Documentation ¶
Index ¶
- Constants
- func AssertMarketCreateEventInIndexerBlock(t *testing.T, k *keeper.Keeper, ctx sdk.Context, ...)
- func AssertMarketEventsNotInIndexerBlock(t *testing.T, k *keeper.Keeper, ctx sdk.Context)
- func AssertMarketModifyEventInIndexerBlock(t *testing.T, k *keeper.Keeper, ctx sdk.Context, ...)
- func AssertMarketPriceUpdateEventInIndexerBlock(t *testing.T, k *keeper.Keeper, ctx sdk.Context, ...)
- func AssertPriceUpdateEventsInIndexerBlock(t *testing.T, k *keeper.Keeper, ctx sdk.Context, ...)
- func AssetsKeepers(t testing.TB, msgSenderEnabled bool) (ctx sdk.Context, keeper *keeper.Keeper, pricesKeeper *priceskeeper.Keeper, ...)
- func BridgeKeepers(t testing.TB) (ctx sdk.Context, keeper *keeper.Keeper, storeKey storetypes.StoreKey, ...)
- func CreateLiquidityTiersAndNPerpetuals(t *testing.T, ctx sdk.Context, keeper *keeper.Keeper, ...) []types.Perpetual
- func CreateNClobPair(t *testing.T, keeper *keeper.Keeper, perpKeeper *perpkeeper.Keeper, ...) []types.ClobPair
- func CreateNMarkets(t *testing.T, ctx sdk.Context, keeper *keeper.Keeper, n int) []types.MarketParamPrice
- func CreateNPerpetuals(t *testing.T, ctx sdk.Context, keeper *keeper.Keeper, ...) ([]types.Perpetual, error)
- func CreateTestClobPairs(t *testing.T, ctx sdk.Context, clobKeeper *keeper.Keeper, ...)
- func CreateTestLiquidityTiers(t *testing.T, ctx sdk.Context, k *keeper.Keeper)
- func CreateTestMarkets(t *testing.T, ctx sdk.Context, k *keeper.Keeper)
- func CreateTestPriceMarkets(t *testing.T, ctx sdk.Context, pricesKeeper *keeper.Keeper, ...)
- func CreateTestPricesAndPerpetualMarkets(t *testing.T, ctx sdk.Context, perpKeeper *keeper.Keeper, ...)
- func CreateUsdcAsset(ctx sdk.Context, assetsKeeper *keeper.Keeper) error
- func CreateUsdcAssetPosition(quoteBalance *big.Int) []*types.AssetPosition
- func CreateUsdcAssetUpdate(deltaQuoteBalance *big.Int) []types.AssetUpdate
- func DelayMsgKeeperWithMockBridgeKeeper(t testing.TB) (ctx sdk.Context, delayMsgKeeper *keeper.Keeper, storeKey storetypes.StoreKey, ...)
- func DelayMsgKeepers(t testing.TB) (ctx sdk.Context, delayMsgKeeper *keeper.Keeper, storeKey storetypes.StoreKey, ...)
- func EpochsKeeper(t testing.TB) (ctx sdk.Context, epochsKeeper *keeper.Keeper, storeKey storetypes.StoreKey)
- func GetAssetCreateEventsFromIndexerBlock(ctx sdk.Context, keeper *keeper.Keeper) []*indexerevents.AssetCreateEventV1
- func GetLiquidityTierUpsertEventsFromIndexerBlock(ctx sdk.Context, keeper *keeper.Keeper) []*indexerevents.LiquidityTierUpsertEventV1
- func GetNumMarkets(t *testing.T, ctx sdk.Context, keeper *keeper.Keeper) uint32
- func GetSubaccountUpdateEventsFromIndexerBlock(ctx sdk.Context, keeper *keeper.Keeper) []*indexerevents.SubaccountUpdateEventV1
- func PopulateTestPremiumStore(t *testing.T, ctx sdk.Context, k *keeper.Keeper, perpetuals []types.Perpetual, ...)
- func PricesKeepers(t testing.TB) (ctx sdk.Context, keeper *keeper.Keeper, storeKey storetypes.StoreKey, ...)
- func SubaccountsKeepers(t testing.TB, msgSenderEnabled bool) (ctx sdk.Context, keeper *keeper.Keeper, pricesKeeper *priceskeeper.Keeper, ...)
- type ClobKeepersTestContext
- type GenesisInitializer
- type PerpKeepersTestContext
- type SendingKeepersTestContext
Constants ¶
const ( TestEpochInfoName = "name" TestEpochDuration = uint32(20) TestCreateEpochBlockTimeSec = 1656900000 )
Variables ¶
This section is empty.
Functions ¶
func AssertMarketCreateEventInIndexerBlock ¶
func AssertMarketCreateEventInIndexerBlock( t *testing.T, k *keeper.Keeper, ctx sdk.Context, createdMarketParam types.MarketParam, )
AssertMarketCreateEventInIndexerBlock verifies that the market create has a corresponding market create event included in the Indexer block message.
func AssertMarketEventsNotInIndexerBlock ¶
AssertMarketEventsNotInIndexerBlock verifies that no market events were included in the Indexer block message.
func AssertMarketModifyEventInIndexerBlock ¶
func AssertMarketModifyEventInIndexerBlock( t *testing.T, k *keeper.Keeper, ctx sdk.Context, updatedMarketParam types.MarketParam, )
AssertMarketModifyEventInIndexerBlock verifies that the market update has a corresponding market modify event included in the Indexer block message.
func AssertPriceUpdateEventsInIndexerBlock ¶
func AssertPriceUpdateEventsInIndexerBlock( t *testing.T, k *keeper.Keeper, ctx sdk.Context, updatedMarketPrices []types.MarketPrice, )
AssertPriceUpdateEventsInIndexerBlock verifies that the market update has a corresponding price update event included in the Indexer block message.
func AssetsKeepers ¶
func AssetsKeepers( t testing.TB, msgSenderEnabled bool, ) ( ctx sdk.Context, keeper *keeper.Keeper, pricesKeeper *priceskeeper.Keeper, accountKeeper *authkeeper.AccountKeeper, bankKeeper *bankkeeper.BaseKeeper, storeKey storetypes.StoreKey, )
func BridgeKeepers ¶
func BridgeKeepers( t testing.TB, ) ( ctx sdk.Context, keeper *keeper.Keeper, storeKey storetypes.StoreKey, mockTimeProvider *mocks.TimeProvider, bridgeEventManager *bridgeserver_types.BridgeEventManager, bankKeeper *bankkeeper.BaseKeeper, mockDelayMsgKeeper *mocks.DelayMsgKeeper, )
func CreateNClobPair ¶
func CreateNClobPair( t *testing.T, keeper *keeper.Keeper, perpKeeper *perpkeeper.Keeper, pricesKeeper *priceskeeper.Keeper, ctx sdk.Context, n int, mockIndexerEventManager *mocks.IndexerEventManager, ) []types.ClobPair
func CreateNMarkets ¶
func CreateNMarkets(t *testing.T, ctx sdk.Context, keeper *keeper.Keeper, n int) []types.MarketParamPrice
CreateNMarkets creates N MarketParam, MarketPrice pairs for testing.
func CreateNPerpetuals ¶
func CreateTestClobPairs ¶
func CreateTestMarkets ¶
CreateTestMarkets creates a standard set of test markets for testing. This function assumes no markets exist and will create markets as id `0`, `1`, and `2`, ... using markets defined in constants.TestMarkets.
func CreateTestPriceMarkets ¶ added in v0.3.0
func CreateTestPriceMarkets( t *testing.T, ctx sdk.Context, pricesKeeper *keeper.Keeper, markets []types.MarketParamPrice, )
CreateTestPriceMarkets is a test utility function that creates list of given price markets in state.
func CreateTestPricesAndPerpetualMarkets ¶
func CreateTestPricesAndPerpetualMarkets( t *testing.T, ctx sdk.Context, perpKeeper *keeper.Keeper, pricesKeeper *priceskeeper.Keeper, perpetuals []types.Perpetual, markets []pricestypes.MarketParamPrice, )
CreateTestPricesAndPerpetualMarkets is a test utility function that creates list of given prices and perpetual markets in state.
func CreateUsdcAsset ¶
CreateUsdcAsset creates USDC in the assets module for tests.
func CreateUsdcAssetPosition ¶
func CreateUsdcAssetPosition( quoteBalance *big.Int, ) []*types.AssetPosition
func CreateUsdcAssetUpdate ¶
func CreateUsdcAssetUpdate( deltaQuoteBalance *big.Int, ) []types.AssetUpdate
func DelayMsgKeepers ¶
func DelayMsgKeepers( t testing.TB, ) ( ctx sdk.Context, delayMsgKeeper *keeper.Keeper, storeKey storetypes.StoreKey, bridgeKeeper *bridgekeeper.Keeper, bankKeeper bankkeeper.Keeper, authorities []string, )
func EpochsKeeper ¶
func GetAssetCreateEventsFromIndexerBlock ¶
func GetAssetCreateEventsFromIndexerBlock( ctx sdk.Context, keeper *keeper.Keeper, ) []*indexerevents.AssetCreateEventV1
GetAssetCreateEventsFromIndexerBlock returns the asset create events in the Indexer Block event Kafka message.
func GetLiquidityTierUpsertEventsFromIndexerBlock ¶
func GetLiquidityTierUpsertEventsFromIndexerBlock( ctx sdk.Context, keeper *keeper.Keeper, ) []*indexerevents.LiquidityTierUpsertEventV1
GetLiquidityTierUpsertEventsFromIndexerBlock returns the liquidityTier upsert events in the Indexer Block event Kafka message. TODO(IND-365): Consider using generics here to reduce duplicated code.
func GetNumMarkets ¶ added in v0.3.0
func GetSubaccountUpdateEventsFromIndexerBlock ¶
func GetSubaccountUpdateEventsFromIndexerBlock( ctx sdk.Context, keeper *keeper.Keeper, ) []*indexerevents.SubaccountUpdateEventV1
GetSubaccountUpdateEventsFromIndexerBlock returns the subaccount update events in the Indexer Block event Kafka message.
func PopulateTestPremiumStore ¶
func PopulateTestPremiumStore( t *testing.T, ctx sdk.Context, k *keeper.Keeper, perpetuals []types.Perpetual, testFundingPremiums []int32, isVote bool, )
PopulateTestPremiumStore populates either `PremiumVotes` (`isVote` is true) or `PremiumSamples` (`isVote` is false) for test. For each perpetual in the given perpetuals, insert the same list of testFundingSamples into state.
func PricesKeepers ¶
func PricesKeepers( t testing.TB, ) ( ctx sdk.Context, keeper *keeper.Keeper, storeKey storetypes.StoreKey, indexPriceCache *pricefeedserver_types.MarketToExchangePrices, marketToSmoothedPrices types.MarketToSmoothedPrices, mockTimeProvider *mocks.TimeProvider, )
func SubaccountsKeepers ¶
func SubaccountsKeepers( t testing.TB, msgSenderEnabled bool, ) ( ctx sdk.Context, keeper *keeper.Keeper, pricesKeeper *priceskeeper.Keeper, perpetualsKeeper *perpskeeper.Keeper, accountKeeper *authkeeper.AccountKeeper, bankKeeper *bankkeeper.BaseKeeper, assetsKeeper *asskeeper.Keeper, storeKey storetypes.StoreKey, )
Types ¶
type ClobKeepersTestContext ¶
type ClobKeepersTestContext struct { Ctx sdk.Context ClobKeeper *keeper.Keeper PricesKeeper *priceskeeper.Keeper AssetsKeeper *asskeeper.Keeper BlockTimeKeeper *blocktimekeeper.Keeper FeeTiersKeeper *feetierskeeper.Keeper PerpetualsKeeper *perpkeeper.Keeper StatsKeeper *statskeeper.Keeper RewardsKeeper *rewardskeeper.Keeper SubaccountsKeeper *subkeeper.Keeper StoreKey storetypes.StoreKey MemKey storetypes.StoreKey Cdc *codec.ProtoCodec }
func NewClobKeepersTestContext ¶
func NewClobKeepersTestContext( t testing.TB, memClob types.MemClob, bankKeeper bankkeeper.Keeper, indexerEventManager indexer_manager.IndexerEventManager, ) (ks ClobKeepersTestContext)
func NewClobKeepersTestContextWithUninitializedMemStore ¶
func NewClobKeepersTestContextWithUninitializedMemStore( t testing.TB, memClob types.MemClob, bankKeeper bankkeeper.Keeper, indexerEventManager indexer_manager.IndexerEventManager, ) (ks ClobKeepersTestContext)
type GenesisInitializer ¶
type PerpKeepersTestContext ¶ added in v0.3.0
type PerpKeepersTestContext struct { Ctx sdk.Context PricesKeeper *priceskeeper.Keeper IndexPriceCache *pricefeedserver_types.MarketToExchangePrices AssetsKeeper *assetskeeper.Keeper EpochsKeeper *epochskeeper.Keeper PerpetualsKeeper *keeper.Keeper StoreKey storetypes.StoreKey MemKey storetypes.StoreKey Cdc *codec.ProtoCodec MockTimeProvider *mocks.TimeProvider }
func PerpetualsKeepers ¶
func PerpetualsKeepers( t testing.TB, ) (pc PerpKeepersTestContext)
func PerpetualsKeepersWithClobHelpers ¶
func PerpetualsKeepersWithClobHelpers( t testing.TB, clobKeeper types.PerpetualsClobKeeper, ) (pc PerpKeepersTestContext)
type SendingKeepersTestContext ¶ added in v0.3.0
type SendingKeepersTestContext struct { Ctx sdk.Context SendingKeeper *keeper.Keeper AccountKeeper *authkeeper.AccountKeeper BankKeeper *bankkeeper.BaseKeeper PricesKeeper *priceskeeper.Keeper PerpetualsKeeper *perpkeeper.Keeper AssetsKeeper *assetskeeper.Keeper SubaccountsKeeper types.SubaccountsKeeper StoreKey storetypes.StoreKey }
func SendingKeepers ¶
func SendingKeepers(t testing.TB) ( ks SendingKeepersTestContext, )
func SendingKeepersWithSubaccountsKeeper ¶
func SendingKeepersWithSubaccountsKeeper(t testing.TB, saKeeper types.SubaccountsKeeper) ( ks SendingKeepersTestContext, )