cosmossdk

package
v2.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddressFromBech32

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

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

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

func (*AuthUtils) CreateDefaultDenomBaseAccount

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) ModifyVestingAccountOriginalVesting

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

func (*AuthUtils) VerifyAccountDoesNotExist

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

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

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

func (*BankUtils) GetAccountAllBalances

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

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

func (*BankUtils) GetModuleAccountAllBalances

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

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

func (*BankUtils) VerifyAccountAllBalances

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

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

func (*BankUtils) VerifyAccountDefaultDenomBalance

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

func (*BankUtils) VerifyAccountDefultDenomLocked

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

func (*BankUtils) VerifyAccountDefultDenomSpendableCoins

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

func (*BankUtils) VerifyAccountLockedByDenom

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

func (*BankUtils) VerifyAccountSpendableByDenom

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

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

func (*BankUtils) VerifyModuleAccountAllBalances

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

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

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) ModifyVestingAccountOriginalVesting

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

func (*ContextAuthUtils) VerifyAccountDoesNotExist

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

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

func (bu *ContextBankUtils) DisableSend()

func (*ContextBankUtils) GetAccountAllBalances

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

func (*ContextBankUtils) GetAccountDefultDenomBalance

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

func (*ContextBankUtils) GetAccountLockedCoins

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

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

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

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

func NewContextDistributionUtils

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

type ContextFeegrantUtils

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

func NewContextFeegrantUtils

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

type ContextGovUtils

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

func NewContextGovUtils

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) GetStakingDenom

func (su *ContextStakingUtils) GetStakingDenom() string

func (*ContextStakingUtils) GetValidator

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

func (*ContextStakingUtils) GetValidators

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

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

func NewDistributionUtils

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

type FeegrantUtils

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

func NewFeegrantUtils

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

type GovUtils

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

func NewGovUtils

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) GetStakingDenom

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

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