Lesson 4: PriceConverter.sol Undeclared identifier #3094
-
Hello, I have an issue that I can't figure out. I watched the others Discussions but I can't fix it. //SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
library PriceConverter {
function getPrice() internal view returns (uint256) {
// ABI
// Address 0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e
AggregatorV3Interface priceFeed = AggregatorV3Interface(0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e);
(,int256,,,) = priceFeed.latestRoundData();
// ETH in terms of USD
//3000.000000
return uint256(price * 1e10); // <--- error
}
function getVersion() internal view returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e);
return priceFeed.version();
}
function getConversionRate(uint256 ethAmount) internal view returns (uint256) {
uint256 ethPrice = getPrice();
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1e18;
return ethAmountInUsd;
}
} https://zhenya-serviceos.tinytake.com/msc/NzQyMzUwMF8yMDMxNzk1Nw |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Oct 5, 2022
Replies: 1 comment 5 replies
-
@dimit4hll your variable name is priceFeed In the return statement of |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dimit4hll your variable name is priceFeed
In the return statement of
getPrice
function update theprice
variable topriceFeed