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.
Overview
Geode’s economic model ensures three things:- Settlers are incentivized to settle batches promptly
- Wash trading is unprofitable — batches can’t extract more than they contribute
- The protocol captures value from direct swap activity
Core invariant: A batch cannot withdraw more settlement reward than that batch economically contributed, except for a tightly capped gas reimbursement.
Fee Sources
| Fee | Rate | Source | Beneficiary |
|---|---|---|---|
| Settlement fee | 0.1% (10 bps) | Deducted from each filled intent’s input | Settler |
| Direct swap fee | 0.2% standard / 1% launch pools | Charged on non-intent swaps via beforeSwap | 50% treasury, 50% surplus |
| Gas reimbursement | Gas-based | Drawn from surplus, capped per batch | Settler |
Settlement Fee
Every filled intent pays a settlement fee from its own input before that input routes to internal matching, the curve, or the AMM:- Buy intents: fee is denominated in currency0 (e.g., WETH)
- Sell intents: fee is denominated in currency1 (e.g., the token)
- Only net input participates in matching, curve, or AMM routing
- The fee amount remains in the PoolManager as unrouted balance
poolManager.take() at the end of settlement.
Why Input-Side?
Deducting fees from the input (not the output) has important properties:One-Sided Batches Work
A batch with only buys (or only sells) still produces fees. There’s no dependency on opposite-side intents existing.
Self-Funding
Each batch’s fees come from that batch’s participants — not from a shared pool that could be drained.
Clean Distribution
Output distribution is already net of fees. No cross-side deduction needed — each buyer/seller gets their full pro-rata share.
Curve Integrity
In launch mode, curve reserves receive net input. Fees never inflate the Geocurve’s price or reserves.
Settler Reward
The total reward a settler earns from a batch:Component 1: Batch Settlement Fees
Component 2: Gas Reimbursement
- Capped: never exceeds
maxGasReimbursementper batch (default: 0.01 ETH) - Gas-based: scales with actual gas consumed, NOT with matched volume
- Surplus-funded: draws from
surplusCurrency0thensurplusCurrency1 - Best-effort: if surplus is insufficient, the settler receives less
SettlerPaid Event
Every settler payment emits an on-chain audit trail:- Settlement fees scale linearly with volume (input-funded)
- Gas reimbursement is constant across volume tiers (gas-based, capped)
Surplus Management
Accumulation
Surplus comes from direct swap fees — the fee charged by thebeforeSwap hook on non-intent swappers. When someone swaps through a Geode-configured pool without using intents:
- The hook charges
directSwapFeeBps(default 0.2% for standard pools, 1% for launch pools) - 50% goes to the protocol treasury
- 50% accumulates as surplus (held as ERC20 balance on the hook contract)
Draw-Down
Surplus is drawn for two purposes only:- Gas reimbursement — capped, per-batch, gas-based (for any pool)
- Deployer royalty — launch mode only, sized from matched volume
Wash Trade Resistance
The Attack
A wash trader submits matched buy and sell intents for the same amount. In a naive surplus-funded model, the settler reward would scale with matched volume, allowing surplus extraction.The Defense
Under Geode’s per-intent fee model, wash trading is strictly net-negative:Net P&L
The washer loses fees on both sides. They receive back less than deposited. The net cost is always negative.
Worked Example
At default parameters (0.1% fee, 0.01 ETH gas cap):| Wash Volume | Fee Cost (Both Sides) | Max Surplus Extracted | Net P&L |
|---|---|---|---|
| 1 ETH | 0.002 ETH | 0.01 ETH | +0.008 ETH |
| 5 ETH | 0.01 ETH | 0.01 ETH | 0 ETH |
| 10 ETH | 0.02 ETH | 0.01 ETH | -0.01 ETH |
| 50 ETH | 0.10 ETH | 0.01 ETH | -0.09 ETH |
Gas Cost Profile
Settlement gas scales approximately linearly with batch size after a fixed overhead:| Batch Size (N) | Total Gas | Per-Intent Gas |
|---|---|---|
| 1 | ~397K | ~397K |
| 5 | ~556K | ~111K |
| 10 | ~1.06M | ~106K |
| 25 | ~2.58M | ~103K |
| 50 | ~5.16M | ~103K |
Default Parameters
| Parameter | Value | Description |
|---|---|---|
settlementFeeBps | 10 (0.1%) | Per-intent fee on input amount |
directSwapFeeBps | 20 (0.2%) standard / 100 (1%) launch | Fee on direct (non-intent) swaps |
maxGasReimbursement | 0.01 ETH | Hard cap on surplus draw per batch |
gasReimbursementMultiplier | 150 (1.5×) | Gas cost multiplier (covers gas + margin) |
batchInterval | 1 block | Minimum blocks between settlements |
maxBatchSize | 128 | Maximum intents per side per batch |
PROTOCOL_FEE_SHARE_BPS | 5000 (50%) | Protocol’s share of direct swap fees |
Security Properties
| Property | Mechanism |
|---|---|
| Fees come from intent owner’s own input | Input-side deduction before routing |
| One-sided batches pay fees | No dependency on opposite-side output |
| Wash trading is net-negative | Both sides pay fees; surplus draw is capped |
| Surplus cannot be drained by volume | Gas reimbursement is gas-based, not volume-based |
| Curve reserves reflect net economics | Net input after fee deduction |
| Settler competition prevents manipulation | First valid batch wins; omitted intents lose to complete batches |
Verified: All economic properties are tested in
SettlementEconomics.t.sol — including adversarial wash trade scenarios, gas cap enforcement, and surplus accounting invariants.