Unicorn Protocol is a non-custodial, non-upgradeable automated market maker (AMM) built on Ethereum. Unicorn v1 introduces Horn Hook architecture — a generalized plugin system that allows arbitrary logic to execute at every lifecycle point of a liquidity pool. Combined with a singleton pool manager, flash accounting via EIP-1153 transient storage, and native ETH support, Unicorn v1 reduces pool creation cost by ~99.9% and multi-hop swap gas by ~40% versus prior Uniswap v3 deployments. We describe the protocol's design, prove key invariants, and document the Horn Hook interface in full.
Automated market makers (AMMs) have become the backbone of decentralised finance, processing trillions of dollars in trading volume with no counterparty risk. Uniswap v2 and v3 established the concentrated liquidity model as the industry standard. Unicorn Protocol extends this foundation with a principled redesign centred on three pillars: programmability, efficiency, and security.
The key insight motivating this work is that an AMM pool should be a primitive, not a product. By exposing a lifecycle hook interface, Unicorn enables developers to build order books, volatility oracles, yield strategies, and MEV mitigations directly on top of a shared liquidity layer — without forking the core protocol.
Unicorn v1 launched on Ethereum mainnet in Q1 2025, following nine independent security audits totalling 47 auditor-months of review, a $50K public audit competition on Code4rena attracting 214 researchers, and formal verification of all pool invariants via Certora Prover[1].
All Unicorn pools are managed by a single immutable contract, UnicornPoolManager. Each pool is identified by a PoolKey struct:
The singleton architecture reduces pool deployment gas from ~$400 (Uniswap v2) to under $0.50, enabling permissionless pool creation at scale. All token balances are tracked as deltas within a single ERC-6909 multi-token ledger, eliminating per-pool ERC-20 deployments.
Unicorn inherits Uniswap v3's tick-based concentrated liquidity model. Liquidity providers specify a price range [Pa, Pb] and receive pro-rata fees only when the current price trades within that range. The invariant for a single position is:
Horn Hooks can modify this model by adjusting virtual reserves, enabling novel AMM curves including constant-sum, bonding curves, and range-order books.
A Horn Hook is a smart contract that implements the IHornHook interface. The Pool Manager calls into the Hook at eight lifecycle points:
Hook permissions are encoded in the last 14 bits of the hook's deployment address. This is enforced at pool initialisation — the Pool Manager verifies that each enabled callback flag corresponds to a set bit in the address. Hooks cannot add permissions post-deployment, preventing permission escalation attacks.
The beforeSwap callback returns a BeforeSwapDelta, allowing the Hook to take ownership of part or all of the input/output amounts. This enables on-chain limit orders, just-in-time liquidity, and custom routing logic with zero additional transfers.
Pools may set fee = DYNAMIC_FEE_FLAG and return an updated fee in basis points from beforeSwap. This allows volatility-responsive fees, time-weighted fee schedules, and LP-voted fee structures — all without redeploying the pool.
Unicorn uses EIP-1153 transient storage to track token deltas within a single transaction without persistent writes. All swaps, liquidity operations, and hook callbacks accumulate net deltas. Settlement occurs exactly once at the end of the outermost lock, resolving all balances in a single pass.
This design enables complex multi-pool routes — e.g., swap ETH → USDC → CORN → ARB — with a single token settlement, reducing gas by up to 40% on 3-hop routes versus Uniswap v3.
CORN is the native governance token of Unicorn Protocol. Total supply is fixed at 1,000,000,000 CORN (1B), distributed as follows:
CORN holders govern protocol parameters via on-chain voting: fee tiers, whitelisted Hook templates, treasury allocation, and protocol upgrade proposals. A 1% quorum is required; passing requires >50% support with a 48-hour timelock on execution.
Unicorn v1 is non-upgradeable. The Pool Manager is deployed as an immutable contract with no admin keys, proxy patterns, or emergency stops. This design choice deliberately sacrifices operational flexibility in exchange for a trust-minimised, censorship-resistant base layer.
Nine independent firms audited the codebase. Key findings and mitigations:
Unicorn Protocol v1 represents a meaningful step forward in AMM design. By combining Uniswap v4's hook architecture with a novel singleton pool manager and flash accounting system, we believe Unicorn provides the most flexible and efficient liquidity primitive available on Ethereum today.
We invite the community to audit, fork, and build upon this work. All code is available at github.com/unicorn-protocol under the Business Source License 1.1, transitioning to MIT on 1 April 2029.