evm

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRequestInterceptor

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

func NewDefaultRequestInterceptor

func NewDefaultRequestInterceptor(
	beRpcBackend berpcbackend.BackendI,
	backend EvmBackendI,
) *DefaultRequestInterceptor

func (*DefaultRequestInterceptor) GetAccount

func (m *DefaultRequestInterceptor) GetAccount(accountAddressStr string) (intercepted, append bool, response berpctypes.GenericBackendResponse, err error)

GetAccount returns the contract information if the account is a contract. Other-wise no-op.

func (*DefaultRequestInterceptor) GetDenomsInformation

func (m *DefaultRequestInterceptor) GetDenomsInformation() (intercepted, append bool, denoms map[string]string, err error)

func (*DefaultRequestInterceptor) GetModuleParams

func (m *DefaultRequestInterceptor) GetModuleParams(moduleName string) (intercepted bool, res berpctypes.GenericBackendResponse, err error)

func (*DefaultRequestInterceptor) GetTransactionByHash

func (m *DefaultRequestInterceptor) GetTransactionByHash(hashStr string) (intercepted bool, response berpctypes.GenericBackendResponse, err error)

type EvmBackend

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

EvmBackend implements the EvmBackendI interface

func NewEvmBackend

func NewEvmBackend(
	ctx *server.Context,
	logger log.Logger,
	clientCtx client.Context,
	externalServices berpctypes.ExternalServices,
) *EvmBackend

NewEvmBackend creates a new EvmBackend instance for EVM Block Explorer

func (*EvmBackend) EvmCall

func (m *EvmBackend) EvmCall(input string, contract common.Address, optionalChainId *hexutil.Big, optionalBlockNumber *hexutil.Uint64, optionalGas uint64) ([]byte, error)

func (*EvmBackend) GetContractCode

func (m *EvmBackend) GetContractCode(contractAddress common.Address) ([]byte, error)

func (*EvmBackend) GetErc20Balance

func (m *EvmBackend) GetErc20Balance(accountAddress common.Address, contractAddresses []common.Address) (berpctypes.GenericBackendResponse, error)

func (*EvmBackend) GetErc20ContractInfo

func (m *EvmBackend) GetErc20ContractInfo(contractAddress common.Address) (berpctypes.GenericBackendResponse, error)

GetErc20ContractInfo will return information of ERC20 contract by address.

  • name (optional): the name of the ERC20 token.
  • symbol (mandatory): the symbol of the ERC20 token.
  • decimals (mandatory): the number of decimals the token uses.

If failed to query any of the mandatory fields, it will return an error. If failed to query the optional field, it will continue.

func (*EvmBackend) GetEvmModuleParams

func (m *EvmBackend) GetEvmModuleParams() (*evmtypes.Params, error)

func (*EvmBackend) GetEvmTransactionByHash

func (m *EvmBackend) GetEvmTransactionByHash(hash common.Hash) (berpctypes.GenericBackendResponse, error)

func (*EvmBackend) GetEvmTransactionInvolversByHash

func (m *EvmBackend) GetEvmTransactionInvolversByHash(hash common.Hash) (berpctypes.MessageInvolversResult, error)

type EvmBackendI

type EvmBackendI interface {

	// GetEvmTransactionByHash returns a transaction by its hash.
	GetEvmTransactionByHash(hash common.Hash) (berpctypes.GenericBackendResponse, error)

	GetEvmTransactionInvolversByHash(hash common.Hash) (berpctypes.MessageInvolversResult, error)

	GetErc20ContractInfo(contractAddress common.Address) (berpctypes.GenericBackendResponse, error)

	GetErc20Balance(accountAddress common.Address, contractAddresses []common.Address) (berpctypes.GenericBackendResponse, error)

	EvmCall(input string, contract common.Address, optionalChainId *hexutil.Big, optionalBlockNumber *hexutil.Uint64, optionalGas uint64) ([]byte, error)

	GetContractCode(contractAddress common.Address) ([]byte, error)

	GetEvmModuleParams() (*evmtypes.Params, error)
}

Jump to

Keyboard shortcuts

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