Documentation
¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func BackedCoinsInvariant(k Keeper) sdk.Invariant
- func BridgePairsIndexInvariant(k Keeper) sdk.Invariant
- func BridgePairsInvariant(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func WrappingAddInt(i1 sdk.Int, i2 sdk.Int) sdk.Int
- type ConversionHooks
- type Keeper
- func (k Keeper) BridgeEthereumToKava(ctx sdk.Context, relayer sdk.AccAddress, ...) error
- func (k Keeper) BurnConversionPairCoin(ctx sdk.Context, pair types.ConversionPair, coin sdk.Coin, ...) error
- func (k Keeper) CallEVM(ctx sdk.Context, abi abi.ABI, from common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallEVMWithData(ctx sdk.Context, from common.Address, contract *types.InternalEVMAddress, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) ConversionHooks() ConversionHooks
- func (k Keeper) ConvertCoinToERC20(ctx sdk.Context, initiatorAccount sdk.AccAddress, ...) error
- func (k Keeper) DeployMintableERC20Contract(ctx sdk.Context, token types.EnabledERC20Token) (types.InternalEVMAddress, error)
- func (k Keeper) GetBridgePair(ctx sdk.Context, id []byte) (types.ERC20BridgePair, bool)
- func (k Keeper) GetBridgePairFromExternal(ctx sdk.Context, externalAddress types.ExternalEVMAddress) (types.ERC20BridgePair, bool)
- func (k Keeper) GetBridgePairFromInternal(ctx sdk.Context, internalAddress types.InternalEVMAddress) (types.ERC20BridgePair, bool)
- func (k Keeper) GetEnabledConversionPairFromDenom(ctx sdk.Context, denom string) (types.ConversionPair, error)
- func (k Keeper) GetEnabledConversionPairFromERC20Address(ctx sdk.Context, address types.InternalEVMAddress) (types.ConversionPair, error)
- func (k Keeper) GetEnabledConversionPairs(ctx sdk.Context) types.ConversionPairs
- func (k Keeper) GetEnabledERC20TokenFromExternal(ctx sdk.Context, address types.ExternalEVMAddress) (types.EnabledERC20Token, error)
- func (k Keeper) GetEnabledERC20Tokens(ctx sdk.Context) types.EnabledERC20Tokens
- func (k Keeper) GetNextWithdrawSequence(ctx sdk.Context) (sdk.Int, error)
- func (k Keeper) GetOrDeployInternalERC20(ctx sdk.Context, externalAddress types.ExternalEVMAddress) (types.InternalEVMAddress, error)
- func (k Keeper) GetPairIDFromExternal(ctx sdk.Context, externalAddress types.ExternalEVMAddress) ([]byte, bool)
- func (k Keeper) GetPairIDFromInternal(ctx sdk.Context, internalAddress types.InternalEVMAddress) ([]byte, bool)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRelayer(ctx sdk.Context) sdk.AccAddress
- func (k Keeper) IncrementNextWithdrawSequence(ctx sdk.Context) error
- func (k Keeper) IsSignerAuthorized(ctx sdk.Context, signer sdk.AccAddress) error
- func (k Keeper) IterateBridgePairs(ctx sdk.Context, cb func(pair types.ERC20BridgePair) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintConversionPairCoin(ctx sdk.Context, pair types.ConversionPair, amount *big.Int, ...) (sdk.Coin, error)
- func (k Keeper) MintERC20(ctx sdk.Context, contractAddr types.InternalEVMAddress, ...) error
- func (k Keeper) QueryERC20BalanceOf(ctx sdk.Context, contractAddr types.InternalEVMAddress, ...) (*big.Int, error)
- func (k Keeper) RegisterBridgePair(ctx sdk.Context, pair types.ERC20BridgePair)
- func (k Keeper) SetNextWithdrawSequence(ctx sdk.Context, sequence sdk.Int)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRelayer(ctx sdk.Context, relayer sdk.AccAddress)
- func (k Keeper) UnlockERC20Tokens(ctx sdk.Context, pair types.ConversionPair, amount *big.Int, ...) error
- func (k Keeper) WithdrawHooks() WithdrawHook
- type WithdrawHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the bridge module
func BackedCoinsInvariant ¶
BackedCoinsInvariant iterates all conversion pairs and asserts that the sdk.Coin balances are less than the module ERC20 balance. **Note:** This compares <= and not == as anyone can send tokens to the ERC20 contract address and break the invariant if a strict equal check.
func BridgePairsIndexInvariant ¶
BridgePairsIndexInvariant iterates all bridge pairs and asserts the index for querying are all valid.
func BridgePairsInvariant ¶
BridgePairsInvariant iterates all bridge pairs and asserts that they are valid
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the bridge MsgServer interface for the provided Keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
NewQueryServerImpl creates a new server for handling gRPC queries.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers the bridge module invariants
Types ¶
type ConversionHooks ¶
type ConversionHooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for bridge keeper
func (ConversionHooks) PostTxProcessing ¶
func (h ConversionHooks) PostTxProcessing( ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt, ) error
PostTxProcessing implements EvmHooks.PostTxProcessing. This handles minting sdk.Coin when ConvertToCoin() is called on an eligible Kava ERC20 contract.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper keeper for the bridge module
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramstore paramtypes.Subspace, bk types.BankKeeper, ak types.AccountKeeper, ek types.EvmKeeper, ) Keeper
NewKeeper creates a new keeper
func (Keeper) BridgeEthereumToKava ¶
func (k Keeper) BridgeEthereumToKava( ctx sdk.Context, relayer sdk.AccAddress, externalERC20Address types.ExternalEVMAddress, receiver types.InternalEVMAddress, amount *big.Int, sequence sdk.Int, ) error
BridgeEthereumToKava mints the bridged amount at the corresponding bridged ERC20 contract on Kava EVM, deploying the ERC20 contract first if it doesn't already exist.
func (Keeper) BurnConversionPairCoin ¶
func (k Keeper) BurnConversionPairCoin( ctx sdk.Context, pair types.ConversionPair, coin sdk.Coin, account sdk.AccAddress, ) error
BurnConversionPairCoin transfers the provided amount to the module account then burns it.
func (Keeper) CallEVM ¶
func (k Keeper) CallEVM( ctx sdk.Context, abi abi.ABI, from common.Address, contract types.InternalEVMAddress, 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 *types.InternalEVMAddress, data []byte, ) (*evmtypes.MsgEthereumTxResponse, error)
CallEVMWithData performs a smart contract method call using contract data Derived from tharsis/evmos https://github.com/tharsis/evmos/blob/ee54f496551df937915ff6f74a94732a35abc505/x/erc20/keeper/evm.go
func (Keeper) ConversionHooks ¶
func (k Keeper) ConversionHooks() ConversionHooks
Return the wrapper struct
func (Keeper) ConvertCoinToERC20 ¶
func (k Keeper) ConvertCoinToERC20( ctx sdk.Context, initiatorAccount sdk.AccAddress, receiverAccount types.InternalEVMAddress, coin sdk.Coin, ) error
ConvertCoinToERC20 converts an sdk.Coin from the originating account to an ERC20 to the receiver account.
func (Keeper) DeployMintableERC20Contract ¶
func (k Keeper) DeployMintableERC20Contract( ctx sdk.Context, token types.EnabledERC20Token, ) (types.InternalEVMAddress, error)
DeployMintableERC20Contract deploys an ERC20 contract on the EVM as the module account and returns the address of the contract. This contract has minting permissions for the module account. Derived from tharsis/evmos https://github.com/tharsis/evmos/blob/ee54f496551df937915ff6f74a94732a35abc505/x/erc20/keeper/evm.go
func (Keeper) GetBridgePair ¶
GetBridgePair returns the ERC20 bridge pair with the provided pair ID from the store.
func (Keeper) GetBridgePairFromExternal ¶
func (k Keeper) GetBridgePairFromExternal( ctx sdk.Context, externalAddress types.ExternalEVMAddress, ) (types.ERC20BridgePair, bool)
GetBridgePairFromExternal gets ERC20 bridge pair with the provided ExternalEVMAddress from the store.
func (Keeper) GetBridgePairFromInternal ¶
func (k Keeper) GetBridgePairFromInternal( ctx sdk.Context, internalAddress types.InternalEVMAddress, ) (types.ERC20BridgePair, bool)
GetBridgePairFromInternal gets ERC20 bridge pair with the provided InternalEVMAddress from the store.
func (Keeper) GetEnabledConversionPairFromDenom ¶
func (k Keeper) GetEnabledConversionPairFromDenom( ctx sdk.Context, denom string, ) (types.ConversionPair, error)
GetEnabledConversionPairFromDenom returns an ConversionPair from the sdk.Coin denom.
func (Keeper) GetEnabledConversionPairFromERC20Address ¶
func (k Keeper) GetEnabledConversionPairFromERC20Address( ctx sdk.Context, address types.InternalEVMAddress, ) (types.ConversionPair, error)
GetEnabledConversionPairFromERC20Address returns an ConversionPair from the internal contract address.
func (Keeper) GetEnabledConversionPairs ¶
func (k Keeper) GetEnabledConversionPairs(ctx sdk.Context) types.ConversionPairs
GetEnabledConversionPairs returns the all ConversionPairs
func (Keeper) GetEnabledERC20TokenFromExternal ¶
func (k Keeper) GetEnabledERC20TokenFromExternal( ctx sdk.Context, address types.ExternalEVMAddress, ) (types.EnabledERC20Token, error)
GetEnabledERC20TokenFromExternal returns an EnabledERC20Token from the external Ethereum contract address.
func (Keeper) GetEnabledERC20Tokens ¶
func (k Keeper) GetEnabledERC20Tokens(ctx sdk.Context) types.EnabledERC20Tokens
GetEnabledERC20Tokens returns the all EnabledERC20Tokens
func (Keeper) GetNextWithdrawSequence ¶
GetNextWithdrawSequence reads the next available global withdraw sequence from store.
func (Keeper) GetOrDeployInternalERC20 ¶
func (k Keeper) GetOrDeployInternalERC20( ctx sdk.Context, externalAddress types.ExternalEVMAddress, ) (types.InternalEVMAddress, error)
GetOrDeployInternalERC20 returns the internal EVM address mapped to the provided ExternalEVMAddress. This will either return from the store if it is already deployed, or will first deploy the internal ERC20 contract and return the new address.
func (Keeper) GetPairIDFromExternal ¶
func (k Keeper) GetPairIDFromExternal( ctx sdk.Context, externalAddress types.ExternalEVMAddress, ) ([]byte, bool)
GetPairIDFromExternal gets the erc20 bridge pair id from the given external address.
func (Keeper) GetPairIDFromInternal ¶
func (k Keeper) GetPairIDFromInternal( ctx sdk.Context, internalAddress types.InternalEVMAddress, ) ([]byte, bool)
GetPairIDFromInternal gets the erc20 bridge pair id from the given internal address.
func (Keeper) GetRelayer ¶
func (k Keeper) GetRelayer(ctx sdk.Context) sdk.AccAddress
GetRelayer returns the relayer in params
func (Keeper) IncrementNextWithdrawSequence ¶
IncrementNextWithdrawSequence increments the next withdraw sequence in the store by 1.
func (Keeper) IsSignerAuthorized ¶
IsSignerAuthorized returns an error if the provided message signer does not match the relayer set in params.
func (Keeper) IterateBridgePairs ¶
func (k Keeper) IterateBridgePairs( ctx sdk.Context, cb func(pair types.ERC20BridgePair) (stop bool), )
IterateBridgePairs provides an iterator over all stored ERC20 bridge pairs. For each pair, cb will be called. If cb returns true, the iterator will close and stop.
func (Keeper) MintConversionPairCoin ¶
func (k Keeper) MintConversionPairCoin( ctx sdk.Context, pair types.ConversionPair, amount *big.Int, recipient sdk.AccAddress, ) (sdk.Coin, error)
MintConversionPairCoin mints the given amount of a ConversionPair denom and sends it to the provided address.
func (Keeper) MintERC20 ¶
func (k Keeper) MintERC20( ctx sdk.Context, contractAddr types.InternalEVMAddress, receiver types.InternalEVMAddress, amount *big.Int, ) error
MintERC20 mints the given amount of an ERC20 token to an address. This is unchecked and should only be called after permission and enabled ERC20 checks.
func (Keeper) QueryERC20BalanceOf ¶
func (k Keeper) QueryERC20BalanceOf( ctx sdk.Context, contractAddr types.InternalEVMAddress, account types.InternalEVMAddress, ) (*big.Int, error)
func (Keeper) RegisterBridgePair ¶
func (k Keeper) RegisterBridgePair( ctx sdk.Context, pair types.ERC20BridgePair, )
RegisterBridgePair puts the erc20 bridge pair in the store with all of its corresponding external/internal to ID mappings.
func (Keeper) SetNextWithdrawSequence ¶
SetNextWithdrawSequence stores a sequence to be used for the next withdraw.
func (Keeper) SetRelayer ¶
func (k Keeper) SetRelayer(ctx sdk.Context, relayer sdk.AccAddress)
SetRelayer sets the relayer in params
func (Keeper) UnlockERC20Tokens ¶
func (k Keeper) UnlockERC20Tokens( ctx sdk.Context, pair types.ConversionPair, amount *big.Int, receiver types.InternalEVMAddress, ) error
UnlockERC20Tokens transfers the given amount of a conversion pair ERC20 token to the provided account.
func (Keeper) WithdrawHooks ¶
func (k Keeper) WithdrawHooks() WithdrawHook
Return the wrapper struct
type WithdrawHook ¶
type WithdrawHook struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for bridge keeper
func (WithdrawHook) PostTxProcessing ¶
func (h WithdrawHook) PostTxProcessing( ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt, ) error
PostTxProcessing implements EvmHooks.PostTxProcessing