fundmanager

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0, MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientFunds = errors.New("insufficient funds")

Functions

func New

func New(cfg Config) func(api v1api.FullNode, fundsDB *db.FundsDB) *FundManager

Types

type Config

type Config struct {
	// The address of the storage miner, used as the target address when
	// moving funds to escrow
	StorageMiner address.Address
	// Wallet used as source of deal collateral when moving funds to
	// escrow
	CollatWallet address.Address
	// Wallet used to send the publish message (and pay gas fees)
	PubMsgWallet address.Address
	// How much to reserve for each publish message
	PubMsgBalMin abi.TokenAmount
}

type FundManager

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

func (*FundManager) AddressDealCollateral

func (m *FundManager) AddressDealCollateral() address.Address

func (*FundManager) AddressPublishMsg

func (m *FundManager) AddressPublishMsg() address.Address

func (*FundManager) BalanceDealCollateral

func (m *FundManager) BalanceDealCollateral(ctx context.Context) (abi.TokenAmount, error)

BalanceDealCollateral returns the amount of funds in the wallet used for collateral for deal making

func (*FundManager) BalanceMarket

func (m *FundManager) BalanceMarket(ctx context.Context) (storagemarket.Balance, error)

BalanceMarket returns available and locked amounts in escrow (on chain with the Storage Market Actor)

func (*FundManager) BalancePublishMsg

func (m *FundManager) BalancePublishMsg(ctx context.Context) (abi.TokenAmount, error)

BalancePublishMsg returns the amount of funds in the wallet used to send publish storage deals messages

func (*FundManager) MoveFundsToEscrow

func (m *FundManager) MoveFundsToEscrow(ctx context.Context, amt abi.TokenAmount) (cid.Cid, error)

MoveFundsToEscrow moves funds from the deal collateral wallet into escrow with the storage market actor

func (*FundManager) TagFunds

func (m *FundManager) TagFunds(ctx context.Context, dealUuid uuid.UUID, proposal market.DealProposal) (*TagFundsResp, error)

TagFunds tags funds for deal collateral and for the publish storage deals message, so those funds cannot be used for other deals. It returns ErrInsufficientFunds if there are not enough funds available in the respective wallets to cover either of these operations.

func (*FundManager) TotalTagged

func (m *FundManager) TotalTagged(ctx context.Context) (*db.TotalTagged, error)

TotalTagged returns the total funds tagged for specific deals for collateral and publish storage deals message

func (*FundManager) UntagFunds

func (m *FundManager) UntagFunds(ctx context.Context, dealUuid uuid.UUID) (collat, pub abi.TokenAmount, err error)

UntagFunds untags funds that were associated (tagged) with a deal. It's called when it's no longer necessary to prevent the funds from being used for a different deal (eg because the deal failed / was published)

type TagFundsResp

type TagFundsResp struct {
	Collateral     abi.TokenAmount
	PublishMessage abi.TokenAmount

	TotalCollateral     abi.TokenAmount
	TotalPublishMessage abi.TokenAmount

	AvailableCollateral     abi.TokenAmount
	AvailablePublishMessage abi.TokenAmount
}

Jump to

Keyboard shortcuts

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