From 89452b088914839e8393b4b3d2cc4506e11ef477 Mon Sep 17 00:00:00 2001 From: Artur Michalek Date: Wed, 31 Jul 2024 14:43:39 +0200 Subject: [PATCH] Update usage of soroban fixed point math --- contracts/governance/src/lib.rs | 2 +- contracts/governance/src/neural_governance.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/governance/src/lib.rs b/contracts/governance/src/lib.rs index f4ec650..e88b336 100644 --- a/contracts/governance/src/lib.rs +++ b/contracts/governance/src/lib.rs @@ -391,7 +391,7 @@ fn weigh_neuron_result(env: &Env, weight: &I256, result: Map) -> M for (key, value) in result { scaled.set( key, - value.fixed_mul_floor(env, weight.clone(), I256::from_i128(env, DECIMALS)), + value.fixed_mul_floor(env, weight, &I256::from_i128(env, DECIMALS)), ); } diff --git a/contracts/governance/src/neural_governance.rs b/contracts/governance/src/neural_governance.rs index 3f13eca..21024f0 100644 --- a/contracts/governance/src/neural_governance.rs +++ b/contracts/governance/src/neural_governance.rs @@ -73,7 +73,7 @@ pub(crate) fn aggregate_result( LayerAggregator::Sum => res.iter().reduce(|acc, e| acc.add(&e)), LayerAggregator::Product => res .iter() - .reduce(|acc, e| acc.fixed_mul_floor(env, e, decimals.clone())), + .reduce(|acc, e| acc.fixed_mul_floor(env, &e, &decimals)), } .unwrap_or_else(|| I256::from_i128(env, 0)); aggregated_result.set(user, res);