Skip to content

5ire-tech/fetch-price-oracle-example

Repository files navigation

Fetch 5ire's Price from 5ireChain

Entangle Oracle

Fetch 5ire/USD Price from Entangle Oracle

This script fetches and verifies the 5IRE/USD price using the PullConsumer smart contract on the 5ireChain.

Prerequisites

  • Node.js (v20 or higher)
  • Yarn
  • A 5ireChain Mainnet Configuration
  • Private key with sufficient 5IRE coins for gas fees

Setup

  1. Install dependencies:
yarn install
  1. Configure environment variables by creating a .env file:
FIRE_URL=https://rpc.5ire.network
FIRE_DEPLOYER=your_private_key_here

Running the Script

Execute the script using Hardhat:

npx hardhat run scripts/entangle/fetchAndVerify.ts --network fire

Script Overview

The script performs the following operations:

  1. Fetches verification data for 5IRE/USD price from Entangle Oracle
  2. Interacts with the PullConsumer contract at 0xB1e44Fb6DDc1DA35300DA3b66be4235F1532d6D7
  3. Verifies the price using merkle proofs and signatures
  4. Outputs the transaction hash upon successful verification

Expected Output

When successful, you should see output similar to:

sent tx: 0x62364a7c80168b8a5a4e8e0758b7a034e96e2e57ae543a8c7907a27039e79a56

References



Supported Pairs

1. 5ire/USD

Orochi Oracle

Fetch 5ire/USD, 5ire/USDT Price from Orochi Oracle This script fetches the `5IRE/USD` and `5IRE/USDT` price using the FetchPrice smart contract on the 5ireChain.

Prerequisites

  • Node.js (v20 or higher)
  • Yarn
  • A 5ireChain Mainnet Configuration
  • Private key with sufficient 5IRE coins for gas fees

Setup

  1. Install dependencies:
yarn install
  1. Configure environment variables by creating a .env file:
FIRE_URL=https://rpc.5ire.network
FIRE_DEPLOYER=your_private_key_here

Running the Script

Compile and deploy the contract:

npx hardhat compile

Deploy the contract to the 5ireChain network:

npx hardhat run scripts/orochi/deploy.ts --network fire

Copy the deployed contract address and update orochifetch.ts with it. Then run:

npx hardhat run scripts/orochi/orochifetch.ts --network fire

Script Overview

The script performs the following operations:

  1. Fetches 5IRE/USD and 5IRE/USDT prices from Orochi Oracle
  2. Interacts with the FetchPrice contract at 0x3E36123bAE1d9EB392C32849324D093a45CEDd7F
  3. Retrieves and displays the latest price

Expected Output

When successful, you should see output similar to:

📡 Fetching 5IRE/USDT price from contract...
💰 5IRE/USDT Price: 0.003066 USDT
💰 5IRE/USD Price: 0.003066352589999999 USD

References



Supported Pairs

1. 5IRE/USD

2. 5IRE/USDT

Umbrella Network

Fetch 5IRE/USD Price from Umbrella Network This script fetches the `5IRE/USD` price using the `UmbrellaPriceFetcher` smart contract on the `5ireChain`.

Prerequisites

  • Node.js (v20 or higher)
  • Yarn
  • A 5ireChain Mainnet Configuration
  • Private key with sufficient 5IRE coins for Gas fees

Setup

  1. Install dependencies:
yarn install
  1. Configure environment variables by creating a .env file:
FIRE_URL=https://rpc.5ire.network
FIRE_DEPLOYER=your_private_key_here

Running the Script

Compile and deploy the contract:

npx hardhat compile

Deploy the contract to the 5ireChain network:

npx hardhat run scripts/Umbrella/deploy.ts --network fire

Copy the deployed contract address and update umbrellaFetch.ts with it. Then run:

npx hardhat run scripts/Umbrella/umbrellaFetch.ts --network fire

Script Overview

The script performs the following operations:

  1. Fetches 5IRE/USD price from Umbrella Network
  2. Interacts with the Feed Address contract at 0x1B9131518EadDFDCCc1876616e3Bf9c534b4e527
  3. Retrieves and displays the latest price

Expected Output

When successful, you should see output similar to:

Price: 0.00338371 USD
Timestamp: 1739737743

References



Supported Pairs

1. 5IRE/USD