Lesson 9: Error: ERROR processing 01-deploy-raffle.js: Error: invalid BigNumber value... #527
-
I have tried everything to get my my Deploy-raffle to deploy, Any help would be great 01-deploy-raffle const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
const VAF_SUB_FUND_AMOUNT = ethers.utils.parseEther("2")
module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let vrfCoordinatorV2Address, subscriptionId
if (chainId == 31337) {
const vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock")
vrfCoordinatorV2Address = vrfCoordinatorV2Mock.address
const transactionResponse = await vrfCoordinatorV2Mock.createSubscription()
const transactionReceipt = await transactionResponse.wait(1)
subscriptionId = transactionReceipt.events[0].subId
//Fund the subscription
//Ususally, you'd neeed the link token on a real network
await vrfCoordinatorV2Mock.fundSubscription(subscriptionId, VAF_SUB_FUND_AMOUNT)
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"]
subcriptionId = networkConfig[chainId]["subscriptionId"]
}
const entranceFee = networkConfig[chainId]["entranceFee"]
const gasLane = networkConfig[chainId]["gasLane"]
const callbackGasLimit = networkConfig[chainId]["callbackGasLimit"]
const interval = networkConfig[chainId]["interval"]
const args = [vrfCoordinatorV2Address, entranceFee, gasLane, subscriptionId, callbackGasLimit, interval]
const raffle = await deploy("Raffle", {
from: deployer,
args: args,
log: true,
waitConfirmations: networks.config.blockConfirmations
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(raffle.address, args)
}
log("---------------------------------------------------")
}
module.exports.tags = ["all", "raffle" ] helper-hardhat-config const { ethers } = require("hardhat")
const networkConfig = {
4: {
name: "rinkeby",
vrfCoordinatorV2: "0x6168499c0cFfCaCD319c818142124B7A15E857ab",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
subscriptionId: "0",
callbackGasLinit: "500,000",
interval: "30",
},
31337: {
name: "hardhat",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
callbackGasLinit: "500,000",
interval: "30",
}
}
const developmentChains = ["hardhat", "localhost"]
module.exports = {
networkConfig,
developmentChains,
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Try taking the commas out of your callbackGasLimit value (so use "500000" instead of "500,000") |
Beta Was this translation helpful? Give feedback.
-
In your helper-hardhat-config you have a spelling mistake Corrected one : helper-hardhat-config const { ethers } = require("hardhat")
const networkConfig = {
4: {
name: "rinkeby",
vrfCoordinatorV2: "0x6168499c0cFfCaCD319c818142124B7A15E857ab",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
subscriptionId: "0",
- callbackGasLinit: "500,000",
+ callbackGasLimit : "500000"
interval: "30",
},
31337: {
name: "hardhat",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
- callbackGasLinit: "500,000",
+ callbackGasLimit : "500000"
interval: "30",
}
}
const developmentChains = ["hardhat", "localhost"]
module.exports = {
networkConfig,
developmentChains,
} |
Beta Was this translation helpful? Give feedback.
-
transactionReceipt.events[0].args.subId Only Change the code that is inside your IF statement. |
Beta Was this translation helpful? Give feedback.
In your helper-hardhat-config you have a spelling mistake
callbackGasLinit
it should becallbackGasLimit
. I hope you find it .Corrected one :
helper-hardhat-config