Documentation
¶
Index ¶
- Constants
- Variables
- type BnOptions
- type Client
- func (cl *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (cl *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error)
- func (cl *Client) GetBalance(ctx context.Context, hexAddr string) (*big.Int, error)
- func (cl *Client) GetBlockByHash(hash common.Hash) (*types.Block, error)
- func (cl *Client) GetBlockNumber() (uint64, error)
- func (cl *Client) GetBlockReceipts(hash common.Hash) (ethTypes.Receipts, error)
- func (c *Client) GetChainID() *big.Int
- func (c *Client) GetEthClient() *ethclient.Client
- func (cl *Client) GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error)
- func (cl *Client) GetMedianGasPriceForBlock(ctx context.Context) (gasPrice *big.Int, gasHeight *big.Int, err error)
- func (c *Client) Log() *zap.Logger
- func (c *Client) MessageReceived(opts *bind.CallOpts, srcNetwork string, _connSn *big.Int) (bool, error)
- func (cl *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (cl *Client) ParseMessage(log ethTypes.Log) (*bridgeContract.AbiMessage, error)
- func (c *Client) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error)
- func (c *Client) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
- func (c *Client) SendMessage(opts *bind.TransactOpts, _to string, _svc string, _sn *big.Int, _msg []byte) (*ethTypes.Transaction, error)
- func (c *Client) SendTransaction(ctx context.Context, tx *ethTypes.Transaction) error
- func (c *Client) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error)
- func (cl *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (cl *Client) TransactionByHash(ctx context.Context, blockHash common.Hash) (tx *ethTypes.Transaction, isPending bool, err error)
- func (cl *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (cl *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*ethTypes.Transaction, error)
- func (cl *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
- type EVMProvider
- func (p *EVMProvider) AddressFromKeyStore(keystoreFile, auth string) (string, error)
- func (p *EVMProvider) ChainName() string
- func (p *EVMProvider) FinalityBlock(ctx context.Context) uint64
- func (p *EVMProvider) FindMessages(ctx context.Context, lbn *types.BlockNotification) ([]*relayertypes.Message, error)
- func (ip *EVMProvider) GenerateMessage(ctx context.Context, key *types.MessageKeyWithMessageHeight) (*types.Message, error)
- func (p *EVMProvider) GetConcurrency(ctx context.Context, startHeight, currentHeight uint64) int
- func (p *EVMProvider) GetTransationOpts(ctx context.Context) (*bind.TransactOpts, error)
- func (p *EVMProvider) Init(ctx context.Context, homePath string, kms kms.KMS) error
- func (r *EVMProvider) Listener(ctx context.Context, lastSavedHeight uint64, ...) error
- func (p *EVMProvider) LogFailedTx(messageKey providerTypes.MessageKey, result *types.Receipt, err error)
- func (p *EVMProvider) LogSuccessTx(messageKey providerTypes.MessageKey, receipt *types.Receipt)
- func (p *EVMProvider) MessageReceived(ctx context.Context, messageKey types.MessageKey) (bool, error)
- func (p *EVMProvider) NID() string
- func (p *EVMProvider) NewKeyStore(dir, password string) (string, error)
- func (p *EVMProvider) ProviderConfig() provider.ProviderConfig
- func (p *EVMProvider) QueryBalance(ctx context.Context, addr string) (*types.Coin, error)
- func (p *EVMProvider) QueryLatestHeight(ctx context.Context) (height uint64, err error)
- func (icp *EVMProvider) QueryTransactionReceipt(ctx context.Context, txHash string) (*types.Receipt, error)
- func (p *EVMProvider) RestoreKeyStore(ctx context.Context, homepath string, client kms.KMS) error
- func (p *EVMProvider) RevertMessage(ctx context.Context, sn *big.Int) error
- func (p *EVMProvider) Route(ctx context.Context, message *providerTypes.Message, ...) error
- func (p *EVMProvider) SendTransaction(ctx context.Context, opts *bind.TransactOpts, message *providerTypes.Message, ...) (*types.Transaction, error)
- func (p *EVMProvider) SetAdmin(ctx context.Context, admin string) error
- func (p *EVMProvider) ShouldReceiveMessage(ctx context.Context, messagekey types.Message) (bool, error)
- func (p *EVMProvider) ShouldSendMessage(ctx context.Context, messageKey types.Message) (bool, error)
- func (p *EVMProvider) Type() string
- func (p *EVMProvider) WaitForResults(ctx context.Context, txHash common.Hash) (txr *ethTypes.Receipt, err error)
- func (p *EVMProvider) WaitForTxResult(ctx context.Context, tx *types.Transaction, ...)
- func (p *EVMProvider) Wallet() (*keystore.Key, error)
- type EVMProviderConfig
- type IClient
Constants ¶
View Source
const ( RPCCallRetry = 5 MaxGasPriceInceremtRetry = 10 GasPriceRatio = 10.0 )
View Source
const ( BlockInterval = 2 * time.Second BlockHeightPollInterval = 60 * time.Second DefaultFinalityBlock = 10 )
View Source
const ( ErrorLessGas = "transaction underpriced" ErrorLimitLessThanGas = "max fee per gas less than block base fee" ErrUnKnown = "unknown" ErrMaxTried = "max tried" ErrNonceTooLow = "nonce too low" )
View Source
const (
EmitMessageSig = "Message(string,uint256,bytes)"
)
All the events
Variables ¶
View Source
var MonitorEvents []common.Hash = []common.Hash{ crypto.Keccak256Hash([]byte(EmitMessageSig)), }
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // evm chain ID EVMChainID *big.Int // contains filtered or unexported fields }
grouped rpc api clients
func (*Client) CallContract ¶
func (*Client) FilterLogs ¶
func (*Client) GetBalance ¶
func (*Client) GetBlockByHash ¶
func (*Client) GetBlockNumber ¶
func (*Client) GetBlockReceipts ¶
func (*Client) GetChainID ¶
func (*Client) GetEthClient ¶
func (*Client) GetHeaderByHeight ¶
func (*Client) GetMedianGasPriceForBlock ¶
func (*Client) MessageReceived ¶
func (*Client) ParseMessage ¶
func (cl *Client) ParseMessage(log ethTypes.Log) (*bridgeContract.AbiMessage, error)
func (*Client) ReceiveMessage ¶
func (c *Client) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error)
func (*Client) RevertMessage ¶
func (c *Client) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
func (*Client) SendMessage ¶
func (*Client) SendTransaction ¶
func (*Client) SetAdmin ¶
func (c *Client) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error)
func (*Client) SuggestGasPrice ¶
func (*Client) TransactionByHash ¶
func (*Client) TransactionCount ¶
func (*Client) TransactionInBlock ¶
type EVMProvider ¶
type EVMProvider struct { StartHeight uint64 // contains filtered or unexported fields }
func (*EVMProvider) AddressFromKeyStore ¶
func (p *EVMProvider) AddressFromKeyStore(keystoreFile, auth string) (string, error)
AddressFromKeyStore returns the address of the key stored in the given keystore file.
func (*EVMProvider) ChainName ¶
func (p *EVMProvider) ChainName() string
func (*EVMProvider) FinalityBlock ¶
func (p *EVMProvider) FinalityBlock(ctx context.Context) uint64
func (*EVMProvider) FindMessages ¶
func (p *EVMProvider) FindMessages(ctx context.Context, lbn *types.BlockNotification) ([]*relayertypes.Message, error)
func (*EVMProvider) GenerateMessage ¶
func (ip *EVMProvider) GenerateMessage(ctx context.Context, key *types.MessageKeyWithMessageHeight) (*types.Message, error)
TODO: may not be need anytime soon so its ok to implement later on
func (*EVMProvider) GetConcurrency ¶
func (p *EVMProvider) GetConcurrency(ctx context.Context, startHeight, currentHeight uint64) int
func (*EVMProvider) GetTransationOpts ¶
func (p *EVMProvider) GetTransationOpts(ctx context.Context) (*bind.TransactOpts, error)
func (*EVMProvider) Listener ¶
func (r *EVMProvider) Listener(ctx context.Context, lastSavedHeight uint64, blockInfoChan chan relayertypes.BlockInfo) error
func (*EVMProvider) LogFailedTx ¶
func (p *EVMProvider) LogFailedTx(messageKey providerTypes.MessageKey, result *types.Receipt, err error)
func (*EVMProvider) LogSuccessTx ¶
func (p *EVMProvider) LogSuccessTx(messageKey providerTypes.MessageKey, receipt *types.Receipt)
func (*EVMProvider) MessageReceived ¶
func (p *EVMProvider) MessageReceived(ctx context.Context, messageKey types.MessageKey) (bool, error)
func (*EVMProvider) NID ¶
func (p *EVMProvider) NID() string
func (*EVMProvider) NewKeyStore ¶
func (p *EVMProvider) NewKeyStore(dir, password string) (string, error)
func (*EVMProvider) ProviderConfig ¶
func (p *EVMProvider) ProviderConfig() provider.ProviderConfig
func (*EVMProvider) QueryBalance ¶
func (*EVMProvider) QueryLatestHeight ¶
func (p *EVMProvider) QueryLatestHeight(ctx context.Context) (height uint64, err error)
func (*EVMProvider) QueryTransactionReceipt ¶
func (*EVMProvider) RestoreKeyStore ¶
func (*EVMProvider) RevertMessage ¶
RevertMessage
func (*EVMProvider) Route ¶
func (p *EVMProvider) Route(ctx context.Context, message *providerTypes.Message, callback providerTypes.TxResponseFunc) error
this will be executed in go route
func (*EVMProvider) SendTransaction ¶
func (p *EVMProvider) SendTransaction(ctx context.Context, opts *bind.TransactOpts, message *providerTypes.Message, maxRetry uint8) (*types.Transaction, error)
func (*EVMProvider) SetAdmin ¶
func (p *EVMProvider) SetAdmin(ctx context.Context, admin string) error
SetAdmin sets the admin address of the bridge contract
func (*EVMProvider) ShouldReceiveMessage ¶
func (*EVMProvider) ShouldSendMessage ¶
func (*EVMProvider) Type ¶
func (p *EVMProvider) Type() string
func (*EVMProvider) WaitForResults ¶
func (*EVMProvider) WaitForTxResult ¶
func (p *EVMProvider) WaitForTxResult( ctx context.Context, tx *types.Transaction, messageKey providerTypes.MessageKey, callback providerTypes.TxResponseFunc, )
type EVMProviderConfig ¶
type EVMProviderConfig struct { ChainName string `json:"-" yaml:"-"` RPCUrl string `json:"rpc-url" yaml:"rpc-url"` VerifierRPCUrl string `json:"verifier-rpc-url" yaml:"verifier-rpc-url"` StartHeight uint64 `json:"start-height" yaml:"start-height"` Keystore string `json:"keystore" yaml:"keystore"` Password string `json:"password" yaml:"password"` GasPrice int64 `json:"gas-price" yaml:"gas-price"` GasLimit uint64 `json:"gas-limit" yaml:"gas-limit"` ContractAddress string `json:"contract-address" yaml:"contract-address"` Concurrency uint64 `json:"concurrency" yaml:"concurrency"` FinalityBlock uint64 `json:"finality-block" yaml:"finality-block"` NID string `json:"nid" yaml:"nid"` }
func (*EVMProviderConfig) GetWallet ¶
func (p *EVMProviderConfig) GetWallet() string
func (*EVMProviderConfig) NewProvider ¶
func (p *EVMProviderConfig) NewProvider(log *zap.Logger, homepath string, debug bool, chainName string) (provider.ChainProvider, error)
func (*EVMProviderConfig) SetWallet ¶
func (p *EVMProviderConfig) SetWallet(addr string)
func (*EVMProviderConfig) Validate ¶
func (p *EVMProviderConfig) Validate() error
type IClient ¶
type IClient interface { Log() *zap.Logger GetBalance(ctx context.Context, hexAddr string) (*big.Int, error) GetBlockNumber() (uint64, error) GetBlockByHash(hash common.Hash) (*types.Block, error) GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error) GetBlockReceipts(hash common.Hash) (ethTypes.Receipts, error) GetMedianGasPriceForBlock(ctx context.Context) (gasPrice *big.Int, gasHeight *big.Int, err error) GetChainID() *big.Int // ethClient FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error) SuggestGasPrice(ctx context.Context) (*big.Int, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) TransactionByHash(ctx context.Context, blockHash common.Hash) (tx *ethTypes.Transaction, isPending bool, err error) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*ethTypes.Transaction, error) // transaction SendTransaction(ctx context.Context, tx *ethTypes.Transaction) error // abiContract ParseMessage(log ethTypes.Log) (*bridgeContract.AbiMessage, error) SendMessage(opts *bind.TransactOpts, _to string, _svc string, _sn *big.Int, _msg []byte) (*ethTypes.Transaction, error) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error) MessageReceived(opts *bind.CallOpts, srcNetwork string, _connSn *big.Int) (bool, error) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.