First commit
This commit is contained in:
31
contracts/SargaTrxUsdPrice.sol
Normal file
31
contracts/SargaTrxUsdPrice.sol
Normal file
@@ -0,0 +1,31 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user