Collect and claim fees
Move fees from a pool to the partner and creator fee recipients.
Fees move from a pool to a recipient in two steps. A collection takes the fees from the pool and credits each recipient. A claim pays a recipient its credit. Anyone can call both, for any pool and any recipient. See Fees.
Check the credit
claimable(recipient, asset) is the credit that a recipient can claim now. The native asset is address(0).
import { zeroAddress } from "viem";
const credit = await publicClient.readContract({
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "claimable",
args: [recipient, zeroAddress],
});The credit does not include fees that are still in the pool. Collect first to add them.
Collect and claim one pool
collectAndClaimFees(quote, token, recipient) collects one pool and pays the recipient in the pool's quote and token.
import { zeroAddress } from "viem";
const { result, request } = await publicClient.simulateContract({
account,
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "collectAndClaimFees",
args: [zeroAddress, token, recipient], // The token's native ETH pool
});
await walletClient.writeContract(request);
const [quoteAmount, tokenAmount] = result; // Paid to the recipientThe amounts are the recipient's full credit in each asset. They can include fees from other pools in the same assets.
Collect only
collectFees(quote, token) collects one pool and credits both recipients. It pays nobody.
const { result, request } = await publicClient.simulateContract({
account,
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "collectFees",
args: [USDC, token],
});
await walletClient.writeContract(request);
// Collected from the pool, before the split
const [quoteAmount, tokenAmount] = result;It reverts with DropLaunchpad__UnknownPool if the token has no pool with that quote.
Claim several assets
claimFees(assets, recipient) pays the recipient's full credit in each asset. Use it after collections, or to claim
credits from many pools at once.
const { result: amounts, request } = await publicClient.simulateContract({
account,
address: LAUNCHPAD,
abi: launchpadAbi,
functionName: "claimFees",
args: [[zeroAddress, USDC, token], recipient],
});
await walletClient.writeContract(request);An asset with no credit pays 0 and does not revert. Each paid asset emits FeesClaimed.
Automatic collections
After a swap, DropHook collects the pool if 12 hours have passed since its last automatic collection. You do not
need to collect pools that trade often. You still need to claim.
Read the time of the last automatic collection with collectedAt(poolId) on the hook.