0

I am struggling to verify a simple contract on the snowtrace that's using chainlink and keep getting this error : ParserError: Source "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File import callback not supported enter image description here

i will put the code below, i tried changing compiler version many times, tried with and without optimization, tried to copy the ABI but got this error:

enter image description here

the code:

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract AvaxConverter {

AggregatorV3Interface internal priceFeed;

constructor() {
    priceFeed = AggregatorV3Interface(0x5498BB86BC934c8D34FDA08E81D444153d0D06aD);
}

function getCurrentPrice() public view returns (int) {
    (
        /*uint80 roundID*/,
        int price,
        /*uint startedAt*/,
        /*uint timeStamp*/,
        /*uint80 answeredInRound*/
    ) = priceFeed.latestRoundData();
    return price;
}

function convertCurrency(int amount) public view returns (int) {
    (
        /*uint80 roundID*/,
        int price,
        /*uint startedAt*/,
        /*uint timeStamp*/,
        /*uint80 answeredInRound*/
    ) = priceFeed.latestRoundData();
    return amount * 10**16/price;
}

}

The photo from inside remix

i need to verify only on snowtrace

enter image description here

Fooad Taha
  • 25
  • 8

1 Answers1

0

if you are using truffle i suggest you to take a look at the truffle-verify-plugin.

After Adding the plugin in the truffle settings and adding the desired block explorer's API key you can verify a contract by doing this command:

truffle run verify SomeContractName AnotherContractName --network networkName
Niccolò Fant
  • 599
  • 5
  • 10
  • Hi, i am new to this and this is pretty much one of my firsts contrats, i am using solidity and idk what you mean by truffle i will post a photo from inside remix – Fooad Taha Mar 11 '22 at 16:35
  • also, whatever i try to write in the console i get the error : Unexpected identifier – Fooad Taha Mar 11 '22 at 16:36
  • Oh ok, if you are using remix you can check this [guide](https://medium.com/remix-ide/verify-contracts-on-remix-with-sourcify-2912004d9c84) that teaches how to verify a contract. – Niccolò Fant Mar 11 '22 at 16:39
  • Hi man, thanks for the link, i need to verify on snowtrace ( this is for a job review) i was able to verify with the link you gave me but i still need snowtrace – Fooad Taha Mar 11 '22 at 16:51
  • what do you mean by "i need snowtrace"? – Niccolò Fant Mar 11 '22 at 17:01
  • i need to verify it on the snowtrace https://testnet.snowtrace.io/address/0x31fa51781f254b2ed96fb2561896b9c5559a7174#code – Fooad Taha Mar 11 '22 at 17:03