PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 183 forks source link

Error: VM Exception while processing transaction #169

Open asalrahman opened 1 year ago

asalrahman commented 1 year ago

doesn't allow entrance when lottery is calculating: Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()' at VRFCoordinatorV2Mock.onlyValidConsumer (@chainlink/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:72) at VRFCoordinatorV2Mock.requestRandomWords (@chainlink/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:147)

asalrahman commented 1 year ago

add this to deploy.js file

if (developmentChains.includes(network.name)) { const vrfCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock") await vrfCoordinatorV2Mock.addConsumer(subscriptionId, lottery.address) }

akashgreninja commented 1 year ago

I fixed it as well same solution as @asalrahman suggested

https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc/issues/171#issuecomment-1643423816