Create a Vault
Last updated
Last updated
Vaults are created through the EthVaultFactory
contracts. The factory deploys and initializes the ERC-1967
proxy and registers the vault to the VaultsRegistry
so that other contracts can verify the validity of the Vault by checking whether it's in the registry.
You can find the addresses of the factories for all the vault types here.
The vault can be deployed by calling the createVault
function of the EthVaultFactory
contract:
Name | Type | Description |
---|---|---|
params | bytes | The encoded parameters for initializing the Vault contract |
isOwnMevEscrow | bool | Whether to deploy own escrow contract or connect to a smoothing pool for priority fees and MEV rewards |
The security deposit of 1 gwei must be transferred with the call. This protects the Vault stakers from the inflation attack described here.
You must encode the params
argument differently based on whether you create vault with the ERC-20 token or without.
To encode the parameters for the vault without an ERC-20 token, you have to provide the following:
capacity
- defines at what TVL in Wei the vault stops accepting new deposits. To make it unlimited, provide the max uint256
value of 2^256 - 1.
feePercent
- defines the percent that you want to charge from the stakes rewards. Must be provided in BPS. For example, if you want to charge 5% from the stakers rewards, you must provide 500. The max value is 10000 (100%).
metadataIpfsHash
- The IPFS hash to the file that contains the name, description, and icon for the vault branding (e.g., bafkreictxn323g4ad3rumxkykqayl5kluozhcet45paen2dnvetdu4ptoe). It's an optional value; you can skip it by specifying an empty string (""
).
You must encode the parameters to the byte string. You can use the following function for that:
In addition to the parameters provided for the vault without an ERC-20 token, you have to provide the following:
name
- the name of the ERC-20 token. It cannot exceed 30 characters. For example, Vitalik Staked ETH.
symbol
- the symbol of the ERC-20 token. It cannot exceed ten characters. For example, vstETH.
You must encode the parameters to the byte string. You can use the following function for that:
Name | Type | Description |
---|---|---|
vault | address | The address of the created Vault |