DevelopmentPlease consider leaving your feedback. Feedback Form

VRF Level


In this level of Chainiversity, you will be asked to integrate Chainlink VRF (Verifiable Randomness Function) into your smart contract. If you integrate it correctly, and follow the instructions below, you will pass this level and you will be able to claim your NFT certificate for your web3 dev portfolio!

Note that you must utilize Polygon Mumbai testnet in order to submit a solution contract. To pay for gas fees and contract creation, you must have test MATIC: reach MATIC faucet here or here. To use Chainlink services, you will need LINK token on the Mumbai testnet, reach the faucet here


Requirements

  • Basic knowledge of Chainlink and its VRF product.
  • Basic knowledge of Solidity and Remix. A beginner? No worries, you can go from zero to hero here.
  • Understanding of interfaces in Solidity.

Level Task

In order to pass this level, the task is very simple: getting a VRF output from the Chainlink network with subscription method. You should be warned that returning a number made up by yourself does not work, and this transaction will revert. We suggest that you integrate the Chainlink VRF correctly by following the Chainlink documentation and the instructions below to pass the level!


There is a level manager contract developed by Chainiversity team that will validate if your contract calls for a VRF output. The Chainiversity Level Manager contract is here.

In order for the manager contract to check if you passed the level, you must implement the interface: function checkAnswer(address, address) external; The first address is your EVM account address, and the second one is the address of your solution contract. The manager contract will check if the first address parameter is the owner of the provided contract address using OpenZeppelin's Ownable imported contract. Be careful here: the owner of the contract will be able to claim the NFT certificate. If your transaction is not reverted, you will be able to claim your NFT certificate with the mint button on this page.


Some tips

Knowing where to implement the checkAnswer() interface function is important. There are two types of functions that need to be implemented in a VRF contract, try to think of where to call the function from the manager contract.

As validating the contract will consume some amount of gas, you may consider increasing the callback gas limit for the VRF contract. Also, considering funding your subscription with enough LINK.