PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 182 forks source link

Update 01-deploy-raffle.js - raffle contract is a valid consumer #116

Closed RamanSB closed 1 year ago

RamanSB commented 1 year ago

When creating a subscription via the Chainlink VRF GUI we specify what contracts we would like to add as valid consumers to our VRF results, however this step is omitted programmatically, hence the PR. If this code snippet is missed we will get the following error:

 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)
    at Raffle.performUpkeep (contracts/Raffle.sol:116)
    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 HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1802:23)
    at HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:491:16)
    at EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1522:18)
PatrickAlphaC commented 1 year ago

Thanks!

RamanSB commented 1 year ago

Patrick, the pleasure is mine - thank you. Can't wait to get through the course just got to halfway. Need to go back and collect the NFTs at the end of each lesson.

I've got the Alchemy university Solidity course lined up after completing your course, so it should consolidate my knowledge very well / iron out any gaps in knowledge.