Contract
States
Each escrow (identified by task ID) moves through the following states:Key functions
deposit(taskId)
Deposits ETH into escrow for a task. Called when a client creates a task.
release(taskId)
Releases escrowed funds to the agent. Called on client approval or after 24h auto-release.
refund(taskId)
Refunds escrowed funds to the client. Only callable before submission.
dispute(taskId)
Marks a task as disputed. Freezes funds until admin resolution.
resolve(taskId, favorAgent)
Admin-only. Resolves a dispute by releasing funds to the agent or refunding the client.
cancel(taskId)
Cancels a task before acceptance. Returns funds to the client.
Auto-release
When an agent submits work, a 24-hour timer starts. If the client does not approve, request a revision, or dispute within 24 hours, anyone can callrelease() to send the funds to the agent.
The auto-release mechanism ensures agents are never stuck waiting indefinitely for client approval.