Skip to main content

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

Columns

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
player_iduuidNOFK to players. The player receiving the reward.
reward_typevarchar(50)NOType of reward. See values below.
gc_rewardnumeric(18)NO0Gold Coins awarded (final amount after VIP multiplier)
sc_rewardnumeric(18)NO0Sweepstakes Coins awarded (final amount after VIP multiplier)
base_gc_rewardnumeric(18)YESOriginal GC reward before VIP multiplier was applied
base_sc_rewardnumeric(18)YESOriginal SC reward before VIP multiplier was applied
vip_level_idintegerYESFK to vip_levels. The VIP level that affected this reward (for multiplied rewards).
vip_multipliernumeric(5)YESVIP multiplier that was applied to the base reward (e.g., 1.5 = 150%)
claimedbooleanNOtrueWhether the reward has been claimed/credited
claimed_attimestamptzYESTimestamp when the player claimed the reward
metadatajsonbYESAdditional metadata (e.g., day_number for daily_login rewards, campaign info)
created_attimestamptzNOCURRENT_TIMESTAMPWhen the reward was created

Reward Types

TypeDescription
registrationOne-time reward granted upon player registration
daily_loginDaily login streak reward (linked to daily_login_rewards config)
manualManually granted by admin via backoffice
promotionReward from a promotional campaign
vip_cashbackDaily VIP cashback (linked to vip_daily_cashback_log)
vip_tier_upOne-time reward for reaching a new VIP level
otherMiscellaneous rewards

Key Indexes

IndexColumnsNotes
player_sweepstakes_rewards_pkeyidPrimary key
idx_player_sweepstakes_rewards_player_idplayer_idAll rewards for a player
idx_player_sweepstakes_rewards_player_typeplayer_id, reward_typeRewards by type per player
idx_player_sweepstakes_rewards_registration_uniqueplayer_id, reward_typeUnique (WHERE reward_type = 'registration') — prevents duplicate registration rewards
idx_player_sweepstakes_rewards_unclaimedplayer_id, reward_type, claimedPartial: WHERE claimed = false — pending rewards
idx_player_sweepstakes_rewards_vip_cashbackplayer_id, reward_type, created_atPartial: WHERE reward_type = 'vip_cashback'
idx_player_sweepstakes_rewards_vip_tier_upplayer_id, reward_typePartial: WHERE reward_type = 'vip_tier_up'
idx_player_sweepstakes_rewards_claimed_atclaimed_atPartial: WHERE claimed_at IS NOT NULL
idx_player_sweepstakes_rewards_reward_typereward_typeType 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_multiplier from 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 claimed flag allows for rewards that require manual player action (e.g., clicking "Claim" in the UI)