Skip to content

Escrow accounting and projection ​

Use the agreement guide for the workflow. This page records the developer contract at source 04a18763; it does not describe arbitrary historical deployments.

An agreement key is not its full identity

agreementId = keccak256(abi.encode(client, agreementRef))

Include chain ID and escrow address when storing an external identity. The hash identifies the client's exact reference on that contract, not all agreement terms. A completed reference is not reusable.

Each terms, submission or dispute reference is { string uri; bytes32 sha256Digest; }. The digest commits to exact content bytes; the URI is a retrieval hint. The contract neither fetches nor canonicalizes content. Use document preparation for current hashing transports and bounds.

Value changes category before it leaves the contract

text
Creation (amount > 0, msg.value == amount):
  totalEscrowed += amount

Terminal settlement:
  totalEscrowed -= amount
  withdrawable[beneficiary] += amount
  totalWithdrawable += amount

Successful withdrawal:
  withdrawable[caller] = 0
  totalWithdrawable -= caller's complete credit
  send that credit to the chosen recipient

The public liability surface exposes withdrawable(account), totalEscrowed(), totalWithdrawable() and totalLiabilities(). Solvency requires totalLiabilities() <= address(escrow).balance. Forced surplus is inert: there is no owner or sweep path.

withdrawTo is the sole native-value send path, using checks-effects-interactions and a reentrancy guard. Credit aggregates across agreements on this contract. Only its owner can withdraw the complete current credit; viewing it grants no authority. A rejected transfer reverts and preserves credit. Direct transfers and unknown selectors revert.

The core owns action availability

Ordinary actions require block.timestamp < deadline; timeout actions require block.timestamp >= deadline. Active agreements have one deadline, while terminal and absent observations have zero. Time passing alone executes no transition.

The same core predicate drives availableActions() and write authorization. Acceptance requires no arbitrator acknowledgement; the contract stores or emits none. Changing that policy would require a different deployment/model, not a new label.

The creation-time arbitration fallback chooses Client or Contractor. The in-range None sentinel is rejected; out-of-range enum encodings fail at the ABI boundary. Every settlement awards the whole amount to one beneficiary: no split, residual liability, appeal, amendment, deadline extension or resubmission exists.

A read-only application model, not a generic protocol machine

CamEscrowUI has immutable backing verified for code and the ICamEscrowView ERC-165 interface. It has no owner, roles, write forwarding or native-value path. It returns the core agreement view unchanged alongside:

machine: escrow.agreement.v1
instance: agreement ID
instantiated flag, stable state ID and actor-role ID
core-enabled transitions mapped in their existing order
arbitration-timeout beneficiary
arbitrator acknowledgement: neither required nor recorded

The projection does not recalculate permissions or timeouts. Creation is a factory action; withdrawal is an account-credit action. Neither is an agreement-machine transition. This application-specific model does not add a generic CAM machine resource or change the current CAM 1.4.0/UI 1.1.0 vocabulary.

Arguments and continuations have separate jobs

Creation supplies one nested params value. $inputs.params.amount owns both the Solidity amount and the transaction's native value. Successful creation continues by client/reference lookup; stored transitions return to agreement(agreementId); withdrawal returns to the caller's credit view.

Unavailable actions and their fields can remain visible but disabled. The contract still checks actual sender, state and deadline during execution. Source-backed examples belong to the authoring guide; campaign entrypoints belong to app checks.

Authorities: core, projection, and manifest.