// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface DiaAssetSpecificCallingConvention {
function latestRoundData() external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract DIAOracleSample {
address btcAdapter = 0x34E793Bed54bcd6a7EE9479D8E7fDdD957ACd252;
function getBTCLatestPrice() external view returns (
uint128 latestPrice,
uint128 timestampOflatestPrice
) {
// Call the Chainlink adapter's latestRoundData function
(, int256 answer, , uint256 updatedAt, ) =
DiaAssetSpecificCallingConvention(btcAdapter).latestRoundData();
latestPrice = uint128(uint256(answer));
timestampOflatestPrice = uint128(updatedAt);
return (latestPrice, timestampOflatestPrice);
}
}