evm

package
v1.127.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 45 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EVMClient

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

EVMClient is a generic client for interacting with EVM chains.

func NewEVMClient

NewEVMClient creates a new EVMClient.

func (*EVMClient) AddSignedTxItem

func (c *EVMClient) AddSignedTxItem(hash string, height int64, vaultPubKey string, toi *stypes.TxOutItem) error

AddSignedTxItem add the transaction to key value store

func (*EVMClient) BroadcastTx

func (c *EVMClient) BroadcastTx(txOutItem stypes.TxOutItem, hexTx []byte) (string, error)

BroadcastTx broadcasts the transaction and returns the transaction hash.

func (*EVMClient) ConfirmationCountReady

func (c *EVMClient) ConfirmationCountReady(txIn stypes.TxIn) bool

ConfirmationCountReady returns true if the confirmation count is ready.

func (*EVMClient) GetAccount

func (c *EVMClient) GetAccount(pk common.PubKey, height *big.Int) (common.Account, error)

GetAccount returns the account for the given public key.

func (*EVMClient) GetAccountByAddress

func (c *EVMClient) GetAccountByAddress(address string, height *big.Int) (common.Account, error)

GetAccountByAddress returns the account for the given address.

func (*EVMClient) GetAddress

func (c *EVMClient) GetAddress(poolPubKey common.PubKey) string

GetAddress returns the address for the given public key.

func (*EVMClient) GetBalance

func (c *EVMClient) GetBalance(addr, token string, height *big.Int) (*big.Int, error)

GetBalance returns the balance of the provided address.

func (*EVMClient) GetBalances

func (c *EVMClient) GetBalances(addr string, height *big.Int) (common.Coins, error)

GetBalances returns the balances of the provided address.

func (*EVMClient) GetBlockScannerHeight added in v1.125.0

func (c *EVMClient) GetBlockScannerHeight() (int64, error)

GetBlockScannerHeight returns blockscanner height

func (*EVMClient) GetChain

func (c *EVMClient) GetChain() common.Chain

GetChain returns the chain.

func (*EVMClient) GetConfig

GetConfig returns the chain configuration.

func (*EVMClient) GetConfirmationCount

func (c *EVMClient) GetConfirmationCount(txIn stypes.TxIn) int64

GetConfirmationCount returns the confirmation count for the given tx.

func (*EVMClient) GetGasFee

func (c *EVMClient) GetGasFee(gas uint64) common.Gas

GetGasFee returns the gas fee based on the current gas price.

func (*EVMClient) GetGasPrice

func (c *EVMClient) GetGasPrice() *big.Int

GetGasPrice returns the current gas price.

func (*EVMClient) GetHeight

func (c *EVMClient) GetHeight() (int64, error)

GetHeight returns the current height of the chain.

func (*EVMClient) GetLatestTxForVault added in v1.125.0

func (c *EVMClient) GetLatestTxForVault(vault string) (string, string, error)

func (*EVMClient) IsBlockScannerHealthy

func (c *EVMClient) IsBlockScannerHealthy() bool

IsBlockScannerHealthy returns true if the block scanner is healthy.

func (*EVMClient) OnObservedTxIn

func (c *EVMClient) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)

OnObservedTxIn is called when a new observed tx is received.

func (*EVMClient) ReportSolvency

func (c *EVMClient) ReportSolvency(height int64) error

ReportSolvency reports solvency once per configured solvency blocks.

func (*EVMClient) ShouldReportSolvency

func (c *EVMClient) ShouldReportSolvency(height int64) bool

ShouldReportSolvency returns true if the given height is a solvency report height.

func (*EVMClient) SignTx

func (c *EVMClient) SignTx(tx stypes.TxOutItem, height int64) ([]byte, []byte, *stypes.TxInItem, error)

SignTx returns the signed transaction.

func (*EVMClient) Start

func (c *EVMClient) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, globalSolvencyQueue chan stypes.Solvency)

Start starts the chain client with the given queues.

func (*EVMClient) Stop

func (c *EVMClient) Stop()

Stop stops the chain client.

type EVMScanner

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

func NewEVMScanner

func NewEVMScanner(cfg config.BifrostBlockScannerConfiguration,
	storage blockscanner.ScannerStorage,
	chainID *big.Int,
	ethClient *ethclient.Client,
	ethRpc *evm.EthRPC,
	bridge thorclient.ThorchainBridge,
	m *metrics.Metrics,
	pubkeyMgr pubkeymanager.PubKeyValidator,
	solvencyReporter SolvencyReporter,
	signerCacheManager *signercache.CacheManager,
) (*EVMScanner, error)

NewEVMScanner create a new instance of EVMScanner.

func (*EVMScanner) FetchMemPool

func (e *EVMScanner) FetchMemPool(_ int64) (stypes.TxIn, error)

FetchMemPool returns all transactions in the mempool.

func (*EVMScanner) FetchTxs

func (e *EVMScanner) FetchTxs(height, chainHeight int64) (stypes.TxIn, error)

FetchTxs extracts all relevant transactions from the block at the provided height.

func (*EVMScanner) GetGasPrice

func (e *EVMScanner) GetGasPrice() *big.Int

GetGasPrice returns the current gas price.

func (*EVMScanner) GetHeight

func (e *EVMScanner) GetHeight() (int64, error)

GetHeight returns the current block height.

func (*EVMScanner) GetNonce

func (e *EVMScanner) GetNonce(addr string) (uint64, error)

GetNonce returns the nonce (including pending) for the given address.

func (*EVMScanner) GetNonceFinalized added in v1.126.0

func (e *EVMScanner) GetNonceFinalized(addr string) (uint64, error)

GetNonceFinalized returns the nonce for the given address.

func (*EVMScanner) GetTokens

func (e *EVMScanner) GetTokens() ([]*evmtypes.TokenMeta, error)

GetTokens returns all token meta data.

Jump to

Keyboard shortcuts

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