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

NameTypeDescription
_adminaddressAdmin address
_initialDelayuint48Delay 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

NameTypeDescription
cDataTypes.ContractContract
contractAddressaddressContract address

dissolveValidator

Dissolve validator

function dissolveValidator(bytes calldata _pubKey, uint256 _amount) external onlyOracleAdapter;

Parameters

NameTypeDescription
_pubKeybytesPublic key
_amountuint256ETH 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

NameTypeDescription
_pubKeybytesPublic key
_removeIndexuint256Validator public key index
_amountuint256ETH amount released from Beacon chain
_unorderedboolRemoved in gas efficient way or not
_useBufferboolWhether to use buffer to compensate the penalty
_burnerAccountsDataTypes.BurnerAccount[]Burner accounts

harvest

Harvest and mint staking rewards

function harvest(uint256 _amount, uint256 _endBlock) external onlyRole(KEEPER_ROLE);

Parameters

NameTypeDescription
_amountuint256Amount of ETH to be harvested
_endBlockuint256Block until which ETH rewards are computed

receive

Receive MEV rewards

receive() external payable;

Events

SetContract

event SetContract(DataTypes.Contract indexed c, address contractAddress);