market

package
v1.26.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 26 Imported by: 9

Documentation

Index

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) GetReserved added in v1.4.1

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

GetReserved returns the amount that is currently reserved for the address

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

type FundManagerAPI struct {
	fx.In

	full.StateAPI
	full.MpoolAPI
}

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) (err error)

type Store added in v1.1.3

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