Skip to content

Introduction ​

Escrow exists to reduce one germane problem in digital commerce: one party wants assurance that payment exists, while the other wants assurance that payment will not disappear after the work is delivered.

The ERC-20 Escrow contract addresses that problem with a small, explicit state machine.

A client creates an escrow for a freelancer, specifies an ERC-20 token, an amount, and a duration, then funds the contract. The freelancer marks the work as delivered. The client approves the work, after which the contract credits the freelancer and the platform with withdrawable balances.

If the deadline passes while the escrow is still Funded, the client can recover the escrowed tokens.

Project note: The documentation describes the current implementation in contracts/Escrow.sol. It does not present the contract as audited or production-ready.

What the contract handles ​

The contract currently handles:

  • ERC-20 denominated escrows;
  • client and freelancer role checks;
  • escrow lifecycle enforcement;
  • platform fees expressed in basis points;
  • pull-based withdrawals after approval;
  • deadline-based refunds before delivery;
  • custom errors;
  • lifecycle events;
  • read functions for escrow records and balances.

What the contract does not handle ​

The current implementation does not provide arbitration, dispute resolution, milestone payments, partial funding, partial release, cancellation before funding, a client timeout after delivery, upgradeability, pausing, or an on-chain supported-token registry.

These are not hidden omissions. They define the contemporary boundary of the implementation and are documented deliberately.

Contract files ​

The source repository contains the principal Solidity implementation in:

text
contracts/Escrow.sol

The file defines IERC20, FeeLibrary, EscrowContract, and MockToken.

The MockToken contract is suitable for demonstration and local testing. It should not be treated as a production token implementation.

Next step ​

Read Architecture before using the function reference.

Documentation grounded in the current ERC-20 escrow implementation.