fix(pool): round pool repayment interest half-up#579
Conversation
|
Thanks for picking this up, @Dannyswiss1, the core idea is right and the simple interest fix is clean. A few things need to work on to ensure PR is ready. 1. Tests can't run Your own PR description says 2. The factoring-fee test is now a tautology You updated assert_eq!(div_round_half_up(A, B), div_round_half_up(A, B))3. Compound interest rounds twice When The correct approach: accumulate exact intermediate values, then round once on the final result: let interest = total_amount - principal;
div_round_half_up(interest_numerator, denominator)4. No test for compound interest rounding The default config has
5. The if denominator == 0 {
return Err(PoolError::AmountOverflow);
}6. Ensure CI/CD passes |
|
@sanmipaul its all good now, please merge. |
Good work resolving all five issues. LGTM. |
Summary
repay_invoiceinterest rounding policyTests
git diff --checkcargo test -p sharecargo test -p pool(blocked by existing Soroban macro compile failures in the pool crate)Closes #564