Roles and permissions
The contract does not maintain a global role registry. Roles are contextual to each escrow.
Client
The caller of createEscrow becomes that escrow's client. Only the client can fund, approve work, and request the implemented refund.
Violations revert with NotClient().
Freelancer
The freelancer address is supplied during creation. Only that address can call deliverWork(id).
Violations revert with NotFreelancer().
Platform wallet
The platform wallet is configured in the constructor. It is not an administrator in the current implementation. It receives an internal balance credit when work is approved and must call withdraw to move accrued fees.
Any account
Any address may create a new escrow. Any address may call withdraw, but the accounting restricts it to:
userBalances[msg.sender][token]This distinction is of utmost importance: the function is public, but the withdrawable balance is caller-specific.
Permission matrix
| Action | Client | Freelancer | Platform wallet | Other account |
|---|---|---|---|---|
| Create a new escrow | Yes | Yes | Yes | Yes |
| Fund a given escrow | Yes | No | No | No |
| Mark delivery | No | Yes | No | No |
| Approve work | Yes | No | No | No |
| Request refund | Yes | No | No | No |
| Withdraw own credited balance | Yes | Yes | Yes | Yes |