Last active
February 24, 2023 02:16
-
-
Save Ashar2shahid/c2f32da1c95c2826ec337faa3a2fb933 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.9; | |
import "@api3/airnode-protocol-v1/contracts/dapis/DapiReader.sol"; | |
contract DataFeedReaderExample is DapiReader { | |
constructor(address _dapiServer) DapiReader(_dapiServer) {} | |
function readDataFeedWithDapiName(bytes32 dapiName) | |
external | |
view | |
returns (int224 value, uint256 timestamp) | |
{ | |
(value, timestamp) = IDapiServer(dapiServer).readDataFeedWithDapiName( | |
dapiName | |
); | |
} | |
function readDataFeedValueWithDapiName(bytes32 dapiName) | |
external | |
view | |
returns (int224 value) | |
{ | |
value = IDapiServer(dapiServer).readDataFeedValueWithDapiName(dapiName); | |
} | |
function dapiNameToReaderToWhitelistStatus(bytes32 dapiName, address reader) | |
external | |
view | |
returns (uint64 expirationTimestamp, uint192 indefiniteWhitelistCount) | |
{ | |
bytes32 dapiNameHash = keccak256(abi.encodePacked(dapiName)); | |
return | |
IDapiServer(dapiServer).dataFeedIdToReaderToWhitelistStatus( | |
dapiNameHash, | |
reader | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment