Add RewardRecipientGateway source and mainnet addresses#1
Add RewardRecipientGateway source and mainnet addresses#1mindfreakzerox wants to merge 4 commits into0xmindfreak:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the on-chain (mainnet) RewardRecipientGateway contract source + storage stub to this repo and documents the deployed proxy/implementation addresses for reference.
Changes:
- Added
RewardRecipientGateway.solsource (synced from Sourcify) to forward rewards between standard and institutional PirexEth systems. - Added
RewardRecipientGatewayStorage.solwith a reserved storage gap for upgrade-safe layout changes. - Updated
README.mdto record mainnet proxy + implementation addresses and the source sync note.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/RewardRecipientGateway.sol |
Introduces the gateway contract that routes validator operations and splits harvested ETH rewards between two systems. |
src/RewardRecipientGatewayStorage.sol |
Adds an upgrade-friendly storage gap contract used as a base for the gateway. |
README.md |
Documents mainnet deployment addresses and the source provenance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { | ||
| AccessControlDefaultAdminRulesUpgradeable | ||
| } from "openzeppelin-contracts-upgradeable/contracts/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; | ||
| import {ERC4626} from "solmate/mixins/ERC4626.sol"; |
There was a problem hiding this comment.
Importing solmate/mixins/ERC4626.sol will not compile with the current repo layout: lib/solmate/src only contains tokens/ and utils/ (no mixins/). Consider switching the type to an ERC-4626 interface available in this repo (e.g., OpenZeppelin IERC4626), or vendor the missing Solmate mixin and update remappings accordingly so CI builds succeed.
| import {ERC4626} from "solmate/mixins/ERC4626.sol"; | |
| import {ERC4626} from "solmate/tokens/ERC4626.sol"; |
src/RewardRecipientGateway.sol
Outdated
| // Calculate the rewards that should go to the institutional system based on the total assets ratio | ||
| uint256 standardAssets = autoPxEth.totalAssets(); | ||
| uint256 institutionalAssets = institutionalAutoPxEth.totalAssets(); | ||
| uint256 institutionalRewards = (institutionalAssets * _amount) / (standardAssets + institutionalAssets); |
There was a problem hiding this comment.
institutionalRewards divides by (standardAssets + institutionalAssets) without guarding against the case where both vaults have totalAssets() == 0, which will revert due to division-by-zero. Add an explicit check for a zero denominator (and decide on a sensible behavior, e.g. revert with Errors.NoRewards() or route all rewards to one system) before performing the ratio calculation.
| uint256 institutionalRewards = (institutionalAssets * _amount) / (standardAssets + institutionalAssets); | |
| uint256 totalAssets = standardAssets + institutionalAssets; | |
| // Revert if both vaults manage zero assets to avoid division by zero | |
| if (totalAssets == 0) { | |
| revert Errors.NoRewards(); | |
| } | |
| uint256 institutionalRewards = (institutionalAssets * _amount) / totalAssets; |
Summary
Testing