Core contracts
FeeDistribution.sol
FeeDistribution holds revenue, allocates recipient credits and attempts payouts. Flaunch inherits this accounting and its pause controls. The findings cover distribution gas, route changes and ownership recovery.
Reviewed source: src/core/FeeDistribution.sol at commit 38f14ff.
Findings
[LOW] B-12 · Distribution cannot complete for launches with many currencies
B-12 · Low
Allocation and payout share an unbounded currency loop. With enough funded currencies and recipients, no gas limit allowed by the transaction cap lets distribution finish.
distribute loops over every currency registered to a launch. For each currency it first allocates pending revenue across the recipients, then attempts each payout. The recipient count is capped at ten, but the number of launch pairs is not capped.
With enough active currencies, early payouts consume gas needed for later allocation writes. A revert rolls back the whole call, including allocations. Retrying individual recipient payouts cannot help because the credits were never committed.
Deposits are permissionless. A third party can activate otherwise idle currencies by depositing 100 base units into each, provided the launch registered enough pairs.
Impact
A many-pair launch can become unable to distribute its revenue within the 16,777,216 per-transaction gas cap observed on Base during the source review. The owner can recover by shortening the royalty route, unless the royalty permission or NFT has been burned.
The measured boundary with ten AddressRecipient entries is 13 funded currencies completing and 14 failing. Ordinary launches with one to three pairs are unaffected, which keeps the rating Low.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/core/FeeDistribution.sol:402–444— Allocation and payout run inside the same currency loop.src/Flaunch.sol:261–273— Launch pairs have no count limit.
From src/core/FeeDistribution.sol:402–421:
function distribute(uint _tokenId) external nonReentrant whenNotPaused {
// Get the recipients and tokens for the token
Distribution storage distribution = _distributions[_tokenId];
Recipient[] memory recipients = distribution.recipients;
address[] memory tokens = distribution.currencies;
// Loop through the tokens and distribute the funds
address token;
for (uint i; i < tokens.length; ++i) {
// Get the token
token = tokens[i];
// Get the balance for the token
CurrencyDistribution storage balance = distribution.balances[token];
// Allocate only the unassigned deposit. Existing recipient credits must never be split again.
uint pending = balance.pending;
if (pending != 0) {
uint allocated = 0;
for (uint k; k < recipients.length; ++k) {
Proof of concept
CoreDistributeGas.t.sol scans call limits rather than checking a single low-gas transaction:
test_CORE02_boundary_tenRecipients13okcompletes with 13 funded currencies and ten recipients.test_CORE02_boundary_tenRecipients14stuckcannot complete within the cap with 14 currencies and the same route.test_CORE02_dustDepositsMakeLaunchUndistributablereaches the failing state through third-party dust deposits.test_CORE02_control_twelveCurrenciesDistributeUnderCapcompletes with 12 currencies.
The source review's read-only Base check found no transaction limit above 16,777,216 across 1,481 recent transactions. The gas-scan test itself needs a raised Foundry test gas limit; that does not change the cap being tested.
The test source is poc/CoreDistributeGas.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/CoreDistributeGas.t.sol' -vv
Recommended solution
Add a distribution entry point that processes one currency at a time, or cap the number of pairs with non-zero allocations at launch. Keep allocation progress independent of optional recipient payouts so a late failure cannot roll back every currency.
[LOW] B-13 · A successful distribution can skip every payout when gas is too low
B-13 · Low
The payout helper returns zero instead of reverting when its gas reserve is missing. A distribution can therefore succeed at a gas limit that pays no recipient.
The payout helper requires enough gas to forward its full recipient budget while retaining the EIP-150 reserve and call overhead. Below that threshold, it emits RecipientDistributionFailed and returns zero.
This protects the enclosing distribution from a failed payout, but it also gives gas estimation a successful path that does not distribute funds. An estimator searching for the smallest non-reverting limit can settle below the payout threshold. Adding an ordinary percentage buffer still leaves that limit too low. The same behavior affects retryRecipientDistribution.
Earlier review: Side effect of the F-11 gas-isolation fix. Recipient gas budgets are now consistent, but insufficient caller gas can silently defer every payout.
Impact
A caller pays for a confirmed transaction while no recipient receives funds. The credits remain allocated and can be retried with enough gas, so the defect causes failed payouts and wasted transaction fees rather than a loss of credited revenue.
The important distinction is between gas consumed and gas required at the call boundary. A paying execution in the test consumes about 238,000 gas, but the smallest call limit that allows the retry to pay is about 1,028,000.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/core/FeeDistribution.sol:486–504— Insufficient gas emits a failure event and returns zero.src/core/FeeDistribution.sol:402–444— The enclosing distribution can still complete successfully.
From src/core/FeeDistribution.sol:488–493:
// EIP-150 forwards at most 63/64 of the remaining gas, so require that reserve and the call setup cost on
// top of the budget; otherwise the payout frame would receive less than the documented amount.
if (gasleft() < GAS_LIMIT_PER_DISTRIBUTION + GAS_LIMIT_PER_DISTRIBUTION / 63 + DISTRIBUTION_CALL_OVERHEAD) {
emit RecipientDistributionFailed(_tokenId, _token, _recipient, amount);
return 0;
}
Proof of concept
CoreDistributeGas.t.sol::test_CORE01_estimatedGasLimitMakesDistributeSilentNoop demonstrates that a 366,478-gas call, representing a 1.5-times buffered estimate in the test, succeeds without paying. The retry's buffered estimate is 341,094 gas; its smallest paying call limit is 1,027,984 gas. Supplying at least 1.1 million gas in the fixture pays the recipient.
The source review executed the contract behavior and measured those boundaries. The explanation of a node estimator choosing the lower limit is based on its search behavior; the review did not run a funded transaction through a live wallet.
The test source is poc/CoreDistributeGas.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/CoreDistributeGas.t.sol' -vv
Recommended solution
Make the explicit retryRecipientDistribution path revert when it cannot supply the promised payout gas. Preserve failure isolation for batch distribution, but give callers a clear way to require a payout attempt.
Document the required call budget and have integrations set a gas limit that covers it, rather than relying on the successful skip path found by estimation.
[LOW] B-15 · The NFT owner can redirect an unallocated royalty backlog
B-15 · Low
Revenue is split using the route stored when distribution runs. The NFT owner can change that route, distribute the backlog to themselves and restore the advertised split.
Deposits accumulate as unallocated revenue. setTokenRoyaltyRecipients replaces the stored route without allocating that backlog under the old recipients. The next distribute uses whichever route is current at that moment.
An NFT owner who retains royalty permission can temporarily install a 100% route to themselves, distribute the accumulated revenue, then restore the previous route. Existing recipient credits are protected; the issue concerns funds that have not yet been allocated.
Impact
Co-recipients can lose a backlog earned while a different split was advertised. Only the NFT owner with royalty permission can change the route, so this is a privileged economic behavior rather than an outsider bypass. Recipients should not treat an unallocated balance as an enforceable entitlement under the current split.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/core/FeeDistribution.sol:208–259— An authorised owner replaces the route without first allocating the backlog.src/core/FeeDistribution.sol:417–434— Pending revenue is split using the recipients read at distribution time.
From src/core/FeeDistribution.sol:250–258:
// Replace the stored array by copying each recipient individually.
Distribution storage distribution = _distributions[_tokenId];
delete distribution.recipients;
for (uint i; i < _recipients.length; ++i) {
distribution.recipients.push(_recipients[i]);
}
// Index the complete effective route, regardless of how its recipient contracts were deployed.
emit TokenRoyaltyRecipientsSet(_tokenId, _recipients);
From src/core/FeeDistribution.sol:417–427:
// Allocate only the unassigned deposit. Existing recipient credits must never be split again.
uint pending = balance.pending;
if (pending != 0) {
uint allocated = 0;
for (uint k; k < recipients.length; ++k) {
uint amount = Math.mulDiv(pending, recipients[k].percentage, ONE_HUNDRED_PERCENT);
if (amount == 0) {
continue;
}
allocated += amount;
balance.pendingRecipients[recipients[k].recipient] += amount;
Proof of concept
CoreRouteAndLaunch.t.sol::test_CORE03_ownerSweepsBacklogEarnedUnderAdvertisedSplit accrues revenue under a shared route, changes it to the owner's route, distributes and restores the original split. The owner receives the 9 ETH backlog and the former co-recipient receives zero.
The test source is poc/CoreRouteAndLaunch.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/CoreRouteAndLaunch.t.sol' -vv
Recommended solution
Allocate pending revenue under the old route before replacing it, while keeping previously allocated credits retryable. If the intended model is that the owner controls all unallocated revenue, document that behavior clearly wherever a royalty split is presented.
[LOW] B-24 · Single-step ownership and renunciation can permanently freeze payouts
B-24 · Low
Six owned contracts retain single-step ownership and renunciation. On Flaunch, pausing before renouncing removes the only account that can resume payouts.
FeeDistribution, inherited by Flaunch, uses OpenZeppelin Ownable alongside Pausable. Only the owner can pause or unpause, and the inherited renounceOwnership remains available.
If the owner pauses and then renounces, distribute stays blocked while no account can call unpause. Deposits deliberately remain live during a pause, so additional royalties can continue to accrue into the frozen distributor.
The same single-step ownership model is used by the paired-token whitelist, recipient factory, Flaunch pool hook, trusted-signer fee calculator and index fund. A mistaken transfer can also irreversibly remove administrative access.
Earlier review: F-19 remains open. F-07 was only partly addressed by the fee cap; ownership recovery remains unresolved.
Impact
An owner mistake can permanently freeze Flaunch payouts or lose administration of the affected contract. This is limited to privileged actions; an unprivileged account cannot renounce another owner's role. It is therefore rated Low.
Affected code
Locations refer to the reviewed commit, 38f14ff.
src/core/FeeDistribution.sol:22–22— The distributor inherits Ownable and Pausable.src/core/FeeDistribution.sol:150–162— Only the owner can change pause state.src/core/FeeDistribution.sol:402–402— Distribution is blocked while paused.src/PairTokenWhitelist.sol:16–16— The whitelist uses the same ownership model.src/recipients/RecipientFactory.sol:20–20— The factory uses the same ownership model.src/hooks/FlaunchPool.sol:38–38— The hook uses the same ownership model.src/calculators/TrustedSignerFeeCalculator.sol:21–21— The calculator uses the same ownership model.src/index/IndexFund.sol:39–39— The fund uses the same ownership model.
From src/core/FeeDistribution.sol:150–162:
function pause() external onlyOwner {
_pause();
}
/**
* @notice Resume launches and royalty payouts.
*
* @dev Reverts with `ExpectedPause` when not paused. Credits deferred during the pause remain
* retryable through the usual entry points. Emits `Unpaused`.
*/
function unpause() external onlyOwner {
_unpause();
}
From src/core/FeeDistribution.sol:402–402:
function distribute(uint _tokenId) external nonReentrant whenNotPaused {
Proof of concept
OwnershipPauseRenounce.t.sol::test_pauseThenRenounceFreezesPayoutsPermanently pauses Flaunch, renounces ownership and deposits more revenue. Distribution reverts with EnforcedPause; the former owner's attempt to unpause reverts with OwnableUnauthorizedAccount.
test_control_ownerWhoKeepsOwnershipCanUnpause shows that retaining ownership preserves the recovery path.
The test source is poc/OwnershipPauseRenounce.t.sol in the Solidity evidence bundle. Follow the reproduction setup, then run:
FOUNDRY_GAS_LIMIT=1000000000000 forge test --match-path 'test/audit/OwnershipPauseRenounce.t.sol' -vv
Recommended solution
Use Ownable2Step for transfers and disable renounceOwnership where administration is required for recovery. Test the pause and ownership lifecycle together so removing an administrator cannot leave a live revenue path with permanently disabled payouts.
Shared findings
- B-02 · Medium: Graduated ETH revenue is locked for Buy-and-Burn routes without an ETH pair — A failed Buy-and-Burn payment leaves a recipient credit that cannot be reassigned by changing the route.
- B-06 · Medium: A one-block stake captures fees accrued before it was deposited — Permissionless distribution delivers an accrued fee backlog as one staking receipt.
- B-10 · Medium: An issuer freeze can halt trading in a currency across every launch — Paired-token deposits into the shared distributor execute during the swap.