Add xdc fork test for GenericDistributionHelper#287
Merged
Conversation
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `test/reserve/GenericDistributionHelper.e2e.test.ts:275-284` </location>
<code_context>
+ it("should correctly calculate swap amounts using XSWAP pools", async function () {
</code_context>
<issue_to_address>
**suggestion (testing):** Missing test for edge cases in calcGDToSell (e.g., zero input, very large input).
Add tests for calcGDToSell with zero and very large G$ inputs to verify correct handling of boundary conditions.
</issue_to_address>
### Comment 2
<location> `test/reserve/GenericDistributionHelper.e2e.test.ts:322-331` </location>
<code_context>
+ it("should handle swap with correct slippage protection", async function () {
</code_context>
<issue_to_address>
**suggestion (testing):** Missing test for slippage exceeding maxSlippage.
Add a test case where slippage exceeds maxSlippage and verify that the swap is reverted, confirming slippage protection works correctly.
</issue_to_address>
### Comment 3
<location> `test/reserve/GenericDistributionHelper.e2e.test.ts:343` </location>
<code_context>
const maxSlippage = feeSettings.maxSlippage;
</code_context>
<issue_to_address>
**suggestion (code-quality):** Prefer object destructuring when accessing and using properties. ([`use-object-destructuring`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/TypeScript/Default-Rules/use-object-destructuring))
```suggestion
const {maxSlippage} = feeSettings;
```
<br/><details><summary>Explanation</summary>Object destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.
From the [Airbnb Javascript Style Guide](https://airbnb.io/javascript/#destructuring--object)
</details>
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
71b4c84 to
d74faa9
Compare
sirpy
requested changes
Dec 24, 2025
Add xdc fork test for GenericDistributionHelper
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
…ibutionHelper E2E tests
…tributionHelper E2E tests
sirpy
requested changes
Jan 21, 2026
| minReceived: ethers.utils.formatEther(minReceived) | ||
| }); | ||
|
|
||
| expect(quoteWXDC).to.be.equal(minReceived); |
Contributor
There was a problem hiding this comment.
why does the quote need to equal minreceived?
also see the AI comment that you arenot testing a case where slippage is larger
Collaborator
Author
There was a problem hiding this comment.
because they are using:
Same input: amountToSell (100 G$)
Same path: G$ -> CUSD -> WXDC
Same oracle: STATIC_ORACLE.quoteAllAvailablePoolsWithTimePeriod
Same pools: both use the same G$/CUSD and CUSD/WXDC pools
I will add large slippage test
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.
Description
Added a GenericDistributionHelper XDC-fork test to verify that swapping G$ to XDC through xswap is working correctly.
About # (link your issue here)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: