Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckOption ¶
type CheckOption func(*config)
func WithChainParams ¶
func WithChainParams(p map[uint64]Params) CheckOption
func WithCheckers ¶
func WithCheckers(rs ...Checker) CheckOption
func WithConcurrency ¶
func WithConcurrency(n int) CheckOption
func WithLowGasLimit ¶
func WithLowGasLimit(l *big.Int) CheckOption
func WithTimeout ¶
func WithTimeout(d time.Duration) CheckOption
type Checker ¶
type Checker interface {
Family() string
Decimals(cldfchain.BlockChain) uint8
Address(cldfchain.BlockChain) (string, error)
Balance(context.Context, cldfchain.BlockChain) (*big.Int, error)
EstimateThreshold(context.Context, cldfchain.BlockChain, *big.Int) (*big.Int, error)
}
Checker knows how to read the signer address and native balance for one chain family.
type Params ¶
type Params struct {
LowBalanceThreshold *big.Int `json:"low_balance_threshold,omitempty" yaml:"low_balance_threshold"`
LowBalanceGasLimit *big.Int `json:"low_balance_gas_limit,omitempty" yaml:"low_balance_gas_limit"`
}
Params holds the parameters used for the balance check. LowBalanceThreshold is the absolute amount compared against the signer balance, in base units of the native token (e.g. "50000000000000000"). LowGasLimit is the gas limit used to estimate the threshold if LowBalanceThreshold is not set. It is multiplied by the suggested gas price to arrive at a LowBalanceThreshold.
type Result ¶
type Result struct {
ChainSelector uint64 `json:"chain_selector"`
ChainName string `json:"chain_name"`
Family string `json:"family"`
Address string `json:"address,omitempty"`
Balance string `json:"balance,omitempty"` // base units (wei, lamports, ...)
BalanceFormatted string `json:"balance_formatted,omitempty"` // human units
Threshold string `json:"threshold,omitempty"` // base units (wei, lamports, ...)
ThresholdFormatted string `json:"threshold_formatted,omitempty"` // human units
Status Status `json:"status"`
Message string `json:"message,omitempty"`
}
func Check ¶
func Check(ctx context.Context, chains cldfchain.BlockChains, opts ...CheckOption) []Result
Check reads the signer balance on every chain and classifies it against thresholds. It never returns an error: per-chain failures are reported as StatusError.