Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oraclize/ethereum-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo Persiani committed Nov 9, 2018
2 parents 47f5242 + d7a9bec commit 481b31c
Show file tree
Hide file tree
Showing 36 changed files with 13,540 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules
*.sw*
*.log
2 changes: 1 addition & 1 deletion solidity/KrakenPriceTicker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract KrakenPriceTicker is usingOraclize {
event NewKrakenPriceTicker(string price);

function KrakenPriceTicker() public {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
oraclize_setProof(proofType_Android | proofStorage_IPFS);
update();
}

Expand Down
4 changes: 2 additions & 2 deletions solidity/Swarm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract swarmExample is usingOraclize {
contract Swarm is usingOraclize {

string public swarmContent;

event newOraclizeQuery(string description);
event newSwarmContent(string swarmContent);

function swarmExample() {
function Swarm() {
update();
}

Expand Down
8 changes: 1 addition & 7 deletions solidity/YoutubeViews.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
for a given Youtube video.
*/


pragma solidity ^0.4.0;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";


pragma solidity ^0.4.0;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
Expand Down Expand Up @@ -38,4 +32,4 @@ contract YoutubeViews is usingOraclize {
NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("URL", 'html(https://www.youtube.com/watch?v=9bZkp7q19f0).xpath(//*[contains(@class, "watch-view-count")]/text())');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract BitcoinAddressExample is usingOraclize {

// Address balance in Satoshis
uint256 balance;
uint256 public balance;

event BitcoinAddressBalance(uint _balance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";


contract DelegatedMathExample is usingOraclize {
contract DelegatedMath is usingOraclize {

event operationResult(uint _result);

function DelegatedMathExample() {
function DelegatedMath() {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
delegateOperation("32", "125");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pragma solidity ^0.4.0;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract UrlRequestsComputation is usingOraclize {
contract UrlRequests is usingOraclize {

event newOraclizeQuery(string description);
event emitResult(string result);

function UrlRequestsComputation() payable {
function UrlRequests() payable {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}

Expand Down
67 changes: 67 additions & 0 deletions solidity/gas-price-oracle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# __A Gas Price Oracle leveraging Oraclize__
 

## :computer: __What this is:__

Designed for the ethereum community, this is an Oraclize-powered and Oraclize-funded ethereum gas-price oracle for providing ate on-chain gas prices. The smart-contract allows anyone to query the EthGasStation.info for up-to-date gas prices at any time - other smart-contracts can make queries too! In addition, an ongoing recursive query funded by Oraclize will ensure the latest gas prices are updated in the contract every six hours - enjoy!


 

---

 

### :fuelpump: __Gas Prices__:

**** Requires ~ 3,600,000 gas for deployment.

**** Gas for normal query to gas station is ~ 111,000.

**** Gas for restarting the recursive chain is ~~170,000~~ 111,000 too now.

**** _Recursive_ callbacks cost ~170409 so limit is 171000.

**** _Non recursive_ callbacks cost ~ 85,350 so their limit is set at 87,000.

**** Recursive restarting queries also refund excess ETH, meaning if the recursions stopped due to insufficient ETH balance, it should be topped up first.

 

***

 



### :mortar_board: __Instructions to test:__

![The passing tests!!](gas-price-oracle-tests.jpg)

**Pre-flight.** Make sure you have Truffle 5 installed globally:

**`❍ npm install -g truffle@beta`**

**1.** Clone the ethereum-examples repo:

**`❍ git clone https://github.com/oraclize/ethereum-examples.git`**

**2.** Switch into the gas-price-oracle directory:

**`❍ cd ethereum-examples/solidity/gas-price-oracle`**

**3.** Install dependencies:

**`❍ npm install`**

**4.** Start Truffle via:

**`❍ truffle develop`**

**5.** Start the Ethereum bridge in a new console via:

**`❍ npm run bridge`**

**6.** Once bridge is spooled up, back to first console to run the tests via:

**`❍ truffle_develop> test`**
Loading

0 comments on commit 481b31c

Please sign in to comment.