Skip to main content

Module cost

Module cost 

Source
Expand description

Cost conversion and attribution (spec 009, 3.8.1 and 3.10.4).

A charge is observed only from a cost the remote side reported for the exchange, converted to the deployment’s units by a declared rate and rounded up; estimated from reported usage and a declared price table; unknown otherwise. Units are not money: the reported amount and currency are kept verbatim in the exchange record.

Structs§

PriceTable
Deployment units per unit of reported usage (for example per token), declared by the host.
UnitRate
Deployment units per reported unit (per currency unit, or per remote unit). Declared by the host; never negative.

Enums§

CostError
Why a cost could not be converted. The charge is then unknown.

Functions§

attribute
Attribute an exchange’s charge to its members (3.10.4). received[i] is whether member i, in attempt-id order, received the response. Receivers get integer shares summing exactly to the total, the first total % receivers one unit more; a member that stopped waiting gets unknown, so its reservation stays liability until reconciled. An unknown total, or no receiver, leaves every member unknown.
convert_bound
A per-call disclosure in remote units, in deployment units, rounded up.
convert_charge
A charge in remote units, in deployment units. A charge that cannot be converted is unknown, never clipped.
convert_units
Whole remote units times the rate, rounded up.
observed_from_amount
An observed charge from a reported amount; unknown when it cannot be converted.
sum_charges
The sum of a member list’s charges: observed only when all are, unknown when any is, estimated otherwise.
units_from_amount
A decimal amount as reported, times the rate, rounded up to whole units.