Created
July 22, 2018 16:40
-
-
Save geekdadley/6cc1158a3f1331fe5d00ebc18c05b735 to your computer and use it in GitHub Desktop.
encrypted oraclize calling
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
| pragma solidity ^0.4.18; | |
| import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; | |
| import "github.com/Arachnid/solidity-stringutils/strings.sol"; | |
| contract TestRoll is usingOraclize { | |
| using strings for *; | |
| string public lastresult; | |
| string public lasturl; | |
| function playerRollDice() public | |
| { | |
| uint randomQueryID = 1; | |
| string memory queryString1 = "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random[\"serialNumber\",\"data\"]', '\\n{\"jsonrpc\":\"2.0\",\"method\":\"generateSignedIntegers\",\"params\":{\"apiKey\":\"${[decrypt] BEVSvpFO2UkiDV6SyIkRy6raQtva13NbJRPM4ZHCI8IxRS/OG9GmDF+GDmUme19qhaqmu3FN8FKlBpcklqaO6wI1CIGIPvXS9hcAMigU39jCMLWN8wQ/rKdhRipE6imsOn6sQ04nqXmXVHigelOa2Esc/nLu}\",\"n\":1,\"min\":1,\"max\":100,\"replacement\":true,\"base\":10},\"id\":"; | |
| string memory queryString2 = uint2str(randomQueryID); | |
| string memory queryString3 = "}']"; | |
| string memory queryString1_2 = queryString1.toSlice().concat(queryString2.toSlice()); | |
| string memory queryString = queryString1_2.toSlice().concat(queryString3.toSlice()); | |
| oraclize_query("nested", queryString); | |
| lasturl = queryString; | |
| } | |
| /* | |
| * semi-public function - only oraclize can call | |
| */ | |
| /*TLSNotary for oraclize call */ | |
| function __callback(bytes32 myid, string result, bytes proof) public | |
| { | |
| lastresult = result; | |
| return; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment