disconnected
docs/developers/events

Event Reference

Four event types matter for indexing NAKA: Buy and Sell from the hook (curve activity), Transfer from the token (movement and burns), and the lifecycle pair SelfDeprecated / Reactivated that signals when the buy path opens and closes.

Buy (NakaHook)

event Buy(
    address indexed user,
    uint256 ethIn,
    uint256 tokensOut,
    uint256 tokensLocked
);

Emitted exactly once per successful buy.

FieldTypeMeaning
user (indexed)addressThe buyer's wallet.
ethInuint256Wei sent in the buy (matches msg.value of the original tx).
tokensOutuint256NAKA delivered to the buyer (post-fee).
tokensLockeduint256NAKA burned to 0xdEaD as the 30 bps fee.

Topic-0: keccak256("Buy(address,uint256,uint256,uint256)").

Sell (NakaHook)

event Sell(
    address indexed user,
    uint256 tokensIn,
    uint256 ethOut,
    uint256 tokensLocked
);

Emitted exactly once per successful sell.

FieldTypeMeaning
user (indexed)addressThe seller's wallet.
tokensInuint256NAKA the user submitted to be sold (pre-fee).
ethOutuint256Wei delivered to the seller.
tokensLockeduint256NAKA burned to 0xdEaD as the 30 bps fee.

SelfDeprecated (NakaHook)

event SelfDeprecated(uint256 finalSupply);

Emitted by _commitBuy whenever a buy pushes circulating supply across the 99% × K threshold and selfDeprecated was previously false. The same event can fire multiple times across the lifetime of the protocol (once per deprecation cycle). After this event, subsequent buyNaka calls revert until Reactivated fires.

FieldTypeMeaning
finalSupplyuint256Circulating supply (totalSupply − DEAD balance) at the moment the flag flipped, 1e18-scaled.

Reactivated (NakaHook)

event Reactivated(uint256 circulatingAtReactivation, uint256 deadBalance);

Emitted by _executeSell whenever a sell pushes circulating supply below 95% × K while selfDeprecated was true. Resets the flag to false in the same transaction, re-enabling buys. Like SelfDeprecated, this event can fire many times across the protocol's lifetime — together they record the boundaries of each deprecation cycle.

FieldTypeMeaning
circulatingAtReactivationuint256Circulating supply right after the sell that crossed the threshold.
deadBalanceuint256NAKA balance of 0x...dEaD at the moment of reactivation. Useful for tracking how much the burn pool has grown since deployment.

Transfer (NakaToken, ERC-20 standard)

event Transfer(
    address indexed from,
    address indexed to,
    uint256 value
);

Emitted on every token movement, including:

  • Mints (from = 0x0, to = recipient)
  • Burns (from = burner, to = 0xdEaD for fee burns; to = 0x0 is not used by NAKA)
  • User transfers and DEX swaps

For an indexer reconstructing balances, summing Transfer events with to = address minus from = address (excluding the zero address as a sender) yields the running balance.

Approval (NakaToken, ERC-20 standard)

event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
);

Emitted by approve() and permit(). Used by the frontend to detect whether the user needs to call approve(router, amount) before the first sell.

MinterLocked (NakaToken)

event MinterLocked(address indexed minter);

Emitted exactly once at token deployment. minter is the address of the hook contract. Its presence in the event log is on-chain proof that the mint role was permanently locked to the hook and cannot be reassigned.

Indexing Recipe

Combining the events above, a minimal indexer can reconstruct:

  • 24-hour volume → sum ethIn of Buy + ethOut of Sell over the past ~7,200 blocks
  • 24-hour swaps → count Buy + Sell events
  • Recent trades feed → fetch latest N Buy + Sell events sorted by block
  • Holder count → replay Transfer events, filter addresses with positive net balance, exclude protocol contracts

The reference implementation is in lib/server/indexer.ts. See the indexer doc for the full architecture and the public API endpoints.