We manage your security to weather the AI storm →

AMM audit for DEXs, pools and order books

In an AMM, anyone can call the pricing math with any amount, and a rounding error repeated enough times can drain a pool. Guardian tests that math with two independent teams and invariant fuzzing, and has published 20+ DEX and AMM reports.

20+ Public DEX and AMM reports
200+ Criticals and Highs in those reports
125 Invariants in Baseline V2's report
500M+ Fuzzing runs on Poolshark Limit

Smart contract audits for

  • GMX
  • USDT0
  • LayerZero
  • Ethena
  • Synthetix
  • Jupiter
  • Yuga Labs
  • Orderly Network
  • Olympus
  • Limit Break
  • M0
  • Dolomite

Onchain · AMM and DEX Audit

Every curve, every tick, every fee.

  • Swap math and curve invariants Constant product, stableswap and custom curves: the invariant never falls on a swap, exact-in and exact-out quotes agree, and every decimal conversion holds.
  • Concentrated liquidity and ticks Tick crossing, net and gross liquidity, tick spacing and bitmaps, and positions whose bounds sit exactly on the current price.
  • Rounding direction Every division rounds in the pool’s favor, tested with tokens of fewer than 18 decimals, dust trades and near-empty pools.
  • Swap and protocol fees Fee growth inside and outside ranges, protocol cuts, dynamic fees, and pools that charge more than they declare.
  • LP shares, mint and burn Share pricing on deposit and withdrawal, first depositors and donations, and fees a mint followed by a burn can capture.
  • Price manipulation and MEV Sandwiches, front-run liquidity adds, direct token transfers and flash swaps that move a price before the pool acts on it.
  • TWAP and oracle exposure Observation windows and minimum TWAP lengths, rate limits on price moves, and spot prices other protocols read from your pool.
  • Reentrancy and callbacks Swap and flash callbacks, native-token refunds, token hooks, and read-only reentrancy into quote functions.
  • Routers and multi-hop swaps Callback caller checks, standing approvals, per-hop fees and slippage, partial fills and leftover balances.
  • Order books with onchain settlement Price buckets and order lists, cancels after fills, fee transfers on every match, and a settlement ledger that stays solvent.
  • Liquidity managers Rebalancing vaults on concentrated liquidity pools: share slippage, tick checks before deposits, and reward claims.
  • Pool creation and admin Factories, initializers, deterministic deployments, fee switches, whitelists and the roles that pause or change them.

Covers constant product, stableswap and concentrated liquidity AMMs, onchain order books, routers and liquidity managers on Ethereum, L2s and other EVM chains. Uniswap v4 hooks have their own Uniswap v4 Hook Audit.

Public findings

What Guardian’s DEX security audits have found.

Each card links a finding in a public Guardian report. All were resolved.

  1. C-02Baseline AMM · Critical

    Quotes rounded against the trader, but the transfer rounded down, so with a 6-decimal reserve token a dust buy paid about half its quoted price. That price became the pool’s average, and one small sell made it the pool price: anyone could then buy at roughly half off.

    Rounding Read the finding C-02 in the Baseline AMM Round 2 report

  2. TK-1Poolshark Limit · Critical

    Active liquidity was stashed on a tick without being zeroed, so it counted twice. Swaps then drew on tokens from positions far from the price, and LPs could not burn.

    Ticks Read the finding TK-1 in the Poolshark Limit report

  3. H-03Limit Break AMM · High

    Protocol fees were checked against an estimate from the pool’s declared fee. A pool could declare a tiny fee, charge more on swaps, and pay the protocol only its cut of the declared one.

    Fees Read the finding H-03 in the Limit Break AMM report

  4. POS-1Poolshark Limit · High

    Accrued fees were valued at a position’s range boundary, not the current price. An attacker could mint while fees were undervalued, then burn for their full value, taking yield from other LPs.

    LP shares Read the finding POS-1 in the Poolshark Limit report

  5. C-02Baseline V2 · Critical

    A whale could sell into the floor, send reserve tokens straight to the pool and trigger a slide. The donation deepened floor liquidity, so buying back ended at a lower price: a guaranteed profit on a short.

    Manipulation Read the finding C-02 in the Baseline V2 report

  6. EP-4Poolshark Cover · Critical

    Cover pools follow a TWAP, capping how far the price moves per auction. When elapsed blocks were not a whole number of auctions, the cap fell off the tick grid: positions landed on invalid ticks and swaps took more than the auction held.

    TWAP Read the finding EP-4 in the Poolshark Cover report

  7. H-09Baseline AMM · High

    A native-token refund ran before swap reserves reached the vault. Reentering mid-swap, a buyer could stake while harvestable yield read as zero and share in yield owed to existing stakers.

    Reentrancy Read the finding H-09 in the Baseline AMM Round 2 report

  8. PROU-1Poolshark Limit · Critical

    The router’s swap callback never checked that its caller was a real Poolshark pool. Anyone could call it and pull tokens from every user who had approved the router.

    Routers Read the finding PROU-1 in the Poolshark Limit report

  9. C-01Ethereal Orderbook DEX · Critical

    Matching credited maker and taker fees to the fee collector without debiting traders. Once the collector claimed them, the ledger fell short and depositors could not withdraw.

    Settlement Read the finding C-01 in the Ethereal Orderbook DEX report

  10. C-01Limit Break AMM · Critical

    closeOrder zeroed an order’s amount before reading it for the refund. Closing any order that was not first in its price bucket refunded nothing and left the maker’s tokens stuck.

    Order book Read the finding C-01 in the Limit Break AMM report

  11. H-01Gamma MultiPositionManager · High

    MultiPositionDeployer.deploy() had no access control. Anyone could copy a pending deployment’s public parameters, deploy first at the same CREATE2 address and make the real deployment revert, blocking token launch migrations and pools created with limit order support.

    Pool creation Read the finding H-01 in the Gamma MultiPositionManager report

