cosmossdk

package
v1.2.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 22 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 CreateRandomAccAddressNoBalance

func CreateRandomAccAddressNoBalance(i int64) 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) 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) 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) 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) 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) VerifyAccountDefultDenomBalance

func (bu *BankUtils) VerifyAccountDefultDenomBalance(ctx sdk.Context, addr sdk.AccAddress, 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) 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) 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 sdk.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 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) 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 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) GetValidator

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

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

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

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