RewardsV2Interface
Primary interface for managing all protocol rewards. This is a long-term support (LTS) interface, designed to ensure continuity even as underlying contracts evolve or protocols migrate to new versions.
Sourced from RewardsV2Interface.sol
on GitHub.
Functions
active
Indicates if the contract is active - claims are enabled.
function active(
) external view returns (
bool
);
claim
Claim rewards for _rewardOwner
and transfer them to _recipient
.
It can be called by reward owner or its authorized executor.
function claim(
address _rewardOwner,
address payable _recipient,
uint24 _rewardEpochId,
bool _wrap,
struct RewardsV2Interface.RewardClaimWithProof[] _proofs
) external returns (
uint256 _rewardAmountWei
);
Parameters
_rewardOwner
: Address of the reward owner._recipient
: Address of the reward recipient._rewardEpochId
: Id of the reward epoch up to which the rewards are claimed._wrap
: Indicates if the reward should be wrapped (deposited) to the WNAT contract._proofs
: Array of reward claims with merkle proofs.
Returns
_rewardAmountWei
: Amount of rewarded native tokens (wei).
getNextClaimableRewardEpochId
Returns the next claimable reward epoch for a reward owner.
function getNextClaimableRewardEpochId(
address _rewardOwner
) external view returns (
uint256
);
Parameters
_rewardOwner
: Address of the reward owner to query.
getRewardEpochIdsWithClaimableRewards
Returns the start and the end of the reward epoch range for which the reward is claimable.
function getRewardEpochIdsWithClaimableRewards(
) external view returns (
uint24 _startEpochId,
uint24 _endEpochId
);
Returns
_startEpochId
: The oldest epoch id that allows reward claiming._endEpochId
: The newest epoch id that allows reward claiming.
getStateOfRewards
Returns the state of rewards for a given address for all unclaimed reward epochs with claimable rewards.
function getStateOfRewards(
address _rewardOwner
) external view returns (
struct RewardsV2Interface.RewardState[][] _rewardStates
);
Parameters
_rewardOwner
: Address of the reward owner.
Returns
_rewardStates
: Array of reward states.
Structures
RewardClaim
Struct used in Merkle tree for storing reward claims.
struct RewardClaim {
uint24 rewardEpochId;
bytes20 beneficiary;
uint120 amount;
enum RewardsV2Interface.ClaimType claimType;
}
RewardClaimWithProof
Struct used for claiming rewards with Merkle proof.
struct RewardClaimWithProof {
bytes32[] merkleProof;
struct RewardsV2Interface.RewardClaim body;
}
RewardState
Struct used for returning state of rewards.
struct RewardState {
uint24 rewardEpochId;
bytes20 beneficiary;
uint120 amount;
enum RewardsV2Interface.ClaimType claimType;
bool initialised;
}
Enums
ClaimType
Claim type enum.
enum ClaimType {
DIRECT,
FEE,
WNAT,
MIRROR,
CCHAIN
}