qualia_core_db/domains/financial/economics/
node_pricing.rs1pub struct SystemContext {
5 pub current_battery_level: f32,
6 pub cpu_temperature: f32,
7 pub network_congestion_index: f64,
8}
9
10pub fn get_current_system_context() -> SystemContext {
12 SystemContext {
13 current_battery_level: 0.8,
14 cpu_temperature: 45.0,
15 network_congestion_index: 0.2,
16 }
17}
18
19pub fn calculate_bandwidth_liability(bytes: usize, context: &SystemContext) -> f64 {
21 let gb_routed = bytes as f64 / 1_073_741_824.0;
22 let mut base_rate = 0.05;
23
24 base_rate += context.network_congestion_index * 0.05;
25 if context.current_battery_level < 0.2 {
26 base_rate += 0.05;
27 }
28 if context.cpu_temperature > 70.0 {
29 base_rate += 0.02;
30 }
31
32 gb_routed * base_rate
33}