LensReward
The LensReward
contract is very simple yet very convenient for calculating accumulated rewards. It can be used to determine the size of accumulated rewards for both single and multiple tokens within the RewardDistributor contract.
Note! You should use the callStatic function to call LensReward contract functions in order to avoid gas fees.
Deployment
This contract is not mandatory for use and deployment, but having it will enhance your system's capabilities.
To deploy LensReward
contract run following command:
npx hardhat run ./scripts/deployLens.ts --network networkName
Interaction
The information about pending rewards is provided with ClaimableRewards structure:
struct ClaimableRewards {
address token;
uint256 claimableAmount;
}
There two ways to get information about pending rewards.
- For single reward token:
LensReward.getUserClaimableReward(
address rewardDistributor,
address user,
address rewardToken
) external view returns (ClaimableRewards memory)
Parameters:rewardDistributor
- The address of the RewardDistributor contractuser
- The user's address to check pending rewards onrewardToken
- The reward token address to check rewards
- For multiple reward tokens:
LensReward.getUserClaimableRewardsAll(
address rewardDistributor,
address user,
address[] calldata allowedRewardTokenList
) external view returns (ClaimableRewards[] memory)
Parameters:rewardDistributor
- The address of the RewardDistributor contractuser
- The user's address to check pending rewards onallowedRewardTokenList
- The array of available reward tokens to check rewards