Skip to main content

EthGenesisVault

Git Source ↗

Inherits: Initializable ↗, EthVault, IEthGenesisVault

Defines the Genesis Vault for Ethereum staking migrated from StakeWise Legacy

State Variables​

_version​

uint8 private constant _version = 5

_poolEscrow​

Note: oz-upgrades-unsafe-allow: state-variable-immutable

IEthPoolEscrow private immutable _poolEscrow

_rewardEthToken​

Note: oz-upgrades-unsafe-allow: state-variable-immutable

IRewardEthToken private immutable _rewardEthToken

__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​

constructor​

Constructor

Since the immutable variable value is stored in the bytecode, its value would be shared among all proxies pointing to a given contract instead of each proxy’s storage.

Note: oz-upgrades-unsafe-allow: constructor

constructor(EthVaultConstructorArgs memory args, address poolEscrow, address rewardEthToken) EthVault(args);

Parameters

NameTypeDescription
argsEthVaultConstructorArgsThe arguments for initializing the EthVault contract
poolEscrowaddressThe address of the pool escrow contract
rewardEthTokenaddressThe address of the reward ETH token contract

initialize​

Initializes or upgrades the EthVault contract. Must transfer security deposit during the deployment.

function initialize(bytes calldata) external payable virtual override(IEthVault, EthVault) reinitializer(_version);

Parameters

NameTypeDescription
<none>bytes

vaultId​

Vault Unique Identifier

function vaultId() public pure virtual override(IVaultVersion, EthVault) returns (bytes32);

Returns

NameTypeDescription
<none>bytes32The unique identifier of the Vault

version​

Version

function version() public pure virtual override(IVaultVersion, EthVault) returns (uint8);

Returns

NameTypeDescription
<none>uint8The version of the Vault implementation contract

migrate​

Function for migrating from StakeWise Legacy. Can be called only by RewardEthToken contract.

function migrate(address receiver, uint256 assets) external override returns (uint256 shares);

Parameters

NameTypeDescription
receiveraddressThe address of the receiver
assetsuint256The amount of assets migrated

Returns

NameTypeDescription
sharesuint256The amount of shares minted

receive​

Function for depositing using fallback function

receive() external payable virtual override;

_calcMaxMintOsTokenShares​

Internal function for calculating the maximum amount of osToken shares that can be minted based on the current user balance

function _calcMaxMintOsTokenShares(address user) private view returns (uint256);

Parameters

NameTypeDescription
useraddressThe address of the user

Returns

NameTypeDescription
<none>uint256The maximum amount of osToken shares that can be minted

_transferVaultAssets​

Internal function for transferring assets from the Vault to the receiver

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

Parameters

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

_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(VaultState, VaultEthStaking) returns (uint256);

Returns

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

_registerValidators​

Internal function for registering validators

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

Parameters

NameTypeDescription
depositsValidatorUtils.ValidatorDeposit[]The validators registration data

_pullWithdrawals​

Pulls assets from pool escrow

function _pullWithdrawals() private;