Skip to content

fix(split): resolve issues #611 #612 #613 #614 - #659

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
Chronos-III:feature/issues-611-612-613-614
Aug 29, 2026
Merged

fix(split): resolve issues #611 #612 #613 #614#659
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
Chronos-III:feature/issues-611-612-613-614

Conversation

@Chronos-III

Copy link
Copy Markdown
Contributor

Title: fix(split): resolve issues #611 #612 #613 #614

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Description:

This PR addresses four issues from the Drips Wave backlog across contracts/split/src/.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

#613 — Fix duplicate Stats type definition in stats.rs

pub type Stats = (u64, i128, u64); was declared twice (lines 9 and 16), which is a compile error in Rust. Removed
the duplicate and consolidated the file around the cleaner implementation that uses increment, invoice_created,
volume_added, and recipients_paid.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

#611 — Add invoice_id to late_payment_penalty_charged event data

The event already exposed invoice_id as a topic, but data-only decoders had no way to identify the affected
invoice. Updated the data payload from (payer, penalty_amount) to (invoice_id, payer, penalty_amount).

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

#614 — distribute_with_remainder returns Result instead of panicking

Replaced assert! guards with typed error returns:

  • ratios.is_empty() → Err(ContractError::InvalidAmount)
  • denom <= 0 → Err(ContractError::InvalidAmount)

Signature changed to pub fn distribute_with_remainder(...) -> Result<Vec, ContractError>. All existing tests
updated; two new unit tests added (test_empty_ratios_returns_err, test_zero_denom_returns_err) confirming Err is
returned rather than a panic.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

#612 — Add computed score integer to rep_updated event

Indexers previously had to re-implement the score formula off-chain. rep_updated now accepts and emits a
computed_score: u32 alongside the raw RepScore struct.

Score formula (documented inline in events.rs):

base = paid_on_time × 10 + invoices_released × 5
deductions = late_pays × 5 + invoices_refunded × 2
computed = base.saturating_sub(deductions)

Event data changed from score_struct to (score_struct, computed_score). Call site in lib.rs (update_rep_internal)
updated to compute the value with saturating arithmetic before emitting.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Files changed: calc.rs, events.rs, lib.rs, stats.rs
Closes: #611
Closes #612
Closes #613
Closes #614

…r-split#613 Stellar-split#614

- Stellar-split#613: remove duplicate `pub type Stats` declaration from stats.rs
- Stellar-split#611: include invoice_id in late_payment_penalty_charged data payload
- Stellar-split#614: change distribute_with_remainder to return Result<Vec<i128>, ContractError>
- Stellar-split#612: add computed_score u32 to rep_updated event data
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Chronos-III 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

@Kingsman-99
Kingsman-99 merged commit 66db721 into Stellar-split:main Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants