Documentation ¶
Index ¶
- type FundManager
- 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() error
- func (fm *FundManager) Stop()
- func (fm *FundManager) Withdraw(ctx context.Context, wallet, addr address.Address, amt abi.TokenAmount) (cid.Cid, error)
- type FundManagerAPI
- type FundedAddressState
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FundManager ¶ added in v1.1.3
type FundManager struct {
// contains filtered or unexported fields
}
FundManager keeps track of funds in a set of addresses
func NewFundManager ¶ added in v1.1.3
func NewFundManager(lc fx.Lifecycle, api FundManagerAPI, ds dtypes.MetadataDS) *FundManager
func (*FundManager) Release ¶ added in v1.1.3
func (fm *FundManager) Release(addr address.Address, amt abi.TokenAmount) error
Subtract from `reserved`.
func (*FundManager) Reserve ¶ added in v1.1.3
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 ¶ added in v1.1.3
func (fm *FundManager) Start() error
func (*FundManager) Stop ¶ added in v1.1.3
func (fm *FundManager) Stop()
func (*FundManager) Withdraw ¶ added in v1.1.3
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 FundManagerAPI ¶ added in v1.1.3
API is the fx dependencies need to run a fund manager
type FundedAddressState ¶ added in v1.1.3
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 ¶ added in v1.1.3
func (t *FundedAddressState) MarshalCBOR(w io.Writer) error
func (*FundedAddressState) UnmarshalCBOR ¶ added in v1.1.3
func (t *FundedAddressState) UnmarshalCBOR(r io.Reader) error