keeper

package
v0.0.0-...-039593e Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsistentBalanceInvariant

func ConsistentBalanceInvariant(k Keeper) sdk.Invariant

ConsistentBalanceInvariant checks that all accounts have consistent balances in bank and erc20

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the erc20 module invariants

Types

type EvmHooks

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

EvmHooks wrapper struct for erc20 keeper

func (EvmHooks) PostTxProcessing

func (h EvmHooks) PostTxProcessing(
	ctx sdk.Context,
	msg core.Message,
	receipt *ethtypes.Receipt,
) error

PostTxProcessing implements evmtypes.EvmHooks.PostTxProcessing

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey sdk.StoreKey,
	ps paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	evmKeeper types.EVMKeeper,
) *Keeper

func (Keeper) CallEVM

func (k Keeper) CallEVM(
	ctx sdk.Context,
	abi abi.ABI,
	from, contract common.Address,
	method string,
	args ...interface{},
) (*evmtypes.MsgEthereumTxResponse, error)

CallEVM performs a smart contract method call using given args

func (Keeper) CallEVMWithData

func (k Keeper) CallEVMWithData(
	ctx sdk.Context,
	from common.Address,
	contract *common.Address,
	data []byte,
) (*evmtypes.MsgEthereumTxResponse, error)

CallEVMWithData performs a smart contract method call using contract data

func (Keeper) CreateCoinMetadata

func (k Keeper) CreateCoinMetadata(ctx sdk.Context, contract common.Address) (*banktypes.Metadata, error)

CreateCoinMetadata generates the coin metadata to represent the ERC20 token.

func (Keeper) DeleteTokenPair

func (k Keeper) DeleteTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

DeleteTokenPair removes a token pair.

func (Keeper) DeployERC20Contract

func (k Keeper) DeployERC20Contract(
	ctx sdk.Context,
	coinMetadata banktypes.Metadata,
) (common.Address, error)

DeployERC20Contract creates and deploys an ERC20 contract on the EVM with the erc20 module account as owner.

func (Keeper) EvmHooks

func (k Keeper) EvmHooks() EvmHooks

EvmHooks returns the wrapper struct

func (Keeper) GetAllTokenPairs

func (k Keeper) GetAllTokenPairs(ctx sdk.Context) []types.TokenPair

GetAllTokenPairs gets all registered token tokenPairs

func (Keeper) GetBalance

func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin

func (Keeper) GetDenomMap

func (k Keeper) GetDenomMap(ctx sdk.Context, denom string) []byte

GetDenomMap returns the token pair id for the given denomination

func (Keeper) GetERC20Map

func (k Keeper) GetERC20Map(ctx sdk.Context, erc20 common.Address) []byte

GetERC20Map returns the token pair id for the given address

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams get all parameters as types.Params

func (Keeper) GetSupply

func (k Keeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin

func (Keeper) GetTokenPair

func (k Keeper) GetTokenPair(ctx sdk.Context, id []byte) (types.TokenPair, bool)

GetTokenPair gets registered token pair from the identifier

func (Keeper) GetTokenPairID

func (k Keeper) GetTokenPairID(ctx sdk.Context, token string) []byte

GetTokenPairID returns the pair id from either of the registered tokens.

func (Keeper) IsDenomForErc20

func (k Keeper) IsDenomForErc20(denom string) bool

func (Keeper) IsDenomRegistered

func (k Keeper) IsDenomRegistered(ctx sdk.Context, denom string) bool

IsDenomRegistered checks if registered coin denom is registered

func (Keeper) IsERC20Registered

func (k Keeper) IsERC20Registered(ctx sdk.Context, erc20 common.Address) bool

IsERC20Registered checks if registered ERC20 token is registered

func (Keeper) IsTokenPairRegistered

func (k Keeper) IsTokenPairRegistered(ctx sdk.Context, id []byte) bool

IsTokenPairRegistered checks if registered token tokenPair is registered

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) Params

func (Keeper) QueryERC20

func (k Keeper) QueryERC20(ctx sdk.Context, contract common.Address) (types.ERC20Data, error)

QueryERC20 returns the data of a deployed ERC20 contract

func (Keeper) RegisterCoin

func (k Keeper) RegisterCoin(ctx sdk.Context, denom string) (*types.TokenPair, error)

RegisterCoin deploys an erc20 contract and creates the token pair for the existing cosmos coin

func (Keeper) RegisterERC20

func (k Keeper) RegisterERC20(ctx sdk.Context, contract common.Address) (types.TokenPair, error)

RegisterERC20 registers the token pair between the coin and the ERC20

func (Keeper) SendCoins

func (k Keeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, nativeCoins sdk.Coins, nativeErc20Tokens sdk.Coins) (err error)

func (Keeper) SetDenomMap

func (k Keeper) SetDenomMap(ctx sdk.Context, denom string, id []byte)

SetDenomMap sets the token pair id for the denomination

func (Keeper) SetERC20Map

func (k Keeper) SetERC20Map(ctx sdk.Context, erc20 common.Address, id []byte)

SetERC20Map sets the token pair id for the given address

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

func (Keeper) SetTokenPair

func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)

SetTokenPair stores a token pair

func (Keeper) SplitCoinsByErc20

func (k Keeper) SplitCoinsByErc20(amt sdk.Coins) (nativeCoins sdk.Coins, nativeErc20Tokens sdk.Coins)

Jump to

Keyboard shortcuts

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