Skip to main content

VaultEthStaking

Git Source ↗

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

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;

donateAssets​

Donate assets to the Vault. Must transfer ETH together with the call.

function donateAssets() external payable override;

_registerValidators​

Internal function for registering validators

function _registerValidators(ValidatorUtils.ValidatorDeposit[] memory deposits) internal virtual override;

Parameters

NameTypeDescription
depositsValidatorUtils.ValidatorDeposit[]The validators registration data

_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

__VaultEthStaking_init​

Initializes the VaultEthStaking contract

function __VaultEthStaking_init() internal onlyInitializing;