DFIP-2203

Proposal

For the community discussion that led to the addition of this feature, please have a look at the Reddit post and hear the Twitter Space.

For the proposal, refer to this link

DFIP summary :

  • Introduce future trading for settling dToken prices once a week (7*2880 blocks).
  • Establish 2 different Future contracts - one for the premium case and on for the discount case.
  • Range for settlement should be +/-5%, which allows anticipating the next price in case of closed markets (constant oracle price)
  • Premium future should trade 5% above the oracle price - you can buy dTokens with a 5% fee)
  • Discount future should trade 5% below the oracle price - you can sell dTokens with a 5% discount)
  • Futures will be a weak binding of DEX price to oracle price: between settlement time higher/lower deviations are possible
  • Introducing an additional swap fee of 0.1% for every dToken pool to burn dTokens. The fee should be conducted for both swap directions.
  • Strengthen dUSD by counting them in the same way as the mandatory 50% DFI in vaults with fix price of $0.99.
  • DEX fee PR
  • DUSD as collateral PR
  • Future swap contract PR

Governances variables

v0/params/dfip2203/active

This variable determines wether the DFIP is activated or not. When disabled, no more deposit to the smart contract address will be accepted nor any swap will be executed.

v0/params/dfip2203/reward_pct

The percent of premium deducted at the moment of the swap.

v0/params/dfip2203/period_blocks

The block interval between two future swaps.

v0/token/<token_id>/dfip2203_disabled

Defaults to false. Used to blacklist certain token.

RPC commands

getfutureswapblock

Get the next block when the contract will be executed.

defi-cli getfutureswapblock
895100

futureswap

Parameters :

  • address : Address to fund contract and receive resulting token.
  • amount : Amount to send in amount@token format.
  • destination : Optional. Expected dToken if DUSD amount supplied.

Deposit DUSD or dTokens to be swapped at the next block interval.

defi-cli futureswap <address> <amount> <destination>
fd55837215c7ff29ba43afb196ffbfba8c20f16eb9dbba30ba829853f15b2aeb

withdrawfutureswap

Parameters :

  • address : Address to fund contract and receive resulting token.
  • amount : Amount to send in amount@token format.
  • destination : Optional. Expected dToken if DUSD amount supplied.

Withdraw DUSD or dTokens previously deposited.

defi-cli withdrawfutureswap <address> <amount> <destination>
bceb216add60c38888d102c737d73d3a559fc214bbe18cab92848a8d31586944

listpendingfutureswaps

List all pending futures.

defi-cli listpendingfutureswaps
[{'owner': 'mg1qAZBb28tuWpxNmbRvZha9zhUpEQ5uVx', 'source': '1.00000000@MSFT', 'destination': 'DUSD'}, {'owner': 'mhe4v9VMpinWfJpgUqpmyEXeUXc1AdFoVC', 'source': '1.00000000@GOOGL', 'destination': 'DUSD'}, {'owner': 'mk5RKGj4nNiVPhKvrVqkUh7oX2oGXvtXc5', 'source': '1.00000000@TSLA', 'destination': 'DUSD'}, {'owner': 'msyMCXeC12XwzJ8CbZTbDyDAem3PsWFrRJ', 'source': '1.00000000@TWTR', 'destination': 'DUSD'}]

getpendingfutureswaps

Get all pending futures for a specific address.

Parameters :

  • address : Address to get futures prices for.
defi-cli getpendingfutureswaps <address>
{'owner': '<address>', 'values': [{'source': '1.00000000@MSFT', 'destination': 'DUSD'}]}

listgovs

All the governance variables related to this DFIP can be accessed via listgovs

defi-cli listgovs
{
    ...,
    "ATTRIBUTES": {
    "v0/params/dfip2203/active": "true",
    "v0/params/dfip2203/reward_pct": "0.05",
    "v0/params/dfip2203/block_period": "20160",
    "v0/token/10/dfip2203_disabled":"true",
    }
}