Skip to content

Allow rewards to be batch claimed onBehalf #65

@etn0m

Description

@etn0m

Auditor Recommendation

It is regarded as best practice to allow keeper bots to claim rewards on users' behalf. This will allow users to receive their rewards even when they are inactive for a short period. This could be achieved by adding
a function similar to the following to the StakingRewards contract:

function getRewardOnBehalf(address[] stakers) external returns (bool) {
    for (uint i; i < stakers.length; i++) {
        _updateRewards(stakers[i]);
        uint256 reward = rewards[stakers[i]];
        if (reward > 0) {
      rewards[stakers[i]] = 0;
      // Send the rewards to Escrow for 1 year
      stakingToken.transfer(address(rewardEscrow), reward);
      rewardEscrow.appendVestingEntry(stakers[i], reward, 52 weeks);
      emit RewardPaid(stakers[i], reward);
    }
}

By allowing a keeper bot to claim multiple users' rewards in a single transaction, the overall gas cost can be decreased to the gas refunds given for reaccessing storage slots.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions