Claim Rewards
Operators claim fees from Rewards.sol using the claimOperatorFees entrypoint for Vault Snapshot rewards. Find the up-to-date Rewards contract address on the Addresses page.
Check claimable rewards
Use the view functions on Rewards.sol to determine the range of rewards to claim:
rewardsLength(vault, network, token)returns the total number of reward distributions.lastUnclaimedOperatorReward(account, vault, network, token)returns the index of your last unclaimed reward.
Claim operator fees (spec)
function claimOperatorFees(
address recipient,
address network,
address token,
address vault,
uint256 lastUnclaimedRewards,
uint256 firstRewardToClaim,
uint256 rewardsToClaim,
bytes calldata extraData
) public| Parameter | Description |
|---|---|
recipient | Address that receives the claimed tokens |
network | Network whose operator fees are being claimed |
token | ERC20 reward token |
vault | Vault address |
lastUnclaimedRewards | Expected current index from storage (reorg protection) |
firstRewardToClaim | Optional starting index for claiming |
rewardsToClaim | Max number of rewards to process |
extraData | ABI-encoded hints for NetworkRestakeDelegator; pass empty bytes if not needed |
Example: calculate unclaimed reward and execute claim function
uint256 totalRewards = rewards.rewardsLength(vault, network, token);
uint256 lastClaimed = rewards.lastUnclaimedOperatorReward(operator, vault, network, token);
uint256 unclaimedCount = totalRewards - lastClaimed;
bytes memory extraData = abi.encode(operatorNetworkSharesHints, totalOperatorNetworkSharesHint);
rewards.claimOperatorFees(
recipient,
network,
token,
vault,
lastClaimed,
0,
unclaimedCount,
""
);