code wiki / _hdl_build / nx_rewards.nx
nx_rewards.nx
buildroot/runtime/_hdl_build/nx_rewards.nx
about
nx_rewards.nx -- LIB: REAL-REWARD gamification (operator: "we want gamification for lots of these popular
activities but not dumb rewards but real rewards and real positives and real capabilities"). A GENERAL
gamification substrate (works for ANY activity -- swap, garden, compost, cook, ...) where every reward is REAL,
never a meaningless point or cosmetic badge.
A reward is REAL iff it pays out in at least one of:
VALUE -- measured money saved / value gained (cents, grounded in real data e.g. store prices).
CAPABILITY -- a real unlocked ability the ecosystem HONORS (rw_can gates real features on it).
PROVISION -- a real good earned (seeds, a tool), with its real worth.
ANTI-DUMB BY CONSTRUCTION: rw_def_achievement REFUSES any achievement with no real backing (value<=0 AND no
capability). So a "dumb reward" cannot exist in the system -- proven mechanically, not promised. Sovereign
seg-store (knowledge/store/reward-*, NO TSV), integer cents. license_tier: ORIGINAL
dependencies 3 imports · 5 importers
imports: nx_food_science.nxnx_seg_store.nxnx_syscalls.nx
imported by: nx_activities_gate.nxnx_rewards_gate.nxnx_seedlib.nxnx_seedlib_gate.nxnx_swap_reward_gate.nx
structs
| none |
consts
| 16 | const K_MAGIC_2048: i64 = 2048 |
functions
| 18 | func rw_put(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 27 | func rw_money(dst: *u8, off: i64, cents: i64) -> i64 |
| 39 | func rw_ach_key(aid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "reward:ach:" as *u8); o = as_append(out, o, aid); out[o] = 0 as u8; return o } |
| 42 | func rw_backing_real(value_cents: i64, capability: *u8) -> i64 |
| 50 | func rw_def_achievement(prefix: *u8, aid: *u8, name: *u8, activity: *u8, kind: *u8, value_cents: i64, capability: *u8, cite: *u8) -> i64 |
| 63 | func rw_ach_defined(prefix: *u8, aid: *u8) -> i64 |
| 70 | func rw_ach_str(prefix: *u8, aid: *u8, f: i64, out: *u8) -> i64 |
| 77 | func rw_ach_int(prefix: *u8, aid: *u8, f: i64) -> i64 |
| 85 | func rw_earned_key(uid: *u8, aid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "reward:earned:" as *u8); o = as_append(out, o, uid); out[o] = 58 as u8; o = o + 1; o = as_append(out, o, aid); out[o] = 0 as u8; return o } |
| 86 | func rw_cap_key(uid: *u8, cap: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "reward:cap:" as *u8); o = as_append(out, o, uid); out[o] = 58 as u8; o = o + 1; o = as_append(out, o, cap); out[o] = 0 as u8; return o } |
| 87 | func rw_value_key(uid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "reward:value:" as *u8); o = as_append(out, o, uid); out[o] = 0 as u8; return o } |
| 88 | func rw_earnedids_key(uid: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "reward:earnedids:" as *u8); o = as_append(out, o, uid); out[o] = 0 as u8; return o } |
| 90 | func rw_has(prefix: *u8, uid: *u8, aid: *u8) -> i64 |
| 97 | func rw_value_total(prefix: *u8, uid: *u8) -> i64 |
| 105 | func rw_can(prefix: *u8, uid: *u8, cap: *u8) -> i64 |
| 115 | func rw_grant(prefix: *u8, uid: *u8, aid: *u8, day: i64) -> i64 called by 4: mainmainmaincomplete_and_reward calls 15: rw_ach_definedrw_hassys_mmaprw_earned_keyfd_apnumrw_put+9 |
| 148 | func rw_render_rewards(prefix: *u8, uid: *u8, out: *u8) -> i64 |