Skip to content

add: improve gas + subgraph fields#319

Closed
sirpy wants to merge 24 commits intomasterfrom
improve-gas-add-subgraph-fields
Closed

add: improve gas + subgraph fields#319
sirpy wants to merge 24 commits intomasterfrom
improve-gas-add-subgraph-fields

Conversation

@sirpy
Copy link
Copy Markdown
Contributor

@sirpy sirpy commented Apr 5, 2026

  1. removed forcing of gasPrice and gasLimit
  2. added subgraph data

TODO:

  • verify that superfluid actions work without the chain overrides. does it use maxFeePerGas? does it estimate gas correctly?
  • release the subgraph

Summary by Sourcery

Relax gas configuration overrides in the GoodCollective SDK and extend subgraph tracking of UBI claims and donor/streamer metrics.

New Features:

  • Track the number of UBI claims per steward and expose it via the subgraph schema.
  • Add a streamedContribution field to DonorCollective in the subgraph schema to distinguish streamed contributions.

Enhancements:

  • Rely on default gas estimation/fee behavior by removing hardcoded gasPrice and gasLimit overrides from GoodCollective SDK contract calls and Superfluid actions.
  • Loosen the @uniswap/smart-order-router dependency to the 3.x range to allow broader compatible versions.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new non-null claims field on Steward is only initialized in handleUBIClaim; please ensure every code path that creates a Steward (other mappings/handlers) also sets an initial claims value to avoid runtime nullability errors in the subgraph.
  • You added the required streamedContribution: BigInt! field to DonorCollective in the schema but there’s no mapping code updating it; consider initializing it on DonorCollective creation and updating it wherever stream-related contributions are processed so the subgraph remains consistent.
  • By removing CHAIN_OVERRIDES entirely, callers lose the ability to customize gas parameters for specific chains; if some environments still need tuned gas settings, consider making overrides an optional argument to the affected SDK methods rather than hard-coding them or removing them outright.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new non-null `claims` field on `Steward` is only initialized in `handleUBIClaim`; please ensure every code path that creates a `Steward` (other mappings/handlers) also sets an initial `claims` value to avoid runtime nullability errors in the subgraph.
- You added the required `streamedContribution: BigInt!` field to `DonorCollective` in the schema but there’s no mapping code updating it; consider initializing it on `DonorCollective` creation and updating it wherever stream-related contributions are processed so the subgraph remains consistent.
- By removing `CHAIN_OVERRIDES` entirely, callers lose the ability to customize gas parameters for specific chains; if some environments still need tuned gas settings, consider making overrides an optional argument to the affected SDK methods rather than hard-coding them or removing them outright.

## Individual Comments

### Comment 1
<location path="packages/app/package.json" line_range="36-38" />
<code_context>
     "@tanstack/react-query": "^5.66.0",
     "@uniswap/router-sdk": "^1.9.3",
     "@uniswap/sdk-core": "^5.3.1",
-    "@uniswap/smart-order-router": "^3.35.12",
+    "@uniswap/smart-order-router": "3.*",
     "@uniswap/v3-sdk": "^3.13.1",
     "@usedapp/core": "^1.2.10",
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Relaxing the smart-order-router version to `3.*` allows downgrades to older 3.x versions, which may miss APIs you rely on.

`^3.35.12` guaranteed a minimum version with known APIs and fixes. `3.*` permits older 3.x versions that may lack required functionality, particularly for consumers or installs without a reliable lockfile. If you want broader compatibility while preserving the tested floor, use a range like `">=3.35.12 <4"` instead.

