code wiki / _hdl_build / nx_adnet_invoice.nx
nx_adnet_invoice.nx
buildroot/runtime/_hdl_build/nx_adnet_invoice.nx
about
nx_adnet_invoice.nx -- LIB: the BILLING PIPELINE for the sovereign ad network (debt 1785513943).
THE GAP IT CLOSED: nx_adnet_bill held correct CPM/CPC math that NOTHING ever called -- grep found zero
production callers, only its own gate. The network served slots and journalled served/viewable/click
events, but no organ ever read those journals, applied a rate, or produced an invoice, so no advertiser
could be charged at all. Correct math nobody calls is not a billing system.
This COMPOSES (rule 22) the already-gated parts rather than re-implementing them: ad_event_count for the
per-AD counts, anb_invoice_line_v for the viewable-basis money math. It adds exactly one thing -- the
RATE CARD, and the loop that joins rates to measured events.
RATES ARE DATA, NEVER CODE (rule 11): knowledge/status/adnet_rates.conf, one row per ad:
<ad_id>\t<cpm_milli>\t<cpc_milli>\t<cap_milli> ('#' comment rows ignored)
DELIBERATELY NOT under sites/ -- a rate card is commercially sensitive and /synth/ is publicly served.
HONEST-BILLING LAW: an ad with NO rate row is REFUSED, never defaulted to zero and never guessed. A
missing price and a price of zero are different facts and must not collapse into the same invoice line.
license_tier: ORIGINAL
dependencies 3 imports · 5 importers
imports: nx_syscalls.nxnx_adnet_slot.nxnx_adnet_bill.nx
imported by: nx_adnet_advreport.nxnx_adnet_invoice_gate.nxnx_adnet_ops.nxnx_adnet_reconcile.nxnx_mgmt_data.nx
structs
| none |
consts
| none |
functions
| 23 | func ainv_num(s: *u8) -> i64 called by 1: ainv_rate |
| 42 | func ainv_rate(rates: *u8, rlen: i64, ad_id: *u8, idx: i64) -> i64 called by 4: ainv_spent_milliainv_line_formainaop_report calls 4: sys_mmapad_eolaslot_field_bainv_num |
| 77 | func ainv_spent_milli(rates: *u8, rlen: i64, servedlog: *u8, slen: i64, viewlog: *u8, vlen: i64, clklog: *u8, clen: i64, ad_id: *u8) -> i64 |
| 97 | func ainv_line_for(rates: *u8, rlen: i64, servedlog: *u8, slen: i64, viewlog: *u8, vlen: i64, clklog: *u8, clen: i64, ad_id: *u8, out: *u8, cap: i64) -> i64 |
| 120 | func ainv_report(inv: *u8, ilen: i64, rates: *u8, rlen: i64, servedlog: *u8, slen: i64, viewlog: *u8, vlen: i64, clklog: *u8, clen: i64, out: *u8, cap: i64) -> i64 called by 2: mainmd_adnet_invoice_report calls 5: sys_mmapad_eolaslot_field_baslot_id_okainv_line_for |
| 157 | func ainv_report_for_advertiser(camps: *u8, clen: i64, adv_bk: *u8, rates: *u8, rlen: i64, servedlog: *u8, slen: i64, viewlog: *u8, vlen: i64, clklog: *u8, cllen: i64, out: *u8, cap: i64) -> i64 |