pleas help me to solve this problem. i wasted more than one hour #6376
Unanswered
muralibca1
asked this question in
Q&A
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
try to understand this... v6 specific... const txResponse = await vrfCoordinatorV2Mock.createSubscription();
const txReceipt = await txResponse.wait();
subId = txReceipt.logs[0].args.subId.toString(); ;`) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
my 01-deploy-raffle.js
` const { network, ethers } = require("hardhat");
const { verify } = require("../utils/verify.js");
require("dotenv").config();
const {
developmentChains,
networkConfig,
} = require("../helper-hardhat-config.js");
const VRF_SUB_FUND_AMOUNT = ethers.parseEther("1");
module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
let vrfCoordinatorV2Address;
let 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;
//fund the subscription
// usually , need the link token on a real network.
await vrfCoordinatorV2Mock.fundSubscription(
subscriptionId,
VRF_SUB_FUND_AMOUNT
);
} else {
vrfCoordinatorV2Address = networkConfig[chainId]["vrfCoordinatorV2"];
subscriptionId = networkConfig[chainId]["subscriptionId"];
}
const entranceFee = networkConfig[chainId]["raffleEntranceFee"];
const gasLane = networkConfig[chainId]["gasLane"];
const callbackGasLimit = networkConfig[chainId]["callbackGasLimit"];
const interval = networkConfig[chainId]["keepersUpdateInterval"];
const argss = [
vrfCoordinatorV2Address,
entranceFee,
gasLane,
subscriptionId,
callbackGasLimit,
interval,
];
const raffle = await deploy("raffle", {
from: deployer,
args: argss,
log: true,
waitConfirmations: network.config.blockConfirmations || 1,
});
if (!developmentChains.includes(network.name) && process.env.ETHER_API_KEY) {
log("verifying...");
await verify(raffle.address, args);
}
log("--------------------------------------");
};
module.exports.tags = ["all", "raffle"];
`
and my error is
Error: ERROR processing /home/murali/lottorysite/deploy/01-deploy-raffle.js:
TypeError: Cannot read properties of undefined (reading '0')
at Object.module.exports [as func] (/home/murali/lottorysite/deploy/01-deploy-raffle.js:24:47)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at listOnTimeout (node:internal/timers:538:9)
at processTimers (node:internal/timers:512:7)
at DeploymentsManager.executeDeployScripts (/home/murali/lottorysite/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1211:22)
at DeploymentsManager.runDeploy (/home/murali/lottorysite/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1060:5)
at SimpleTaskDefinition.action (/home/murali/lottorysite/node_modules/hardhat-deploy/src/index.ts:450:5)
at Environment._runTaskDefinition (/home/murali/lottorysite/node_modules/hardhat/src/internal/core/runtime-environment.ts:358:14)
at Environment.run (/home/murali/lottorysite/node_modules/hardhat/src/internal/core/runtime-environment.ts:191:14)
at DeploymentsManager.executeDeployScripts (/home/murali/lottorysite/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1214:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at listOnTimeout (node:internal/timers:538:9)
at processTimers (node:internal/timers:512:7)
at DeploymentsManager.runDeploy (/home/murali/lottorysite/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1060:5)
at SimpleTaskDefinition.action (/home/murali/lottorysite/node_modules/hardhat-deploy/src/index.ts:450:5)
at Environment._runTaskDefinition (/home/murali/lottorysite/node_modules/hardhat/src/internal/core/runtime-environment.ts:358:14)
at Environment.run (/home/murali/lottorysite/node_modules/hardhat/src/internal/core/runtime-environment.ts:191:14)
at SimpleTaskDefinition.action (/home/murali/lottorysite/node_modules/hardhat-deploy/src/index.ts:601:32)
error Command failed with exit code 1.
Beta Was this translation helpful? Give feedback.
All reactions