Skip to main content

DefaultStakerRewards

Git Source

Methods

ADMIN_FEE_BASE

function ADMIN_FEE_BASE() external view returns (uint256)

Get the maximum admin fee (= 100%).

Returns

NameTypeDescription
uint256maximum admin fee

ADMIN_FEE_CLAIM_ROLE

function ADMIN_FEE_CLAIM_ROLE() external view returns (bytes32)

Get the admin fee claimer's role.

Returns

NameTypeDescription
bytes32identifier 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

NameTypeDescription
bytes32identifier of the admin fee setter role

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
bytes32

NETWORK_MIDDLEWARE_SERVICE

function NETWORK_MIDDLEWARE_SERVICE() external view returns (address)

Get the network middleware service's address.

Returns

NameTypeDescription
addressaddress of the network middleware service

VAULT

function VAULT() external view returns (address)

Get the vault's address.

Returns

NameTypeDescription
addressaddress of the vault

VAULT_FACTORY

function VAULT_FACTORY() external view returns (address)

Get the vault factory's address.

Returns

NameTypeDescription
addressaddress of the vault factory

adminFee

function adminFee() external view returns (uint256)

Get an admin fee.

Returns

NameTypeDescription
uint256admin fee

claimAdminFee

function claimAdminFee(address recipient, address token) external nonpayable

Claim an admin fee.

Only the vault owner can call this function.

Parameters

NameTypeDescription
recipientaddressaccount that will receive the fee
tokenaddressaddress of the token

claimRewards

function claimRewards(address recipient, address token, bytes data) external nonpayable

Claim rewards using a given token.

Parameters

NameTypeDescription
recipientaddressaddress of the tokens' recipient
tokenaddressaddress of the token
databytessome 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

NameTypeDescription
tokenaddressaddress of the token
accountaddressaddress of the claimer
databytessome data to use

Returns

NameTypeDescription
amountuint256of claimable tokens

claimableAdminFee

function claimableAdminFee(address token) external view returns (uint256 amount)

Get a claimable admin fee amount for a particular token.

Parameters

NameTypeDescription
tokenaddressaddress of the token

Returns

NameTypeDescription
amountuint256claimable 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

NameTypeDescription
networkaddressnetwork on behalf of which the reward to distribute
tokenaddressaddress of the token
amountuint256amount of tokens
databytessome 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

NameTypeDescription
rolebytes32

Returns

NameTypeDescription
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

NameTypeDescription
rolebytes32
accountaddress

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription
rolebytes32
accountaddress

Returns

NameTypeDescription
bool

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

NameTypeDescription
accountaddressaddress of the account
tokenaddressaddress of the token
networkaddressaddress of the network

Returns

NameTypeDescription
rewardIndexuint256first 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

NameTypeDescription
databytes[]

Returns

NameTypeDescription
resultsbytes[]

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

NameTypeDescription
rolebytes32
callerConfirmationaddress

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

NameTypeDescription
rolebytes32
accountaddress

rewards

function rewards(address token, address network, uint256) external view returns (uint256 amount, uint48 timestamp)

Get a particular reward distribution.

Parameters

NameTypeDescription
tokenaddressaddress of the token
networkaddressaddress of the network
rewardIndexuint256index of the reward distribution using the token

Returns

NameTypeDescription
amountuint256amount of tokens to be distributed
timestampuint48time 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

NameTypeDescription
tokenaddressaddress of the token
networkaddressaddress of the network

Returns

NameTypeDescription
uint256total 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

NameTypeDescription
adminFeeuint256admin fee (up to ADMIN_FEE_BASE inclusively)

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See IERC165-supportsInterface.

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
bool

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

NameTypeDescription
uint64version of the staker rewards contract

Events

ClaimAdminFee

event ClaimAdminFee(address indexed recipient, uint256 amount)

Emitted when an admin fee is claimed.

Parameters

NameTypeDescription
recipient indexedaddressaccount that received the fee
amountuint256amount 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

NameTypeDescription
token indexedaddressaddress of the token claimed
network indexedaddressaddress of the network
claimer indexedaddressaccount that claimed the reward
recipientaddressaccount that received the reward
firstRewardIndexuint256first index of the claimed rewards
numRewardsuint256number of rewards claimed
amountuint256amount of tokens claimed

DistributeRewards

event DistributeRewards(address indexed network, address indexed token, uint256 amount, bytes data)

Emitted when a reward is distributed.

Parameters

NameTypeDescription
network indexedaddressnetwork on behalf of which the reward is distributed
token indexedaddressaddress of the token
amountuint256amount of tokens
databytessome used data

Initialized

event Initialized(uint64 version)

Triggered when the contract has been initialized or reinitialized.

Parameters

NameTypeDescription
versionuint64

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

NameTypeDescription
role indexedbytes32
previousAdminRole indexedbytes32
newAdminRole indexedbytes32

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

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress

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

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress

SetAdminFee

event SetAdminFee(uint256 adminFee)

Emitted when an admin fee is set.

Parameters

NameTypeDescription
adminFeeuint256admin 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

NameTypeDescription
vaultaddressaddress of the vault to get stakers' data from
adminFeeuint256admin fee (up to ADMIN_FEE_BASE inclusively)
defaultAdminRoleHolderaddressaddress of the initial DEFAULT_ADMIN_ROLE holder
adminFeeClaimRoleHolderaddressaddress of the initial ADMIN_FEE_CLAIM_ROLE holder
adminFeeSetRoleHolderaddressaddress of the initial ADMIN_FEE_SET_ROLE holder

RewardDistribution

struct RewardDistribution {
uint256 amount;
uint48 timestamp;
}

Structure for a reward distribution.

Parameters

NameTypeDescription
amountuint256amount of tokens to be distributed (admin fee is excluded)
timestampuint48time point stakes must taken into account at