types

package
v0.0.0-...-cda3398 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToBigInt

func BytesToBigInt(data []byte) *big.Int

func CreateCoinSet

func CreateCoinSet(zrc20address common.Address, amount *big.Int) (sdk.Coins, error)

func GetCosmosAddress

func GetCosmosAddress(bankKeeper bank.Keeper, addr common.Address) (sdk.AccAddress, error)

GetCosmosAddress returns the counterpart cosmos address of the given ethereum address. It checks if the address is empty or blocked by the bank keeper.

func GetEVMCallerAddress

func GetEVMCallerAddress(evm *vm.EVM, contract *vm.Contract) (common.Address, error)

GetEVMCallerAddress returns the caller address. Usually the caller is the contract.CallerAddress, which is the address of the contract that called the precompiled contract. If contract.CallerAddress != evm.Origin is true, it means the call was made through a contract, on which case there is a need to set the caller to the evm.Origin.

func ZRC20ToCosmosDenom

func ZRC20ToCosmosDenom(ZRC20Address common.Address) string

ZRC20ToCosmosDenom returns the cosmos coin address for a given ZRC20 address. This is converted to "zrc20/{ZRC20Address}".

Types

type BaseContract

type BaseContract interface {
	Registrable
	ContractCaller
}

func NewBaseContract

func NewBaseContract(address common.Address) BaseContract

type ContractCaller

type ContractCaller interface {
	CallContract(
		ctx sdk.Context,
		fungibleKeeper *fungiblekeeper.Keeper,
		abi *abi.ABI,
		dst common.Address,
		method string,
		args []interface{}) ([]interface{}, error)
}

type ErrDisabledMethod

type ErrDisabledMethod struct {
	Method string
}

func (ErrDisabledMethod) Error

func (e ErrDisabledMethod) Error() string

type ErrInsufficientBalance

type ErrInsufficientBalance struct {
	Requested string
	Got       string
}

func (ErrInsufficientBalance) Error

func (e ErrInsufficientBalance) Error() string

type ErrInvalidAddr

type ErrInvalidAddr struct {
	Got    string
	Reason string
}

func (ErrInvalidAddr) Error

func (e ErrInvalidAddr) Error() string

type ErrInvalidAmount

type ErrInvalidAmount struct {
	Got string
}

func (ErrInvalidAmount) Error

func (e ErrInvalidAmount) Error() string

type ErrInvalidArgument

type ErrInvalidArgument struct {
	Got any
}

func (ErrInvalidArgument) Error

func (e ErrInvalidArgument) Error() string

type ErrInvalidCoin

type ErrInvalidCoin struct {
	Got      string
	Negative bool
	Nil      bool
	Empty    bool
}

func (ErrInvalidCoin) Error

func (e ErrInvalidCoin) Error() string

type ErrInvalidMethod

type ErrInvalidMethod struct {
	Method string
}

func (ErrInvalidMethod) Error

func (e ErrInvalidMethod) Error() string

type ErrInvalidNumberOfArgs

type ErrInvalidNumberOfArgs struct {
	Got, Expect int
}

func (ErrInvalidNumberOfArgs) Error

func (e ErrInvalidNumberOfArgs) Error() string

type ErrInvalidToken

type ErrInvalidToken struct {
	Got    string
	Reason string
}

func (ErrInvalidToken) Error

func (e ErrInvalidToken) Error() string

type ErrUnexpected

type ErrUnexpected struct {
	When string
	Got  string
}

func (ErrUnexpected) Error

func (e ErrUnexpected) Error() string

type ErrWriteMethod

type ErrWriteMethod struct {
	Method string
}

func (ErrWriteMethod) Error

func (e ErrWriteMethod) Error() string

type ExtStateDB

type ExtStateDB interface {
	vm.StateDB
	ExecuteNativeAction(
		contract common.Address,
		converter statedb.EventConverter,
		action func(ctx sdk.Context) error,
	) error
	CacheContext() sdk.Context
}

ExtStateDB defines extra methods of statedb to support stateful precompiled contracts. It's used to persist changes into the store.

type Registrable

type Registrable interface {
	RegistryKey() common.Address
}

Jump to

Keyboard shortcuts

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