Skip to main content

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.

Geodeguy

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

PropertyTraditional AMMGeode
ExecutionSequential, per-transactionBatch, all-at-once
PriceDepends on position in blockUniform for entire batch
MEVSandwich attacks are profitableBatching makes sandwiching impossible
MatchingEvery trade hits the AMMOpposing flow crosses internally, free of AMM spread
SettlementEach swap pays full gasOne 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

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.
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.
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.
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.
1

Intents Collected

Users sign Permit2 intents expressing their desired trades. Settlers collect these off-chain.
2

Batch Settled

A settler calls geodeSettleBatch(), pulling tokens from each user via Permit2.
3

Clearing Price Applied

The clearing price algorithm determines fills. Compatible buy and sell flow crosses internally at the clearing price.
4

Residual Routes Through AMM

Any unmatched flow (e.g., more buys than sells) routes through the underlying Uniswap v4 AMM for the remaining fill.

Launch Mode (Geocurve)

For new token launches. A virtual constant-product bonding curve manages price discovery from day one.
1

Token Created

Deployer calls GeodeFactory.launch(). A new ERC20 is deployed, full supply goes to the hook, and the bonding curve activates.
2

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.
3

Graduation

When the ETH reserve crosses the graduation threshold (default: 85 ETH), the curve transitions to PendingGraduation.
4

AMM Seeded

Anyone can call finalizeGraduation() to initialize the Uniswap v4 pool at the terminal curve price and seed permanent liquidity. The pool now operates in standard mode.

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.