Skip to content

Commit

Permalink
feat(0.4.25API): adds token payment for cached queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gskapka committed Jun 10, 2019
1 parent 4c88e75 commit 9d5ea28
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions oraclizeAPI_0.4.25.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4667,6 +4667,27 @@ contract usingOraclize {
return oraclize.queryCached.value(_queryPrice)();
}

function oraclize_token_queryCached(uint256 _queryPrice)
oraclizeAPI
internal
returns (bytes32 _queryId)
{
settleERC20Payment(_queryPrice);
return oraclize.queryCached();
}

function settleERC20Payment(uint256 _queryPriceInEth)
private
{
address tokenAddress = oraclize
.addressCustomPaymentToken(address(this));
ERC20Interface(tokenAddress)
.transfer(
address(oraclize),
oraclize.convertToERC20Price(_queryPriceInEth, tokenAddress)
);
}

function oraclize_getDatasourceByte(
string memory _datasourceString
)
Expand Down

0 comments on commit 9d5ea28

Please sign in to comment.