```suggestion
    "@uniswap/sdk-core": "^5.3.1",
    "@uniswap/smart-order-router": ">=3.35.12 <4",
    "@uniswap/v3-sdk": "^3.13.1",
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 36 to 38
"@uniswap/sdk-core": "^5.3.1",
"@uniswap/smart-order-router": "^3.35.12",
"@uniswap/smart-order-router": "3.*",
"@uniswap/v3-sdk": "^3.13.1",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Relaxing the smart-order-router version to 3.* allows downgrades to older 3.x versions, which may miss APIs you rely on.

^3.35.12 guaranteed a minimum version with known APIs and fixes. 3.* permits older 3.x versions that may lack required functionality, particularly for consumers or installs without a reliable lockfile. If you want broader compatibility while preserving the tested floor, use a range like ">=3.35.12 <4" instead.

Suggested change
"@uniswap/sdk-core": "^5.3.1",
"@uniswap/smart-order-router": "^3.35.12",
"@uniswap/smart-order-router": "3.*",
"@uniswap/v3-sdk": "^3.13.1",
"@uniswap/sdk-core": "^5.3.1",
"@uniswap/smart-order-router": ">=3.35.12 <4",
"@uniswap/v3-sdk": "^3.13.1",

EmekaManuel and others added 22 commits April 5, 2026 16:18
… in contracts and SDK, including gas estimation and tests.
… pools with bulk updates and error handling improvements
- Simplified factory addMembers() to inline logic instead of calling external functions
- Removed BATCH_TOO_LARGE guards - gas management is now caller's responsibility
- Added MANAGER_ROLE access control to pool addMembers() methods
- Removed _grantMemberRoleWithoutFactory() helper functions
- Consolidated SDK methods into single addPoolMembers() with poolType parameter
- Updated tests to remove obsolete double-counting and batch size checks
- Fixed SDK TypeScript error in gas estimation function
BREAKING CHANGE: SDK addDirectPaymentsPoolMembers() and addUBIPoolMembers()
methods removed in favor of consolidated addPoolMembers(poolType) method
…pools

- Consolidated member addition logic in addMembers() functions to improve readability and maintainability.
- Removed redundant event emissions and replaced them with role grants for better event handling.
- Updated tests to reflect changes in event verification and member addition processes.
- Adjusted SDK methods to align with the new member addition structure, enhancing usability.
…yments and UBI pools fixing contract build error

- Updated addMember functions in DirectPaymentsFactory, UBIPool, and UBIPoolFactory contracts from external to public visibility to enhance accessibility.
- This change allows for more flexible member addition while maintaining existing access control mechanisms.
…ctPayments and UBI pools

- Updated for-loops in addMembers functions to remove unnecessary unchecked increment statements, enhancing code clarity and maintainability.
- This change streamlines the member addition process while preserving existing functionality.
…setup logic

- Introduced reusable setup functions for DirectPayments tests to streamline test initialization and improve maintainability.
- Updated test cases to utilize the new setup functions, reducing redundancy and enhancing clarity.
- Adjusted member validation mocks to ensure accurate testing of member addition scenarios.
…pools

- Consolidated member addition functionality by introducing internal helper functions for adding members, improving code clarity and maintainability.
- Updated addMembers functions to utilize the new helper methods, enhancing the overall structure of member addition processes.
- Introduced an internal helper function for adding members with validation, improving clarity and maintainability.
- Updated the addMembers function to utilize the new helper, allowing for better error handling and skipping invalid members.
- Adjusted member validation checks to ensure robust member addition processes while preserving existing functionality.
- Enhanced the addMember function to utilize an internal helper for streamlined member addition and validation.
- Improved error handling by determining specific revert reasons based on validation checks.
- Updated tests to reflect changes in member validation logic and ensure accurate testing of member addition scenarios.
…r async handling

- Changed the mock function call for isMemberValid to await its execution, ensuring accurate test behavior.
- This adjustment improves the reliability of the test by correctly handling asynchronous operations.
@openzeppelin-code
Copy link
Copy Markdown

openzeppelin-code bot commented Apr 5, 2026

add: improve gas + subgraph fields

Generated at commit: fe03edc157ba0b981a63cea934f0626d5f1d52e1

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
1
0
4
30
36
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@sirpy sirpy closed this Apr 5, 2026
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.

3 participants