Tests - operation in Hive - limit order cancel operation
Operation: limit_order_cancel_operation, // 6
All numbers and calculations are in the attached excel file.
Test cases: User cancels limit order not matched.
-
1. User cancel limit order Hive to HBD created using operation limit_order_create_operation
. -
2. User cancel limit order Hive to HBD created using operation limit_order_create2_operation
. -
3. User cancel limit order HBD to Hive created using operation limit_order_create_operation
. -
4. User cancel limit order HBD to Hive created using operation limit_order_create2_operation
.
Preconditions (test 1, 2, 3 and 4):
- Order 1 is on the market, but it doesn't match to the order created by the user.
Steps (test 1, 2, 3 and 4):
Step 1: User creates limit order (order 2) with {fill_or_kill} = false.
Expected results:
- After operation: {owner} account balance is reduced by correct amount.
- After operation: RC is reduced.
Step 2: User cancels limit order (order 2) before expiration.
Expected results:
- After operation: {owner} account balance is increased by correct amount.
- After operation: RC is reduced.
- After operation: the virtual operation: limit_order_cancelled_operation is generated.
Test cases: User (taker) cancels limit order partially matched.
-
5. User cancel limit order Hive to HBD created using operation limit_order_create_operation
. -
6. User cancel limit order Hive to HBD created using operation limit_order_create2_operation
. -
7. User cancel limit order HBD to Hive created using operation limit_order_create_operation
. -
8. User cancel limit order HBD to Hive created using operation limit_order_create2_operation
.
Preconditions (test 5, 6, 7 and 8):
- There is a partially matching order on the market.
Steps (test 5, 6, 7 and 8):
order 3
with {fill_or_kill}= false.
Step 1: User creates limit order Expected results:
- (order 3) The {owner} account balance in HIVE/HBD is reduced by correct amount.
- (order 3) The {owner} account balance in HBD/HIVE is increased by correct amount.
- (order 3) RC is reduced.
- (order 3) The virtual operation: fill_order_operation is generated.
- (order 1) The left amount of the order 1 is correct.
- (order 2) The left amount of the order 2 is correct.
Step 2: User cancels limit order (order 3) before expiration.
Expected results:
- (order 3 - cancel) After operation: {owner} account balance is increased by correct amount.
- (order 3 - cancel) After operation: RC is reduced.
- (order 3 - cancel) After operation: the virtual operation: limit_order_cancelled_operation is generated.
- (order 3) After {expiration}: {owner} account balance is not increased.
Test cases: User (maker) cancels limit order partially matched.
-
9. User cancel limit order Hive to HBD created using operation limit_order_create_operation
. -
10. User cancel limit order Hive to HBD created using operation limit_order_create2_operation
. -
11. User cancel limit order HBD to Hive created using operation limit_order_create_operation
. -
12. User cancel limit order HBD to Hive created using operation limit_order_create2_operation
.
Preconditions (test 9, 10, 11 and 12):
- The partially matching orders are coming later.
Steps (test 9, 10, 11 and 12):
order 1
with {fill_or_kill}= false.
Step 1: User creates limit order Expected results:
- (order 1) The {owner} account balance in HIVE/HBD is reduced by correct amount.
- (order 1) RC is reduced.
order 2
is comming - no match.
Step 2: The Expected results:
- (order 1) The {owner} account balance in HIVE/HBD is not reduced.
- (order 1) The {owner} account balance in HBD/HIVE is not increased.
order 3
is comming - the is a partial match.
Step 3: The Expected results:
- (order 1) The {owner} account balance in HIVE/HBD is reduced by correct amount.
- (order 1) The {owner} account balance in HBD/HIVE is increased by correct amount.
- (order 1) RC is not reduced.
- (order 1) The virtual operation: fill_order_operation is generated.
- (order 2) The left amount of the order 2 is correct.
- (order 3) The left amount of the order 3 is correct.
Step 4: User cancels limit order (order 1) before expiration.
Expected results:
- (order 1 - cancel) After operation: {owner} account balance is increased by correct amount.
- (order 1 - cancel) After operation: RC is reduced.
- (order 1 - cancel) After operation: the virtual operation: limit_order_cancelled_operation is generated.
- (order 1) After {expiration}: {owner} account balance is not increased.
Edited by Mateusz Kudela