src/referral/service.ts is explicitly documented as a single-level program: a referrer earns a reward when someone they referred activates, full stop. There's no second tier — the referrer's own referrer earns nothing from a sub-referral.
Task
- Add an optional second-tier reward (referrer's-referrer gets a smaller reward on the same activation event) behind a config flag, without disturbing the existing
PENDING → ACTIVATED → REWARDED lifecycle or the transactional activation check in checkAndActivateOnDeposit.
- The payout job (
jobs/referralPayout.ts) should pay all eligible tiers in the same sweep.
- Add tests for a 2-tier chain, including the case where the tier-2 referrer's own code is no longer active.
src/referral/service.tsis explicitly documented as a single-level program: a referrer earns a reward when someone they referred activates, full stop. There's no second tier — the referrer's own referrer earns nothing from a sub-referral.Task
PENDING→ACTIVATED→REWARDEDlifecycle or the transactional activation check incheckAndActivateOnDeposit.jobs/referralPayout.ts) should pay all eligible tiers in the same sweep.