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

# Events

> Anchor `#[event]` structs emitted by Kimia programs.

<Note>
  Only `kimia-perp`, `delta-vault` (one event), and `intent-router` emit
  `#[event]` structs today. `split-engine`, `yield-amm`, and `kusd-mint` log
  via `msg!` only — observe them by reading `tx.meta.logMessages` on the
  confirmed transaction.
</Note>

## kimia-perp

Defined in `Perp-engine/programs/kimia-perp/src/events.rs`.

| Event                 | Key fields                                                                                                                    |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `MarketInitialized`   | market, oracle, admin                                                                                                         |
| `PositionOpened`      | user, market, direction, base\_amount, quote\_amount, entry\_price, fee                                                       |
| `PositionClosed`      | user, market, close\_amount, close\_price, realized\_pnl, fee                                                                 |
| `FundingRateUpdated`  | market, funding\_rate, mark\_twap, oracle\_twap, cumulative\_funding\_rate\_long, cumulative\_funding\_rate\_short, timestamp |
| `FundingSettled`      | user, market, funding\_payment                                                                                                |
| `CollateralDeposited` | user, amount                                                                                                                  |
| `CollateralWithdrawn` | user, amount                                                                                                                  |
| `Liquidated`          | user, liquidator, market, base\_amount\_closed, close\_price, liquidation\_fee, insurance\_fee, bad\_debt                     |
| `OrderPlaced`         | order\_id, owner, market, price, base\_amount, direction                                                                      |
| `OrderFilled`         | taker, maker, market, fill\_qty, fill\_price, taker\_fee, maker\_fee, taker\_direction                                        |
| `OrderCancelled`      | order\_id, owner, refunded\_margin                                                                                            |
| `MarkPriceUpdated`    | market, new\_price, timestamp                                                                                                 |
| `SelfTradeSkipped`    | owner, order\_id                                                                                                              |
| `BadDebtDetected`     | market, amount, cumulative\_uncovered, market\_paused                                                                         |
| `SpotPoolInitialized` | pool, base\_mint, quote\_mint, admin                                                                                          |
| `SpotSwapped`         | user, pool, direction, amount\_in, amount\_out, fee, oracle\_price                                                            |

## delta-vault

Defined in `Programs/programs/delta-vault/src/instructions/rebalance.rs`.

| Event              | Key fields                                                             |
| ------------------ | ---------------------------------------------------------------------- |
| `RebalanceChecked` | vault, long\_notional\_usd, short\_notional\_usd, delta\_bps, executed |

All other state transitions (deposit, withdraw, claim\_funding, pause) currently
emit `msg!` logs instead of typed events.

## intent-router

Defined in `Programs/programs/intent-router/src/events.rs`.

| Event             | Key fields                                                                           |
| ----------------- | ------------------------------------------------------------------------------------ |
| `IntentFulfilled` | owner, session\_id, amount, target\_rate, achieved\_rate, pt\_received, yt\_received |

Per-step progress (session create, step 1, step 2, close) is visible via
`msg!` logs and the session account's `state` field.

## split-engine, yield-amm, kusd-mint

No `#[event]` structs emitted. Observe state transitions by:

* Reading `tx.meta.logMessages` on the confirmed transaction.
* Polling or subscribing to the relevant account PDAs.
