dharma-kṣetre
dharma-kṣetre

Reputation: 21

Getting TypeError when trying to compile the mock file imported from the @chianlink/contracts

I am getting the type error when I try to compile my mock file

Here's my mock file content

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";

and this is the error I am getting when I try to compile it

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

Error

My chainlink version "@chainlink/contracts": "^0.3.1" Version I defined in the hardhat config

  solidity: {
    compilers: [
      {version: "0.8.9"},
      {version: "0.6.0"},
    ]
  },

I think the error is coming from the @chainlink/contracts. Therefore I tried to reinstall the package but the error remains the same.

I also tried to change the version of the @chainlink/contracts.

Can anyone please tell me what I am doing wrong?

Upvotes: 0

Views: 106

Answers (2)

you may change the version from this {version: "0.6.0"} to {version: "0.6.6"}:

solidity: {
    compilers: [
      {version: "0.8.9"},
      {version: "0.6.6"},
    ]
  },

and make sure the pragma version of the mock file has caret(^)

pragma solidity ^0.6.0;

it is for compatible with version updates as minor/patch

Upvotes: 0

dharma-kṣetre
dharma-kṣetre

Reputation: 21

The problem is solved. I installed the latest version of @chainlink and also updated my compiler version. And instead of importing from v6.0. I am importing from v8.0

Upvotes: 0

Related Questions