cosmossdk

package
v1.3.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddressFromBech32 added in v1.2.0

func AccAddressFromBech32(address string) (addr sdk.AccAddress, err error)

AccAddressFromBech32 creates an AccAddress from a Bech32 string.

func AddHelperModuleAccountAddr

func AddHelperModuleAccountAddr(moduleAccAddrs map[string]bool) map[string]bool

func AddHelperModuleAccountPermissions

func AddHelperModuleAccountPermissions(maccPerms map[string][]string) map[string][]string

func CheckInvariant

func CheckInvariant(t require.TestingT, ctx sdk.Context, invariant sdk.Invariant, failed bool, message string)

func ConvertAddrsToValAddrs

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

func CreateAccounts

func CreateAccounts(accNum int, valAccNum int) (acountsAddresses []sdk.AccAddress, validatorsAddresses []sdk.ValAddress)

func CreateIncrementalAccounts

func CreateIncrementalAccounts(accNum int, genInitNumber int) []sdk.AccAddress

func CreateRandomAccAddress

func CreateRandomAccAddress() string

func CreateRandomAccAddressHexAndBechNoBalance added in v1.3.0

func CreateRandomAccAddressHexAndBechNoBalance(i int64) (hex string, bech string)

func CreateTestPubKeys

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.

func NewPubKeyFromHex

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

func ValidateManyInvariants

func ValidateManyInvariants(t require.TestingT, ctx sdk.Context, invariants []sdk.Invariant)

Types

type AuthUtils

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

func NewAuthUtils

func NewAuthUtils(t require.TestingT, helperAccountKeeper *authkeeper.AccountKeeper, bankUtils *BankUtils) AuthUtils

func (*AuthUtils) CreateBaseAccount added in v1.2.0

func (au *AuthUtils) CreateBaseAccount(ctx sdk.Context, address string, coin sdk.Coins) error

func (*AuthUtils) CreateDefaultDenomBaseAccount added in v1.2.0

func (au *AuthUtils) CreateDefaultDenomBaseAccount(ctx sdk.Context, address string, amount math.Int) error

func (*AuthUtils) CreateDefaultDenomVestingAccount

func (au *AuthUtils) CreateDefaultDenomVestingAccount(ctx sdk.Context, address string, amount math.Int, start time.Time, end time.Time) error

func (*AuthUtils) CreateVestingAccount

func (au *AuthUtils) CreateVestingAccount(ctx sdk.Context, address string, coins sdk.Coins, start time.Time, end time.Time) error

func (*AuthUtils) ExportGenesisAndValidate added in v1.3.1

func (au *AuthUtils) ExportGenesisAndValidate(ctx sdk.Context)

func (*AuthUtils) ModifyVestingAccountOriginalVesting added in v1.2.0

func (au *AuthUtils) ModifyVestingAccountOriginalVesting(ctx sdk.Context, address string, newOrignalVestings sdk.Coins) error

func (*AuthUtils) VerifyAccountDoesNotExist added in v1.2.0

func (au *AuthUtils) VerifyAccountDoesNotExist(ctx sdk.Context, address sdk.AccAddress)

func (*AuthUtils) VerifyDefaultDenomVestingAccount

func (au *AuthUtils) VerifyDefaultDenomVestingAccount(ctx sdk.Context, address sdk.AccAddress, lockedAmount math.Int, startTime time.Time, endTime time.Time)

func (*AuthUtils) VerifyIsContinuousVestingAccount added in v1.2.0

func (au *AuthUtils) VerifyIsContinuousVestingAccount(ctx sdk.Context, address sdk.AccAddress)

func (*AuthUtils) VerifyVestingAccount

func (au *AuthUtils) VerifyVestingAccount(ctx sdk.Context, address sdk.AccAddress, lockedAmount sdk.Coins, startTime time.Time, endTime time.Time)

type BankUtils

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

func NewBankUtils

func NewBankUtils(t require.TestingT, ctx sdk.Context, helperAccountKeeper *authkeeper.AccountKeeper, helperBankKeeper bankkeeper.Keeper) BankUtils

func (*BankUtils) AddCoinsToAccount

func (bu *BankUtils) AddCoinsToAccount(ctx sdk.Context, coinsToMint sdk.Coins, toAddr sdk.AccAddress)

func (*BankUtils) AddCoinsToModule

func (bu *BankUtils) AddCoinsToModule(ctx sdk.Context, coinsToMint sdk.Coin, moduleName string)

func (*BankUtils) AddDefaultDenomCoinsToAccount

func (bu *BankUtils) AddDefaultDenomCoinsToAccount(ctx sdk.Context, amount math.Int, toAddr sdk.AccAddress) (denom string)

func (*BankUtils) AddDefaultDenomCoinsToModule

func (bu *BankUtils) AddDefaultDenomCoinsToModule(ctx sdk.Context, amount math.Int, moduleName string) (denom string)

func (*BankUtils) DisableSend added in v1.2.0

func (bu *BankUtils) DisableSend(ctx sdk.Context)

func (*BankUtils) ExportGenesisAndValidate added in v1.3.1

func (bu *BankUtils) ExportGenesisAndValidate(ctx sdk.Context)

func (*BankUtils) GetAccountAllBalances added in v1.2.0

func (bu *BankUtils) GetAccountAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

func (*BankUtils) GetAccountBalanceByDenom

func (bu *BankUtils) GetAccountBalanceByDenom(ctx sdk.Context, addr sdk.AccAddress, denom string) math.Int

func (*BankUtils) GetAccountDefultDenomBalance

func (bu *BankUtils) GetAccountDefultDenomBalance(ctx sdk.Context, addr sdk.AccAddress) math.Int

func (*BankUtils) GetAccountLockedCoins added in v1.2.0

func (bu *BankUtils) GetAccountLockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

func (*BankUtils) GetModuleAccountAllBalances added in v1.3.0

func (bu *BankUtils) GetModuleAccountAllBalances(ctx sdk.Context, accName string) sdk.Coins

func (*BankUtils) GetModuleAccountBalanceByDenom

func (bu *BankUtils) GetModuleAccountBalanceByDenom(ctx sdk.Context, accName string, denom string) math.Int

func (*BankUtils) GetModuleAccountDefultDenomBalance

func (bu *BankUtils) GetModuleAccountDefultDenomBalance(ctx sdk.Context, accName string) math.Int

func (*BankUtils) GetTotalSupplyByDenom added in v1.3.0

func (bu *BankUtils) GetTotalSupplyByDenom(ctx sdk.Context, denom string) sdk.Coin

func (*BankUtils) VerifyAccountAllBalances added in v1.3.0

func (bu *BankUtils) VerifyAccountAllBalances(ctx sdk.Context, addr sdk.AccAddress, expectedBalances sdk.Coins)

func (*BankUtils) VerifyAccountBalanceByDenom

func (bu *BankUtils) VerifyAccountBalanceByDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, expectedAmount math.Int)

func (*BankUtils) VerifyAccountBalances added in v1.2.0

func (bu *BankUtils) VerifyAccountBalances(ctx sdk.Context, addr sdk.AccAddress, expectedBalances sdk.Coins, isAllBalances bool)

func (*BankUtils) VerifyAccountDefaultDenomBalance added in v1.3.0

func (bu *BankUtils) VerifyAccountDefaultDenomBalance(ctx sdk.Context, addr sdk.AccAddress, expectedAmount math.Int)

func (*BankUtils) VerifyAccountDefultDenomLocked added in v1.3.0

func (bu *BankUtils) VerifyAccountDefultDenomLocked(ctx sdk.Context, addr sdk.AccAddress, expectedAmount math.Int)

func (*BankUtils) VerifyAccountDefultDenomSpendableCoins added in v1.3.0

func (bu *BankUtils) VerifyAccountDefultDenomSpendableCoins(ctx sdk.Context, addr sdk.AccAddress, expectedAmount math.Int)

func (*BankUtils) VerifyAccountLockedByDenom added in v1.3.0

func (bu *BankUtils) VerifyAccountLockedByDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, expectedAmount math.Int)

func (*BankUtils) VerifyAccountSpendableByDenom added in v1.3.0

func (bu *BankUtils) VerifyAccountSpendableByDenom(ctx sdk.Context, addr sdk.AccAddress, denom string, expectedAmount math.Int)

func (*BankUtils) VerifyDefultDenomTotalSupply

func (bu *BankUtils) VerifyDefultDenomTotalSupply(ctx sdk.Context, expectedAmount math.Int)

func (*BankUtils) VerifyLockedCoins added in v1.2.0

func (bu *BankUtils) VerifyLockedCoins(ctx sdk.Context, addr sdk.AccAddress, expectedLockedCoins sdk.Coins, isAllLocked bool)

func (*BankUtils) VerifyModuleAccountAllBalances added in v1.3.0

func (bu *BankUtils) VerifyModuleAccountAllBalances(ctx sdk.Context, accName string, expectedAmount sdk.Coins)

func (*BankUtils) VerifyModuleAccountBalanceByDenom

func (bu *BankUtils) VerifyModuleAccountBalanceByDenom(ctx sdk.Context, accName string, denom string, expectedAmount math.Int)

func (*BankUtils) VerifyModuleAccountDefultDenomBalance

func (bu *BankUtils) VerifyModuleAccountDefultDenomBalance(ctx sdk.Context, accName string, expectedAmount math.Int)

func (*BankUtils) VerifyTotalSupply added in v1.3.0

func (bu *BankUtils) VerifyTotalSupply(ctx sdk.Context, expectedAmount sdk.Coins)

func (*BankUtils) VerifyTotalSupplyByDenom

func (bu *BankUtils) VerifyTotalSupplyByDenom(ctx sdk.Context, denom string, expectedAmount math.Int)

type ContextAuthUtils

type ContextAuthUtils struct {
	AuthUtils
	// contains filtered or unexported fields
}

func NewContextAuthUtils

func NewContextAuthUtils(t require.TestingT, testContext testenv.TestContext, helperAccountKeeper *authkeeper.AccountKeeper, bankUtils *BankUtils) *ContextAuthUtils

func (*ContextAuthUtils) CreateDefaultDenomBaseAccount added in v1.2.0

func (au *ContextAuthUtils) CreateDefaultDenomBaseAccount(address string, amount math.Int) error

func (*ContextAuthUtils) CreateDefaultDenomVestingAccount

func (au *ContextAuthUtils) CreateDefaultDenomVestingAccount(address string, amount math.Int, start time.Time, end time.Time) error

func (*ContextAuthUtils) CreateVestingAccount

func (au *ContextAuthUtils) CreateVestingAccount(address string, coins sdk.Coins, start time.Time, end time.Time) error

func (*ContextAuthUtils) ExportGenesisAndValidate added in v1.3.1

func (au *ContextAuthUtils) ExportGenesisAndValidate()

func (*ContextAuthUtils) ModifyVestingAccountOriginalVesting added in v1.2.0

func (au *ContextAuthUtils) ModifyVestingAccountOriginalVesting(address string, newOrignalVestings sdk.Coins) error

func (*ContextAuthUtils) VerifyAccountDoesNotExist added in v1.2.0

func (au *ContextAuthUtils) VerifyAccountDoesNotExist(address sdk.AccAddress)

func (*ContextAuthUtils) VerifyDefaultDenomVestingAccount

func (au *ContextAuthUtils) VerifyDefaultDenomVestingAccount(address sdk.AccAddress, lockedAmount math.Int, startTime time.Time, endTime time.Time)

func (*ContextAuthUtils) VerifyIsContinuousVestingAccount added in v1.2.0

func (au *ContextAuthUtils) VerifyIsContinuousVestingAccount(address sdk.AccAddress)

func (*ContextAuthUtils) VerifyVestingAccount

func (au *ContextAuthUtils) VerifyVestingAccount(address sdk.AccAddress, lockedAmount sdk.Coins, startTime time.Time, endTime time.Time)

type ContextBankUtils

type ContextBankUtils struct {
	BankUtils
	// contains filtered or unexported fields
}

func NewContextBankUtils

func NewContextBankUtils(t require.TestingT, testContext testenv.TestContext, helperAccountKeeper *authkeeper.AccountKeeper, helperBankKeeper bankkeeper.Keeper) *ContextBankUtils

func (*ContextBankUtils) AddCoinsToAccount

func (bu *ContextBankUtils) AddCoinsToAccount(coinsToMint sdk.Coins, toAddr sdk.AccAddress)

func (*ContextBankUtils) AddCoinsToModule

func (bu *ContextBankUtils) AddCoinsToModule(coinsToMint sdk.Coin, moduleName string)

func (*ContextBankUtils) AddDefaultDenomCoinsToAccount

func (bu *ContextBankUtils) AddDefaultDenomCoinsToAccount(amount math.Int, toAddr sdk.AccAddress) (denom string)

func (*ContextBankUtils) AddDefaultDenomCoinsToModule

func (bu *ContextBankUtils) AddDefaultDenomCoinsToModule(amount math.Int, moduleName string) (denom string)

func (*ContextBankUtils) DisableSend added in v1.2.0

func (bu *ContextBankUtils) DisableSend()

func (*ContextBankUtils) ExportGenesisAndValidate added in v1.3.1

func (bu *ContextBankUtils) ExportGenesisAndValidate()

func (*ContextBankUtils) GetAccountAllBalances added in v1.2.0

