> ## Documentation Index
> Fetch the complete documentation index at: https://docs.delphai.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Staking

> Stake DELPH tokens to earn rewards and participate in the ecosystem

## Overview

The delphAI staking mechanism allows token holders to stake their DELPH tokens and earn continuous rewards from a shared reward pool. The system implements two key components:

1. **Time-locked Staking**: Stake tokens to earn farming rewards proportionally to your stake
2. **Flexible Unstaking**: Choose your unstaking period to determine penalty rates (50-100% return)

## How Staking Works

### Staking Process

When you stake DELPHAI tokens:

* Your tokens are locked in the staking contract
* You immediately start earning rewards proportionally to your stake
* Rewards are distributed continuously from the reward pool over time
* You can stake additional tokens at any time to increase your rewards

### Reward Distribution

The staking contract uses a continuous emission model:

* Rewards are distributed from a shared reward pool
* Distribution happens over a predefined period (e.g., 30 days)
* Your share of rewards is proportional to your staked amount vs total staked
* Rewards accumulate continuously and can be claimed at any time

**Example**: If the reward pool contains 100,000 DELPH with a 30-day distribution period, approximately 3,333 tokens are emitted per day to all stakers proportionally.

## Unstaking Mechanism

### Time-Based Penalty System

When you want to unstake, you choose a lock duration that determines your penalty:

* **Minimum Lock Period**: Shorter wait time, higher penalty (50% return)
* **Maximum Lock Period**: Longer wait time, no penalty (100% return)
* **Linear Scaling**: Lock periods in between scale linearly

**Example Configuration**:

* 7 days lock = 50% return (50% penalty)
* 30 days lock = 100% return (0% penalty)
* 15 days lock = 75% return (25% penalty)

### Unstaking Flow

1. **Initialize Unstake**: Choose amount and lock duration
   * Penalty is calculated based on your chosen duration
   * Penalty tokens are immediately added to the reward pool
   * You stop earning rewards on this amount
   * Tokens enter a waiting period

2. **Waiting Period**: Wait for the lock duration to complete
   * Your remaining tokens (after penalty) are reserved
   * Cannot be canceled once initiated

3. **Finalize Unstake**: Claim your tokens after the lock period
   * Receive your tokens minus the penalty
   * No additional fees or delays

## Key Features

### Continuous Farming Rewards

* Rewards are distributed smoothly over time, not in discrete epochs
* No need to wait for specific claim periods
* Claim anytime you want - rewards accumulate automatically
* Pool is replenished by penalties and external deposits

### Penalty-to-Rewards Model

When users unstake with penalties, those penalty tokens flow directly into the reward pool:

* Creates a self-sustaining ecosystem
* Early unstakers subsidize patient stakers
* Encourages longer-term participation

### Flexible Options

* **No lock period for staking**: Start earning immediately
* **Multiple unstake positions**: Can initiate multiple unstakes with different lock periods
* **Additive staking**: Stake more tokens anytime to increase rewards
* **EIP-2612 Permit support**: Gasless approvals for better UX

## Mathematical Model

### Reward Calculation

Your rewards at any time are calculated as:

$$
\text{Pending Rewards} = (\text{Your Stake} \times \text{Accumulated Rewards Per Share}) - \text{Reward Debt}
$$

Where:

* **Accumulated Rewards Per Share**: Total rewards distributed per staked token
* **Reward Debt**: Tracks rewards already accounted for
* **Emission Rate**:

$$
\text{Emission Rate} = \frac{\text{Reward Pool} \times \text{Time Elapsed}}{\text{Distribution Period}}
$$

### Penalty Calculation

Your return amount when unstaking:

$$
\text{Return Amount} = \text{Staked Amount} \times \frac{\text{Penalty Ratio}}{100}
$$

$$
\text{Penalty} = \text{Staked Amount} - \text{Return Amount}
$$

Where $\text{Penalty Ratio}$ scales linearly between $\text{MIN\_REDEEM\_RATIO}$ and $\text{MAX\_REDEEM\_RATIO}$ based on chosen lock days.

## Contract Parameters

The staking contract is deployed with immutable parameters:

| Parameter            | Description                   | Example Value |
| -------------------- | ----------------------------- | ------------- |
| MIN\_REDEEM\_DAYS    | Minimum unstaking lock period | 7 days        |
| MAX\_REDEEM\_DAYS    | Maximum unstaking lock period | 30 days       |
| MIN\_REDEEM\_RATIO   | Minimum return percentage     | 50%           |
| MAX\_REDEEM\_RATIO   | Maximum return percentage     | 100%          |
| DISTRIBUTION\_PERIOD | Reward distribution timeframe | 30 days       |

## Getting Started

### How to Stake

1. Connect your wallet to the delphAI platform
2. Navigate to the Staking section
3. Enter the amount of DELPH tokens you want to stake
4. Confirm the transaction
5. Start earning rewards immediately

### How to Claim Rewards

1. Go to the Staking dashboard
2. View your accumulated rewards
3. Click "Claim Rewards"
4. Confirm the transaction to receive your tokens

### How to Unstake

1. Navigate to your staked positions
2. Select the amount you want to unstake
3. Choose your lock duration (affects penalty rate)
4. Confirm to initialize the unstake
5. Wait for the lock period to complete
6. Return to finalize and receive your tokens

## Best Practices

1. **Maximize Rewards**: Stake early and maintain your position
2. **Plan Unstaking**: Choose longer lock periods to minimize penalties
3. **Claim Regularly**: Gas-efficient to claim periodically rather than every block
4. **Monitor Pool**: Keep an eye on the reward pool size and distribution rate
5. **Multiple Positions**: Consider spreading unstakes across different lock periods

## Contract Address

| Network     | Contract Address                             |
| ----------- | -------------------------------------------- |
| BSC Mainnet | `0x4Bd4c9AaaE9B9fD66EDEc0932B1A4297409aDe8f` |

## Additional Resources

* [Staking Smart Contract](https://bscscan.com/address/0x4Bd4c9AaaE9B9fD66EDEc0932B1A4297409aDe8f)
* [FAQ](/resources/faq)
