smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12.25k stars 2.94k forks source link

[Chronological Update]: smartcontractkit/chainlink no longer supports MockV3Aggregator for v0.6 #4731

Closed geeky01adarsh closed 1 year ago

geeky01adarsh commented 1 year ago

Lesson

Lesson 7

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

https://youtu.be/gyMwXuJrbJQ?t=38446

Operating System

Windows

Describe the bug

Hi, I was trying to create the mock contract using this line of code

import "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";

but it threw an error

@chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol:7:38: TypeError: Interfaces cannot inherit.
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
                                     ^-----------------^

@chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol:7:59: TypeError: Interfaces cannot inherit.
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
                                                          ^-------------------^

Error HH600: Compilation failed

And after debugging and going through the GitHub repo, I found that the above lines in MockV3Aggregator.sol must be replaced with the following lines

import "@chainlink/contracts/src/v0.7/tests/MockV3Aggregator.sol";

Please update it.

sheoran0917 commented 1 year ago

@geeky01adarsh That depends on what solidity version you have your MockV3Aggegator.sol is on. If you are on version ^0.6.0

image

Then you can update your hardhat.config.js version greater than 0.6.0 as below:

image

Same goes for all other versions. Be it v5.0, v6.0, v7.0 or v8.0.

alymurtazamemon commented 1 year ago

@geeky01adarsh Here is the MockV3Aggregator.sol for version 6 LINK

sheoran0917 commented 1 year ago

@alymurtazamemon - Same goes here as well. I provided the solution not asked any questions here.

alymurtazamemon commented 1 year ago

@sheoran0917 My mistake I wanted to tag @geeky01adarsh!

sheoran0917 commented 1 year ago

No Worries @alymurtazamemon. I figured that out after commenting. :-) You can close this one as well as this is also not a course issue.

geeky01adarsh commented 1 year ago

Thank you guys for the help!!! I don't why it didn't work back then, extremely sorry for pointing out something wrong. I am closing this issue now.