Lesson 7: I'm unable to deploy my project #4963
-
Whenever I run yarn hardhat deploy --tags mock to deploy it compiles the code instead
This's my hardhatconfig file require("@nomicfoundation/hardhat-toolbox");
require("hardhat-deploy")
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
defaultNetwork: "hardhat",
solidity: {
compilers: [
{ version: "0.8.8" }, { version: "0.6.6"}
]
},
};
my mock deploy file
// For network that has no pricefeed e.g localhsot and price feed
const network = require("hardhat")
const { developmentChains, DECIMALS, INITIAL_ANSWER } = require("../helper-hardhat-config")
module.exports = async ({ deployments, getNamedAccounts }) => {
const { deploy, log } = deployments
const { deployer } = getNamedAccounts()
const chainId = network.config.chainId
if (developmentChains.includes(network.name)) {
log("Local network detected! Deploying mocks")
await deploying("MockV3Aggregator", {
contract: MockV3Aggregator,
from: deployer,
log: true,
args: [DECIMALS, INITIAL_ANSWER]
})
log("Mocks deployed")
log("--------------------------------")
}
}
module.exports.tags = ["all", "mocks"] deploy fund me file
const { network } = require("hardhat")
const { networkConfig } = require("../helper-hardhat-config")
module.exports = async ({ deployments, getnamedAccounts }) => {
const { log, deploy } = deployments
const { deployer } = await getnamedAccounts()
const chainId = network.config.chainId
const ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
const fundMe = await deploy("FundMe", {
from: deployer,
args: [], // You'll pass in the priceFeed Aggregator in the constructor here
log: true
})
} helper file
const networkConfig = {
5: {
name: "goerli",
ethUsdPriceFeed: "0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e"
},
137: {
name: "sepolia",
ethUsdPriceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306"
}
}
const developmentChains = ["hardhat", "localhost"]
const DECIMALS = 8
const INITIAL_ANSWER = 200000000
module.exports = { networkConfig, developmentChains, DECIMALS, INITIAL_ANSWER } |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Is your file in deploy folder ? |
Beta Was this translation helpful? Give feedback.
-
Hello @Cointerior As @paulcoffee85 said you should use
Just visit course repository for this lesson and compare it's code with yours it shoulkd solve your problems. If you see only compiling in console that is because script you are running has some errors and it is not working properly. |
Beta Was this translation helpful? Give feedback.
Hello @Cointerior
As @paulcoffee85 said you should use
deploy
instead ofdeploying
. There is also another error coming from missing data in yourhardhat.config.js
as you are not having there following:networks
setup for Goerli and Sepolia, noPRIVATE_KEY
,GOERLI_RPC_URL
, chainId and blockconfirmationsnamedAccounts
setup...Just visit course repository for this lesson and compare it's code with yours it shoulkd solve your problems.
If you see only compiling in console that is because script you are running has some errors and it is not working properly.