Fooad Taha
Fooad Taha

Reputation: 25

verifying smart contract on avax testnet networrk while using chainlink data feed

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

Upvotes: 0

Views: 292

Answers (1)

Niccolò Fant
Niccolò Fant

Reputation: 601

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

Upvotes: 0

Related Questions