Add some additional tests and utility functions pre production deploy#6
Closed
Add some additional tests and utility functions pre production deploy#6
Conversation
3ff6a2c to
9c88716
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR reorganizes and expands test coverage for the AltheaDex incentives system while adding several critical improvements to the main contract:
- Reorganizes tests from flat files into a structured
test/incentives/directory - Adds comprehensive validation tests, overflow tests, and edge case coverage
- Implements emergency withdrawal functionality and validation checks in the contract
- Adds pagination to the
totalOwedfunction to prevent gas issues with large user sets
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 40 comments.
Show a summary per file
| File | Description |
|---|---|
| test/incentives/Validation.ts | New comprehensive validation and edge case tests including emergency withdrawal, overflow handling, concurrency, and deactivation scenarios |
| test/incentives/TestRewardCalculations.ts | New overflow/underflow tests verifying reward calculations with realistic DEX liquidity values |
| test/incentives/ConcentratedIncentives.ts | Reorganized concentrated rewards tests with proper BigNumber usage and pagination tests |
| test/incentives/ClaimAndWithdraw.ts | New tests for claim/withdraw variants, event emission, and liquidity tracking |
| test/incentives/AmbientIncentives.ts | Reorganized ambient rewards tests with proper BigNumber usage and pagination tests |
| test/incentives/AccessControl.ts | New comprehensive access control, deactivation, and constructor tests |
| test/TestConcentratedIncentives.ts | Deleted old flat test file (code moved to organized structure) |
| test/TestAmbientIncentives.ts | Deleted old flat test file (code moved to organized structure) |
| contracts/AltheaDexIncentivesContinuousMulti.sol | Added validation checks, emergency withdrawal, pagination for totalOwed, unclaimed rewards check on registration, and new events |
Comments suppressed due to low confidence (1)
contracts/AltheaDexIncentivesContinuousMulti.sol:206
- The require check at lines 206 and 216 is now redundant since the same validation is performed earlier in the public functions at lines 164 and 187. Consider removing these duplicate checks from the internal helper functions.
require(program.p.rewardRateDenominator != 0, "Zero denominator");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b10a67e to
2a758e2
Compare
This modifies the structure of the incentives contract we have been working with to solve a key problem. Namely the accuracy was either unacceptable or the management of the contract (funding expectations) where intractable. This has now been resolved with a new delegated claiming model that can be added to the existing althea l1 gassless tx ecosystem. This provides consistent updates that and allows for efficient operation and management in one package.
2a758e2 to
03bd8e3
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.
This patch adds a significant amount of new test scope and some new utility functions