Git Source
Methods
ADMIN_FEE_BASE
function ADMIN_FEE_BASE() external view returns (uint256)
 
Get the maximum admin fee (= 100%).
Returns
| Name | Type | Description | 
|---|
 | uint256 | maximum admin fee | 
ADMIN_FEE_CLAIM_ROLE
function ADMIN_FEE_CLAIM_ROLE() external view returns (bytes32)
 
Get the admin fee claimer’s role.
Returns
| Name | Type | Description | 
|---|
 | bytes32 | identifier of the admin fee claimer role | 
ADMIN_FEE_SET_ROLE
function ADMIN_FEE_SET_ROLE() external view returns (bytes32)
 
Get the admin fee setter’s role.
Returns
| Name | Type | Description | 
|---|
 | bytes32 | identifier of the admin fee setter role | 
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
 
Returns
| Name | Type | Description | 
|---|
 | bytes32 |  | 
NETWORK_MIDDLEWARE_SERVICE
function NETWORK_MIDDLEWARE_SERVICE() external view returns (address)
 
Get the network middleware service’s address.
Returns
| Name | Type | Description | 
|---|
 | address | address of the network middleware service | 
VAULT
function VAULT() external view returns (address)
 
Get the vault’s address.
Returns
| Name | Type | Description | 
|---|
 | address | address of the vault | 
VAULT_FACTORY
function VAULT_FACTORY() external view returns (address)
 
Get the vault factory’s address.
Returns
| Name | Type | Description | 
|---|
 | address | address of the vault factory | 
adminFee
function adminFee() external view returns (uint256)
 
Get an admin fee.
Returns
| Name | Type | Description | 
|---|
 | uint256 | admin fee | 
claimAdminFee
function claimAdminFee(address recipient, address token) external nonpayable
 
Claim an admin fee.
Only the vault owner can call this function.
Parameters
| Name | Type | Description | 
|---|
| recipient | address | account that will receive the fee | 
| token | address | address of the token | 
claimRewards
function claimRewards(address recipient, address token, bytes data) external nonpayable
 
Claim rewards using a given token.
Parameters
| Name | Type | Description | 
|---|
| recipient | address | address of the tokens’ recipient | 
| token | address | address of the token | 
| data | bytes | some data to use | 
claimable
function claimable(address token, address account, bytes data) external view returns (uint256 amount)
 
Get an amount of rewards claimable by a particular account of a given token.
Parameters
| Name | Type | Description | 
|---|
| token | address | address of the token | 
| account | address | address of the claimer | 
| data | bytes | some data to use | 
Returns
| Name | Type | Description | 
|---|
| amount | uint256 | of claimable tokens | 
claimableAdminFee
function claimableAdminFee(address token) external view returns (uint256 amount)
 
Get a claimable admin fee amount for a particular token.
Parameters
| Name | Type | Description | 
|---|
| token | address | address of the token | 
Returns
| Name | Type | Description | 
|---|
| amount | uint256 | claimable admin fee | 
distributeRewards
function distributeRewards(address network, address token, uint256 amount, bytes data) external nonpayable
 
Distribute rewards on behalf of a particular network using a given token.
Parameters
| Name | Type | Description | 
|---|
| network | address | network on behalf of which the reward to distribute | 
| token | address | address of the token | 
| amount | uint256 | amount of tokens | 
| data | bytes | some data to use | 
getRoleAdmin
function getRoleAdmin(bytes32 role) external view returns (bytes32)
 
Returns the admin role that controls role. See grantRole and revokeRole. To change a role’s admin, use \_setRoleAdmin.
Parameters
| Name | Type | Description | 
|---|
| role | bytes32 |  | 
Returns
| Name | Type | Description | 
|---|
 | bytes32 |  | 
grantRole
function grantRole(bytes32 role, address account) external nonpayable
 
Grants role to account. If account had not been already granted role, emits a RoleGranted event. Requirements: - the caller must have role’s admin role. May emit a RoleGranted event.
Parameters
| Name | Type | Description | 
|---|
| role | bytes32 |  | 
| account | address |  | 
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
 
Returns true if account has been granted role.
Parameters
| Name | Type | Description | 
|---|
| role | bytes32 |  | 
| account | address |  | 
Returns
lastUnclaimedReward
function lastUnclaimedReward(address account, address token, address network) external view returns (uint256 rewardIndex)
 
Get the first index of the unclaimed rewards using a particular token by a given account.
Parameters
| Name | Type | Description | 
|---|
| account | address | address of the account | 
| token | address | address of the token | 
| network | address | address of the network | 
Returns
| Name | Type | Description | 
|---|
| rewardIndex | uint256 | first index of the unclaimed rewards | 
multicall
function multicall(bytes[] data) external nonpayable returns (bytes[] results)
 
Receives and executes a batch of function calls on this contract.
Parameters
| Name | Type | Description | 
|---|
| data | bytes[] |  | 
Returns
| Name | Type | Description | 
|---|
| results | bytes[] |  | 
renounceRole
function renounceRole(bytes32 role, address callerConfirmation) external nonpayable
 
Revokes role from the calling account. Roles are often managed via grantRole and revokeRole: this function’s purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a RoleRevoked event. Requirements: - the caller must be callerConfirmation. May emit a RoleRevoked event.
Parameters
| Name | Type | Description | 
|---|
| role | bytes32 |  | 
| callerConfirmation | address |  | 
revokeRole
function revokeRole(bytes32 role, address account) external nonpayable
 
