Documentation
¶
Index ¶
- Variables
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type EVMHooks
- type Keeper
- func (k Keeper) BalanceOfZRC4(ctx sdk.Context, contract, account common.Address) (*big.Int, error)
- func (k Keeper) CallEVM(ctx sdk.Context, abi abi.ABI, from, contract common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallEVMWithData(ctx sdk.Context, from common.Address, contract *common.Address, data []byte, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallOnReceiveZevmConnector(ctx sdk.Context, zetaTxSenderAddress []byte, sourceChainID *big.Int, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) CallOnRevertZevmConnector(ctx sdk.Context, zetaTxSenderAddress common.Address, sourceChainID *big.Int, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) CallUniswapV2RouterSwapEthForExactToken(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) ([]*big.Int, error)
- func (k *Keeper) CallUniswapV2RouterSwapExactETHForToken(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) ([]*big.Int, error)
- func (k *Keeper) CallUniswapV2RouterSwapExactTokensForETH(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) (ret []*big.Int, err error)
- func (k *Keeper) CallUniswapV2RouterSwapExactTokensForTokens(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) (ret []*big.Int, err error)
- func (k *Keeper) CallWZetaDeposit(ctx sdk.Context, sender ethcommon.Address, amount *big.Int) error
- func (k *Keeper) CallZRC20Approve(ctx sdk.Context, owner ethcommon.Address, zrc20address ethcommon.Address, ...) error
- func (k *Keeper) CallZRC20Burn(ctx sdk.Context, sender ethcommon.Address, zrc20address ethcommon.Address, ...) error
- func (k *Keeper) CallZRC20Deposit(ctx sdk.Context, sender ethcommon.Address, zrc20address ethcommon.Address, ...) error
- func (k Keeper) CodeHash(c context.Context, req *types.QueryCodeHashRequest) (*types.QueryCodeHashResponse, error)
- func (k Keeper) DeployConnectorZEVM(ctx sdk.Context, wzeta common.Address) (common.Address, error)
- func (k Keeper) DeployContract(ctx sdk.Context, metadata *bind.MetaData, ctorArguments ...interface{}) (common.Address, error)
- func (k Keeper) DeploySystemContract(ctx sdk.Context, wzeta common.Address, v2factory common.Address, ...) (common.Address, error)
- func (k Keeper) DeployUniswapV2Factory(ctx sdk.Context) (common.Address, error)
- func (k Keeper) DeployUniswapV2Router02(ctx sdk.Context, factory common.Address, wzeta common.Address) (common.Address, error)
- func (k Keeper) DeployWZETA(ctx sdk.Context) (common.Address, error)
- func (k Keeper) DeployZRC20Contract(ctx sdk.Context, name, symbol string, decimals uint8, chainID int64, ...) (common.Address, error)
- func (k Keeper) DepositCoinZeta(ctx sdk.Context, to eth.Address, amount *big.Int) error
- func (k Keeper) DepositCoinsToFungibleModule(ctx sdk.Context, amount *big.Int) error
- func (k Keeper) DepositZRC20(ctx sdk.Context, contract common.Address, to common.Address, amount *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context, context systemcontract.ZContext, zrc20Addr common.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) EVMHooks() EVMHooks
- func (k Keeper) EnsureGasStabilityPoolAccountCreated(ctx sdk.Context)
- func (k Keeper) ForeignCoins(c context.Context, req *types.QueryGetForeignCoinsRequest) (*types.QueryGetForeignCoinsResponse, error)
- func (k Keeper) ForeignCoinsAll(c context.Context, req *types.QueryAllForeignCoinsRequest) (*types.QueryAllForeignCoinsResponse, error)
- func (k Keeper) FundGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error
- func (k Keeper) GasStabilityPoolAddress(_ context.Context, req *types.QueryGetGasStabilityPoolAddress) (*types.QueryGetGasStabilityPoolAddressResponse, error)
- func (k Keeper) GasStabilityPoolBalance(c context.Context, req *types.QueryGetGasStabilityPoolBalance) (*types.QueryGetGasStabilityPoolBalanceResponse, error)
- func (k Keeper) GasStabilityPoolBalanceAll(c context.Context, req *types.QueryAllGasStabilityPoolBalance) (*types.QueryAllGasStabilityPoolBalanceResponse, error)
- func (k Keeper) GetAllForeignCoinMap(ctx sdk.Context) map[int64]map[string]types.ForeignCoins
- func (k Keeper) GetAllForeignCoins(ctx sdk.Context) (list []types.ForeignCoins)
- func (k Keeper) GetAllForeignCoinsForChain(ctx sdk.Context, foreignChainID int64) (list []types.ForeignCoins)
- func (k Keeper) GetAuthKeeper() types.AccountKeeper
- func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper
- func (k Keeper) GetBankKeeper() types.BankKeeper
- func (k Keeper) GetEVMKeeper() types.EVMKeeper
- func (k Keeper) GetForeignCoinFromAsset(ctx sdk.Context, asset string, chainID int64) (types.ForeignCoins, bool)
- func (k Keeper) GetForeignCoins(ctx sdk.Context, zrc20Addr string) (val types.ForeignCoins, found bool)
- func (k Keeper) GetGasCoinForForeignCoin(ctx sdk.Context, chainID int64) (types.ForeignCoins, bool)
- func (k Keeper) GetGasStabilityPoolBalance(ctx sdk.Context, chainID int64) (*big.Int, error)
- func (k Keeper) GetObserverKeeper() types.ObserverKeeper
- func (k Keeper) GetSystemContract(ctx sdk.Context) (val types.SystemContract, found bool)
- func (k *Keeper) GetSystemContractAddress(ctx sdk.Context) (ethcommon.Address, error)
- func (k *Keeper) GetUniswapV2FactoryAddress(ctx sdk.Context) (ethcommon.Address, error)
- func (k *Keeper) GetUniswapV2Router02Address(ctx sdk.Context) (ethcommon.Address, error)
- func (k *Keeper) GetWZetaContractAddress(ctx sdk.Context) (ethcommon.Address, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k *Keeper) MintZetaToEVMAccount(ctx sdk.Context, to sdk.AccAddress, amount *big.Int) error
- func (k *Keeper) MintZetaToFungibleModule(ctx sdk.Context, amount *big.Int) error
- func (k Keeper) QueryChainIDFromContract(ctx sdk.Context, contract common.Address) (*big.Int, error)
- func (k Keeper) QueryGasLimit(ctx sdk.Context, contract common.Address) (*big.Int, error)
- func (k Keeper) QueryProtocolFlatFee(ctx sdk.Context, contract common.Address) (*big.Int, error)
- func (k *Keeper) QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainid *big.Int) (ethcommon.Address, error)
- func (k *Keeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4 ethcommon.Address) (*big.Int, error)
- func (k *Keeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 ethcommon.Address) (*big.Int, error)
- func (k *Keeper) QueryUniswapV2RouterGetZetaAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 ethcommon.Address) (*big.Int, error)
- func (k *Keeper) QueryWZetaBalanceOf(ctx sdk.Context, addr ethcommon.Address) (*big.Int, error)
- func (k Keeper) QueryZRC20Data(ctx sdk.Context, contract common.Address) (types.ZRC20Data, error)
- func (k Keeper) RemoveForeignCoins(ctx sdk.Context, zrc20Addr string)
- func (k Keeper) RemoveSystemContract(ctx sdk.Context)
- func (k Keeper) SetForeignCoins(ctx sdk.Context, foreignCoins types.ForeignCoins)
- func (k Keeper) SetGasCoin(ctx sdk.Context, chainid *big.Int, address ethcommon.Address) error
- func (k Keeper) SetGasPrice(ctx sdk.Context, chainid *big.Int, gasPrice *big.Int) (uint64, error)
- func (k Keeper) SetGasZetaPool(ctx sdk.Context, chainid *big.Int, pool ethcommon.Address) error
- func (k Keeper) SetSystemContract(ctx sdk.Context, sytemContract types.SystemContract)
- func (k Keeper) SetupChainGasCoinAndPool(ctx sdk.Context, chainID int64, gasAssetName string, symbol string, ...) (ethcommon.Address, error)
- func (k Keeper) SystemContract(c context.Context, req *types.QueryGetSystemContractRequest) (*types.QueryGetSystemContractResponse, error)
- func (k Keeper) TotalSupplyZRC4(ctx sdk.Context, contract common.Address) (*big.Int, error)
- func (k Keeper) UpdateZRC20GasLimit(ctx sdk.Context, zrc20Addr common.Address, newGasLimit *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) UpdateZRC20ProtocolFlatFee(ctx sdk.Context, zrc20Addr common.Address, newFee *big.Int) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) WithdrawFromGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error
- func (k Keeper) ZETADepositAndCallContract(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) ZETARevertAndCallContract(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) ZRC20DepositAndCallContract(ctx sdk.Context, from []byte, to eth.Address, amount *big.Int, ...) (*evmtypes.MsgEthereumTxResponse, bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( BigIntZero = big.NewInt(0) ZEVMGasLimitDepositAndCall = big.NewInt(1_000_000) ZEVMGasLimitConnectorCall = big.NewInt(1_000_000) )
TODO USE string constant
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, authKeeper types.AccountKeeper, evmKeeper types.EVMKeeper, bankKeeper types.BankKeeper, observerKeeper types.ObserverKeeper, authorityKeeper types.AuthorityKeeper, ) *Keeper
func (Keeper) BalanceOfZRC4 ¶
func (k Keeper) BalanceOfZRC4( ctx sdk.Context, contract, account common.Address, ) (*big.Int, error)
BalanceOfZRC4 queries an account's balance for a given ZRC4 contract
func (Keeper) CallEVM ¶
func (k Keeper) CallEVM( ctx sdk.Context, abi abi.ABI, from, contract common.Address, value, gasLimit *big.Int, commit bool, noEthereumTxEvent bool, method string, args ...interface{}, ) (*evmtypes.MsgEthereumTxResponse, error)
CallEVM performs a smart contract method call using given args returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted.
func (Keeper) CallEVMWithData ¶
func (k Keeper) CallEVMWithData( ctx sdk.Context, from common.Address, contract *common.Address, data []byte, commit bool, noEthereumTxEvent bool, value *big.Int, gasLimit *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
CallEVMWithData performs a smart contract method call using contract data value is the amount of wei to send; gaslimit is the custom gas limit, if nil EstimateGas is used to bisect the correct gas limit (this may sometimes result in insufficient gas limit; not sure why)
noEthereumTxEvent flag is used to control if ethereum_tx events should be emitted which will mean these txs are indexed and available in rpc methods
returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted; in which case msg.Ret gives the RET code if contract revert with REVERT opcode with parameters.
func (Keeper) CallOnReceiveZevmConnector ¶
func (k Keeper) CallOnReceiveZevmConnector(ctx sdk.Context, zetaTxSenderAddress []byte, sourceChainID *big.Int, destinationAddress common.Address, zetaValue *big.Int, message []byte, internalSendHash [32]byte, ) (*evmtypes.MsgEthereumTxResponse, error)
CallOnReceiveZevmConnector calls the onReceive function of the ZevmConnector contract Before calling it mints the zetaValue tokens to the fungible module , and this amount is then provided as value to the onReceive function The onReceive function will then wrap this native zeta into WZETA and call the onReceive function of the destination contract specified by the destinationAddress
func (Keeper) CallOnRevertZevmConnector ¶
func (k Keeper) CallOnRevertZevmConnector(ctx sdk.Context, zetaTxSenderAddress common.Address, sourceChainID *big.Int, destinationAddress []byte, destinationChainID *big.Int, remainingZetaValue *big.Int, message []byte, internalSendHash [32]byte, ) (*evmtypes.MsgEthereumTxResponse, error)
CallOnRevertZevmConnector calls the onRevert function of the ZevmConnector contract Before calling it mints the remainingZetaValue tokens to the fungible module , and this amount is then provided as value to the onRevert function The onRevert function will then wrap this native zeta into WZETA and call the onRevert function of the contract specified by the zetaTxSenderAddress Note the destination address is the original destination address of the transaction and not the current destination .
func (*Keeper) CallUniswapV2RouterSwapEthForExactToken ¶
func (k *Keeper) CallUniswapV2RouterSwapEthForExactToken( ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, maxAmountIn *big.Int, amountOut *big.Int, outZRC4 ethcommon.Address, ) ([]*big.Int, error)
CallUniswapV2RouterSwapEthForExactToken calls the swapETHForExactTokens method of the uniswapv2 router contract
func (*Keeper) CallUniswapV2RouterSwapExactETHForToken ¶
func (k *Keeper) CallUniswapV2RouterSwapExactETHForToken( ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, amountIn *big.Int, outZRC4 ethcommon.Address, noEthereumTxEvent bool, ) ([]*big.Int, error)
CallUniswapV2RouterSwapExactETHForToken calls the swapExactETHForTokens method of the uniswapv2 router contract
func (*Keeper) CallUniswapV2RouterSwapExactTokensForETH ¶
func (k *Keeper) CallUniswapV2RouterSwapExactTokensForETH( ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, amountIn *big.Int, inZRC4 ethcommon.Address, noEthereumTxEvent bool, ) (ret []*big.Int, err error)
CallUniswapV2RouterSwapExactTokensForETH calls the swapExactTokensForETH method of the uniswapv2 router contract
func (*Keeper) CallUniswapV2RouterSwapExactTokensForTokens ¶
func (k *Keeper) CallUniswapV2RouterSwapExactTokensForTokens( ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, amountIn *big.Int, inZRC4, outZRC4 ethcommon.Address, noEthereumTxEvent bool, ) (ret []*big.Int, err error)
CallUniswapV2RouterSwapExactTokensForTokens calls the swapExactTokensForETH method of the uniswapv2 router contract to swap tokens to another tokens using wZeta as intermediary
func (*Keeper) CallWZetaDeposit ¶
CallWZetaDeposit calls the deposit method of the wzeta contract
func (*Keeper) CallZRC20Approve ¶
func (k *Keeper) CallZRC20Approve( ctx sdk.Context, owner ethcommon.Address, zrc20address ethcommon.Address, spender ethcommon.Address, amount *big.Int, noEthereumTxEvent bool, ) error
CallZRC20Approve calls the approve method of the zrc20 contract
func (*Keeper) CallZRC20Burn ¶
func (k *Keeper) CallZRC20Burn( ctx sdk.Context, sender ethcommon.Address, zrc20address ethcommon.Address, amount *big.Int, noEthereumTxEvent bool, ) error
CallZRC20Burn calls the burn method of the zrc20 contract
func (*Keeper) CallZRC20Deposit ¶
func (k *Keeper) CallZRC20Deposit( ctx sdk.Context, sender ethcommon.Address, zrc20address ethcommon.Address, to ethcommon.Address, amount *big.Int, ) error
CallZRC20Deposit calls the deposit method of the zrc20 contract
func (Keeper) CodeHash ¶
func (k Keeper) CodeHash(c context.Context, req *types.QueryCodeHashRequest) (*types.QueryCodeHashResponse, error)
CodeHash returns the code hash of an account if it exists
func (Keeper) DeployConnectorZEVM ¶
func (Keeper) DeployContract ¶
func (k Keeper) DeployContract( ctx sdk.Context, metadata *bind.MetaData, ctorArguments ...interface{}, ) (common.Address, error)
DeployContract deploys a new contract in the ZEVM
func (Keeper) DeploySystemContract ¶
func (Keeper) DeployUniswapV2Factory ¶
func (Keeper) DeployUniswapV2Router02 ¶
func (Keeper) DeployZRC20Contract ¶
func (k Keeper) DeployZRC20Contract( ctx sdk.Context, name, symbol string, decimals uint8, chainID int64, coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, ) (common.Address, error)
DeployZRC20Contract creates and deploys an ERC20 contract on the EVM with the erc20 module account as owner. Also adds itself to ForeignCoins fungible module state variable TODO Unit test for these functions https://github.com/zeta-chain/node/issues/864 TODO Remove repetitive code
func (Keeper) DepositCoinZeta ¶
DepositCoinZeta immediately mints ZETA to the EVM account
func (Keeper) DepositCoinsToFungibleModule ¶
func (Keeper) DepositZRC20 ¶
func (k Keeper) DepositZRC20( ctx sdk.Context, contract common.Address, to common.Address, amount *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
DepositZRC20 deposits ZRC4 tokens into to account; Callable only by the fungible module account returns directly CallEVM()
func (Keeper) DepositZRC20AndCallContract ¶
func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context, context systemcontract.ZContext, zrc20Addr common.Address, targetContract common.Address, amount *big.Int, message []byte, ) (*evmtypes.MsgEthereumTxResponse, error)
DepositZRC20AndCallContract deposits into ZRC4 and call contract function in a single tx callable from fungible module Returns directly results from CallEVM
func (Keeper) EnsureGasStabilityPoolAccountCreated ¶
EnsureGasStabilityPoolAccountCreated ensures the gas stability pool account exists
func (Keeper) ForeignCoins ¶
func (k Keeper) ForeignCoins( c context.Context, req *types.QueryGetForeignCoinsRequest, ) (*types.QueryGetForeignCoinsResponse, error)
func (Keeper) ForeignCoinsAll ¶
func (k Keeper) ForeignCoinsAll( c context.Context, req *types.QueryAllForeignCoinsRequest, ) (*types.QueryAllForeignCoinsResponse, error)
func (Keeper) FundGasStabilityPool ¶
FundGasStabilityPool mints the ZRC20 into a special address called gas stability pool for the chain
func (Keeper) GasStabilityPoolAddress ¶
func (k Keeper) GasStabilityPoolAddress( _ context.Context, req *types.QueryGetGasStabilityPoolAddress, ) (*types.QueryGetGasStabilityPoolAddressResponse, error)
func (Keeper) GasStabilityPoolBalance ¶
func (k Keeper) GasStabilityPoolBalance( c context.Context, req *types.QueryGetGasStabilityPoolBalance, ) (*types.QueryGetGasStabilityPoolBalanceResponse, error)
func (Keeper) GasStabilityPoolBalanceAll ¶
func (k Keeper) GasStabilityPoolBalanceAll( c context.Context, req *types.QueryAllGasStabilityPoolBalance, ) (*types.QueryAllGasStabilityPoolBalanceResponse, error)
func (Keeper) GetAllForeignCoinMap ¶
GetAllForeignCoinMap returns all foreign ERC20 coins in a map of chainID -> asset -> coin Note: DO NOT use this method outside of gRPC queries
func (Keeper) GetAllForeignCoins ¶
func (k Keeper) GetAllForeignCoins(ctx sdk.Context) (list []types.ForeignCoins)
GetAllForeignCoins returns all foreignCoins
func (Keeper) GetAllForeignCoinsForChain ¶
func (k Keeper) GetAllForeignCoinsForChain(ctx sdk.Context, foreignChainID int64) (list []types.ForeignCoins)
GetAllForeignCoinsForChain returns all foreignCoins on a given chain
func (Keeper) GetAuthKeeper ¶
func (k Keeper) GetAuthKeeper() types.AccountKeeper
func (Keeper) GetAuthorityKeeper ¶
func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper
func (Keeper) GetBankKeeper ¶
func (k Keeper) GetBankKeeper() types.BankKeeper
func (Keeper) GetEVMKeeper ¶
func (Keeper) GetForeignCoinFromAsset ¶
func (k Keeper) GetForeignCoinFromAsset(ctx sdk.Context, asset string, chainID int64) (types.ForeignCoins, bool)
GetForeignCoinFromAsset returns the foreign coin for a given asset for a given chain
func (Keeper) GetForeignCoins ¶
func (k Keeper) GetForeignCoins( ctx sdk.Context, zrc20Addr string, ) (val types.ForeignCoins, found bool)
GetForeignCoins returns a foreignCoins from its index
func (Keeper) GetGasCoinForForeignCoin ¶
GetGasCoinForForeignCoin returns the gas coin for a given chain
func (Keeper) GetGasStabilityPoolBalance ¶
GetGasStabilityPoolBalance returns the balance of the gas stability pool
func (Keeper) GetObserverKeeper ¶
func (k Keeper) GetObserverKeeper() types.ObserverKeeper
func (Keeper) GetSystemContract ¶
GetSystemContract returns system contract from the store
func (*Keeper) GetSystemContractAddress ¶
GetSystemContractAddress returns the system contract address TODO : wzetaContractAddress and other constant strings , can be declared as a constant string in types TODO Remove repetitive code
func (*Keeper) GetUniswapV2FactoryAddress ¶
GetUniswapV2FactoryAddress returns the uniswapv2 factory contract address on ZetaChain
func (*Keeper) GetUniswapV2Router02Address ¶
GetUniswapV2Router02Address returns the uniswapv2 router02 address on ZetaChain
func (*Keeper) GetWZetaContractAddress ¶
GetWZetaContractAddress returns the wzeta contract address on ZetaChain
func (*Keeper) MintZetaToEVMAccount ¶
MintZetaToEVMAccount mints ZETA (gas token) to the given address NOTE: this method should be used with a temporary context, and it should not be committed if the method returns an error
func (*Keeper) MintZetaToFungibleModule ¶
func (Keeper) QueryChainIDFromContract ¶
func (k Keeper) QueryChainIDFromContract( ctx sdk.Context, contract common.Address, ) (*big.Int, error)
QueryChainIDFromContract returns the chain id of the chain
func (Keeper) QueryGasLimit ¶
QueryGasLimit returns the gas limit for a withdrawal transaction associated with a given zrc20
func (Keeper) QueryProtocolFlatFee ¶
QueryProtocolFlatFee returns the protocol flat fee associated with a given zrc20
func (*Keeper) QuerySystemContractGasCoinZRC20 ¶
func (k *Keeper) QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainid *big.Int) (ethcommon.Address, error)
QuerySystemContractGasCoinZRC20 returns the gas coin zrc20 address for the given chain id
func (*Keeper) QueryUniswapV2RouterGetZRC4AmountsIn ¶
func (k *Keeper) QueryUniswapV2RouterGetZRC4AmountsIn( ctx sdk.Context, amountOut *big.Int, inZRC4 ethcommon.Address, ) (*big.Int, error)
QueryUniswapV2RouterGetZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy the given amount of zeta
func (*Keeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn ¶
func (k *Keeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn( ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 ethcommon.Address, ) (*big.Int, error)
QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy another ZRC4 token, it uses the WZeta contract as a bridge
func (*Keeper) QueryUniswapV2RouterGetZetaAmountsIn ¶
func (k *Keeper) QueryUniswapV2RouterGetZetaAmountsIn( ctx sdk.Context, amountOut *big.Int, outZRC4 ethcommon.Address, ) (*big.Int, error)
QueryUniswapV2RouterGetZetaAmountsIn returns the amount of zeta needed to buy the given amount of ZRC4 tokens
func (*Keeper) QueryWZetaBalanceOf ¶
QueryWZetaBalanceOf returns the balance of the given address in the wzeta contract
func (Keeper) QueryZRC20Data ¶
func (k Keeper) QueryZRC20Data( ctx sdk.Context, contract common.Address, ) (types.ZRC20Data, error)
QueryZRC20Data returns the data of a deployed ZRC20 contract
func (Keeper) RemoveForeignCoins ¶
RemoveForeignCoins removes a foreignCoins from the store
func (Keeper) RemoveSystemContract ¶
RemoveSystemContract removes system contract from the store
func (Keeper) SetForeignCoins ¶
func (k Keeper) SetForeignCoins(ctx sdk.Context, foreignCoins types.ForeignCoins)
SetForeignCoins set a specific foreignCoins in the store from its index
func (Keeper) SetGasCoin ¶
func (Keeper) SetGasPrice ¶
SetGasPrice sets gas price on the system contract in zEVM; return the gasUsed and error code
func (Keeper) SetGasZetaPool ¶
func (Keeper) SetSystemContract ¶
func (k Keeper) SetSystemContract(ctx sdk.Context, sytemContract types.SystemContract)
SetSystemContract set system contract in the store
func (Keeper) SetupChainGasCoinAndPool ¶
func (k Keeper) SetupChainGasCoinAndPool( ctx sdk.Context, chainID int64, gasAssetName string, symbol string, decimals uint8, gasLimit *big.Int, ) (ethcommon.Address, error)
SetupChainGasCoinAndPool setup gas ZRC20, and ZETA/gas pool for a chain add 0.1gas/0.1wzeta to the pool FIXME: add cointype and use proper gas limit based on cointype/chain
func (Keeper) SystemContract ¶
func (k Keeper) SystemContract( c context.Context, req *types.QueryGetSystemContractRequest, ) (*types.QueryGetSystemContractResponse, error)
func (Keeper) TotalSupplyZRC4 ¶
TotalSupplyZRC4 queries the total supply of a given ZRC4 contract
func (Keeper) UpdateZRC20GasLimit ¶
func (k Keeper) UpdateZRC20GasLimit( ctx sdk.Context, zrc20Addr common.Address, newGasLimit *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
UpdateZRC20GasLimit updates the gas limit for a given ZRC20 contract
func (Keeper) UpdateZRC20ProtocolFlatFee ¶
func (k Keeper) UpdateZRC20ProtocolFlatFee( ctx sdk.Context, zrc20Addr common.Address, newFee *big.Int, ) (*evmtypes.MsgEthereumTxResponse, error)
UpdateZRC20ProtocolFlatFee updates the protocol flat fee for a given ZRC20 contract
func (Keeper) WithdrawFromGasStabilityPool ¶
func (k Keeper) WithdrawFromGasStabilityPool( ctx sdk.Context, chainID int64, amount *big.Int, ) error
WithdrawFromGasStabilityPool burns the ZRC20 from the gas stability pool
func (Keeper) ZETADepositAndCallContract ¶
func (k Keeper) ZETADepositAndCallContract(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, inboundSenderChainID int64, inboundAmount *big.Int, data []byte, indexBytes [32]byte) (*evmtypes.MsgEthereumTxResponse, error)
ZETADepositAndCallContract deposits native ZETA to the to address if its an account or if the account does not exist yet If it's not an account it calls onReceive function of the connector contract and provides the address as the destinationAddress .The amount of tokens is minted to the fungible module account, wrapped and sent to the contract
func (Keeper) ZETARevertAndCallContract ¶
func (k Keeper) ZETARevertAndCallContract(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, inboundSenderChainID int64, destinationChainID int64, remainingAmount *big.Int, data []byte, indexBytes [32]byte) (*evmtypes.MsgEthereumTxResponse, error)
ZETARevertAndCallContract deposits native ZETA to the sender address if its account or if the account does not exist yet If it's not an account it calls onRevert function of the connector contract and provides the sender address as the zetaTxSenderAddress.The amount of tokens is minted to the fungible module account, wrapped and sent to the contract
func (Keeper) ZRC20DepositAndCallContract ¶
func (k Keeper) ZRC20DepositAndCallContract( ctx sdk.Context, from []byte, to eth.Address, amount *big.Int, senderChainID int64, data []byte, coinType coin.CoinType, asset string, ) (*evmtypes.MsgEthereumTxResponse, bool, error)
ZRC20DepositAndCallContract deposits ZRC20 to the EVM account and calls the contract returns [txResponse, isContractCall, error] isContractCall is true if the receiver is a contract and a contract call was made
Source Files
¶
- deposits.go
- evm.go
- evm_hooks.go
- foreign_coins.go
- gas_coin_and_pool.go
- gas_price.go
- gas_stability_pool.go
- grpc_query.go
- grpc_query_code_hash.go
- grpc_query_foreign_coins.go
- grpc_query_gas_stability_pool.go
- grpc_query_system_contract.go
- keeper.go
- msg_server.go
- msg_server_deploy_fungible_coin_zrc20.go
- msg_server_deploy_system_contract.go
- msg_server_pause_zrc20.go
- msg_server_remove_foreign_coin.go
- msg_server_udpate_zrc20_liquidity_cap.go
- msg_server_unpause_zrc20.go
- msg_server_update_contract_bytecode.go
- msg_server_update_system_contract.go
- msg_server_update_zrc20_withdraw_fee.go
- system_contract.go
- zeta.go
- zevm_msg_passing.go