Skip to content

feat(core-contracts): top-up bonus curve with base and bonus credits quoted separately - #1719

Merged
nc9 merged 3 commits into
mainfrom
feat/topup-bonus-curve-3888
Nov 13, 2026
Merged

nc9 merged 3 commits into
mainfrom
feat/topup-bonus-curve-3888

Conversation

@nc9

@nc9 nc9 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Public code slice of squirrelscan/repo#3888 (billing). Nik approved the curve on 2026-11-13. Merge it together with the private slice (squirrelscan/repo#3899): the gitlink bump is the price change. The docs are in the held PR #1721, which merges on the private slice's deploy day.

topupCreditsForUsd now includes a bonus:

  • 0% at or below $100;
  • above that, 20 x ((usd - 100) / 900) ^ 0.7 percent, capped at 20%, floored to whole credits.

It is the same for Pro and Team. The $10 minimum, the $1,000 maximum and 100 credits per $1 are unchanged. The floor, cap and exponent live in one object, TOPUP_BONUS_CURVE.

Amount Bonus Credits Per $1
$50 0% 5,000 100
$75 0% 7,500 100
$100 0% 10,000 100
$150 2.6% 15,396 102.6
$250 5.7% 26,426 105.7
$500 11.3% 55,668 111.3
$750 15.9% 86,944 115.9
$1,000 20% 120,000 120

New exports:

  • topupQuote: base, bonus and total separately; NaN, Infinity and non-positive amounts give a zero quote.
  • topupBonusPercent, topupBonusSchedule and TOPUP_SCHEDULE_USD.

Tests (37 pass):

  • every row of the table above;
  • the cap;
  • exactly 100 credits per $1 at and below the floor;
  • monotonic over every whole dollar;
  • the bad-amount cases;
  • a pinned totalCredits for every whole dollar from $10 to $1,000 (tests/fixtures/topup-total-credits.json, regenerated for the $100 floor).

Rebased onto main (4b34f00). DCO is signed on every commit. Skill change: none.

nc9 added 3 commits November 13, 2026 12:04
…ive amounts, pin every whole dollar; docs move to a held PR

Signed-off-by: Nik Cubrilovic <[email protected]>
… 2.6% at $150, 5.7% at $250, 11.3% at $500, 15.9% at $750, 20% at $1,000) (squirrelscan/repo#3888)

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the feat/topup-bonus-curve-3888 branch from 4b34f00 to 9b6fb04 Compare November 13, 2026 12:04
@nc9
nc9 merged commit cecfc1b into main Nov 13, 2026
16 checks passed
@nc9
nc9 deleted the feat/topup-bonus-curve-3888 branch November 13, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant