> For the complete documentation index, see [llms.txt](https://docs.fira.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fira.money/developers/events-and-indexing.md).

# Events & Indexing

Event tracking and position measurement across Fira markets, covering the 8 role buckets and their on-chain event sources.

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](https://docs.fira.money/developers/events-and-indexing/event-table.md) — Corrected event-to-role mapping with issue analysis
* [Position Measurement](https://docs.fira.money/developers/events-and-indexing/reward-measurement.md) — Per-role position share formulas and function calls


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
