DevelopmentPlease consider leaving your feedback. Feedback Form
Another level for Chainiversity: Chainlink Price Feeds Level! In this level, you will be asked to integrate Chainlink Price Feeds into your 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.
For this level, you will not need LINK tokens to utilize Chainlink Price Feeds.
In this level, the task is that you send 0.01 USD worth of MATIC to the manager contract using MATIC/USD Price Feeds. Chainiversity Level Manager contract is here.
In order to send MATIC to the manager contract, use the following interface function: function receiveAnswer() external payable;
0.01 USD worth of MATIC will be sent to the Manager contract, and you will be able to withdraw it.
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 importOwnable.sol
. Make sure that the owner of the contract sends the transaction when calling the interface function function receiveAnswer() external payable;
The most important point for solving this challenge is paying attention to the decimals of the Price Feeds output. You will have to play around with decimals if you want to send a valid amount of MATIC to the manager contract.
Even though you correctly write your smart contract, and attempt to submit your solution, the transaction could give an error in Remix interface. Try submitting the solution multiple times; if it does not still work, then check for errors.
The heartbeat for MATIC/USD feed is 120 seconds. Make sure to leave no gap between retrieving the price and submitting your solution.