RewardRecipient.sol
General Overview
The RewardRecipient.sol
contract is a key component in the protocol. It handles the harvesting of rewards earned by validators, and oversees their dissolution and penalization (slashing) as required. Additionally, it is responsible for setting and updating addresses of critical protocol contracts.
Technical Overview
Inherits: AccessControlDefaultAdminRules
Author: redactedcartel.finance
State Variables
KEEPER_ROLE
bytes32 public constant KEEPER_ROLE = keccak256("KEEPER_ROLE");
GOVERNANCE_ROLE
bytes32 public constant GOVERNANCE_ROLE = keccak256("GOVERNANCE_ROLE");
pirexEth
IPirexEth public pirexEth;
oracleAdapter
IOracleAdapter public oracleAdapter;
Functions
onlyOracleAdapter
modifier onlyOracleAdapter();
constructor
constructor(address _admin, uint48 _initialDelay) AccessControlDefaultAdminRules(_initialDelay, _admin);
Parameters
Name | Type | Description |
---|---|---|
_admin | address | Admin address |
_initialDelay | uint48 | Delay required to schedule the acceptance of a access control transfer started |
setContract
Set a contract address
function setContract(DataTypes.Contract c, address contractAddress) external onlyRole(GOVERNANCE_ROLE);
Parameters
Name | Type | Description |
---|---|---|
c | DataTypes.Contract | Contract |
contractAddress | address | Contract address |
dissolveValidator
Dissolve validator
function dissolveValidator(bytes calldata _pubKey, uint256 _amount) external onlyOracleAdapter;
Parameters
Name | Type | Description |
---|---|---|
_pubKey | bytes | Public key |
_amount | uint256 | ETH amount |
slashValidator
Slash validator
function slashValidator(
bytes calldata _pubKey,
uint256 _removeIndex,
uint256 _amount,
bool _unordered,
bool _useBuffer,
DataTypes.BurnerAccount[] calldata _burnerAccounts
) external payable onlyRole(KEEPER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_pubKey | bytes | Public key |
_removeIndex | uint256 | Validator public key index |
_amount | uint256 | ETH amount released from Beacon chain |
_unordered | bool | Removed in gas efficient way or not |
_useBuffer | bool | Whether to use buffer to compensate the penalty |
_burnerAccounts | DataTypes.BurnerAccount[] | Burner accounts |
harvest
Harvest and mint staking rewards
function harvest(uint256 _amount, uint256 _endBlock) external onlyRole(KEEPER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
_amount | uint256 | Amount of ETH to be harvested |
_endBlock | uint256 | Block until which ETH rewards are computed |
receive
Receive MEV rewards
receive() external payable;
Events
SetContract
event SetContract(DataTypes.Contract indexed c, address contractAddress);