FundMe test Stage: No contract deployed with name FundMe #130
-
So This is the portion of my smart contract code //SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./PriceConveter.sol";
error FundMe_Owner();
contract FundMe {
//mapping of funders
//array of funders
//MIN_USD for price converetor
//Owner of address
using PriceConverter for uint256;
mapping(address => uint256) private s_addressToAmountFunded;
address[] private s_funders;
uint256 public constant MIN_USD = 50;
//owner doesn't have to be public -> save gas
//owner is immutable is not going to change for this contract
address private immutable i_owner;
AggregatorV3Interface private s_priceFeed;
//create a funded event Here is the deploy script const {assert, expect} = require("chai");
const {getNamedAccounts,ethers, network} = require("hardhat");
const { developMentChain } = require("../../helper-hardhat-config")
describe("FundMe", async function() {
let fundMe;
let deployer;
let MockV3Aggregator;
const sendValue = ethers.utils.parseEther("1");
beforeEach(async function() {
deployer = (await getNamedAccounts()).deployer;
console.log(deployer)
await deployments.fixture(["all"]);
fundMe = await ethers.getContract("FundMe", deployer)
MockV3Aggregator = await ethers.getContract("MockV3Aggregator", deployer)
});
describe("constructor", async function() {
it("sets the aggregator address correctly", async function() {
const response = await fundMe.getPriceFeed();
console.log(response)
assert.equal(response, MockV3Aggregator.address)
})
})
}) and here is the error I run into when running yarn hardhat test const {assert, expect} = require("chai");
const {getNamedAccounts,ethers, network} = require("hardhat");
const { developMentChain } = require("../../helper-hardhat-config")
describe("FundMe", async function() {
let fundMe;
let deployer;
let MockV3Aggregator;
const sendValue = ethers.utils.parseEther("1");
beforeEach(async function() {
deployer = (await getNamedAccounts()).deployer;
console.log(`Log ${deployer}`)
await deployments.fixture(["all"]);
fundMe = await ethers.getContract("FundMe", deployer)
console.log(`Funde me ${fundMe}`)
MockV3Aggregator = await ethers.getContract("MockV3Aggregator", deployer)
});
describe("constructor", async function() {
it("sets the aggregator address correctly", async function() {
const response = await fundMe.getPriceFeed();
console.log(response)
assert.equal(response, MockV3Aggregator.address)
})
})
}) Yet this is the error I keep running into? not sure where I went wrong on this one any suggestions?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Your deploy script looks a lot like a test file. Could you check the github repo and make sure your deploy script matches? Reminder to add the name of your language next to your 3 backticks when formatting! ie: ```javascript |
Beta Was this translation helpful? Give feedback.
-
I had this issue as well. The problem for me was that I had my main function inside |
Beta Was this translation helpful? Give feedback.
-
@slimmsyd did you solve this error?? |
Beta Was this translation helpful? Give feedback.
Your deploy script looks a lot like a test file. Could you check the github repo and make sure your deploy script matches?
Like this:
https://github.com/PatrickAlphaC/hardhat-fund-me-fcc/blob/main/deploy/01-deploy-fund-me.js
Reminder to add the name of your language next to your 3 backticks when formatting!
ie: ```javascript