Open leveraged CDP
Closed this issue · 0 comments
MicahZoltu commented
Create a smart contract that lets a user open a leveraged CDP.
- Function for opening a CDP, is payable, takes in leverage target as parameter.
- Function to get estimated fees/costs for a CDP of a given size.
On calling primary function with ETH:
- Our fees are deducted from the supplied ETH.
- Create CDP.
- Get cost of DAI from OasisDEX and calculate leverage numbers from it.
- Transfer remaining ETH plus enough to reach leverage target into CDP.
- Draw DAI such that leverage target is achieved.
- Buy ETH with DAI off OasisDEX.
- Transfer CDP to
msg.sender