DEVELOPERS / FEES

Claiming fees

In V2, AgiV2FeeEscrow.claim() and claimToken() pay the caller's own balance and nothing else. The protocol wallet claims the protocol 30%. The creator fee recipient claims the creator 70% plus the creator tax. No address can claim for another. Fees reach the escrow when a sweep runs: curve.sweepFees (the creator recipient or the fee sweep operator), hook.sweepPoolFees (the creator or the operator), or graduation, which sweeps on its own. In V1, AgiLaunchLocker.collectFees(token) collects the pool's 1% LP fee and pays 70% to the creator's fee wallet and 30% to the protocol wallet in the same call. Only the locker owner, the deployer, the fee recipient or a whitelisted collector may call it.

ethers v6 · AgiV2FeeEscrow, AgiLaunchLocker
// --- V2: native ETH balance ------------------------------------------------
// claim() pays msg.sender's own balance: the protocol wallet gets its 30%,
// the creator fee recipient gets its 70% plus the creator tax. Nobody else.
const ESCROW = window.AGI_CONFIG.contracts.launchpad.v2.feeEscrow; // null if not deployed
if (!ESCROW) throw new Error('AGI Launchpad V2 is not open yet');
const escrow = new ethers.Contract(ESCROW, ESCROW_ABI, signer);
const owed   = await escrow.balanceOf(await signer.getAddress());
if (owed > 0n) await escrow['claim()']();

// --- V2: an ERC-20 quote asset --------------------------------------------
const owedToken = await escrow.balanceOfToken(await signer.getAddress(), quoteAsset);
if (owedToken > 0n) await escrow['claimToken(address)'](quoteAsset);

// Fees only reach the escrow once a sweep runs, and sweeps are restricted:
//   curve.sweepFees(0)                             before graduation: creator recipient or the fee sweep operator (the argument is minBuybackTokensOut; unused, buyback is never enabled)
//   hook.sweepPoolFees(poolId, minOut, minOut)     after graduation:  creator or the fee sweep operator
// Graduation sweeps the curve by itself. A sweep that must convert launch-token
// fees into the quote asset needs the operator; a sweep of already-quoted fees
// does not. Whoever sweeps, the escrow credits the fixed recipients, never the caller.

// --- V1: collect and split LP fees ----------------------------------------
const LOCKER_V1 = window.AGI_CONFIG.contracts.launchpad.v1.locker; // null if not deployed
if (!LOCKER_V1) throw new Error('AGI Launchpad V1 is not open yet');
const locker = new ethers.Contract(LOCKER_V1, LOCKER_V1_ABI, signer);
await locker.collectFees(token);   // caller must be the owner, the deployer,
                                   // the fee recipient, or a whitelisted collector;
                                   // pays 70% creator / 30% protocol to the fixed recipients