# How it works

### Cross‑Compounding Loop

Lair turns the “can’t compound different reward tokens” problem into a **two‑way flywheel**:

{% @mermaid/diagram content="flowchart LR
A\["iBGT Staked (Infrared)"]
B\["Route to selected PoL Vaults"]
C\["Auto-compound iBGT back into iBGT Staking"]

A -- "rewards (non-iBGT)" --> B
B -- "emits iBGT" --> C
C -- "grows" --> A
" %}

**Key ideas**

* **From iBGT staking → PoL vaults:**\
  Rewards from iBGT staking (often not iBGT) are **allocated** into chosen **PoL vaults** that **emit iBGT**.
* **From PoL vaults → iBGT staking:**\
  The **iBGT** emitted by PoL vaults is **auto‑compounded** back into **iBGT staking**, boosting APR and **Infrared points**.
* **Result:** More iBGT staked, bigger PoL positions, reinforced emissions—**without constantly market‑buying iBGT**.

<figure><img src="https://1040218031-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FahQwkJji5wLlKOx67Jae%2Fuploads%2F276sipk8nskCcgtCWrCs%2F%E1%84%80%E1%85%B5%E1%86%BA%E1%84%87%E1%85%AE%E1%86%A8%20autocompound.png?alt=media&#x26;token=d4e47653-8609-416a-963a-0b712aac839b" alt=""><figcaption></figcaption></figure>

***

### Why this avoids the hidden iBGT long

Traditional autocompounders **sell rewards → buy iBGT**. That’s a **directional bet**. If iBGT premium compresses when holders unwind, late depositors eat the loss in BERA terms.

**Lair** grows iBGT **by farming it** (via PoL emissions) instead of repeatedly **buying it**. This **reduces direct price‑premium risk** linked to constant market purchases.

***

### Share Tokens (LRTs)

When you deposit, you **mint** an LRT that represents your share of the strategy. On exit, your LRT is **burned** and you receive the underlying (iBGT and PoL vault tokens).

* **Accounting:** Internally we track total holdings across:
  * iBGT staked (and pending claims)
  * PoL vault LP balances (and pending rewards)
  * Unclaimed/unallocated rewards in the harvester
* **Preview UI:** We surface a **preview** of shares out / assets out using current quotes and route sims. Actual results depend on execution and slippage.

***

### Reward Harvesting & Scheduler

* **Harvester** batches reward claims from iBGT staking and PoL vaults.
* **Allocator** routes iBGT‑staking rewards into PoL vaults, and routes PoL iBGT rewards into iBGT staking.
* **Scheduler (keeper/cron)** runs on a cadence (and thresholds) to keep gas reasonable while maintaining compounding.

> If harvest fails or markets are too choppy, the scheduler can **throttle** or **skip cycles** until conditions improve.
