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