helpers

package
v8.1.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertJsonFile

func AssertJsonFile(t *testing.T, filePath string, result interface{})

func CreateMultiECDSA

func CreateMultiECDSA(count int) []*ecdsa.PrivateKey

func GenAccAddress

func GenAccAddress() sdk.AccAddress

GenAccAddress generates an cosmos-sdk accAddress

func GenExternalAddr

func GenExternalAddr(module string) string

GenExternalAddr generates an Ethereum or Tron address.

func GenHexAddress

func GenHexAddress() common.Address

GenHexAddress generates an Ethereum address.

func GenZeroExternalAddr

func GenZeroExternalAddr(module string) string

GenZeroExternalAddr generates an Ethereum or Tron zero address.

func HexAddrToTronAddr

func HexAddrToTronAddr(str string) string

HexAddrToTronAddr returns a Tron address from an hex string.

func IsLocalTest

func IsLocalTest() bool

func NewApp

func NewApp(opts ...func(*AppOpts)) *app.App

func NewBigInt

func NewBigInt(amount, power int64) *big.Int

func NewEthPrivKey

func NewEthPrivKey() cryptotypes.PrivKey

NewEthPrivKey generates an Ethereum address and its corresponding private key.

func NewMnemonic

func NewMnemonic() string

func NewPriKey

func NewPriKey() cryptotypes.PrivKey

NewPriKey generates cosmos-sdk accAddress private key.

func NewRandAmount

func NewRandAmount() sdkmath.Int

func NewRandDenom

func NewRandDenom() string

func NewRandSymbol

func NewRandSymbol() string

func NewStakingCoin

func NewStakingCoin(amount, power int64) sdk.Coin

func NewStakingCoins

func NewStakingCoins(amount, power int64) sdk.Coins

func PackERC20Mint

func PackERC20Mint(receiver common.Address, amount *big.Int) ([]byte, error)

func PrivKeyFromMnemonic

func PrivKeyFromMnemonic(mnemonic string, algo hd.PubKeyType, account, index uint32) (cryptotypes.PrivKey, error)

func SkipTest

func SkipTest(t *testing.T, msg ...any)

Types

type AppOpts

type AppOpts struct {
	Logger log.Logger
	Home   string
	DB     dbm.DB
}

type BankPrecompileSuite

type BankPrecompileSuite struct {
	*ContractBaseSuite

	contract.BankPrecompileKeeper
	// contains filtered or unexported fields
}

func NewBankPrecompileSuite

func NewBankPrecompileSuite(require *require.Assertions, signer *Signer, caller contract.Caller, contractAddr common.Address) BankPrecompileSuite

func (BankPrecompileSuite) WithError

type BaseSuite

type BaseSuite struct {
	suite.Suite
	MintValNumber int
	ValSet        *tmtypes.ValidatorSet
	ValAddr       []sdk.ValAddress
	App           *app.App
	Ctx           sdk.Context
}

func (*BaseSuite) AddTestAddress

func (s *BaseSuite) AddTestAddress(accNum int, coin sdk.Coin) []sdk.AccAddress

func (*BaseSuite) AddTestSigner

func (s *BaseSuite) AddTestSigner(amount ...int64) *Signer

func (*BaseSuite) AddTestSigners

func (s *BaseSuite) AddTestSigners(accNum int, coin sdk.Coin) []*Signer

func (*BaseSuite) AssertAllBalance

func (s *BaseSuite) AssertAllBalance(addr sdk.AccAddress, expBal ...sdk.Coin)

func (*BaseSuite) AssertBalance

func (s *BaseSuite) AssertBalance(addr sdk.AccAddress, expBal ...sdk.Coin)

func (*BaseSuite) Balance

func (s *BaseSuite) Balance(acc sdk.AccAddress) sdk.Coins

func (*BaseSuite) Commit

func (s *BaseSuite) Commit(block ...int64) sdk.Context

func (*BaseSuite) Delegate

func (s *BaseSuite) Delegate(delAddr sdk.AccAddress, delAmount sdkmath.Int, val sdk.ValAddress)

func (*BaseSuite) GenIBCTransferChannel

func (s *BaseSuite) GenIBCTransferChannel() (portID, channelID string)

func (*BaseSuite) GetDelegation

