pub struct FinancialReceiptMetadata {
pub grant_index: u32,
pub cost_charged: u64,
pub currency: String,
pub budget_remaining: u64,
pub budget_total: u64,
pub delegation_depth: u32,
pub root_budget_holder: String,
pub payment_reference: Option<String>,
pub settlement_status: SettlementStatus,
pub cost_breakdown: Option<Value>,
pub oracle_evidence: Option<OracleConversionEvidence>,
pub attempted_cost: Option<u64>,
}Expand description
Financial metadata attached to receipts for monetary grant invocations.
For allow receipts under a monetary grant, this struct is serialized under
the “financial” key in ChioReceiptBody::metadata.
For denial receipts caused by budget exhaustion, attempted_cost is
populated with the cost that would have been charged.
§Field Invariants
Callers constructing this struct must uphold the following invariants:
cost_charged <= budget_total: the amount charged for a single invocation must not exceed the total budget allocation.budget_remaining == budget_total - cost_charged(approximately): the remaining budget field should reflect the post-charge balance. Due to HA split-brain scenarios,budget_remainingmay be a best-effort snapshot rather than a strict invariant at read time, but callers must ensure it is computed correctly at write time.- For denial receipts,
cost_chargedshould be 0 andattempted_costshould hold the cost that was rejected.
These invariants are not enforced by the type system and must be upheld by the kernel when constructing financial metadata.
Fields§
§grant_index: u32Index of the matching grant in the capability token’s scope.
cost_charged: u64Cost charged for this invocation in currency minor units (e.g. cents for USD).
currency: StringISO 4217 currency code (e.g. “USD”).
budget_remaining: u64Remaining budget after this charge, in currency minor units.
budget_total: u64Total budget for this grant, in currency minor units.
delegation_depth: u32Depth of the delegation chain at the time of invocation.
root_budget_holder: StringIdentifier of the root budget holder in the delegation chain.
payment_reference: Option<String>Optional payment reference for external settlement systems.
settlement_status: SettlementStatusSettlement status for this charge.
cost_breakdown: Option<Value>Optional itemized cost breakdown for audit purposes.
oracle_evidence: Option<OracleConversionEvidence>Oracle price evidence used for cross-currency conversion, if applicable.
attempted_cost: Option<u64>Cost that was attempted but denied (populated only on denial receipts).
Trait Implementations§
Source§impl Clone for FinancialReceiptMetadata
impl Clone for FinancialReceiptMetadata
Source§fn clone(&self) -> FinancialReceiptMetadata
fn clone(&self) -> FinancialReceiptMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more