code wiki / (root) / nx_damages_gate.nx

nx_damages_gate.nx

buildroot/runtime/nx_damages_gate.nx

8191 B124 linesdepth 7pulls 16 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_damages_gate.nx -- PREJUDGMENT INTEREST GATE. Proves the exact day count (via composed nx_sol), simple and annually-compounded interest, that compound exceeds simple for the same period, the total-award composition, a full real scenario ($50k loss over an exact 3-year interval at 8pct simple = $12k interest), and the fail-closed refusals (judgment before accrual, negative principal/rate/days, sentinel propagation). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 D001-MIGRATED 2026-08-26: the verdict now comes from the shared nx_gate_verdict base class, so the outcome is readable FROM OUTSIDE via the exit code (/api/gate_run) and a harness frame is recorded. The hand-rolled cnt[] survives ONLY to feed the legacy `pass=/fail=` line, which is this gate's public signature; gv_ctr is the canonical count, so a tooth that silently stops running can no longer read GREEN. The fail-closed teeth are named `neg-control-` so the gate-law census can SEE them: a control nobody can find is a control nobody maintains.

dependencies 3 imports · 0 importers

nx_damages_lib.nx nx_matter_lib.nx nx_gate_verdict.nx nx_damages_gate.nx

imports: nx_damages_lib.nxnx_matter_lib.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ dm_puts dm_ck dm_puts ↻ dm_putn gv_check gv_puts sys_write ↻ dmg_days_between sol_days_from_civil dmg_simple_interest dmg_compound_interest dmg_total_award dm_putn ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

23const ACCRUAL_YEAR: i64 = 2020 // date of loss, both scenarios
24const JUDGMENT_YEAR_2YR: i64 = 2022 // exactly two years after accrual (the span contains a leap day)
25const JUDGMENT_YEAR_3YR: i64 = 2023 // judgment year for the $50k scenario
26const DAYS_2YR_LEAP_SPAN: i64 = 731 // 2020-01-01 -> 2022-01-01, leap-aware
27const DAYS_3YR_SPAN: i64 = 1095 // 2020-03-15 -> 2023-03-15
28const PRINCIPAL_1K_CENTS: i64 = 100000 // $1,000.00
29const PRINCIPAL_50K_CENTS: i64 = 5000000 // $50,000.00
30const RATE_10PCT_BP: i64 = 1000 // 10.00% in basis points
31const RATE_8PCT_BP: i64 = 800 // 8.00% in basis points
32const DAYS_1YR: i64 = 365
33const DAYS_2YR: i64 = 730
34const YEARS_2: i64 = 2
35const INTEREST_1YR_SIMPLE_CENTS: i64 = 10000 // $100.00
36const INTEREST_2YR_SIMPLE_CENTS: i64 = 20000 // $200.00
37const INTEREST_2YR_COMPOUND_CENTS: i64 = 21000 // $210.00 -- compounding beats simple by $10 over the same 2 years
38const AWARD_1K_PLUS_2YR_CENTS: i64 = 120000 // $1,200.00 = principal + 2yr simple interest
39const INTEREST_50K_3YR_CENTS: i64 = 1200000 // $12,000.00 = 8pct x 3yr x $50k
40const AWARD_50K_TOTAL_CENTS: i64 = 6200000 // $62,000.00 = principal + prejudgment interest

functions

42func dm_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: dm_ckmain
43func dm_putn(v: i64) -> i64
called by 2: dm_ckmain
58func dm_ck(cnt: *i64, ctr: *i64, name: *u8, got: i64, want: i64) -> i64
called by 1: main calls 3: dm_putsdm_putngv_check
73func main(argc: i64, argv: *i64) -> i64