Skip to content

[VEN-3321]: Liquidation Threshold and repay Improvements in Core Pool on BNB - #604

Open
Debugger022 wants to merge 122 commits into
developfrom
feat/VEN-3321
Open

[VEN-3321]: Liquidation Threshold and repay Improvements in Core Pool on BNB#604
Debugger022 wants to merge 122 commits into
developfrom
feat/VEN-3321

Conversation

@Debugger022

@Debugger022 Debugger022 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Description

This PR implements the following features:-

[VEN-3321] - Add the concept of Liquidation Threshold to the core Pool on BNB.
[VEN-3322] - Dynamic Liquidation Incentive and Close Factor in core Pool on BNB.
[VEN-3323] - Define maximum Liquidation Incentive per seized asset in the core pool on BNB.
[VEN-233] - Repay logic improvisation

This pull request introduces significant enhancements and refactoring to the contracts, primarily to support dynamic liquidation incentives, improved health factor calculations, and integration with a new LiquidationManager contract. The changes include new interfaces and storage structures, updated function signatures, and expanded account health and liquidation logic.

Liquidation and Account Health Enhancements

  • Added new functions and updated existing ones in ComptrollerInterface.sol to support dynamic liquidation incentives and close factor, health factor calculations, and detailed account snapshots, including overloaded methods for seize token calculations.

LiquidationManager Integration

  • Added references to the new LiquidationManager contract in both storage and interface files, and exposed its address via the Comptroller contract.

Storage and Contract Refactoring

  • Deprecated old close factor and liquidation incentive variables, replacing them with new ones (__oldCloseFactorMantissaSlot, maxLiquidationIncentiveMantissa) and moved to ComptrollerV19Storage. Updated all relevant contract inheritance to use the new storage version. Also, removed the old setCloseFactor and setLiquidationIncentive functions as they will now be calculated dynamically using the liquidationManager.

Diamond Facet and Functionality Updates

  • Updated FacetBase and MarketFacet to use new health snapshot logic and ComptrollerLens integration, including new internal and external functions for health factor calculations and liquidation seize token calculations.

Repay logic Improvisation

  • Updated the repayAmount calculation in the VToken from this to this:
    vars.repayAmount = repayAmount >= vars.accountBorrows ? vars.accountBorrows : repayAmount;

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

don't merge Need to merge after passing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants