keeper

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrappedOriginDenom

func WrappedOriginDenom(name, symbol string) (fxtypes.Contract, string, string)

Types

type Hooks

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

Hooks wrapper struct for erc20 keeper

func (Hooks) PostTxProcessing

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

PostTxProcessing implements EvmHooks.PostTxProcessing

type Keeper

type Keeper struct {
	Router *types.Router
	// contains filtered or unexported fields
}

Keeper of this module maintains collections of erc20.

func NewKeeper

func NewKeeper(
	storeKey sdk.StoreKey,
	cdc codec.BinaryCodec,
	ps paramtypes.Subspace,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	evmKeeper types.EVMKeeper,
	ibcTransferKeeper types.IBCTransferKeeper,
	ibcChannelKeeper types.IBCChannelKeeper,
) Keeper

NewKeeper creates new instances of the erc20 Keeper

func (Keeper) BalanceOf

func (k Keeper) BalanceOf(ctx sdk.Context, contract, addr common.Address) (*big.Int, error)

BalanceOf returns the balance of an address for ERC20 contract

func (Keeper) CallEVM

func (k Keeper) CallEVM(
	ctx sdk.Context,
	abi abi.ABI,
	from, contract common.Address,
	commit bool,
	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,
	commit bool,
) (*evmtypes.MsgEthereumTxResponse, error)

CallEVMWithData performs a smart contract method call using contract data

func (Keeper) ConvertCoin

ConvertCoin converts Cosmos-native Coins into ERC20 tokens for both Cosmos-native and ERC20 TokenPair Owners

func (Keeper) ConvertERC20

ConvertERC20 converts ERC20 tokens into Cosmos-native Coins for both Cosmos-native and ERC20 TokenPair Owners

func (Keeper) CreateCoinMetadata

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

CreateCoinMetadata generates the metadata to represent the ERC20 token on functionX.

func (Keeper) CreateContractWithCode

func (k Keeper) CreateContractWithCode(ctx sdk.Context, addr common.Address, code []byte) error

func (Keeper) DeleteTokenPair

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

DeleteTokenPair removes a token pair.

func (Keeper) DeployContract

func (k Keeper) DeployContract(ctx sdk.Context, from common.Address, abi abi.ABI, bin []byte, constructorData ...interface{}) (common.Address, error)

func (Keeper) DeployERC1967Proxy

func (k Keeper) DeployERC1967Proxy(ctx sdk.Context, from, logicAddr common.Address, logicData ...byte) (common.Address, error)

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) DeployUpgradableToken

func (k Keeper) DeployUpgradableToken(ctx sdk.Context, from common.Address, name, symbol string, decimals uint8, origin bool) (common.Address, error)

func (Keeper) GetAllTokenPairs

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

GetAllTokenPairs - get all registered token tokenPairs

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) GetIBCTransferHash

func (k Keeper) GetIBCTransferHash(ctx sdk.Context, port, channel string, sequence uint64) (common.Hash, bool)

func (Keeper) GetParams

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

GetParams returns the total set of erc20 parameters.

func (Keeper) GetRouter

func (k Keeper) GetRouter() *types.Router

func (Keeper) GetTokenPair

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

GetTokenPair - get registered token pair from the identifier

func (Keeper) GetTokenPairByAddress

func (k Keeper) GetTokenPairByAddress(ctx sdk.Context, address common.Address) (types.TokenPair, bool)

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) HashIBCTransferHash

func (k Keeper) HashIBCTransferHash(ctx sdk.Context, port, channel string, sequence uint64) bool

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

Hooks Return the wrapper struct

func (Keeper) InitializeUpgradable

func (k Keeper) InitializeUpgradable(ctx sdk.Context, from, contract common.Address, abi abi.ABI, data ...interface{}) error

func (Keeper) IsDenomRegistered

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

IsDenomRegistered check if registered coin denom is registered

func (Keeper) IsERC20Registered

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

IsERC20Registered check if registered ERC20 token is registered

func (Keeper) IsTokenPairRegistered

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

IsTokenPairRegistered - check if registered token tokenPair is registered

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintingEnabled

func (k Keeper) MintingEnabled(ctx sdk.Context, sender, receiver sdk.AccAddress, token string) (types.TokenPair, error)

MintingEnabled checks that:

  • the global parameter for intrarelaying is enabled
  • minting is enabled for the given (erc20,coin) token pair
  • recipient address is not on the blocked list
  • bank module transfers are enabled for the Cosmos coin

func (Keeper) Params

Params return hub contract param

func (Keeper) ProcessRelayToken

func (k Keeper) ProcessRelayToken(ctx sdk.Context, fip20ABI abi.ABI, txHash common.Hash, pair types.TokenPair, from common.Address, amount *big.Int) error

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) RefundAfter

func (k Keeper) RefundAfter(ctx sdk.Context, sourcePort, sourceChannel string, sequence uint64, sender sdk.AccAddress, receiver string, amount sdk.Coin) error

func (Keeper) RegisterCoin

func (k Keeper) RegisterCoin(ctx sdk.Context, coinMetadata banktypes.Metadata) (*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 creates a cosmos coin and registers the token pair between the coin and the ERC20

func (Keeper) RelayConvertCoin

func (k Keeper) RelayConvertCoin(ctx sdk.Context, sender sdk.AccAddress, receiver common.Address, coin sdk.Coin) error

func (Keeper) RelayTokenProcessing

func (k Keeper) RelayTokenProcessing(ctx sdk.Context, _ common.Address, _ *common.Address, receipt *ethtypes.Receipt) error

RelayTokenProcessing relay token from evm contract to chain address

func (Keeper) RelayTransferCrossChainProcessing

func (k Keeper) RelayTransferCrossChainProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) (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) SetIBCChannelKeeperForTest

func (k *Keeper) SetIBCChannelKeeperForTest(t types.IBCChannelKeeper)

func (*Keeper) SetIBCTransferKeeperForTest

func (k *Keeper) SetIBCTransferKeeperForTest(t types.IBCTransferKeeper)

func (Keeper) SetParams

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

SetParams sets the erc20 parameters to the param space.

func (*Keeper) SetRouter

func (k *Keeper) SetRouter(rtr *types.Router)

SetRouter sets the Router in IBC Transfer Keeper and seals it. The method panics if there is an existing router that's already sealed.

func (Keeper) SetTokenPair

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

SetTokenPair stores a token pair

func (Keeper) ToggleRelay

func (k Keeper) ToggleRelay(ctx sdk.Context, token string) (types.TokenPair, error)

ToggleRelay toggles relaying for a given token pair

func (Keeper) TokenPair

TokenPair returns a given registered token pair

func (Keeper) TokenPairs

TokenPairs return registered pairs

func (Keeper) TransferAfter

func (k Keeper) TransferAfter(ctx sdk.Context, sender, receive string, coin, fee sdk.Coin) error

func (Keeper) TransferChainHandler

func (k Keeper) TransferChainHandler(ctx sdk.Context, from sdk.AccAddress, to string, amount, fee sdk.Coin, target string, _ *ethtypes.Receipt) error

func (Keeper) TransferIBCHandler

func (k Keeper) TransferIBCHandler(ctx sdk.Context, from sdk.AccAddress, to string, amount, fee sdk.Coin, target string, receipt *ethtypes.Receipt) error

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

Jump to

Keyboard shortcuts

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