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.
| Field | Type | Meaning |
|---|---|---|
user (indexed) | address | The buyer's wallet. |
ethIn | uint256 | Wei sent in the buy (matches msg.value of the original tx). |
tokensOut | uint256 | NAKA delivered to the buyer (post-fee). |
tokensLocked | uint256 | NAKA 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.
| Field | Type | Meaning |
|---|---|---|
user (indexed) | address | The seller's wallet. |
tokensIn | uint256 | NAKA the user submitted to be sold (pre-fee). |
ethOut | uint256 | Wei delivered to the seller. |
tokensLocked | uint256 | NAKA 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.
| Field | Type | Meaning |
|---|---|---|
finalSupply | uint256 | Circulating 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.
| Field | Type | Meaning |
|---|---|---|
circulatingAtReactivation | uint256 | Circulating supply right after the sell that crossed the threshold. |
deadBalance | uint256 | NAKA 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 = 0xdEaDfor fee burns;to = 0x0is 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
ethInofBuy+ethOutofSellover the past ~7,200 blocks - 24-hour swaps → count
Buy+Sellevents - Recent trades feed → fetch latest N
Buy+Sellevents sorted by block - Holder count → replay
Transferevents, 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.