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

# Events

> Full field schemas for every event the program emits

All amounts are **gross** — before any Token-2022 transfer fee, reported separately. All events
carry `pool` except `SwapEvent`, which additionally carries direction and pricing detail instead
of a position (a swap has no position).

## CreatePoolEvent

Fired by `create_pool`.

| Field        | Type     |
| ------------ | -------- |
| `pool`       | `Pubkey` |
| `binStep`    | `u16`    |
| `feeRate`    | `u32`    |
| `tokenMintX` | `Pubkey` |
| `tokenMintY` | `Pubkey` |

## OpenPositionEvent / ClosePositionEvent

Fired by `open_position` / `close_position`.

| Field        | Type     |
| ------------ | -------- |
| `pool`       | `Pubkey` |
| `position`   | `Pubkey` |
| `owner`      | `Pubkey` |
| `lowerBinId` | `i32`    |
| `upperBinId` | `i32`    |

## DepositEvent

Fired by `deposit_by_weight`.

| Field          | Type     |
| -------------- | -------- |
| `pool`         | `Pubkey` |
| `position`     | `Pubkey` |
| `owner`        | `Pubkey` |
| `lowerBinId`   | `i32`    |
| `upperBinId`   | `i32`    |
| `amountX`      | `u64`    |
| `amountY`      | `u64`    |
| `transferFeeX` | `u64`    |
| `transferFeeY` | `u64`    |

## WithdrawEvent

Fired by `withdraw`.

| Field          | Type     |
| -------------- | -------- |
| `pool`         | `Pubkey` |
| `position`     | `Pubkey` |
| `owner`        | `Pubkey` |
| `lowerBinId`   | `i32`    |
| `upperBinId`   | `i32`    |
| `bpsRemoved`   | `u16`    |
| `amountX`      | `u64`    |
| `amountY`      | `u64`    |
| `transferFeeX` | `u64`    |
| `transferFeeY` | `u64`    |

## ClaimFeeEvent

Fired by `claim_fee`.

| Field          | Type     |
| -------------- | -------- |
| `pool`         | `Pubkey` |
| `position`     | `Pubkey` |
| `owner`        | `Pubkey` |
| `lowerBinId`   | `i32`    |
| `upperBinId`   | `i32`    |
| `amountX`      | `u64`    |
| `amountY`      | `u64`    |
| `transferFeeX` | `u64`    |
| `transferFeeY` | `u64`    |

## SwapEvent

Fired by `swap_exact_in` / `swap_exact_out`.

| Field               | Type     | Meaning                                                   |
| ------------------- | -------- | --------------------------------------------------------- |
| `pool`              | `Pubkey` |                                                           |
| `xToY`              | `bool`   | Swap direction                                            |
| `preBinId`          | `i32`    | Active bin before the swap                                |
| `postBinId`         | `i32`    | Active bin after the swap — the bin the fold last touched |
| `amountIn`          | `u64`    | Gross, what the trader paid                               |
| `amountOut`         | `u64`    | Gross, what the trader received                           |
| `inputTransferFee`  | `u64`    | Token-2022 transfer fee on the input leg, if any          |
| `outputTransferFee` | `u64`    | Token-2022 transfer fee on the output leg, if any         |
| `lpFee`             | `u64`    | Total LP-side swap fee across every bin crossed           |
| `protocolFee`       | `u64`    | Total protocol-side swap fee across every bin crossed     |

See [SDK → Events](/sdk/events) for how to subscribe to and decode these.
