# The New Epoch Action

*Note*: The new epoch action code be found [here](https://github.com/DIG-Network/reward-distributor-clsp/blob/main/rue-puzzles/actions/reward_distributor/new_epoch.rue) ([Chialisp](https://github.com/DIG-Network/reward-distributor-clsp/blob/main/puzzles/actions/reward_distributor/new_epoch.clsp)).

Because reward rates might change, the Reward Distributor uses the concept of 'epochs', which are simply one-week periods. The rewards committed to each epoch may be different. Inside each round, rewards are distributed linearly (e.g., \~25% of the rewards will be distributed after 25% of the time in the round has passed).

Starting a new epoch requires a 'slot oracle' - spending and recreating a reward slot with the same value. This ensures that the correct rewards are allocated. The slot either:

* Represents the new epoch, in which case it contains the reward amount
* Represents a previous epoch but indicates that the next slot is not initialized, in which case the reward amount for the epoch to be initialized is 0

When a new epoch starts, the committed rewards, which were previously stored as CAT units (i.e., 1 = one mojo), are multiplied by PRECISION (usually `u64::MAX`), allowing a much more precise reward allocation to all entries.

The action also creates a puzzle announcement that be asserted to ensure the dApp singleton is running the right action with the right parameters. For the new epoch action, the announcement prefix, `e`, is concatenated to `(sha256tree epoch_end)`.

*Written by* [*yakuhito*](https://x.com/yakuhito) *from* [*FireAcademy.io*](https://fireacademy.io/) *on Feb 16th, 2025.*


---

# 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.xchandles.com/techincal-manual/reward-distributors/the-new-epoch-action.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.
