Core contracts
Flaunch.sol
Flaunch creates the launched token, its pools and its launch NFT. The findings below cover the shared launch nonce and the price supplied when an ERC20 pool is initialised.
Reviewed source: src/Flaunch.sol at commit 38f14ff.
Findings
| ID | Severity | Finding |
|---|---|---|
| B-08 | Medium | Any launch invalidates every nonce-pinned launch in flight |
| B-14 | Low | Unpinned ERC20 launches can open at the reciprocal price |
[MEDIUM] B-08 · Any launch invalidates every nonce-pinned launch in flight
B-08 · Medium
All launchers share one token nonce. Any intervening launch makes prepared AtomicLaunchZap, TrustedSignerZap and launchWithExpectedNonce calls revert.
The launched token's address is derived from a global tokenNonce. That address determines currency ordering for ERC20 pairs, so nonce-pinned entry points protect callers by reverting when the predicted nonce is stale.
Every launch increments the same counter. An unrelated launch therefore invalidates every prepared launch that read the previous value. The frontend uses AtomicLaunchZap, and trusted-signer launches also bind their authorisation to the predicted context. An attacker can repeatedly submit junk launches to keep those paths failing; ordinary concurrent launches can cause the same failures.
Earlier review: Follow-on to F-06. The earlier prebuy failure was fixed; nonce pinning introduces this separate interference path.
Impact
Prepared launches revert and users have to rebuild their transactions. Signed launches also need a new authorisation. A junk launch has no protocol launch fee and costs about 1.0 million gas in the source test, making repeated interference practical. The issue affects availability rather than custody.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/Flaunch.sol:203–205— Expected-nonce launches reject any change to the global counter.src/Flaunch.sol:288–289— Clone creation consumes that counter.src/zaps/abstract/LaunchZapBase.sol:84–89— Zaps use the same expected-nonce condition.
From src/Flaunch.sol:203–206:
if (_expectedNonce != tokenNonce) {
revert LaunchNonceChanged(_expectedNonce, tokenNonce);
}
return launch(_name, _symbol, _baseFee, _contractURI, _pairedTokens, _nftLink, _recipients, _recipient);
Proof of concept
- Prepare an atomic or signed launch using the current
tokenNonce. - Submit an unrelated launch before the prepared transaction.
- Submit the prepared launch and observe
LaunchNonceChanged.
ZapsPoC.t.sol::test_Z03_cheapLaunchInvalidatesNoncePinnedSignedLaunch reproduces the failure and records 1,008,886 gas for the interfering launch, including test overhead. TokensOrderingFlip.t.sol::test_pinnedLaunchRevertsOnAnyInterleavedLaunch provides a second case.
The test source is poc/ZapsPoC.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/ZapsPoC.t.sol' -vv
Recommended solution
Derive the clone salt from the launcher and a launcher-chosen salt. That makes the address predictable without depending on other launches and also removes the currency-order race in B-14.
[LOW] B-14 · Unpinned ERC20 launches can open at the reciprocal price
B-14 · Low
An intervening launch can change the new token's address and reverse currency ordering. Unpinned entry points then interpret the supplied starting price in the opposite direction.
Pool initialisation takes sqrtPriceX96 in currency0/currency1 order. For an ERC20 pair, that order depends on whether the launched token's address sorts before or after the paired token.
The clone address depends on the global launch nonce. A caller can prepare a price for one predicted address, then have an unrelated launch consume that nonce before their transaction executes. Flaunch.launch and LaunchZap.launch do not pin it. If the replacement address sorts on the other side of the paired token, the same price encodes the reciprocal economic value.
Earlier review: Follow-on to F-06. The remaining race affects price orientation in unpinned ERC20 launch paths.
Impact
The launch can revert or open at the reciprocal of the intended price. The effect is limited to the affected launch and depends on currency ordering changing; native ETH pairs do not have this ordering ambiguity.
Nonce-pinned entry points reject the race, but then face the availability issue in B-08.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/Flaunch.sol:288–289— The global nonce determines the clone address.src/Flaunch.sol:459–472— Address ordering determines the key, while the supplied price is used unchanged.src/zaps/LaunchZap.sol:43–57— This entry point does not pin the expected nonce.
From src/Flaunch.sol:459–472:
bool tokenIsCurrency0 = pairedTokenCurrency > tokenCurrency;
// Determine the PoolKey for the paired token
PoolKey memory key = PoolKey({currency0: tokenIsCurrency0 ? tokenCurrency : pairedTokenCurrency, currency1: tokenIsCurrency0 ? pairedTokenCurrency : tokenCurrency, fee: 0, tickSpacing: 60, hooks: flaunchHook});
poolToken[key.toId()] = _token;
// Publish the key before any pool callback so indexers never need PoolManager-wide subscriptions.
emit LaunchPoolRegistered(_token, PoolId.unwrap(key.toId()), Currency.unwrap(key.currency0), Currency.unwrap(key.currency1), key.fee, key.tickSpacing, address(key.hooks));
// Initialise the liquidity position
// Each requested pair must be validated and initialized with its own liquidity; failure reverts the launch.
// forge-lint: disable-next-line(calls-loop)
int24 tick = poolManager.initialize(key, _pairedToken.sqrtPriceX96);
Proof of concept
- Prepare an ERC20-paired launch with a price in the predicted currency order.
- Submit another launch that changes the next clone address and flips that order.
- Execute the unpinned launch and inspect its starting price.
ZapsPoC.t.sol::test_Z04_launchZapErc20StartingPriceInvertsWhenAnotherLaunchLandsFirst reproduces the inversion. TokensOrderingFlip.t.sol covers both a reciprocal-price launch and a launch that reverts at a typical price. CoreRouteAndLaunch.t.sol provides independent cases, including a six-decimal pair.
The test source is poc/TokensOrderingFlip.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/TokensOrderingFlip.t.sol' -vv
Recommended solution
Use a launcher-specific salt so other launches cannot change the token address, as recommended in B-08. Alternatively, accept the economic price in a fixed token orientation and invert it on chain after determining the actual currency order.
Shared findings
- B-02 · Medium: Graduated ETH revenue is locked for Buy-and-Burn routes without an ETH pair — Graduation registers ETH revenue even when the launch has no native-ETH pair.
- B-12 · Low: Distribution cannot complete for launches with many currencies — Launch pair counts determine the number of currencies the inherited distributor must process.
- B-24 · Low: Single-step ownership and renunciation can permanently freeze payouts — Flaunch inherits the distributor's ownership and pause controls; pausing before renunciation freezes payouts.