Documentation

Quick Start Guide

⏱️ Time Required: ~5 minutes
🎯 Goal: Deploy a contract that reads the live BNB/USD price from ORCAFI

Prerequisites

💰
Testnet BNB
1

Open Remix IDE

Go to remix.ethereum.org and create a new file called PriceConsumer.sol

2

Copy the Code

Paste the following contract:

PriceConsumer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IOrcafiRouter {
    struct PriceData {
        uint256 price;
        uint256 conf;
        uint256 expo;
        uint256 timestamp;
    }
    function getLatestPrice(string calldata feedId) 
        external view returns (PriceData memory);
}

contract PriceConsumer {
    IOrcafiRouter public router;

    // BNB Chain Testnet Router
    constructor() {
        router = IOrcafiRouter(
            0x71C95911E9a5D330f4D621842EC243EE14729A23
        );
    }

    function getBnbPrice() public view returns (uint256) {
        return router.getLatestPrice("BNB/USD").price;
    }
}
3

Deploy & Test

  1. Compile (Ctrl+S)
  2. Go to Deploy & Run tab
  3. Select Injected Provider - MetaMask
  4. Click Deploy and confirm
  5. Call getBnbPrice to see the result!

✅ Success!

You just consumed your first decentralized price feed. The returned value (e.g., 850000000000000000000) represents the price with 18 decimals — so that's $850.00.

What's Next?

Add Safety Checks →

Learn about staleness checks and confidence validation.

Browse All Feeds →

See all available price feeds and their parameters.

Use Risk Levels →

Implement defensive logic based on market conditions.