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

# Events

> Every event the swap program emits, the instruction that emits it, and its fields.

The swap program emits an Anchor event from each instruction that changes state. Events appear in the transaction logs as `Program data:` lines, encoded with the event's discriminator. To read swaps, use `client.parseSwapEventsFromTransaction(signature)` or `client.parseSwapEventsFromLogs(logs)`, which decode `SwapExecuted`. The [IDL](https://docs.multiliquid.xyz/svm/idl.md) defines every event for other decoders.

## Swaps

### `SwapExecuted`

Emitted by `swap`.

| Field | Type | Meaning |
| - | - | - |
| `requestor` | `Pubkey` | The user |
| `amount_in` | `u64` | The input paid into the vault |
| `protocol_fee_amount` | `u64` | The protocol fee, in the fee token |
| `discount_bps` | `u16` | The pair fee that applied |
| `amount_out` | `u64` | The output paid to the user |
| `pair` | `Pubkey` | The pair account |
| `swap_direction` | `SwapDirection` | `QuoteToBase` or `BaseToQuote` |
| `swap_type` | `SwapType` | `ExactIn` or `ExactOut` |
| `redemption_fee_bps` | `u16` | The pair's redemption fee at the time |
| `discount_rate_bps` | `u16` | The pair's discount rate at the time |

## Pairs and liquidity

| Event | Emitted by | Fields |
| - | - | - |
| `PairInitialized` | `init_pair` | `pair`, `liquidity_provider`, `quote_token_mint_address`, `base_token_mint_address`, `redemption_fee_bps`, `discount_rate_bps` |
| `PairUpdated` | `update_pair` | `pair`, `liquidity_provider`, `redemption_fee_bps`, `discount_rate_bps`, `paused` |
| `PairClosed` | `close_pair` | `pair`, `liquidity_provider`, `quote_token_mint_address`, `base_token_mint_address`, `quote_amount_returned`, `base_amount_returned` |
| `LiquidityAdded` | `add_liquidity` | `liquidity_provider`, `mint_address`, `amount`, `treasury_deposit_amount` |
| `LiquidityRemoved` | `remove_liquidity` | `liquidity_provider`, `mint_address`, `amount`, `amount_transferred`, `treasury_backed` |
| `LpStableConfigPauseChanged` | `set_paused_for_lp_stable_config` | `liquidity_provider`, `mint`, `paused` |
| `LpTreasuryEnabledChanged` | `set_lp_treasury_enabled` | `liquidity_provider`, `enabled` |
| `TreasuryPositionClosed` | `close_treasury_position` | `liquidity_provider`, `lp_vault_authority`, `treasury_user_position`, `lamports_returned` |
| `LpFeeAccountClosed` | `close_lp_fee_account` | `liquidity_provider`, `fee_token_mint`, `amount_returned` |

In `PairClosed`, each returned amount is zero when another pair still uses that vault. In `LiquidityAdded`, `treasury_deposit_amount` is zero when nothing went to Treasury. In `LiquidityRemoved`, `amount` is the argument as passed and `amount_transferred` is what the capital provider received.

## Administration

| Event | Emitted by | Fields |
| - | - | - |
| `GlobalConfigInitialized` | `init_global_config` | `admin`, `fee_wallet`, `protocol_fees_bps`, `spread_protocol_fees_bps`, `fee_token_mint`, `paused` |
| `GlobalConfigUpdated` | `update_global_config` | `fee_wallet`, `paused`, `protocol_fees_bps`, `spread_protocol_fees_bps`, `fee_token_mint` |
| `NewAdminProposed` | `set_new_admin` | `current_admin`, `pending_admin` |
| `AdminChanged` | `confirm_new_admin` | `old_admin`, `new_admin` |
| `LpProtocolFeeConfigUpdated` | `set_lp_protocol_fee_config` | `liquidity_provider`, `protocol_fees_bps`, `spread_protocol_fees_bps` |
| `AssetConfigInitialized` | `init_asset_config_account` | `asset_config`, `mint`, `asset_type`, `price_difference_bps`, `nav_data` |
| `AssetConfigUpdated` | `update_asset_config_account` | `asset_config`, `mint`, `asset_type`, `price_difference_bps`, `nav_data` |
| `AssetPauseChanged` | `set_paused_for_asset` | `mint`, `paused` |
| `FeesClaimed` | `claim_fees` | `fee_wallet`, `fee_mint`, `amount` |

`GlobalConfigUpdated` carries every field after the change, including those left unchanged.

## What to monitor

* **Pauses:** `GlobalConfigUpdated`, `AssetPauseChanged`, `PairUpdated`, and `LpStableConfigPauseChanged` with `paused` changing.
* **Prices and fees:** `AssetConfigUpdated` for new price sources, and `PairUpdated` and `LpProtocolFeeConfigUpdated` for new fees.
* **Admin changes:** `NewAdminProposed` and `AdminChanged`.


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