Add on-chain calculation for bond repay amount needed for liquidations #42
Locked
scorpion9979
started this conversation in
Ideas
Replies: 1 comment
-
This feature has been added in #38 Locking this convo. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the way
liquidateBorrow(...)
works makes it much easier to liquidate a multi-bond single collateral vault than a single bond multi-collateral vault. This is due to the fact that when a vault is to be liquidated, the client app would need to construct a nested for loop where one loop iterates over all borrowed bond tokens from that vault and the other loop iterates over all the collateralized assets in that vault, the order of loop nesting being negligible. There exists an issue with liquidations that didn't exist with the previous iteration of the protocol that only dealt with single collaterals. The issue is met when the full borrowed bond amount would yield more collateral to be liquidated than the actual collateral, therefore the client would not be able to use the value returned bygetDebtAmount(...)
as therepayAmount
param inliquidateBorrow(...)
, because therepayAmount
needed to liquidate the entirecollateral
asset in the vault would be less than the borrowed bond amount in the case of multi-collateral. To resolve this, I suggest we add a basic on-chain getter method for calculating therepayAmount
needed to be repaid in order to liquidate a specified amount of a certaincollateral
as follows:Beta Was this translation helpful? Give feedback.
All reactions