IInfraredDistributor

Git Source

Interface for distributing validator commissions and rewards

Handles reward distribution snapshots and claiming logic for validators

Functions

token

Token used for reward distributions

function token() external view returns (ERC20);

Returns

NameTypeDescription
<none>ERC20The ERC20 token interface of the reward token

amountsCumulative

Tracks reward amount accumulation per validator

function amountsCumulative() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Current cumulative amount of rewards

getSnapshot

Get validator's reward snapshots

Returns (0,0) if validator doesn't exist

function getSnapshot(bytes calldata pubkey)
    external
    view
    returns (uint256 amountCumulativeLast, uint256 amountCumulativeFinal);

Parameters

NameTypeDescription
pubkeybytesValidator's public key

Returns

NameTypeDescription
amountCumulativeLastuint256Last claimed accumulator value
amountCumulativeFinaluint256Final accumulator value if removed

getValidator

Get validator's registered claim address

function getValidator(bytes calldata pubkey) external view returns (address);

Parameters

NameTypeDescription
pubkeybytesValidator's public key

Returns

NameTypeDescription
<none>addressAddress authorized to claim validator rewards

add

Register new validator for rewards

Only callable by Infrared contract

Notes:

  • access-control: Requires INFRARED_ROLE

  • error: ValidatorAlreadyExists if validator already registered

function add(bytes calldata pubkey, address validator) external;

Parameters

NameTypeDescription
pubkeybytesValidator's public key
validatoraddressAddress authorized to claim rewards

remove

Removes validator from reward-eligible set

Only callable by Infrared contract

Note: access-control: Requires INFRARED_ROLE

function remove(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesValidator's public key

purge

Purges validator from registry completely

Only possible after all rewards are claimed

Note: error: ClaimableRewardsExist if unclaimed rewards remain

function purge(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesValidator's public key

notifyRewardAmount

Distributes new commission rewards to validator set

Notes:

  • error: ZeroAmount if amount is 0

  • error: InvalidValidator if no validators exist

function notifyRewardAmount(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256Amount to distribute equally among validators

claim

Claims outstanding commission rewards

Notes:

  • error: InvalidValidator if caller not authorized

  • error: ZeroAmount if no rewards to claim

function claim(bytes calldata pubkey, address recipient) external;

Parameters

NameTypeDescription
pubkeybytesValidator's public key
recipientaddressAddress to receive the claimed rewards

Events

Added

Emitted when validator is added to commission-eligible set

event Added(bytes pubkey, address operator, uint256 amountCumulative);

Parameters

NameTypeDescription
pubkeybytesValidator's public key
operatoraddressAddress authorized to claim rewards
amountCumulativeuint256Starting point for commission stream

Removed

Emitted when validator is removed from commission-eligible set

event Removed(bytes pubkey, address operator, uint256 amountCumulative);

Parameters

NameTypeDescription
pubkeybytesValidator's public key
operatoraddressAddress previously authorized for claims
amountCumulativeuint256Final point for commission stream

Purged

Emitted when validator is fully purged from registry

event Purged(bytes pubkey, address validator);

Parameters

NameTypeDescription
pubkeybytesValidator's public key
validatoraddressAddress being purged

Notified

Emitted when new commission rewards are added

event Notified(uint256 amount, uint256 num);

Parameters

NameTypeDescription
amountuint256New rewards being distributed
numuint256Current number of eligible validators

Claimed

Emitted when validator claims their commission

event Claimed(
    bytes pubkey, address validator, address recipient, uint256 amount
);

Parameters

NameTypeDescription
pubkeybytesClaiming validator's public key
validatoraddressAddress authorized for claims
recipientaddressAddress receiving the commission
amountuint256Amount of commission claimed

Structs

Snapshot

Reward accumulation checkpoints for validators

Used to calculate claimable rewards between snapshots

struct Snapshot {
    uint256 amountCumulativeLast;
    uint256 amountCumulativeFinal;
}