Documentation Index
Fetch the complete documentation index at: https://docs.geode.ag/llms.txt
Use this file to discover all available pages before exploring further.

The Problem
Every trade on a traditional AMM is a public transaction visible in the mempool before it’s confirmed. This creates a systematic disadvantage for regular traders:Sandwich Attacks
MEV bots detect your pending swap, front-run it to move the price against you, then back-run to profit. You get a worse price; the bot pockets the difference.
Information Asymmetry
Sophisticated actors see your order flow before execution and trade ahead of it. Retail traders are at a structural disadvantage by design.
Sequential Execution
Trades execute one-by-one, each moving the price for the next. Your execution price depends on where you land in the block — not on the actual market.
Fragmented Liquidity
Liquidity is spread across AMMs, aggregators, and order books. Each venue has its own price, and routing adds complexity and cost.
The Solution: Batch Auctions
Geode replaces sequential trade execution with batch auctions. Instead of executing each swap individually against the AMM, Geode collects signed trade intents over a block window and settles them all at a single uniform clearing price.Core Guarantee: Every trader in the same batch gets the same price — regardless of trade size, submission order, or sophistication.
What This Means in Practice
| Property | Traditional AMM | Geode |
|---|---|---|
| Execution | Sequential, per-transaction | Batch, all-at-once |
| Price | Depends on position in block | Uniform for entire batch |
| MEV | Sandwich attacks are profitable | Batching makes sandwiching impossible |
| Matching | Every trade hits the AMM | Opposing flow crosses internally, free of AMM spread |
| Settlement | Each swap pays full gas | One transaction settles the entire batch |
Architecture
Geode is built as a Uniswap v4 Hook — a smart contract that intercepts swap calls on Uniswap v4 pools and adds batch auction functionality.Key Components
GeodeHook.sol — The Core Protocol
GeodeHook.sol — The Core Protocol
The main contract (~1,260 lines) implements the Uniswap v4
IHooks interface. It intercepts swaps via beforeSwap, collects a direct swap fee for non-intent users, and exposes geodeSettleBatch() for batch settlement.Immutables: PoolManager, Permit2, protocol treasury, factory address.State: Per-pool configuration, batch tracking, launch curve state, surplus balances.ClearingPriceLib.sol — Price Discovery
ClearingPriceLib.sol — Price Discovery
Pure library that computes the uniform clearing price, internal match amounts, and residual swap direction from a set of buy/sell intents and the current AMM spot price.The clearing price equals the AMM spot price. Intents whose limit prices are compatible get filled; the rest are skipped.
Permit2 — Gasless Token Approvals
Permit2 — Gasless Token Approvals
Intents are signed as Permit2
permitWitnessTransferFrom messages. The user signs once; the settler pulls tokens on their behalf during settlement. No separate approval transaction needed.GeodeFactory.sol — Token Launches
GeodeFactory.sol — Token Launches
Permissionless factory that deploys GeodeToken ERC20s, mints the full supply to the hook, and configures the bonding curve. Single-transaction launch with no upfront liquidity required.
Two Operating Modes
Standard Mode
For pools with existing AMM liquidity. The hook attaches to any Uniswap v4 pool and adds batch settlement on top.Intents Collected
Users sign Permit2 intents expressing their desired trades. Settlers collect these off-chain.
Clearing Price Applied
The clearing price algorithm determines fills. Compatible buy and sell flow crosses internally at the clearing price.
Launch Mode (Geocurve)
For new token launches. A virtual constant-product bonding curve manages price discovery from day one.Token Created
Deployer calls
GeodeFactory.launch(). A new ERC20 is deployed, full supply goes to the hook, and the bonding curve activates.Trading on the Curve
Buys dispense tokens from the curve at rising prices. Sells absorb tokens back at falling prices. The curve is the only market during this phase.
Graduation
When the ETH reserve crosses the graduation threshold (default: 85 ETH), the curve transitions to
PendingGraduation.Key Properties
Immutable
No admin keys, no upgradeability, no privileged roles. The protocol is fully immutable once deployed.
Permissionless
Anyone can settle batches. Anyone can launch tokens. Anyone can call graduation. No gatekeepers.
On-Chain Only
No off-chain state dependencies. Every function operates from on-chain state. No sequencers, no relayers, no trusted infrastructure.
Uniswap v4 Native
Not a fork or wrapper. A native v4 hook that composes directly with the PoolManager’s flash accounting system.
Dive deeper: Read How It Works for the settlement flow, or Economics for the fee model and wash trade resistance.