use cosmwasm_std::{Addr, Coin};
use injective_std::types::injective::exchange::v1beta1::{
MarketStatus, MsgInstantSpotMarketLaunch,
QuerySpotMarketsRequest, QuerySpotMarketsResponse, SpotMarket,
};
use injective_test_tube::{Account, Exchange, InjectiveTestApp};
use test_tube_inj::Module;
let app = InjectiveTestApp::new();
let signer = app
.init_account(&[
Coin::new(10_000_000_000_000_000_000_000u128, "inj"),
Coin::new(100_000_000_000_000_000_000u128, "usdt"),
])
.unwrap();
let trader = app
.init_account(&[
Coin::new(10_000_000_000_000_000_000_000u128, "inj"),
Coin::new(100_000_000_000_000_000_000u128, "usdt"),
])
.unwrap();
let exchange = Exchange::new(&app);
exchange
.instant_spot_market_launch(
MsgInstantSpotMarketLaunch {
sender: signer.address(),
ticker: "INJ/USDT".to_owned(),
base_denom: "inj".to_owned(),
quote_denom: "usdt".to_owned(),
min_price_tick_size: "10000".to_owned(),
min_quantity_tick_size: "100000".to_owned(),
},
&signer,
)
.unwrap();
exchange
.instant_spot_market_launch(
MsgInstantSpotMarketLaunch {
sender: signer.address(),
ticker: "INJ/USDT".to_owned(),
base_denom: "inj".to_owned(),
quote_denom: "usdt".to_owned(),
min_price_tick_size: "10000".to_owned(),
min_quantity_tick_size: "100000".to_owned(),
},
&signer,
)
.unwrap_err();
app.increase_time(1u64);
let spot_markets = exchange
.query_spot_markets(&QuerySpotMarketsRequest {
status: "Active".to_owned(),
market_ids: vec![],
})
.unwrap();
let expected_response = QuerySpotMarketsResponse {
markets: vec![SpotMarket {
ticker: "INJ/USDT".to_string(),
base_denom: "inj".to_string(),
quote_denom: "usdt".to_string(),
maker_fee_rate: "-100000000000000".to_string(),
taker_fee_rate: "1000000000000000".to_string(),
relayer_fee_share_rate: "400000000000000000".to_string(),
market_id: "0xd5a22be807011d5e42d5b77da3f417e22676efae494109cd01c242ad46630115"
.to_string(),
status: MarketStatus::Active.into(),
min_price_tick_size: "10000".to_string(),
min_quantity_tick_size: "100000".to_string(),
}],
};
assert_eq!(spot_markets, expected_response);