Skip to content

compu-TEE/Escrow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🧾 Escrow Smart Contract

A secure, milestone-based Escrow system between a Client, Freelancer, and Admin, written in Solidity. It ensures safe payments, dispute resolution, and automated refunds β€” ideal for freelance or gig-based work.

βš™οΈ Features

πŸͺ™ Milestone-based payments β€” funds released only after approval

πŸ”’ Reentrancy protection and role-based access

πŸ•’ Auto-refund after deadline if work isn’t completed

βš–οΈ Admin dispute resolution with a configurable fee

🧾 Progress tracking via milestones and completion %

πŸ”„ State Transition Diagram

           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚  CREATED   β”‚
           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β”‚ addMilestones() + deposit()
                  β–Ό
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚   FUNDED   β”‚
           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β”‚ startWork()
                  β–Ό
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚  IN_PROGRESS   β”‚
           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
                  β”‚    β”‚
                  β”‚    └────────── raiseDispute() ──────────────┐
                  β”‚                                              β”‚
                  β–Ό                                              β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
        β”‚  AWAITING_APPROVAL   β”‚                                 β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
                   β”‚ approveMilestone()                          β”‚
                   β–Ό                                              β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚ COMPLETED  │◄────────── resolveDispute() β”‚ DISPUTED   β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–²
                  β”‚ triggerAutoRefund()
                  β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚  REFUNDED  β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Other transitions:

  • cancel() β†’ CANCELLED
  • resolveDispute() decides between COMPLETED or REFUNDED

πŸš€ Basic Flow

Client deploys contract with freelancer, admin, fee %, and duration

Client adds milestones β†’ addMilestone()

Client deposits total β†’ deposit()

Freelancer starts and completes milestones β†’ completeMilestone(id)

Client approves β†’ approveMilestone(id) β†’ payment auto-released

If dispute β†’ raiseDispute() β†’ admin resolves with resolveDispute()

If deadline passes β†’ triggerAutoRefund()

πŸ”§ Deployment (Remix)

Compiler: Solidity ^0.8.0 Deploy with:

constructor(address _freelancer, address _admin, uint _adminFeePercent, uint _durationDays)

πŸ“œ License SPDX-License-Identifier: MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors