IRRewardDistributor
Inherits: InfraredUpgradeable
Title: IRRewardDistributor
Distributes IR emissions to Infrared vaults based on governance/keeper configured weights
Integrates with Infrared.addIncentives() for vault reward distribution
Maintains a list of eligible stakingTokens (added by governor) for distribution
Mandatory minimum allocation to iBGT vault (siBGT stakers); iBGT cannot be weighted or excluded
State Variables
BASIS_POINTS
Basis points denominator (100%)
uint256 public constant BASIS_POINTS = 10000
MAX_IBGT_ALLOCATION
Maximum iBGT vault allocation (50%)
uint256 public constant MAX_IBGT_ALLOCATION = 5000
_irToken
IR token for rewards
ERC20 private _irToken
lastEpochTimestamp
Start timestamp of current epoch
uint256 public lastEpochTimestamp
totalRewardsPerEpoch
Total IR to distribute per epoch
uint256 public totalRewardsPerEpoch
currentEpoch
Current epoch number
uint256 public currentEpoch
minIBGTAllocation
Minimum allocation to iBGT vault in basis points (e.g., 2000 = 20%)
uint256 public minIBGTAllocation
_excludedVaults
Set of excluded vaults (not eligible for distribution)
EnumerableSet.AddressSet private _excludedVaults
_eligibleVaults
Set of eligible vaults (maintained by governor; excludes iBGT and excluded vaults)
EnumerableSet.AddressSet private _eligibleVaults
defaultVaultWeights
stakingToken => weight (basis points) - configurable by governance/keeper
mapping(address => uint256) public defaultVaultWeights
totalDefaultWeight
Sum of default weights
uint256 public totalDefaultWeight
epochDuration
Reward distribution period
uint256 public epochDuration
carryOverRewards
Accumulated undistributed rewards from previous failed distributions per vault
mapping(address => uint256) public carryOverRewards
__gap
uint256[40] private __gap
Functions
initialize
Initialize the contract
function initialize(
address _infrared,
address _gov,
address irToken,
uint256 _minIBGTAllocation
) external initializer;
Parameters
| Name | Type | Description |
|---|---|---|
_infrared | address | Infrared protocol address |
_gov | address | Governance address |
irToken | address | IR token address |
_minIBGTAllocation | uint256 | Minimum allocation to iBGT vault in basis points |
excludeVault
Exclude a stakingToken from distribution and voting
function excludeVault(address stakingToken) external virtual onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address to exclude |
includeVault
Include a previously excluded stakingToken (does not auto-add to eligible)
function includeVault(address stakingToken) external virtual onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address to include |
addEligibleVault
Add an eligible stakingToken for distribution (must be a valid Infrared vault)
function addEligibleVault(address stakingToken)
external
virtual
onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address to add |
removeEligibleVault
Remove an eligible stakingToken
function removeEligibleVault(address stakingToken)
external
virtual
onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address to remove |
setRewardsPerEpoch
Set total rewards per epoch
function setRewardsPerEpoch(uint256 amount) external virtual onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Total IR tokens to distribute per epoch |
setEpochDuration
Set epoch duration (time between distrubtions)
function setEpochDuration(uint256 _newDuration)
external
virtual
onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
_newDuration | uint256 | Duration, in seconds, between distribution events |
setMinIBGTAllocation
Set minimum iBGT vault allocation
function setMinIBGTAllocation(uint256 allocation)
external
virtual
onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
allocation | uint256 | Minimum allocation in basis points (max 50%) |
updateDefaultWeights
Update vault weights (sum must be BASIS_POINTS)
Callable by governance or keeper for operational flexibility
function updateDefaultWeights(
address[] calldata stakingTokens_,
uint256[] calldata weights
) external virtual onlyKeeper;
Parameters
| Name | Type | Description |
|---|---|---|
stakingTokens_ | address[] | Array of stakingToken addresses |
weights | uint256[] | Array of weights in basis points |
recoverERC20
Recover ERC20 tokens sent to this contract (governor only)
function recoverERC20(address token, uint256 amount)
external
virtual
onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
token | address | The ERC20 token to recover |
amount | uint256 | The amount to recover (or max balance if 0) |
distributeRewards
Distribute rewards to vaults based on configured weights
Can only be called after epoch ends
function distributeRewards() external virtual;
_getEligibleVaults
Get all eligible vaults for distribution
function _getEligibleVaults()
internal
view
virtual
returns (address[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | Array of eligible stakingToken addresses |
_calculateTotalCarryOver
Calculate the total carry-over rewards across iBGT and all eligible vaults
function _calculateTotalCarryOver()
internal
view
virtual
returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The sum of all carry-over amounts |
IR_TOKEN
Get IR token address
function IR_TOKEN() external view virtual returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The IR token address |
getExcludedVaults
Get all excluded vaults
function getExcludedVaults()
external
view
virtual
returns (address[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | Array of excluded stakingToken addresses |
getEligibleVaults
Get all eligible vaults
function getEligibleVaults()
external
view
virtual
returns (address[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address[] | Array of eligible stakingToken addresses |
isVaultExcluded
Check if vault is excluded
function isVaultExcluded(address stakingToken)
external
view
virtual
returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if vault is excluded |
timeUntilNextEpoch
Get time until next epoch
function timeUntilNextEpoch() external view virtual returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Seconds until next epoch (0 if epoch has ended) |
getVaultAllocation
Preview the allocation for a specific vault in the next distribution
function getVaultAllocation(address stakingToken)
external
view
virtual
returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
stakingToken | address | The stakingToken address |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The estimated reward amount for the vault |
getNextEpochRewards
Get the total rewards for the next epoch
function getNextEpochRewards() external view virtual returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total rewards per epoch (pending distribution) |
Events
RewardsDistributed
event RewardsDistributed(address indexed stakingToken, uint256 amount);
VaultExcluded
event VaultExcluded(address indexed stakingToken);
VaultIncluded
event VaultIncluded(address indexed stakingToken);
EligibleVaultAdded
event EligibleVaultAdded(address indexed stakingToken);
EligibleVaultRemoved
event EligibleVaultRemoved(address indexed stakingToken);
EpochStarted
event EpochStarted(
uint256 indexed epoch, uint256 timestamp, uint256 totalRewards
);
EpochFinalized
event EpochFinalized(uint256 indexed epoch);
WeightsUpdated
event WeightsUpdated(address indexed stakingToken, uint256 weight);
RewardsPerEpochUpdated
event RewardsPerEpochUpdated(uint256 oldAmount, uint256 newAmount);
EpochDurationUpdated
event EpochDurationUpdated(uint256 oldDuration, uint256 newDuration);
MinIBGTAllocationUpdated
event MinIBGTAllocationUpdated(
uint256 oldAllocation, uint256 newAllocation
);
TokensRecovered
event TokensRecovered(address indexed token, uint256 amount);
DistributionFailed
event DistributionFailed(
address indexed stakingToken, uint256 amount, bytes errorData
);
Errors
InvalidVault
error InvalidVault();
InvalidAmount
error InvalidAmount();
EpochNotEnded
error EpochNotEnded();
NoRewardsAvailable
error NoRewardsAvailable();
InvalidWeights
error InvalidWeights();
NoWeightsSet
error NoWeightsSet();
InsufficientIRBalance
error InsufficientIRBalance();
InvalidArrayLength
error InvalidArrayLength();
ZeroAddress
error ZeroAddress();
InvalidAllocation
error InvalidAllocation();