func (bu *ContextBankUtils) GetAccountAllBalances(addr sdk.AccAddress) sdk.Coins

func (*ContextBankUtils) GetAccountDefultDenomBalance

func (bu *ContextBankUtils) GetAccountDefultDenomBalance(addr sdk.AccAddress) math.Int

func (*ContextBankUtils) GetAccountLockedCoins added in v1.2.0

func (bu *ContextBankUtils) GetAccountLockedCoins(addr sdk.AccAddress) sdk.Coins

func (*ContextBankUtils) GetModuleAccountDefultDenomBalance

func (bu *ContextBankUtils) GetModuleAccountDefultDenomBalance(accName string) math.Int

func (*ContextBankUtils) VerifyAccountBalanceByDenom

func (bu *ContextBankUtils) VerifyAccountBalanceByDenom(addr sdk.AccAddress, denom string, expectedAmount math.Int)

func (*ContextBankUtils) VerifyAccountBalances added in v1.2.0

func (bu *ContextBankUtils) VerifyAccountBalances(addr sdk.AccAddress, expectedBalances sdk.Coins, isAllBalances bool)

func (*ContextBankUtils) VerifyAccountDefultDenomBalance

func (bu *ContextBankUtils) VerifyAccountDefultDenomBalance(addr sdk.AccAddress, expectedAmount math.Int)

func (*ContextBankUtils) VerifyDefultDenomTotalSupply

func (bu *ContextBankUtils) VerifyDefultDenomTotalSupply(expectedAmount math.Int)

func (*ContextBankUtils) VerifyLockedCoins added in v1.2.0

func (bu *ContextBankUtils) VerifyLockedCoins(addr sdk.AccAddress, expectedLockedCoins sdk.Coins, isAllLocked bool)

func (*ContextBankUtils) VerifyModuleAccountBalanceByDenom

func (bu *ContextBankUtils) VerifyModuleAccountBalanceByDenom(accName string, denom string, expectedAmount math.Int)

func (*ContextBankUtils) VerifyModuleAccountDefultDenomBalance

func (bu *ContextBankUtils) VerifyModuleAccountDefultDenomBalance(accName string, expectedAmount math.Int)

func (*ContextBankUtils) VerifyTotalSupplyByDenom

func (bu *ContextBankUtils) VerifyTotalSupplyByDenom(denom string, expectedAmount math.Int)

type ContextDistributionUtils added in v1.3.0

type ContextDistributionUtils struct {
	DistributionUtils
	// contains filtered or unexported fields
}

func NewContextDistributionUtils added in v1.3.0

func NewContextDistributionUtils(t require.TestingT, testContext testenv.TestContext, distrKeeper *distrkeeper.Keeper) *ContextDistributionUtils

func (*ContextDistributionUtils) ExportGenesisAndValidate added in v1.3.1

func (m *ContextDistributionUtils) ExportGenesisAndValidate()

type ContextFeegrantUtils added in v1.3.0

type ContextFeegrantUtils struct {
	FeegrantUtils
	// contains filtered or unexported fields
}

func NewContextFeegrantUtils added in v1.3.0

func NewContextFeegrantUtils(t require.TestingT, testContext testenv.TestContext, feegrantKeeper *feegrantkeeper.Keeper) *ContextFeegrantUtils

type ContextGovUtils added in v1.3.0

type ContextGovUtils struct {
	GovUtils
	// contains filtered or unexported fields
}

func NewContextGovUtils added in v1.3.0

func NewContextGovUtils(t require.TestingT, testContext testenv.TestContext, govKeeper *govkeeper.Keeper) *ContextGovUtils

type ContextStakingUtils

type ContextStakingUtils struct {
	StakingUtils
	// contains filtered or unexported fields
}

func NewContextStakingUtils

func NewContextStakingUtils(t require.TestingT, testContext testenv.TestContext, helperStakingkeeper stakingkeeper.Keeper, bankUtils *BankUtils) *ContextStakingUtils

func (*ContextStakingUtils) CreateValidator

func (su *ContextStakingUtils) CreateValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, coin sdk.Coin, commisions stakingtypes.CommissionRates)

func (*ContextStakingUtils) ExportGenesisAndValidate added in v1.3.1

func (su *ContextStakingUtils) ExportGenesisAndValidate()

func (*ContextStakingUtils) GetStakingDenom added in v1.3.0

func (su *ContextStakingUtils) GetStakingDenom() string

func (*ContextStakingUtils) GetValidator

func (su *ContextStakingUtils) GetValidator(addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)

