Lesson 13: Error: No Contract deployed with name ILendingPoolAddressesProvider #1224
-
As per Sir @PatrickAlphaC instructions, i delete the file name 👉 Here is my const { getNamedAccounts, ethers } = require("hardhat");
const { getWeth, AMOUNT } = require("./getWeth");
async function main() {
await getWeth();
const { deployer } = await getNamedAccounts();
//abi address
const lendingPool = await getLendingPool(deployer);
console.log("LendingPool Address", lendingPool.address);
}
async function getLendingPool(acc) {
const lendingPoolAddressesProvider = await ethers.getContract(
"ILendingPoolAddressesProvider",
"0xb53c1a33016b2dc2ff3653530bff1848a515c8c5",
acc
);
const lendingPoolAddress =
await lendingPoolAddressesProvider.getLendingPool();
const lendingPool = await ethers.getContract(
"ILendingPool",
lendingPoolAddress,
acc
);
return lendingPool;
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Now when i run the script 👇
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
In getLendingPool, paste the following code (refactor variables as per your liking, but do not change the logic): const lendingPoolAddressesProvider = await ethers.getContractAt(
"ILendingPoolAddressesProvider",
networkConfig[network.config.chainId].lendingPoolAddressesProvider,
account
) const lendingPool = await ethers.getContractAt("ILendingPool", lendingPoolAddress, account) Note: add the equivalent in networkConfig (Context: |
Beta Was this translation helpful? Give feedback.
-
Use the getContractAt function const lendingPoolContract = await ethers.getContractAt(
"ILendingPool",
lendingPoolAddress,
acc
); |
Beta Was this translation helpful? Give feedback.
@shoaibshebi
Use the getContractAt function