Deposit
Handling deposits
In order to deposit to the Yelay V3 vault using vault's asset currency, do the following:
Where:
vaultAddress is one of the vaults set up by Yelay. You can fetch addresses of the vaults by using sdk.vaults.getVaults() method. See 'Supportive methods' chapter.
poolId is one of the pools set up by the Client in the vault
Once deposit is done, the corresponding amount of NFT ERC-1155 shares is minted in user's wallet.
F.e. for this deposit of 1 USDC to the Yelay V3 test vault with Pool ID = 1, corresponding amount of 1,000,000 ERC-1155 has been minted:
If deposit is 2 USDC, 2,000,000 NFTs will be minted, etc.
Depositing with any asset
Any ERC-20 token
In order to deposit any ERC-20 token and swap it on the way, use sdk.vaults.swapAndDeposit method:
Where:
vault - the address of the vault
pool - one the pools set up by the Client in the vault
amount - the deposit amount
swapCallData - swap args from 1Inch
swapTarget - should be asset of the vault
tokenToSwap - deposit token that needs to be swapped
The method a promise that resolves to the result of the deposit transaction.
(!) Note that using this method requires getting 1inch API key and getting swapData from it. This means that using this method will incur swap costs for the users.
Wrap ETH when depositing to WETH vault
Use depositEth method in order to deposit specified amount of ETH into the WETH vault (i.e. naturally wrap ETH into WETH instead of swapping in order to avoid swap fees) :
The method uses the VaultWrapper contract underneath in order to handle ETH wrapping and depositing in a single transaction.
Where:
vault - address of Yelay V3 WETH vault on the given chain
poolId - id of the pool where user deposits
amount - amount of ETH to deposit
Method returns {Promise} - a promise that resolves to the result of the deposit transaction.
Last updated