From 9f83b2197dac271c9a5276cbf3d0c9dbb72a63c6 Mon Sep 17 00:00:00 2001 From: hydropump3 Date: Fri, 2 Feb 2024 19:00:16 -0500 Subject: [PATCH] feat: virtual shares in rebase impl --- packages/math/src/traits/rebase.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/math/src/traits/rebase.rs b/packages/math/src/traits/rebase.rs index f836561..228ca35 100644 --- a/packages/math/src/traits/rebase.rs +++ b/packages/math/src/traits/rebase.rs @@ -21,8 +21,8 @@ pub trait Rebase { let mut base; // Use virtual offset approach in YieldBox to enforce a base conversion rate. - // Because we want to support at most 18 decimal fixed point math, we set the ratio to 1 : 1e18. - let total_shares = self.base() + exp10(18); + // Because we want to support at most 18 decimal fixed point math, we set the ratio to 1 : 1e19. + let total_shares = self.base() + exp10(19); let total_amount = self.elastic() + U256::ONE; base = muldiv(elastic, total_shares, total_amount)?; @@ -38,8 +38,8 @@ pub trait Rebase { let mut elastic; // Use virtual offset approach in YieldBox to enforce a base conversion rate. - // Because we want to support at most 18 decimal fixed point math, we set the ratio to 1 : 1e18. - let total_shares = self.base() + exp10(18); + // Because we want to support at most 18 decimal fixed point math, we set the ratio to 1 : 1e19. + let total_shares = self.base() + exp10(19); let total_amount = self.elastic() + U256::ONE; elastic = muldiv(base, total_amount, total_shares)?;