Graduation to Uniswap V4

Two phases, both open to anyone, so a failed pool seed never strands a curve's reserves.

Phase 1 — graduate(token)

  • Checks that the curve is ready and that the pool seed would succeed (AgiV2GraduationGuard) before anything irreversible happens.
  • Sweeps pending fees, halts the curve and moves its reserves to the factory.
  • The buy that crosses the threshold calls it automatically; if that call fails (AutoGraduationFailed), the buy still goes through.
  • The launch moves to phase Swept.

Phase 2 — createGraduatedPool(token)

  • Permissionless and retryable: the launch stays in Swept until a seed succeeds.
  • Only the token amount that keeps the curve's final price is seeded: poolTokens = sweptTokens × sweptQuote / (sweptQuote + phantomQuote). The rest, which backed the phantom reserve, is locked for good in AgiV2LaunchLocker (GraduationTokensPermanentlyLocked).
  • The pool is initialized at the price those two amounts imply and registered with AgiV2MemeHook, and AgiV2GraduationExecutor mints a full-range position directly to the locker.
  • The launch moves to PoolCreated. From then on the hook charges the fee and the escrow pays it out.
  • Our robot sends this call and pays its gas (see Operations).

When it goes wrong

forceSweptGraduation
Owner-only, and only for a launch the guard refuses. While a seed is still viable it reverts with GraduationStillViable.
rescueSweptGraduation
Owner-only, and only 7 days after the sweep. Releases the reserves to one address for off-chain distribution, for a quote asset that can no longer make the transfer the seed needs. Until then anyone can still seed the pool. The phase becomes Rescued, which is final.
rescueCurveFees
Owner-only. Pays a still-trading launch's pending fees straight to the protocol and the creator, for a quote asset that has stopped delivering to the escrow. It is also the only way to unblock that launch's graduation.