Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0) #2810
-
Error: ERROR processing E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\deploy\01_deploy.Lottery.js:
Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
at Logger.makeError (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\logger\src.ts\index.ts:269:28)
at Logger.throwError (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\logger\src.ts\index.ts:281:20)
at Logger.throwArgumentError (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\logger\src.ts\index.ts:285:21)
at Function.BigNumber.from (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\bignumber\src.ts\bignumber.ts:289:23)
at NumberCoder.encode (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\abi\src.ts\coders\number.ts:25:27)
at E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\abi\src.ts\coders\array.ts:71:19
at Array.forEach (<anonymous>)
at pack (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\abi\src.ts\coders\array.ts:54:12)
at TupleCoder.encode (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\abi\src.ts\coders\tuple.ts:54:20)
at AbiCoder.encode (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\@ethersproject\abi\src.ts\abi-coder.ts:111:15)
at DeploymentsManager.executeDeployScripts (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat-deploy\src\DeploymentsManager.ts:1222:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7)
at DeploymentsManager.runDeploy (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat-deploy\src\DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat-deploy\src\index.ts:438:5)
at Environment._runTaskDefinition (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat\src\internal\core\runtime-environment.ts:308:14)
at Environment.run (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat\src\internal\core\runtime-environment.ts:156:14)
at SimpleTaskDefinition.action (E:\Block Chain Projects\Hardhat_FULL_STACK_LOTTERY\LOTTERY_BACKEND\node_modules\hardhat-deploy\src\index.ts:584:32)
error Command failed with exit code 1. I am unable to find Where is the bug......does this error specified the line no const { getNamedAccounts, deployments, network, ethers } = require("hardhat");
const {
developmentchains,
networkconfig,
} = require("../helper-hardhat.config");
const { verify } = require("../utils/verify");
require("dotenv").config();
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY;
const SUB_KEY_AMOUNT = ethers.utils.parseEther("30");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
let vrfCoordinatorv2address;
const entranceFee = networkconfig[chainId]["entranceFee"];
const gasLane = networkconfig[chainId]["gasLane"];
const subscriptionId = networkconfig[chainId]["subscriptionId"];
const callbackGasLimit = networkconfig[chainId]["callbackGasLimit"];
const interval = networkconfig[chainId]["interval"];
if (developmentchains.includes(network.name)) {
const vrfCoordinatorv2Mock = await ethers.getContract(
"VRFCoordinatorV2Mock"
);
vrfCoordinatorv2address = vrfCoordinatorv2Mock.address;
const transactionResponse = await vrfCoordinatorv2Mock.createSubscription();
const transactionReciept = await transactionResponse.wait(1);
const subscriptionId = transactionReciept.events[0].args.subId;
//Fund The Subscription
// Usually You Dont need a Link Token on a real network
await vrfCoordinatorv2Mock.fundSubscription(subscriptionId, SUB_KEY_AMOUNT);
} else {
vrfCoordinatorv2address = networkconfig[chainId]["vrfCoordinatorv2"];
}
const args = [
vrfCoordinatorv2address,
entranceFee,
gasLane,
subscriptionId,
callbackGasLimit,
interval,
];
const Lottery = await deploy("Lottery", {
from: deployer,
args: args,
log: true,
waitConfirmations: network.config.blockConfirmations || 1,
});
//Verify the Contract
if (!developmentchains.includes(network.name) && ETHERSCAN_API_KEY) {
log("Verifying........");
await verify(Lottery.address, args);
}
};
module.exports.tags = ["all", "LOTTERY"]; |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 23 replies
-
@decentralized-86 Make sure that not any of them is undefined by consoling this array |
Beta Was this translation helpful? Give feedback.
-
Hey @decentralized-86 you are defining the subscriptionId twice using |
Beta Was this translation helpful? Give feedback.
-
Hey @decentralized-86 in your lottery.sol code, change |
Beta Was this translation helpful? Give feedback.
-
I had this bug as well with a different solution. I needed to update the code that gets the |
Beta Was this translation helpful? Give feedback.
-
I have tried all of the above solutions but still, the error persists, can anyone suggest a solution? |
Beta Was this translation helpful? Give feedback.
Hey @decentralized-86 in your lottery.sol code, change
uint16 callbackGasLimit
in the constructor touint32 callbackGasLimit
You are getting this error because the callbackGasLimit value you are passing (500000
) is way above whatuint16
can accomodate (65535
)Tell me if it fixes your issue.