Onchain · How it runs

Two teams, and pool math written as code.

  1. 01 / Two teams

    Two independent teams, one scope.

    Team A pairs expert manual review with the fuzzing suite. Team B runs Helix across every corner. Each cross-checks the other.

    • Expert manual review
    • Competitive incentives
    • Cross-checked findings
  2. 02 / Helix AI Auditor

    Helix, the leading AI Auditor.

    Hundreds of parallel agents spend billions of tokens across the entire codebase. Only human-verified findings reach the report.

    • Billions of tokens
    • Human-guided context
    • Human-triaged findings
  3. 03 / Invariant fuzzing

    An invariant suite around your pool.

    Core safety properties become executable invariants, fuzzed across every reachable state. On an AMM, those are its liquidity and solvency rules.

    • Pool liquidity never underflows
    • Transfers never exceed pool balance
    • Capacity covers circulating supply
  4. 04 / Price manipulation

    An attacker who trades first.

    Reviewers take every path that reads or sets a price and ask what happens if someone moved the pool first: front-run, donated to, flash-swapped or reentered.

    • Sandwiches and front-run adds
    • Donations and direct transfers
    • Pool prices read as oracles

The suite stays with your code for every later change. Poolshark kept the Echidna harness from its Limit review: 22 invariants, more than half a billion fuzzing runs. In Baseline V2’s report, “Anchor liquidity should not decrease” failed under fuzzing, and H-01 shows how a sweep could thin the anchor range.

Published work

AMMs and DEXs Guardian has reviewed.

Recent incidents

The failures an AMM audit tests for.

  1. $223MCetus

    A faulty overflow check in an imported math library let a one-token deposit buy enormous liquidity in a narrow tick range. The attacker withdrew it as real tokens.

    May 2025 Our breakdown of the Cetus incident

  2. $121.1MBalancer

    Exact-out swaps rounded the trader’s input down. Rate providers added imprecision and low liquidity magnified it; Rekt counts 65 or more swaps in one exploit transaction.

    Nov 2025 Our breakdown of the Balancer incident

  3. 606 daysCurve pools

    Vyper 0.2.15 to 0.3.0 compiled the pools’ reentrancy locks incorrectly, so the locks did not hold. Four Curve pools built with those versions were drained in July 2023, 606 days after Vyper 0.3.1 fixed the bug.

    Jul 2023 Our coverage of the Curve pools incident

“10/10 They are hands down some of the absolute best security minds in the space. This is how auditing DeFi protocols should be.”
AlphakeyPoolshark
“My team and I have worked with many auditors in the past, including generally considered top tier firms. I can confidently say that we have never felt as secure as when working with Guardian.”
IndigoBaseline

Resource Hub

Before you book an AMM audit.

Questions

AMM audit questions

What does an AMM audit cover?

The pool, factory, router and position contracts, and every math library they import. Cetus lost about $223 million through a library its auditor had left out of scope, so list imported libraries in your scope too. Uniswap v4 hooks get their own Uniswap v4 Hook Audit.

Do you audit Uniswap forks and integrations?

Yes. A fork is new code wherever it differs from upstream, and an integration inherits the pool’s math. Guardian’s public reports include Gamma’s position managers on Algebra pools and FlowRouter’s routes into Uniswap v4 and Ekubo pools.

How do you test sandwich and MEV risk?

Each deposit, liquidity add and swap is reviewed against a trader who moves the price first. A slippage check must compare against state the attacker cannot move: in Gamma’s position managers, the slippage check added as a fix computed expected shares from the same manipulable state, so it always passed. That finding is acknowledged.

Do you audit order book DEXs?

Yes, where orders settle onchain. Limit Break’s AMM includes an onchain order book of linked price buckets, and Ethereal’s settlement contracts keep the balances its order book trades settle against. An offchain matching engine is scoped separately, as an Offchain Automation Pentest.

How long does an AMM audit take?

Published Guardian reviews ran under two weeks on Baseline V2 and on Ethereal’s settlement contracts, and a month on Poolshark Limit. How long a smart contract audit takes covers lead time, code freeze and fix review.

Which invariants do you fuzz on an AMM?

Liquidity and solvency rules. Poolshark Limit’s report lists “Minting a position then burning the position causes no change in global liquidity”. Baseline V2’s report lists 125 invariants, from “Positions Ticks Always Multiple Of Tick Spacing” to its solvency rule on circulating supply.

Smart Contract Audit

Other engagements

Start now

Get a quote for your AMM audit.

Get a quote