Documentation ¶
Index ¶
- type Keeper
- func (k Keeper) AckAfter(ctx sdk.Context, channel string, sequence uint64) error
- func (k Keeper) AddTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) AliasDenom(c context.Context, req *types.QueryAliasDenomRequest) (*types.QueryAliasDenomResponse, error)
- func (k Keeper) ConvertCoin(goCtx context.Context, msg *types.MsgConvertCoin) (*types.MsgConvertCoinResponse, error)
- func (k Keeper) ConvertCoinNativeCoin(ctx sdk.Context, pair types.TokenPair, sender sdk.AccAddress, ...) error
- func (k Keeper) ConvertCoinNativeERC20(ctx sdk.Context, pair types.TokenPair, sender sdk.AccAddress, ...) error
- func (k Keeper) ConvertDenom(goCtx context.Context, msg *types.MsgConvertDenom) (*types.MsgConvertDenomResponse, error)
- func (k Keeper) ConvertDenomToTarget(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin, fxTarget fxtypes.FxTarget) (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, sender common.Address, ...) error
- func (k Keeper) ConvertERC20NativeToken(ctx sdk.Context, pair types.TokenPair, sender common.Address, ...) error
- func (k Keeper) DeleteAliasesDenom(ctx sdk.Context, aliases ...string)
- func (k Keeper) DeleteIBCTransferRelation(ctx sdk.Context, channel string, sequence uint64) bool
- func (k Keeper) DeleteOutgoingTransferRelation(ctx sdk.Context, moduleName string, txID uint64)
- func (k Keeper) DenomAliases(c context.Context, req *types.QueryDenomAliasesRequest) (*types.QueryDenomAliasesResponse, error)
- func (k Keeper) DeployUpgradableToken(ctx sdk.Context, from common.Address, name, symbol string, decimals uint8) (common.Address, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAliasDenom(ctx sdk.Context, alias string) (string, bool)
- func (k Keeper) GetAllTokenPairs(ctx sdk.Context) []types.TokenPair
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetEnableEVMHook(ctx sdk.Context) bool
- func (k Keeper) GetEnableErc20(ctx sdk.Context) bool
- func (k Keeper) GetIbcTimeout(ctx sdk.Context) time.Duration
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetTokenPair(ctx sdk.Context, tokenOrDenom string) (types.TokenPair, bool)
- func (k Keeper) GetTokenPairByAddress(ctx sdk.Context, address common.Address) (types.TokenPair, bool)
- func (k Keeper) HasDenomAlias(ctx sdk.Context, denom string) (banktypes.Metadata, bool)
- func (k Keeper) HasOutgoingTransferRelation(ctx sdk.Context, moduleName string, txID uint64) bool
- func (k Keeper) HookOutgoingRefund(ctx sdk.Context, moduleName string, txID uint64, sender sdk.AccAddress, ...) error
- func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
- 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) IsOriginDenom(ctx sdk.Context, denom string) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintingEnabled(ctx sdk.Context, receiver sdk.AccAddress, token string) (types.TokenPair, error)
- func (k Keeper) ModuleAddress() common.Address
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) PrecompileCancelSendToExternal(_ sdk.Context, _ uint64, _ sdk.AccAddress) (sdk.Coin, error)
- func (k Keeper) PrecompileIncreaseBridgeFee(_ sdk.Context, _ uint64, _ sdk.AccAddress, _ sdk.Coin) error
- func (k Keeper) QueryERC20(ctx sdk.Context, contract common.Address) (types.ERC20Data, error)
- func (k Keeper) RefundAfter(ctx sdk.Context, channel string, sequence uint64, sender sdk.AccAddress, ...) error
- func (k Keeper) RegisterCoin(c context.Context, req *types.MsgRegisterCoin) (*types.MsgRegisterCoinResponse, error)
- func (k Keeper) RegisterERC20(c context.Context, req *types.MsgRegisterERC20) (*types.MsgRegisterERC20Response, error)
- func (k Keeper) RegisterNativeCoin(ctx sdk.Context, coinMetadata banktypes.Metadata) (*types.TokenPair, error)
- func (k Keeper) RegisterNativeERC20(ctx sdk.Context, contract common.Address, aliases ...string) (*types.TokenPair, error)
- func (k Keeper) RemoveTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) SetAliasesDenom(ctx sdk.Context, denom string, aliases ...string)
- func (k Keeper) SetIBCTransferRelation(ctx sdk.Context, channel string, sequence uint64)
- func (k Keeper) SetOutgoingTransferRelation(ctx sdk.Context, moduleName string, txID uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error
- func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) ToTargetDenom(ctx sdk.Context, denom, base string, aliases []string, ...) string
- func (k Keeper) ToggleTokenConversion(c context.Context, req *types.MsgToggleTokenConversion) (*types.MsgToggleTokenConversionResponse, error)
- func (k Keeper) ToggleTokenConvert(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 sdk.AccAddress, receive string, coin, fee sdk.Coin, ...) error
- func (k Keeper) UpdateDenomAlias(c context.Context, req *types.MsgUpdateDenomAlias) (*types.MsgUpdateDenomAliasResponse, error)
- func (k Keeper) UpdateDenomAliases(ctx sdk.Context, denom, alias string) (bool, error)
- func (k Keeper) UpdateParams(c context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of this module maintains collections of erc20.
func NewKeeper ¶
func NewKeeper( storeKey storetypes.StoreKey, cdc codec.BinaryCodec, ak types.AccountKeeper, bk types.BankKeeper, evmKeeper types.EVMKeeper, ibcTransferKeeper types.IBCTransferKeeper, authority string, ) Keeper
NewKeeper creates new instances of the erc20 Keeper
func (Keeper) AddTokenPair ¶
func (Keeper) AliasDenom ¶
func (k Keeper) AliasDenom(c context.Context, req *types.QueryAliasDenomRequest) (*types.QueryAliasDenomResponse, error)
AliasDenom returns alias denom
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 ¶
func (k Keeper) ConvertCoinNativeCoin(ctx sdk.Context, pair types.TokenPair, sender sdk.AccAddress, receiver common.Address, coin sdk.Coin) 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 ¶
func (k Keeper) ConvertCoinNativeERC20(ctx sdk.Context, pair types.TokenPair, sender sdk.AccAddress, receiver common.Address, coin sdk.Coin) 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 `approve` event in logs
func (Keeper) ConvertDenom ¶
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) ConvertDenomToTarget ¶
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 ¶
func (k Keeper) ConvertERC20NativeCoin(ctx sdk.Context, pair types.TokenPair, sender common.Address, receiver sdk.AccAddress, amount sdkmath.Int) 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 ¶
func (k Keeper) ConvertERC20NativeToken(ctx sdk.Context, pair types.TokenPair, sender common.Address, receiver sdk.AccAddress, amount sdkmath.Int) 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 `approve` event in logs
func (Keeper) DeleteAliasesDenom ¶
DeleteAliasesDenom deletes the denom-alias for the given alias
func (Keeper) DeleteIBCTransferRelation ¶
func (Keeper) DeleteOutgoingTransferRelation ¶
func (Keeper) DenomAliases ¶
func (k Keeper) DenomAliases(c context.Context, req *types.QueryDenomAliasesRequest) (*types.QueryDenomAliasesResponse, error)
DenomAliases returns denom aliases
func (Keeper) DeployUpgradableToken ¶
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis export module status
func (Keeper) GetAliasDenom ¶
GetAliasDenom returns the denom for the given alias
func (Keeper) GetAllTokenPairs ¶
GetAllTokenPairs - get all registered token tokenPairs
func (Keeper) GetAuthority ¶
func (Keeper) GetEnableEVMHook ¶
GetEnableEVMHook returns the EnableEVMHook parameter.
func (Keeper) GetEnableErc20 ¶
GetEnableErc20 returns the EnableErc20 parameter.
func (Keeper) GetIbcTimeout ¶
GetIbcTimeout returns the IbcTimeout parameter.
func (Keeper) GetTokenPair ¶
GetTokenPair - get registered token pair from the token or denom
func (Keeper) GetTokenPairByAddress ¶
func (Keeper) HasDenomAlias ¶
func (Keeper) HasOutgoingTransferRelation ¶
func (Keeper) HookOutgoingRefund ¶
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
InitGenesis import module genesis
func (Keeper) IsAliasDenomRegistered ¶
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) IsOriginDenom ¶
IsOriginDenom check denom origin denom must be eth0x...|bsc0x...|tronTL...|ibc/ABC... origin: FX, fxUSD(fxevm-ERC20) cross: PUNDIX, PURSE, Other(usdt,usdc)
func (Keeper) MintingEnabled ¶
func (k Keeper) MintingEnabled(ctx sdk.Context, 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) ModuleAddress ¶
ModuleAddress return erc20 module address
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params return hub contract param
func (Keeper) PrecompileCancelSendToExternal ¶
func (Keeper) PrecompileIncreaseBridgeFee ¶
func (Keeper) QueryERC20 ¶
QueryERC20 returns the data of a deployed ERC20 contract
func (Keeper) RefundAfter ¶
func (Keeper) RegisterCoin ¶
func (k Keeper) RegisterCoin(c context.Context, req *types.MsgRegisterCoin) (*types.MsgRegisterCoinResponse, error)
func (Keeper) RegisterERC20 ¶
func (k Keeper) RegisterERC20(c context.Context, req *types.MsgRegisterERC20) (*types.MsgRegisterERC20Response, error)
func (Keeper) RegisterNativeCoin ¶
func (k Keeper) RegisterNativeCoin(ctx sdk.Context, coinMetadata banktypes.Metadata) (*types.TokenPair, error)
RegisterNativeCoin deploys an erc20 contract and creates the token pair for the existing cosmos coin
func (Keeper) RegisterNativeERC20 ¶
func (k Keeper) RegisterNativeERC20(ctx sdk.Context, contract common.Address, aliases ...string) (*types.TokenPair, error)
RegisterNativeERC20 creates a cosmos coin and registers the token pair between the coin and the ERC20
func (Keeper) RemoveTokenPair ¶
RemoveTokenPair removes a token pair.
func (Keeper) SetAliasesDenom ¶
SetAliasesDenom sets the aliases for the denomination
func (Keeper) SetIBCTransferRelation ¶
func (Keeper) SetOutgoingTransferRelation ¶
func (Keeper) SetTokenPair ¶
func (Keeper) ToTargetDenom ¶
func (Keeper) ToggleTokenConversion ¶
func (k Keeper) ToggleTokenConversion(c context.Context, req *types.MsgToggleTokenConversion) (*types.MsgToggleTokenConversionResponse, error)
func (Keeper) ToggleTokenConvert ¶
ToggleTokenConvert 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 (k Keeper) TransferAfter(ctx sdk.Context, sender sdk.AccAddress, receive string, coin, fee sdk.Coin, _ bool) error
TransferAfter ibc transfer after
func (Keeper) UpdateDenomAlias ¶
func (k Keeper) UpdateDenomAlias(c context.Context, req *types.MsgUpdateDenomAlias) (*types.MsgUpdateDenomAliasResponse, error)
func (Keeper) UpdateDenomAliases ¶
UpdateDenomAliases 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
func (Keeper) UpdateParams ¶
func (k Keeper) UpdateParams(c context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
NewMigrator returns a new Migrator.
func (Migrator) Migrate3to4 ¶
Migrate3to4 migrates the x/erc20 module state from the consensus version 3 to version 4. Specifically, it takes the parameters that are currently stored and managed by the x/params modules and stores them directly into the x/erc20 module state.