Lesson7 Mocking: Cannot read properties of undefined (reading 'length'): Tried answers from past discussions. #665
-
Getting the same error
here's my files 00-deploy-mock.js const { network } = require("hardhat");
const {
devlopmentChains,
DECIMALS,
INITIAL_ANSWER,
} = require("../helper-hardhat-config");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments; // deploy and log are some functions
const { deployer } = await getNamedAccounts();
if (devlopmentChains.includes(network.name)) {
log("Local network detected! Deploying Mocks...");
await deploy(
("MockV3Aggregator",
{
contract: "MockV3Aggregator",
from: deployer,
log: true,
args: [DECIMALS, INITIAL_ANSWER],
})
);
log("Mocks deployed");
log("____________________");
}
};
module.exports.tags = ["all", "mocks"]; hardhat.config.js module.exports = {
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
defaultNetwork: "hardhat",
networks: {
ropsten: {
url: process.env.ROPSTEN_URL || "",
accounts: [],
},
},
gasReporter: {
enabled: process.env.REPORT_GAS !== undefined,
currency: "USD",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
user: {
default: 1,
},
},
}; fundme.sol AggregatorV3Interface public priceFeed;
constructor(address priceFeedAddress) {
i_owner = msg.sender;
priceFeed = AggregatorV3Interface(priceFeedAddress);
}
function fund() public payable {
require(msg.value.getConversionRate(priceFeed) >= MINIMUM_USD, "You need to spend more ETH!");
// require(PriceConverter.getConversionRate(msg.value) >= MINIMUM_USD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
} Please help me find the error. |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jun 30, 2022
Replies: 2 comments 12 replies
-
Is this the right syntax?
Or should it be
|
Beta Was this translation helpful? Give feedback.
1 reply
-
@Rishi860 should show you helper config |
Beta Was this translation helpful? Give feedback.
11 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Rishi860 should show you helper config