# Gated pools: how BlazePhoenix routes through permissioned venues

> Canonical: https://blazephoenix.xyz/learn/gated-pools-permissioned-venues/
> License: CC BY-NC-ND 4.0 (attribution + link) · © 2026 BlazePhoenix
> Updated: 2026-11-17

How the BlazePhoenixGate of the 2.0.0 generation routes through Curve, Balancer, PancakeSwap Infinity, Liquidity Book and Algebra Integral venues: wrappers whose address is derived by CREATE2 under the V3 salt, adapters admitted by propose, 48 hours, accept and revoked at once, the factory code-hash pin checked by gateWrapperLive, and swaps settled by measured delta on explicit routes. None of the eight adapters is deployed on mainnet yet.

BlazePhoenixGate is the 2.0.0 contract that lets the BlazePhoenix DEX route through venues the Core cannot read natively. That generation is scheduled to launch on 15 December 2026; it is not deployed yet, and no address is published for it. The DEX main branch carries eight adapters for the Gate: Curve StableSwap-NG; Curve Twocrypto-NG and Tricrypto-NG; Balancer V2; Balancer V3; PancakeSwap Infinity CL; PancakeSwap Infinity Bin; Liquidity Book (LFJ v2.1 and v2.2, Pharaoh DLMM); and Algebra Integral (Blackhole). None of them is deployed on mainnet yet. The Gate places these venues behind thin wrappers, and the venue adapters article describes what each adapter checks.

To the Router, each wrapper looks like a Uniswap V3 pair: it answers swap and uniswapV3SwapCallback, and exposes token0, token1 and fee. Behind it, an adapter for the venue family trades on the real venue.

The Gate is registered in the Hub as one factory row of kind KIND_EXTERNAL (kind 9) in mode MODE_CREATE2_V3. Everything below describes the code in the public repository; the generation that carries it is the one that goes live on the launch date.

## What is a Gate wrapper?

A wrapper is an immutable contract with no proxy. Its immutables are the gate that made it, the two tokens, a venue key (family << 16 | slot, which the Hub reads as the fee field), the venue contract it fronts and two auxiliary words for the adapter. Between calls it holds no tokens; its one piece of state is a use counter, vitalSlot.

Wrappers are created by the curator through Gate.create. At creation the Gate asks the family adapter to resolve the pair: the adapter must prove from the venue itself (its registry, factory or vault) that the hinted contract belongs to that venue for those two tokens. The answer is written into the wrapper as an immutable, so the venue behind a slot is fixed for the life of the wrapper. A venue key of 0 is refused, because the Hub reserves fee 0 for the Algebra derivation.

## How is a wrapper's address derived?

A wrapper is found by computation, not by a list. The Gate deploys each wrapper with CREATE2 under the same salt formula the Hub uses for Uniswap V3 factories, Core.v3Salt, and with the hash of the wrapper creation code, WRAPPER_INIT_HASH. Anyone can recompute the address from the Gate, the two tokens and the venue key, and Gate.wrapperAddress returns it whether or not the wrapper exists yet.

The Hub admits kind 9 in the MODE_CREATE2_V3 row and refuses it in rows that look addresses up from a factory: a lookup row would trust the factory's answer, and a wrapper's identity is its CREATE2 address and nothing else.

```
wrapper = CREATE2(gate, keccak256(abi.encode(token0, token1, venueKey)), WRAPPER_INIT_HASH)
# token0 < token1 (sorted), venueKey = family << 16 | slot, venueKey != 0
# the same salt (Core.v3Salt) the Hub derives Uniswap V3 pairs with
```

## How is an adapter admitted, and how is it removed?

In BlazePhoenixGate, an adapter change waits 48 hours (ADAPTER_DELAY). The first step, proposeAdapter, scans the candidate runtime code opcode by opcode, stepping over PUSH data, and refuses DELEGATECALL, CALLCODE and SELFDESTRUCT, as well as empty code and an EIP-7702 delegation designator; it records the code hash. acceptAdapter succeeds once that delay has passed and the code hash still matches the proposal, and it pins that hash.

liveAdapter returns zero when no adapter is set or when the adapter code no longer matches its pin, and every wrapper swap asks liveAdapter again. clearAdapter takes effect at once: from then on the wrappers of that family revert, and other kinds of venue are untouched. After renounceControl the curator can still add a new family or a new wrapper, but can no longer replace or clear an adapter.

## What does the factory code-hash pin add?

When the Hub admits a factory with addFactory, it stores that factory's code hash, readable as Hub.factoryCodehashOf. A kind 9 leg is accepted through BPC.gateWrapperLive, which does not take the calldata's word that an address is a wrapper. It asks the wrapper which gate made it, requires that gate's current code hash to equal the hash the Hub admitted, recomputes the CREATE2 address from the hop's own tokens and the leg's fee and requires it to equal the wrapper, and requires a live adapter for the family.

Each of those reads is gas-capped and reads as zero on failure, so the check fails closed. The Router's kind 9 path and the Quoter both use it; a leg that fails it reverts with RouterE(19).

## How does a swap through a wrapper settle?

The Router calls the wrapper with the Uniswap V3 swap ABI, exact input. The wrapper asks for its input through uniswapV3SwapCallback, measures how much arrived, and reverts if it is less than requested. It forwards exactly that measured amount to the adapter, which trades on the venue and pays the recipient.

Custody is then checked by delta: the adapter must end holding no more of either token than before, and so must the wrapper. The output reported back to the Router is the balance change measured at the recipient, never a figure the adapter returns. The swap never reads the quote, and the floors stay the Router's: each leg must deliver at least 80 percent of its bound, and the transaction must deliver the caller's minimum.

## Where are gated venues executed?

In this design, BlazePhoenix runs gated legs on the Router's explicit-route doors: the caller supplies the route, built off-chain and priced with Quoter.previewRouteExact through eth_call. The best-route door, swapBestExactIn, re-enters as the Router itself, and a plan carrying a kind 9 leg is refused there; the Solver does not plan Gate legs.

The companion article on gate vitality explains how a gated venue reports that it is alive and how deep it is, and the trust-minimised routing article places the Gate in the wider trust model. The venue adapters article describes each of the eight adapters.

**Verify it yourself:** git clone https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex && cd Blaze-Phoenix-Dex && grep -n 'ADAPTER_DELAY\|function clearAdapter\|function liveAdapter\|function wrapperAddress' src/BlazePhoenixGate.sol && grep -n 'function gateWrapperLive' src/BlazePhoenixCore.sol

Related: https://blazephoenix.xyz/learn/venue-adapters-and-the-gate/ · https://blazephoenix.xyz/learn/gate-vitality-adapter-depth/ · https://blazephoenix.xyz/learn/trust-minimised-routing/ · https://blazephoenix.xyz/learn/why-blazephoenix-trusts-less/ · https://blazephoenix.xyz/learn/create2-discovery/ · https://blazephoenix.xyz/learn/two-entry-points-calldata-trust/ · https://blazephoenix.xyz/learn/custody-explained/
