Skip to main content

FinancialReceiptMetadata

Struct FinancialReceiptMetadata 

Source
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_remaining may 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_charged should be 0 and attempted_cost should 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: u32

Index of the matching grant in the capability token’s scope.

§cost_charged: u64

Cost charged for this invocation in currency minor units (e.g. cents for USD).

§currency: String

ISO 4217 currency code (e.g. “USD”).

§budget_remaining: u64

Remaining budget after this charge, in currency minor units.

§budget_total: u64

Total budget for this grant, in currency minor units.

§delegation_depth: u32

Depth of the delegation chain at the time of invocation.

§root_budget_holder: String

Identifier of the root budget holder in the delegation chain.

§payment_reference: Option<String>

Optional payment reference for external settlement systems.

§settlement_status: SettlementStatus

Settlement 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

Source§

fn clone(&self) -> FinancialReceiptMetadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FinancialReceiptMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FinancialReceiptMetadata

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FinancialReceiptMetadata, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FinancialReceiptMetadata

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,