Created
October 22, 2018 07:50
-
-
Save ohadcn/fb5ef52399e064511bb239098424a337 to your computer and use it in GitHub Desktop.
This file contains 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
pragma solidity ^0.4.0; | |
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; | |
contract CveDateViews is usingOraclize { | |
string public cveCount; | |
string public url; | |
string public prod; | |
string public vendor; // date | |
event newOraclizeQuery(string description); | |
event newCveViewsCount(string cveCount); | |
function CveDateViews(string _vendor, string _prod) { | |
//url = strConcat('json(https://cve.circl.lu/api/search/' , vendor , '/',prod, ')..[?(@.cvss>7)].Published'); | |
// url = strConcat('json(https://cve.circl.lu/api/search/' , vendor , '/',prod, ').0.Published.3'); | |
prod = _prod; | |
vendor = _vendor; | |
update(); | |
//$..[?(@.cvss>8)].Published | |
//oraclize_query(60, "URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c.0"); | |
} | |
function __callback(bytes32 myid, string result) { | |
if (msg.sender != oraclize_cbAddress()) throw; | |
cveCount = result; | |
newCveViewsCount(cveCount); | |
// do something with cveCount. like sending report to augur if viewsCount > X? | |
} | |
function update() payable { | |
if (oraclize_getPrice("URL") > this.balance) { | |
newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee"); | |
} else { | |
newOraclizeQuery("Oraclize query was sent, standing by for the answer.."); | |
oraclize_query('URL', strConcat('json(https://cve.circl.lu/api/search/' , vendor , '/',prod, ').0.Published')); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment