Documentation ¶
Index ¶
- func WrappedOriginDenom(name, symbol string) (fxtypes.Contract, string, string)
- type Hooks
- type Keeper
- func (k Keeper) AliasDenom(c context.Context, req *types.QueryAliasDenomRequest) (*types.QueryAliasDenomResponse, error)
- func (k Keeper) BalanceOf(ctx sdk.Context, contract, addr common.Address) (*big.Int, error)
- func (k Keeper) CallEVM(ctx sdk.Context, abi abi.ABI, from, contract common.Address, commit bool, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallEVMWithData(ctx sdk.Context, from common.Address, contract *common.Address, data []byte, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) ConvertCoin(goCtx context.Context, msg *types.MsgConvertCoin) (*types.MsgConvertCoinResponse, error)
- func (k Keeper) ConvertCoinNativeCoin(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertCoin, ...) (*types.MsgConvertCoinResponse, error)
- func (k Keeper) ConvertCoinNativeERC20(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertCoin, ...) (*types.MsgConvertCoinResponse, error)
- func (k Keeper) ConvertDenom(goCtx context.Context, msg *types.MsgConvertDenom) (*types.MsgConvertDenomResponse, error)
- func (k Keeper) ConvertDenomToMany(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin, target string) (sdk.Coin, error)
- func (k Keeper) ConvertDenomToOne(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin) (sdk.Coin, error)
- func (k Keeper) ConvertERC20(goCtx context.Context, msg *types.MsgConvertERC20) (*types.MsgConvertERC20Response, error)
- func (k Keeper) ConvertERC20NativeCoin(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertERC20, ...) (*types.MsgConvertERC20Response, error)
- func (k Keeper) ConvertERC20NativeToken(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertERC20, ...) (*types.MsgConvertERC20Response, error)
- func (k Keeper) CreateCoinMetadata(ctx sdk.Context, contract common.Address) (*banktypes.Metadata, string, string, error)
- func (k Keeper) CreateContractWithCode(ctx sdk.Context, addr common.Address, code []byte) error
- func (k Keeper) DeleteAliasesDenom(ctx sdk.Context, aliases ...string)
- func (k Keeper) DeleteDenomMap(ctx sdk.Context, denom string)
- func (k Keeper) DeleteERC20Map(ctx sdk.Context, erc20 common.Address)
- func (k Keeper) DeleteTokenPair(ctx sdk.Context, id []byte)
- func (k Keeper) DenomAliases(c context.Context, req *types.QueryDenomAliasesRequest) (*types.QueryDenomAliasesResponse, error)
- func (k Keeper) DeployContract(ctx sdk.Context, from common.Address, abi abi.ABI, bin []byte, ...) (common.Address, error)
- func (k Keeper) DeployERC1967Proxy(ctx sdk.Context, from, logicAddr common.Address, logicData ...byte) (common.Address, error)
- func (k Keeper) DeployERC20Contract(ctx sdk.Context, coinMetadata banktypes.Metadata) (common.Address, error)
- func (k Keeper) DeployUpgradableToken(ctx sdk.Context, from common.Address, name, symbol string, decimals uint8, ...) (common.Address, error)
- func (k Keeper) GetAliasDenom(ctx sdk.Context, alias string) []byte
- func (k Keeper) GetAllTokenPairs(ctx sdk.Context) []types.TokenPair
- func (k Keeper) GetDenomMap(ctx sdk.Context, denom string) []byte
- func (k Keeper) GetERC20Map(ctx sdk.Context, erc20 common.Address) []byte
- func (k Keeper) GetIBCTransferHash(ctx sdk.Context, port, channel string, sequence uint64) (common.Hash, bool)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRouter() *types.Router
- func (k Keeper) GetTokenPair(ctx sdk.Context, id []byte) (types.TokenPair, bool)
- func (k Keeper) GetTokenPairByAddress(ctx sdk.Context, address common.Address) (types.TokenPair, bool)
- func (k Keeper) GetTokenPairID(ctx sdk.Context, token string) []byte
- func (k Keeper) HashIBCTransferHash(ctx sdk.Context, port, channel string, sequence uint64) bool
- func (k *Keeper) Hooks() Hooks
- func (k Keeper) InitializeUpgradable(ctx sdk.Context, from, contract common.Address, abi abi.ABI, ...) error
- func (k Keeper) IsAliasDenomRegistered(ctx sdk.Context, alias string) bool
- func (k Keeper) IsDenomRegistered(ctx sdk.Context, denom string) bool
- func (k Keeper) IsERC20Registered(ctx sdk.Context, erc20 common.Address) bool
- func (k Keeper) IsManyToOneDenom(ctx sdk.Context, denom string) (bool, error)
- func (k Keeper) IsTokenPairRegistered(ctx sdk.Context, id []byte) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintingEnabled(ctx sdk.Context, sender, receiver sdk.AccAddress, token string) (types.TokenPair, error)
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProcessRelayToken(ctx sdk.Context, fip20ABI abi.ABI, txHash common.Hash, pair types.TokenPair, ...) error
- func (k Keeper) QueryERC20(ctx sdk.Context, contract common.Address) (types.ERC20Data, error)
- func (k Keeper) RefundAfter(ctx sdk.Context, sourcePort, sourceChannel string, sequence uint64, ...) error
- func (k Keeper) RegisterCoin(ctx sdk.Context, coinMetadata banktypes.Metadata) (*types.TokenPair, error)
- func (k Keeper) RegisterERC20(ctx sdk.Context, contract common.Address) (*types.TokenPair, error)
- func (k Keeper) RelayConvertCoin(ctx sdk.Context, sender sdk.AccAddress, receiver common.Address, coin sdk.Coin) error
- func (k Keeper) RelayConvertDenomToMany(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin, target string) (sdk.Coin, error)
- func (k Keeper) RelayConvertDenomToOne(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin) (sdk.Coin, error)
- func (k Keeper) RelayTokenProcessing(ctx sdk.Context, _ common.Address, _ *common.Address, ...) error
- func (k Keeper) RelayTransferCrossChainProcessing(ctx sdk.Context, from common.Address, to *common.Address, ...) (err error)
- func (k Keeper) RemoveTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) SendCoins(ctx sdk.Context, from, to sdk.AccAddress, coins sdk.Coins) error
- func (k Keeper) SetAliasesDenom(ctx sdk.Context, denom string, aliases ...string)
- func (k Keeper) SetDenomMap(ctx sdk.Context, denom string, id []byte)
- func (k Keeper) SetERC20Map(ctx sdk.Context, erc20 common.Address, id []byte)
- func (k *Keeper) SetIBCChannelKeeperForTest(t types.IBCChannelKeeper)
- func (k Keeper) SetIBCTransferHash(ctx sdk.Context, port, channel string, sequence uint64, hash common.Hash)
- func (k *Keeper) SetIBCTransferKeeperForTest(t types.IBCTransferKeeper)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetRouter(rtr *types.Router)
- func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) SupportInfiniteGasMeter(ctx sdk.Context) (sdk.Context, sdk.GasMeter)
- func (k Keeper) SupportRefundGasWithGasMeter(ctx sdk.Context, gasMater sdk.GasMeter) sdk.Context
- func (k Keeper) ToggleRelay(ctx sdk.Context, token string) (types.TokenPair, error)
- func (k Keeper) TokenPair(c context.Context, req *types.QueryTokenPairRequest) (*types.QueryTokenPairResponse, error)
- func (k Keeper) TokenPairs(c context.Context, req *types.QueryTokenPairsRequest) (*types.QueryTokenPairsResponse, error)
- func (k Keeper) TransferAfter(ctx sdk.Context, sender, receive string, coin, fee sdk.Coin) error
- func (k Keeper) TransferChainHandler(ctx sdk.Context, from sdk.AccAddress, to string, amount, fee sdk.Coin, ...) error
- func (k Keeper) TransferIBCHandler(ctx sdk.Context, from sdk.AccAddress, to string, amount, fee sdk.Coin, ...) error
- func (k Keeper) UpdateDenomAlias(ctx sdk.Context, denom, alias string) (bool, error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for erc20 keeper
type Keeper ¶
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) AliasDenom ¶ added in v2.2.0
func (k Keeper) AliasDenom(c context.Context, req *types.QueryAliasDenomRequest) (*types.QueryAliasDenomResponse, error)
AliasDenom returns alias denom
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 ¶
func (k Keeper) ConvertCoin(goCtx context.Context, msg *types.MsgConvertCoin) (*types.MsgConvertCoinResponse, error)
ConvertCoin converts Cosmos-native Coins into ERC20 tokens for both Cosmos-native and ERC20 TokenPair Owners
func (Keeper) ConvertCoinNativeCoin ¶ added in v2.3.0
func (k Keeper) ConvertCoinNativeCoin(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertCoin, receiver common.Address, sender sdk.AccAddress) (*types.MsgConvertCoinResponse, error)
ConvertCoinNativeCoin handles the Coin conversion flow for a native coin token pair:
- Escrow Coins on module account (Coins are not burned)
- Mint Tokens and send to receiver
- Check if token balance increased by amount
func (Keeper) ConvertCoinNativeERC20 ¶ added in v2.3.0
func (k Keeper) ConvertCoinNativeERC20(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertCoin, receiver common.Address, sender sdk.AccAddress) (*types.MsgConvertCoinResponse, error)
ConvertCoinNativeERC20 handles the Coin conversion flow for a native ERC20 token pair:
- Escrow Coins on module account
- Unescrow Tokens that have been previously escrowed with ConvertERC20 and send to receiver
- Burn escrowed Coins
- Check if token balance increased by amount
- Check for unexpected `appove` event in logs
func (Keeper) ConvertDenom ¶ added in v2.2.0
func (k Keeper) ConvertDenom(goCtx context.Context, msg *types.MsgConvertDenom) (*types.MsgConvertDenomResponse, error)
ConvertDenom converts coin into other coin, use for multiple chains in the same currency
func (Keeper) ConvertDenomToMany ¶ added in v2.3.0
func (k Keeper) ConvertDenomToMany(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin, target string) (sdk.Coin, error)
ConvertDenomToMany handles the Denom conversion flow for one to many token pair:
- Escrow Coins on module account
- Unescrow Tokens that have been previously escrowed with ConvertDenomToMany and send to receiver
- Burn escrowed Coins
- Check if token balance increased by amount
func (Keeper) ConvertDenomToOne ¶ added in v2.3.0
func (k Keeper) ConvertDenomToOne(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin) (sdk.Coin, error)
ConvertDenomToOne handles the Denom conversion flow for many to one token pair:
- Escrow Coins on module account (Coins are not burned)
- Mint Tokens and send to from address
- Check if token balance increased by amount
func (Keeper) ConvertERC20 ¶
func (k Keeper) ConvertERC20(goCtx context.Context, msg *types.MsgConvertERC20) (*types.MsgConvertERC20Response, error)
ConvertERC20 converts ERC20 tokens into Cosmos-native Coins for both Cosmos-native and ERC20 TokenPair Owners
func (Keeper) ConvertERC20NativeCoin ¶ added in v2.3.0
func (k Keeper) ConvertERC20NativeCoin(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertERC20, receiver sdk.AccAddress, sender common.Address) (*types.MsgConvertERC20Response, error)
ConvertERC20NativeCoin handles the erc20 conversion flow for a native coin token pair:
- Burn escrowed tokens
- Unescrow coins that have been previously escrowed with ConvertCoin
- Check if coin balance increased by amount
- Check if token balance decreased by amount
func (Keeper) ConvertERC20NativeToken ¶ added in v2.3.0
func (k Keeper) ConvertERC20NativeToken(ctx sdk.Context, pair types.TokenPair, msg *types.MsgConvertERC20, receiver sdk.AccAddress, sender common.Address) (*types.MsgConvertERC20Response, error)
ConvertERC20NativeToken handles the erc20 conversion flow for a native erc20 token pair:
- Escrow tokens on module account (Don't burn as module is not contract owner)
- Mint coins on module
- Send minted coins to the receiver
- Check if coin balance increased by amount
- Check if token balance decreased by amount
- Check for unexpected `appove` event in logs
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 (Keeper) DeleteAliasesDenom ¶ added in v2.3.0
DeleteAliasesDenom deletes the denom-alias for the given alias
func (Keeper) DeleteDenomMap ¶ added in v2.3.0
DeleteDenomMap deletes the token pair id for the given denom
func (Keeper) DeleteERC20Map ¶ added in v2.3.0
DeleteERC20Map deletes the token pair id for the given address
func (Keeper) DeleteTokenPair ¶
DeleteTokenPair deletes the token pair for the given id
func (Keeper) DenomAliases ¶ added in v2.2.0
func (k Keeper) DenomAliases(c context.Context, req *types.QueryDenomAliasesRequest) (*types.QueryDenomAliasesResponse, error)
DenomAliases returns denom aliases
func (Keeper) DeployContract ¶
func (Keeper) DeployERC1967Proxy ¶
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 (Keeper) GetAliasDenom ¶ added in v2.2.0
GetAliasDenom returns the denom for the given alias
func (Keeper) GetAllTokenPairs ¶
GetAllTokenPairs - get all registered token tokenPairs
func (Keeper) GetDenomMap ¶
GetDenomMap returns the token pair id for the given denomination
func (Keeper) GetERC20Map ¶
GetERC20Map returns the token pair id for the given address
func (Keeper) GetIBCTransferHash ¶
func (Keeper) GetTokenPair ¶
GetTokenPair - get registered token pair from the identifier
func (Keeper) GetTokenPairByAddress ¶
func (Keeper) GetTokenPairID ¶
GetTokenPairID returns the pair id from either of the registered tokens.
func (Keeper) HashIBCTransferHash ¶
func (Keeper) InitializeUpgradable ¶
func (Keeper) IsAliasDenomRegistered ¶ added in v2.2.0
IsAliasDenomRegistered check if registered coin alias is registered
func (Keeper) IsDenomRegistered ¶
IsDenomRegistered check if registered coin denom is registered
func (Keeper) IsERC20Registered ¶
IsERC20Registered check if registered ERC20 token is registered
func (Keeper) IsManyToOneDenom ¶ added in v2.2.0
func (Keeper) IsTokenPairRegistered ¶
IsTokenPairRegistered - check if registered token tokenPair is registered
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 ¶
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params return hub contract param
func (Keeper) ProcessRelayToken ¶
func (Keeper) QueryERC20 ¶
QueryERC20 returns the data of a deployed ERC20 contract
func (Keeper) RefundAfter ¶
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 ¶
RegisterERC20 creates a cosmos coin and registers the token pair between the coin and the ERC20
func (Keeper) RelayConvertCoin ¶
func (Keeper) RelayConvertDenomToMany ¶ added in v2.2.1
func (Keeper) RelayConvertDenomToOne ¶ added in v2.2.1
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 (Keeper) RemoveTokenPair ¶ added in v2.3.0
RemoveTokenPair removes a token pair.
func (Keeper) SetAliasesDenom ¶ added in v2.2.0
SetAliasesDenom sets the aliases for the denomination
func (Keeper) SetDenomMap ¶
SetDenomMap sets the token pair id for the denomination
func (Keeper) SetERC20Map ¶
SetERC20Map sets the token pair id for the given address
func (*Keeper) SetIBCChannelKeeperForTest ¶
func (k *Keeper) SetIBCChannelKeeperForTest(t types.IBCChannelKeeper)
func (Keeper) SetIBCTransferHash ¶ added in v2.3.0
func (*Keeper) SetIBCTransferKeeperForTest ¶
func (k *Keeper) SetIBCTransferKeeperForTest(t types.IBCTransferKeeper)
func (*Keeper) SetRouter ¶
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 ¶
SetTokenPair stores a token pair
func (Keeper) SupportInfiniteGasMeter ¶ added in v2.2.1
func (Keeper) SupportRefundGasWithGasMeter ¶ added in v2.2.1
func (Keeper) ToggleRelay ¶
ToggleRelay toggles relaying for a given token pair
func (Keeper) TokenPair ¶
func (k Keeper) TokenPair(c context.Context, req *types.QueryTokenPairRequest) (*types.QueryTokenPairResponse, error)
TokenPair returns a given registered token pair
func (Keeper) TokenPairs ¶
func (k Keeper) TokenPairs(c context.Context, req *types.QueryTokenPairsRequest) (*types.QueryTokenPairsResponse, error)
TokenPairs return registered pairs
func (Keeper) TransferAfter ¶
func (Keeper) TransferChainHandler ¶
func (Keeper) TransferIBCHandler ¶
func (Keeper) UpdateDenomAlias ¶ added in v2.2.0
UpdateDenomAlias update denom alias if alias not registered, add to denom alias if alias registered with denom, remove from denom alias if alias registered, but not with denom, return error