In this guide, we will cover an example of how to deposit into the stETHvv Vault.
1) If you are withdrawing ETH
If you want to withdraw ETH, it will be a 2-step process. You will need to first Permit (gasless transaction) the Adapter contract to withdraw on your behalf. Then the Adapter contract will convert stETH to ETH under the hood using Curve.
import BigNumber from'bignumber.js'import { ethers } from'ethers'// Parameters exampleconstpodsAdapterAddress='0x4aad0755efd63f4e9b7fac19bd426db4a0d9b5e8'constpodsStethvvAddress='0x463f9ed5e11764eb9029762011a03643603ad879'constpodsAdapterABI=''// You can find this information on the Contract Addresses pageconstPodsVaultABI=''// Get this in our Contract Addresses sectionconstuserAddress='0x123..'// Instantiate contractsconstPodsAdapter=awaitethers.getContractAt(PodsAdapterAddress, PodsAdapterABI)constPodsVault=awaitethers.getContractAt(podsStethvvAddress, PodsVaultABI)// Check User balanceconstuserSharesBalance=awaitPodsVault.balanceOf(userAddress)// Calculate Slippage toleranceconstslippageTolerance=2/100; // (Eg: 2%)constsharesWithSlippageTolerance= userSharesBalance * (1-slippageTolerance)/////////////// Ethers.jsconstpermit=awaitPodsVault.doPermitFor({ signer,//This is the only parameter that we are omitting in this tutorial. This is the signer Ethers.js object address:PodsVault.address, sender: userAddress, spender: podsAdapterAddress, amount: userSharesBalance,})constargs= [PodsVault.address,shares.toString(), userAddress,sharesWithSlippageTolerance.toString(),permit.deadline,permit.v,permit.r.toString(),permit.s.toString(),]consttransaction=awaitPodsAdapter.redeemWithPermit(...args)
Coming soon...
2) If you are withdrawing stETH directly
Withdrawing stETH is a 1-step process
import BigNumber from'bignumber.js'import { ethers } from'ethers'// Ethers.js// Parameters exampleconstpodsStethvvAddress='0x463f9ed5e11764eb9029762011a03643603ad879'// Change here for stETHvv or ETHphoriaconstPodsVaultABI=''// Get this in our Contract Addresses sectionconstuserAddress='0x123..'// Address that will receive the shares// 1) Check address balanceconstPodsVault=awaitethers.getContractAt(podsStethvvAddress, PodsVaultABI)constuserShareBalance=awaitPodsVault.balanceOf(userAddress)constamount= userShareBalance * (1-0.5) // Withdraw 50% of the shares/** * @param amount Amount to be deposited into the vault * @param receiver Address that will receive the token after the withdraw * @param receiver Address that will be the owner of the Vault's shares * @return uint256 Amount of shares returned by vault ERC4626 contract */awaitPodsVault.redeem( amount, userAddress, userAddress)