I am trying to use the ETH/USD price data feed on the Polygon Cardano Testnet via Remix. I deployed the following contract successfully:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
contract DataConsumerV3 {
AggregatorV3Interface internal dataFeed;
constructor() {
dataFeed = AggregatorV3Interface(
0x97d9F9A00dEE0004BE8ca0A8fa374d486567eE2D
);
}
function getChainlinkDataFeedLatestAnswer() public view returns (int) {
(
int answer,
) = dataFeed.latestRoundData();
return answer;
}
}
However, when I call the getChainlinkDataFeedLatestAnswer() function, I encounter the following error:
execution reverted
The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
You may want to cautiously increase the gas limit if the transaction went out of gas.
Could someone help me resolve this issue? Thank you!
I tried to fetch the ETH/USD price feed on the Polygon Cardona Testnet via Remix. I was expecting to get the USD price of 1 ETH but it was resulted in a ‘execution reverted’ error. I tried the same with Sepolia Testnet and it worked.
Divyakrishnan R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.