Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSIP71 - Change Request: Incorporate core changes necessary for BSIP-0076 to allow a threshhold price #224

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
141 changes: 116 additions & 25 deletions bsip-0071.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BSIP: 71
Title: Add "Prevent Global Settlement" Flag for Smartcoin
Title: Add "Prevent Global Settlement and External Attacks" Flag for Smartcoin
Authors: Jerry Liu [email protected]
Stefan Schießl [email protected]
Status: Draft
Type: Protocol
Created: 2019-07-02
Expand All @@ -9,23 +10,43 @@

# Abstract

This BSIP proposes a new solution to handle bad debt: the core idea is, while bad debt appears, the system does not take over the bad debt positions; instead, it accepts the smartcoin devaluation caused by bad debt and it lets borrowing, margin call, and force settlement all operate referring to the BTS/devaluated smartcoin price. This solution avoids any global/partial settlement, and keeps the borrowing, margin calls and force settlement features to continue and allow the market to decide how to finally remove bad debt, either by BTS price restoration or by debt position adjustment/ margin call order filling/force settlement.
This BSIP proposes a new solution to handle bad debt: the core idea is, while bad debt appears,
the system does not take over the bad debt positions;
instead, it accepts the smartcoin devaluation caused by bad debt and it lets borrowing, margin call,
and force settlement all operate referring to the BTS/devaluated smartcoin price.
This solution avoids any global/partial settlement, and keeps the borrowing, margin calls and force settlement features
to continue and allow the market to decide how to finally remove bad debt,
either by BTS price restoration or by debt position adjustment/ margin call order filling/force settlement.
In addition, this BSIP allows the asset owner to define an optional threshold price to prevent external market manipulation.

# Motivation

BitShares has a mechanism to handle debt positions whose collateral is valued less than the debt itself ("bad debt"). This mechanism is called global settlement ("black swan") and is triggered when the published feed price (FP) is less than or equal to the product of the global settlement price (P<sub>gs</sub>) and the maximum short-squeeze ratio (MSSR).
BitShares has a mechanism to handle debt positions whose collateral is valued less than the debt itself ("bad debt").
This mechanism is called global settlement ("black swan") and is triggered when the published feed price (FP) is less
than or equal to the product of the global settlement price (P<sub>gs</sub>) and the maximum short-squeeze ratio (MSSR).

FP &le; P<sub>gs</sub> &times; MSSR

If this does occur it means that the collateral ratio (CR) of at least one debt position is less than the MSSR.

Global settlement is not a good way to handle bad debt, as can be seen to what happened to bitUSD. After global settlement was triggered for bitUSD in December 2018:
Global settlement is not a good way to handle bad debt, as can be seen to what happened to bitUSD.
After global settlement was triggered for bitUSD in December 2018:

- traders could no longer borrow bitUSD;
- the price of bitUSD dropped below USD because of insufficient collateral; and,
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
- it will take a long time for bitUSD to be revived.
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved

