Collateralized Vault
alcueca opened this issue · comments
There is a Vault that lends DAI. Get the contract from Etherscan and deploy it locally, then supply your Vault with an amount of DAI.
Users can deposit Ether in the Vault to get DAI, how much DAI they get for the Ether they deposit is something the Vault knows by reading from a Chainlink Oracle.
To withdraw their Ether, the users must repay the DAI they borrowed.
If the Ether price rises, the users can borrow more DAI without depositing more Ether.
If the Ether price drops, and the value of a user's deposit falls below the DAI it borrowed, the Vault owner can erase the user's debt and the record of their Ether deposit (the Ether remains in the Vault, but the user can't withdraw it anymore).
To test in your local network, code a contract that conforms to the Chainlink interface (import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
), but for which you can set up prices manually. Then deploy to kovan using a real Chainlink oracle.