How to withdraw

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 example
const podsAdapterAddress = '0x4aad0755efd63f4e9b7fac19bd426db4a0d9b5e8'
const podsStethvvAddress = '0x463f9ed5e11764eb9029762011a03643603ad879'
const podsAdapterABI = '' // You can find this information on the Contract Addresses page
const PodsVaultABI = '' // Get this in our Contract Addresses section
const userAddress = '0x123..'

// Instantiate contracts
const PodsAdapter = await ethers.getContractAt(PodsAdapterAddress, PodsAdapterABI)
const PodsVault = await ethers.getContractAt(podsStethvvAddress, PodsVaultABI)

// Check User balance
const userSharesBalance = await PodsVault.balanceOf(userAddress)

// Calculate Slippage tolerance
const slippageTolerance = 2/100; // (Eg: 2%)
const sharesWithSlippageTolerance = userSharesBalance * (1-slippageTolerance)

/////////////
// Ethers.js

const permit = await PodsVault.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,
})

const args = [
  PodsVault.address,
  shares.toString(),
  userAddress,
  sharesWithSlippageTolerance.toString(),
  permit.deadline,
  permit.v,
  permit.r.toString(),
  permit.s.toString(),
]

const transaction = await PodsAdapter.redeemWithPermit(...args)

2) If you are withdrawing stETH directly

Withdrawing stETH is a 1-step process

Last updated