Skip to content

Commit 4a9a6b7

Browse files
authored
Merge pull request #2708 from 0xPolygon/0xsajal/supra-
Added supra oracle doc and updated bootnodes
2 parents 04b3830 + 3370ebf commit 4a9a6b7

File tree

3 files changed

+288
-2
lines changed

3 files changed

+288
-2
lines changed

docs/pos/reference/seed-and-bootnodes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ This document provides a comprehensive list of seeds and bootnodes for both the
1616

1717
```bash
1818
enode://07bc4cf87ff8f4e7dc51280991809940f26e846c944609ae4726309be73742a830040cd783989f6941e1b41c02405834bc6365059403a59ca9255ac695156235@34.89.75.187:30303
19-
enode://f81234949f791624d1196eb3a780490f5a8199b476c3522335e6d76ca96aa9155ad21c308864b1e22ab9a53136b486520b33515310f8f18485ab471826ae9ded@34.142.43.249:30303
19+
enode://2c3be2e637a68dc694498a44b6e0d57b5c762925ea97f941079a91f8a080b032fe2eb9e6c3230076e9fb046f626b5dcd3fb045dc9c194689a359aa7167ae0f6c@34.142.43.249:30303
2020
enode://a0bc4dd2b59370d5a375a7ef9ac06cf531571005ae8b2ead2e9aaeb8205168919b169451fb0ef7061e0d80592e6ed0720f559bd1be1c4efb6e6c4381f1bdb986@35.246.99.203:30303
2121
enode://f2b0d50e0b843d38ddcab59614f93065e2c82130100032f86ae193eb874505de12fcaf12502dfd88e339b817c0b374fa4b4f7c4d5a4d1aa04f29c503d95e0228@35.197.233.240:30303
2222
enode://8a3f21c293c913a1148116a295aa69fdf41b9c5b0b0628d49be751aa8c025ae2ec1973d6d84cea8e2aba5541b5d76219dfaae41a124d42d0f56d4e1af50b74f8@35.246.95.65:30303
2323
enode://f5cfe35f47ed928d5403aa28ee616fd64ed7daa527b5ae6a7bc412ca25eaad9b6bf2f776144fd9f8e7e9c80b5360a9c03b67f1d47ea88767def7d391cc7e0cd1@34.105.180.11:30303
2424
enode://fc7624241515f9d5e599a396362c29de92b13a048ad361c90dd72286aa4cca835ba65e140a46ace70cc4dcb18472a476963750b3b69d958c5f546d48675880a8@34.147.169.102:30303
25-
enode://a36848f536ff6c431e9e3ccbb2f859a5c71f6e5e2d282d8dc6e0199618256444c5032f4cbf7e8579da9fa4d30251b7a55a2d6d3711516112e8dced057c8596c6@34.89.55.74:30303
25+
enode://7400e4bc70c56de26d5d240474a1b78af0bf8f0db567edfa851c9724ed697ca7692a92483369e9633d4342a036d10223958007160765d0317a1073f86f2a80c8@34.89.55.74:30303
2626
```
2727

2828
### Heimdall

docs/tools/oracles/supra.md

Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
!!! info "Content disclaimer"
2+
3+
Please view the third-party content disclaimer [here](https://github.com/0xPolygon/polygon-docs/blob/main/CONTENT_DISCLAIMER.md).
4+
5+
# Supra Oracle Integration
6+
7+
**Supra** is a MultiVM Layer 1 network designed for high performance, interoperability, and security. It has achieved over **500,000 transactions per second (TPS)** across **300 nodes** with **sub-second consensus latency**, marking it as one of the fastest and most scalable Layer 1 solutions available. Supra is also the first blockchain to provide full vertical integration of **native oracles, DVRF, bridging, and automation**, enabling developers to build powerful **Super dApps** within a unified ecosystem.
8+
9+
---
10+
11+
## Key Features
12+
13+
### Lightning Fast Speeds
14+
Supra provides near-instant data refresh rates with full on-chain finality, reaching consensus in **600–900 milliseconds**. This makes it one of the **fastest-to-finality oracle networks** available.
15+
16+
### Truly Decentralized
17+
Supra’s oracles are decentralized at every level—from **multi-source data collection** to a **globally distributed node network**—ensuring reliability and trustless data delivery.
18+
19+
### Toughened Security
20+
A randomized node network and built-in fail-safes help **maximize security** and prevent manipulation or downtime.
21+
22+
### Natively Interoperable
23+
Supra is **blockchain agnostic**, offering compatibility with **58+ networks** including **Polygon, Ethereum, Arbitrum, Optimism, Avalanche, and Aptos**, among others.
24+
25+
### Massive Scalability
26+
Supra’s novel consensus mechanism enables **hundreds of thousands of transactions per second** without sacrificing security or decentralization.
27+
28+
---
29+
30+
## Supra Oracle Resources
31+
32+
Explore Supra’s documentation for more information on:
33+
34+
- [**Data Feeds**](#)
35+
- [**APIs for Real-Time and Historical Data**](#)
36+
- [**Indices**](#)
37+
38+
---
39+
40+
# Pull Oracle Integration
41+
42+
Supra’s **Pull Oracle** allows developers to retrieve proof data directly from a gRPC server and interact with smart contracts programmatically.
43+
44+
## Installation
45+
46+
Clone the repository or download the source code, then install the required dependencies:
47+
48+
```bash
49+
npm install
50+
```
51+
52+
## Configuration
53+
54+
Before using the library, configure the parameters in your `main.js` file.
55+
56+
### gRPC Server Address
57+
58+
**Mainnet:**
59+
```
60+
mainnet-dora-2.supra.com:443
61+
```
62+
63+
**Testnet:**
64+
```
65+
testnet-dora-2.supra.com:443
66+
```
67+
68+
### REST Server Address
69+
70+
**Mainnet:**
71+
```
72+
https://rpc-mainnet-dora-2.supra.com
73+
```
74+
75+
**Testnet:**
76+
```
77+
https://rpc-testnet-dora-2.supra.com
78+
```
79+
80+
### Pair Indexes
81+
82+
Set the desired pair indexes as an array (example):
83+
84+
```javascript
85+
const pairIndexes = [0, 21, 61, 49];
86+
```
87+
88+
### Chain Type
89+
90+
Specify the chain type as EVM:
91+
92+
```javascript
93+
const chainType = 'evm';
94+
```
95+
96+
### RPC Configuration
97+
98+
Set the RPC URL for your target blockchain network:
99+
100+
```javascript
101+
const web3 = new Web3(new Web3.providers.HttpProvider('<RPC URL>'));
102+
```
103+
104+
---
105+
106+
## Customization
107+
108+
You can modify the smart contract interaction logic within the `callContract` function.
109+
110+
### Smart Contract ABI
111+
112+
Update the path to your ABI JSON file:
113+
114+
```javascript
115+
const contractAbi = require("../resources/abi.json");
116+
```
117+
118+
### Smart Contract Address
119+
120+
Specify your contract address:
121+
122+
```javascript
123+
const contractAddress = '<CONTRACT ADDRESS>';
124+
```
125+
126+
### Function Call
127+
128+
Modify the function call as per your contract. Example:
129+
130+
```javascript
131+
const txData = contract.methods.GetPairPrice(hex, 0).encodeABI();
132+
```
133+
134+
### Gas Estimation
135+
136+
Estimate gas for your function call:
137+
138+
```bash
139+
const gasEstimate = await contract.methods.GetPairPrice(hex, 0).estimateGas({ from: "<WALLET ADDRESS>" });
140+
```
141+
142+
### Transaction Object
143+
144+
Customize the transaction parameters:
145+
146+
```bash
147+
const transactionObject = {
148+
from: "<WALLET ADDRESS>",
149+
to: contractAddress,
150+
data: txData,
151+
gas: gasEstimate,
152+
gasPrice: await web3.eth.getGasPrice()
153+
};
154+
```
155+
156+
### Private Key Signing
157+
158+
Sign the transaction using your private key:
159+
160+
```bash
161+
const signedTransaction = await web3.eth.accounts.signTransaction(transactionObject, "<PRIVATE KEY>");
162+
```
163+
164+
---
165+
166+
## Running the Application
167+
168+
To start the application and initiate proof data fetching, run:
169+
170+
```bash
171+
node main.js
172+
```
173+
174+
This will retrieve data from Supra’s servers and interact with your smart contract using the defined configurations.
175+
176+
---
177+
178+
# Push Oracle Integration
179+
180+
Supra’s **Push Oracle** enables on-chain access to real-time data feeds (S-Values) through Solidity interfaces.
181+
182+
## Step 1: Create the S-Value Interface
183+
184+
Add the following code to your contract to define the data structures and functions needed to retrieve S-Values:
185+
186+
```solidity
187+
pragma solidity 0.8.19;
188+
189+
interface ISupraSValueFeed {
190+
struct priceFeed {
191+
uint256 round;
192+
uint256 decimals;
193+
uint256 time;
194+
uint256 price;
195+
}
196+
197+
struct derivedData {
198+
int256 roundDifference;
199+
uint256 derivedPrice;
200+
uint256 decimals;
201+
}
202+
203+
function getSvalue(uint256 _pairIndex) external view returns (priceFeed memory);
204+
205+
function getSvalues(uint256[] memory _pairIndexes) external view returns (priceFeed[] memory);
206+
207+
function getDerivedSvalue(uint256 pair_id_1, uint256 pair_id_2, uint256 operation)
208+
external
209+
view
210+
returns (derivedData memory);
211+
212+
function getTimestamp(uint256 _tradingPair) external view returns (uint256);
213+
}
214+
```
215+
216+
---
217+
218+
## Step 2: Configure the S-Value Feed Address
219+
220+
Initialize the S-Value feed contract in your smart contract constructor:
221+
222+
```solidity
223+
contract ISupraSValueFeedExample {
224+
ISupraSValueFeed internal sValueFeed;
225+
226+
constructor() {
227+
sValueFeed = ISupraSValueFeed(0xE92D276bBE234869Ecc9b85101F423c6bD26654A);
228+
}
229+
}
230+
```
231+
232+
*Note: Replace the above address with the correct network-specific Supra contract address.*
233+
234+
---
235+
236+
## Step 3: Retrieve the S-Value Data
237+
238+
Use the following functions to fetch single or multiple S-Values and to derive new data pairs.
239+
240+
```solidity
241+
function getPrice(uint256 _priceIndex)
242+
external
243+
view
244+
returns (ISupraSValueFeed.priceFeed memory)
245+
{
246+
return sValueFeed.getSvalue(_priceIndex);
247+
}
248+
249+
function getPriceForMultiplePair(uint256[] memory _pairIndexes)
250+
external
251+
view
252+
returns (ISupraSValueFeed.priceFeed[] memory)
253+
{
254+
return sValueFeed.getSvalues(_pairIndexes);
255+
}
256+
257+
function getDerivedValueOfPair(uint256 pair_id_1, uint256 pair_id_2, uint256 operation)
258+
external
259+
view
260+
returns (ISupraSValueFeed.derivedData memory)
261+
{
262+
return sValueFeed.getDerivedSvalue(pair_id_1, pair_id_2, operation);
263+
}
264+
```
265+
266+
---
267+
268+
## Recommended Best Practices
269+
270+
Implement an **access-controlled function** to update the Supra feed contract address for future upgrades:
271+
272+
```solidity
273+
function updateSupraSvalueFeed(ISupraSValueFeed _newSValueFeed)
274+
external
275+
onlyOwner
276+
{
277+
sValueFeed = _newSValueFeed;
278+
}
279+
```
280+
281+
This approach ensures your contract remains upgradeable while maintaining secure access control over Oracle configurations.
282+
283+
---
284+
285+
By integrating **Supra Oracles**, developers gain access to a high-speed, decentralized, and secure data layer—purpose-built for real-world use cases across DeFi, gaming, and Web3 applications.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ nav:
440440
- Getting started: tools/oracles/getting-started.md
441441
- Chainlink: tools/oracles/chainlink.md
442442
- Chronicle: tools/oracles/chronicle.md
443+
- Supra: tools/oracles/supra.md
443444

444445
- Wallets:
445446
- Getting started: tools/wallets/getting-started.md

0 commit comments

Comments
 (0)