Documentation

Technical reference for the Bonker token factory.

SDK Integration

Integrate with Bonker using viem to deploy tokens and interact with the factory programmatically.

Deploy a token

import { encodeAbiParameters, parseAbiParameters } from 'viem';

const FACTORY = '0xD850DACe6c3E3B3cf09ABb92342Fab681013c8cB';
const DYNAMIC_HOOK = '0x963E91A45148b39737b9DF10c5b897B55cA9e8cC';
const LP_LOCKER = '0xBf05b1d5E356f3219D0086A4e09c969ADbe2e7d0';
const MEV_MODULE = '0x6a04057180F8cc02E18DabEE3f3437E438BE657A';
const WETH = '0x4200000000000000000000000000000000000006';
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';

const feeDataBytes = encodeAbiParameters(
  parseAbiParameters('uint24, uint24, uint256, uint256, int24, uint256, uint24'),
  [30000, 100000, 30n, 120n, 200, 500000000n, 7500]
);

const poolDataBytes = encodeAbiParameters(
  parseAbiParameters('(address extension, bytes extensionData, bytes feeData)'),
  [{ extension: ZERO_ADDR, extensionData: '0x', feeData: feeDataBytes }]
);

const deploymentConfig = {
  tokenConfig: {
    tokenAdmin: myAddress,
    name: 'My Token',
    symbol: 'MTK',
    salt: '0x' + '00'.repeat(32),
    image: '',
    metadata: '',
    context: '',
    originatingChainId: 8453n, // Base
  },
  poolConfig: {
    hook: DYNAMIC_HOOK,
    pairedToken: WETH,
    tickIfToken0IsBonker: -230400,
    tickSpacing: 200,
    poolData: poolDataBytes,
  },
  lockerConfig: {
    locker: LP_LOCKER,
    rewardAdmins: [myAddress],
    rewardRecipients: [myAddress],
    rewardBps: [10000],       // 100% to creator
    tickLower: [-887200],
    tickUpper: [887200],
    positionBps: [10000],
    lockerData: encodeAbiParameters([{ type: 'tuple', components: [{ type: 'uint8[]', name: 'feePreference' }] }], [{ feePreference: [1] }]),
  },
  mevModuleConfig: {
    mevModule: MEV_MODULE,
    mevModuleData: encodeAbiParameters(parseAbiParameters('(uint24 startingFee, uint24 endingFee, uint256 secondsToDecay)'), [{ startingFee: 666777, endingFee: 41673, secondsToDecay: 15n }]),
  },
  extensionConfigs: [],       // no extensions
};

const tx = await walletClient.writeContract({
  address: FACTORY,
  abi: factoryAbi,
  functionName: 'deployToken',
  args: [deploymentConfig],
});

Claiming fees

// Check available fees
const available = await publicClient.readContract({
  address: FEE_LOCKER,
  abi: feeLockerAbi,
  functionName: 'availableFees',
  args: [myAddress, WETH],
});

// Claim fees (called by the reward recipient)
await walletClient.writeContract({
  address: FEE_LOCKER,
  abi: feeLockerAbi,
  functionName: 'claim',
  args: [myAddress, WETH],
});