Skip to content

Commit b622cb1

Browse files
authored
Merge pull request #8796 from RaynHarr/patch-1
Tellor 360 Update
2 parents dda4b96 + f529976 commit b622cb1

File tree

1 file changed

+16
-32
lines changed
  • src/content/developers/tutorials/how-to-use-tellor-as-your-oracle

1 file changed

+16
-32
lines changed

src/content/developers/tutorials/how-to-use-tellor-as-your-oracle/index.md

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Assumptions:
2222
- you have npm installed
2323
- you know how to use npm to manage dependencies
2424

25-
Tellor is a live and open-sourced oracle ready for implementation. This beginner's guide is here to showcase the ease with which one can get up and running with Tellor, providing your project with a fully decentralized and censorship-resistent oracle.
25+
Tellor is a live and open-sourced oracle ready for implementation. This beginner's guide is here to showcase the ease with which one can get up and running with Tellor, providing your project with a fully decentralized and censorship-resistant oracle.
2626

2727
## Overview {#overview}
2828

29-
Tellor is an oracle system where parties can request the value of an off-chain data point (e.g. BTC/USD) and reporters compete to add this value to an on-chain data-bank, accessible by all Ethereum smart contracts. The inputs to this data-bank are secured by a network of staked reporters. Tellor utilizes crypto-economic incentive mechanisms, rewarding honest data submissions by reporters and punishing bad actors through the issuance of Tellor’s token, Tributes (TRB) and a dispute mechanism.
29+
Tellor is an oracle system where parties can request the value of an offchain data point (e.g. BTC/USD) and reporters compete to add this value to an onchain data-bank, accessible by all Ethereum smart contracts. The inputs to this data-bank are secured by a network of staked reporters. Tellor utilizes crypto-economic incentive mechanisms, rewarding honest data submissions by reporters and punishing bad actors through the issuance of Tellor’s token, Tributes (TRB), and a dispute mechanism.
3030

3131
In this tutorial we'll go over:
3232

@@ -53,45 +53,29 @@ Here's an example:
5353
```solidity
5454
import "usingtellor/contracts/UsingTellor.sol";
5555
56-
contract BtcPriceContract is UsingTellor {
56+
contract PriceContract is UsingTellor {
57+
uint256 public btcPrice;
5758
58-
//This Contract now has access to all functions in UsingTellor
59+
//This Contract now has access to all functions in UsingTellor
5960
60-
bytes btcPrice;
61-
bytes32 btcQueryId = 0x0000000000000000000000000000000000000000000000000000000000000002;
61+
constructor(address payable _tellorAddress) UsingTellor(_tellorAddress) public {}
6262
63-
constructor(address payable _tellorAddress) UsingTellor(_tellorAddress) public {}
63+
function setBtcPrice() public {
64+
bytes memory _b = abi.encode("SpotPrice",abi.encode("btc","usd"));
65+
bytes32 _queryID = keccak256(_b);
6466
65-
function setBtcPrice() public {
66-
bool _didGet;
6767
uint256 _timestamp;
68+
bytes _value;
6869
69-
(_didGet, btcPrice, _timestamp) = getCurrentValue(btcQueryId);
70+
(_value, _timestamp) = getDataBefore(_queryId, block.timestamp - 15 minutes);
71+
72+
btcPrice = abi.decode(_value,(uint256));
7073
}
7174
}
7275
```
7376

74-
**Want to try a different data feed? Check out the list of supported data feeds here:
75-
[Current Data Feeds](https://docs.tellor.io/tellor/integration/data-feed-ids)**
76-
77-
## Addresses: {#addresses}
78-
79-
Mainnet: [`0x88df592f8eb5d7bd38bfef7deb0fbc02cf3778a0`](https://etherscan.io/address/0x88df592f8eb5d7bd38bfef7deb0fbc02cf3778a0#code)
80-
81-
#### Looking to do some testing first? See the list below for our active testnet addresses: {#looking-to-do-some-testing-first-see-the-list-below-for-our-active-testnet-addresses}
82-
83-
Rinkeby: [`0x88df592f8eb5d7bd38bfef7deb0fbc02cf3778a0`](https://rinkeby.etherscan.io/address/0x88df592f8eb5d7bd38bfef7deb0fbc02cf3778a0#code)
84-
85-
Kovan: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7`](https://kovan.etherscan.io/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7#code)
86-
87-
Ropsten: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7`](https://ropsten.etherscan.io/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7#code)
88-
89-
Goerli: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7`](https://goerli.etherscan.io/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7#code)
90-
91-
BSC Testnet: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7 `](https://testnet.bscscan.com/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7#code)
92-
93-
Polygon Mumbai Testnet: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7 `](https://mumbai.polygonscan.com/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7/contracts#code)
77+
For a complete list of contract addresses refer [here](https://docs.tellor.io/tellor/the-basics/contracts-reference).
9478

95-
Arbitrum Testnet: [`0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7 `](https://rinkeby-explorer.arbitrum.io/address/0x3477EB82263dabb59AC0CAcE47a61292f28A2eA7)
79+
For ease of use, the UsingTellor repo comes with a version of the [Tellor Playground](https://github.com/tellor-io/TellorPlayground) contract for easier integration. See [here](https://github.com/tellor-io/sampleUsingTellor#tellor-playground) for a list of helpful functions.
9680

97-
#### For a more robust implementation of the Tellor oracle, check out the full list of available functions [here.](https://github.com/tellor-io/usingtellor/blob/master/README.md) {#for-a-more-robust-implementation-of-the-tellor-oracle-check-out-the-full-list-of-available-functions-here}
81+
For a more robust implementation of the Tellor oracle, check out the full list of available functions [here](https://github.com/tellor-io/usingtellor/blob/master/README.md).

0 commit comments

Comments
 (0)