ShareVault

MevEthShareVault.sol Git Source

Structs

ProtocolBalance

Struct to account for the protocol fees and rewards.

struct ProtocolBalance {
    uint128 feesPaid;
    uint128 rewardsPaid;
    uint128 exitsPaid;
    uint128 totalWithdrawn;
}

State Variables

protocolBalance

ProtocolBalance struct to account for the protocol fees and rewards.

ProtocolBalance public protocolBalance;

mevEth

The address of the MevEth contract.

address public mevEth;

protocolFeeTo

The address that protocol fees are sent to.

address public protocolFeeTo;

Functions

constructor

Construction sets authority, MevEth, and averageFeeRewardsPerBlock.

constructor(address authority, address _mevEth, address _protocolFeeTo) Auth(authority);

Parameters

NameTypeDescription
authorityaddressThe address of the controlling admin authority.
_mevEthaddressThe address of the WETH contract to use for deposits.
_protocolFeeToaddressThe address that protocol fees are sent to.

payRewards

Function to pay rewards to the MevEth contract

Only callable by an operator.

function payRewards(uint256 rewards) external onlyOperator;

Parameters

NameTypeDescription
rewardsuint256rewards to pay to the MevEth contract

sendFees

Function to collect the fees owed to the prorotocol.

function sendFees(uint256 fees) external onlyAdmin;

setProtocolFeeTo

function setProtocolFeeTo(address newProtocolFeeTo) external onlyAdmin;

recoverToken

Function to recover tokens sent to the contract.

This function is only callable by an admin.

function recoverToken(address token, address recipient, uint256 amount) external onlyAdmin;

setNewMevEth

Function to set a new mevEth address.

function setNewMevEth(address newMevEth) external onlyAdmin;

payValidatorWithdraw

Function to pay MevEth when withdrawing funds from a validator

This function is only callable by an admin and emits an event for offchain validator registry tracking.

function payValidatorWithdraw() external onlyOperator;

receive

Function to receive ETH.

receive() external payable;

Events

RewardsCollected

Event emitted when the protocol balance is updated during logRewards

event RewardsCollected(uint256 indexed protocolFeesOwed, uint256 indexed rewardsOwed);

TokenRecovered

Event emitted when a tokens are recovered from the contract.

event TokenRecovered(address indexed recipient, address indexed token, uint256 indexed amount);

ProtocolFeeToUpdated

Event emitted when the protocolFeeTo address is updated.

event ProtocolFeeToUpdated(address indexed newProtocolFeeTo);

FeesSent

Event emitted when the protocol fees are sent to the protocolFeeTo address.

event FeesSent(uint256 indexed feesSent);

RewardsPaid

Event emitted when rewards are paid to the MevEth contract.

event RewardsPaid(uint256 indexed rewards);

MevEthUpdated

Event emitted when the mevEth address is updated.

event MevEthUpdated(address indexed meveth);

ValidatorWithdraw

Event emitted when funds representing a validator withdrawal are sent to the MevEth contract.

event ValidatorWithdraw(address sender, uint256 amount);