Skip to content

Chore: Adding new field to the return all treasuries - fe need it#278

Merged
ogarciarevett merged 3 commits into
mainfrom
feat/add-tokenId-for-nft-treasuries
Feb 10, 2026
Merged

Chore: Adding new field to the return all treasuries - fe need it#278
ogarciarevett merged 3 commits into
mainfrom
feat/add-tokenId-for-nft-treasuries

Conversation

@ogarciarevett
Copy link
Copy Markdown
Collaborator

Issue: resolves

🐵 Description

This pull request enhances the getAllTreasuryBalances functionality in the Rewards and Treasury contracts to include token IDs for all treasury assets. This addition provides more granular information about each token, especially for ERC1155 tokens, and updates the related tests to ensure correctness.

Smart Contract Enhancements:

  • The getAllTreasuryBalances function in both Rewards.sol and Treasury.sol now returns an additional array, tokenIds, which contains the token ID for each asset (0 for ERC20/ERC721, actual token ID for ERC1155). [1] [2] [3]
  • The internal logic in Treasury.sol is updated to populate the tokenIds array appropriately for each token type, including modifications to the ERC1155 processing function to handle token IDs. [1] [2] [3] [4]

Testing Improvements:

  • The test suite in rewardsSoulbound.test.ts is updated to assert the correct handling and values of the new tokenIds field for all token types, ensuring the changes are verified across different scenarios. [1] [2] [3] [4] [5]

🙊 Checklist:

  • I have added tests proving my fix is effective or that my feature works
  • Contract deployed to testnet(only for new contracts)

@ogarciarevett ogarciarevett self-assigned this Feb 9, 2026
Copilot AI review requested due to automatic review settings February 9, 2026 18:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the getAllTreasuryBalances view in the Soulbound Rewards/Treasury flow to also return a tokenIds array, enabling callers (notably FE) to distinguish ERC1155 assets by token ID while keeping ERC20/ERC721 tokenIds as 0.

Changes:

  • Updated Rewards.getAllTreasuryBalances() and Treasury.getAllTreasuryBalances() to return an additional uint256[] tokenIds.
  • Updated Treasury’s ERC1155 aggregation to populate tokenIds per unique (contract, tokenId) pair.
  • Updated rewardsSoulbound.test.ts assertions to validate tokenIds for empty / ERC20 / ERC1155 and mixed scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
contracts/upgradeables/soulbounds/Rewards.sol Extends Rewards’ delegated treasury balance getter to include tokenIds in the return tuple and docs.
contracts/upgradeables/soulbounds/Treasury.sol Allocates/fills tokenIds and threads it through ERC1155 processing; updates return signature accordingly.
test/rewardsSoulbound.test.ts Adds test assertions to validate the new tokenIds field across several scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/upgradeables/soulbounds/Treasury.sol
@openzeppelin-code
Copy link
Copy Markdown

openzeppelin-code Bot commented Feb 9, 2026

Chore: Adding new field to the return all treasuries - fe need it

Generated at commit: 8fb34d69726b23e999b6fadf2449282544b9792f

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
3
0
10
41
56
Dependencies Critical
High
Medium
Low
Note
Total
1
0
0
0
0
1

For more details view the full report in OpenZeppelin Code Inspector

@ogarciarevett ogarciarevett merged commit cc0ec0d into main Feb 10, 2026
1 check passed
@ogarciarevett ogarciarevett deleted the feat/add-tokenId-for-nft-treasuries branch February 10, 2026 15:47
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