-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(PerpV2BasisTradingModule): External audit fixes for low-risk find…
…ings and Internal audit fixes (#232) * Design Improvement: Cache storage slot values * Design Improvements: Spelling and grammar * Fix typo * Fix revert statement * Design improvement: Return early if no funding will be withdrawn * Fix coverage: Add test case for when notionalFunding is zero * Fix failing test * Modify calculateExternalPositionUnit logic used by deposit and withdraw; Reduce bytecodesize * Override withdraw function to track settled funding * Fix deposit; Add check to ensure deposit unit is <= current unit; Add tests * Refactor update external position unit logic; Add tests * Fix tests; And skip 2 getRedemptionAdjustments tests * Add internal audit fixes and suggestions * Fix division by zero error * fix(tests): Small fixes for BasisTradingModule audit changes (#243) * Add fix for _updateExternalPositionUnit * Add test for negative balance check in _calculateNetFeesPositionUnit * Fix externalPositionUnit test in perpV2LeverageV2SlippageIssuance tests * Use `tradeAndTrackFunding` everywhere in BasisTrading integration tests * Remove .skip; Fix javadocs Co-authored-by: cgewecke <[email protected]>
- Loading branch information
Showing
11 changed files
with
526 additions
and
194 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
158 changes: 109 additions & 49 deletions
158
contracts/protocol/modules/v2/PerpV2BasisTradingModule.sol
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.