'length' Error while Deploying on Mumbai Testnet only. #1454
-
I have a peculiar issue. I get the following error, only when I'm deploying to the Mumbai Testnet:
I have deployed successfully on the local hardhat network with mocks and on rinkeby. I'm only getting this error when trying to deploy to mumbai testnet. This error is similar to #69, answered by @PatrickAlphaC . So I followed his solution (I had already included the named accounts in the hardhat-config, since Patrick mentions it somewhere in Lesson 8). However, It's still throwing up the same error. My namedAccounts object from 'hardhat-config.js' - namedAccounts: {
deployer: {
default: 0,
},
users: {
default: 0,
},
}, The code snippet that's throwing the error - const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper-hardhat-config")
const { verify } = require("../utils/verify")
const VRF_SUB_FUND_AMOUNT = "1000000000000000000000"
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
await vrfCoordinatorV2Mock.fundSubscription(subscriptionId, VRF_SUB_FUND_AMOUNT)
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"]
subscriptionId = 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: network.config.blockConfirmations || 1,
}) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 13 replies
-
When does it lead to |
Beta Was this translation helpful? Give feedback.
-
Have you added accounts to the Mumbai testnet in hardhat.config.ts? |
Beta Was this translation helpful? Give feedback.
-
9 times out of 10 this is the error: |
Beta Was this translation helpful? Give feedback.
-
@Mark-Four Can you push it to GitHub and leave a link here? |
Beta Was this translation helpful? Give feedback.
@Mark-Four Can you push it to GitHub and leave a link here?