func (s *BaseSuite) GetDelegation(delAddr sdk.AccAddress, val sdk.ValAddress) stakingtypes.Delegation

func (*BaseSuite) GetFirstValAddr

func (s *BaseSuite) GetFirstValAddr() sdk.ValAddress

func (*BaseSuite) GetFirstValidator

func (s *BaseSuite) GetFirstValidator() stakingtypes.Validator

func (*BaseSuite) GetSecondValAddr

func (s *BaseSuite) GetSecondValAddr() sdk.ValAddress

func (*BaseSuite) GetSecondValidator

func (s *BaseSuite) GetSecondValidator() stakingtypes.Validator

func (*BaseSuite) GetStakingBalance

func (s *BaseSuite) GetStakingBalance(addr sdk.AccAddress) sdkmath.Int

func (*BaseSuite) GetValidator

func (s *BaseSuite) GetValidator(valAddr sdk.ValAddress) stakingtypes.Validator

func (*BaseSuite) GetValidators

func (s *BaseSuite) GetValidators() []stakingtypes.Validator

func (*BaseSuite) MintToken

func (s *BaseSuite) MintToken(address sdk.AccAddress, amount ...sdk.Coin)

func (*BaseSuite) MintTokenToModule

func (s *BaseSuite) MintTokenToModule(module string, amount ...sdk.Coin)

func (*BaseSuite) NewBridgeCoin

func (s *BaseSuite) NewBridgeCoin(module string, amounts ...sdkmath.Int) (sdk.Coin, string)

func (*BaseSuite) NewCoin

func (s *BaseSuite) NewCoin(amounts ...sdkmath.Int) sdk.Coin

func (*BaseSuite) NewSigner

func (s *BaseSuite) NewSigner() *Signer

func (*BaseSuite) Redelegate

func (s *BaseSuite) Redelegate(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress)

func (*BaseSuite) SetAllowance

func (s *BaseSuite) SetAllowance(valAddr sdk.ValAddress, owner, spender sdk.AccAddress, shares *big.Int)

func (*BaseSuite) SetupTest

func (s *BaseSuite) SetupTest()

func (*BaseSuite) Undelegate

func (s *BaseSuite) Undelegate(delAddr sdk.AccAddress, val sdk.ValAddress)

type ContractBaseSuite

type ContractBaseSuite struct {
	// contains filtered or unexported fields
}

func NewContractBaseSuite

func NewContractBaseSuite(require *require.Assertions, signer *Signer) *ContractBaseSuite

func (*ContractBaseSuite) AccAddress

func (s *ContractBaseSuite) AccAddress() sdk.AccAddress

func (*ContractBaseSuite) HexAddress

func (s *ContractBaseSuite) HexAddress() common.Address

func (*ContractBaseSuite) WithContract

func (s *ContractBaseSuite) WithContract(addr common.Address) *ContractBaseSuite

func (*ContractBaseSuite) WithSigner

func (s *ContractBaseSuite) WithSigner(signer *Signer) *ContractBaseSuite

type CrosschainPrecompileSuite

type CrosschainPrecompileSuite struct {
	*ContractBaseSuite

	contract.CrosschainPrecompileKeeper
	// contains filtered or unexported fields
}

func NewCrosschainPrecompileSuite

func NewCrosschainPrecompileSuite(require *require.Assertions, signer *Signer, caller contract.Caller, contractAddr common.Address) CrosschainPrecompileSuite

func (CrosschainPrecompileSuite) BridgeCall

func (CrosschainPrecompileSuite) BridgeCoinAmount

func (CrosschainPrecompileSuite) ExecuteClaim

func (CrosschainPrecompileSuite) HasOracle

func (CrosschainPrecompileSuite) IsOracleOnline

func (CrosschainPrecompileSuite) WithError

type ERC20TokenSuite

type ERC20TokenSuite struct {
	*ContractBaseSuite

	ERC20TokenKeeper contract.ERC20TokenKeeper
	// contains filtered or unexported fields
}

func NewERC20Suite

func NewERC20Suite(require *require.Assertions, signer *Signer, evmKeeper *fxevmkeeper.Keeper) ERC20TokenSuite

func (ERC20TokenSuite) Allowance

func (s ERC20TokenSuite) Allowance(ctx context.Context, owner, spender common.Address) *big.Int