Revokes role from account. If account had been granted role, emits a RoleRevoked event. Requirements: - the caller must have role’s admin role. May emit a RoleRevoked event.
Parameters
| Name | Type | Description | 
|---|
| role | bytes32 |  | 
| account | address |  | 
rewards
function rewards(address token, address network, uint256) external view returns (uint256 amount, uint48 timestamp)
 
Get a particular reward distribution.
Parameters
| Name | Type | Description | 
|---|
| token | address | address of the token | 
| network | address | address of the network | 
| rewardIndex | uint256 | index of the reward distribution using the token | 
Returns
| Name | Type | Description | 
|---|
| amount | uint256 | amount of tokens to be distributed | 
| timestamp | uint48 | time point stakes must taken into account at | 
rewardsLength
function rewardsLength(address token, address network) external view returns (uint256)
 
Get a total number of rewards using a particular token for a given network.
Parameters
| Name | Type | Description | 
|---|
| token | address | address of the token | 
| network | address | address of the network | 
Returns
| Name | Type | Description | 
|---|
 | uint256 | total number of the rewards using the token by the network | 
setAdminFee
function setAdminFee(uint256 adminFee) external nonpayable
 
Set an admin fee.
Only the ADMIN_FEE_SET_ROLE holder can call this function.
Parameters
| Name | Type | Description | 
|---|
| adminFee | uint256 | admin fee (up to ADMIN_FEE_BASE inclusively) | 
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
 
See IERC165-supportsInterface.
Parameters
| Name | Type | Description | 
|---|
| interfaceId | bytes4 |  | 
Returns
version
function version() external view returns (uint64)
 
Get a version of the staker rewards contract (different versions mean different interfaces).
Must return 1 for this one.
Returns
| Name | Type | Description | 
|---|
 | uint64 | version of the staker rewards contract | 
Events
ClaimAdminFee
event ClaimAdminFee(address indexed recipient, uint256 amount)
 
Emitted when an admin fee is claimed.
Parameters
| Name | Type | Description | 
|---|
recipient indexed | address | account that received the fee | 
| amount | uint256 | amount of the fee claimed | 
ClaimRewards
event ClaimRewards(address indexed token, address indexed network, address indexed claimer, address recipient, uint256 firstRewardIndex, uint256 numRewards, uint256 amount)
 
Emitted when rewards are claimed.
Parameters
| Name | Type | Description | 
|---|
token indexed | address | address of the token claimed | 
network indexed | address | address of the network | 
claimer indexed | address | account that claimed the reward | 
| recipient | address | account that received the reward | 
| firstRewardIndex | uint256 | first index of the claimed rewards | 
| numRewards | uint256 | number of rewards claimed | 
| amount | uint256 | amount of tokens claimed | 
DistributeRewards
event DistributeRewards(address indexed network, address indexed token, uint256 amount, bytes data)
 
Emitted when a reward is distributed.
Parameters
| Name | Type | Description | 
|---|
network indexed | address | network on behalf of which the reward is distributed | 
token indexed | address | address of the token | 
| amount | uint256 | amount of tokens | 
| data | bytes | some used data | 
Initialized
event Initialized(uint64 version)
 
Triggered when the contract has been initialized or reinitialized.
Parameters
| Name | Type | Description | 
|---|
| version | uint64 |  | 
RoleAdminChanged
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
 
Emitted when newAdminRole is set as role’s admin role, replacing previousAdminRole DEFAULT_ADMIN_ROLE is the starting admin for all roles, despite RoleAdminChanged not being emitted signaling this.
Parameters
| Name | Type | Description | 
|---|
role indexed | bytes32 |  | 
previousAdminRole indexed | bytes32 |  | 
newAdminRole indexed | bytes32 |  | 
RoleGranted
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
 
Emitted when account is granted role. sender is the account that originated the contract call, an admin role bearer except when using AccessControl-\_setupRole.
Parameters
| Name | Type | Description | 
|---|
role indexed | bytes32 |  | 
account indexed | address |  | 
sender indexed | address |  | 
RoleRevoked
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
 
Emitted when account is revoked role. sender is the account that originated the contract call: - if using revokeRole, it is the admin role bearer - if using renounceRole, it is the role bearer (i.e. account)
Parameters
| Name | Type | Description | 
|---|
role indexed | bytes32 |  | 
account indexed | address |  | 
sender indexed | address |  | 
SetAdminFee
event SetAdminFee(uint256 adminFee)
 
Emitted when an admin fee is set.
Parameters
| Name | Type | Description | 
|---|
| adminFee | uint256 | admin fee | 
Structs
InitParams
struct InitParams {
    address vault;
    uint256 adminFee;
    address defaultAdminRoleHolder;
    address adminFeeClaimRoleHolder;
    address adminFeeSetRoleHolder;
}
 
Initial parameters needed for a vault with a delegator and a slasher deployment.
Parameters
| Name | Type | Description | 
|---|
| vault | address | address of the vault to get stakers’ data from | 
| adminFee | uint256 | admin fee (up to ADMIN_FEE_BASE inclusively) | 
| defaultAdminRoleHolder | address | address of the initial DEFAULT_ADMIN_ROLE holder | 
| adminFeeClaimRoleHolder | address | address of the initial ADMIN_FEE_CLAIM_ROLE holder | 
| adminFeeSetRoleHolder | address | address of the initial ADMIN_FEE_SET_ROLE holder | 
RewardDistribution
struct RewardDistribution {
    uint256 amount;
    uint48 timestamp;
}
 
Structure for a reward distribution.
Parameters
| Name | Type | Description | 
|---|
| amount | uint256 | amount of tokens to be distributed (admin fee is excluded) | 
| timestamp | uint48 | time point stakes must taken into account at |