0

The ILendingPoolAddressProvider does not contain the getLendingPool function.

async function getLendingPool(account) {
  const lendingPoolAddressProvider = await ethers.getContractAt(
    "ILendingPoolAddressesProvider", // This is the interface
    "0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5",
    account,
  )
  const lendingPoolAddress = await lendingPoolAddressProvider.getLendingPool()
  const lendingPool = await ethers.getContractAt(
    "ILendingPoool",
    lendingPoolAddress,
    account,
  )
  return lendingPool
}
2

1 Answer 1

0

The following things need to be changed (mostly in aaveBorrow.js script):

  • Change ethers import from ethers to hardhat package (as getContractAt is a function of ethers imported from hardhat).
  • Uninstalled the ethers package to avoid version conflicts.
  • Replaced { deployer } to [ deployer ] in the lvalue (or LHS) of await ethers.getSigners().
  • In the borrow and repay function calls of lendingPool, changed the argument value of 1 (i.e., denoting the interestRateMode and rateMode in the borrow and repay functions respectively) to 2. For this, you can refer to the explanation in this post.

Console output of yarn hardhat run scripts/aaveBorrow.js:

output

PS. I've done all these changes and created a PR. You can review it and merge it into your repository.

9
  • What is the reason for this "Replaced { deployer } to [ deployer ] in the lvalue (or LHS) of await ethers.getSigners()." Commented Sep 18 at 21:12
  • And thanks for always helping me Commented Sep 18 at 21:13
  • After runing yarn hardhat run scripts/aaveBorrow.js I got this TypeError: ethers.parseEther is not a function at Object.<anonymous> (C:\Users\HP FOLIO\.vscode\hardhat-defi-fcc\scripts\getWeth.js:3:23) Commented Sep 18 at 21:33
  • You’re welcome, @EddiePumpin. Happy to help! Commented Sep 19 at 5:28
  • The reason for replacing { deployer } with [ deployer ] is await getSigners() returns the array of signer objects. Commented Sep 19 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.