# Revenue Module

The Revenue Module is an epoch-based treasury and value-routing mechanism designed to collect protocol trading fees, normalize them into a designated target asset, and deterministically split the resulting proceeds across burn, insurance, and treasury destinations.

## Epoch-Gated Execution Model

Revenue processing is executed in the module's `EndBlocker`, gated by two runtime parameters:

* **Enabled:** Globally toggles the revenue pipeline on or off.
* **EpochBlocks:** Defines the round interval in blocks.

On an epoch boundary, the module increments the internal `CurrentRound` counter and begins a full sweep → convert → allocate → settle cycle.

## Oracle-Based Synthetic Conversion

At each round, for non-target balances, the convertible amount per epoch is calculated as:

$$
ConvertAmount = Balance \times \frac{MaxSellBpsPerEpoch}{10000}
$$

Then the target amount is calculated as:

$$
A\_t = \frac{A\_s \cdot P\_s \cdot 10^{e\_t}}{P\_t \cdot 10^{e\_s}}
$$

## Allocation into Buckets

Target-denom revenue is split using basis points that must sum to 10,000:

$$
BurnBps + InsuranceBps + TreasuryBps = 10000
$$

| Bucket    | Settlement               |
| --------- | ------------------------ |
| Burn      | Tokens are burned        |
| Insurance | Sent to Insurance module |
| Treasury  | Sent to fee collector    |

## Governance Parameters

The following parameters are adjustable via governance:

* `Enabled`
* `TargetDenom`
* `EpochBlocks`
* `MinLot`
* `MaxSellBpsPerEpoch`
* `BurnBps`
* `InsuranceBps`
* `TreasuryBps`
* `DenomOracleSymbols`


---

# 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://uniocean.gitbook.io/uniocean-docs/core-platform-modules/revenue-module.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.
