Player Sweepstakes Rewards
Tracks all Sweepstakes Coins (SC) and engagement rewards given to players. This is distinct from the bonus/promotion system — it covers system-generated rewards like registration bonuses, daily login rewards, VIP cashback, and manual admin grants.
Table Comment
Tracks all Sweepstakes Coins (SC) and engagement rewards given to players. Distinct from bonus/promotion systems.
Relationships
- Belongs to players via
player_id - Optionally references vip_levels via
vip_level_id - Referenced by daily_reward_logs via
reward_id
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
player_id | uuid | NO | FK to players. The player receiving the reward. | |
reward_type | varchar(50) | NO | Type of reward. See values below. | |
gc_reward | numeric(18) | NO | 0 | Gold Coins awarded (final amount after VIP multiplier) |
sc_reward | numeric(18) | NO | 0 | Sweepstakes Coins awarded (final amount after VIP multiplier) |
base_gc_reward | numeric(18) | YES | Original GC reward before VIP multiplier was applied | |
base_sc_reward | numeric(18) | YES | Original SC reward before VIP multiplier was applied | |
vip_level_id | integer | YES | FK to vip_levels. The VIP level that affected this reward (for multiplied rewards). | |
vip_multiplier | numeric(5) | YES | VIP multiplier that was applied to the base reward (e.g., 1.5 = 150%) | |
claimed | boolean | NO | true | Whether the reward has been claimed/credited |
claimed_at | timestamptz | YES | Timestamp when the player claimed the reward | |
metadata | jsonb | YES | Additional metadata (e.g., day_number for daily_login rewards, campaign info) | |
created_at | timestamptz | NO | CURRENT_TIMESTAMP | When the reward was created |
Reward Types
| Type | Description |
|---|---|
registration | One-time reward granted upon player registration |
daily_login | Daily login streak reward (linked to daily_login_rewards config) |
manual | Manually granted by admin via backoffice |
promotion | Reward from a promotional campaign |
vip_cashback | Daily VIP cashback (linked to vip_daily_cashback_log) |
vip_tier_up | One-time reward for reaching a new VIP level |
other | Miscellaneous rewards |
Key Indexes
| Index | Columns | Notes |
|---|---|---|
player_sweepstakes_rewards_pkey | id | Primary key |
idx_player_sweepstakes_rewards_player_id | player_id | All rewards for a player |
idx_player_sweepstakes_rewards_player_type | player_id, reward_type | Rewards by type per player |
idx_player_sweepstakes_rewards_registration_unique | player_id, reward_type | Unique (WHERE reward_type = 'registration') — prevents duplicate registration rewards |
idx_player_sweepstakes_rewards_unclaimed | player_id, reward_type, claimed | Partial: WHERE claimed = false — pending rewards |
idx_player_sweepstakes_rewards_vip_cashback | player_id, reward_type, created_at | Partial: WHERE reward_type = 'vip_cashback' |
idx_player_sweepstakes_rewards_vip_tier_up | player_id, reward_type | Partial: WHERE reward_type = 'vip_tier_up' |
idx_player_sweepstakes_rewards_claimed_at | claimed_at | Partial: WHERE claimed_at IS NOT NULL |
idx_player_sweepstakes_rewards_reward_type | reward_type | Type filtering |
Business Rules
- Registration rewards can only be granted once per player (enforced by unique partial index)
- VIP multipliers are applied to base rewards:
gc_reward = base_gc_reward * vip_multiplier - The VIP
daily_bonus_multiplierfrom vip_levels determines how much extra a VIP player receives on daily rewards - When a reward is claimed, corresponding transactions are created to credit the player's balances
- The
claimedflag allows for rewards that require manual player action (e.g., clicking "Claim" in the UI)