Skip to main content

EthErc20Vault

Git Source ↗

Inherits: VaultImmutables →, Initializable ↗, VaultAdmin →, VaultVersion →, VaultFee →, VaultState →, VaultValidators →, VaultEnterExit →, VaultOsToken →, VaultMev →, VaultToken →, VaultEthStaking →, Multicall →, IEthErc20Vault

Defines the Ethereum staking Vault with ERC20 ↗ token.

Structs

EthErc20VaultConstructorArgs

Struct for deploying the EthErc20Vault contract

struct EthErc20VaultConstructorArgs {
address keeper;
address vaultsRegistry;
address validatorsRegistry;
address validatorsWithdrawals;
address validatorsConsolidations;
address consolidationsChecker;
address osTokenVaultController;
address osTokenConfig;
address osTokenVaultEscrow;
address sharedMevEscrow;
address depositDataRegistry;
uint64 exitingAssetsClaimDelay;
}

Properties

NameTypeDescription
keeperaddressThe address of the Keeper contract
vaultsRegistryaddressThe address of the VaultsRegistry contract
validatorsRegistryaddressThe contract address used for registering validators in beacon chain
validatorsWithdrawalsaddressThe contract address used for withdrawing validators in beacon chain
validatorsConsolidationsaddressThe contract address used for consolidating validators in beacon chain
consolidationsCheckeraddressThe contract address used for checking consolidations
osTokenVaultControlleraddressThe address of the OsTokenVaultController contract
osTokenConfigaddressThe address of the OsTokenConfig contract
osTokenVaultEscrowaddressThe address of the OsTokenVaultEscrow contract
sharedMevEscrowaddressThe address of the shared MEV escrow
depositDataRegistryaddressThe address of the DepositDataRegistry contract
exitingAssetsClaimDelayuint64The delay after which the assets can be claimed after exiting from staking

EthErc20VaultInitParams

Struct for initializing the EthErc20Vault contract

struct EthErc20VaultInitParams {
uint256 capacity;
uint16 feePercent;
string name;
string symbol;
string metadataIpfsHash;
}

Properties

NameTypeDescription
capacityuint256The Vault stops accepting deposits after exceeding the capacity
feePercentuint16The fee percent that is charged by the Vault
namestringThe name of the ERC20 token
symbolstringThe symbol of the ERC20 token
metadataIpfsHashstringThe IPFS hash of the Vault's metadata file

Functions

depositAndMintOsToken

Deposits assets to the vault and mints OsToken shares to the receiver

function depositAndMintOsToken(address receiver, uint256 osTokenShares, address referrer)
public
payable
override
returns (uint256);

Parameters

NameTypeDescription
receiveraddressThe address to receive the OsToken
osTokenSharesuint256The amount of OsToken shares to mint. If set to type(uint256).max, max OsToken shares will be minted.
referreraddressThe address of the referrer

Returns

NameTypeDescription
<none>uint256The amount of OsToken assets minted

updateStateAndDepositAndMintOsToken

Updates the state, deposits assets to the vault and mints OsToken shares to the receiver

function updateStateAndDepositAndMintOsToken(
address receiver,
uint256 osTokenShares,
address referrer,
IKeeperRewards.HarvestParams calldata harvestParams
) external payable override returns (uint256);

Parameters

NameTypeDescription
receiveraddressThe address to receive the OsToken
osTokenSharesuint256The amount of OsToken shares to mint. If set to type(uint256).max, max OsToken shares will be minted.
referreraddressThe address of the referrer
harvestParamsIKeeperRewards.HarvestParamsThe parameters for the harvest

Returns

NameTypeDescription
<none>uint256The amount of OsToken assets minted

transfer

Moves amount tokens from the caller's account to to.

function transfer(address to, uint256 amount) public virtual override(IERC20, ERC20Upgradeable) returns (bool);

transferFrom

Moves amount tokens from from to to using the allowance mechanism. amount is then deducted from the caller's allowance.

function transferFrom(address from, address to, uint256 amount)
public
virtual
override(IERC20, ERC20Upgradeable)
returns (bool);

enterExitQueue

Locks shares to the exit queue. The shares continue earning rewards until they will be burned by the Vault.

function enterExitQueue(uint256 shares, address receiver)
public
virtual
override(IVaultEnterExit, VaultEnterExit, VaultOsToken)
returns (uint256 positionTicket);

Parameters

NameTypeDescription
sharesuint256The number of shares to lock
receiveraddressThe address that will receive assets upon withdrawal

Returns

NameTypeDescription
positionTicketuint256The position ticket of the exit queue. Returns uint256 max if no ticket created.

vaultId

Vault Unique Identifier

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

Returns

NameTypeDescription
<none>bytes32The unique identifier of the Vault

version

Version

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

Returns

NameTypeDescription
<none>uint8The version of the Vault implementation contract