Feat: Add rewards like a semi-diamond proxy with a central storage#277
Merged
ogarciarevett merged 4 commits intomainfrom Feb 6, 2026
Merged
Feat: Add rewards like a semi-diamond proxy with a central storage#277ogarciarevett merged 4 commits intomainfrom
ogarciarevett merged 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request attempts to refactor the Rewards system into a "semi-diamond proxy with central storage" pattern by introducing two new contracts (RewardsState and Treasury) and refactoring the existing Rewards contract to delegate to them. The goal is to reduce contract size and centralize state management.
Changes:
- Introduces RewardsState.sol for centralized state management across Rewards and Treasury
- Introduces Treasury.sol for treasury-specific business logic
- Refactors Rewards.sol to delegate state management to RewardsState and treasury operations to Treasury
- Adds upgradeRewards.ts script for upgrading the Rewards contract
- Reduces Hardhat optimizer runs from 200 to 5 for maximum contract size reduction
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/upgradeables/soulbounds/RewardsState.sol | New contract for centralized state storage with role-based access control and UUPS upgradeability |
| contracts/upgradeables/soulbounds/Treasury.sol | New contract for treasury management logic, delegates state to RewardsState |
| contracts/upgradeables/soulbounds/Rewards.sol | Refactored to remove state variables and delegate to RewardsState and Treasury |
| scripts/upgradeRewards.ts | New script for upgrading the Rewards proxy contract |
| hardhat.config.ts | Reduced optimizer runs to 5 for maximum size reduction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Feat: Add rewards like a semi-diamond proxy with a central storage
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
karacurt
approved these changes
Feb 6, 2026
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
This pull request introduces a new centralized upgradeable contract for managing rewards state, adds a deployment script for upgrading the Rewards contract, and makes a minor optimization change to the Hardhat compiler settings. The main focus is on creating a robust, upgradeable state management contract for the rewards and treasury system, along with supporting tooling for upgrades and deployment.
Rewards System State Management:
RewardsStateincontracts/upgradeables/soulbounds/RewardsState.sol, which centralizes and manages all shared state between Rewards and Treasury contracts. It includes role-based access control, token whitelisting, reservation management for ERC20/ERC721/ERC1155, reward token management, nonce tracking, and is upgradeable using the UUPS pattern.Deployment and Upgrade Tooling:
scripts/upgradeRewards.tsto automate upgrading the Rewards contract proxy, including proxy registration, upgrade execution, implementation address retrieval, and post-upgrade validation such as treasury delegation checks.Build/Optimization:
hardhat.config.tsto use fewer optimizer runs (runs: 5) for maximum contract size reduction, which may help with deployment size constraints.🙊 Checklist: