Improve Pool Withdraw Modal Health Factor Validation
Summary
The Pool Withdraw modal currently allows users to attempt withdrawals without fully accounting for outstanding borrows and resulting health factor impacts. This can lead to a poor user experience where a withdrawal appears valid in the UI but ultimately fails during transaction execution because the withdrawal would reduce collateral below the required threshold.
Problem
When a user has active borrows (particularly WAD debt), the withdraw modal does not adequately evaluate the post-withdraw account health.
As a result:
- Users can submit withdrawals that cannot succeed on-chain.
- Transactions fail after signing and submission.
- The UI does not clearly explain why the withdrawal is invalid.
- Users may need to manually discover that debt repayment is required before withdrawing.
Example scenario:
- User supplies collateral to a pool.
- User borrows WAD against that collateral.
- User attempts to withdraw collateral.
- Withdraw modal permits the action.
- Transaction fails because the resulting health factor would fall below the required threshold.
- Repaying part or all of the WAD debt would allow the withdrawal to succeed.
Proposed Solution
Enhance the Withdraw modal to perform the same health factor and collateralization checks used by the lending protocol before allowing submission.
The modal should:
- Calculate projected health factor after withdrawal.
- Account for all outstanding borrows.
- Prevent users from selecting withdrawal amounts that would violate collateral requirements.
- Display estimated health factor after withdrawal.
- Clearly communicate when debt repayment is required before additional collateral can be withdrawn.
- Optionally display the maximum withdrawable amount based on current borrow positions.
UX Improvements
Suggested additions:
- Current Health Factor
- Projected Health Factor
- Maximum Withdrawable Amount
- Warning banner when borrow positions restrict withdrawals
- Contextual message such as:
"This withdrawal would reduce your collateral below the minimum required to support your outstanding borrows. Repay a portion of your WAD debt before withdrawing additional collateral."
Acceptance Criteria
- Withdraw modal calculates post-withdraw health factor.
- Borrowed assets are included in withdrawal validation.
- Users cannot submit withdrawals that are guaranteed to fail due to collateral constraints.
- Maximum safe withdrawal amount is displayed.
- Clear guidance is provided when debt repayment is required.
- Validation behavior matches protocol health factor calculations.
Notes
Issue generated with AI assistance and should be reviewed before implementation.
Improve Pool Withdraw Modal Health Factor Validation
Summary
The Pool Withdraw modal currently allows users to attempt withdrawals without fully accounting for outstanding borrows and resulting health factor impacts. This can lead to a poor user experience where a withdrawal appears valid in the UI but ultimately fails during transaction execution because the withdrawal would reduce collateral below the required threshold.
Problem
When a user has active borrows (particularly WAD debt), the withdraw modal does not adequately evaluate the post-withdraw account health.
As a result:
Example scenario:
Proposed Solution
Enhance the Withdraw modal to perform the same health factor and collateralization checks used by the lending protocol before allowing submission.
The modal should:
UX Improvements
Suggested additions:
Acceptance Criteria
Notes
Issue generated with AI assistance and should be reviewed before implementation.