Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IIRRewardDistributor

Git Source

Title: IIRRewardDistributor

Interface for the IR Reward Distributor contract

Manages IR token distribution to Infrared vaults based on governance/keeper configured weights

Maintains list of eligible vaults for distribution

Mandatory minimum allocation to iBGT vault (siBGT stakers)

Functions

initialize

Initialize the contract

function initialize(
    address _infrared,
    address irToken,
    address sirToken,
    uint256 _minIBGTAllocation
) external;

Parameters

NameTypeDescription
_infraredaddressInfrared protocol address
irTokenaddressIR token address
sirTokenaddresssIR token address
_minIBGTAllocationuint256Minimum allocation to iBGT vault in basis points

excludeVault

Exclude a vault from distribution

function excludeVault(address vault) external;

Parameters

NameTypeDescription
vaultaddressThe vault address to exclude

includeVault

Include a previously excluded vault

function includeVault(address vault) external;

Parameters

NameTypeDescription
vaultaddressThe vault address to include

addEligibleVault

Add an eligible vault for distribution

function addEligibleVault(address vault) external;

Parameters

NameTypeDescription
vaultaddressThe vault address to add

removeEligibleVault

Remove an eligible vault

function removeEligibleVault(address vault) external;

Parameters

NameTypeDescription
vaultaddressThe vault address to remove

setRewardsPerEpoch

Set total rewards per epoch

function setRewardsPerEpoch(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256Total IR tokens to distribute per epoch

setMinIBGTAllocation

Set minimum iBGT vault allocation

function setMinIBGTAllocation(uint256 allocation) external;

Parameters

NameTypeDescription
allocationuint256Minimum allocation in basis points (max 50%)

updateTokens

Update IR and sIR token addresses (for upgrades)

function updateTokens(address irToken, address sirToken) external;

Parameters

NameTypeDescription
irTokenaddressNew IR token address
sirTokenaddressNew sIR token address

updateDefaultWeights

Update vault weights (sum must be BASIS_POINTS)

Callable by governance or keeper for operational flexibility

function updateDefaultWeights(
    address[] calldata vaults,
    uint256[] calldata weights
) external;

Parameters

NameTypeDescription
vaultsaddress[]Array of vault addresses
weightsuint256[]Array of weights in basis points

distributeRewards

Distribute rewards to vaults based on configured weights

Can only be called after epoch ends

function distributeRewards() external;

IR_TOKEN

Get IR token address

function IR_TOKEN() external view returns (address);

Returns

NameTypeDescription
<none>addressThe IR token address

SIR_TOKEN

Get sIR token address

function SIR_TOKEN() external view returns (address);

Returns

NameTypeDescription
<none>addressThe sIR token address

getExcludedVaults

Get all excluded vaults

function getExcludedVaults() external view returns (address[] memory);

Returns

NameTypeDescription
<none>address[]Array of excluded vault addresses

getEligibleVaults

Get all eligible vaults

function getEligibleVaults() external view returns (address[] memory);

Returns

NameTypeDescription
<none>address[]Array of eligible vault addresses

isVaultExcluded

Check if vault is excluded

function isVaultExcluded(address vault) external view returns (bool);

Parameters

NameTypeDescription
vaultaddressThe vault address

Returns

NameTypeDescription
<none>boolTrue if vault is excluded

timeUntilNextEpoch

Get time until next epoch

function timeUntilNextEpoch() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Seconds until next epoch (0 if epoch has ended)

currentEpoch

Get current epoch number

function currentEpoch() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The current epoch

totalRewardsPerEpoch

Get total rewards per epoch

function totalRewardsPerEpoch() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total rewards per epoch

lastEpochTimestamp

Get last epoch timestamp

function lastEpochTimestamp() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The last epoch timestamp

minIBGTAllocation

Get minimum iBGT vault allocation

function minIBGTAllocation() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The minimum iBGT allocation in basis points

defaultVaultWeights

Get weight for a vault

function defaultVaultWeights(address vault) external view returns (uint256);

Parameters

NameTypeDescription
vaultaddressThe vault address

Returns

NameTypeDescription
<none>uint256The vault weight

totalDefaultWeight

Get total weight

function totalDefaultWeight() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total weight

infrared

Get Infrared protocol address

function infrared() external view returns (address);

Returns

NameTypeDescription
<none>addressThe Infrared protocol address

Events

RewardsDistributed

Emitted when rewards are distributed to a vault

event RewardsDistributed(address indexed vault, uint256 amount);

VaultExcluded

Emitted when a vault is excluded from distribution

event VaultExcluded(address indexed vault);

VaultIncluded

Emitted when a vault is included in distribution

event VaultIncluded(address indexed vault);

EligibleVaultAdded

Emitted when an eligible vault is added

event EligibleVaultAdded(address indexed vault);

EligibleVaultRemoved

Emitted when an eligible vault is removed

event EligibleVaultRemoved(address indexed vault);

EpochStarted

Emitted when a new epoch starts

event EpochStarted(
    uint256 indexed epoch, uint256 timestamp, uint256 totalRewards
);

EpochFinalized

Emitted when an epoch is finalized

event EpochFinalized(uint256 indexed epoch);

WeightsUpdated

Emitted when vault weights are updated

event WeightsUpdated(address indexed vault, uint256 weight);

RewardsPerEpochUpdated

Emitted when rewards per epoch is updated

event RewardsPerEpochUpdated(uint256 oldAmount, uint256 newAmount);

MinIBGTAllocationUpdated

Emitted when minimum iBGT allocation is updated

event MinIBGTAllocationUpdated(
    uint256 oldAllocation, uint256 newAllocation
);

TokensUpdated

Emitted when token addresses are updated

event TokensUpdated(address indexed irToken, address indexed sirToken);

Errors

InvalidVault

Thrown when vault address is invalid

error InvalidVault();

InvalidAmount

Thrown when amount is invalid

error InvalidAmount();

EpochNotEnded

Thrown when trying to distribute before epoch ends

error EpochNotEnded();

NoRewardsAvailable

Thrown when no rewards are available for distribution

error NoRewardsAvailable();

InvalidWeights

Thrown when weights are invalid

error InvalidWeights();

NoWeightsSet

Thrown when no weights are set

error NoWeightsSet();

InsufficientIRBalance

Thrown when contract has insufficient IR balance

error InsufficientIRBalance();

InvalidArrayLength

Thrown when array lengths don't match

error InvalidArrayLength();

ZeroAddress

Thrown when zero address is provided

error ZeroAddress();

InvalidAllocation

Thrown when allocation is invalid

error InvalidAllocation();