Documentation
¶
Overview ¶
Copyright (c) 2023-2024 Nibi, Inc.
Copyright (c) 2023-2024 Nibi, Inc.
Index ¶
- Variables
- func AssertERC20BalanceEqual(t *testing.T, deps TestDeps, contract, account gethcommon.Address, ...)
- func CreateContractGethCoreMsg(args ArgsCreateContract, cfg *params.ChainConfig, blockHeight *big.Int) (gethCoreMsg core.Message, err error)
- func CreateContractTxMsg(args ArgsCreateContract) (ethTxMsg *evm.MsgEthereumTx, err error)
- func CreateFunTokenForBankCoin(deps *TestDeps, bankDenom string, s *suite.Suite) (funtoken evm.FunToken)
- func DeployAndExecuteERC20Transfer(deps *TestDeps, t *testing.T) (*evm.MsgEthereumTx, []*evm.MsgEthereumTx)
- func DoEthTx(deps *TestDeps, contract, from gethcommon.Address, input []byte) (evmResp *evm.MsgEthereumTxResponse, err error)
- func ExecuteContractTxMsg(args ArgsExecuteContract) (ethTxMsg *evm.MsgEthereumTx, err error)
- func ExecuteNibiTransfer(deps *TestDeps, t *testing.T) *evm.MsgEthereumTx
- func GasLimitCreateContract() *big.Int
- func GenerateAndSignEthTxMsg(txArgs evm.JsonTxArgs, deps *TestDeps) (*evm.MsgEthereumTx, error)
- func HappyCreateContractTx(deps *TestDeps) *evm.MsgEthereumTx
- func HappyTransferTx(deps *TestDeps, nonce uint64) *evm.MsgEthereumTx
- func NewEthTxMsg() *evm.MsgEthereumTx
- func NewEthTxMsgAsCmt(t *testing.T) (txBz cmt.Tx, ethTxMsgs []*evm.MsgEthereumTx, clientCtx client.Context)
- func NewEthTxMsgFromTxData(deps *TestDeps, txType GethTxType, innerTxData []byte, nonce uint64, ...) (*evm.MsgEthereumTx, error)
- func NewEthTxMsgs(count uint64) (ethTxMsgs []*evm.MsgEthereumTx)
- func NewSigner(sk cryptotypes.PrivKey) keyring.Signer
- func NonEvmMsgTx(deps *TestDeps) sdk.Tx
- func TransferWei(deps *TestDeps, to gethcommon.Address, amountWei *big.Int) error
- func TxTemplateAccessListTx() *gethcore.AccessListTx
- func TxTemplateDynamicFeeTx() *gethcore.DynamicFeeTx
- func TxTemplateLegacyTx() *gethcore.LegacyTx
- type ArgsCreateContract
- type ArgsExecuteContract
- type DeployContractResult
- type EthPrivKeyAcc
- type GethTxType
- type Signer
- type TestDeps
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AssertERC20BalanceEqual ¶
func CreateContractGethCoreMsg ¶
func CreateContractGethCoreMsg( args ArgsCreateContract, cfg *params.ChainConfig, blockHeight *big.Int, ) (gethCoreMsg core.Message, err error)
func CreateContractTxMsg ¶
func CreateContractTxMsg( args ArgsCreateContract, ) (ethTxMsg *evm.MsgEthereumTx, err error)
func CreateFunTokenForBankCoin ¶
func CreateFunTokenForBankCoin( deps *TestDeps, bankDenom string, s *suite.Suite, ) (funtoken evm.FunToken)
CreateFunTokenForBankCoin: Uses the "TestDeps.Sender" account to create a "FunToken" mapping for a new coin
func DeployAndExecuteERC20Transfer ¶
func DeployAndExecuteERC20Transfer( deps *TestDeps, t *testing.T, ) (*evm.MsgEthereumTx, []*evm.MsgEthereumTx)
DeployAndExecuteERC20Transfer deploys contract, executes transfer and returns tx hash
func DoEthTx ¶
func DoEthTx( deps *TestDeps, contract, from gethcommon.Address, input []byte, ) (evmResp *evm.MsgEthereumTxResponse, err error)
func ExecuteContractTxMsg ¶
func ExecuteContractTxMsg(args ArgsExecuteContract) (ethTxMsg *evm.MsgEthereumTx, err error)
func ExecuteNibiTransfer ¶
func ExecuteNibiTransfer(deps *TestDeps, t *testing.T) *evm.MsgEthereumTx
ExecuteNibiTransfer executes nibi transfer
func GasLimitCreateContract ¶
func GenerateAndSignEthTxMsg ¶
func GenerateAndSignEthTxMsg( txArgs evm.JsonTxArgs, deps *TestDeps, ) (*evm.MsgEthereumTx, error)
GenerateAndSignEthTxMsg estimates gas, sets gas limit and sings the tx
func HappyCreateContractTx ¶
func HappyCreateContractTx(deps *TestDeps) *evm.MsgEthereumTx
func HappyTransferTx ¶
func HappyTransferTx(deps *TestDeps, nonce uint64) *evm.MsgEthereumTx
func NewEthTxMsg ¶
func NewEthTxMsg() *evm.MsgEthereumTx
NewEthTxMsg: Helper that returns a valid instance of *evm.MsgEthereumTx.
func NewEthTxMsgAsCmt ¶
func NewEthTxMsgAsCmt(t *testing.T) ( txBz cmt.Tx, ethTxMsgs []*evm.MsgEthereumTx, clientCtx client.Context, )
NewEthTxMsgAsCmt: Helper that returns an Ethereum tx msg converted into tx bytes used in the Consensus Engine.
func NewEthTxMsgFromTxData ¶
func NewEthTxMsgFromTxData( deps *TestDeps, txType GethTxType, innerTxData []byte, nonce uint64, to *gethcommon.Address, value *big.Int, gas uint64, accessList gethcore.AccessList, ) (*evm.MsgEthereumTx, error)
func NewEthTxMsgs ¶
func NewEthTxMsgs(count uint64) (ethTxMsgs []*evm.MsgEthereumTx)
func NonEvmMsgTx ¶
func TransferWei ¶
func TxTemplateAccessListTx ¶
func TxTemplateAccessListTx() *gethcore.AccessListTx
func TxTemplateDynamicFeeTx ¶
func TxTemplateDynamicFeeTx() *gethcore.DynamicFeeTx
func TxTemplateLegacyTx ¶
Types ¶
type ArgsCreateContract ¶
type ArgsCreateContract struct {
EthAcc EthPrivKeyAcc
EthChainIDInt *big.Int
GasPrice *big.Int
Nonce uint64
GasLimit *big.Int
}
ArgsCreateContract: Arguments to call with `CreateContractTxMsg` and `CreateContractGethCoreMsg` to make Ethereum transactions that create contracts.
It is recommended to use a gas price of `big.NewInt(1)` for simpler op code calculations in gas units.
type ArgsExecuteContract ¶
type ArgsExecuteContract struct {
EthAcc EthPrivKeyAcc
EthChainIDInt *big.Int
ContractAddress *gethcommon.Address
Data []byte
GasPrice *big.Int
Nonce uint64
GasLimit *big.Int
}
ArgsExecuteContract: Arguments to call with `ExecuteContractTxMsg` to make Ethereum transactions that execute contracts.
type DeployContractResult ¶
type DeployContractResult struct {
TxResp *evm.MsgEthereumTxResponse
EthTxMsg *evm.MsgEthereumTx
ContractData embeds.CompiledEvmContract
Nonce uint64
ContractAddr gethcommon.Address
}
func DeployContract ¶
func DeployContract( deps *TestDeps, contract embeds.CompiledEvmContract, t *testing.T, args ...any, ) (result DeployContractResult, err error)
type EthPrivKeyAcc ¶
type EthPrivKeyAcc struct {
EthAddr gethcommon.Address
NibiruAddr sdk.AccAddress
PrivKey *ethsecp256k1.PrivKey
PrivKeyE *ecdsa.PrivateKey
KeyringSigner keyring.Signer
}
func NewEthAccInfo ¶
func NewEthAccInfo() EthPrivKeyAcc
NewEthAccInfo returns an Ethereum private key, its corresponding Eth address, public key, and Nibiru address.
func (EthPrivKeyAcc) GethSigner ¶
func (acc EthPrivKeyAcc) GethSigner(ethChainID *big.Int) gethcore.Signer
type GethTxType ¶
type GethTxType = uint8
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer defines a type that is used on testing for signing MsgEthereumTx
func (Signer) SignByAddress ¶
SignByAddress sign byte messages with a user key providing the address.
type TestDeps ¶
type TestDeps struct {
App *app.NibiruApp
Ctx sdk.Context
EncCfg codec.EncodingConfig
EvmKeeper keeper.Keeper
GenState *evm.GenesisState
Sender EthPrivKeyAcc
}
func NewTestDeps ¶
func NewTestDeps() TestDeps