use super::*; #[tokio::test] async fn test_ioc() -> Result<(), TransportError> { let TestInitialize { context, collect_fee_admin, owner, payer, mints, owner_token_0, owner_token_1, market, market_base_vault, market_quote_vault, price_lots, tokens, account_1, account_2, .. } = TestContext::new_with_market(TestNewMarketInitialize { maker_fee: 200, taker_fee: 200, ..TestNewMarketInitialize::default() }) .await?; let solana = &context.solana.clone(); send_tx( solana, PlaceOrderInstruction { open_orders_account: account_1, market, signer: owner, user_token_account: owner_token_1, market_vault: market_quote_vault, side: Side::Bid, price_lots, max_base_lots: 1, max_quote_lots_including_fees: 10000, reduce_only: false, client_order_id: 0, expiry_timestamp: 0, self_trade_behavior: SelfTradeBehavior::default(), remainings: vec![], }, ) .await .unwrap(); send_tx( solana, PlaceOrderInstruction { open_orders_account: account_2, market, signer: owner, user_token_account: owner_token_0, market_vault: market_base_vault, side: Side::Ask, price_lots, max_base_lots: 1, max_quote_lots_including_fees: 10000, reduce_only: false, client_order_id: 0, expiry_timestamp: 0, self_trade_behavior: SelfTradeBehavior::default(), remainings: vec![], }, ) .await .unwrap(); { let open_orders_account_1 = solana.get_account::(account_1).await; let open_orders_account_2 = solana.get_account::(account_2).await; assert_eq!(open_orders_account_1.position.base_position_lots(), 0); assert_eq!(open_orders_account_2.position.base_position_lots(), 0); assert_eq!(open_orders_account_1.position.quote_position_native(), 0); // assert_eq!(open_orders_account_2.position.quote_position_native(), 0); assert_eq!(open_orders_account_1.position.bids_base_lots, 1); assert_eq!(open_orders_account_2.position.bids_base_lots, 0); assert_eq!(open_orders_account_1.position.asks_base_lots, 0); assert_eq!(open_orders_account_2.position.asks_base_lots, 0); assert_eq!(open_orders_account_1.position.taker_base_lots, 0); assert_eq!(open_orders_account_2.position.taker_quote_lots, 10000); assert_eq!(open_orders_account_1.position.base_free_native, 0); assert_eq!(open_orders_account_2.position.base_free_native, 0); assert_eq!(open_orders_account_1.position.quote_free_native, 0); assert_eq!(open_orders_account_2.position.quote_free_native, 99960); } Ok(()) }