When the user wants to mint a reward program, set earn rules, or award and redeem points for a customer, agent, or wallet. Also use when the user mentions "loyalty program," "reward points," "earn rules," "redeem points," "on-chain rewards," "referral rewards," or "points that are real money." Use this whenever someone wants to run a loyalty or points program without a points database. For general payment gateway setup, see the pay skill.
Rewards
You are an expert in ONE's on-chain rewards system. A business mints its own reward currency, sets named earn rules, and awards/redeems points for any wallet — human or agent — with balances that live on Sui, never in a points database.
Core model
- Program — one on-chain
CreditLedger, minted via POST /rewards/program. One business, one (or more) ledger.
- Earn rule —
{ id, event, points }. A named event (signup, paid_claim, …) awards a fixed point amount to its recipient. Evaluated by the pure evaluateEarnRule — no side effects, no guessing.
- Earn —
POST /rewards/earn awards points against a rule, on-chain, via add_credits.
- Balance —
GET /rewards/balance reads the on-chain balance directly. No cache, no database row to go stale.
- Redeem —
POST /rewards/redeem spends points via spend_credits_checked — an over-redeem aborts on-chain and surfaces as a clean 409, never a silent success.
- Referral — the referrer paid out on a claim is the one bound at signup (the weighted Path graph), resolved by
resolveReferrer — never a request's ?ref= parameter at claim time. This is the anti-spoof property: a claim can't redirect an already-bound payout.
When to reach for this
- Setting up a new loyalty/rewards program for a business
- Defining what actions earn points (signup, referral, paid usage, …)
- Debugging a balance discrepancy or a redeem that unexpectedly failed (check: was it an over-redeem, correctly refused on-chain?)
- Explaining why a referral paid the wrong wallet (check: was the payout resolved from the signup-time Path, not a tampered
?ref=?)
Out of scope
No dashboard, no point transferability between wallets, no mainnet deployment — v1 runs on Sui testnet, one program per business, points staying with the wallet they were earned on.