[BUG] Precision Issue in calculate_propotional_apy
Function
#912
Labels
bug 🪲
Something isn't working
calculate_propotional_apy
Function
#912
We have identified a precision issue in the
calculate_propotional_apy
function within therewards.rs
file. The function currently uses thePercent
type for calculations, which leads to unexpected results due to its whole number representation.Problem
When calculating the proportional APY, multiplying two
Percent
values (e.g.,10%
and2%
) results in0%
due to rounding down to the nearest whole percentage. This is causing inaccuracies in the APY calculations.Steps to Reproduce:
calculate_propotional_apy
function withtotal_deposit
anddeposit_cap
such that thepropotion
is10%
.original_apy
of2%
.0%
.Expected Behavior:
The function should return a more precise APY value, reflecting the actual multiplication result (e.g.,
0.2%
).Impact
This issue affects the accuracy of APY calculations, potentially leading to incorrect reward distributions.
Screenshot
Screenshots of the test I conducted to verify the results of the
calculate_proportional_apy
function.The text was updated successfully, but these errors were encountered: