Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
31aa62d
docs(oracle): add OmniDragonOracle docs (overview, configuration, tec…
wenakita Aug 25, 2025
0d3b550
docs: retarget to omnidragon-io/docs, fix baseUrl/routeBasePath and l…
wenakita Aug 26, 2025
dc640f3
ci: setup GitHub Pages with custom domain; fix links; clean CNAME
wenakita Aug 26, 2025
05d2ea0
fix: root links for routeBasePath=/; clean homepage links
wenakita Aug 26, 2025
35f4870
ci: add actions/configure-pages before deploy
wenakita Aug 26, 2025
ed12371
Update README with comprehensive OmniDragonOracle documentation
wenakita Sep 2, 2025
e8b2554
Update oracle address to 0x69c1E310B9AD8BeA139696Df55A8Cb32A9f00777 a…
wenakita Sep 2, 2025
4a000ee
Fix outdated oracle documentation: update to 18 decimals and correct …
wenakita Sep 2, 2025
b992a64
Update Sonic RPC URL and add comprehensive cross-chain deployment sum…
wenakita Sep 2, 2025
600dba3
Add comprehensive infrastructure documentation: Registry addresses an…
wenakita Sep 2, 2025
3bbf0d1
docs: update oracle overview with comprehensive OmniDragon infrastruc…
wenakita Sep 4, 2025
b7098af
docs: add comprehensive Registry documentation section
wenakita Sep 4, 2025
3edcb9b
docs: add comprehensive VRF documentation section
wenakita Sep 4, 2025
1d97317
docs: add comprehensive Token documentation section
wenakita Sep 5, 2025
756c7f5
docs: convert token overview sections to collapsible format
wenakita Sep 6, 2025
9908976
docs: convert oracle, registry, and vrf sections to collapsible format
wenakita Sep 6, 2025
2d8c7a5
docs: update deployments page with complete contract addresses
wenakita Sep 7, 2025
86170d1
docs: update VRF contract addresses to correct values
wenakita Sep 7, 2025
289c337
docs: replace ASCII diagrams with professional Mermaid diagrams
wenakita Sep 7, 2025
0e12fe7
docs: remove all emojis from Mermaid diagrams for clean, professional…
wenakita Sep 7, 2025
29ddd3e
docs: upgrade all Mermaid diagrams with beautiful professional styling
wenakita Sep 7, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build website
run: npm run build

Expand Down
293 changes: 274 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,296 @@
# Website
# OmniDragon Cross-Chain Oracle Infrastructure

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
> **Multi-chain price oracle ecosystem powered by LayerZero for the OmniDragon protocol**

## Installation
[![Solidity](https://img.shields.io/badge/Solidity-0.8.20-363636?style=flat-square&logo=solidity)](https://soliditylang.org/)
[![LayerZero](https://img.shields.io/badge/LayerZero%20V2-lzRead-6366f1?style=flat-square)](https://layerzero.network/)
[![Cross-Chain](https://img.shields.io/badge/Cross--Chain-Oracle-22c55e?style=flat-square)](#)
[![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](https://opensource.org/licenses/MIT)

```bash
yarn
## Overview

The OmniDragon Oracle Infrastructure provides **real-time cross-chain price feeds** for the DRAGON token across multiple blockchains. Built on **LayerZero V2**, it enables seamless price synchronization between chains with multiple oracle feed integrations.

### Key Features
- **Cross-Chain Compatibility**: Sonic ↔ Arbitrum via LayerZero Read
- **Multi-Oracle Aggregation**: Chainlink, Pyth, Band, API3 integration
- **Real-Time Updates**: Sub-second price synchronization
- **Fail-Safe Design**: Graceful degradation and redundancy
- **LayerZero Read Compatible**: Fixed `_lzReceive` message handling
- **Frontend Ready**: Exposed individual oracle feeds for dApps

## Architecture

```
┌─────────────────┐ LayerZero Read ┌─────────────────┐
│ ARBITRUM │◄────────────────────►│ SONIC │
│ │ │ │
│ OmniDragonOracle│ │ OmniDragonOracle│
│ (SECONDARY) │ │ (PRIMARY) │
│ │ │ │
│ ┌─────────────┐ │ │ ┌─────────────┐ │
│ │Request Price│ │ │ │Price Feeds │ │
│ └─────────────┘ │ │ │• Chainlink │ │
└─────────────────┘ │ │• Pyth │ │
│ │• Band │ │
│ │• API3 │ │
│ │• DEX TWAP │ │
│ └─────────────┘ │
└─────────────────┘
```

## Local Development
## Quick Start

### Prerequisites
```bash
yarn start
# Install dependencies
npm install
forge install

# Set up environment
cp .env.example .env
# Configure your RPC URLs and private keys
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
### Deploy & Configure
```bash
# Complete deployment guide
cd deploy/OmniDragonOracle/
cat DEPLOY.md
```

## Build
## Project Structure

```bash
yarn build
```
layerzero-cli-workspace/
├── contracts/
│ └── core/oracles/
│ └── OmniDragonOracle.sol # Main oracle contract
├── deploy/
│ └── OmniDragonOracle/ # Complete deployment toolkit
│ ├── README.md # Project overview
│ ├── DEPLOY.md # Deployment guide
│ ├── DeployVanityOracleViaCreate2.s.sol
│ ├── layerzero-oracle-read.config.ts
│ └── oracle-vanity-generator/ # Vanity address tools
├── deployments/ # Contract deployments
├── test/ # Test suites
└── Configuration files
├── hardhat.config.ts # Unified config
├── foundry.toml # Forge settings
└── layerzero-omnidragon.config.ts # LZ configuration
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
## Core Components

## Deployment
### OmniDragonOracle.sol
The heart of the system - a sophisticated price oracle that:
- **Aggregates** multiple oracle feeds with fail-safes
- **Provides** LayerZero Read compatible price queries
- **Maintains** TWAP calculations from DEX pairs
- **Exposes** individual feed data for frontend integration

Using SSH:
```solidity
// Get aggregated price (LayerZero Read compatible)
function getLatestPrice() external view returns (int256 price, uint256 timestamp)

```bash
USE_SSH=true yarn deploy
// Get individual oracle feeds
function getChainlinkPrice() external view returns (int256 price, uint256 timestamp)
function getPythPrice() external view returns (int256 price, uint256 timestamp)
function getBandPrice() external view returns (int256 price, uint256 timestamp)
function getAPI3Price() external view returns (int256 price, uint256 timestamp)
function getAllOraclePrices() external view returns (
int256 chainlinkPrice, bool chainlinkValid,
int256 pythPrice, bool pythValid,
int256 bandPrice, bool bandValid,
int256 api3Price, bool api3Valid
)

// Cross-chain functions
function requestPrice(uint32 targetEid, bytes calldata options) external payable
function setPeer(uint32 eid, bytes32 peer) external
function setMode(uint8 mode) external
```

### Cross-Chain Communication
- **Primary Oracle** (Sonic): Aggregates all price feeds
- **Secondary Oracle** (Arbitrum): Requests prices via LayerZero Read
- **Peer Configuration**: Automatic peer discovery and mapping

## Oracle Feeds

| **Feed** | **Network** | **Update Frequency** | **Reliability** |
|----------|-------------|---------------------|-----------------|
| Chainlink | Multiple | ~1 minute | 🟢 High |
| Pyth | Multiple | ~1 second | 🟢 High |
| Band | Multiple | ~5 minutes | 🟡 Medium |
| API3 | Multiple | ~2 minutes | 🟡 Medium |
| DEX TWAP | Sonic | Real-time | 🟢 High |

## Deployment Status

### Current Deployments
- **Sonic Oracle**: `0x69c1E310B9AD8BeA139696Df55A8Cb32A9f00777` (PRIMARY)
- **Arbitrum Oracle**: `0x69c1E310B9AD8BeA139696Df55A8Cb32A9f00777` (SECONDARY)

> ✅ **Status**: Fully operational with working LayerZero cross-chain communication

### Network Configuration
```typescript
// LayerZero Endpoint IDs
SONIC_EID: 30332
ARBITRUM_EID: 30110

// Oracle Modes
PRIMARY: Aggregates and provides prices
SECONDARY: Requests prices from PRIMARY via LayerZero Read
```

Not using SSH:
## Development

### Testing
```bash
GIT_USER=<Your GitHub username> yarn deploy
# Run oracle price checks
cd deploy/OmniDragonOracle/
forge script CheckOraclePrice.s.sol --rpc-url $SONIC_RPC

# Test cross-chain communication
npx hardhat lz:oapp-read:wire --oapp-config layerzero-oracle-read.config.ts
```

### Local Development
```bash
# Start local nodes
anvil --fork-url $SONIC_RPC
anvil --fork-url $ARBITRUM_RPC

# Deploy locally
forge script DeployVanityOracleViaCreate2.s.sol --broadcast
```

## Frontend Integration

### Price Feed Access
```javascript
// Get aggregated price
const [price, timestamp] = await oracle.getLatestPrice();

// Get individual feeds for comparison
const chainlinkPrice = await oracle.getChainlinkPrice();
const pythPrice = await oracle.getPythPrice();

// Get all feeds at once
const allPrices = await oracle.getAllOraclePrices();
```

### Real-Time Updates
```javascript
// Listen for price updates
oracle.on('PriceUpdated', (newPrice, timestamp) => {
console.log(`DRAGON price: ${newPrice} at ${timestamp}`);
});

// Cross-chain price request from Arbitrum
const tx = await oracle.requestPrice(30332, "0x", {
value: ethers.parseEther("0.000034")
});

// Listen for cross-chain responses
oracle.on('CrossChainPriceReceived', (targetEid, dragonPrice, nativePrice, timestamp) => {
console.log(`Received price from chain ${targetEid}: $${dragonPrice}`);
});
```

## Security

- **Multi-Signature**: Critical functions require multi-sig approval
- **Oracle Redundancy**: Multiple independent price feeds
- **Graceful Degradation**: System continues with partial feeds
- **LayerZero Security**: Leverages LZ's battle-tested infrastructure
- **Fixed LayerZero Read**: `getLatestPrice()` returns graceful values instead of reverting

## Recent Updates

### ✅ LayerZero Read Compatibility Fix (Latest)
- **Fixed**: `_lzReceive` message format mismatch that caused execution reverts
- **Fixed**: `getLatestPrice()` now returns graceful `(0,0)` instead of reverting
- **Result**: Cross-chain price requests now work flawlessly
- **Status**: Fully operational cross-chain oracle system

### Configuration
- **Oracle Addresses**: All using vanity address `0x69c1E310B9AD8BeA139696Df55A8Cb32A9f00777`
- **Price Feeds**: 4 oracles configured with `setPullOracle` function
- **LP Pair**: DRAGON/S pair properly configured with `setPair`
- **TWAP**: Enabled for time-weighted average pricing

## Contributing

1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## API Reference

### Price Functions
| Function | Description | Returns |
|----------|-------------|---------|
| `getLatestPrice()` | Get aggregated DRAGON price | `(int256 price, uint256 timestamp)` |
| `getAllOraclePrices()` | Get all individual feed prices | Multiple price/validity pairs |
| `getChainlinkPrice()` | Get Chainlink feed only | `(int256 price, uint256 timestamp)` |
| `getPythPrice()` | Get Pyth feed only | `(int256 price, uint256 timestamp)` |

### Cross-Chain Functions
| Function | Description | Gas Required |
|----------|-------------|--------------|
| `requestPrice(uint32, bytes)` | Request price from another chain | ~0.000034 ETH |
| `setPeer(uint32, bytes32)` | Configure LayerZero peer | Admin only |
| `setMode(uint8)` | Set PRIMARY/SECONDARY mode | Admin only |

### Events
```solidity
event PriceUpdated(int256 newPrice, uint256 timestamp);
event CrossChainPriceReceived(uint32 targetEid, int256 dragonPrice, int256 nativePrice, uint256 timestamp);
event PeerSet(uint32 eid, bytes32 peer);
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
## Performance & Costs

### Gas Costs
- **Cross-chain request**: ~0.000034 ETH on Arbitrum
- **Price update**: ~50,000 gas on Sonic
- **Oracle configuration**: ~25,000 gas per oracle

### Latency
- **Local price query**: <100ms
- **Cross-chain request**: 2-5 minutes (LayerZero confirmation time)
- **Price feed updates**: Real-time to 5 minutes (varies by oracle)

## Troubleshooting

### Common Issues
1. **"Price too stale"**: Check if oracle feeds are updating properly
2. **Cross-chain request fails**: Verify sufficient gas payment and peer configuration
3. **Oracle returns (0,0)**: Price feeds may be inactive or oracle not initialized

### Health Check
```javascript
// Check if oracle is healthy
const [price, timestamp] = await oracle.getLatestPrice();
const isHealthy = price > 0 && timestamp > (Date.now()/1000 - 3600); // 1 hour tolerance
```

## Support

- **Documentation**: Complete deployment guide in `DEPLOY.md`
- **Issues**: Open an issue for bugs or feature requests
- **Discussions**: Join community discussions for questions

---

**Built for the OmniDragon ecosystem**
4 changes: 2 additions & 2 deletions docs/_data/sonic.addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"DragonFeeMHelper": "0xc47c9cabae8a6425f01f5769eda470e1d01e9fbf"
},
"VRF": {
"ChainlinkVRFIntegratorV2_5_Sonic": "0x5eD6B9D172a3e6cd89578477FcB0a542BbFb14e0",
"OmniDragonVRFConsumerV2_5_Arbitrum": "0x697a9d438a5b61ea75aa823f98a85efb70fd23d5"
"ChainlinkVRFIntegratorV2_5_Sonic": "0x694f00e7CAB26F9D05261c3d62F52a81DE18A777",
"OmniDragonVRFConsumerV2_5_Arbitrum": "0x697a9d438A5B61ea75Aa823f98A85EFB70FD23d5"
},
"RevenueAndBribes": {
"veDRAGONRevenueDistributor": "0x6960cd77b3628b77d06871f114cde980434fa777",
Expand Down
12 changes: 9 additions & 3 deletions docs/deployments/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ sidebar_position: 10

## Key Addresses

**DRAGON Token**: `0x69dc1c36f8b26db3471acf0a6469d815e9a27777` (same on all chains)
**VRF Integrator**: `0x2BD68f5E956ca9789A7Ab7674670499e65140Bd5` (same on all chains)
### Core Contracts (Same on all chains)
**DRAGON Token**: `0x69dc1c36f8b26db3471acf0a6469d815e9a27777`
**Oracle**: `0x69c1E310B9AD8BeA139696Df55A8Cb32A9f00777`
**Registry**: `0x6940aDc0A505108bC11CA28EefB7E3BAc7AF0777`

### VRF Contracts
**Chainlink VRF Integrator**: `0x694f00e7CAB26F9D05261c3d62F52a81DE18A777`
**OmniDragon VRF Consumer (Arbitrum)**: `0x697a9d438A5B61ea75Aa823f98A85EFB70FD23d5`

## Cross-Chain Bridge Example

Expand All @@ -23,6 +29,6 @@ cast call $DRAGON_TOKEN "quoteSend((uint32,bytes32,uint256,uint256,bytes,bytes,b
cast send $DRAGON_TOKEN "send(...)" --value $NATIVE_FEE --rpc-url $RPC_URL_SONIC
```

See [Frontend Integrations](/docs/integrations/frontend-integrations) for complete examples and addresses.
See [Frontend Integrations](/integrations/frontend-integrations) for complete examples and addresses.


Loading