# Staking & Unstaking Process

<figure><img src="/files/oDEbn6ZWzLp9EKN50xdM" alt=""><figcaption></figcaption></figure>

The above diagram illustrates the journey of EAI tokens through the staking lifecycle in the contract:<br>

1. **Staking During Epoch N**
   * A user stakes EAI tokens.
   * If staking occurs **mid-epoch**, tokens are placed in the **Pending Stake** pool.
2. **Pending Stake**
   * These tokens are **not eligible for rewards** during the current epoch.
   * They remain here until the epoch rolls over.
3. **Epoch Transition**
   * At the start of a new epoch (Epoch N+1), the epoch number and end time are updated. The tokens are migrated from `pendingStake → lockedStake`.
4. **Locked Stake**
   * Tokens moved here become **eligible for rewards** in EAI and/or USDC.
   * Rewards are calculated proportionally based on each user's `lockedStake`.
5. **Claim Rewards**
   * Users can claim their rewards via `Rewards`  section of TradeDividends
6. **Unstaking**
   * When users unstake:
     * It removes from **pending stake first** (no impact on rewards).
     * Then from **locked stake** if necessary \
       (reduces eligible reward amount if done before claiming).


---

# 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.eagleailabs.com/trade-rewards/staking-and-unstaking-process.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.
