From 0e7b3965961e767ea049921e24310e8f742133c6 Mon Sep 17 00:00:00 2001 From: Anthony Graignic <anthony.graignic@uca.fr> Date: Mon, 22 Jan 2024 09:13:17 +0100 Subject: [PATCH] Update mobility coefficients for bx quantity --- src/utils/mobility_data.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/utils/mobility_data.rs b/src/utils/mobility_data.rs index 8589aec..4ce2d0b 100644 --- a/src/utils/mobility_data.rs +++ b/src/utils/mobility_data.rs @@ -121,15 +121,21 @@ pub fn compute_stretched_relative_start_time( } /// Provide differents fake quantities depending on mobility e.g. BIKE that will be use for rewards calculation +/// Coefficients per km from https://nosgestesclimat.fr/actions/plus/transport/voiture-5km pub fn quantify_mobility(service: String) -> U256 { + // let base_vdf_divider = + let base_vdf_divider = + // U256::from(1_000_000_000_000_000_000_000_000_000_u128); + U256::from("0x0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff"); if service == "BIKE_SHARING" { - U256::from(1000000000000000000_u128) + // 0.129/0.0001 = 1290 + base_vdf_divider.saturating_mul(U256::from(1290_u128)) } else if service == "BIKE_RENTAL" { - U256::from(500000000000000000_u128) + base_vdf_divider.saturating_mul(U256::from(1290_u128)) } else if service == "PUBLIC_TRANSPORT" { - U256::from(10000000000000000_u128) + base_vdf_divider.saturating_mul(U256::from(1_u128)) } else { - U256::from(1) + base_vdf_divider } } @@ -283,6 +289,6 @@ mod tests { // ACT let result = quantify_mobility(String::from("BIKE_SHARING")); // ASSERT - assert_eq!(U256::from(1000000000000000000_u128), result); + assert_eq!(U256::from(1290000000000000000000_u128), result); } } -- GitLab