Skip to content

Assert ur cap#27

Open
ZouBadCode wants to merge 4 commits intomainfrom
assert-ur-cap
Open

Assert ur cap#27
ZouBadCode wants to merge 4 commits intomainfrom
assert-ur-cap

Conversation

@ZouBadCode
Copy link
Copy Markdown
Contributor

This pull request introduces a utilization-based restriction on WLP redeem requests in the lp_pool contract, preventing redemptions when pool utilization exceeds a defined threshold. It also updates the redeem request and settlement logic, adds new error handling, and adjusts tests to accommodate the new parameter and behavior.

Key changes:

Utilization-based redeem restriction

  • Added a new constant MAX_REDEEM_WLP_UTILIZATION_BPS (set to 8,000) that limits WLP redemption when pool utilization exceeds this value. Implemented the assert_redeem_allowed and calculate_total_wlp_utilization_bps functions to enforce this restriction in both redeem request and settlement paths.

  • Introduced a new error code and abort function err_redeem_blocked_by_utilization to handle cases where redemption is blocked due to high utilization.

Redeem request API and logic updates

  • Updated the request_redeem function to require a GlobalConfig parameter and to check both pool and global config versions, as well as to enforce the new utilization restriction and price freshness.

Test suite updates

  • Refactored all test cases that call request_redeem to pass the new global_cfg parameter and added cleanup for the shared global config object.

@ZouBadCode ZouBadCode requested a review from JustaLiang April 10, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant