dfips icon indicating copy to clipboard operation
dfips copied to clipboard

DFIP: safely delist dTokens from DeFiChain when the corresponding ticker is delisted

Open Graciaho opened this issue 1 year ago • 0 comments

DFIP Overview

  1. Requester(s): u/DeFiChef
  2. Reddit discussion thread (optional): https://www.reddit.com/r/defiblockchain/comments/11wzhex/dfip_safely_delist_dtokens_from_defichain_when/

Describe your proposal

Hi Community,

Introduction The recent news of UBS's purchase of Credit Suisse and the upcoming merger that will lead to the delisting of $CS raises questions about what could happen to the counterpart $dCS on DeFiChain.

Until recently, the Ticker Council would have intervened in case of delisting to ensure the entire process and its safety. However, since it has dissolved (https://twitter.com/tickercouncil/status/1633099232545587204?s=61&t=dcfjIIAkY4eeHBWh_4Q0BQ), this is no longer an option.

On the other hand, removing every dToken via a special DFIP/DFIP could be cumbersome and ultimately not very useful.

The goal of this post is to initiate a brainstorming process that leads to a safe but as automated procedure as possible.

This morning, I proposed a 2880 block interval (~ 1 day) for delisting an hypothetical dTokenX from the moment the oracles remain flat (expected behavior when the corresponding ticker is delisted). However, as u/uzyn rightly pointed out, this only works if all holders of that dTokenX have time to react.

Clearly, further security measures and a more streamlined procedure must be in place to protect users.

How does this DFIP benefit the DeFiChain community?

Proposed procedure

A possible process could be as follows, similar to what happens during a dToken split (subjected to technical feasibility checks and eventual optimization by the Core Development Team):

The block height of the delisting is set into gov variables. N.B. Since delistings are generally scheduled, it can be a fixed pre-determined block height based on the expected date/time of the delisting, or 2880 blocks after dTokenX oracles go flat (whatever works best in terms of resources and computation required).

At the block height of the delisting the trading is halted, a snapshot is acquired, and dTokenX-dUSD pool gets locked for security reasons.

Every LP token is removed from the pool.

Every holder of the dTokenX receives a new token in a defined ratio. The "new token" is dUSD and the defined ratio is determined by the last oracle price of dTokenX (registered at the time of the snapshot).

Ultimately, if any, the % of rewards defined by the reward scheme is redirected from the dTokenX-dUSD pool to the dUSD-DFI pool.

Now the only dTokenXs in the system are the open loans and the dTokenXs in accounts (no more tokens in LM).

All dTokenXs in accounts get converted to dUSD according to the last oracle price.

All dTokenX loans get converted to dUSD loans according to the last oracle price.

When the process is finalized, dTokenX is completely gone from the system (no pool, no loans, no balances). All the operations need to be tracked for history purposes.

Any feedback is welcome. I may not have considered some elements, or some things may not be feasible in reality.

Let's start brainstorming! 😎

Edits:

  • Renamed 'dToken' in 'dTokenX' to increase clarity.
  • Changed the price of dTokenX to be used for the ratio calculations based on the suggestions (to make it more straightforward and less computationally expensive). Thank you.
  • Reformulated and simplified the whole process, based on u/kuegi precious suggestions. Thank you.
  • Brainstorming ended. This DFIP is going to be uploaded for the June voting round. I want to thank everyone for the insightful comments and the suggestions that were essential to shape the proposal in its final form.

Non-obligation

I understand that vote of confidence for DFIP carries no obligations by any developers to implement the proposals. DeFiChain is a community projects. Pull requests can be submitted by community and reserved to be evaluated for safety and general community acceptance.

Graciaho avatar May 22 '23 07:05 Graciaho