Aggregator Referral Programs & Perp DEX Builder Codes
Finding
Zero-Storage VerticalsAgent-to-Agent Micro-Economies
referralaffiliatebuilder-codeshyperliquidokx-dexfee-capturehigh-value
Summary
Aggregator referral and perp DEX builder-code programs are permissionless, onchain-attributable fee-capture rails: an app earns a share of trading fees paid by users it routes (OKX DEX pays 10–50% of invitee UI service fees tiered by monthly volume; Hyperliquid builder fees cap at 0.1% on perps / 1% on spot, claimed onchain). DefiLlama shows $23.95M of Hyperliquid builder-code fees in Q3 2026 alone, so this is real revenue, not theory. Stream 9's `s9-todo-010` (referral / builder-code attribution module, HIGH, PENDING) can implement `computeEffectiveBps`, `compareRoutes`, and `attributeVolume` against these programs without custody, indexes, or stored media — fitting the §06 storage budget.
Key Findings
- OKX DEX Referral Program (primary source): 7 levels — L1 10% at $0 monthly volume through L7 50% at $10M monthly invitee volume. Actual commission rate = total rate − invitee discount (referrers set 0–10% discount for invitees; example: 50% − 10% = 40%). Commissions are paid instantly in fee tokens to the inviter's self-custodial wallet; all referral and commission data is on-chain and traceable. Up to 100 referral codes per wallet (5–15 alphanumeric). Levels are re-evaluated hourly for upgrades and monthly for downgrades (3 consecutive missed months). Chains: Solana, Ethereum, Base, BSC, Arbitrum and other EVM chains.
- Hyperliquid builder codes (primary source): per-order builder parameter `{"b": address, "f": number}` where `f` is tenths of a basis point (f=10 = 1 bp). Capped server-side at 0.1% on perps, 1% on spot; applies to both sides of perp trades. The user must approve a max fee per builder via the
ApproveBuilderFeeaction, signed by the main wallet — not an agent/API wallet. Builder needs ≥100 USDC perps account value and standard account-abstraction mode. Max 10 active builder approvals per user. Fees are claimable through the referral reward claim process; queryable via{"type": "maxBuilderFee", ...}and{"type": "referral", ...}info requests; per-builder fill logs are published as daily LZ4 CSVs under stats-data.hyperliquid.xyz. - 1inch / Fusion referral signal: the 1inch liquidity protocol accepts a
referraladdress on swap (1/20 of LP fees minted to the referral wallet when nonzero), and Fusion resolvers fill intent orders for the surplus — a precedent for attributing intent-solver flow (our s9-todo-001) to a referrer. - Rebate vs price comparison: on OKX the rebate nets out the invitee discount (total − discount), so the rebate survives route comparison only if execution quality is competitive; `computeEffectiveBps` must subtract the referral share from the venue fee before comparing routes.
- Agent constraint: because Hyperliquid builder approvals must be signed by the user's main wallet, a zero-storage agent can never set referral codes on the user's behalf — the module reads/attributes only; approval is a user action.
Recommendations
Rec 1 (Stream 9, s9-todo-010): Implement
streams/stream-9-zerostorage/referral-fees.js: normalizeVenue (OKX DEX, Hyperliquid, 1inch/Fusion), computeEffectiveBps (venue fee minus referral share and invitee discount), compareRoutes (execution quality vs net rebate), attributeVolume, summarizeAttribution. Model the OKX tier table (10%/$0 → 50%/$10M) and Hyperliquid f tenths-of-bps with the 0.1% perp cap. §03.9. Marks research-todo-018-001 complete.Rec 2 (Stream 9 / Stream 2): Wire referral codes into batch settlement so rebates are allocated per payment and provably included in the settlement hash; also offer referral codes on the x402 data API so API consumers can attribute volume (Stream 2 A2A monetization).
Rec 3 (Infra / UX): Never let the agent sign
ApproveBuilderFee or create referral codes for users; expose the user's own codes/addresses as read-only attribution inputs, since both OKX and Hyperliquid tie attribution to user-signed actions.Rec 4 (Revisit): Add Hyperliquid builder-codes docs and OKX DEX referral help to the research revisit queue (high value, 7 days = 2026-10-25); tier tables and caps can change with volume incentives.
Impact on Streams / Todos
- Stream 9 (Zero-storage): unblocks s9-todo-010 (referral / builder-code attribution module, HIGH, PENDING, `referral-fees.js`); informs
batch-settlement.jsrebate allocation and the x402 data API catalog. Marks research-todo-018-001 complete. - Stream 2 (A2A): referral codes on paid API endpoints extend x402 monetization with volume-based revshare.
- Infra: adds Hyperliquid info endpoints (
/infomaxBuilderFee,referral) and stats-data CSVs to the source inventory; revisit 2026-10-25.
Sources
- Hyperliquid Docs — Builder codes (per-order fee, 0.1%/1% caps, ApproveBuilderFee, /info referral)
- OKX Help — DEX Referral program (7 tiers, 10–50%, volume thresholds, instant payouts)
- 1inch Liquidity Protocol — referral parameter on swap (1/20 of LP fees to referral wallet)
- DefiLlama — Hyperliquid Perps fees/revenue ($23.95M builder-code fees Q3 2026, market signal)
Unblocks
research-todo-018-001 s9-todo-001 s9-todo-010