DevelopmentPlease consider leaving your feedback. Feedback Form
Do you want to master automating your smart contracts? Then, this Chainiversity level is for you! In this level, you will be asked to integrate Chainlink Automation into your smart contract.
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.
In this level, you should create a function that will register your contract at the level manager contract whose address is here using the interface function registerContract() external;
Registering is essential in order to pass the level.
The time of the registration (block.timestamp) is stored in the manager contract. Chainlink Automation should be integrated in such a way that the interface function for submitting your solution function submitAnswer() external;
is called at least 30 seconds or more after the registration timestamp.
You can automate your contract to call the submitAnswer()
function in the manager contract every 30 seconds after your contract is registered for Chainlink Automation. To be safe, you can also set the interval for 45 seconds in your contract.
The function submitAnswer()
should be called only by the Chainlink node operators. If you attempt to call it, the transaction will revert.
The manager contract will also 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, so you must import Ownable.sol
.