aave / protocol-v2

Aave Protocol V2
https://aave.com
Other
668 stars 754 forks source link

I found error "lpContract.methods.withdraw is not a function" when i use Lending Pool withdraw function #252

Open queqoomts opened 2 years ago

queqoomts commented 2 years ago

`lpContract.methods.withdraw is not a function

// Withdraw async function withdraw() { const daiAmountinWei = web3.utils.toWei("2", "ether").toString() const daiAddress = "0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD" // kovan testnet DAI

try {
  // Make the borrow transaction via LendingPool contract
  const lpAddress = await getLendingPoolAddress()
  const lpContract = new web3.eth.Contract(LendingPoolABI, lpAddress)
  await lpContract.methods
    .withdraw(daiAddress, daiAmountinWei, myAddress)
    .send({ from: myAddress })
    .catch((e) => {
      throw Error(`Error borrowing from the LendingPool contract: ${e.message}`)
    })

} catch (e) {
  alert(e.message)
  console.log(e.message)
}

}`