Security model
Non-custodial by design: what the contracts and app can and cannot do.
Stargaze Finance is an interface to public smart contracts. It never holds user funds, seed phrases or private keys, and every transaction is signed in the user's own wallet. This page summarises what the code enforces; docs/SECURITY.md in the repository is the longer version.
Launched tokens
StargazeTokenis OpenZeppelinERC20+ERC20Permitwith the full supply minted once in the constructor.- No admin keys: no owner, no mint, no pause, no blacklist, no transfer tax, no max-wallet, not upgradeable. The launch contracts' emergency pause cannot reach launched tokens.
creator,launcherandmetadataURIare informational; none of them grants any privilege, andmetadataURIcannot be changed.
Launch contracts
| Property | StargazeLaunchFactory | StargazeFairLaunch |
|---|---|---|
| Owner powers | setLaunchFee (≤ 0.05 ETH), setFeeRecipient, pause / unpause | setPlatformFeeBps (≤ 5 %), setFeeRecipient, pause / unpause |
| Pause blocks | createToken only | createSale and commit only — never finalize, claim or refund |
| Fee changes affect | the next createToken call | only sales created afterwards (fee snapshotted per sale) |
| Liquidity | LP to creator or 0x…dEaD, emitted as liquidityBurned | pool opens at the clearing price; ≥ 20 % of the raise is paired |
| Funds held | none — unused ETH / tokens are returned in the same tx | committed ETH and the supply until finalize |
| Escape hatch | — | finalize is permissionless; failed sales refund 100 % |
- Both contracts use
ReentrancyGuardon every state-changing entry point,Ownable2Stepfor ownership transfers and OpenZeppelinPausablefor the emergency pause. - Allocation, supply (≤
uint112max), name/symbol length and timing are validated on-chain — see the contracts reference. settled[saleId][wallet]makes claims and refunds settle-once.
Emergency pause
If a problem is found, the owner can pause new activity so no new funds are exposed, while everyone already involved can still leave. Pausing never touches launched tokens, their pools or LP tokens.
| While paused | Status |
|---|---|
New instant launches (createToken) | ❌ blocked — reverts EnforcedPause() |
New fair-launch sales (createSale) and new commitments (commit) | ❌ blocked — reverts EnforcedPause() |
finalize, claim, refund | ✅ always work — not pausable |
| Trading, transfers and approvals of launched tokens | ✅ unaffected — tokens have no owner |
- Only the owner can call
pause()/unpause(); both emit OpenZeppelinPaused(account)/Unpaused(account)events andpaused()is public. - A live sale keeps its fixed
endTime; after it,finalizesettles it against the reserve as usual, so committed ETH can never be trapped (fuzz-tested). - The app reads
paused()and shows a banner, disabling only the create and commit buttons. - Before mainnet, ownership moves to a Safe multisig through
Ownable2Step(transferOwnership→ the Safe callsacceptOwnership).
Transactions from the app
- The wallet is switched to the target chain if needed.
- Bytecode is checked at the Stargaze contract or Uniswap router address on that chain (
getCode). - The exact call is simulated (
simulateContract) so reverts — bad parameters, a fee change, slippage, an expired deadline — appear before the wallet prompt. - The user signs in their own wallet (
writeContract). - Success is shown only after
waitForTransactionReceiptreturnsstatus: "success".
Server side
- Provider keys and RPC URLs without the
NEXT_PUBLIC_prefix never reach the browser; API routes proxy the providers. /api/txre-reads each submitted transaction from the chain, so clients cannot inject fake history.next.config.mjssetsX-Content-Type-Options: nosniff,Referrer-Policy: strict-origin-when-cross-origin,X-Frame-Options: SAMEORIGINand a restrictivePermissions-Policyon every route.- The Foundry deploy script refuses mainnet unless
ALLOW_MAINNET_DEPLOY=true.
Known limitations
- Anyone can
createPairfor a predictable token address before a launch; with zero reserves this does not change the opening price, and donated WETH would only benefit the LP recipient. - The web indexer trusts the configured RPC for logs and block timestamps.
