Documentation

Technical reference for the Bonker token factory.

Architecture

Bonker is built on Uniswap v4's hook system. Every token deployment creates a full stack:

Factory (Bonker)
├── creates BonkerToken (ERC-20)
├── initializes Uniswap v4 pool via Hook
│   ├── DynamicHook or StaticHook
│   │   ├── initializePool — setup pool data and starting price
│   │   ├── beforeSwap — MEV module check, set dynamic fee
│   │   ├── afterSwap — handle fee distribution
│   │   └── beforeAddLiquidity — block during MEV module period
│   └── Pool Extension (optional)
├── locks LP in LpLocker
│   └── collects fees → FeeLocker → reward recipients
└── activates MevModule
    ├── Sniper Auction
    ├── Descending Fees
    └── Block Delay

Hook permissions

Both hooks use these Uniswap v4 permission flags:

  • BEFORE_INITIALIZE — setup pool data, mint tokens, add initial liquidity
  • BEFORE_ADD_LIQUIDITY — block liquidity adds during MEV module period
  • BEFORE_SWAP — run MEV module, set dynamic fee
  • AFTER_SWAP — handle fee distribution
  • BEFORE_SWAP_RETURNS_DELTA — MEV fee extraction
  • AFTER_SWAP_RETURNS_DELTA — fee accounting as balance delta