Reputation: 1
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.
Upvotes: 0
Views: 96
Reputation: 146
It looks like you're using the wrong contract address for the ETH/USD pair on the Polygon Cardano zkEVM testnet.
The ETH/USD
price feed contract address on Polygon Cardona zkEVM testnet is 0xd94522a6feF7779f672f4C88eb672da9222f2eAc
.
0x97d9F9A00dEE0004BE8ca0A8fa374d486567eE2D
is the address for ETH/USD
on Polygon zkEVM Mainnet
Chainlink Docs: https://docs.chain.link/data-feeds/price-feeds/addresses?network=polygonzkevm&page=1#polygon-zkevm-cardona-testnet
Make the changes and it will work.
Upvotes: 0