Pull Oracle
DORA V2, our latest version of data feeds protocol, uses a combination of Web2 and Web3 methods to achieve ultra-low latency when sending data from Supra to destination chains. First, Web2 methods are used to retrieve data from Supra, while Web3 smart contracts are utilised for cryptographically verifying and writing it on-chain where it lives on immutable ledgers.
Please refer to the following resources for a better understanding of DORA price feeds.
Data Feeds - This explains how Supra calculates the S-Value for data feeds.
Data Feeds Index - This provides a list of data feeds currently offered by Supra.
Available Networks - This lists available networks and Supra contract addresses.
Important: Please make sure you read and understand Terms of Use before start using Supra products and services.
The first step of the process would be to set up your web2 code to interact with DORA's pull oracle and sync with Supra's consumer smart contract address.
Javascript Implementation
A code library is designed to connect to a gRPC/Rest server to retrieve proof data, which it then uses to interact with a smart contracts can be downloaded from links provided below. This document provides instructions on setting up and using the library, along with guidelines for customising its components to suit your specific requirements.
gRPC - Download here.
REST - Download here.
Installation
To use the PullServiceClient library, follow these steps:
Clone the repository or download the library's source code.
Install the necessary dependencies by running the following command in your project directory:
npm install
Usage
The library's primary function retrieves proof data from the gRPC server using specified parameters and subsequently invokes a smart contract function on a blockchain network.
Configuration
Before using the library, make sure to set up the configuration in the main.js file:
Set the server address: gRPC
NetworkgRPC Server AddressMainnets
Testnets
Set the server address: REST
Mainnets
Testnets
Set the pair indexes as an array (below given indexes are examples):
Set the chain type to EVM:
Configure the RPC URL for the desired blockchain network:
Customization
Users can customize the smart contract interaction under the callContract function. Specifically, you can modify the following components:
Smart Contract ABI: Update the path to your smart contract's ABI JSON file:
Smart Contract Address: Set the address of your smart contract:
Function Call: Modify the function call according to your smart contract's methods. For example, if your smart contract has a method named GetPairPrice:
Gas Estimate: Adjust the gas estimation by calling the desired contract method:
Transaction Object: Customize the transaction object as needed:
Private Key Signing: Sign the transaction with the appropriate private key:
Running the Application
To run the application, execute the following command:
This will initiate the fetching of proof data and allow for interaction with the smart contract based on the provided configuration and customisation. -----------------------------------------------------------\
Rust Implementation
The code library being discussed in the section can be downloaded here. The Rust PullServiceClient is designed to interact with a gRPC server for fetching proof data and using that data to call a smart contract on a blockchain network. This readme provides instructions on how to use the library and customize certain components for your specific use case.
Prerequisites
Installation
To use the Rust library for Sui, Aptos and EVM, and follow these steps:
Clone the repository or download the library's source code.
Navigate to the project directory in your terminal
Usage
The Rust library for Sui, Aptos and EVM provides a complete example that fetches proof data from a gRPC server and then calls a contract function on a blockchain network.
Configuration
Before using the library, configure the file in example folder:
gRPC server address:
NetworkgRPC Server AddressMainnets
Testnets
REST Server address
NetworkREST Server AddressMainnets
Testnets
Set the pair indexes as an array: ( below mentioned indexes are for an example)
Set the chain type to EVM:
Set the RPC URL for the desired blockchain network:
Customization
Users can customize the smart contract interaction under the call_contract function. Specifically, you can modify the following components:
Private Key: Set your private key:
Contract Address: Set the address of your smart contract:
Contract Function Call: Customize the function call based on your contract methods:
Smart Contract ABI: Update the path to your smart contract's ABI JSON file and contract name (EVM only) in
pull_contract.rs:
Running the Application
Open your terminal and navigate to the project directory.
Run the example using the following command:
Evm
Javascript Implementation
A code library is designed to connect to a gRPC/Rest server to retrieve proof data, which it then uses to interact with a smart contracts can be downloaded from links provided below. This document provides instructions on setting up and using the library, along with guidelines for customising its components to suit your specific requirements.
gRPC - Download here.
REST - Download here.
Installation
To use the PullServiceClient library, follow these steps:
Clone the repository or download the library's source code.
Install the necessary dependencies by running the following command in your project directory:
Usage
The library's primary function retrieves proof data from the gRPC server using specified parameters and subsequently invokes a smart contract function on a blockchain network.
Configuration
Set the server address: gRPC
NetworkgRPC Server AddressMainnets
Testnets
Set the server address: REST
NetworkREST Server AddressMainnets
Testnets
\
Set the pair indexes as an array (below given indexes are examples):
Set the chain type SUI:
Configure the RPC URL for the desired blockchain network:
Before using the library, make sure to set up the configuration in the main.js file:
Users can customize the smart contract interaction under the callContract function. Specifically, you can modify the following components:
Smart Contract Address: Set the address of your smart contract:
Function Call: Modify the function call according to your smart contract's methods. For example, if your smart contract has module named pull_example and a method named get_pair_price:
Transaction Object: Customize the transaction object as needed:
Private Key Signing: Sign the transaction with the appropriate private key:
Running the Application
To run the application, execute the following command
This will initiate the fetching of proof data and interaction with the smart contract based on the provided configuration. -------------------------------------------------------
Rust Implementation
Prerequisites
The code library being discussed in the section can be downloaded below
gRPC: Download Here
REST: Download Here
Installation
To use the Rust library for EVM please follow these steps:
Clone the repository or download the library's source code.
Navigate to the project directory in your terminal.
Usage
The Rust library for Sui, Aptos and EVM provides a complete example that retrieves proof data from a gRPC/Rest server and then calls a contract function on a blockchain network.
Set the gRPC server address:\
NetworkgRPC Server AddressMainnets
Testnets
Set the REST server address:\
NetworkREST Server AddressMainnets
Testnets
Set the pair indexes as an array: ( below mentioned indexes are for an example)
Set the pair indexes as an array: ( below mentioned indexes are for an example)
Set the chain type to Sui:
Set the RPC URL for the desired blockchain network:
Before using the library, configure the file in example folder:
Customization
Users can customize the smart contract interaction under the call_contract function. Specifically, you can modify the following components:
Private Key: Set your private key:
Contract Address: Set the address of your smart contract:
Contract Function Call: Customize the function call based on your contract module and methods::
Transaction Object: Customize the transaction object as needed:
Running the Application
Open your terminal and navigate to the project directory.
Run the example using the following command:
Javascript Implementation
A code library is designed to connect to a gRPC/Rest server to retrieve proof data, which it then uses to interact with a smart contracts can be downloaded from links provided below. This document provides instructions on setting up and using the library, along with guidelines for customising its components to suit your specific requirements.
gRPC - Download here.
REST - Download here.
Installation
To use the PullServiceClient library, follow these steps:
Clone the repository or download the library's source code.
Install the necessary dependencies by running the following command in your project directory:
Usage
The library's primary function retrieves proof data from the gRPC server using specified parameters and subsequently invokes a smart contract function on a blockchain network.
Configuration
Before using the library, make sure to set up the configuration in the main.js file:
Set the server address: gRPC
NetworkgRPC Server AddressMainnets
Testnets
Set the server address: REST
NetworkREST Server AddressMainnets
Testnets
Set the pair indexes as an array (below given indexes are examples):
Set the chain type:
Configure the RPC URL for the desired blockchain network:
Users can customize the smart contract interaction under the callContract function. Specifically, you can modify the following components:
Smart Contract Address: Set the address of your smart contract:
Function Call: Modify the function call according to your smart contract's methods. For example, if your smart contract has module named pull_example and a method named get_pair_price:
Retrieve signer Account:
Transaction Object: Customize the transaction object as needed:
Running the Application
To run the application, execute the following command: node main.js
This will initiate the fetching of proof data and interaction with the smart contract based on the provided configuration and customization. ---------------------------------------------------------------
Rust Implementation
The code library being discussed in this section can be downloaded here. The Rust PullServiceClient is designed to interact with a gRPC server for fetching proof data and using that data to call a smart contract on a blockchain network. This readme provides instructions on how to use the library and customize certain components for your specific use case.
Prerequisites
Installation
To use the Rust library for Sui, Aptos and EVM and follow these steps:
Clone the repository or download the library's source code.
Navigate to the project directory in your terminal
Usage
The Rust library for Sui, Aptos and EVM provides a complete example that fetches proof data from a gRPC server and then calls a contract function on a blockchain network.
Set the gRPC server address:
NetworkgRPC Server AddressMainnets
Testnets
Set the REST server address:
NetworkREST Server AddressMainnets
Testnets
Set the pair indexes as an array: ( below mentioned indexes are for an example)
Set the chain type:
Set the RPC URL for the desired blockchain network:
Before using the library, configure the file in example folder:
Customization
Users can customize the smart contract interaction under the call_contract function. Specifically, you can modify the following components:
Private Key: Set your private key:
Contract Address: Set the address of your smart contract:
Contract Function Call: Customize the function call based on your contract module and methods::
Transaction Object: Customize the transaction object as needed:
Running the Application
Open your terminal and navigate to the project directory.
Run the example using the following command:
Now, let's move on to set up your Web3 components:
Step 1: Create The S-Value Pull Interface to verify the price data received.
Add the following code to the solidity smart contract that you wish to retrieve an S-Value.
This creates the interface that you will later apply in order to verify and fetch S-Values from Supra's Pull Contract.\
Step 2: Configure The S-Value Feed Address
To verify and fetch the S-Value from a Supra Pull smart contract, first find the S-Value Pull Contract address for the preferred chain. When you have the address, create an instance of the ISupraOraclePull using the interface we previously defined: Supra contracts for each network can be found in our network addresses list.
Step 3: Receive and Verify the S-Value
You can refer to: GitHub Example to get the Proof<_bytesProof> of S-Values in a Web2 environment.
Next, copy the following code to the smart contract to verify the price data received:
Thats it. Done!
Now you are ready to consume fast, low latency, and highly accurate data from Supra's Pull oracle.
Recommended Best Practices
Create a function with access control that updates the oracle using the function: updatePullAddress()
This will allow you to update the address of the Supra Pull contract after deployment, allowing you to future proof your contract. Access control is mandatory to prevent the undesired modification of the address.
Example Implementation
Here's an example of what your implementation should look like:
Step 1: Create The S-Value Interface
Import interface from https://github.com/Entropy-Foundation/dora-interface git repository and add subdirectory mainnet or testnet for integration.
Step 2: Configure The S-Value Feed Dependency
Create your project and add the below dependencies in your Move.toml
Testnet
Mainnet
Step 3: Receive and Verify the S-Value
Import supra_holder contracts dependency in: client_example/sources/pull_client.move
Here's an example of what your implementation should look like.
Thats it. Done!
Now you are ready to consume fast, and low latency data from Supra pull oracle.
Step 1: Create The S-Value Interface
Import interface from https://github.com/Entropy-Foundation/dora-interface git repository and add subdirectory mainnet or testnet for integration.
Step 2: Configure The S-Value Feed Dependency
Create your project and add the below dependencies in your Move.toml
Testnet
Mainnet
Step 3: Receive and Verify the S-Value
Import supra_holder contracts dependency in: client_example/sources/pull_client.move
Here's an example of what your implementation should look like.
Thats it. Done!
Now you are ready to consume fast, and low latency data from Supra pull oracle.
Last updated
