Skip to main content

VaultEthStaking

Git Source

Inherits: Initializable, VaultState, VaultValidators, VaultEnterExit, VaultMev, IVaultEthStaking

Author: StakeWise

Defines the Ethereum staking functionality for the Vault

State Variables

_securityDeposit

uint256 private constant _securityDeposit = 1e9;

__gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps

uint256[50] private __gap;

Functions

deposit

Deposit ETH to the Vault

function deposit(address receiver, address referrer) public payable virtual override returns (uint256 shares);

Parameters

NameTypeDescription
receiveraddressThe address that will receive Vault's shares
referreraddressThe address of the referrer. Set to zero address if not used.

Returns

NameTypeDescription
sharesuint256The number of shares minted

updateStateAndDeposit

Updates Vault state and deposits ETH to the Vault

function updateStateAndDeposit(address receiver, address referrer, IKeeperRewards.HarvestParams calldata harvestParams)
public
payable
virtual
override
returns (uint256 shares);

Parameters

NameTypeDescription
receiveraddressThe address that will receive Vault's shares
referreraddressThe address of the referrer. Set to zero address if not used.
harvestParamsIKeeperRewards.HarvestParamsThe parameters for harvesting Keeper rewards

Returns

NameTypeDescription
sharesuint256The number of shares minted

receive

Function for depositing using fallback function

receive() external payable virtual;

receiveFromMevEscrow

Used by MEV escrow to transfer ETH.

function receiveFromMevEscrow() external payable override;

_registerValidator

Internal function for registering validator

function _registerValidator(bytes calldata validator, bool isTopUp, bool isV1Validator)
internal
virtual
override
returns (uint256 depositAmount);

Parameters

NameTypeDescription
validatorbytesThe validator registration data
isTopUpboolWhether the registration is a balance top-up
isV1ValidatorboolWhether the validator is V1 or V2

Returns

NameTypeDescription
depositAmountuint256The amount of assets that was deposited

_vaultAssets

Internal function for retrieving the total assets stored in the Vault. NB! Assets can be forcibly sent to the vault, the returned value must be used with caution

function _vaultAssets() internal view virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256The total amount of assets stored in the Vault

_transferVaultAssets

Internal function for transferring assets from the Vault to the receiver

function _transferVaultAssets(address receiver, uint256 assets) internal virtual override nonReentrant;

Parameters

NameTypeDescription
receiveraddressThe address that will receive the assets
assetsuint256The number of assets to transfer

_validatorMinEffectiveBalance

Internal function for fetching validator minimum effective balance

function _validatorMinEffectiveBalance() internal pure virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256The minimum effective balance for the validator

_validatorMaxEffectiveBalance

Internal function for fetching validator maximum effective balance

function _validatorMaxEffectiveBalance() internal pure virtual override returns (uint256);

Returns

NameTypeDescription
<none>uint256The maximum effective balance for the validator

__VaultEthStaking_init

Initializes the VaultEthStaking contract

function __VaultEthStaking_init() internal onlyInitializing;