testutil

package
v0.0.0-...-853bff8 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Suite

type Suite struct {
	suite.Suite
	App           app.TestApp
	Ctx           sdk.Context
	Keeper        keeper.Keeper
	BankKeeper    bankkeeper.Keeper
	StakingKeeper stakingkeeper.Keeper
	EarnKeeper    earnkeeper.Keeper
}

Test suite used for all keeper tests

func (*Suite) AccountBalanceEqual

func (suite *Suite) AccountBalanceEqual(addr sdk.AccAddress, coins sdk.Coins)

AccountBalanceEqual checks if an account has the specified coins.

func (*Suite) AccountBalanceOfEqual

func (suite *Suite) AccountBalanceOfEqual(addr sdk.AccAddress, denom string, amount sdkmath.Int)

AccountBalanceOfEqual checks if an account has the specified amount of one denom.

func (*Suite) AccountSpendableBalanceEqual

func (suite *Suite) AccountSpendableBalanceEqual(addr sdk.AccAddress, amount sdk.Coins)

AccountSpendableBalanceEqual checks if an account has the specified coins unlocked.

func (*Suite) AddCoinsToModule

func (suite *Suite) AddCoinsToModule(module string, amount sdk.Coins)

AddCoinsToModule adds coins to the a module account, creating it if it doesn't exist.

func (*Suite) CreateAccountWithAddress

func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI

CreateAccount creates a new account from the provided balance and address

func (*Suite) CreateDelegation

func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec

CreateDelegation delegates tokens to a validator.

func (*Suite) CreateNewUnbondedValidator

func (suite *Suite) CreateNewUnbondedValidator(addr sdk.ValAddress, selfDelegation sdkmath.Int) stakingtypes.Validator

CreateNewUnbondedValidator creates a new validator in the staking module. New validators are unbonded until the end blocker is run.

func (*Suite) CreateVault

func (suite *Suite) CreateVault(
	vaultDenom string,
	vaultStrategies earntypes.StrategyTypes,
	isPrivateVault bool,
	allowedDepositors []sdk.AccAddress,
)

CreateVault adds a new earn vault to the earn keeper parameters

func (*Suite) CreateVestingAccountWithAddress

func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI

CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`.

func (*Suite) DelegationBalanceInDeltaBelow

func (suite *Suite) DelegationBalanceInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool

DelegationBalanceInDeltaBelow checks if a delegation's staked token balance is between `expected` and `expected - delta` inclusive. It treats not found delegations as having zero shares.

func (*Suite) DelegationBalanceLessThan

func (suite *Suite) DelegationBalanceLessThan(valAddr sdk.ValAddress, delegator sdk.AccAddress, max sdkmath.Int) bool

DelegationBalanceLessThan checks if a delegation's staked token balance is less the specified amount. It treats not found delegations as having zero shares.

func (*Suite) DelegationSharesEqual

func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) bool

DelegationSharesEqual checks if a delegation has the specified shares. It expects delegations with zero shares to not be stored in state.

func (*Suite) EventsContains

func (suite *Suite) EventsContains(events sdk.Events, expectedEvent sdk.Event)

EventsContains asserts that the expected event is in the provided events

func (*Suite) NewBondCoin

func (suite *Suite) NewBondCoin(amount sdkmath.Int) sdk.Coin

NewBondCoin creates a Coin with the current staking denom.

func (*Suite) NewBondCoins

func (suite *Suite) NewBondCoins(amount sdkmath.Int) sdk.Coins

NewBondCoins creates Coins with the current staking denom.

func (*Suite) QueryBank_SpendableBalance

func (suite *Suite) QueryBank_SpendableBalance(user sdk.AccAddress) sdk.Coins

func (*Suite) QueryEarn_VaultValue

func (suite *Suite) QueryEarn_VaultValue(depositor sdk.AccAddress, vaultDenom string) earntypes.DepositResponse

func (*Suite) QueryStaking_Delegation

func (suite *Suite) QueryStaking_Delegation(valAddr sdk.ValAddress, delegator sdk.AccAddress) stakingtypes.DelegationResponse

func (*Suite) SetSavingsSupportedDenoms

func (suite *Suite) SetSavingsSupportedDenoms(denoms []string)

SetSavingsSupportedDenoms overwrites the list of supported denoms in the savings module params.

func (*Suite) SetupTest

func (suite *Suite) SetupTest()

The default state used by each test

func (*Suite) SlashValidator

func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec)

SlashValidator burns tokens staked in a validator. new_tokens = old_tokens * (1-slashFraction)

func (*Suite) UnbondingDelegationInDeltaBelow

func (suite *Suite) UnbondingDelegationInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool

UnbondingDelegationInDeltaBelow checks if the total balance in an unbonding delegation is between `expected` and `expected - delta` inclusive.

func (*Suite) VaultAccountSharesEqual

func (suite *Suite) VaultAccountSharesEqual(acc sdk.AccAddress, shares earntypes.VaultShares)

VaultAccountSharesEqual asserts that the vault account shares match the provided values.

func (*Suite) VaultAccountValueEqual

func (suite *Suite) VaultAccountValueEqual(acc sdk.AccAddress, coin sdk.Coin)

VaultAccountValueEqual asserts that the vault account value matches the provided coin amount.

Jump to

Keyboard shortcuts

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