aave / aave-v3-core

This repository contains the core smart contracts of the Aave V3 protocol.
https://aave.com
Other
867 stars 568 forks source link

aave allows liquidation, when an asset swap to a higher LTV asset would suffice #829

Open blakelapierre opened 1 year ago

blakelapierre commented 1 year ago

Say you have two hypothetical assets with the given max loan-to-value(s):

And an e-stablecoin borrow market consisting of:

Imagine a user supplies:

Simplified, a user would have the following Stable1 borrow ability:

Now, say a user borrows the full $140 in Stable1 and the value of the supplied Crypto1 drops to $80. The new borrow ability is:

Now, simplified, aave would let a second and/or third party take about $25 of Crypto1 from the account + a bonus/penalty (say 10% for this simplified example) in order to repay $25 of Stable1 on the account. The new account looks like this:

Supplied

Borrowed

The user has now suffered a $27.5 loss of Crypto1 (transferred to a second/third party), when the account could have simply performed the following swap:

$25 Crypto1 -> $25 Stable1 and had the following supplies:

Notice that the value of the assets supplied are both greater in this scenario, than in the second/third party liquidation scenario.

The difference in total account value is even starker. Under the second/third party liquidation scenario the final account value is $152.5, while under the Crypto1->Stable1 swap scenario it is $180.

Now, there would potentially be some interest rate risk as the account maintains its borrow, but it seems typical that there is maybe a 1-2 percentage point spread in supply APY and borrow APY on stablecoins. However, also notice that the supply of Stable1 has increased, while the borrow amount stayed the same, so this point spread is now being paid on less Stable1 value than before the swap. In this example, the difference is now only $15 (before it was $40). So, in the worst case scenario of these hypotheticals, the account is losing about 2% of $15 per year, or $0.30. Now, avoiding some slight complexities, it would take about $2.5/$0.30 ~= 8 years to lose the equivalent of the liquidation penalty that would have been imposed; meanwhile, the account has an extra $2.5 in Crypto1 value that is 1) increasing due to supply APY, and 2) has a chance of increasing in market value.

martini1990 commented 1 year ago

``