radix_engine_interface/api/
costing_api.rs

1use crate::blueprints::resource::LiquidFungibleResource;
2use crate::types::*;
3use radix_common::math::Decimal;
4
5pub trait SystemCostingApi<E> {
6    /// Check if costing is enabled.
7    fn start_lock_fee(&mut self, amount: Decimal, contingent: bool) -> Result<bool, E>;
8
9    /// Add cost units to the reserve. This should never fail.
10    fn lock_fee(&mut self, locked_fee: LiquidFungibleResource, contingent: bool);
11
12    /// Consume an amount of cost units.
13    fn consume_cost_units(&mut self, costing_entry: ClientCostingEntry) -> Result<(), E>;
14
15    /// Retrieve the cost unit limit for the transaction
16    fn execution_cost_unit_limit(&mut self) -> Result<u32, E>;
17
18    /// Retrieve the cost unit price in XRD
19    fn execution_cost_unit_price(&mut self) -> Result<Decimal, E>;
20
21    /// Retrieve the finalization cost unit limit
22    fn finalization_cost_unit_limit(&mut self) -> Result<u32, E>;
23
24    /// Retrieve the finalization cost unit price in XRD
25    fn finalization_cost_unit_price(&mut self) -> Result<Decimal, E>;
26
27    /// Retrieve the usd price of XRD
28    fn usd_price(&mut self) -> Result<Decimal, E>;
29
30    /// Retrieve the maximum allowable royalty per function
31    fn max_per_function_royalty_in_xrd(&mut self) -> Result<Decimal, E>;
32
33    /// Retrieve the tip percentage of the transaction
34    fn tip_percentage_truncated(&mut self) -> Result<u32, E>;
35
36    /// Retrieve the current fee balance in XRD
37    fn fee_balance(&mut self) -> Result<Decimal, E>;
38}