# Events & Indexing

Fira tracks user positions across **8 role buckets** using weekly time-weighted average (TWAP) exposures. Positions are piecewise-constant, updated on relevant on-chain events. This section documents the event-to-role mapping and position share formulas for analytics and integrations.

{% hint style="info" %}
Positions are piecewise-constant between events. The indexer must track each event to maintain an accurate TWAP of user exposure per role bucket over each epoch.
{% endhint %}

## Role buckets

| Bucket   | Full name            | Market        |
| -------- | -------------------- | ------------- |
| **BFR**  | Borrow Fixed Rate    | Fixed Rate    |
| **BT**   | Held BT              | Fixed Rate    |
| **CT**   | Coupon Token holders | Fixed Rate    |
| **LP**   | Liquidity Providers  | Fixed Rate    |
| **VRB**  | Variable Rate Borrow | Variable Rate |
| **VRL**  | Variable Rate Lend   | Variable Rate |
| **USLC** | USL Collateral       | USL Migrator  |
| **USLL** | USL Loan             | USL Migrator  |

## Source contracts

| Contract          | Events defined in                                     | Emitted by          |
| ----------------- | ----------------------------------------------------- | ------------------- |
| **LendingMarket** | `lib/fira-lending-market/src/libraries/EventsLib.sol` | `LendingMarket.sol` |
| **BondToken**     | ERC20 events via FiraERC20                            | `BondToken.sol`     |
| **CouponToken**   | Custom + ERC20 events                                 | `CouponToken.sol`   |
| **FiraMarket**    | `src/interfaces/IPMarket.sol`                         | `FiraMarket.sol`    |
| **SisuVault**     | ERC4626 Deposit/Withdraw                              | `SisuVault.sol`     |

## Pages

* [Event Table](/developers/events-and-indexing/event-table.md) — Corrected event-to-role mapping with issue analysis
* [Position Measurement](/developers/events-and-indexing/reward-measurement.md) — Per-role position share formulas and function calls


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fira.money/developers/events-and-indexing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
