Skip to content

Implement resolve_dispute with Agent Judge authorization - #64

Merged
soomtochukwu merged 1 commit into
DXmakers:mainfrom
samjay8:Escrow-Contract-Agent-Judge-Verdict-Execution
Mar 29, 2026
Merged

Implement resolve_dispute with Agent Judge authorization#64
soomtochukwu merged 1 commit into
DXmakers:mainfrom
samjay8:Escrow-Contract-Agent-Judge-Verdict-Execution

Conversation

@samjay8

@samjay8 samjay8 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Closes #17

⚖️ Feature: resolve_dispute with Agent Judge Authorization

Implements 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)

  • AgentJudge storage key — designates a judge address separately from admin
  • initialize() — now accepts agent_judge parameter to set the judge at deployment
  • set_agent_judge() — allows admin to update the Agent Judge address
  • resolve_dispute() — updated to accept explicit payee_amount and payer_amount instead of BPS percentages; validates payee_amount + payer_amount <= remaining_funds; authorized by agent_judge only
  • Tests — all existing tests updated to new signatures; new tests added for set_agent_judge and payout validation

Acceptance 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

- 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
samjay8 requested a review from soomtochukwu as a code owner March 29, 2026 13:36
@drips-wave

drips-wave Bot commented Mar 29, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@soomtochukwu
soomtochukwu merged commit fc90013 into DXmakers:main Mar 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue 6: Escrow Contract - Agent Judge Verdict Execution

2 participants