Skip to content

Commit

Permalink
More quieries tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbernal87 committed Feb 22, 2024
1 parent 4ce1d52 commit e7c9ab2
Show file tree
Hide file tree
Showing 5 changed files with 1,203 additions and 72 deletions.
70 changes: 70 additions & 0 deletions contracts/injective-cosmwasm-mock/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,75 @@ pub fn query(deps: Deps<InjectiveQueryWrapper>, _env: Env, msg: QueryMsg) -> Std
QueryMsg::TestSubAccountDepositQuery { subaccount_id, denom } => to_json_binary(&querier.query_subaccount_deposit(&subaccount_id, &denom)?),
QueryMsg::TestSpotMarketQuery { market_id } => to_json_binary(&querier.query_spot_market(&market_id)?),
QueryMsg::TestDerivativeMarketQuery { market_id } => to_json_binary(&querier.query_derivative_market(&market_id)?),
QueryMsg::TestEffectiveSubaccountPosition { market_id, subaccount_id } => {
to_json_binary(&querier.query_effective_subaccount_position(&market_id, &subaccount_id)?)
}
QueryMsg::TestVanillaSubaccountPosition { market_id, subaccount_id } => {
to_json_binary(&querier.query_vanilla_subaccount_position(&market_id, &subaccount_id)?)
}
QueryMsg::TestTraderDerivativeOrders { market_id, subaccount_id } => {
to_json_binary(&querier.query_trader_derivative_orders(&market_id, &subaccount_id)?)
}
QueryMsg::TestTraderTransientSpotOrders { market_id, subaccount_id } => {
to_json_binary(&querier.query_trader_transient_spot_orders(&market_id, &subaccount_id)?)
}
QueryMsg::TestTraderTransientDerivativeOrders { market_id, subaccount_id } => {
to_json_binary(&querier.query_trader_transient_derivative_orders(&market_id, &subaccount_id)?)
}
QueryMsg::TestTraderSpotOrders { market_id, subaccount_id } => to_json_binary(&querier.query_trader_spot_orders(&market_id, &subaccount_id)?),
QueryMsg::TestSpotOrdersToCancelUpToAmount {
market_id,
subaccount_id,
base_amount,
quote_amount,
strategy,
reference_price,
} => to_json_binary(&querier.query_spot_orders_to_cancel_up_to_amount(
&market_id,
&subaccount_id,
base_amount,
quote_amount,
strategy,
reference_price,
)?),
QueryMsg::TestDerivativeOrdersToCancelUpToAmount {
market_id,
subaccount_id,
quote_amount,
strategy,
reference_price,
} => to_json_binary(&querier.query_derivative_orders_to_cancel_up_to_amount(
&market_id,
&subaccount_id,
quote_amount,
strategy,
reference_price,
)?),
QueryMsg::TestPerpetualMarketInfo { market_id } => to_json_binary(&querier.query_perpetual_market_info(&market_id)?),
QueryMsg::TestPerpetualMarketFunding { market_id } => to_json_binary(&querier.query_perpetual_market_funding(&market_id)?),
QueryMsg::TestMarketVolatility {
market_id,
trade_grouping_sec,
max_age,
include_raw_history,
include_metadata,
} => to_json_binary(&querier.query_market_volatility(&market_id, trade_grouping_sec, max_age, include_raw_history, include_metadata)?),
QueryMsg::TestDerivativeMarketMidPriceAndTob { market_id } => to_json_binary(&querier.query_derivative_market_mid_price_and_tob(&market_id)?),
QueryMsg::TestAggregateMarketVolume { market_id } => to_json_binary(&querier.query_aggregate_market_volume(&market_id)?),
QueryMsg::TestAggregateAccountVolume { account_id } => to_json_binary(&querier.query_aggregate_account_volume(&account_id)?),
QueryMsg::TestSpotMarketMidPriceAndTob { market_id } => to_json_binary(&querier.query_spot_market_mid_price_and_tob(&market_id)?),
QueryMsg::TestSpotMarketOrderbook {
market_id,
side,
limit_cumulative_quantity,
limit_cumulative_notional,
} => to_json_binary(&querier.query_spot_market_orderbook(&market_id, side, limit_cumulative_quantity, limit_cumulative_notional)?),
QueryMsg::TestDerivativeMarketOrderbook {
market_id,
limit_cumulative_notional,
} => to_json_binary(&querier.query_derivative_market_orderbook(&market_id, limit_cumulative_notional)?),
QueryMsg::TestMarketAtomicExecutionFeeMultiplier { market_id } => {
to_json_binary(&querier.query_market_atomic_execution_fee_multiplier(&market_id)?)
}
}
}
90 changes: 87 additions & 3 deletions contracts/injective-cosmwasm-mock/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,91 @@ pub enum ExecuteMsg {
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
TestExchangeParamsQuery {},
TestSpotMarketQuery { market_id: MarketId },
TestDerivativeMarketQuery { market_id: MarketId },
TestSubAccountDepositQuery { subaccount_id: SubaccountId, denom: String },
TestSpotMarketQuery {
market_id: MarketId,
},
TestDerivativeMarketQuery {
market_id: MarketId,
},
TestSubAccountDepositQuery {
subaccount_id: SubaccountId,
denom: String,
},
TestEffectiveSubaccountPosition {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestVanillaSubaccountPosition {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestTraderDerivativeOrders {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestTraderTransientSpotOrders {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestTraderTransientDerivativeOrders {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestTraderSpotOrders {
market_id: MarketId,
subaccount_id: SubaccountId,
},
TestSpotOrdersToCancelUpToAmount {
market_id: MarketId,
subaccount_id: SubaccountId,
base_amount: FPDecimal,

Check failure on line 56 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
quote_amount: FPDecimal,

Check failure on line 57 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
strategy: CancellationStrategy,

Check failure on line 58 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `CancellationStrategy` in this scope
reference_price: Option<FPDecimal>,

Check failure on line 59 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
},
TestDerivativeOrdersToCancelUpToAmount {
market_id: MarketId,
subaccount_id: SubaccountId,
quote_amount: FPDecimal,

Check failure on line 64 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
strategy: CancellationStrategy,

Check failure on line 65 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `CancellationStrategy` in this scope
reference_price: Option<FPDecimal>,

Check failure on line 66 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
},
TestPerpetualMarketInfo {
market_id: MarketId,
},
TestPerpetualMarketFunding {
market_id: MarketId,
},
TestMarketVolatility {
market_id: MarketId,
trade_grouping_sec: u64,
max_age: u64,
include_raw_history: bool,
include_metadata: bool,
},
TestDerivativeMarketMidPriceAndTob {
market_id: MarketId,
},
TestAggregateMarketVolume {
market_id: MarketId,
},
TestAggregateAccountVolume {
account_id: String,
},
TestSpotMarketMidPriceAndTob {
market_id: MarketId,
},
TestSpotMarketOrderbook {
market_id: MarketId,
side: OrderSide,

Check failure on line 95 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `OrderSide` in this scope
limit_cumulative_quantity: Option<FPDecimal>,

Check failure on line 96 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
limit_cumulative_notional: Option<FPDecimal>,

Check failure on line 97 in contracts/injective-cosmwasm-mock/src/msg.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot find type `FPDecimal` in this scope
},
TestDerivativeMarketOrderbook {
market_id: MarketId,
limit_cumulative_notional: FPDecimal,
},
TestMarketAtomicExecutionFeeMultiplier {
market_id: MarketId,
},
}
Loading

0 comments on commit e7c9ab2

Please sign in to comment.