> ## Documentation Index
> Fetch the complete documentation index at: https://docs.radion.app/llms.txt
> Use this file to discover all available pages before exploring further.

# fees

> Exchange fees charged on Polymarket trades, from the CTFExchange and NegRiskCTFExchange contracts.

The `fees` channel sends every exchange fee event from the Polymarket exchange contracts (v1 and v2). We decode each one and send it after the transaction is confirmed on-chain. Fees are no longer part of the `trading` channel; they stream here so you can track fee flow on its own.

## Subscribe

```json theme={null}
{
  "action": "subscribe",
  "id": "s1",
  "channel": "fees"
}
```

With no filters, you get every confirmed fee event from all markets. Add filters to narrow to certain traders or tokens.

## Filters

| Filter      | Type       | Required | Description                                                             |
| ----------- | ---------- | -------- | ----------------------------------------------------------------------- |
| `wallets`   | `string[]` | No       | Hex addresses (`0x…`). Keeps fees whose `receiver` is a listed address. |
| `token_ids` | `string[]` | No       | Token IDs as decimal strings. Keeps fees on the listed outcome tokens.  |

This channel ignores `market_ids` and `min_usd` — they have no effect here. See [Filters](/websockets/filters) for the combination rule.

## Events

This channel sends both exchange fee events.

| Event          | `data.type`      | Description                                                                   |
| -------------- | ---------------- | ----------------------------------------------------------------------------- |
| `FeeChargedV1` | `fee_charged_v1` | A fee charged on exchange v1. Carries the receiver, token id, and fee amount. |
| `FeeChargedV2` | `fee_charged_v2` | A fee charged on exchange v2. Simplified to the receiver and fee amount.      |

## Payloads

Every frame wraps the event in the standard envelope (`type`, `id`, `channel`, `confirmed`, `data`) shown on [Frames](/websockets/frames). Below, each block is the `data` object for one event — its `type` discriminator plus every field the [ABI](https://github.com/radion-app) decodes. A full frame looks like:

```json theme={null}
{
  "type": "event",
  "id": "s1",
  "channel": "fees",
  "confirmed": true,
  "data": {
    "type": "fee_charged_v1",
    "receiver": "0x…",
    "tokenId": "0x…",
    "amount": "0x…"
  }
}
```

### `fee_charged_v1`

`FeeCharged` on CTFExchange v1 / NegRiskCTFExchange v1. Carries the receiver, the token the fee was taken on, and the fee amount.

```json theme={null}
{
  "type": "fee_charged_v1",
  "receiver": "0x…",
  "tokenId": "0x…",
  "amount": "0x…"
}
```

| Field      | Solidity type   | Description                         |
| ---------- | --------------- | ----------------------------------- |
| `type`     | string          | `fee_charged_v1`.                   |
| `receiver` | `address` (hex) | Address that received the fee.      |
| `tokenId`  | `uint256` (hex) | Outcome token the fee was taken on. |
| `amount`   | `uint256` (hex) | Fee amount.                         |

### `fee_charged_v2`

`FeeCharged` on CTFExchange v2 / NegRiskCTFExchange v2. The v2 signature dropped `tokenId`, so it carries only the receiver and the amount.

```json theme={null}
{
  "type": "fee_charged_v2",
  "receiver": "0x…",
  "amount": "0x…"
}
```

| Field      | Solidity type   | Description                    |
| ---------- | --------------- | ------------------------------ |
| `type`     | string          | `fee_charged_v2`.              |
| `receiver` | `address` (hex) | Address that received the fee. |
| `amount`   | `uint256` (hex) | Fee amount.                    |

## Pending feed

Set `confirmed: false` on your subscribe to get the pending feed of this channel — the same payload shape for pending exchange transactions, before they are in a block. Pending events are guesses. A transaction can be dropped, replaced, or reverted. See [Mempool](/websockets/mempool) for the full frame shape and how to handle it.

```json theme={null}
{
  "action": "subscribe",
  "id": "pending",
  "channel": "fees",
  "confirmed": false
}
```
