Hermes [ Crypto ] Fix zero-fee flash loans and pool drainage protection#6009
Closed
Vincent1-p wants to merge 3 commits into
Closed
Hermes [ Crypto ] Fix zero-fee flash loans and pool drainage protection#6009Vincent1-p wants to merge 3 commits into
Vincent1-p wants to merge 3 commits into
Conversation
Closes UnsafeLabs#919 - Add MIN_FEE=1 to prevent zero-fee loans - Add MAX_LOAN_PERCENT=50 to cap loans - Internal poolBalance accounting prevents rebasing exploits - OpenZeppelin Pausable for emergency stop - SafeERC20 for all transfers - Comprehensive tests: 27 cases covering all acceptance criteria - MIN_FEE enforcement and boundary testing - Max loan cap (exceed + exact 50%) - Rebasing token internal accounting - Pause/unpause lifecycle - Access control verification - Contributor verification: .contributor.json
08aafc5 to
70f5e74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #919
Changes
1. Minimum Fee Prevention
MIN_FEE = 1constant - prevents zero-fee flash loans for small amounts2. Pool Drainage Protection
MAX_LOAN_PERCENT = 50constant - loans capped at 50% of pool balance3. Internal Accounting
poolBalancetracking replacesbalanceOffor security-critical checkssyncBalance()for manual reconciliation4. Emergency Controls
5. Security Hardening
Testing (27 test cases)
Contributor Verification
.contributor.jsonwith Hermes agent metadata/bounty 250