diff --git a/bsip-0035.md b/bsip-0035.md index 9a54ebf..9f7d182 100644 --- a/bsip-0035.md +++ b/bsip-0035.md @@ -182,15 +182,23 @@ The detailed rules proposes in this BSIP (new rules highlighted): * **if the smaller order would get nothing after the round-down, cancel it** * when matching a limit order with a call order, in favor of call order, round down receiving collateral amount - * **if the call order is receiving the whole debt (so the short position - will be closed) but paying nothing, let it pay 1 Satoshi (round up);** + * **if the call order is receiving the whole debt amount (so the short + position will be closed) but paying nothing, let it pay 1 Satoshi + (round up);** * **otherwise, if the limit order would get nothing after the round-down, cancel it (it's smaller, so safe to cancel)** * when matching a settle order with a call order, in favor of call order, round down receiving collateral amount - * **if the settle order would get nothing after the round-down, give it 1 - Satoshi (round up); after paid both side, check if a black swan event would - be triggered by the round-up, if yes, trigger it** + * **if the call order is receiving the whole debt amount (so the short + position will be closed) but paying nothing, let it pay 1 Satoshi + (round up);** + * **otherwise, if the settle order would be completely filled but would + receive nothing, cancel it;** + * **otherwise, it means both orders won't be completely filled, which may + due to hitting `maximum_force_settlement_volume`, in this case, don't fill + any one of the two orders, and stop matching for this asset at this block;** + * **that said, only round up when the call order is completely filled, so + won't trigger a black swan event, nor need to check for it.** * when globally settling, in favor of call order, round down receiving collateral amount * **when the asset is not a prediction market, if a call order would pay @@ -243,15 +251,23 @@ so the order will be cancelled later. In `check_call_orders(...)` function of `database` class, after calculated `order_receives`, check if it is zero. If the answer is `true`, -* if `call_receives` is equal to `call_itr->debt`, set `order_receives` to 1; +* if `call_receives` is equal to `call_itr->debt`, set `order_receives` to `1`; * otherwise, skip filling and cancel the limit order. ## When Matching A Settle Order With A Call Order In `match( const call_order_object&, ... )` function of `database` class, -after calculated `call_pays`, round up it to `1` if it is zero. +after calculated `call_pays`, check if it is zero. +If the answer is `true`, +* if `call_receives` is equal to `call_debt`, set `call_pays` to `1`; +* otherwise, if `call_receives` is equal to `settle.balance`, + call `cancel_order(...)` with parameter set to `settle`, + then return a zero-amount collateral asset object; +* otherwise, return a zero-amount collateral asset object directly. -If rounded up, after filled both orders, check and allow a black swan event. +After returned, need to check the amount of returned asset at where calling the +`match(...)` function, specifically, `clear_expired_orders()` function of +`database` class. If the returned amount is `0`, break out of the `while` loop. ## When Globally Settling