code wiki / (root) / nx_captable_gate.nx

nx_captable_gate.nx source

↩ module page · 66 lines · 5204 B

1// nx_captable_gate.nx -- INDEPENDENT GATE: cap table arithmetic and corporate-authority limits. 2// ZERO storage. The teeth: issuing beyond the authorised count is VOID (not a negative headroom figure); 3// ownership differs by BASIS and both bases are named explicitly; dilution can only ever reduce a 4// holder's percentage; and a zero denominator yields UNKNOWN, never "0% owned". 5// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 6 7import "nx_captable_lib.nx" 8import "nx_gate_verdict.nx" 9 10func main(argc: i64, argv: *i64) -> i64 { 11 let ctr: *i64 = gv_ctr() 12 13 let auth: i64 = 10000000 14 let issued: i64 = 8000000 15 let treas: i64 = 500000 16 17 gv_head("NISHI-CAPTABLE-GATE (cap table: authority limits, bases, dilution invariants)" as *u8) 18 19 // ---- A: corporate authority ---- 20 gv_check("A1 issuing within the authorised count is permitted" as *u8, ent_issue_ok_pure(auth, issued) == 1, ctr) 21 gv_check("A2 issuing EXACTLY the authorised count is permitted" as *u8, ent_issue_ok_pure(auth, auth) == 1, ctr) 22 gv_check("A3 u2605issuing ONE share beyond authority is NOT permitted" as *u8, ent_issue_ok_pure(auth, auth + 1) == 0, ctr) 23 gv_check("A4 remaining authorised headroom" as *u8, ent_authorized_remaining_pure(auth, issued) == 2000000, ctr) 24 gv_check("A5 u2605over-issuance reports VOID, never negative headroom" as *u8, ent_authorized_remaining_pure(auth, auth + 1) == ENT_VOID, ctr) 25 gv_check("A6 a negative authorised count is refused" as *u8, ent_issue_ok_pure(0 - 1, 100) == 0, ctr) 26 27 // ---- O: outstanding ---- 28 gv_check("O1 outstanding = issued minus treasury" as *u8, ent_outstanding_pure(issued, treas) == 7500000, ctr) 29 gv_check("O2 no treasury -> outstanding equals issued" as *u8, ent_outstanding_pure(issued, 0) == 8000000, ctr) 30 gv_check("O3 treasury exceeding issued is impossible -> UNKNOWN" as *u8, ent_outstanding_pure(100, 200) == ENT_UNKNOWN, ctr) 31 gv_check("O4 negative treasury -> UNKNOWN" as *u8, ent_outstanding_pure(100, 0 - 5) == ENT_UNKNOWN, ctr) 32 33 // ---- F: fully diluted ---- 34 let outs: i64 = ent_outstanding_pure(issued, treas) 35 let fd: i64 = ent_fully_diluted_pure(outs, 1000000, 500000, 250000, 750000) 36 gv_check("F1 fully diluted adds granted + pool + warrants + convertibles" as *u8, fd == 10000000, ctr) 37 gv_check("F2 u2605the UNISSUED pool counts -- omitting it understates dilution" as *u8, ent_fully_diluted_pure(outs, 1000000, 0, 250000, 750000) == 9500000, ctr) 38 gv_check("F3 nothing outstanding beyond shares -> diluted equals outstanding" as *u8, ent_fully_diluted_pure(outs, 0, 0, 0, 0) == 7500000, ctr) 39 gv_check("F4 an unknown outstanding propagates to UNKNOWN" as *u8, ent_fully_diluted_pure(ENT_UNKNOWN, 0, 0, 0, 0) == ENT_UNKNOWN, ctr) 40 41 // ---- P: ownership depends on the BASIS ---- 42 gv_check("P1 750000 shares on an OUTSTANDING basis = 100 permille" as *u8, ent_ownership_outstanding_pure(750000, outs) == 100, ctr) 43 gv_check("P2 the SAME holding on a FULLY DILUTED basis = 75 permille" as *u8, ent_ownership_diluted_pure(750000, fd) == 75, ctr) 44 gv_check("P3 u2605the two bases genuinely DISAGREE for the same holder" as *u8, ent_ownership_outstanding_pure(750000, outs) == ent_ownership_diluted_pure(750000, fd) == 0, ctr) 45 gv_check("P4 a zero denominator -> UNKNOWN, never 0 permille" as *u8, ent_ownership_outstanding_pure(750000, 0) == ENT_UNKNOWN, ctr) 46 gv_check("P5 a negative holding -> UNKNOWN" as *u8, ent_ownership_outstanding_pure(0 - 1, outs) == ENT_UNKNOWN, ctr) 47 gv_check("P6 the whole company on an outstanding basis = 1000 permille" as *u8, ent_ownership_outstanding_pure(outs, outs) == 1000, ctr) 48 49 // ---- D: the dilution invariant ---- 50 gv_check("D1 diluted percentage never exceeds outstanding percentage" as *u8, ent_dilution_consistent_pure(100, 75) == 1, ctr) 51 gv_check("D2 equal bases are consistent" as *u8, ent_dilution_consistent_pure(100, 100) == 1, ctr) 52 gv_check("D3 u2605a diluted figure ABOVE the outstanding figure is impossible" as *u8, ent_dilution_consistent_pure(75, 100) == 0, ctr) 53 gv_check("D4 an UNKNOWN on either side is not consistent" as *u8, ent_dilution_consistent_pure(ENT_UNKNOWN, 75) == 0, ctr) 54 55 // ---- L: the option pool as investors negotiate it ---- 56 gv_check("L1 pool = granted + available over fully diluted" as *u8, ent_pool_permille_pure(1000000, 500000, fd) == 150, ctr) 57 gv_check("L2 an empty pool is 0 permille of a real base" as *u8, ent_pool_permille_pure(0, 0, fd) == 0, ctr) 58 59 // ---- V: whole-table validity ---- 60 gv_check("V1 a coherent table is valid" as *u8, ent_table_valid_pure(auth, issued, treas, fd) == 1, ctr) 61 gv_check("V2 u2605over-issuance invalidates the WHOLE table" as *u8, ent_table_valid_pure(auth, auth + 1, treas, fd) == 0, ctr) 62 gv_check("V3 a diluted base BELOW outstanding invalidates it" as *u8, ent_table_valid_pure(auth, issued, treas, 100) == 0, ctr) 63 gv_check("V4 impossible treasury invalidates it" as *u8, ent_table_valid_pure(auth, 100, 200, fd) == 0, ctr) 64 65 return gv_verdict("CAPTABLE" as *u8, ctr, "over-issuance is VOID; both ownership bases proven to disagree; dilution only reduces" as *u8) 66}