1. Force-settlements are matched with margin calls with conditions:
no need to wait for the force-settlement delay when margin call appears
match price is in favor of force-settle orders, i.e. at current_feed_price.settlement_price / (MSSR-MCFR)
if filling at the match price above would trigger a black swan event, fill at 100% CR price instead; after filled, if there are remaining debt in the margin call, trigger black swan event normally
no force-settlement fee charged in this case
the volume is not counted in the force-settlement volume per maintenance interval
the matching takes place after processed limit (buy) orders with better price
sell orders whose price are lower than margin calls won't be matched with force-settlements, because force-settlement are meant to improve overall collateral ratio.
2. When a global settlement occurs:
the margin calls (whose CR <= MCR) pay a premium (by MSSR-MCFR) and a margin call fee (by MCFR), and
they are closed at the same price;
the debt positions with CR > MCR do not pay premium or margin call fee, and they are closed at a same
price too.
The GS price would close the position with the least CR with no collateral left for the owner,
but would close other positions with some collateral left (if any) for their owners.
Both the premium and the margin call fee paid by the margin calls go to the asset's accumulated fees pool, none will go to the global settlement fund, because
if a part of the premium or fees goes to the global settlement fund, it means there would be a
difference in settlement prices, so traders are incentivized to create new debt in the last minute
then settle after GS to earn free money;
if no premium or fees goes to the global settlement fund, it means debt asset holders would only
settle for less after GS, so they are incentivized to settle before GS which helps avoid GS.
struct asset_settle_cancel_operation : public base_operation
{
struct fee_parameters_type { };
asset_settle_cancel_operation() = default;
asset_settle_cancel_operation( const force_settlement_id_type& fsid, const account_id_type& aid,
const asset& a ) : settlement(fsid), account(aid), amount(a) {}
asset fee;
force_settlement_id_type settlement;
/// Account requesting the force settlement. This account pays the fee
account_id_type account;
/// Amount of asset to force settle. This must be a market-issued asset
asset amount;
account_id_type fee_payer()const { return account; }
/***
* This is a virtual operation and should never be placed in a block
* (i.e. in a proposal)
*/
void validate() const { FC_ASSERT( !"Virtual operation"); }
share_type calculate_fee(const fee_parameters_type& params)const
{ return 0; }
};
Tasks:
[x] cross-hf tests
[x] test : disallow adjusting a call order if it would match a force settlement (when there is no limit order) but the call order is not fully filled
[x] test : disallow creating a new instantly-called call order if it would match a force settlement (when there is no limit order) but the call order is not fully filled
[x] test: if matching a call with a limit order would trigger a blackswan event, match settle orders first, then check for blackswan again
[x] test: if there exists a settle order, it is now allowed to create a new call order with CR <= ~MSSP , in other words, DO NOT match the settle order with such undercollateralized call order.
[x] test: if there exists a settle order, it is now allowed to update an existing call order so that its CR <= ~MSSP , in other words, DO NOT match the settle order with such undercollateralized call order.
[x] rounding tests
[x] smaller settle order (price not capped)
[x] smaller settle order (price capped)
[x] cancel too small settle order(price not capped)
[x] cancel too small settle order(price capped)
[x] settle receives 0 due to margin call fee, round up to 1 cancel it (updated in #2499)
PR for #2481.
1. Force-settlements are matched with margin calls with conditions:
current_feed_price.settlement_price / (MSSR-MCFR)
2. When a global settlement occurs:
3. API changes
The unused
extensions
field is removed fromasset_settle_cancel_operation
Tasks:
round up to 1cancel it (updated in #2499)