{"repo":"genesiscode2026/icp-multi-exchange-price-oracle","private":true,"description":"Rust/ICP multi-exchange price oracle with Binance, Coinbase and OKX HTTPS outcalls, provenance and validation safeguards.","default_branch":"main","stars":0,"forks":0,"pushed_at":"2026-09-16T12:09:21Z","languages":{"Rust":26798},"files":21,"tree":[".gitignore","AGENT_EVAL.md","ARCHITECTURE.md","CHANGELOG.md","Cargo.lock","Cargo.toml","DEPENDENCIES.md","LICENSE.md","LIMITATIONS.md","PREVIEW.md","QUICKSTART.md","README.md","SECURITY.md","SUPPORT.md","TEST_REPORT.md","VERIFICATION.md","candid/market_oracle.did","commercial-manifest.json","dfx.json","release-manifest.json","src/lib.rs"],"sizes":{".gitignore":25,"AGENT_EVAL.md":1231,"ARCHITECTURE.md":2704,"CHANGELOG.md":503,"Cargo.lock":20781,"Cargo.toml":369,"DEPENDENCIES.md":399,"LICENSE.md":1660,"LIMITATIONS.md":794,"PREVIEW.md":2253,"QUICKSTART.md":1343,"README.md":3639,"SECURITY.md":1567,"SUPPORT.md":624,"TEST_REPORT.md":1476,"VERIFICATION.md":376,"candid/market_oracle.did":1359,"commercial-manifest.json":1215,"dfx.json":254,"release-manifest.json":1965,"src/lib.rs":26798},"readme":"# ICP Multi-Exchange Price Oracle Canister\n\n> **Multi-Venue Spot Market Data & Candlestick Oracle for the Internet Computer**\n\n[![Tests](https://img.shields.io/badge/tests-10%20passed-brightgreen.svg)](TEST_REPORT.md)\n[![Target](https://img.shields.io/badge/target-wasm32--unknown--unknown-blue.svg)](Cargo.toml)\n[![License](https://img.shields.io/badge/license-Commercial%20Source-blue.svg)](LICENSE.md)\n\n---\n\n## 1. WHAT IS THIS?\nThe **ICP Multi-Exchange Price Oracle Canister** is a production-ready Rust smart contract for the Internet Computer (ICP). It fetches, validates, normalizes, and caches real-time and historical candlestick (OHLCV) market data from three Tier-1 exchanges (Binance, Coinbase, OKX) via deterministic HTTPS outcalls, serving queries to frontend clients with zero cycle fees.\n\n## 2. WHO IS IT FOR?\n- **Web3 DeFi & DEX Developers:** Needing validated multi-timeframe OHLCV bars and multi-exchange spread data for interactive charting and on-chain trade logic.\n- **DAO Treasuries:** Requiring automated asset valuation without recurring third-party oracle subscription fees.\n- **Canister Architects:** Requiring a secure reference implementation for rate-limited, single-flight HTTPS outcalls with cycle reserve protection.\n\n## 3. WHAT PROBLEM DOES IT SOLVE?\nThe official DFINITY Exchange Rate Canister (XRC) provides single spot price cross-rates but has structural limitations for interactive applications:\n1. **Cycles Attached on Query:** XRC requires the caller to attach cycles to every query call, making direct, unauthenticated frontend web client queries impossible.\n2. **No Candlestick (OHLCV) Series:** XRC returns a single spot price; it does not aggregate, normalize, or cache multi-timeframe OHLCV series required for charting.\n3. **Black-Box Aggregation:** XRC hides individual exchange order-book/candle provenance.\n4. **Bankruptcy Risk:** Naive outcall loops can rapidly exhaust a canister cycle balance during upstream network disruptions.\n\n## 4. WHY PAY FOR IT INSTEAD OF BUILDING IT?\n- **Free Client Queries:** An in-canister RAM cache serves authenticated query calls (`cached_market_data`) to browser frontends at zero cycle cost to the user.\n- **Full OHLCV Candlestick Parsing:** Parses and normalizes native candlestick streams across M1, M5, M15, H1, H4, D1, W1 timeframes.\n- **Multi-Exchange Transparency:** Queries Binance, Coinbase, and OKX concurrently, returning validated series and provenance alongside explicit failure tracking for each venue.\n- **100 Billion Cycle Reserve Protection:** Automatically aborts outcalls if canister reserves drop below 100B cycles (~0.1 TC), preventing canister freeze.\n- **Single-Flight Coalescing:** Concurrent requests for the same asset/timeframe share an in-flight promise to eliminate duplicate outcall expenses.\n\n## 5. WHAT IS VERIFIED?\n- **10 / 10 Automated Rust Unit Tests Passed:** OHLCV validation, duplicate timestamp rejection, negative/zero price rejection, case-insensitive asset normalization, boundary calculation, and exchange parser error handling.\n- **WASM Compilation:** Compiles to optimized `wasm32-unknown-unknown` canister binary.\n- **Candid Interface:** Fully verified Candid contract (`candid/market_oracle.did`).\n\n## 6. HOW DO I RUN IT?\n```bash\n# 1. Run unit tests\ncargo test --manifest-path Cargo.toml\n\n# 2. Build optimized canister WASM\ncargo build --manifest-path Cargo.toml --target wasm32-unknown-unknown --release\n\n# 3. Deploy locally with dfx\ndfx start --background\ndfx deploy market_oracle\ndfx canister call market_oracle refresh_market_data '(record { asset = \"BTC\"; timeframe = variant { H1 }; limit = 20 })'\n```\n","price_usd":"249.00","clone_checkout":"https://api.checkout402.com/c/chk__SmB8Wxr0d3PyGa_","rehearse_checkout":"https://api.checkout402.com/c/chk__SmB8Wxr0d3PyGa_/test","preview":"/r/genesiscode2026/icp-multi-exchange-price-oracle/f/<path> serves file CONTENTS for the seller's preview paths; other paths answer with the price","how_to_buy":"pay clone_checkout with x402 (pay402 does it in one call); the goods arrive as payload_base64, a tar.gz of the full repo. Rehearse first at rehearse_checkout: same flow, simulated money.","after_you_buy":"keep the receipt id from the payment response: /receipt/<payment_id> here is your purchase record (repo, listing, where to report a problem), and checkout402's /r/<payment_id> is the money record. Tell your human both URLs."}