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

# Stellar lending events

> Controller event categories and indexing notes for current Stellar Lending flows.

Protocol events are emitted by the controller. Indexers should subscribe to the
controller address. The pool is an implementation contract and does not provide
the user-facing event stream.

Source definitions live in `common/src/events.rs`.

## Market And Pool State

| Event                         | Purpose                                                             |
| ----------------------------- | ------------------------------------------------------------------- |
| `CreateMarketEvent`           | A hub-asset pool row was created.                                   |
| `UpdateMarketParamsEvent`     | Pool params changed after interest was synced.                      |
| `UpdateMarketStateBatchEvent` | One transaction updated one or more market state snapshots.         |
| `UpdateAssetOracleEvent`      | Token-rooted oracle config changed.                                 |
| `OracleDisabledEvent`         | Token-rooted oracle config was removed.                             |
| `UpdateOracleToleranceEvent`  | Oracle tolerance config changed.                                    |
| `OracleTwapDegradedEvent`     | Permissive policy used fallback when TWAP history was insufficient. |

## Account And Position

| Event                         | Purpose                                            |
| ----------------------------- | -------------------------------------------------- |
| `CreateAccountEvent`          | New account id created.                            |
| `UpdatePositionBatchEvent`    | Supply and/or borrow positions changed.            |
| `UpdateAccountThresholdEvent` | Stored collateral risk parameters refreshed.       |
| `CleanBadDebtEvent`           | Eligible residual debt was cleaned and socialized. |
| `FlashLoanEvent`              | Flash loan completed.                              |
| `BlendMigrationEvent`         | Blend migration completed.                         |

`UpdatePositionBatchEvent` contains account attributes and a vector of
per-hub-asset deltas. Consumers must process every vector element in the event.

## Configuration

| Event                            | Purpose                                  |
| -------------------------------- | ---------------------------------------- |
| `UpdateSpokeEvent`               | Spoke created or deprecated.             |
| `UpdateSpokeAssetEvent`          | Spoke asset config added or edited.      |
| `RemoveSpokeAssetEvent`          | Spoke asset config removed.              |
| `UpdatePositionLimitsEvent`      | Account position limits changed.         |
| `UpdateMinBorrowCollateralEvent` | Debt collateral floor changed.           |
| `ApproveTokenEvent`              | Token listing approval changed.          |
| `ApproveBlendPoolEvent`          | Blend migration source approval changed. |
| `UpdateAggregatorEvent`          | Aggregator address changed.              |
| `UpdateAccumulatorEvent`         | Revenue accumulator address changed.     |
| `UpdatePoolTemplateEvent`        | Pool WASM template changed.              |

## Indexing Notes

* Topic names are contract API. Treat renames as breaking changes.
* Batch events can contain several hub assets.
* `HubAssetKey` fields should be stored together; do not index by token address
  alone.
* `OracleTwapDegradedEvent` is a degradation notice, not proof that the
  transaction failed.
* `BlendMigrationEvent` should be correlated with the governance allow-list for
  the source Blend pool.
