fix(split): resolve issues #611 #612 #613 #614 - #659
Open
Chronos-III wants to merge 1 commit into
Open
Conversation
…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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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