OTC Bridge: Peer-to-peer RTC trading with RIP-302 escrow (Bounty #695)#1459
Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom Mar 17, 2026
Merged
OTC Bridge: Peer-to-peer RTC trading with RIP-302 escrow (Bounty #695)#1459Scottcjn merged 1 commit intoScottcjn:mainfrom
Scottcjn merged 1 commit intoScottcjn:mainfrom
Conversation
Peer-to-peer RTC trading with on-chain escrow via RIP-302 Agent Economy and HTLC smart contract for ETH/USDC side on Base. - Flask backend with 9 API endpoints (order book, matching, settlement) - Dark-themed SPA frontend with depth visualization and auto-refresh - RTC sell orders auto-lock in RIP-302 escrow - Solidity HTLC for cross-chain atomic settlement (ETH + ERC20) - SQLite persistence (shared order book between users) - Rate limiting, self-match prevention, order expiry with auto-refund - 23 unit tests, all passing - Docker support for production deployment Supported pairs: RTC/USDC, RTC/ETH, RTC/ERG Wallet: wirework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bounty Claim: #695 — Tier 2 (150 RTC)
Full Tier 2 OTC Bridge implementation with RIP-302 escrow and HTLC smart contract.
Deliverables
Backend (
otc_bridge.py— Flask, 9 API endpoints):POST /api/orders— Create buy/sell order (sell orders auto-lock RTC in escrow)GET /api/orders— List open orders with pair/side filtersGET /api/orderbook— Aggregated bids/asks with spread calculationPOST /api/orders/{id}/match— Match an order (counterparty)POST /api/orders/{id}/confirm— Confirm settlement (reveals HTLC secret, releases escrow)POST /api/orders/{id}/cancel— Cancel with escrow refundGET /api/trades— Trade history with audit trailGET /api/stats— Market stats (volume, open orders, prices)Frontend (
static/index.html— single-file SPA):HTLC Smart Contract (
contracts/HTLC.sol):createSwapETH()/createSwapERC20()— Lock funds with hashlock + timelockclaim()— Seller reveals preimage to claimrefund()— Buyer reclaims after timeoutSettlement Flow:
Tests: 23 unit tests, all passing — covers order CRUD, escrow locking/refund, matching, settlement, rate limiting, auth checks.
Docker: Production-ready with gunicorn.
Tier 2 Checklist
/agent/jobswith escrow lock)Supported Pairs
RTC/USDC, RTC/ETH, RTC/ERG
Wallet: wirework