Lesson7: getContract is not working #1070
Answered
by
zeroxvee
maikelordaz
asked this question in
Q&A
-
When I run
I get the next error
This are my files Test: const { deployments, ethers, getNamedAccounts } = require("hardhat")
const { assert, expect } = require("chai")
describe("FundMe", async function () {
let fundMe
let deployer
let mockV3Aggregator
beforeEach(async () => {
deployer = (await getNamedAccounts()).deployer
await deployments.fixture(["all"])
fundMe = await ethers.getContract(
"FundMe" /*nombre del contrato*/,
deployer
)
mockV3Aggregator = await ethers.getContract(
"MockV3Aggregator",
deployer
)
})
describe("constructor", async function () {
it("sets the aggregator addresses correctly", async () => {
const response = await fundMe.getPriceFeed()
assert.equal(response, mockV3Aggregator.address)
})
}) package.json
Hardhat config require("@nomicfoundation/hardhat-toolbox")
require("@nomicfoundation/hardhat-chai-matchers")
require("@nomiclabs/hardhat-ethers")
require("hardhat-gas-reporter")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
require("hardhat-deploy")
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const PRIVATE_KEY = process.env.PRIVATE_KEY
const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
// gasPrice: 130000000000,
},
rinkeby: {
url: RINKEBY_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
blockConfirmations: 6,
},
},
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: true,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
//coinmarketcap: COINMARKETCAP_API_KEY,
},
namedAccounts: {
deployer: {
default: 0,
},
user: {
default: 1,
},
},
} |
Beta Was this translation helpful? Give feedback.
Answered by
zeroxvee
Jul 19, 2022
Replies: 2 comments 5 replies
-
Add this in hardhat.config.js and let me know if it solves the problem: mocha: {
timeout: 500000, // 500 seconds max for running tests
}, |
Beta Was this translation helpful? Give feedback.
2 replies
-
Please attach your deploy scripts and FundMe contract |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
maikelordaz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please attach your deploy scripts and FundMe contract