Documentation ¶
Index ¶
- Constants
- func IsAVAX(token string) bool
- func LatestAggregatorContracts() []common.Address
- type AvalancheClient
- func (c *AvalancheClient) AddSignedTxItem(hash string, height int64, vaultPubKey string) error
- func (c *AvalancheClient) BroadcastTx(txOutItem stypes.TxOutItem, hexTx []byte) (string, error)
- func (c *AvalancheClient) ConfirmationCountReady(txIn stypes.TxIn) bool
- func (c *AvalancheClient) GetAccount(pk common.PubKey, height *big.Int) (common.Account, error)
- func (c *AvalancheClient) GetAccountByAddress(address string, height *big.Int) (common.Account, error)
- func (c *AvalancheClient) GetAddress(poolPubKey common.PubKey) string
- func (c *AvalancheClient) GetBalance(addr, token string, height *big.Int) (*big.Int, error)
- func (c *AvalancheClient) GetBalances(addr string, height *big.Int) (common.Coins, error)
- func (c *AvalancheClient) GetChain() common.Chain
- func (c *AvalancheClient) GetConfig() config.BifrostChainConfiguration
- func (c *AvalancheClient) GetConfirmationCount(txIn stypes.TxIn) int64
- func (c *AvalancheClient) GetGasFee(gas uint64) common.Gas
- func (c *AvalancheClient) GetGasPrice() *big.Int
- func (c *AvalancheClient) GetHeight() (int64, error)
- func (c *AvalancheClient) IsBlockScannerHealthy() bool
- func (c *AvalancheClient) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)
- func (c *AvalancheClient) ReportSolvency(avaxBlockHeight int64) error
- func (c *AvalancheClient) ShouldReportSolvency(height int64) bool
- func (c *AvalancheClient) SignTx(tx stypes.TxOutItem, height int64) ([]byte, []byte, error)
- func (c *AvalancheClient) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, ...)
- func (c *AvalancheClient) Stop()
- type AvalancheScanner
- func (a *AvalancheScanner) FetchMemPool(_ int64) (stypes.TxIn, error)
- func (a *AvalancheScanner) FetchTxs(height int64) (stypes.TxIn, error)
- func (a *AvalancheScanner) GetGasPrice() *big.Int
- func (a *AvalancheScanner) GetHeight() (int64, error)
- func (a *AvalancheScanner) GetNonce(addr string) (uint64, error)
- func (a *AvalancheScanner) GetTokens() ([]*evmtypes.TokenMeta, error)
- type SolvencyReporter
Constants ¶
const ( BlockCacheSize = 6000 MaxContractGas = 80000 GasPriceResolution int64 = 250000000000 // wei per gas unit (250 gwei) )
const TxWaitBlocks = 150
This is the number of THORChain blocks to wait before re-broadcasting a stuck tx with more gas. 150 was chosen because the signing period for outbounds is 300 blocks. After 300 blocks the tx will be re-assigned to a different vault, so we want to try to push the tx through before that
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AvalancheClient ¶
type AvalancheClient struct {
// contains filtered or unexported fields
}
AvalancheClient is a structure to sign and broadcast tx to the Avalanche C-Chain
func NewAvalancheClient ¶
func NewAvalancheClient(thorKeys *mayaclient.Keys, cfg config.BifrostChainConfiguration, server *tssp.TssServer, bridge mayaclient.MayachainBridge, m *metrics.Metrics, pubkeyMgr pubkeymanager.PubKeyValidator, poolMgr mayaclient.PoolManager, ) (*AvalancheClient, error)
NewAvalancheClient creates new instance of an AvalancheClient
func (*AvalancheClient) AddSignedTxItem ¶
func (c *AvalancheClient) AddSignedTxItem(hash string, height int64, vaultPubKey string) error
AddSignedTxItem add the transaction to key value store
func (*AvalancheClient) BroadcastTx ¶
BroadcastTx decodes tx using rlp and broadcasts to the AVAX C-Chain
func (*AvalancheClient) ConfirmationCountReady ¶
func (c *AvalancheClient) ConfirmationCountReady(txIn stypes.TxIn) bool
ConfirmationCountReady - AVAX C-Chain has instant finality, THORChain can accept the tx instantly
func (*AvalancheClient) GetAccount ¶
GetAccount gets account by address in avax client
func (*AvalancheClient) GetAccountByAddress ¶
func (c *AvalancheClient) GetAccountByAddress(address string, height *big.Int) (common.Account, error)
GetAccountByAddress return account information
func (*AvalancheClient) GetAddress ¶
func (c *AvalancheClient) GetAddress(poolPubKey common.PubKey) string
GetAddress returns the current signer address, it will be bech32 encoded address
func (*AvalancheClient) GetBalance ¶
GetBalance call smart contract to find out the balance of the given address and token
func (*AvalancheClient) GetBalances ¶
GetBalances gets all the balances of the given address
func (*AvalancheClient) GetChain ¶
func (c *AvalancheClient) GetChain() common.Chain
GetChain gets chain
func (*AvalancheClient) GetConfig ¶
func (c *AvalancheClient) GetConfig() config.BifrostChainConfiguration
GetConfig return the configurations used by AVAX chain client
func (*AvalancheClient) GetConfirmationCount ¶
func (c *AvalancheClient) GetConfirmationCount(txIn stypes.TxIn) int64
GetConfirmationCount - AVAX C-Chain has instant finality, so return 0
func (*AvalancheClient) GetGasFee ¶
func (c *AvalancheClient) GetGasFee(gas uint64) common.Gas
GetGasFee gets gas fee
func (*AvalancheClient) GetGasPrice ¶
func (c *AvalancheClient) GetGasPrice() *big.Int
GetGasPrice gets gas price from eth scanner
func (*AvalancheClient) GetHeight ¶
func (c *AvalancheClient) GetHeight() (int64, error)
GetHeight gets height from avax scanner
func (*AvalancheClient) IsBlockScannerHealthy ¶
func (c *AvalancheClient) IsBlockScannerHealthy() bool
IsBlockScannerHealthy returns if the block scanner is healthy or not
func (*AvalancheClient) OnObservedTxIn ¶
func (c *AvalancheClient) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)
OnObservedTxIn gets called from observer when we have a valid observation
func (*AvalancheClient) ReportSolvency ¶
func (c *AvalancheClient) ReportSolvency(avaxBlockHeight int64) error
func (*AvalancheClient) ShouldReportSolvency ¶
func (c *AvalancheClient) ShouldReportSolvency(height int64) bool
ShouldReportSolvency with given block height, should chain client report Solvency to THORNode? AVAX C-Chain blocktime is around 2 seconds
func (*AvalancheClient) Start ¶
func (c *AvalancheClient) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, globalSolvencyQueue chan stypes.Solvency)
Start to monitor the AVAX C-Chain
type AvalancheScanner ¶
type AvalancheScanner struct {
// contains filtered or unexported fields
}
AvalancheScanner is a scanner that understand how to interact with and scan blocks of the AVAX C-chain
func NewAVAXScanner ¶
func NewAVAXScanner(cfg config.BifrostBlockScannerConfiguration, storage blockscanner.ScannerStorage, chainID *big.Int, ethClient *ethclient.Client, ethRpc *evm.EthRPC, bridge mayaclient.MayachainBridge, m *metrics.Metrics, pubkeyMgr pubkeymanager.PubKeyValidator, solvencyReporter SolvencyReporter, signerCacheManager *signercache.CacheManager, ) (*AvalancheScanner, error)
Creates a new instance of AvalancheScanner
func (*AvalancheScanner) FetchMemPool ¶
func (a *AvalancheScanner) FetchMemPool(_ int64) (stypes.TxIn, error)
FetchMemPool gets tx from mempool
func (*AvalancheScanner) FetchTxs ¶
func (a *AvalancheScanner) FetchTxs(height int64) (stypes.TxIn, error)
FetchTxs query the AVAX C-Chain to get txs in the given block height
func (*AvalancheScanner) GetGasPrice ¶
func (a *AvalancheScanner) GetGasPrice() *big.Int
GetGasPrice returns current gas price
func (*AvalancheScanner) GetHeight ¶
func (a *AvalancheScanner) GetHeight() (int64, error)
GetHeight return latest block height
type SolvencyReporter ¶
SolvencyReporter is to report solvency info to THORNode