Files
aurorabot/shared/modules/economy/AGENTS.md
syntaxbullet 6abbd4652a
Some checks failed
Deploy to Production / test (push) Failing after 33s
Refresh repository documentation
- Rewrite AGENTS and README files to match the current app layout
- Document API routes, trivia UI, and the active panel design language
2026-04-09 21:10:10 +02:00

1.3 KiB

Economy module

This area is split across three services:

  • economy.service.ts
  • exam.service.ts
  • lootdrop.service.ts

Core rules

  • Currency values are bigint
  • modifyUserBalance() is the canonical balance mutator for most features because it logs a transaction and emits BALANCE_CHANGED
  • direct balance updates still exist in a few flows where the service owns the full transaction, such as trivia entry/win and exam payout

Daily rewards

  • claimDaily() uses a UTC-midnight cooldown, not a rolling 24-hour timer
  • streak bonus is linear from config.economy.daily.streakBonus
  • weekly bonus applies every seventh claim
  • total daily reward is capped at 500n
  • missing more than 24 hours after the cooldown expired resets the streak

Weekly exam

  • stored in user_timers with type EXAM_SYSTEM
  • registration locks the user to the current weekday
  • payout is based on XP gained since the previous exam snapshot
  • missing the assigned weekday rolls the timer forward and pays nothing

Lootdrops

  • channel activity and cooldowns are kept in memory
  • spawned drops are persisted in the lootdrops table
  • claiming uses an atomic update where claimedBy IS NULL
  • expired drops and stale activity are cleaned every 60 seconds
  • spawned drops expire after 10 minutes