disconnected
docs/smart-contracts/contracts

Contracts

NAKA is implemented as four contracts working together. Three are NAKA-specific; one is the canonical Uniswap V4 PoolManager that the hook plugs into.

Contract Set

NakaToken. ERC-20

A vanilla ERC-20 with one twist: the mint role is granted to the hook contract at deployment and the role-locking flag is permanently set in the same transaction. The deployer cannot reclaim mint, no admin can grant it elsewhere, and there is no upgrade path that could change either.

Events emitted: Transfer, Approval, MinterLocked.

NakaHook. Curve, fees, lifecycle

The brain of the protocol. Implements the Uniswap V4 hook interface and additionally exposes the bonding-curve view functions and the standalone buy/sell entry points. Two execution paths share the same core logic: the V4 path (gated by beforeSwap) and a direct standalone path (buy() payable / sell(tokensIn)).

Key state:

  • totalMintedFair. Virtual cumulative ETH on the curve. Advances on buys by the fair-curve component (entropy bonus excluded), retreats on sells in proportion to the seller's share of real supply.
  • selfDeprecated. A two-way flag. Set to true when circulating ≥ 99% × K after a buy. Cleared back to false when sells push circulating below 95% × K. Together they form the deprecation cycle.
  • lastBuyBlock[address]. Per-EOA cooldown timestamp (tx.origin-keyed) for the 1-block anti-flip rule.
  • poolInitialized. Flips true once beforeInitialize accepts the V4 pool key.
  • View functions: actualEthBalance, floorPrice, marginalPrice, circulatingSupply, totalSupplyExisting, lockedTokens, percentToCap, holderValueAtFloor(holder), estimatedSellOut(tokensIn).

Events emitted: Buy(user, ethIn, tokensOut, tokensLocked), Sell(user, tokensIn, ethOut, tokensLocked), SelfDeprecated(finalSupply), Reactivated(circulatingAtReactivation, deadBalance).

Configuration constants (full table at parameters): MAX_BUY_WEI = 5 ETH, MIN_TX_AMOUNT = 1 gwei, FEE_BPS = 30, RANDOM_BLOCKS = 100, SELF_DEPRECATE_PCT = 99, REACTIVATE_PCT = 95, COOLDOWN_BLOCKS = 1, POOL_FEE = 3000.

NakaSwapRouter. User-facing entry point

A thin router that takes user input and calls the V4 PoolManager unlock-callback flow. Exposes buyNaka(minTokensOut) (payable) and sellNaka(tokensIn, minEthOut). Uses the pre-settle pattern required by NakaHook: the input currency is settled to the PoolManager before the swap, then the hook takes from PoolManager during beforeSwap. This is necessary because the hook needs to mint new tokens on a buy and pay native ETH out on a sell.

The router holds no state beyond the immutable poolKey (set once by the deployer) and no funds. The pool key is locked via setPoolKey immediately after deployment and can never be changed.

NakaDeployer. One-shot atomic deployment

Convenience contract that deploys the full stack (NakaTokenNakaHook via CREATE2 with mined salt → setMinter lock → NakaSwapRouterPoolManager.initializesetPoolKey → genesis buy → token transfer to cold storage) in a single constructor invocation. After deployment finishes, this contract is no longer needed and holds no powers — it does not retain mint, admin, or upgrade rights.

The atomic flow exists specifically to prevent MEV bots from inserting a buy between pool initialization and the genesis allocation.

PoolManager (Uniswap V4)

The canonical Uniswap V4 PoolManager for each chain. NAKA does not deploy or modify this contract. It simply registers NakaHook against a PoolManager-managed pool.

ABIs

The frontend ships ABIs for all NAKA contracts:

  • lib/abis/NakaToken.json
  • lib/abis/NakaHook.json
  • lib/abis/NakaSwapRouter.json

Integrations should pull these from the project's GitHub release tags rather than copying from a running frontend, so that integrators get the exact compiled-version metadata.

Verification

Each contract on Etherscan has:

  • Verified source matching a tagged GitHub release
  • Linked deployment transaction hash
  • Compiler version and optimizer settings as on-chain metadata
  • No proxy admin and no upgradeable storage layout

See the addresses page for current Sepolia deployment.