How to withdraw
1) If you are withdrawing ETH
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
Last updated