#[derive(Debug, Clone)]
pub struct FeeTable {
pub per_transaction_weight_cost: u64,
pub per_module_call_cost: u64,
pub per_byte_storage_cost: u64,
pub per_signature_verification_cost: u64,
pub per_template_load_cost_unit: u64,
pub per_substate_create_cost: u64,
pub per_wasm_point_cost: u64,
pub storage_cost_divisor: u64,
pub template_load_bytes_cost_divisor: u64,
pub wasm_points_cost_divisor: u64,
}
impl FeeTable {
pub fn zero_rated() -> Self {
Self {
per_transaction_weight_cost: 0,
per_module_call_cost: 0,
per_byte_storage_cost: 0,
per_signature_verification_cost: 0,
per_template_load_cost_unit: 0,
per_substate_create_cost: 0,
per_wasm_point_cost: 0,
storage_cost_divisor: 1,
template_load_bytes_cost_divisor: 1,
wasm_points_cost_divisor: 1,
}
}
pub fn per_transaction_weight_cost(&self) -> u64 {
self.per_transaction_weight_cost
}
pub fn per_module_call_cost(&self) -> u64 {
self.per_module_call_cost
}
pub fn per_byte_storage_cost(&self) -> u64 {
self.per_byte_storage_cost
}
pub fn per_signature_verification_cost(&self) -> u64 {
self.per_signature_verification_cost
}
pub fn per_template_load_cost_unit(&self) -> u64 {
self.per_template_load_cost_unit
}
pub fn per_substate_create_cost(&self) -> u64 {
self.per_substate_create_cost
}
pub fn per_wasm_point_cost(&self) -> u64 {
self.per_wasm_point_cost
}
pub fn storage_cost_divisor(&self) -> u64 {
non_zero(self.storage_cost_divisor)
}
pub fn template_load_bytes_cost_divisor(&self) -> u64 {
non_zero(self.template_load_bytes_cost_divisor)
}
pub fn wasm_points_cost_divisor(&self) -> u64 {
non_zero(self.wasm_points_cost_divisor)
}
}
fn non_zero(divisor: u64) -> u64 {
if divisor == 0 { 1 } else { divisor }
}