Documentation ¶
Index ¶
- type FundManager
- func (fm *FundManager) GetReserved(addr address.Address) abi.TokenAmount
- func (fm *FundManager) Release(addr address.Address, amt abi.TokenAmount) error
- func (fm *FundManager) Reserve(ctx context.Context, wallet, addr address.Address, amt abi.TokenAmount) (cid.Cid, error)
- func (fm *FundManager) Start(ctx context.Context) error
- func (fm *FundManager) Stop()
- func (fm *FundManager) Withdraw(ctx context.Context, wallet, addr address.Address, amt abi.TokenAmount) (cid.Cid, error)
- type FundManagerParams
- type FundedAddressState
- type Store
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) 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