diff --git a/zrml/orderbook-v1/src/tests.rs b/zrml/orderbook-v1/src/tests.rs index 4a6d2a536..71a441432 100644 --- a/zrml/orderbook-v1/src/tests.rs +++ b/zrml/orderbook-v1/src/tests.rs @@ -324,6 +324,9 @@ fn it_fills_bid_orders_partially() { // 3500 of base_asset lost, 1500 of base_asset reserved assert_eq!(bob_bal, BASE - 5000); assert_eq!(bob_shares, 700); + + let reserved_bob = Balances::reserved_balance(BOB); + assert_eq!(reserved_bob, 1500); }); } @@ -353,7 +356,7 @@ fn it_fills_ask_orders_partially() { let order_id = 0u128; let order_hash = Orderbook::order_hash(&BOB, order_id); - assert_ok!(Tokens::deposit(market.base_asset.clone(), &ALICE, 5000)); + assert_ok!(Tokens::deposit(market.base_asset, &ALICE, 5000)); // instead of buying 5000 of the base asset, Alice buys 700 shares let portion = Some(700); @@ -401,6 +404,9 @@ fn it_fills_ask_orders_partially() { assert_eq!(bob_bal, BASE + 700); // ask order was adjusted from 1000 to 860, and bob had 2000 shares at start assert_eq!(bob_shares, 1000); + + let reserved_bob = Tokens::reserved_balance(outcome_asset, &BOB); + assert_eq!(reserved_bob, 860); }); } @@ -463,8 +469,16 @@ fn it_removes_orders() { Error::::NotOrderCreator, ); + let reserved_funds = + >::reserved_balance(&ALICE); + assert_eq!(reserved_funds, 10); + assert_ok!(Orderbook::remove_order(RuntimeOrigin::signed(ALICE), order_hash)); + let reserved_funds = + >::reserved_balance(&ALICE); + assert_eq!(reserved_funds, 0); + assert!(>::get(order_hash).is_none()); System::assert_last_event(