Closed aindriu80 closed 1 year ago
I got it resolved. It seems to be something similar related to this thread:-
https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/1565
The steps were:
yarn add @chainlink/contracts
Then:
npm install --save-dev @chainlink/contracts@0.4.1
The above step didn't work so I tried:
npm install --save-dev @chainlink/contracts@0.4.1 --force
After that it was just a matter of fixing typos.
Hi, I'm following along but I'm getting the following error Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()'
`
yarn hardhat deploy
deploying "BasicNFT" (tx: 0x856f4762a665e306d42f86075296104169d1cd0d7c899762a2ba14c4bc5e6ee8)...: deployed at 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 with 2020849 gas
deploying "RandomIpfsNft" (tx: 0x426e79fa73661c50e53209695233001c01acdc1485ab97206329d592c97a391e)...: deployed at 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 with 3553625 gas
deploying "DynamicSvgNft" (tx: 0xc6858035bf7e7c76e7b7110a2cec7e8df81a24e243bbbbd72b61553096d1d127)...: deployed at 0x0165878A594ca255338adfa4d48449f69242Eb8F with 4276707 gas Basic NFT index 0 has tokenURI: ipfs://bafybeig37ioir76s7mg5oobetncojcm3c3hxasyd4rvid4jqhy4gkaheg4/?filename=0-PUG.json 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 RandomIpfsNft.requestNft (contracts/RandomIpfsNft.sol:73) at processTicksAndRejections (node:internal/process/task_queues:95:5) at runNextTicks (node:internal/process/task_queues:64:3) at listOnTimeout (node:internal/timers:533:9) at processTimers (node:internal/timers:507:7) at HardhatNode._mineBlockWithPendingTxs (/home/aindriu/Cáipéisí/Programming/projects/FreeCodeCamp/fcc-hardhat-nft-app/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1802:23) at HardhatNode.mineBlock (/home/aindriu/Cáipéisí/Programming/projects/FreeCodeCamp/fcc-hardhat-nft-app/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:491:16) at EthModule._sendTransactionAndReturnHash (/home/aindriu/Cáipéisí/Programming/projects/FreeCodeCamp/fcc-hardhat-nft-app/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1522:18) error Command failed with exit code 1.
......`
My code base is here https://github.com/aindriu80/fcc-hardhat-nft-app
Here is RandomIpfsNft.sol
`
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7;
import '@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol'; import '@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol'; import '@openzeppelin/contracts/access/Ownable.sol';
error RandomIpfsNftRangeOutOfBounds(); error RandomIpfsNftNeedMoreETHSent(); error RandomIpfsNft__TransferFailed();
contract RandomIpfsNft is VRFConsumerBaseV2, ERC721URIStorage, Ownable { // When we mint an NFT, we will trigger a Chainlink VRF call to get us a random number // using that number, we will get a random NFT // Pug, Shiba Inu, St. Bernard // Pug super rare // Shiba sort of rare // St. Bernard very common // users have to pay to min an NFT // the owner of the contract can withdrawn the ETH
}
`
I'm comparing Patricks code and I've already fixed a few bugs but I don't understand the following error
Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()'