Lesson 14: Dynamic SVG NFT error #2328
Answered
by
alymurtazamemon
Henrychang26
asked this question in
Q&A
-
Hi all, I have been following 03-deploy-dynamic-svg-nft.js, and I keep getting this error when I try to deploy, See below: 03-deploy-dynamic-svg-nft.js const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
const fs = require("fs")
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if (developmentChains.includes(network.name)) {
const EthUsdAggregator = await ethers.getContract("MockV3Aggregator")
ethUsdPriceFeedAddress = EthUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId].ethUsdPriceFeed
}
log("---------------")
const lowSVG = await fs.readFileSync("./images/dynamicNFT/frown.svg", { encoding: "utf8" })
const highSVG = await fs.readFileSync("./images/dynamicNFT/happy.svg", { encoding: "utf8" })
args = [ethUsdPriceFeedAddress, lowSVG, highSVG]
const dynamicSvgNft = await deploy("DynamicSvgNft", {
from: deployer,
args: args,
log: true,
waitConfimations: network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(dynamicSvgNft.address, args)
}
}
module.exports.tags = ["all", "dynamicsvg", "main"] 00-deploy-mocks.js const { network } = require("hardhat")
const { DECIMALS, INITIAL_PRICE } = require("../helper-hardhat-config")
const BASE_FEE = "250000000000000000" // 0.25 is this the premium in LINK?
const GAS_PRICE_LINK = 1e9 // link per gas, is this the gas lane? // 0.000000001 LINK per gas
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
// If we are on a local development network, we need to deploy mocks!
if (chainId == 31337) {
log("Local network detected! Deploying mocks...")
await deploy("VRFCoordinatorV2Mock", {
from: deployer,
log: true,
args: [BASE_FEE, GAS_PRICE_LINK],
})
await deploy("MockV3Aggregator", {
from: deployer,
log: true,
args: [DECIMALS, INITIAL_PRICE],
})
log("Mocks Deployed!")
log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
log("You are deploying to a local network, you'll need a local network running to interact")
log(
"Please run `yarn hardhat console --network localhost` to interact with the deployed smart contracts!"
)
log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
}
}
module.exports.tags = ["all", "mocks", "main"] |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Sep 5, 2022
Replies: 1 comment 2 replies
-
@Henrychang26 Did you run this command |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Henrychang26
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Henrychang26 Did you run this command
npx hardhat deploy --tags dynamicsvg,mocks
?