full-blockchain-solidity-course-js
full-blockchain-solidity-course-js copied to clipboard
Error: ERROR processing C:\Users\HP\smartcontract-lottery\deploy\01-deploy-raffle.js: Error: incorrect data length (argument="gaslane", value={"type":"BigNumber","hex":"0x2386f26fc10000"}, code=INVALID_ARGUMENT, version=abi/5.6.4)
Lesson
Lesson 9
Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")
https://youtu.be/gyMwXuJrbJQ?t=55155
Operating System
Windows
Describe the bug
this is my 01-deploy-raffle.js
const { network, ethers } = require("hardhat")
const { developmentChains, networkConfig } = require("../helper.hardhat-config")
const { verify } = require("../helper.hardhat-config")
const VRF_SUB_FUND_AMOUNT = ethers.utils.parseEther("4")
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 transactionReciept = await transactionResponse.wait()
subscriptionId = transactionReciept.events[0].args.subId
await vrfCoordinatorV2Mock.fundSubscription(subscriptionId, VRF_SUB_FUND_AMOUNT)
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"]
subscriptionId = networkConfig[chainId]["subscriptionId"]
}
const callBackGasLimit = networkConfig[chainId]["callBackGasLimit"]
const entranceFee = networkConfig[chainId]["entranceFee"]
const interval = networkConfig[chainId]["interval"]
const gasLane = networkConfig[chainId]["gasLane"]
const args = [
vrfCoordinatorV2Address,
interval,
entranceFee,
gasLane,
subscriptionId,
callBackGasLimit,
]
const raffle = await deploy("Raffle", {
from: deployer,
args: args,
log: true,
waitConfirmations: network.config.blockConfirmations || 1,
})
if (!developmentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
log("Verifying...")
await verify(raffle.address, args)
}
log("--------------------------------------------------------------------------------------")
}
module.exports.tags = ["all", "raffle"]
and this is my: helper.hardhat-config.js
const { ethers } = require("hardhat")
const networkConfig = {
4: {
name: "rinkeby",
vrfCoordinatorV2: "0x6168499c0cFfCaCD319c818142124B7A15E857ab",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
subscriptionId: "0",
callBackGasLimit: "500000",
interval: "30",
},
31337: {
name: "hardhat",
entranceFee: ethers.utils.parseEther("0.01"),
gasLane: "0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc",
callBackGasLimit: "500000",
interval: "30",
},
}
const developmentChains = ["hardhat", "localhost"]
module.exports = {
networkConfig,
developmentChains,
}

verify coming from helper file but it is not there.
Also check the order of these args should be same as contract constructor.
const args = [
vrfCoordinatorV2Address,
interval,
entranceFee,
gasLane,
subscriptionId,
callBackGasLimit,
]
If this is resolved, please close the issue.
Additionally, if possible, a discussion with the category "Ideas" w/ the answer.
I'm having an issue like this in the same step, after the mocks are deployed:
Error: ERROR processing /home/daniel/daniel/dev/chainlink/smartcontract-lottery-fcc/deploy/01-deploy-raffle.js:
TypeError: Cannot read properties of undefined (reading 'toHexString')
I'll tell you what I can find
I'm having an issue like this in the same step, after the mocks are deployed:
Error: ERROR processing /home/daniel/daniel/dev/chainlink/smartcontract-lottery-fcc/deploy/01-deploy-raffle.js: TypeError: Cannot read properties of undefined (reading 'toHexString')
I'll tell you what I can find
My mistake is that I was catching the 31337 network, where I hadn't specified gasLane yet, so I had an "undefined" value where a string should be.
The gasLimit value is a property of a transaction object that specifies the maximum amount of gas that can be used for executing the transaction. It's possible that the gasLimit value provided in the script is too large or too small, resulting in the error.
One potential solution is to check the gasLimit value being passed to the contract deployment function and ensure that it is a valid integer value. You can also try to increase the gasLimit value slightly to see if that resolves the error.
Another possibility is that there is an issue with the version of the ABI library being used. You may want to check if there is an updated version of the library available and update it if necessary.