feat: escrow partial release, portfolio analytics, team collaboration, review moderation (#601-604) - #695
Open
a-malik-gh wants to merge 2 commits into
Open
Conversation
…laboration, and review moderation Closes Dfunder#601 – Implement Escrow Partial Release for Milestone-Based Work Closes Dfunder#602 – Implement Portfolio Analytics Contract Closes Dfunder#603 – Implement Team Collaboration Features Closes Dfunder#604 – Add Review Moderation & Appeal System ## Dfunder#601 – Escrow Partial Release - Add `partial_release` to EscrowContract: supports percentage or fixed amount releases from Locked/PartiallyReleased escrows with overflow-safe fee split (fee_bps) and CEI ordering under reentrancy guard - Add `auto_release_on_deadline`: releases remaining balance to artist when ledger sequence >= auto_release_ledger - Add `PartiallyReleased` status to CommissionStatus enum with discriminant 5 - Add `released_amount` field to EscrowRecord (tracks cumulative releases) - Transitions to Released automatically when released_amount == amount - Tests: state machine transitions, fee split math, deadline guard, boundary values (storage_edge_tests.rs + tests.rs) ## Dfunder#602 – Portfolio Analytics Contract - New contracts/analytics/ package with full Soroban contract - record_earning: tracks earnings by category + client, increments completed_count, appends EarningsRecord log with pagination support - record_cancellation: increments cancelled_count for completion rate - record_response_time: rolling sum for average response time analytics - record_satisfaction: score_x10 (10-50 range) rolling average - predict_earnings: mean payout per commission (rolling average) - get_metrics, get_completion_rate, get_avg_response_time, get_avg_satisfaction, get_earning, get_earning_count - Admin-only write operations, ANALYTICS_TTL_LEDGERS (~90 days) TTL ## Dfunder#603 – Team Collaboration - invite_team_member: role-based (Lead/Contributor/Viewer), payment_share_bps validation (0-10000 bps cumulative cap), max 10 members, dedup - accept_team_invitation / decline_team_invitation: only the invited member can change their Pending status - update_contribution_note: member or lead artist can update - get_team_members: returns Vec<TeamMember> for a commission - New types: TeamRole, InvitationStatus, TeamMember - New errors: MemberAlreadyExists, PaymentShareExceeded, InvalidInvitationStatus, TeamSizeLimit ## Dfunder#604 – Review Moderation & Appeal System - New contracts/reputation/ package with full Soroban contract - submit_review: rating_x10 (10-50), dedup by review_id, reviewer auth - report_review: reason enum (Spam/Abuse/Misleading/Other), dedup by reporter+review_id, transitions review to UnderReview, adds to queue - moderate_review: admin-only, sets Removed/Cleared, appends ModerationRecord history, maintains queue size counter - file_appeal: only artist or original reviewer, one appeal per review, only on Removed reviews - resolve_appeal: Upheld reinstates review to Active; Denied leaves Removed - escalate_appeal: marks appeal Escalated for external dispute arbiter ## Fixes - Remove 3 unnecessary `mut` bindings in commission_agreement/lib.rs - Wrap escrow integration_tests under #[cfg(test)] - Add #[allow(dead_code)] on get_suggestion helpers (public API, used by SDK/frontend consumers)
|
@a-malik-gh 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.
Summary
This PR implements all four issues assigned to a-malik-gh.
Closes #601
Closes #602
Closes #603
Closes #604
#601 – Escrow Partial Release for Milestone-Based Work
Files:
contracts/escrow/src/lib.rs,contracts/escrow/src/storage.rs,contracts/escrow/src/tests.rs,contracts/escrow/src/storage_edge_tests.rspartial_release(commission_id, release_amount, config_contract): releases a fixed amount from aLockedorPartiallyReleasedescrow to the artist (minus platform fee split). Transitions toReleasedwhen the full amount has been paid out.auto_release_on_deadline(commission_id, auto_release_ledger, config_contract): releases the remaining balance automatically once the ledger sequence meets or exceedsauto_release_ledger.PartiallyReleased = 5variant toCommissionStatusenum.released_amount: i128field toEscrowRecordto track cumulative partial releases.checked_add,checked_sub,checked_mul) throughout.#602 – Portfolio Analytics Contract
Files:
contracts/analytics/(new package)record_earning: tracks earnings per category and client, incrementscompleted_count, appends a paginatedEarningsRecord.record_cancellation: incrementscancelled_countfor completion rate calculation.record_response_time: rolling sum for average response-time analytics.record_satisfaction:score_x10(range 10–50) rolling average for satisfaction trends.predict_earnings: returns mean payout per commission as an earnings forecast.get_metrics,get_completion_rate,get_avg_response_time,get_avg_satisfaction,get_earning,get_earning_count.ANALYTICS_TTL_LEDGERS).#603 – Team Collaboration Features
Files:
contracts/commission_agreement/src/lib.rs,contracts/commission_agreement/src/types.rs,contracts/commission_agreement/src/errors.rs,contracts/commission_agreement/src/test.rsinvite_team_member: lead artist invites members withTeamRole(Lead/Contributor/Viewer),payment_share_bps(cumulative cap at 10 000 bps), dedup, max 10 members.accept_team_invitation/decline_team_invitation: only the invited member can act on their ownPendinginvitation.update_contribution_note: member or lead artist can update the contribution description.get_team_members: returns the full team list for a commission.TeamRole,InvitationStatus,TeamMember.MemberAlreadyExists,PaymentShareExceeded,InvalidInvitationStatus,TeamSizeLimit.#604 – Review Moderation & Appeal System
Files:
contracts/reputation/(new package)submit_review:rating_x10range 10–50, dedup byreview_id, reviewer auth required.report_review: reason enum (Spam/Abuse/Misleading/Other), dedup by reporter+review_id, transitions review →UnderReview, adds to admin moderation queue.moderate_review: admin-only, setsRemovedorCleared, appends aModerationRecordto decision history.file_appeal: only the affected artist or original reviewer may appeal aRemovedreview; one appeal per review enforced.resolve_appeal:Upheldreinstates the review toActive;Deniedleaves itRemoved.escalate_appeal: marks appealEscalatedfor the external dispute arbiter.Code Quality
cargo buildmutbindings incommission_agreement/lib.rsescrow/integration_testsunder#[cfg(test)]#[allow(dead_code)]onget_suggestionhelpers (public introspection API, consumed by SDK/frontend)Testing
cargo buildpasses cleanly. Unit tests are written and structured for all four contracts. Thecargo testrunner is blocked environment-wide by a pre-existinged25519-dalekversion conflict insoroban-env-host(not introduced by this PR — affects all packages in the workspace equally).