func (*ContextStakingUtils) GetValidators added in v1.3.0

func (su *ContextStakingUtils) GetValidators() []stakingtypes.Validator

func (*ContextStakingUtils) MessageDelegate

func (su *ContextStakingUtils) MessageDelegate(expectedCurrentAmountOfDelegations int, expectedCurrentAmountOfUnbondingDelegations int,
	validatorAddress sdk.ValAddress, delegatorAddress sdk.AccAddress, bondAmount math.Int)

func (*ContextStakingUtils) MessageUndelegate

func (su *ContextStakingUtils) MessageUndelegate(expectedCurrentAmountOfDelegations int, expectedCurrentAmountOfUnbondingDelegations int, validatorAddress sdk.ValAddress, delegatorAddress sdk.AccAddress, unbondAmount math.Int)

func (*ContextStakingUtils) SetupValidators

func (su *ContextStakingUtils) SetupValidators(validators []sdk.ValAddress, delegatePerValidator math.Int)

func (*ContextStakingUtils) VerifyNumberOfUnbondingDelegations

func (su *ContextStakingUtils) VerifyNumberOfUnbondingDelegations(expectedNumberOfUnbondingDelegations int, delegatorAddress sdk.AccAddress)

type DistributionUtils added in v1.3.0

type DistributionUtils struct {
	DistrKeeper *distrkeeper.Keeper
	// contains filtered or unexported fields
}

func NewDistributionUtils added in v1.3.0

func NewDistributionUtils(t require.TestingT, distrKeeper *distrkeeper.Keeper) DistributionUtils

func (*DistributionUtils) ExportGenesisAndValidate added in v1.3.1

func (m *DistributionUtils) ExportGenesisAndValidate(ctx sdk.Context)

type FeegrantUtils added in v1.3.0

type FeegrantUtils struct {
	FeegrantKeeper *feegrantkeeper.Keeper
	// contains filtered or unexported fields
}

func NewFeegrantUtils added in v1.3.0

func NewFeegrantUtils(t require.TestingT, feegrantKeeper *feegrantkeeper.Keeper) FeegrantUtils

type GovUtils added in v1.3.0

type GovUtils struct {
	GovKeeper *govkeeper.Keeper
	// contains filtered or unexported fields
}

func NewGovUtils added in v1.3.0

func NewGovUtils(t require.TestingT, govKeeper *govkeeper.Keeper) GovUtils

type StakingUtils

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

func NewStakingUtils

func NewStakingUtils(t require.TestingT, helperStakingkeeper stakingkeeper.Keeper, bankUtils *BankUtils) StakingUtils

func (*StakingUtils) CreateValidator

func (su *StakingUtils) CreateValidator(ctx sdk.Context, addr sdk.ValAddress, pk cryptotypes.PubKey, coin sdk.Coin, commisions stakingtypes.CommissionRates)

func (*StakingUtils) ExportGenesisAndValidate added in v1.3.1

func (su *StakingUtils) ExportGenesisAndValidate(ctx sdk.Context)

func (*StakingUtils) GetStakingDenom added in v1.3.0

func (su *StakingUtils) GetStakingDenom(ctx sdk.Context) string

func (*StakingUtils) GetValidator

func (su *StakingUtils) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)

func (*StakingUtils) GetValidators added in v1.3.0

func (su *StakingUtils) GetValidators(ctx sdk.Context) []stakingtypes.Validator

func (*StakingUtils) MessageDelegate

func (su *StakingUtils) MessageDelegate(ctx sdk.Context, expectedCurrentAmountOfDelegations int, expectedCurrentAmountOfUnbondingDelegations int, validatorAddress sdk.ValAddress, delegatorAddress sdk.AccAddress, bondAmount math.Int)

func (*StakingUtils) MessageUndelegate

func (su *StakingUtils) MessageUndelegate(ctx sdk.Context, expectedCurrentAmountOfDelegations int, expectedCurrentAmountOfUnbondingDelegations int, validatorAddress sdk.ValAddress, delegatorAddress sdk.AccAddress, unbondAmount math.Int)

func (*StakingUtils) SetupValidators

func (su *StakingUtils) SetupValidators(ctx sdk.Context, validators []sdk.ValAddress, delegatePerValidator math.Int)

func (*StakingUtils) VerifyNumberOfUnbondingDelegations

func (su *StakingUtils) VerifyNumberOfUnbondingDelegations(ctx sdk.Context, expectedNumberOfUnbondingDelegations int, delegatorAddress sdk.AccAddress)

Jump to

Keyboard shortcuts

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