Skip to content

Commit 13db2e1

Browse files
Adán Sánchez de Pedro Crespogitbook-bot
Adán Sánchez de Pedro Crespo
authored andcommitted
GITBOOK-196: Add Dynamic Requests Example
1 parent 29e4578 commit 13db2e1

File tree

11 files changed

+227
-20
lines changed

11 files changed

+227
-20
lines changed

SUMMARY.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* [Klaytn Price Feeds](smart-contracts/witnet-data-feeds/addresses/klaytn-price-feeds.md)
4545
* [Mantle Price Feeds](smart-contracts/witnet-data-feeds/addresses/metis.md)
4646
* [Meter Price Feeds](smart-contracts/witnet-data-feeds/addresses/meter-price-feeds.md)
47-
* [Metis Price Feeds](smart-contracts/witnet-data-feeds/addresses/metis-1.md)
47+
* [Metis Price Feeds](smart-contracts/price-feeds/addresses/metis.md)
4848
* [Moonbeam Price Feeds](smart-contracts/price-feeds/addresses/moonbeam.md)
4949
* [OKXChain Price Feeds](smart-contracts/witnet-data-feeds/addresses/okxchain-price-feeds.md)
5050
* [Optimism Price Feeds](smart-contracts/witnet-data-feeds/addresses/optimism-price-feeds.md)
@@ -66,11 +66,12 @@
6666
* [HTTP GET Requests in Solidity](smart-contracts/witnet-web-oracle/make-a-get-request.md)
6767
* [HTTP POST Requests in Solidity](smart-contracts/witnet-web-oracle/make-a-post-request.md)
6868
* [Query GraphQL APIs in Solidity](smart-contracts/witnet-web-oracle/query-graphql-apis-in-solidity.md)
69+
* [Dynamic Requests in Solidity](smart-contracts/witnet-web-oracle/dynamic-requests-in-solidity.md)
6970
* [UsingWitnet Inheritance](smart-contracts/witnet-web-oracle/usingwitnet-inheritance.md)
7071
* [API Reference](smart-contracts/witnet-web-oracle/api-reference/README.md)
71-
* [Solidity API](smart-contracts/witnet-web-oracle/api-reference/api-solidity/README.md)
72+
* [Solidity API](smart-contracts/witnet-web-oracle/api-reference/api-solidity.md)
7273
* [Solidity Contracts](smart-contracts/witnet-web-oracle/api-reference/api-solidity/solidity-contracts/README.md)
73-
* [WitnetRequestBoard](smart-contracts/witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md)
74+
* [WitnetRequestBoard](smart-contracts/witnet-web-oracle/witnet-request-board.md)
7475
* [Javascript API](smart-contracts/witnet-web-oracle/api-reference/api-javascript.md)
7576
* [Multi-chain Addresses](smart-contracts/witnet-web-oracle/contracts-addresses.md)
7677