The community has had extensive discussions about how to handle the bad debt in a better way in the future. However an easy way, [BSIP58](https://github.com/bitshares/bsips/blob/master/bsip-0058.md), has been implemented for smartcoins like bitCNY and bitUSD; it has worked successfully to prevent GS from happening with no other obvious impact. However, BSIP58 has some issues - it is suspected of market manipulation and it risks witnesses independence. Moving forward, this BSIP will be built based on BSIP58 and eliminate all its disadvantages.
The community has had extensive discussions about how to handle the bad debt in a better way in the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't sound like a bad consequence of global settlement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevance?

However an easy way, [BSIP58](https://github.com/bitshares/bsips/blob/master/bsip-0058.md),
has been implemented for smartcoins like bitCNY and bitUSD; it has worked successfully to prevent GS
from happening with no other obvious impact.
However, BSIP58 has some issues - it is suspected of market manipulation and it risks witnesses independence.
Moving forward, this BSIP will be built based on BSIP58 and eliminate all its disadvantages.

[Shorting attacks and fake volume](https://bitsharestalk.org/index.php?topic=29635.0) have presumably caused massive
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
price fluctuations which created the desire to define an optional threshold price in addition to the Global
Settlement protection, which will act as a floor price. For committee-owned assets, this floor price is to be
[decided by voting through BSIP-76](https://github.com/bitshares/bsips/blob/master/bsip-0076.md).

# Rationale

Expand All @@ -39,9 +60,12 @@ We now have several choices on handling bad debt:

We need to do a deep review on bad debt before evaluating above solutions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When can we expect this deep review on bad debt? Why can't we work on improving the price feed scripts in parallel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know. Certainly we can, care to join?


Bad debt means in some debt positions the debt cannot be fully paid by selling the collaterals via margin call/force settlement at the market price. In other words, the relevant smartcoin loses sufficient collateral to back the value and will possibly devalue.
Bad debt means in some debt positions the debt cannot be fully paid by selling the collaterals via margin
call/force settlement at the market price. In other words, the relevant smartcoin loses sufficient collateral
to back the value and will possibly devalue.

At this moment, the system should accept the fact that the smartcoin will possibly devalue, find ways to minimize the impact to different parties in the market and the time to revive.
At this moment, the system should accept the fact that the smartcoin will possibly devalue,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not just a possibility, but now a fact that the CNY & USD assets have been devalued by BSIP 76.

find ways to minimize the impact to different parties in the market and the time to revive.

In my view, a good way to handle bad debt need to follow below principles:

Expand All @@ -51,59 +75,126 @@ In my view, a good way to handle bad debt need to follow below principles:

In above mentioned 5 solutions, only "5. Prevent Global Settlement" fulfills all 3 principles.

Partial GS is another attractive solution: it is similar to Global Settlement but differs in that (a) only takes over the bad debt positions and moves them to a settlement pool without touching the debt positions with CR>1, and (b) users can issue force settlement from the pool, from the margin call orders, or from the good debt position depending on which has the lowest CR.
Partial GS is another attractive solution: it is similar to Global Settlement but differs in that
(a) only takes over the bad debt positions and moves them to a settlement pool without touching the debt
positions with CR>1, and
(b) users can issue force settlement from the pool, from the margin call orders, or from the good debt position
depending on which has the lowest CR.

The problem of Partial GS is that it does not resolve itself automatically when the price recovers.

The "Prevent Global Settlement" solution adopts a new idea to handle bad debt: while bad debt appears, the smartcoin will be devaluated at a ratio of the lowest CR from among the bad debt positions, yet all the smartcoin trading features, including borrowing, margin call and force settlement, will all switch to refer to GS price to ensure the continuity and fairness of all the features.
The "Prevent Global Settlement" solution adopts a new idea to handle bad debt:
while bad debt appears, the smartcoin will be devaluated at a ratio of the lowest CR from among the bad debt positions,
yet all the smartcoin trading features, including borrowing, margin call and force settlement,
will all switch to refer to GS price to ensure the continuity and fairness of all the features.

# Specifications

Add one flag "Prevent Global Settlement" to each smartcoin asset.
#### Add flags "Prevent Global Settlement" and "Set Threshhold price" to each smartcoin asset.

Those flags are set by the asset owner, and come with their respective permission like all others.
Default values
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved

#### Introduce new parameters: *threshold price*, *settlement price* and *call execution price*.

Introduce new parameters: *settlement price* and *call execution price*. They shall be calculated as:
While the *threshold price* is a new BitAsset option and defined by the asset owner,
the remaining two shall be calculated as:

```
if flag "Prevent Global Settlement" is enabled
settlement price = max(FP_M * (1 - settlement_offset), P_gs)
call execution price = max(FP_M * (1 + MSSR), P_gs)
if flag "Prevent Global Settlement and External Attacks" is enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add flags "Prevent Global Settlement"
flag "Prevent Global Settlement and External Attacks"

Which is the final name for the flag?

settlement price = max(FP_M * (1 - settlement_offset), P_gs, threshold price)
call execution price = max(FP_M * (1 + MSSR), P_gs, threshold price)
else
settlement price = FP_M * (1 - settlement_offset)
call execution price = FP_M * (1 + MSSR)
```

where *FP<sub>M</sub>* is the median of the prices published by witnesses, *MSSR* is the [maximum short-squeeze ratio](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset.hpp#L192-L193) and *settlement offset* is the [force settlement offset](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset_ops.hpp#L105-L106); witnesses should always feed the real market price.
where *FP<sub>M</sub>* is the median of the prices published by price feeders, *MSSR* is the
[maximum short-squeeze ratio](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset.hpp#L192-L193)
and *settlement offset* is the
[force settlement offset](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset_ops.hpp#L105-L106);
price feeders should always feed the real external market price.

The *settlement price* is the price that is used when executing forced settlements. Note that when a large forced settlement fills up a debt position completely, P<sub>gs</sub> is likely to change. The resulting new *settlement price* will be used when settling against the next debt position.
The *call execution price* is the price that is used when matching margin calls against limit orders or settlement requests. Again, when a large match fills up a debt position completely, P<sub>gs</sub> is likely to change. The resulting new *call execution price* will be used when settling against the next debt position.
FP<sub>M</sub> is still used for determining if a debt position is margin called, as before, at FP<sub>M</sub> &times; (1 + [MCR](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset.hpp#L189-L190)).
The *settlement price* is the price that is used when executing forced settlements.
Note that when a large forced settlement fills up a debt position completely, P<sub>gs</sub> is likely to change.
The resulting new *settlement price* will be used when settling against the next debt position.
The *call execution price* is the price that is used when matching margin calls against limit orders or settlement requests.
Again, when a large match fills up a debt position completely, P<sub>gs</sub> is likely to change.
The resulting new *call execution price* will be used when settling against the next debt position.
FP<sub>M</sub> is still used for determining if a debt position is margin called, as before, at FP<sub>M</sub> &times;
(1 + [MCR](https://github.com/bitshares/bitshares-core/blob/e8567d0425ec27d29036a9a9178df5afd8ca6f25/libraries/protocol/include/graphene/protocol/asset.hpp#L189-L190)).

**Note:** when comparing prices, `max` is to be understood in terms of debt %div; collateral.
**Note:** when comparing prices, `max` is to be understood in terms of debt divided by collateral.

#### Adjustment to voting power

The voting power for BTS backed SmartCoins added to the owner of a margin position is reduced. Only the exccess collateral counts as voting power. Example: If a position has CR 1.8, the voting power from this position only counts the BTS that represent the excess of 0.8. Reasoning for this is given in the section Discussion / Voting power.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes about voting power should not be in the scope of this BSIP.

Copy link
Collaborator Author

@sschiessl-bcp sschiessl-bcp Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This BSIP cements the ability for risk-free margin to the max, multiplying voting power, and setting a status quo and "confirmed by core". In the worst case scenario, this is an irreversible action.

Planning for the worst-case scenario, I see it very much in relevance to this BSIP, and would rather not remove it. This is certainly an effect that we already see now, still having it inside the core is of different magnitude IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally disagree with the adjustment to voting power, voting power is inside BTS, one should own the voting power of the BTS in his account, either his account is debt free or not, debt just means he would like to bear the relevant risk, no others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What risk?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitcrab If you don't own the associated bitasset for your debt, then you effectively sold that 1x CR BTS which the bitasset holder can claim at any moment. Anything above 1x CR would still be yours to vote with, so just maintain a good CR 👍

# References

- [New mechanism to handle bad debt (black swan)](https://bitsharestalk.org/index.php?topic=27273.0)
- [New BSIP:GS protection via core code](https://bitsharestalk.org/index.php?topic=28681.0)
- [New BSIP: Add "Prevent Global Settlement" Flag for Smartcoin (old title: Global Settlement Protection via core code)](#179)
- [New BSIP: Add "Prevent Global Settlement" Flag for Smartcoin](#193)
- [New BSIP: Add "Prevent Global Settlement" Flag for Smartcoin (old title: Global Settlement Protection via core code)](https://github.com/bitshares/bsips/pull/179)
- [New BSIP: Add "Prevent Global Settlement" Flag for Smartcoin](https://github.com/bitshares/bsips/pull/193)
- [Threshold for price feeds through voting](https://github.com/bitshares/bsips/blob/master/bsip-0076.md)

# Discussion

## settlement_price / feed_price

Some may perceive it as confusing or unfair that borrowing and force settlement may refer to different prices. However, in a period where the least collateralized short position has insufficient collateral in terms of FP_m, it would be dangerous to use the resulting settlement_price for borrowing as well, because that would allow creation of short positions that are undercollateralized from the start.
Some may perceive it as confusing or unfair that borrowing and force settlement may refer to different prices.
However, in a period where the least collateralized short position has insufficient collateral in terms of FP_m,
it would be dangerous to use the resulting settlement_price for borrowing as well, because that would allow creation
of short positions that are undercollateralized from the start.

## Least collateralized short

Two variants for the *call execution price* have been discussed.

Variant A (as specified here) prefers to match the bad debt positions first, hoping that this way the bad debt will be resolved quickly. This also means that if P<sub>gs</sub> moves away from the market price, **no** margin calls will be filled, not even those with a collateral ratio that would allow them being matched with market orders. This can lead to more bad debt piling up instead of resolving at least some debt positions through margin calls.
Variant A (as specified here) prefers to match the bad debt positions first, hoping that this way the bad debt will
be resolved quickly. This also means that if P<sub>gs</sub> moves away from the market price, **no** margin calls will
be filled, not even those with a collateral ratio that would allow them being matched with market orders.
This can lead to more bad debt piling up instead of resolving at least some debt positions through margin calls.

Variant B would have let bad debt positions matched at their own collateral ratio while matching other margin calls
as before at FP<sub>M</sub> &times; MSSR, hoping to improve the overall collateralization. This also means that debt
positions with better collateral ratio would have been preferred over bad debt, meaning that bad debt positions will
remain sitting on the market for a longer time.

## The threshhold price

With this BSIP the threshhold price is defined by the asset owner. This may not be considered fair. A suitable
future extension is to let asset **holders** have a say in the threshhold price discovery. This could be done by
introducing a voting procedures where holders of the SmartCoin can participate, with their voting weight reflecting their
holdings of the SmartCoin in question. This procedure needs precise definition in a new BSIP.

## Voting power

As of right now, a SmartCoin that has BTS as its collateral provides the full amount of collateral as voting power.
This is not considered to be fair since it is borrowed voting power and gives incentives to squeeze out as much as
possible from a margin position to increase voting weight (borrow, sell bitasset on market, borrow more, and so on).
This is adressed by adjusting voting power of a position, and the suggested solution ensures that the voting power of
a margin position holders remains unchanged, with the assumption that he sells the newly borrowed bitasset on the
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
respective BTS market.

# Impacts and Risks

- If the Global Settlement prevention is enabled, the SmartCoin holders lose the ability to instantly settle after a
Global Settlement would have occured, and are forced to use the open market if they want to avoid holding a
SmartCoin that is eventually undercollaterized

- If the Threshhold price is enabled, the promise of being able to settle for equivalent value of the collateral SmartCoin holders are extradited to the asset's owner ability to set it, with the direct implication on the force settlement price. The Threshhold price is defined to prevent external market manipulation, but ultimately the asset owner may use any justification for setting the threshold.

Variant B would have let bad debt positions matched at their own collateral ratio while matching other margin calls as before at FP<sub>M</sub> &times; MSSR, hoping to improve the overall collateralization. This also means that debt positions with better collateral ratio would have been preferred over bad debt, meaning that bad debt positions will remain sitting on the market for a longer time.
- If the Threshhold is set, conflict of interest exists if the asset owner is also borrowing the asset into existence
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved

- If the Threshhold price is set, margin positions creators essentially have a call price limit that they can set in order to avoid ever being margin called. This means the position carries no risk for the margin position holder anymore, which can be seen as incentive to borrow as much as possible without considering the consequences. This is the reason to adjust the voting weight of a BitAsset position

# Summary for Shareholders
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impact on smartcoin, debt & bts holders?


It is important to eliminate concerns about global settlement. This is currently achieved with the technical options that are available to the witnesses. A more advanced solution as proposed here is needed.
It is important to eliminate concerns about global settlement and market manipulation. This is currently achieved with
the technical options that are available to the price feeders (i.e. the witnesses for BitASsets like bitCNY).
A more advanced solution as proposed here is needed that allows the price feeders to feed the real external market price.
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
For BTS backed SmartCoins, the voting power of margin positions is adjusted to reflect the actually underlying voting power.

# Copyright

Expand Down