> ## Documentation Index
> Fetch the complete documentation index at: https://pons-labs-llc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Claiming fees

> How v3 fees get from a trade to a wallet, claiming to another address, and how sweeps work.

Fees go through four steps before reaching a wallet, and you only handle the last
one. Trades build up fees in the hook. A sweep splits them into the protocol's
share, the creator's share plus the full creator tax, and the buyback portion.
The sweep then credits the escrow for each recipient and asset. Finally, the
recipient claims.

```ts Balances and claims theme={null}
const escrowAbi = parseAbi([
  "function balanceOf(address recipient) view returns (uint256)",
  "function balanceOfToken(address recipient, address token) view returns (uint256)",
  "function claim()",
  "function claim(uint256 amount)",
  "function claimTo(address to, uint256 amount)",
  "function claimToken(address token)",
  "function claimToken(address token, uint256 amount)",
  "function claimTokenTo(address token, address to, uint256 amount)",
]);

// A claim pays out the caller's own balance. Native launches credit ETH,
// ERC-20 launches credit that token.
const owed = await client.readContract({
  address: feeEscrow,
  abi: escrowAbi,
  functionName: "balanceOf",
  args: [creatorFeeRecipient],
});
```

> [!WARNING]
>
> If the fee recipient is a contract, test a claim before relying on it. `claim()`
> sends ETH with a plain call and reverts if the recipient rejects it, so a
> contract without a `receive` function can be credited fees it can never withdraw.
> `claimTo` and `claimTokenTo` were added in v3 for this case. The contract calls
> them and the funds go to an address it chooses. This is the integration mistake
> we've had to clean up most often, and nothing on the protocol side can recover
> those fees for you.

## Sweeps

Only the operator can sweep a pool that has fees pending. If a creator calls it
on a pool with pending fees, it reverts. On a pool with nothing pending, it does
nothing. v2's permissionless tipped sweep is gone, and only allowlisted callers
can use the relay, so fees arrive on the protocol's schedule. It's normal for a
pool to have fees that haven't been swept yet. That isn't an error or a stuck
balance, so don't show it as one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.