Aavesurance is an insurance for Aave users against price fluctuation of their assets deposited in Aave.
How it works :
- For example, a user deposits 1 ETH @ $2000
- User wants to withdraw 1 ETH but the price of ETH now is $1900, hence they've lost $100 from their deposit value.
- With Aavesurance, User is reimbursed 50% of their loss, i.e $50 in this example. If a user has timelocked their funds, then the coverage amount can go all the way up to 100% in case of losses.
- Hence users get protection against price fluctuation.
- In return, we take a 50% cut from profit amount
How the smart contract works :
--A user deposits 1 ETH and 0.66ETH gets deposited from the contract into Aave with a mapping keeping track of it
- 0.33ETH is shorted in Aave. The 0.33 ETH is swapped to DAI with Uniswap and the DAI is desposited into Aave and ETH is borrowed using DAI as collateral. In doing so, we short ETH.
- User wants to withdraw his 1ETH (worth $2000 during deposit) that's worth $1800 now. This data will be received by the contract from Chainlink. Hence, we'll have to imburse them $100 (arbitrary 50% assumption) as a part of insurance. This amount will be obtained from the short position placed.
- In case of a profit scenario, say a user wants to withdraw his 1 ETH (worth $2000 during deposit) that's now $2200, they'll incur a 50% charge for covering their money.
We used Aave to deposited user funds to incur interest. We also used to short ETH by deposited DAI as collateral and borrowing ETH and swapping that ETH to DAI and again following the same cycle.
We used Uniswap to swap ETH for DAI and this DAI was used to short ETH in Aave.
We used Chainlink price feeds to determine how much a particular user needs to be compensated for their loss in comparison to the price of the token during their deposit.
We also used Chainlink Alarm clock to trigger rebalancing of Short position.