testutil

package
v0.0.0-...-ff1fc56 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStandardMoneyMarket

func NewStandardMoneyMarket(denom string) hardtypes.MoneyMarket

Types

type EarnGenesisBuilder

type EarnGenesisBuilder struct {
	earntypes.GenesisState
}

EarnGenesisBuilder is a tool for creating a earn genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewEarnGenesisBuilder

func NewEarnGenesisBuilder() EarnGenesisBuilder

func (EarnGenesisBuilder) Build

func (builder EarnGenesisBuilder) Build() earntypes.GenesisState

func (EarnGenesisBuilder) BuildMarshalled

func (builder EarnGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

func (EarnGenesisBuilder) WithAllowedVaults

func (builder EarnGenesisBuilder) WithAllowedVaults(vault ...earntypes.AllowedVault) EarnGenesisBuilder

type GenesisBuilder

type GenesisBuilder interface {
	BuildMarshalled(cdc codec.JSONCodec) app.GenesisState
}

type HardGenesisBuilder

type HardGenesisBuilder struct {
	hardtypes.GenesisState
	// contains filtered or unexported fields
}

HardGenesisBuilder is a tool for creating a hard genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewHardGenesisBuilder

func NewHardGenesisBuilder() HardGenesisBuilder

func (HardGenesisBuilder) Build

func (builder HardGenesisBuilder) Build() hardtypes.GenesisState

func (HardGenesisBuilder) BuildMarshalled

func (builder HardGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

func (HardGenesisBuilder) WithGenesisTime

func (builder HardGenesisBuilder) WithGenesisTime(genTime time.Time) HardGenesisBuilder

func (HardGenesisBuilder) WithInitializedMoneyMarket

func (builder HardGenesisBuilder) WithInitializedMoneyMarket(market hardtypes.MoneyMarket) HardGenesisBuilder

func (HardGenesisBuilder) WithMinBorrow

func (builder HardGenesisBuilder) WithMinBorrow(minUSDValue sdk.Dec) HardGenesisBuilder

type IncentiveGenesisBuilder

type IncentiveGenesisBuilder struct {
	types.GenesisState
	// contains filtered or unexported fields
}

IncentiveGenesisBuilder is a tool for creating an incentive genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewIncentiveGenesisBuilder

func NewIncentiveGenesisBuilder() IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) Build

func (builder IncentiveGenesisBuilder) Build() types.GenesisState

func (IncentiveGenesisBuilder) BuildMarshalled

func (builder IncentiveGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

func (IncentiveGenesisBuilder) WithGenesisTime

func (builder IncentiveGenesisBuilder) WithGenesisTime(time time.Time) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithInitializedBorrowRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedBorrowRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedBorrowRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedDelegatorRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedDelegatorRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedDelegatorRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedEarnRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedEarnRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedEarnRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedRewardPeriod(
	claimType types.ClaimType,
	periods types.MultiRewardPeriods,
) IncentiveGenesisBuilder

WithInitializedRewardPeriod adds an initialized typed reward period.

func (IncentiveGenesisBuilder) WithInitializedSavingsRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedSavingsRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedSavingsRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedSupplyRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedSupplyRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedSupplyRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedSwapRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedSwapRewardPeriod(period types.MultiRewardPeriod) IncentiveGenesisBuilder

WithInitializedSwapRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithInitializedUSDXRewardPeriod

func (builder IncentiveGenesisBuilder) WithInitializedUSDXRewardPeriod(period types.RewardPeriod) IncentiveGenesisBuilder

WithInitializedUSDXRewardPeriod sets the genesis time as the previous accumulation time for the specified period. This can be helpful in tests. With no prev time set, the first block accrues no rewards as it just sets the prev time to the current.

func (IncentiveGenesisBuilder) WithMultipliers

func (builder IncentiveGenesisBuilder) WithMultipliers(multipliers types.MultipliersPerDenoms) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleBorrowRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleBorrowRewardPeriod(ctype string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleDelegatorRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleDelegatorRewardPeriod(ctype string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleEarnRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleEarnRewardPeriod(ctype string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleRewardPeriod(
	claimType types.ClaimType,
	collateralType string,
	rewardsPerSecond sdk.Coins,
) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleSavingsRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleSavingsRewardPeriod(ctype string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleSupplyRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleSupplyRewardPeriod(ctype string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleSwapRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleSwapRewardPeriod(poolID string, rewardsPerSecond sdk.Coins) IncentiveGenesisBuilder

func (IncentiveGenesisBuilder) WithSimpleUSDXRewardPeriod

func (builder IncentiveGenesisBuilder) WithSimpleUSDXRewardPeriod(ctype string, rewardsPerSecond sdk.Coin) IncentiveGenesisBuilder

type IntegrationTester

type IntegrationTester struct {
	suite.Suite
	App app.TestApp
	Ctx sdk.Context

	GenesisTime time.Time
}

func (*IntegrationTester) AddIncentiveEarnMultiRewardPeriod

func (suite *IntegrationTester) AddIncentiveEarnMultiRewardPeriod(period types.MultiRewardPeriod)

func (*IntegrationTester) AddIncentiveMultiRewardPeriod

func (suite *IntegrationTester) AddIncentiveMultiRewardPeriod(
	claimType types.ClaimType,
	period types.MultiRewardPeriod,
)

func (*IntegrationTester) AddTestAddrsFromPubKeys

func (suite *IntegrationTester) AddTestAddrsFromPubKeys(ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)

AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.

func (*IntegrationTester) BalanceEquals

func (suite *IntegrationTester) BalanceEquals(address sdk.AccAddress, expected sdk.Coins)

func (*IntegrationTester) BalanceInEpsilon

func (suite *IntegrationTester) BalanceInEpsilon(address sdk.AccAddress, expected sdk.Coins, epsilon float64)

func (*IntegrationTester) DelegatorRewardEquals

func (suite *IntegrationTester) DelegatorRewardEquals(owner sdk.AccAddress, expected sdk.Coins)

func (*IntegrationTester) DeliverCDPMsgBorrow

func (suite *IntegrationTester) DeliverCDPMsgBorrow(owner sdk.AccAddress, collateralType string, draw sdk.Coin) error

func (*IntegrationTester) DeliverCDPMsgRepay

func (suite *IntegrationTester) DeliverCDPMsgRepay(owner sdk.AccAddress, collateralType string, payment sdk.Coin) error

func (*IntegrationTester) DeliverEarnMsgDeposit

func (suite *IntegrationTester) DeliverEarnMsgDeposit(
	depositor sdk.AccAddress,
	amount sdk.Coin,
	strategy earntypes.StrategyType,
) error

func (*IntegrationTester) DeliverHardMsgBorrow

func (suite *IntegrationTester) DeliverHardMsgBorrow(owner sdk.AccAddress, borrow sdk.Coins) error

func (*IntegrationTester) DeliverHardMsgDeposit

func (suite *IntegrationTester) DeliverHardMsgDeposit(owner sdk.AccAddress, deposit sdk.Coins) error

func (*IntegrationTester) DeliverHardMsgRepay

func (suite *IntegrationTester) DeliverHardMsgRepay(owner sdk.AccAddress, repay sdk.Coins) error

func (*IntegrationTester) DeliverHardMsgWithdraw

func (suite *IntegrationTester) DeliverHardMsgWithdraw(owner sdk.AccAddress, withdraw sdk.Coins) error

func (*IntegrationTester) DeliverIncentiveMsg

func (suite *IntegrationTester) DeliverIncentiveMsg(msg sdk.Msg) error

func (*IntegrationTester) DeliverMsgCreateCDP

func (suite *IntegrationTester) DeliverMsgCreateCDP(owner sdk.AccAddress, collateral, principal sdk.Coin, collateralType string) error

func (*IntegrationTester) DeliverMsgCreateValidator

func (suite *IntegrationTester) DeliverMsgCreateValidator(address sdk.ValAddress, selfDelegation sdk.Coin) error

func (*IntegrationTester) DeliverMsgDelegate

func (suite *IntegrationTester) DeliverMsgDelegate(delegator sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) error

func (*IntegrationTester) DeliverMsgDelegateMint

func (suite *IntegrationTester) DeliverMsgDelegateMint(
	delegator sdk.AccAddress,
	validator sdk.ValAddress,
	amount sdk.Coin,
) (sdk.Coin, error)

func (*IntegrationTester) DeliverMsgMintDerivative

func (suite *IntegrationTester) DeliverMsgMintDerivative(
	sender sdk.AccAddress,
	validator sdk.ValAddress,
	amount sdk.Coin,
) (sdk.Coin, error)

func (*IntegrationTester) DeliverRouterMsgDelegateMintDeposit

func (suite *IntegrationTester) DeliverRouterMsgDelegateMintDeposit(
	depositor sdk.AccAddress,
	validator sdk.ValAddress,
	amount sdk.Coin,
) error

func (*IntegrationTester) DeliverRouterMsgMintDeposit

func (suite *IntegrationTester) DeliverRouterMsgMintDeposit(
	depositor sdk.AccAddress,
	validator sdk.ValAddress,
	amount sdk.Coin,
) error

func (*IntegrationTester) DeliverSwapMsgDeposit

func (suite *IntegrationTester) DeliverSwapMsgDeposit(depositor sdk.AccAddress, tokenA, tokenB sdk.Coin, slippage sdk.Dec) error

func (*IntegrationTester) EarnRewardEquals

func (suite *IntegrationTester) EarnRewardEquals(owner sdk.AccAddress, expected sdk.Coins)

func (*IntegrationTester) ErrorIs

func (suite *IntegrationTester) ErrorIs(err, target error) bool

func (*IntegrationTester) GetAbciValidator

func (suite *IntegrationTester) GetAbciValidator(valAddr sdk.ValAddress) abcitypes.Validator

func (*IntegrationTester) GetAccount

func (suite *IntegrationTester) GetAccount(addr sdk.AccAddress) authtypes.AccountI

func (*IntegrationTester) GetBalance

func (suite *IntegrationTester) GetBalance(address sdk.AccAddress) sdk.Coins

func (*IntegrationTester) GetBeginBlockClaimedStakingRewards

func (suite *IntegrationTester) GetBeginBlockClaimedStakingRewards(
	resBeginBlock abcitypes.ResponseBeginBlock,
) (validatorRewards map[string]sdk.Coins, totalRewards sdk.Coins)

func (*IntegrationTester) GetModuleAccount

func (suite *IntegrationTester) GetModuleAccount(name string) authtypes.ModuleAccountI

func (*IntegrationTester) HardRewardEquals

func (suite *IntegrationTester) HardRewardEquals(owner sdk.AccAddress, expected sdk.Coins)

func (*IntegrationTester) MintLiquidAnyValAddr

func (suite *IntegrationTester) MintLiquidAnyValAddr(
	owner sdk.AccAddress,
	validator sdk.ValAddress,
	amount sdk.Coin,
) (sdk.Coin, error)

MintLiquidAnyValAddr mints liquid tokens with the given validator address, creating the validator if it does not already exist. **Note:** This will increment the block height/time and run the End and Begin blockers!

func (*IntegrationTester) NextBlockAfter

func (suite *IntegrationTester) NextBlockAfter(blockDuration time.Duration)

func (*IntegrationTester) NextBlockAfterWithReq

func (*IntegrationTester) NextBlockAt

func (*IntegrationTester) NextBlockAtWithRequest

func (*IntegrationTester) ProposeAndVoteOnNewParams

func (suite *IntegrationTester) ProposeAndVoteOnNewParams(voter sdk.AccAddress, committeeID uint64, changes []proposaltypes.ParamChange)

func (*IntegrationTester) SetApp

func (suite *IntegrationTester) SetApp()

func (*IntegrationTester) SetupSuite

func (suite *IntegrationTester) SetupSuite()

func (*IntegrationTester) SetupTest

func (suite *IntegrationTester) SetupTest()

func (*IntegrationTester) StartChain

func (suite *IntegrationTester) StartChain(genesisStates ...app.GenesisState)

func (*IntegrationTester) StartChainWithBuilders

func (suite *IntegrationTester) StartChainWithBuilders(builders ...GenesisBuilder)

func (*IntegrationTester) StoredEarnIndexesEqual

func (suite *IntegrationTester) StoredEarnIndexesEqual(denom string, expected types.RewardIndexes)

func (*IntegrationTester) StoredEarnTimeEquals

func (suite *IntegrationTester) StoredEarnTimeEquals(denom string, expected time.Time)

func (*IntegrationTester) StoredIndexesEqual

func (suite *IntegrationTester) StoredIndexesEqual(claimType types.ClaimType, denom string, expected types.RewardIndexes)

func (*IntegrationTester) StoredTimeEquals

func (suite *IntegrationTester) StoredTimeEquals(claimType types.ClaimType, denom string, expected time.Time)

func (*IntegrationTester) SwapRewardEquals

func (suite *IntegrationTester) SwapRewardEquals(owner sdk.AccAddress, expected sdk.Coins)

func (*IntegrationTester) USDXRewardEquals

func (suite *IntegrationTester) USDXRewardEquals(owner sdk.AccAddress, expected sdk.Coin)

func (*IntegrationTester) VestingPeriodsEqual

func (suite *IntegrationTester) VestingPeriodsEqual(address sdk.AccAddress, expectedPeriods []vestingtypes.Period)

func (*IntegrationTester) WithGenesisTime

func (suite *IntegrationTester) WithGenesisTime(genesisTime time.Time)

type MintGenesisBuilder

type MintGenesisBuilder struct {
	minttypes.GenesisState
}

MintGenesisBuilder is a tool for creating a mint genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewMintGenesisBuilder

func NewMintGenesisBuilder() MintGenesisBuilder

func (MintGenesisBuilder) Build

func (builder MintGenesisBuilder) Build() minttypes.GenesisState

func (MintGenesisBuilder) BuildMarshalled

func (builder MintGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

func (MintGenesisBuilder) WithInflationMax

func (builder MintGenesisBuilder) WithInflationMax(
	inflationMax sdk.Dec,
) MintGenesisBuilder

func (MintGenesisBuilder) WithInflationMin

func (builder MintGenesisBuilder) WithInflationMin(
	inflationMin sdk.Dec,
) MintGenesisBuilder

func (MintGenesisBuilder) WithMintDenom

func (builder MintGenesisBuilder) WithMintDenom(
	mintDenom string,
) MintGenesisBuilder

func (MintGenesisBuilder) WithMinter

func (builder MintGenesisBuilder) WithMinter(
	inflation sdk.Dec,
	annualProvisions sdk.Dec,
) MintGenesisBuilder

type SavingsGenesisBuilder

type SavingsGenesisBuilder struct {
	savingstypes.GenesisState
	// contains filtered or unexported fields
}

SavingsGenesisBuilder is a tool for creating a savings genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewSavingsGenesisBuilder

func NewSavingsGenesisBuilder() SavingsGenesisBuilder

func (SavingsGenesisBuilder) Build

func (SavingsGenesisBuilder) BuildMarshalled

func (builder SavingsGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

func (SavingsGenesisBuilder) WithGenesisTime

func (builder SavingsGenesisBuilder) WithGenesisTime(genTime time.Time) SavingsGenesisBuilder

func (SavingsGenesisBuilder) WithSupportedDenoms

func (builder SavingsGenesisBuilder) WithSupportedDenoms(denoms ...string) SavingsGenesisBuilder

type StakingGenesisBuilder

type StakingGenesisBuilder struct {
	stakingtypes.GenesisState
}

StakingGenesisBuilder is a tool for creating a staking genesis state. Helper methods add values onto a default genesis state. All methods are immutable and return updated copies of the builder.

func NewStakingGenesisBuilder

func NewStakingGenesisBuilder() StakingGenesisBuilder

func (StakingGenesisBuilder) Build

func (StakingGenesisBuilder) BuildMarshalled

func (builder StakingGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState

type TestKeeper

type TestKeeper struct {
	keeper.Keeper
}

TestKeeper is a test wrapper for the keeper which contains useful methods for testing

func (TestKeeper) StoreGlobalBorrowIndexes

func (keeper TestKeeper) StoreGlobalBorrowIndexes(ctx sdk.Context, indexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalDelegatorIndexes

func (keeper TestKeeper) StoreGlobalDelegatorIndexes(ctx sdk.Context, multiRewardIndexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalEarnIndexes

func (keeper TestKeeper) StoreGlobalEarnIndexes(ctx sdk.Context, indexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalIndexes

func (keeper TestKeeper) StoreGlobalIndexes(ctx sdk.Context, claimType types.ClaimType, indexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalSavingsIndexes

func (keeper TestKeeper) StoreGlobalSavingsIndexes(ctx sdk.Context, indexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalSupplyIndexes

func (keeper TestKeeper) StoreGlobalSupplyIndexes(ctx sdk.Context, indexes types.MultiRewardIndexes)

func (TestKeeper) StoreGlobalSwapIndexes

func (keeper TestKeeper) StoreGlobalSwapIndexes(ctx sdk.Context, indexes types.MultiRewardIndexes)

Jump to

Keyboard shortcuts

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