Skip to content

feat: switch accrual to e18 fixed-point for tighter rounding#497

Open
ayo-ola0710 wants to merge 1 commit into
RevoraOrg:masterfrom
ayo-ola0710:feat/e18-accrual-fixed-point
Open

feat: switch accrual to e18 fixed-point for tighter rounding#497
ayo-ola0710 wants to merge 1 commit into
RevoraOrg:masterfrom
ayo-ola0710:feat/e18-accrual-fixed-point

Conversation

@ayo-ola0710

Copy link
Copy Markdown

What was done

In this implementation, we replaced the previous per-period BPS-based accrual method with an e18 fixed-point accrual index to eliminate cumulative rounding dust. We added an E18 constant for high-precision arithmetic, introduced new storage keys (AccrualIndexE18 for per-offering index tracking and LastClaimedAccrualIndex for per-holder last-claimed index), updated do_deposit_revenue to calculate and update the accrual index on each revenue deposit, modified set_holder_share_internal to set a holder’s last-claimed index to the current accrual index (ensuring they only earn on future deposits), and rewrote the claim function to use the accrual index to calculate total payouts instead of per-period calculations, all while maintaining existing invariants and using checked_mul/checked_div for secure arithmetic.

Close #479

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@ayo-ola0710 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add fixed-point e18 accrual representation for share-conserving rounding across reports

1 participant