You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**## i get this error message when i run yarn hardhat test. I think <await deployments.fixture(["all"])> is not running the scripts to deploy the contract.
I have re-installed <@nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers> multiples times both still not working.
please help if you have a solution, thanks**
## my FundMe Script
`import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import networkConfig, { developmentChains } from "../helper-hardhat-config";
import { verify } from "../utils/verify";
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
**## i get this error message when i run yarn hardhat test. I think <await deployments.fixture(["all"])> is not running the scripts to deploy the contract.
I have re-installed <@nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers> multiples times both still not working.
please help if you have a solution, thanks**
## my FundMe Script
`import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import networkConfig, { developmentChains } from "../helper-hardhat-config";
import { verify } from "../utils/verify";
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// @ts-ignore
const { getNamedAccounts, deployments, network } = hre;
const { deploy, log, get } = deployments;
const { deployer } = await getNamedAccounts();
let ethUsdPriceFeedAddress;
if (developmentChains.includes(network.name)) {
const ethUsdAgregator = await get("MockV3Aggregator");
ethUsdPriceFeedAddress = ethUsdAgregator.address;
} else {
ethUsdPriceFeedAddress = networkConfig[network.name].ethUsdPriceFeed;
}
log("starting deployment______");
const FundMe = await deploy("FundMe", {
contract: "FundMe",
from: deployer,
args: [ethUsdPriceFeedAddress],
log: true,
waitConfirmations: networkConfig[network.name].blockConfirmations || 0,
});
if (
!developmentChains.includes(network.name) &&
process.env.ETHER_SCAN_APIKEY
) {
await verify(FundMe.address, [ethUsdPriceFeedAddress]);
}
};
export default func;
export const tags = ["all", "FundMe"];`
### my test
`import { assert, expect } from "chai";
import { deployments, ethers, getNamedAccounts } from "hardhat";
import { FundMe, MockV3Aggregator } from "../../typechain-types";
describe("FundMe", async () => {
let FundMe: FundMe;
let MockV3Aggregator: MockV3Aggregator;
let deployer: any;
beforeEach(async () => {
//deploy fundme contract
deployer = (await getNamedAccounts()).deployer;
await deployments.fixture(["all"]);
FundMe = await ethers.getContract("FundMe", deployer);
MockV3Aggregator = await ethers.getContract("MockV3Aggregator", deployer);
});
describe("Constructor", async () => {
it("sets the aggregator addresses correctly", async () => {
const response = await FundMe.priceFeed();
assert.equal(response, MockV3Aggregator.address);
});
});
// describe("fund", async () => {
// it("fails if you dont send enough Eth", async () => {
// await expect(FundMe.fund()).to.be.revertedWith(
// "You need to spend more ETH!"
// );
// });
// });
});`
Beta Was this translation helpful? Give feedback.
All reactions