Description
Integrators need a single-call read that returns each holder's currently-owed dividend balance across all periods. This query walks the accrual ledger and returns a consolidated amount.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/test_accrual_ledger.rs, src/lib.rs
- Query must be pure and bounded per-holder to avoid unbounded gas
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/accrual-snapshot-query
- Implement changes
- Add
get_holder_accrued_unclaimed(offering_id, holder) returning i128
- Sum entries from
AccrualLedger since last claim checkpoint
- Emit read-only tracing when a debug flag is set
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Holder with zero shares and holder never having claimed
- Include test output and security notes
Example commit message
feat: add per-holder accrual snapshot query
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Integrators need a single-call read that returns each holder's currently-owed dividend balance across all periods. This query walks the accrual ledger and returns a consolidated amount.
Requirements and context
src/test_accrual_ledger.rs,src/lib.rsSuggested execution
git checkout -b feat/accrual-snapshot-queryget_holder_accrued_unclaimed(offering_id, holder)returning i128AccrualLedgersince last claim checkpointTest and commit
cargo test --allExample commit message
feat: add per-holder accrual snapshot queryGuidelines