Keydonix/liquid-long

Open leveraged CDP

Closed this issue · 0 comments

Create a smart contract that lets a user open a leveraged CDP.

  1. Function for opening a CDP, is payable, takes in leverage target as parameter.
  2. Function to get estimated fees/costs for a CDP of a given size.

On calling primary function with ETH:

  1. Our fees are deducted from the supplied ETH.
  2. Create CDP.
  3. Get cost of DAI from OasisDEX and calculate leverage numbers from it.
  4. Transfer remaining ETH plus enough to reach leverage target into CDP.
  5. Draw DAI such that leverage target is achieved.
  6. Buy ETH with DAI off OasisDEX.
  7. Transfer CDP to msg.sender