Skip to content
Discussion options

You must be logged in to vote

You have to add consumer manually when you deploy the contract on the local Hardhat network.

Add below code in Raffle-deploy.js file
eg.

if (chainId == 31337) {
    await VRFCoordinatorV2Mock.addConsumer(subscriptionId.toNumber(), raffle.address)
  }

Full Code :

const { network, ethers } = require("hardhat")
const { devlopmentChains, networkConfig } = require("../helper-hardhat_config")
const { verify } = require("../utils/verify")
require("dotenv").config()
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY

//Contract Number : 0x165224DC69394A35483b49e89751842011429B05

module.exports = async function (hre) {
  const { getNamedAccounts, deployments } = hre
  const { log, deploy } =

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@ritesh798
Comment options

Comment options

You must be logged in to vote
1 reply
@ritesh798
Comment options

Answer selected by ritesh798
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants