# Liquidity Pool Cumulative Accounting

The Liquidity Pool (LP) utilizes a high-performance O(1) gas-efficient cumulative accounting model. This ensures that transaction costs remain low and constant regardless of how many providers join the pool:

* **Global Accumulators:** Instead of calculating rewards for each user individually every block, the pool maintains two global counters: `accumulatedProfitPerShare` and `accumulatedDebtPerShare`. These counters only move forward (monotonically non-decreasing), recording the entire history of the pool's performance.
* **Fair Entry Snapshots:** When you deposit, your Position NFT snapshots the current state of these accumulators. This "Fair Entry" mechanism ensures you never inherit debt from player wins that happened before you joined, and you only earn from game activity that occurs during your participation.
* **4-Week Sync Epochs:** Every 4th Thursday between 12:00 and 24:00 UTC, the system synchronizes the "Actual Balance" (tokens currently in the contract) with the "Expected Principal" (the baseline of all deposits minus withdrawals). The difference — whether profit or loss — is then added to the global accumulators and distributed to all providers simultaneously.


---

# 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.celestium.digital/staking-manual/staking-explanation/liquidity-pool-cumulative-accounting.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.
