Skip to content

feat: implement escrow and job registry smart contracts#44

Merged
soomtochukwu merged 1 commit into
DXmakers:mainfrom
playground-ogazboiz:feat/core-contracts
Mar 26, 2026
Merged

feat: implement escrow and job registry smart contracts#44
soomtochukwu merged 1 commit into
DXmakers:mainfrom
playground-ogazboiz:feat/core-contracts

Conversation

@ogazboiz
Copy link
Copy Markdown
Contributor

Summary

Escrow Contract (#1)

  • initialize — persist admin, guard double-init
  • deposit — transfer USDC from client→contract, store EscrowJob
  • release_milestone — proportional release per milestone, handles rounding remainder
  • open_dispute — verify client/freelancer, set Disputed
  • resolve_dispute — admin auth, split remaining by BPS to both parties
  • refund — client auth + Active status, return remaining funds
  • 5 tests: happy path, double-init guard, unauthorized rejection, 50/50 split, refund

Job Registry Contract (#3)

  • post_job — client auth, duplicate job_id guard, store JobRecord + empty bids
  • submit_bid — freelancer auth, verify Open status
  • accept_bid — client auth, set freelancer + InProgress
  • submit_deliverable — freelancer auth, verify InProgress + correct freelancer
  • mark_disputed — no auth (cross-contract), only from InProgress/DeliverableSubmitted
  • 6 tests: full lifecycle, bid on non-Open, mark_disputed from valid/invalid states

Closes #1
Closes #3

Test plan

  • cargo clippy -p escrow -p job_registry -- -D warnings — clean
  • cargo test -p escrow — 5/5 pass
  • cargo test -p job_registry — 6/6 pass
  • CI: lint-contracts job passes

Escrow Contract (DXmakers#1):
- initialize with admin guard against double-init
- deposit transfers USDC from client to contract, stores EscrowJob
- release_milestone with proportional release per milestone
- open_dispute verifies client/freelancer, sets Disputed
- resolve_dispute splits remaining by BPS (admin only)
- refund returns remaining to client (Active status only)
- 5 tests: lifecycle, double-init, unauthorized, 50/50 split, refund

Job Registry Contract (DXmakers#3):
- post_job with client auth, duplicate guard, stores JobRecord
- submit_bid verifies Open status, appends BidRecord
- accept_bid sets freelancer + InProgress
- submit_deliverable verifies InProgress + correct freelancer
- mark_disputed (cross-contract, no auth) only from valid states
- 6 tests: full lifecycle, bid on non-Open, mark_disputed states

Both pass cargo clippy -D warnings.

Closes DXmakers#1
Closes DXmakers#3
@ogazboiz ogazboiz requested a review from soomtochukwu as a code owner March 26, 2026 23:04
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 26, 2026

@ogazboiz 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 02a50ad into DXmakers:main Mar 26, 2026
5 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.

Job Registry Contract Implementation Escrow Contract Implementation

2 participants