func (ERC20TokenSuite) Approve

func (ERC20TokenSuite) BalanceOf

func (s ERC20TokenSuite) BalanceOf(ctx context.Context, address common.Address) *big.Int

func (ERC20TokenSuite) Burn

func (ERC20TokenSuite) Decimals

func (s ERC20TokenSuite) Decimals(ctx context.Context) uint8

func (ERC20TokenSuite) DeployERC20Token

func (s ERC20TokenSuite) DeployERC20Token(ctx sdk.Context, symbol string) common.Address

func (ERC20TokenSuite) Deposit

func (ERC20TokenSuite) Error

func (s ERC20TokenSuite) Error(err error)

func (ERC20TokenSuite) Mint

func (ERC20TokenSuite) Name

func (s ERC20TokenSuite) Name(ctx context.Context) string

func (ERC20TokenSuite) OnTest

func (s ERC20TokenSuite) OnTest(ctx context.Context, name, symbol string, decimals uint8, totalSupply *big.Int, owner common.Address)

func (ERC20TokenSuite) Owner

func (ERC20TokenSuite) Symbol

func (s ERC20TokenSuite) Symbol(ctx context.Context) string

func (ERC20TokenSuite) TotalSupply

func (s ERC20TokenSuite) TotalSupply(ctx context.Context) *big.Int

func (ERC20TokenSuite) Transfer

func (s ERC20TokenSuite) Transfer(ctx context.Context, recipient common.Address, amount *big.Int) *evmtypes.MsgEthereumTxResponse

func (ERC20TokenSuite) TransferFrom

func (s ERC20TokenSuite) TransferFrom(ctx context.Context, sender, recipient common.Address, amount *big.Int) *evmtypes.MsgEthereumTxResponse

func (ERC20TokenSuite) TransferOwnership

func (s ERC20TokenSuite) TransferOwnership(ctx context.Context, newOwner common.Address) *evmtypes.MsgEthereumTxResponse

func (ERC20TokenSuite) WithError

func (s ERC20TokenSuite) WithError(err error) ERC20TokenSuite

func (ERC20TokenSuite) Withdraw

func (ERC20TokenSuite) WithdrawSelf

func (s ERC20TokenSuite) WithdrawSelf(ctx context.Context, amount *big.Int) *evmtypes.MsgEthereumTxResponse

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer defines a type that is used on testing for signing MsgEthereumTx

func NewSigner

func NewSigner(sk cryptotypes.PrivKey) *Signer

func (Signer) AccAddress

func (s Signer) AccAddress() sdk.AccAddress

func (Signer) Address

func (s Signer) Address() common.Address

func (Signer) PrivKey

func (s Signer) PrivKey() cryptotypes.PrivKey

func (Signer) Sign

func (s Signer) Sign(_ string, msg []byte, _ signing.SignMode) ([]byte, cryptotypes.PubKey, error)

Sign signs the message using the underlying private key

func (Signer) SignByAddress

func (s Signer) SignByAddress(address sdk.Address, msg []byte, signMode signing.SignMode) ([]byte, cryptotypes.PubKey, error)

SignByAddress sign byte messages with a user key providing the address.

type StakingPrecompileSuite

type StakingPrecompileSuite struct {
	*ContractBaseSuite

	contract.StakingPrecompileKeeper
	// contains filtered or unexported fields
}

func NewStakingPrecompileSuite

func NewStakingPrecompileSuite(require *require.Assertions, signer *Signer, caller contract.Caller, contractAddr common.Address) StakingPrecompileSuite

func (StakingPrecompileSuite) AllowanceShares

func (StakingPrecompileSuite) ApproveShares

func (StakingPrecompileSuite) DelegateV2

func (StakingPrecompileSuite) Delegation

func (StakingPrecompileSuite) DelegationRewards

func (StakingPrecompileSuite) Error

func (s StakingPrecompileSuite) Error(err error)

func (StakingPrecompileSuite) RedelegateV2

func (StakingPrecompileSuite) SlashingInfo

func (StakingPrecompileSuite) UndelegateV2

func (StakingPrecompileSuite) ValidatorList

func (StakingPrecompileSuite) WithError

func (StakingPrecompileSuite) Withdraw

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL