Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/pos/reference/seed-and-bootnodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ This document provides a comprehensive list of seeds and bootnodes for both the

```bash
enode://07bc4cf87ff8f4e7dc51280991809940f26e846c944609ae4726309be73742a830040cd783989f6941e1b41c02405834bc6365059403a59ca9255ac695156235@34.89.75.187:30303
enode://f81234949f791624d1196eb3a780490f5a8199b476c3522335e6d76ca96aa9155ad21c308864b1e22ab9a53136b486520b33515310f8f18485ab471826ae9ded@34.142.43.249:30303
enode://2c3be2e637a68dc694498a44b6e0d57b5c762925ea97f941079a91f8a080b032fe2eb9e6c3230076e9fb046f626b5dcd3fb045dc9c194689a359aa7167ae0f6c@34.142.43.249:30303
enode://a0bc4dd2b59370d5a375a7ef9ac06cf531571005ae8b2ead2e9aaeb8205168919b169451fb0ef7061e0d80592e6ed0720f559bd1be1c4efb6e6c4381f1bdb986@35.246.99.203:30303
enode://f2b0d50e0b843d38ddcab59614f93065e2c82130100032f86ae193eb874505de12fcaf12502dfd88e339b817c0b374fa4b4f7c4d5a4d1aa04f29c503d95e0228@35.197.233.240:30303
enode://8a3f21c293c913a1148116a295aa69fdf41b9c5b0b0628d49be751aa8c025ae2ec1973d6d84cea8e2aba5541b5d76219dfaae41a124d42d0f56d4e1af50b74f8@35.246.95.65:30303
enode://f5cfe35f47ed928d5403aa28ee616fd64ed7daa527b5ae6a7bc412ca25eaad9b6bf2f776144fd9f8e7e9c80b5360a9c03b67f1d47ea88767def7d391cc7e0cd1@34.105.180.11:30303
enode://fc7624241515f9d5e599a396362c29de92b13a048ad361c90dd72286aa4cca835ba65e140a46ace70cc4dcb18472a476963750b3b69d958c5f546d48675880a8@34.147.169.102:30303
enode://a36848f536ff6c431e9e3ccbb2f859a5c71f6e5e2d282d8dc6e0199618256444c5032f4cbf7e8579da9fa4d30251b7a55a2d6d3711516112e8dced057c8596c6@34.89.55.74:30303
enode://7400e4bc70c56de26d5d240474a1b78af0bf8f0db567edfa851c9724ed697ca7692a92483369e9633d4342a036d10223958007160765d0317a1073f86f2a80c8@34.89.55.74:30303
```

### Heimdall
Expand Down
285 changes: 285 additions & 0 deletions docs/tools/oracles/supra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
!!! info "Content disclaimer"

Please view the third-party content disclaimer [here](https://github.com/0xPolygon/polygon-docs/blob/main/CONTENT_DISCLAIMER.md).

# Supra Oracle Integration

**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.

---

## Key Features

### Lightning Fast Speeds
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.

### Truly Decentralized
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.

### Toughened Security
A randomized node network and built-in fail-safes help **maximize security** and prevent manipulation or downtime.

### Natively Interoperable
Supra is **blockchain agnostic**, offering compatibility with **58+ networks** including **Polygon, Ethereum, Arbitrum, Optimism, Avalanche, and Aptos**, among others.

### Massive Scalability
Supra’s novel consensus mechanism enables **hundreds of thousands of transactions per second** without sacrificing security or decentralization.

---

## Supra Oracle Resources

Explore Supra’s documentation for more information on:

- [**Data Feeds**](#)
- [**APIs for Real-Time and Historical Data**](#)
- [**Indices**](#)

---

# Pull Oracle Integration

Supra’s **Pull Oracle** allows developers to retrieve proof data directly from a gRPC server and interact with smart contracts programmatically.

## Installation

Clone the repository or download the source code, then install the required dependencies:

```bash
npm install
```

## Configuration

Before using the library, configure the parameters in your `main.js` file.

### gRPC Server Address

**Mainnet:**
```
mainnet-dora-2.supra.com:443
```

**Testnet:**
```
testnet-dora-2.supra.com:443
```

### REST Server Address

**Mainnet:**
```
https://rpc-mainnet-dora-2.supra.com
```

**Testnet:**
```
https://rpc-testnet-dora-2.supra.com
```

### Pair Indexes

Set the desired pair indexes as an array (example):

```javascript
const pairIndexes = [0, 21, 61, 49];
```

### Chain Type

Specify the chain type as EVM:

```javascript
const chainType = 'evm';
```

### RPC Configuration

Set the RPC URL for your target blockchain network:

```javascript
const web3 = new Web3(new Web3.providers.HttpProvider('<RPC URL>'));
```

---

## Customization

You can modify the smart contract interaction logic within the `callContract` function.

### Smart Contract ABI

Update the path to your ABI JSON file:

```javascript
const contractAbi = require("../resources/abi.json");
```

### Smart Contract Address

Specify your contract address:

```javascript
const contractAddress = '<CONTRACT ADDRESS>';
```

### Function Call

Modify the function call as per your contract. Example:

```javascript
const txData = contract.methods.GetPairPrice(hex, 0).encodeABI();
```

### Gas Estimation

Estimate gas for your function call:

```bash
const gasEstimate = await contract.methods.GetPairPrice(hex, 0).estimateGas({ from: "<WALLET ADDRESS>" });
```

### Transaction Object

Customize the transaction parameters:

```bash
const transactionObject = {
from: "<WALLET ADDRESS>",
to: contractAddress,
data: txData,
gas: gasEstimate,
gasPrice: await web3.eth.getGasPrice()
};
```

### Private Key Signing

Sign the transaction using your private key:

```bash
const signedTransaction = await web3.eth.accounts.signTransaction(transactionObject, "<PRIVATE KEY>");
```

---

## Running the Application

To start the application and initiate proof data fetching, run:

```bash
node main.js
```

This will retrieve data from Supra’s servers and interact with your smart contract using the defined configurations.

---

# Push Oracle Integration

Supra’s **Push Oracle** enables on-chain access to real-time data feeds (S-Values) through Solidity interfaces.

## Step 1: Create the S-Value Interface

Add the following code to your contract to define the data structures and functions needed to retrieve S-Values:

```solidity
pragma solidity 0.8.19;

interface ISupraSValueFeed {
struct priceFeed {
uint256 round;
uint256 decimals;
uint256 time;
uint256 price;
}

struct derivedData {
int256 roundDifference;
uint256 derivedPrice;
uint256 decimals;
}

function getSvalue(uint256 _pairIndex) external view returns (priceFeed memory);

function getSvalues(uint256[] memory _pairIndexes) external view returns (priceFeed[] memory);

function getDerivedSvalue(uint256 pair_id_1, uint256 pair_id_2, uint256 operation)
external
view
returns (derivedData memory);

function getTimestamp(uint256 _tradingPair) external view returns (uint256);
}
```

---

## Step 2: Configure the S-Value Feed Address

Initialize the S-Value feed contract in your smart contract constructor:

```solidity
contract ISupraSValueFeedExample {
ISupraSValueFeed internal sValueFeed;

constructor() {
sValueFeed = ISupraSValueFeed(0xE92D276bBE234869Ecc9b85101F423c6bD26654A);
}
}
```

*Note: Replace the above address with the correct network-specific Supra contract address.*

---

## Step 3: Retrieve the S-Value Data

Use the following functions to fetch single or multiple S-Values and to derive new data pairs.

```solidity
function getPrice(uint256 _priceIndex)
external
view
returns (ISupraSValueFeed.priceFeed memory)
{
return sValueFeed.getSvalue(_priceIndex);
}

function getPriceForMultiplePair(uint256[] memory _pairIndexes)
external
view
returns (ISupraSValueFeed.priceFeed[] memory)
{
return sValueFeed.getSvalues(_pairIndexes);
}

function getDerivedValueOfPair(uint256 pair_id_1, uint256 pair_id_2, uint256 operation)
external
view
returns (ISupraSValueFeed.derivedData memory)
{
return sValueFeed.getDerivedSvalue(pair_id_1, pair_id_2, operation);
}
```

---

## Recommended Best Practices

Implement an **access-controlled function** to update the Supra feed contract address for future upgrades:

```solidity
function updateSupraSvalueFeed(ISupraSValueFeed _newSValueFeed)
external
onlyOwner
{
sValueFeed = _newSValueFeed;
}
```

This approach ensures your contract remains upgradeable while maintaining secure access control over Oracle configurations.

---

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.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ nav:
- Getting started: tools/oracles/getting-started.md
- Chainlink: tools/oracles/chainlink.md
- Chronicle: tools/oracles/chronicle.md
- Supra: tools/oracles/supra.md

- Wallets:
- Getting started: tools/wallets/getting-started.md
Expand Down