DobDex
DobDex is a decentralized exchange purpose-built for real-world asset (RWA) tokens. It replaces AMM bonding curves with a two-layer model:
- Buys are priced 1:1 against the AI-validator USD oracle (the dUSDC peg).
- Sells are priced by Liquidity Nodes (LPs) at each LP's own discount, filled FIFO. When the validator flags an asset for liquidation, sells use a protocol-mandated penalty instead.
It also runs a permissionless USDC LP pool with swap fees, an RWA Resale Market (peer-to-peer LP-only listings at oracle price), and the DobPooledLN shared LN vault.
Live at: dex.dobprotocol.com
The earlier "zero-slippage DEX" framing was inaccurate. Buys settle at the oracle peg; sells settle at LP-quoted discounts (or the protocol-mandated penalty during liquidations). See Liquidity-Node Pricing for the actual code paths.
Why a different model for RWAs
Traditional AMMs (x * y = k) work for volatile crypto tokens but cause real problems for RWA tokens:
| Problem | Impact on RWAs |
|---|---|
| Slippage on every trade | A tokenised solar farm appraised at $50,000 should not trade at $40,000 because the AMM curve is thin. |
| Impermanent loss | LPs lose value when the appraised price drifts vs the pool ratio. |
| Cascading liquidations | One forced sell drops the curve, triggering more forced sells. |
DobDex's two-layer model decouples deposit pricing from exit pricing. The validator oracle prices deposits; LPs (or the validator-set penalty) price exits.
Core architecture
The DobDex contracts on V4 chains:
| Contract | Role | Source |
|---|---|---|
| DobPegHook | Uniswap V4 Custom-Accounting hook — buys, sells, liquidations, RWA resale market | Dobhooks/contracts/src/DobPegHook.sol |
| DobValidatorRegistry | On-chain price + liquidation oracle | Dobhooks/contracts/src/DobValidatorRegistry.sol |
| DobLPRegistry | LP positions and per-asset backings (FIFO matching) | Dobhooks/contracts/src/DobLPRegistry.sol |
| DobPooledLN | Shared LN vault — pooled USDC under one LP entry | Dobhooks/contracts/src/DobPooledLN.sol |
| DobRwaVault | Wraps approved RWA tokens into the dobRWA ERC-20 | Dobhooks/contracts/src/DobRwaVault.sol |
| DobSwapRouter | User-facing wrapper around IPoolManager | Dobhooks/contracts/src/DobSwapRouter.sol |
| DobDirectSwap | Standalone dUSDC↔USDC peg for chains without V4 | Dobhooks/contracts/src/DobDirectSwap.sol |
| OracleAlertReceiver / ReactiveOracleSync | Cross-chain oracle sync via Reactive Network | Dobhooks/contracts/src/... |
Deployments
| Chain | Path |
|---|---|
| Arbitrum Sepolia (421614) | DobPegHook + full V4 stack |
| Base Sepolia (84532) | DobPegHook + full V4 stack |
| Unichain Sepolia (1301) | DobPegHook + full V4 stack; origin chain for cross-chain oracle sync |
| Reactive Network (5318007) | ReactiveOracleSync only |
| Robinhood Chain Testnet (46630) | DobDirectSwap only (no Uniswap V4) |
How a swap goes through
Buy — USDC -> dobRWA
amountOut = amountIn (1:1 against the oracle peg)
The hook mints ERC-6909 USDC claims, settles dobRWA out, and emits PegSwap. No fees on buys.
Sell — dobRWA -> USDC, normal mode
The hook charges swapFeeBps (LP-pool fee) and an optional protocolFeeBps (max 5%, accrues to protocolReserveUsdc), then routes through DobLPRegistry.queryAndFillAtMarket(rwaToken, oraclePrice, idealOut). Each LP fills at their own minPenaltyBps — that discount is the seller's exit price on the LP-filled portion. Hook reserves cover any remainder unless lpOnlyMode[token] is true.
Sell — dobRWA -> USDC, liquidation mode
The hook reads (enabled, penaltyBps, cap, liquidatedAmount) from the registry. It checks per-asset and global caps, computes amountOut = amountIn * (1 - penaltyBps), records the liquidation, and routes through lpRegistry.queryAndFill(...). LPs whose minPenaltyBps <= penaltyBps get filled FIFO/cheapest-first.
Full code-path walkthrough: Liquidity-Node Pricing and Liquidations.
Key properties
| Property | Where it lives in code |
|---|---|
| Oracle-peg buys | DobPegHook._beforeSwap (amountOut = amountIn for USDC -> dobRWA) |
| LP-priced exits | DobLPRegistry.queryAndFillAtMarket (each LP's minPenaltyBps) |
| Orderly liquidations | DobValidatorRegistry.setLiquidationParams + DobPegHook._beforeSwap liquidation branch + cap checks |
| No bonding-curve slippage on buys | Custom Accounting BeforeSwapDelta overrides AMM math |
| Permissionless LP pool | DobPegHook.depositUsdc / withdrawUsdc + swapFeeBps |
| RWA Resale Market | DobPegHook.listRwaForSale / buyListedRwa |
| Slippage protection | hookData.minAmountOut -> SlippageExceeded revert |
| Oracle staleness guard | getPrice().updatedAt vs vault.maxOracleDelay() -> OracleStale revert |
| Per-asset + global liquidation caps | LiquidationCapExceeded, GlobalLiquidationCapExceeded reverts |
Test coverage
The Foundry suite covers swap mechanics, oracle staleness, LP fills, liquidation caps, vault accounting, and reserve-hold edge cases.
Next steps
- Liquidity-Node Pricing — how buys vs sells are priced.
- Liquidity Nodes — the two-step LP model.
- Pooled Liquidity Node — DobPooledLN shared vault.
- Liquidations — orderly liquidation mechanism.