Difference between revisions of "Future Swap"

From DeFiChain-Wiki
(created article for future swaps in EN)
 
(added quickcheck)
Line 12: Line 12:
 
https://defiscan.live/blocks/countdown/NextFutureSwap
 
https://defiscan.live/blocks/countdown/NextFutureSwap
  
In the desktop wallet you can check the next future swap block using the command '''getfutureswapblock'''  
+
In the desktop wallet you can check the next future swap block using the command '''getfutureswapblock'''
 +
 
 +
To quickly check for the current premium of the stock tokens you can use the dStocks Quickcheck page at
 +
 
 +
https://dstocks-defichain.web.app/
 
===Strategy===
 
===Strategy===
 
With this measure the price of the dTokens can be hold in a +-5% corridor. In case of a higher premium or discount it can get arbitraged. For the case of a premium the following trade can be done
 
With this measure the price of the dTokens can be hold in a +-5% corridor. In case of a higher premium or discount it can get arbitraged. For the case of a premium the following trade can be done

Revision as of 16:11, 20 October 2022

Future Swap

Background

after the introduction of the stock token they were traded with a premium. The prices on the DEX were higher than the prices from the oracle. To fight this premium (nut also a possible discount) the future swaps were introduced with DFIP-2203-A.

https://github.com/DeFiCh/dfips/issues/127

This swap is executed once a week (every 7*2880 blocks). You can buy for + 5% of the oracle price or sell for -5% of the oracle price, even if the Price is higer/lower than that 5%. Buy or sell means swapping to DUSD.

Scheduling

On defiscan.live you can find a countdown to the next future swap block via the link

https://defiscan.live/blocks/countdown/NextFutureSwap

In the desktop wallet you can check the next future swap block using the command getfutureswapblock

To quickly check for the current premium of the stock tokens you can use the dStocks Quickcheck page at

https://dstocks-defichain.web.app/

Strategy

With this measure the price of the dTokens can be hold in a +-5% corridor. In case of a higher premium or discount it can get arbitraged. For the case of a premium the following trade can be done

  • Mint a dToken using a vault (take a loan)
  • The collateralization ration gets calculated using the oracle price (real price without premium)
  • Sell the minted dToken on the DEX (swap to DUSD)
  • Because of the premium you get „too much“ DUSD
  • Do a future swap using the received DUSD to buy the dToken back paying the oracle price (cheaper bacause it's without premium)
  • When the future Swaps gets executed you will receive more dToken as you minted
  • The loan (minted dToken) can be payed back and the additional dToken stay in the wallet as a profit

Future Swap in the Light Wallet

In the Light Wallet select the desired pool in the DEX tab. In the Swap menu you can switch from an instant swap to the future swap.

Future Swap im light wallet

Future Swap in the Desktop Wallet

In the console view of the desktop wallet you can use the command futureswap.

Syntax:

futureswap "address" "amount" ( "destination" [{"txid":"hex","vout":n},...] )

For example to swap 500 DUSD to Netflix token:

futureswap "dVvPfdjhfdjhfjd32dPWZoNYno7uBUn1KyU" "500@DUSD" dNFLX)

Using the command getpendingfutureswaps you can check which future swaps have alread been set for a given address.

getpendingfutureswaps "address"