Skip to content

Add stake on behalf of account functionality#7

Open
daveroga wants to merge 26 commits intomainfrom
feature/stake-on-behalf
Open

Add stake on behalf of account functionality#7
daveroga wants to merge 26 commits intomainfrom
feature/stake-on-behalf

Conversation

@daveroga
Copy link
Contributor

@daveroga daveroga commented Jan 19, 2026

  • Add stake on behalf function stakeAndLockOnBehalf
  • Add setStakerOnBehalf function to only allow stakerOnBehalfaddress to execute the previous function.
  • Add stakeOnBehalf to only stake on behalf without lock period.
  • AccessControlUpgradeable for different roles: REWARDS_DISTRIBUTOR_ROLE, STAKER_ON_BEHALF_ROLE.
  • Initial lock period to lock withdraw and get rewards during this period.

@daveroga daveroga requested review from Copilot and invocamanman and removed request for Copilot January 19, 2026 11:24
@daveroga daveroga force-pushed the feature/stake-on-behalf branch 2 times, most recently from cd9b08e to 58f4c12 Compare January 19, 2026 17:09
@daveroga daveroga force-pushed the feature/stake-on-behalf branch from 58f4c12 to e96ff5a Compare January 19, 2026 17:12
@daveroga daveroga force-pushed the feature/stake-on-behalf branch from 49a8005 to 21b638b Compare January 20, 2026 07:04
@daveroga daveroga marked this pull request as ready for review January 20, 2026 13:18
@daveroga daveroga force-pushed the feature/stake-on-behalf branch from 99df000 to 301a35f Compare January 30, 2026 07:29
@vmidyllic vmidyllic requested a review from Copilot March 16, 2026 14:11
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 PR adds "stake on behalf" functionality to the StakingRewards contract, replacing the single rewardsDistribution address with OpenZeppelin's AccessControlUpgradeable for role-based access, and introduces an initial lock period that restricts withdrawals and reward claims.

Changes:

  • Added stakeOnBehalf and stakeAndLockOnBehalf functions gated by STAKER_ON_BEHALF_ROLE, refactoring stake and lockStake into internal _stake and _lockStake helpers
  • Replaced rewardsDistribution address with AccessControlUpgradeable roles (REWARDS_DISTRIBUTOR_ROLE, STAKER_ON_BEHALF_ROLE)
  • Added setInitialLockPeriod owner function to block withdrawals and reward claims during a configurable initial lock period

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
contracts/staking/StakingRewards.sol Core changes: AccessControl integration, stake-on-behalf functions, initial lock period
contracts/staking/interfaces/IStakingRewards.sol Interface updated to reflect new functions and removed rewardsDistribution/setRewardsDistribution
test/StakingRewards.test.ts Tests updated for role-based access and new functionality
package-lock.json Dependency peer/direct flag changes
README.md Minor trailing whitespace change
.gitignore Added testnet deploy script JSON exclusion

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

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 PR adds "stake on behalf" functionality and role-based access control to the StakingRewards upgradeable contract, replacing the single rewardsDistribution address with OpenZeppelin's AccessControlUpgradeable roles, and introducing an initial lock period feature.

Changes:

  • Replaced rewardsDistribution address and onlyRewardsDistribution modifier with AccessControlUpgradeable roles (REWARDS_DISTRIBUTOR_ROLE, STAKER_ON_BEHALF_ROLE)
  • Added stakeOnBehalf, stakeAndLockOnBehalf functions and refactored stake/lockStake into internal _stake/_lockStake helpers
  • Added setInitialLockPeriod to block withdrawals and reward claims during a configurable initial lock period

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
contracts/staking/StakingRewards.sol Core changes: ACL roles, stake-on-behalf functions, initial lock period, internal refactors
contracts/staking/interfaces/IStakingRewards.sol Interface updated to reflect new functions and removed rewardsDistribution/setRewardsDistribution
test/StakingRewards.test.ts Tests updated for role-based access, new stakeOnBehalf/stakeAndLockOnBehalf, and initial lock period
package-lock.json Dependency peer/direct classification changes
README.md Whitespace-only change
.gitignore Added testnet deployment JSON exclusion

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

@daveroga daveroga requested a review from vmidyllic March 16, 2026 16:22
vmidyllic
vmidyllic previously approved these changes Mar 16, 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.

4 participants