market

package
v1.2.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2022 License: Apache-2.0, MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FundManager

type FundManager struct {
	// contains filtered or unexported fields
}

FundManager keeps track of funds in a set of addresses

func NewFundManager

func NewFundManager(p *FundManagerParams) *FundManager

func (*FundManager) GetReserved

func (fm *FundManager) GetReserved(addr address.Address) abi.TokenAmount

GetReserved returns the amount that is currently reserved for the address

func (*FundManager) Release

func (fm *FundManager) Release(addr address.Address, amt abi.TokenAmount) error

Subtract from `reserved`.

func (*FundManager) Reserve

func (fm *FundManager) Reserve(ctx context.Context, wallet, addr address.Address, amt abi.TokenAmount) (cid.Cid, error)

Reserve adds amt to `reserved`. If there are not enough available funds for the address, submits a message on chain to top up available funds. Returns the cid of the message that was submitted on chain, or cid.Undef if the required funds were already available.

func (*FundManager) Start

func (fm *FundManager) Start(ctx context.Context) error

func (*FundManager) Stop

func (fm *FundManager) Stop()

func (*FundManager) Withdraw

func (fm *FundManager) Withdraw(ctx context.Context, wallet, addr address.Address, amt abi.TokenAmount) (cid.Cid, error)

Withdraw unreserved funds. Only succeeds if there are enough unreserved funds for the address. Returns the cid of the message that was submitted on chain.

type FundManagerParams

type FundManagerParams struct {
	MP v1api.IMessagePool
	CI v1api.IChainInfo
	MS v1api.IMinerState
	DS repo.Datastore
}

type FundedAddressState

type FundedAddressState struct {
	Addr address.Address
	// AmtReserved is the amount that must be kept in the address (cannot be
	// withdrawn)
	AmtReserved abi.TokenAmount
	// MsgCid is the cid of an in-progress on-chain message
	MsgCid *cid.Cid
}

FundedAddressState keeps track of the state of an address with funds in the datastore

func (*FundedAddressState) MarshalCBOR

func (t *FundedAddressState) MarshalCBOR(w io.Writer) error

func (*FundedAddressState) UnmarshalCBOR

func (t *FundedAddressState) UnmarshalCBOR(r io.Reader) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL