Skip to content

Feat: Add rewards like a semi-diamond proxy with a central storage#277

Merged
ogarciarevett merged 4 commits intomainfrom
feat/reward-modules
Feb 6, 2026
Merged

Feat: Add rewards like a semi-diamond proxy with a central storage#277
ogarciarevett merged 4 commits intomainfrom
feat/reward-modules

Conversation

@ogarciarevett
Copy link
Collaborator

🐵 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:

  • Introduced a new upgradeable contract RewardsState in contracts/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:

  • Added a new script scripts/upgradeRewards.ts to 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:

  • Updated the Hardhat Solidity optimizer settings in hardhat.config.ts to use fewer optimizer runs (runs: 5) for maximum contract size reduction, which may help with deployment size constraints.

🙊 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 5, 2026
Copilot AI review requested due to automatic review settings February 5, 2026 03:29
Copy link

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 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.

@openzeppelin-code
Copy link

openzeppelin-code bot commented Feb 5, 2026

Feat: Add rewards like a semi-diamond proxy with a central storage

Generated at commit: 67a5cc402a6f8b991dfcae15d67e2c24e54a6adb

🚨 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 ec92812 into main Feb 6, 2026
1 check passed
@ogarciarevett ogarciarevett deleted the feat/reward-modules branch February 6, 2026 13:33
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