From 598dd8f492845521cc76d15ec4c13832449acb02 Mon Sep 17 00:00:00 2001 From: Ale Banzas Date: Wed, 1 Feb 2023 14:26:54 +0100 Subject: [PATCH 1/4] changing folder name --- docs/tools/oracles/{supraoracles => supra-oracles}/README.md | 0 docs/tools/oracles/{supraoracles => supra-oracles}/vrf.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename docs/tools/oracles/{supraoracles => supra-oracles}/README.md (100%) rename docs/tools/oracles/{supraoracles => supra-oracles}/vrf.md (100%) diff --git a/docs/tools/oracles/supraoracles/README.md b/docs/tools/oracles/supra-oracles/README.md similarity index 100% rename from docs/tools/oracles/supraoracles/README.md rename to docs/tools/oracles/supra-oracles/README.md diff --git a/docs/tools/oracles/supraoracles/vrf.md b/docs/tools/oracles/supra-oracles/vrf.md similarity index 100% rename from docs/tools/oracles/supraoracles/vrf.md rename to docs/tools/oracles/supra-oracles/vrf.md From 316672290a5ed4f0c7b31ca313465446883b82ea Mon Sep 17 00:00:00 2001 From: Ale Banzas Date: Wed, 1 Feb 2023 14:30:06 +0100 Subject: [PATCH 2/4] sidebar --- sidebars.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sidebars.js b/sidebars.js index 9d223195..d375689e 100644 --- a/sidebars.js +++ b/sidebars.js @@ -609,10 +609,10 @@ const sidebars = { { type: 'category', label: 'SupraOracles', - link: {type: 'doc', id: 'tools/oracles/supraoracles/README'}, + link: {type: 'doc', id: 'tools/oracles/supra-oracles/README'}, collapsed: true, items: [ - 'tools/oracles/supraoracles/vrf', + 'tools/oracles/supra-oracles/vrf', ], }, From 83de345e5a372317ac22ba0bb39763ac4968d332 Mon Sep 17 00:00:00 2001 From: Ale Banzas Date: Wed, 1 Feb 2023 15:14:51 +0100 Subject: [PATCH 3/4] tabs should contain more than one element --- .../{supra-oracles => supraoracles}/README.md | 31 ------------------ .../{supra-oracles => supraoracles}/vrf.md | 32 +------------------ sidebars.js | 4 +-- 3 files changed, 3 insertions(+), 64 deletions(-) rename docs/tools/oracles/{supra-oracles => supraoracles}/README.md (90%) rename docs/tools/oracles/{supra-oracles => supraoracles}/vrf.md (95%) diff --git a/docs/tools/oracles/supra-oracles/README.md b/docs/tools/oracles/supraoracles/README.md similarity index 90% rename from docs/tools/oracles/supra-oracles/README.md rename to docs/tools/oracles/supraoracles/README.md index 4acc112a..5b7eba39 100644 --- a/docs/tools/oracles/supra-oracles/README.md +++ b/docs/tools/oracles/supraoracles/README.md @@ -26,18 +26,12 @@ To get started, you will want to visit [SupraOracles' docs site](https://supra Add the following code to the Solidity smart contract that you wish to retrieve an S-Value. - - - ```solidity interface ISupraSValueFeed { function checkPrice(string memory marketPair) external view returns (int256 price, uint256 timestamp); } ``` - - - This creates the interface that you will later apply in order to fetch a price from SupraOracles. @@ -53,9 +47,6 @@ For Gnosis Chiado TestNet, the address is: When you have the proper address, create an instance of the S-Value Feed using the interface we previously defined for Gnosis Chiado TestNet: - - - ```solidity contract ISupraSValueFeedExample { ISupraSValueFeed internal sValueFeed; @@ -66,17 +57,10 @@ contract ISupraSValueFeedExample { } ``` - - - - ### Step 3: Get The S-Value Crypto Price Now you can simply access the S-Value Crypto Price of our supported market pairs. In this step, we'll get the price of ETH/USDT (eth_usdt) by applying the following code to our Smart Contract. - - - ```solidity function getEthUsdtPrice() external view returns (int) { ( @@ -88,14 +72,8 @@ function getEthUsdtPrice() external view returns (int) { } ``` - - - Here's an example of what your implementation should look like. - - - ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; @@ -123,16 +101,10 @@ contract ISupraSValueFeedExample { } ``` - - - You now have a method in your Smart Contract that you can call at any time to retrieve the price of ETH in USDT. ### Extra: S-Value Feeds with ethers.js - - - ```js // example assumes that the ethers library has been imported and is accessible within your scope const getEthUsdtPrice = async () => { @@ -148,9 +120,6 @@ const getEthUsdtPrice = async () => { getEthUsdtPrice() ``` - - - For additional tutorials and guides based on example use-cases, please refer to the [Supra docs](https://supraoracles.com/docs/additional-guides). diff --git a/docs/tools/oracles/supra-oracles/vrf.md b/docs/tools/oracles/supraoracles/vrf.md similarity index 95% rename from docs/tools/oracles/supra-oracles/vrf.md rename to docs/tools/oracles/supraoracles/vrf.md index bd048feb..7505f23f 100644 --- a/docs/tools/oracles/supra-oracles/vrf.md +++ b/docs/tools/oracles/supraoracles/vrf.md @@ -28,9 +28,6 @@ To get started, you will want to visit [SupraOracles' docs site](https://supraor Add the following code to the requester contract i.e, the contract which uses VRF as a service. You can also add the code in a separate Interface and inherit the interface in the requester contract. - - - ```solidity interface ISupraRouter { function generateRequest(string memory _functionSig , uint8 _rngCount, uint256 _numConfirmations) external returns(uint256); @@ -38,9 +35,6 @@ interface ISupraRouter { } ``` - - - This interface will help the requester contract interact with the Supra Router contract and through which the requester contract can use the VRF service. @@ -55,10 +49,6 @@ For Gnosis Chiado TestNet, the address is: We’ll store the set the address within the constructor and use it later to interact with the interface. - - - - ```solidity contract ExampleContract { address supraAddr; @@ -69,9 +59,6 @@ contract ExampleContract { } ``` - - - ### Step 3: Use the VRF service and request a Random Number In this step, we'll use the “generateRequest” function of the Supra Router Contract to create a request for random numbers. There are two modes for the "generateRequest" function. The only difference between them is that you can optionally provide a client-side input, which will also be part of the payload being threshold signed to provide randomness. @@ -83,9 +70,6 @@ Supra's VRF process requires splitting the contract logic into two functions. * The request function - the signature of this function is up to the developer * The callback function - the signature must be of the form **“uint256 nonce, uint256[] calldata rngList”** - - - ```solidity function exampleRNG() external { //Function validation and logic @@ -102,25 +86,16 @@ function exampleRNG() external { } ``` - - - ### Step 4 - Add the validation in the callback function of requester contract Inside the callback function where the requester contract wants the random number (in this example the callback function is exampleCallback), the requester contract will have to add the validation such that only the Supra router contract can call the function. The validation is necessary to protect against malicious contracts/users executing the callback with fake data. - - - ```solidity function exampleCallback(uint256 _nonce ,uint256[] _rngList) external { require(msg.sender == supraAddr); // Following the required logic of the function } - ``` - - - +``` ### Example Implementation @@ -130,9 +105,6 @@ In the example below, * Then the callback function prints the random numbers requested by a specific user and it has the signature: myCallbackUsername(uint256 nonce, uint256[] calldata rngList) Once Supra generates the random number and it is verified by the on-chain logic to be authentic, myCallbackUsername is executed by the Supra Router, which completes the second half of the process. The nonce from the first argument is used to look up the username that originated the request. - - - ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; @@ -170,8 +142,6 @@ contract Interaction { } } ``` - - For additional tutorials and guides based on example use-cases, please refer to the [Supra Docs](https://supraoracles.com/docs/additional-guides). diff --git a/sidebars.js b/sidebars.js index d375689e..9d223195 100644 --- a/sidebars.js +++ b/sidebars.js @@ -609,10 +609,10 @@ const sidebars = { { type: 'category', label: 'SupraOracles', - link: {type: 'doc', id: 'tools/oracles/supra-oracles/README'}, + link: {type: 'doc', id: 'tools/oracles/supraoracles/README'}, collapsed: true, items: [ - 'tools/oracles/supra-oracles/vrf', + 'tools/oracles/supraoracles/vrf', ], }, From 5fb19e45cfe8a13c0f37ef6a4bc73d809051aa88 Mon Sep 17 00:00:00 2001 From: Ale Banzas Date: Wed, 1 Feb 2023 15:44:39 +0100 Subject: [PATCH 4/4] tab issue --- docs/node/guide/server/_partials/_install-initial.md | 1 + .../validator/_partials/clients/_install_validator_lighthouse.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/node/guide/server/_partials/_install-initial.md b/docs/node/guide/server/_partials/_install-initial.md index 57130340..f4fa106b 100644 --- a/docs/node/guide/server/_partials/_install-initial.md +++ b/docs/node/guide/server/_partials/_install-initial.md @@ -38,6 +38,7 @@ import JwtGenerationPartial from '@site/docs/node/guide/server/_partials/_jwt-ge Place the `jwt.hex` file in the jwtsecret folder, so it can be referenced in the next steps as `../jwtsecret/jwt.hex` for the `consensus` and `execution` clients. ::: + diff --git a/docs/node/guide/validator/_partials/clients/_install_validator_lighthouse.md b/docs/node/guide/validator/_partials/clients/_install_validator_lighthouse.md index acc15eb5..42cba646 100644 --- a/docs/node/guide/validator/_partials/clients/_install_validator_lighthouse.md +++ b/docs/node/guide/validator/_partials/clients/_install_validator_lighthouse.md @@ -13,6 +13,7 @@ Lighthouse only runs on Linux. To run it on Windows, [Install Linux on Windows w ::: +