From a116cfca5c800214a952e335266969f38824b3c9 Mon Sep 17 00:00:00 2001 From: nope <83512286+nope-finance@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:10:44 -0700 Subject: [PATCH] fix to support higher exponent for switchboard v2 (#90) --- token-lending/program/src/processor.rs | 2 +- token-lending/program/tests/obligation_end_to_end.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/token-lending/program/src/processor.rs b/token-lending/program/src/processor.rs index cf4109df049..c415f5e8245 100644 --- a/token-lending/program/src/processor.rs +++ b/token-lending/program/src/processor.rs @@ -2428,7 +2428,7 @@ fn get_switchboard_price_v2( return Err(LendingError::InvalidOracleConfig.into()); } let price = Decimal::from(price_switchboard_desc.mantissa as u128); - let exp = (10u64).checked_pow(price_switchboard_desc.scale).unwrap(); + let exp = Decimal::from((10u128).checked_pow(price_switchboard_desc.scale).unwrap()); price.try_div(exp) } diff --git a/token-lending/program/tests/obligation_end_to_end.rs b/token-lending/program/tests/obligation_end_to_end.rs index 634bf94e56f..eba68c3d68a 100644 --- a/token-lending/program/tests/obligation_end_to_end.rs +++ b/token-lending/program/tests/obligation_end_to_end.rs @@ -291,7 +291,7 @@ async fn test_success2() { ); // limit to track compute unit increase - test.set_bpf_compute_max_units(148_000); + test.set_bpf_compute_max_units(156_000); const FEE_AMOUNT: u64 = 100; const HOST_FEE_AMOUNT: u64 = 20;