# A venue is data: how the Gate admits venues the Core cannot price natively

> Canonical: https://blazephoenix.xyz/learn/a-venue-is-data/
> License: CC BY-NC-ND 4.0 (attribution + link) · © 2026 BlazePhoenix
> Updated: 2026-11-16

A router can use a venue it cannot price from storage by treating the venue as data, never as an authority. An immutable wrapper speaks the V3 swap ABI, an adapter enters through a 48-hour delay and an opcode scan, and the Router still measures the balance delta at the recipient.

Short answer: by treating the venue as data and never as an authority. A thin immutable wrapper stands in front of the venue and speaks the V3 swap ABI. Nothing the wrapper or its adapter says about its own output becomes an input to a floor, because the Router measures the balance delta at the recipient exactly as it does for a V3 pool.

This is the Gate, one factory row in the Hub (section 4.5 of the whitepaper). It exists for venues the Core cannot read natively: Balancer V2 and V3, Curve StableSwap-NG, Twocrypto-NG and Tricrypto-NG, PancakeSwap Infinity CL and Bin, Liquidity Book, and Algebra Integral.

## Wrapper: a V3 shape the Router already knows

For each venue the Gate creates a wrapper at a derived address. To the Router the wrapper is kind 9: it speaks the V3 `swap` and `uniswapV3SwapCallback` ABI and forwards what it measured arriving to its family's adapter. The Hub admits kind 9 only as a `MODE_CREATE2_V3` factory row, so a wrapper can exist in the registry only at the address the Gate's own creation code derives.

When a leg of an external kind executes, the Router checks that the wrapper it names is the one the Gate derives from the hop's own tokens and fee. Otherwise it refuses with `RouterE(19)`. The kind in calldata is a claim, and the derived address is the identity.

## Adapter: two steps, 48 hours apart

An adapter enters in two steps separated by `ADAPTER_DELAY = 48 hours`. At the proposal the Gate scans the adapter's runtime code opcode by opcode, stepping over `PUSH` data. It refuses `DELEGATECALL`, `CALLCODE` and `SELFDESTRUCT`, because code that can run foreign code in its own context, or vanish and be redeployed, would make a pin meaningless. Empty code and an EIP-7702 delegation prefix are refused too. The scan is conservative: it may refuse honest code and never admits dishonest code.

The proposal records the adapter's code hash. The acceptance reverts if the code has moved since, and pins the hash. From then on `liveAdapter` answers zero when none is set or when the code at the address is no longer the pinned code, and every swap reads it, so a changed adapter stops every wrapper of its family at the next call.

## What the Router trusts, and what it measures

An adapter is immutable, leaves no allowance standing, and after each call may hold no more of either token than before. A venue that can only be priced by simulating it is quoted by `eth_call`. That quote is advice to the caller, and the Router's execution floors never read it.

The Gate's one pricing function, `gateQuote`, asks its questions in order. First identity: the Hub has admitted the Gate, the Gate still runs the code it was admitted with, the wrapper sits at the address the Gate derives, and the family's adapter is live. Then the wrapper's own `quote` is called by `staticcall` under a fixed gas ceiling. A failure is a zero quote and the venue drops out.

## Why the cap is four

The reason is a cost, not a taste. The best door reads every wrapper of the pair on every solve, one identity check each, and every wrapper enters the Solver's funnel next to the native venues. A wrapper's mass is not measured from a reserve, so it is never dropped as dust. The cap is what bounds the work.

Creating a wrapper stays a curator act, because the first creation fixes the venue pool of its token pair and venue key for ever. An open door would let anyone occupy every slot with a thin pool of a legitimate venue. Clearing a family is a brake and not a power over funds: its wrappers revert from the next call and the other kinds are untouched.

## What this does not claim

It does not claim every venue of those families is wrapped, only that the ones that are enter by this path. It does not make a venue's quote true. It makes the quote irrelevant to settlement: the floors are enforced on the delta the recipient actually received.

**Verify it yourself:** grep -n 'ADAPTER_DELAY\|MAX_WRAPPERS_PER_PAIR' src/BlazePhoenixGate.sol   # declared at lines 76 and 78 at commit 969bcc6, in a checkout of the V2 repository. Then read gateWrapperLive and the RouterE(19) refusal in the Router's leg execution. Reading: section 4.5 of the 2.4 whitepaper.

Related: https://blazephoenix.xyz/learn/venue-adapters-and-the-gate/ · https://blazephoenix.xyz/learn/gate-vitality-adapter-depth/ · https://blazephoenix.xyz/learn/integrated-dexes/ · https://blazephoenix.xyz/learn/verifying-beats-solving/
