I am getting this very strange error message --DeclarationError:undefined identifier.
And it's giving this in all of my Functions, I don't know why. Can anyone please tell me what's is going on ?
I am using Ethereum, Solidity and Openzepellinn to do this, but to be able to do the next step I need my interface to work without any of these error.
pls see the code below
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
/**
* THIS EXAMPLE USES UN-AUDITED CODE.
* Network: Kovan
* Base: BTC/USD
* Base Address: 0x6135b13325bfC4B00278B4abC5e20bbce2D6580e
* Quote: EUR/USD
* Quote Address: 0x0c15Ab9A0DB086e062194c273CC79f41597Bbf13
* Decimals: 8
*/
contract PriceConverter {
address public priceSource;
address public quote;
uint8 private decimals;
uint256 public fallbackPrice;
event FallbackPrice(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
constructor(address _priceSource, address _quote, uint8 _decimals) public {
priceSource = _priceSource;
quote = _quote;
decimals = uint8(10 ** uint8(_decimals));
}
function latestRoundData() public view
returns
(uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
require(decimals > uint8(0) && decimals <= uint8(18), "Invalid _decimals");
( , int256 basePrice, , , ) = address(priceSource).latestRoundData();
uint8 baseDecimals = address(priceSource).decimals();
basePrice = scalePrice(basePrice, baseDecimals, decimals);
( , int256 quotePrice, , , ) = address(quote).latestRoundData();
uint8 quoteDecimals = address(quote).decimals();
quotePrice = scalePrice(quotePrice, quoteDecimals, decimals);
return basePrice * decimals / quotePrice;
}
function updateFallbackPrice() public {
(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) = priceSource.latestRoundData();
if (answer > 0) {
fallbackPrice = uint256(answer);
emit FallbackPrice(roundId,answer,startedAt,updatedAt,answeredInRound);
}
}
function scalePrice(int256 _price, uint8 _priceDecimals, uint8 _decimals)
internal
pure
returns (int256)
{
if (_priceDecimals < _decimals) {
return _price * int256(10 ** uint256(_decimals - _priceDecimals));
} else if (_priceDecimals > _decimals) {
return _price / int256(10 ** uint256(_priceDecimals - _decimals));
}
return _price;
}
} ```
Also i added screenshot of what it looks like on remix IDE
[1]: https://i.stack.imgur.com/e00dC.png