Files
SargaTrxUsdPrice/contracts/SargaTrxUsdPrice.sol
2025-05-13 19:41:33 +02:00

32 lines
822 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
contract SargaTrxUsdPrice {
AggregatorV3Interface internal _priceFeed;
/**
* Network: Tron
* Aggregator: TRX/USD
* Address: TC6o8AakUg4Xz9nHY9qXpJNsgF7CQkwBqF
*/
constructor(address priceFeedAddress) {
_priceFeed = AggregatorV3Interface(priceFeedAddress);
}
/**
* Returns the latest price
*/
function getLatestPrice() public view returns (int) {
(
,
/* uint80 roundID */ int price /* uint startedAt */ /* uint timeStamp */ /* uint80 answeredInRound */,
,
,
) = _priceFeed.latestRoundData();
return price;
}
}