This is a random NFT collection creation from a Chainlink Hackaton Spring 2022 workshop which is implemented by using IPFS for decentralize images storage and Chainlink VRF for make it actually random.
NOTICE: we are working with Chainlink VRF V2 which is not still implemented on Polygon Network.
The workshop followed to complete this repo is this one.
- Create NFT Collection ✅
- Each NFT has a "rarity" ✅
- Users pay for minting random NFTs ✅
- Start hardhat project:
npm init -y
npm install --save-dev hardhat
npx hardhat
- Add .gitignore file containing:
node_modules
.env
coverage
coverage.json
typechain
#Hardhat files
cache
artifacts
- Install dependencies:
yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai ethereum-waffle hardhat hardhat-contract-sizer hardhat-deploy hardhat-gas-reporter prettier prettier-plugin-solidity solhint solidity-coverage dotenv @chainlink/contracts
or
npm install --save-dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
npm install @nomiclabs/hardhat-ethers
npm install @chainlink/contracts
npm install dotenv --save
- Rinkeby network:
npx hardhat deploy --network rinkeby
or
yarn hardhat deploy --network rinkeby
- Mint:
npm hardhat deploy --tags mint --network rinkeby
or
yarn hardhat deploy --tags mint --network rinkeby
IMPORTAR: In order that our Contract works correctly with Chainlink VRF we need to add our Smart Contract Address as VRF consumer. To do so:
- Go to Chainlink VRF
- Create a 'Subscription' or use an existing one
- Add 'consumer': Smart Contract Address NOTICE: check that Subscription has enough funds (LINK)
- hardhat-nft-fcc: Patrick's repo for NFTs
- hardhat-starter-kit
- OpenZeppeling github: OpenZeppeling github
- Chainlink VRF: NECESARY for getting an actually random number
- Chainlink VRF contract addresses: Smart Contract addresses for Chainlink VRF (VRFCoordinator and Key Hash)
- Chainlink VRF subscription: Needed to create subscriptionId for using Chainlink VRF - Create subscription - add funds - get 'ID' - add deployed Smart Contract address as consumer