Skip to content

Commit 481b31c

Browse files
author
Riccardo Persiani
committed
Merge branch 'master' of github.com:oraclize/ethereum-examples
2 parents 47f5242 + d7a9bec commit 481b31c

36 files changed

+13540
-15
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules
2+
*.sw*
3+
*.log

solidity/KrakenPriceTicker.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ contract KrakenPriceTicker is usingOraclize {
1717
event NewKrakenPriceTicker(string price);
1818

1919
function KrakenPriceTicker() public {
20-
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
20+
oraclize_setProof(proofType_Android | proofStorage_IPFS);
2121
update();
2222
}
2323

solidity/Swarm.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
pragma solidity ^0.4.0;
77
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
88

9-
contract swarmExample is usingOraclize {
9+
contract Swarm is usingOraclize {
1010

1111
string public swarmContent;
1212

1313
event newOraclizeQuery(string description);
1414
event newSwarmContent(string swarmContent);
1515

16-
function swarmExample() {
16+
function Swarm() {
1717
update();
1818
}
1919

solidity/YoutubeViews.sol

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
for a given Youtube video.
66
*/
77

8-
9-
pragma solidity ^0.4.0;
10-
11-
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
12-
13-
148
pragma solidity ^0.4.0;
159

1610
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
@@ -38,4 +32,4 @@ contract YoutubeViews is usingOraclize {
3832
NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
3933
oraclize_query("URL", 'html(https://www.youtube.com/watch?v=9bZkp7q19f0).xpath(//*[contains(@class, "watch-view-count")]/text())');
4034
}
41-
}
35+
}

solidity/computation-datasource/bitcoin/getBitcoinAddressBalance.sol solidity/computation-datasource/bitcoin/BitcoinAddressExample.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
99
contract BitcoinAddressExample is usingOraclize {
1010

1111
// Address balance in Satoshis
12-
uint256 balance;
12+
uint256 public balance;
1313

1414
event BitcoinAddressBalance(uint _balance);
1515

solidity/computation-datasource/delegatedMath/delegatedMath.sol solidity/computation-datasource/delegatedMath/DelegatedMath.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pragma solidity ^0.4.0;
77
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
88

99

10-
contract DelegatedMathExample is usingOraclize {
10+
contract DelegatedMath is usingOraclize {
1111

1212
event operationResult(uint _result);
1313

14-
function DelegatedMathExample() {
14+
function DelegatedMath() {
1515
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
1616
delegateOperation("32", "125");
1717
}

solidity/computation-datasource/url-requests/urlRequests.sol solidity/computation-datasource/url-requests/UrlRequests.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ pragma solidity ^0.4.0;
1010

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

13-
contract UrlRequestsComputation is usingOraclize {
13+
contract UrlRequests is usingOraclize {
1414

1515
event newOraclizeQuery(string description);
1616
event emitResult(string result);
1717

18-
function UrlRequestsComputation() payable {
18+
function UrlRequests() payable {
1919
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
2020
}
2121

solidity/gas-price-oracle/README.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# __A Gas Price Oracle leveraging Oraclize__
2+
 
3+
4+
## :computer: __What this is:__
5+
6+
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!
7+
8+
9+
 
10+
11+
---
12+
13+
 
14+
15+
### :fuelpump: __Gas Prices__:
16+
17+
**** Requires ~ 3,600,000 gas for deployment.
18+
19+
**** Gas for normal query to gas station is ~ 111,000.
20+
21+
**** Gas for restarting the recursive chain is ~~170,000~~ 111,000 too now.
22+
23+
**** _Recursive_ callbacks cost ~170409 so limit is 171000.
24+
25+
**** _Non recursive_ callbacks cost ~ 85,350 so their limit is set at 87,000.
26+
27+
**** Recursive restarting queries also refund excess ETH, meaning if the recursions stopped due to insufficient ETH balance, it should be topped up first.
28+
29+
 
30+
31+
***
32+
33+
 
34+
35+
36+
37+
### :mortar_board: __Instructions to test:__
38+
39+
![The passing tests!!](gas-price-oracle-tests.jpg)
40+
41+
**Pre-flight.** Make sure you have Truffle 5 installed globally:
42+
43+
**`❍ npm install -g truffle@beta`**
44+
45+
**1.** Clone the ethereum-examples repo:
46+
47+
**`❍ git clone https://github.com/oraclize/ethereum-examples.git`**
48+
49+
**2.** Switch into the gas-price-oracle directory:
50+
51+
**`❍ cd ethereum-examples/solidity/gas-price-oracle`**
52+
53+
**3.** Install dependencies:
54+
55+
**`❍ npm install`**
56+
57+
**4.** Start Truffle via:
58+
59+
**`❍ truffle develop`**
60+
61+
**5.** Start the Ethereum bridge in a new console via:
62+
63+
**`❍ npm run bridge`**
64+
65+
**6.** Once bridge is spooled up, back to first console to run the tests via:
66+
67+
**`❍ truffle_develop> test`**

0 commit comments

Comments
 (0)