inventory

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package inventory contains the inventory manager. the inventory manager is one of the core pieces of the program which manages the currently available inventory.

"All" (committed & uncommitted inventory) is considered to be the current balance on all chains (so, you if you iterate through all erc-20's and call balanceOf()) that is the "All" inventory "Commitable" inventory is "All" inventory net of current commitments. Commitments occur when a user bridge request comes in and the relayer internally commits to filling it. This prevents overcommiting erc-20 balances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceFetchArgOption

type BalanceFetchArgOption func(options *balanceFetchOptions)

BalanceFetchArgOption is an option that can be passed into a balance fetch request. we do this to allow optional args.

func SkipCache

func SkipCache() BalanceFetchArgOption

SkipCache allows someone fetching balance(s) to skip the cache.

type Manager

type Manager interface {
	// GetCommittableBalance gets the total balance available for quotes
	// this does not include on-chain balances committed in previous quotes that may be
	// refunded in the event of a revert.
	GetCommittableBalance(ctx context.Context, chainID int, token common.Address, options ...BalanceFetchArgOption) (*big.Int, error)
	// GetCommittableBalances gets the total balances committable for all tracked tokens.
	GetCommittableBalances(ctx context.Context, options ...BalanceFetchArgOption) (map[int]map[common.Address]*big.Int, error)
	// ApproveAllTokens approves all tokens for the relayer address.
	ApproveAllTokens(ctx context.Context, submitter submitter.TransactionSubmitter) error
	// HasSufficientGas checks if there is sufficient gas for a given route.
	HasSufficientGas(ctx context.Context, origin, dest int) (bool, error)
}

Manager is the interface for the inventory manager.

func NewInventoryManager

func NewInventoryManager(ctx context.Context, clientFetcher submitter.ClientFetcher, handler metrics.Handler, cfg relconfig.Config, relayer common.Address, db reldb.Service) (Manager, error)

NewInventoryManager creates a list of tokens we should use.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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