Distribute & Reinvest Fees

All fee distribution functions are permissionless. Anyone can call them to trigger the 30/10/60 split and liquidity reinvestment.

Distribute Token Fees

const hook = new ethers.Contract(HOOK_ADDRESS, HOOK_ABI, signer);

// Check if distribution is possible
const canDist = await hook.canDistribute(tokenAddress);
const pending = await hook.getPendingFees(tokenAddress);

if (canDist && pending.gt(0)) {
    const tx = await hook.distributeFees(tokenAddress);
    await tx.wait();
    // 30% credited to deployer, 10% to platform, 60% reinvested as LP
}

Process Platform Fees

const canProcess = await hook.canProcessPlatformFees();
if (canProcess) {
    await (await hook.processPlatformFees()).wait();
}

Refresh Fee Tier

// Force update the cached fee tier if pool depth has changed significantly
await (await hook.refreshFeeTier(tokenAddress)).wait();

// Check current fee info
const [feeBps, ethInPool] = await hook.getFeeInfo(tokenAddress);
console.log("Fee:", feeBps.toNumber() / 100, "%");
console.log("ETH in pool:", ethers.utils.formatEther(ethInPool));