smart-contracts/price-feeds/addresses/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ You can request support for additional chains using [this form](https://tally.so
8282
[meter-price-feeds.md](../../witnet-data-feeds/addresses/meter-price-feeds.md)
8383
{% endcontent-ref %}
8484

85-
{% content-ref url="../../witnet-data-feeds/addresses/metis-1.md" %}
86-
[metis-1.md](../../witnet-data-feeds/addresses/metis-1.md)
85+
{% content-ref url="metis.md" %}
86+
[metis.md](metis.md)
8787
{% endcontent-ref %}
8888

8989
{% content-ref url="moonbeam.md" %}

smart-contracts/witnet-data-feeds/addresses/metis-1.md renamed to smart-contracts/price-feeds/addresses/metis.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ description: >-
2222
Clicking on any of the captions above will take you to the corresponding view in the [**Data Feeds Explorer** website](https://feeds.witnet.io), where not only the whole price timeline can be checked for the corresponding currency pair, but also the **Price Feed** contract currently serving the price updates, as well as the hashes of the Witnet transactions that solved every single update.
2323
{% endhint %}
2424

25-
{% content-ref url="../price-feeds-registry.md" %}
26-
[price-feeds-registry.md](../price-feeds-registry.md)
25+
{% content-ref url="../../witnet-data-feeds/price-feeds-registry.md" %}
26+
[price-feeds-registry.md](../../witnet-data-feeds/price-feeds-registry.md)
2727
{% endcontent-ref %}
2828

29-
{% content-ref url="../triggering-conditions.md" %}
30-
[triggering-conditions.md](../triggering-conditions.md)
29+
{% content-ref url="../../witnet-data-feeds/triggering-conditions.md" %}
30+
[triggering-conditions.md](../../witnet-data-feeds/triggering-conditions.md)
3131
{% endcontent-ref %}

smart-contracts/supported-chains.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ description: >-
2828
| **KuCoin Community Chain (KCC)** | <ul><li>mainnet</li><li>testnet</li></ul> | <ul><li><a href="price-feeds/addresses/kcc.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#kucoin-community-chain">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#kucoin-community-chain">HTTP GET/POST</a></li></ul> |
2929
| **Mantle** | <ul><li>mainnet</li><li>testnet</li></ul> | <ul><li><a href="witnet-data-feeds/addresses/metis.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#mantle">Randomness</a></li><li><a href="https://app.gitbook.com/o/FBZI0TiYcvmYWo7cdgni/s/mmENEsyOrIbtAF1SzG2l/~/changes/202/smart-contracts/witnet-web-oracle/contracts-addresses#mantle">HTTP GET/POST</a></li></ul> |
3030
| **Meter** | <ul><li>testnet</li></ul> | <ul><li><a href="witnet-data-feeds/addresses/meter-price-feeds.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#meter">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#meter">HTTP GET/POST</a></li></ul> |
31-
| **Metis** | <ul><li>andromeda</li><li>goerli</li></ul> | <ul><li><a href="witnet-data-feeds/addresses/metis-1.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#metis">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#metis">HTTP GET/POST</a></li></ul> |
31+
| **Metis** | <ul><li>andromeda</li><li>goerli</li></ul> | <ul><li><a href="price-feeds/addresses/metis.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#metis">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#metis">HTTP GET/POST</a></li></ul> |
3232
| **Moonbeam** | <ul><li>mainnet</li><li>moonriver</li><li>moonbase</li></ul> | <ul><li><a href="price-feeds/addresses/moonbeam.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#moonbeam">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#moonbeam">HTTP GET/POST</a></li></ul> |
3333
| **OKXChain (OKC)** | <ul><li>testnet</li></ul> | <ul><li><a href="price-feeds/addresses/okxchain.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#okx-chain">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#okx-chain">HTTP GET/POST</a></li></ul> |
3434
| **Optimism** | <ul><li>mainnet</li><li>goerli</li></ul> | <ul><li><a href="witnet-data-feeds/addresses/optimism-price-feeds.md">Price Feeds</a></li><li><a href="witnet-randomness-oracle/contract-addresses.md#optimism">Randomness</a></li><li><a href="witnet-web-oracle/contracts-addresses.md#optimism">HTTP GET/POST</a></li></ul> |

smart-contracts/witnet-data-feeds/api-reference.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ Functions defined within the [`IWitnetRequest`](https://github.com/witnet/witnet
5555

5656
Public function inherited from the [`UsingWitnet`](https://github.com/witnet/witnet-solidity-bridge/blob/master/contracts/UsingWitnet.sol) abstract contract:
5757

58-
| **Function** | **Description** |
59-
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60-
| `witnet()` | Returns the immutable address of the [**Witnet Request Board**](../witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md) that interacts with the Witnet oracle's sidechain, for both posting new data requests and receiving results from it. |
58+
| **Function** | **Description** |
59+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60+
| `witnet()` | Returns the immutable address of the [**Witnet Request Board**](../witnet-web-oracle/witnet-request-board.md) that interacts with the Witnet oracle's sidechain, for both posting new data requests and receiving results from it. |

smart-contracts/witnet-randomness-oracle/api-reference.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Public functions inherited from the [`Clonable`](https://github.com/witnet/witne
3636

3737
Public function inherited from the [`UsingWitnet`](https://github.com/witnet/witnet-solidity-bridge/blob/master/contracts/UsingWitnet.sol) abstract contract:
3838

39-
| **Function** | **Description** |
40-
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41-
| `witnet()` | Returns the immutable address of the [**Witnet Request Board**](../witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md) that interacts with the Witnet oracle's sidechain, for both posting new data requests and receiving results from it. |
39+
| **Function** | **Description** |
40+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41+
| `witnet()` | Returns the immutable address of the [**Witnet Request Board**](../witnet-web-oracle/witnet-request-board.md) that interacts with the Witnet oracle's sidechain, for both posting new data requests and receiving results from it. |
4242

4343
## WitnetRequestRandomness contract
4444

smart-contracts/witnet-randomness-oracle/generating-randomness.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
There are two major approaches to generate unpredictable and malleable randomness from the Witnet oracle:
44

55
* Using the [**WitnetRandomness Contract**](randomness-contract.md), also known as the «_**Witnet Randomness Oracle**_», that can be used by practically all kind of dapps, and that it has been already pre-deployed by the Witnet Foundation on [multiple chains](../witnet-web-oracle/contracts-addresses.md).
6-
* Posting a low-level [**WitnetRequestRandomness** ](randomness-requests.md)to the [WitnetRequestBoard ](../witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md)entrypoint.
6+
* Posting a low-level [**WitnetRequestRandomness** ](randomness-requests.md)to the [WitnetRequestBoard ](../witnet-web-oracle/witnet-request-board.md)entrypoint.

smart-contracts/witnet-randomness-oracle/randomness-requests.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Low-level Requests
22

3-
The straight way to fetch randomness from the Witnet oracle is by posting a low-level randomness data request to the [**WitnetRequestBoard**](../witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md).
3+
The straight way to fetch randomness from the Witnet oracle is by posting a low-level randomness data request to the [**WitnetRequestBoard**](../witnet-web-oracle/witnet-request-board.md).
44

55
However, you will then need to add logic within your smart contract as to await for an answer from the Witnet side-chain and handle corner-case revert situations at the Witnet level, before feeding your favourite _Pseudo Random Number Generator_ (PRNG) algorithm with the 32-byte random seed provided by the Witnet oracle.
66

7-
Besides, you or your contract will have to pay the required fee every time a randomness request is posted to the [WitnetRequestBoard](../witnet-web-oracle/api-reference/api-solidity/solidity-contracts/witnet-request-board.md).
7+
Besides, you or your contract will have to pay the required fee every time a randomness request is posted to the [WitnetRequestBoard](../witnet-web-oracle/witnet-request-board.md).
88

99
{% hint style="success" %}
1010
If your contract inherits from the [**UsingWitnet** abstract contract](../witnet-web-oracle/usingwitnet-inheritance.md), the reward will be estimated automatically. However, you should make sure that everytime a data request is posted, enough funds (i.e. EVM native currency) are provided as to cover the posting fee required by the **WitnetRequestBoard**.

smart-contracts/witnet-web-oracle/api-reference/api-solidity/README.md renamed to smart-contracts/witnet-web-oracle/api-reference/api-solidity.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Solidity API Reference
1+
# Solidity API
22

33
{% hint style="info" %}
44
This section is under construction. If you need more information, you can ask in [Discord](https://discord.gg/X4uurfP) or [Telegram](https://t.me/witnetio).

0 commit comments

Comments
 (0)