add a getSpotPrice getter to usingtellor?
Closed this issue · 0 comments
tkernell commented
Something like this. It would abstract away the generation of queryData/queryIds for this particular query type. But then we wouldn't want to add a getter for every query type.
function getSpotPrice(string calldata _asset, string calldata _currency, uint256 _disputeBufferTime)
public
view
returns(
bool _ifRetrieve,
bytes memory _value,
uint256 _timestampRetrieved
) {
bytes memory _queryData = abi.encode("SpotPrice", abi.encode(_asset, _currency));
return getDataBefore(keccak256(_queryData), block.timestamp - _disputeBufferTime);
}