feat(escrow): add escrow top-up support for existing jobs (Closes #533) - #666
Open
bethel4455 wants to merge 4 commits into
Open
feat(escrow): add escrow top-up support for existing jobs (Closes #533)#666bethel4455 wants to merge 4 commits into
bethel4455 wants to merge 4 commits into
Conversation
Restore a coherent escrow lib and add top_up_escrow with auth/status checks, EscrowToppedUp events, unit tests, and client Add Funds UI so budgets can increase without canceling jobs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@bethel4455 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! 🚀 |
Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
@bethel4455 please resolve conflicts |
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
This PR introduces escrow top-up functionality, allowing clients to add additional funds to an existing job without canceling and recreating it. This enables budget increases for scope changes, bonuses, and other post-creation adjustments while preserving the existing client–freelancer relationship.
What was implemented
Added a top_up_escrow(client, job_id, additional_amount) contract function.
Transfers the specified additional_amount from the client into the escrow contract.
Updates the job's escrow amount by adding the new funds to the existing balance.
Restricts top-ups to jobs in eligible states:
Open
InProgress
SubmittedForReview
Enforces authorization so only the original job owner (client) can perform escrow top-ups.
Emits an EscrowToppedUp event containing:
job_id
old_amount
new_amount
Updated get_job to return the latest escrow balance after top-ups.
Frontend Updates
Added an "Add Funds" action to the job details page for eligible clients.
Implemented a confirmation dialog displaying:
Current escrow amount
Additional amount being added
Updated total escrow amount before confirmation
Testing
Added unit tests covering:
Successful escrow top-up flow.
Authorization checks for non-owners.
Invalid job status restrictions.
Escrow balance updates after multiple top-ups.
Event emission and state persistence.
Edge cases and invalid input validation.
Benefits
Eliminates the need to cancel and recreate jobs when increasing project budgets.
Supports bonuses and scope expansion without disrupting ongoing work.
Preserves the existing escrow workflow while maintaining secure authorization and event tracking.
Closes #533