Implement resolve_dispute with Agent Judge authorization - #64
Merged
soomtochukwu merged 1 commit intoMar 29, 2026
Merged
Conversation
- Add AgentJudge data key to store designated judge address - Modify initialize function to accept agent_judge parameter - Add set_agent_judge function for updating judge address - Modify resolve_dispute to accept explicit amounts (payee_amount, payer_amount) - Add validation to ensure sum of amounts equals or is less than remaining funds - Update authorization to use agent_judge instead of admin - Update all tests to use new function signatures - Add new tests for set_agent_judge and payout validation
|
@samjay8 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.
Closes #17
⚖️ Feature:
resolve_disputewith Agent Judge AuthorizationImplements secure dispute resolution in the escrow contract, restricting finalization to a designated Agent Judge with explicit fund routing to both parties.
Changes (
contracts/escrow/src/lib.rs)AgentJudgestorage key — designates a judge address separately from admininitialize()— now acceptsagent_judgeparameter to set the judge at deploymentset_agent_judge()— allows admin to update the Agent Judge addressresolve_dispute()— updated to accept explicitpayee_amountandpayer_amountinstead of BPS percentages; validatespayee_amount + payer_amount <= remaining_funds; authorized byagent_judgeonlyset_agent_judgeand payout validationAcceptance Criteria
✅ Only the authenticated Agent Judge can finalize a dispute
✅ Split amounts accurately routed to both parties based on verdict
✅ Escrow status updated post-resolution and cannot be re-disputed