💰

# Staking Rewards & Earnings

Manage Basic Reward Distribution

## 🎯 Rewards Overview

The staking rewards system provides basic earnings management functionality. Administrators can create earnings records, track user rewards, and distribute payments. The system supports simple earning types and basic distribution management.

## 📋 Earning Types

💵

### REGULAR

Standard staking rewards based on APR

Primary earning type
🎁

### BONUS

Additional rewards and incentives

Special promotions
🤝

### REFERRAL

Referral program rewards

User referrals

## 🔧 Earnings Management

### Access Earnings Management

Navigate to the earnings management section:

Admin Panel → Staking → Earnings

View aggregated earnings data and create new earning records.

### Creating Earning Records

When creating earning records, you need to specify:

Basic Information

- • Position ID (which position earns)
- • Amount to be credited
- • Earning type (REGULAR/BONUS/REFERRAL)
- • Description of the earning

Status Information

- • Claimed status (isClaimed: true/false)
- • Claimed date (claimedAt: optional)
- • Automatic timestamps
- • Soft delete support

### Earnings Overview

The earnings dashboard provides:

Aggregated Totals: Total user earnings, admin earnings, and overall earnings
Pool Breakdown: Earnings by staking pool with detailed breakdown
Historical Data: Admin earnings history with computed user earnings
Filtering Options: Filter by pool, date range, and other criteria

## 📊 Distribution System

### Distribution Management

The system provides basic distribution functionality:

Admin Distribution

Create admin earning records for platform fees and management

User Rewards

Track user earning records linked to specific positions

### Distribution Actions

`POST /api/admin/staking/earning/distribute`

Process earnings distribution

## 📋 Data Models

### stakingEarningRecord Model

Field | Type | Description
--- | --- | ---
id | UUID | Unique earning record identifier
positionId | UUID | Reference to the staking position
amount | Float | Amount of reward earned
type | Enum | REGULAR | BONUS | REFERRAL
description | String | Description of the earning
isClaimed | Boolean | Whether the reward has been claimed
claimedAt | Date | When the reward was claimed (optional)

### stakingAdminEarning Model

Field | Type | Description
--- | --- | ---
id | UUID | Unique admin earning identifier
poolId | UUID | Reference to the staking pool
amount | Float | Amount of admin earnings
description | String | Description of the admin earning

## 🔌 API Integration

### Available Endpoints

`GET /api/admin/staking/earning`

Get aggregated earnings data with filtering options

`POST /api/admin/staking/earning`

Create new earning record

`GET /api/admin/staking/earning/{id}`

Get specific earning record details

`POST /api/admin/staking/earning/distribute`

Process earnings distribution

## 💡 Best Practices

### Accurate Record Keeping

Ensure all earning amounts and descriptions are accurate before creating records.

### Proper Type Classification

Use the correct earning type (REGULAR, BONUS, REFERRAL) for proper categorization.

### Distribution Monitoring

Regularly monitor distribution processes and handle any failed transactions.

### Data Analysis

Use the aggregated data to analyze pool performance and user engagement.