Skip to main content

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:

ProblemImpact on RWAs
Slippage on every tradeA tokenised solar farm appraised at $50,000 should not trade at $40,000 because the AMM curve is thin.
Impermanent lossLPs lose value when the appraised price drifts vs the pool ratio.
Cascading liquidationsOne 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:

ContractRoleSource
DobPegHookUniswap V4 Custom-Accounting hook — buys, sells, liquidations, RWA resale marketDobhooks/contracts/src/DobPegHook.sol
DobValidatorRegistryOn-chain price + liquidation oracleDobhooks/contracts/src/DobValidatorRegistry.sol
DobLPRegistryLP positions and per-asset backings (FIFO matching)Dobhooks/contracts/src/DobLPRegistry.sol
DobPooledLNShared LN vault — pooled USDC under one LP entryDobhooks/contracts/src/DobPooledLN.sol
DobRwaVaultWraps approved RWA tokens into the dobRWA ERC-20Dobhooks/contracts/src/DobRwaVault.sol
DobSwapRouterUser-facing wrapper around IPoolManagerDobhooks/contracts/src/DobSwapRouter.sol
DobDirectSwapStandalone dUSDC↔USDC peg for chains without V4Dobhooks/contracts/src/DobDirectSwap.sol
OracleAlertReceiver / ReactiveOracleSyncCross-chain oracle sync via Reactive NetworkDobhooks/contracts/src/...

Deployments

ChainPath
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

PropertyWhere it lives in code
Oracle-peg buysDobPegHook._beforeSwap (amountOut = amountIn for USDC -> dobRWA)
LP-priced exitsDobLPRegistry.queryAndFillAtMarket (each LP's minPenaltyBps)
Orderly liquidationsDobValidatorRegistry.setLiquidationParams + DobPegHook._beforeSwap liquidation branch + cap checks
No bonding-curve slippage on buysCustom Accounting BeforeSwapDelta overrides AMM math
Permissionless LP poolDobPegHook.depositUsdc / withdrawUsdc + swapFeeBps
RWA Resale MarketDobPegHook.listRwaForSale / buyListedRwa
Slippage protectionhookData.minAmountOut -> SlippageExceeded revert
Oracle staleness guardgetPrice().updatedAt vs vault.maxOracleDelay() -> OracleStale revert
Per-asset + global liquidation capsLiquidationCapExceeded, 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