Skip to main content
2 of 5
added 109 characters in body

getting error in Patrick collins smart-contract-lottery project

this is my code

const { network, ethers } = require("hardhat");
const { deploymentChains, networkConfig } = require("../helper-hardhat-config");
const { verify } = require("../utils/verify");
require("dotenv").config();

module.exports = async function ({ deployments, getNamedAccounts }) {
    const { deployer } = await getNamedAccounts();
    const { deploy, log } = deployments;
    let VRFCoordinatorV2Address, subscriptionId;
    const chainId = network.config.chainId;
    const VRF_SUB_AMOUNT = ethers.parseEther("2");
    const entranceFee = networkConfig[chainId]["entranceFee"];
    const gasLane = networkConfig[chainId]["gasLane"];
    const callbackGasLimit = networkConfig[chainId]["callbackGasLimit"];
    const interval = networkConfig[chainId]["interval"];

    if (deploymentChains.includes(network.name)) {
        const VRFCoordinator = await ethers.getContract("VRFCoordinatorV2Mock");
        VRFCoordinatorV2Address = VRFCoordinator.address;
        const transactionResponse = await VRFCoordinator.createSubscription();
        const transactionReceipt = await transactionResponse.wait(1);
        subscriptionId = transactionReceipt.events[0].args.subId;
        await VRFCoordinator.fundSubscription(subscriptionId, VRF_SUB_AMOUNT);
    } else {
        VRFCoordinatorV2Address = networkConfig[chainId]["VRFCoordinatorAddress"];
        subscriptionId = networkConfig[chainId]["subscriptionId"];
    }

    const args = [
        VRFCoordinatorV2Address,
        entranceFee,
        gasLane,
        subscriptionId,
        callbackGasLimit,
        interval,
    ];
    const raffle = await deploy("Raffle", {
        from: deployer,
        log: true,
        args: args,
        waitConfirmations: network.config.blockConfirmations,
    });
    if (!deploymentChains.includes(network.name) && process.env.ETHERSCAN_API_KEY) {
        await verify(raffle.address, args);
    }
    log("----------------------------------------------");
};

module.exports.tags = ["all", "raffle"];

this is the error im getting this is the error im getting