When the user only borrows or only withdraws and the position LTV reaches a level that's 5% before the max LTV, we display a warning modal, where the user gets prompted to confirm the operation because it's put the position at risk of liquidation.
Every vault has a maxLTV (maximum loan-to-value) that positions on that vault have to respect. The LTV represents the ratio between the value of the debt and the value of the collateral. For a position with 1 ETH as collateral (1 ETH = $1500) and debt of 1000 USDC, the LTV is 66% (1000 / 1500).
TODOs
[x] On borrow and manage-position pages (both Add Position and Remove Position), when the user clicks on the main button (Allow, Sign & Borrow, Deposit, ...), check how the inputted values affect the user's LTV.
[x] If user's LTV > maxLTV - 5%, display a warning modal with two actions: "Proceed anyway" and "Change".
Title of the modal:
"Warning"
The text msg in the modal:
"The Loan-to-Value of your position becomes XX% that's very close to the maximum allowed. Your position risks being liquidated if the price of the collateral changes. Please, make sure you understand the risks associated with this operation. We highly recommend you change the amount of the collateral and/or the debt so that your position LTV reaches a healthier level.
Notes
There are no designs for this task; use the general modal component.
Start a branch from "frontend/feat/manage-position" if it's still not merged to "main"
Context
When the user only borrows or only withdraws and the position LTV reaches a level that's 5% before the max LTV, we display a warning modal, where the user gets prompted to confirm the operation because it's put the position at risk of liquidation.
Every vault has a maxLTV (maximum loan-to-value) that positions on that vault have to respect. The LTV represents the ratio between the value of the debt and the value of the collateral. For a position with 1 ETH as collateral (1 ETH = $1500) and debt of 1000 USDC, the LTV is 66% (1000 / 1500).
TODOs
The text msg in the modal: "The Loan-to-Value of your position becomes XX% that's very close to the maximum allowed. Your position risks being liquidated if the price of the collateral changes. Please, make sure you understand the risks associated with this operation. We highly recommend you change the amount of the collateral and/or the debt so that your position LTV reaches a healthier level.
Notes