TypeError: Cannot read properties of undefined (reading 'entranceFee') #3091
Answered
by
RoboCrypter
blaynejosh
asked this question in
Q&A
-
Hello, Here's is my deploy script: const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
// const { verify } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
const VRF_SUB_FUND_AMOUNT = ethers.utils.parseEther("30")
module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let vrfCoordinatorV2Address, subscriptionId
if (developmentChains.includes(network.name)) {
const vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock")
vrfCoordinatorV2Address = vrfCoordinatorV2Mock.address
const transactionResponse = await vrfCoordinatorV2Mock.createSubscription()
const transactionReceipt = await transactionResponse.wait(1)
subscriptionId = transactionReceipt.events[0].args.subId
// We need to fund this subscription
// Fund the subscription is done with link token on a real network
// However, this mock allows us to fund the subscription without the link token
await vrfCoordinatorV2Mock.fundSubscription(subscriptionId, VRF_SUB_FUND_AMOUNT)
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"]
subscriptionId = networkConfig[chainId]["subsrciptionId"]
}
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, callbackGasLimit, interval]
const raffle = await deploy("Raffle", {
from: deployer,
log: true,
args: args,
waitConfirmations: network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(raffle.address, args)
}
log("Raffle Deployed!")
log("------------------------------------------")
}
module.exports.tags = ["all", "Raffle"] |
Beta Was this translation helpful? Give feedback.
Answered by
RoboCrypter
Oct 5, 2022
Replies: 1 comment 13 replies
-
@blaynejosh : Can your send me your repo link! |
Beta Was this translation helpful? Give feedback.
13 replies
Answer selected by
blaynejosh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@blaynejosh : Can your send me your repo link!