Skip to content

Commit 448483c

Browse files
A1igatorclaude
andauthored
Update protocol and contracts docs to match current state (#14)
## Summary - **Escrow scheme spec rewritten** to align with [coinbase/x402 PR #1425](https://github.com/coinbase/x402/pull/1425) and [issue #1011](https://github.com/coinbase/x402/issues/1011) — adds settlement methods (authorize/charge), nonce derivation, 11-step verification logic, settlement logic, error codes, PaymentInfo struct with all fields, and expiry ordering - **All contract addresses updated** to unified CREATE3 addresses (same on every chain) - **Missing contracts added**: ArbiterRegistry, RefundRequestEvidence, ReceiverRefundCollector, SignatureCondition/SignatureRefundRequest factories, and all condition/combinator factories - **Supported chains expanded** from 2 (Base + Base Sepolia) to 11 chains - **PaymentInfo struct fixed** in architecture docs (was missing `preApprovalExpiry`, `refundExpiry`, `salt`, had wrong field ordering) - **Payment flow diagrams fixed** to route through operator (not escrow directly) - **Roadmap updated** with escrow scheme spec submission status and multi-chain deployment ## Test plan - [ ] Preview with `npx mint dev` and verify all pages render - [ ] Verify all contract addresses match `@x402r/core` config - [ ] Verify escrow scheme spec matches PR #1425 content - [ ] Check all internal links work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent beaa7f4 commit 448483c

22 files changed

Lines changed: 812 additions & 587 deletions

contracts/architecture.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,18 @@ This example shows marketplace configuration. For subscriptions, you might use `
158158
// PaymentInfo is from base commerce-payments (AuthCaptureEscrow)
159159
// Passed as calldata to operator methods - not stored in operator
160160
struct PaymentInfo {
161-
address payer;
162-
address receiver;
163161
address operator; // The PaymentOperator address
164-
uint256 amount;
165-
address token;
166-
uint48 authorizationExpiry; // When authorization expires
167-
uint16 minFeeBps; // Minimum fee in basis points
168-
uint16 maxFeeBps; // Maximum fee in basis points
162+
address payer; // Client wallet
163+
address receiver; // Fund recipient
164+
address token; // ERC-20 token address
165+
uint120 maxAmount; // Maximum authorized amount
166+
uint48 preApprovalExpiry; // ERC-3009 validBefore / pre-approval deadline
167+
uint48 authorizationExpiry;// Capture deadline (authorize path only)
168+
uint48 refundExpiry; // Refund request deadline
169+
uint16 minFeeBps; // Minimum fee in basis points
170+
uint16 maxFeeBps; // Maximum fee in basis points
169171
address feeReceiver; // Who receives fees (operator itself)
172+
uint256 salt; // Client-provided entropy
170173
}
171174
```
172175

@@ -306,8 +309,8 @@ These events enable off-chain monitoring and indexing.
306309
## Next Steps
307310

308311
<CardGroup cols={2}>
309-
<Card title="Core Contracts" icon="file-contract" href="/contracts/core-contracts">
310-
Learn about individual contract implementations.
312+
<Card title="PaymentOperator" icon="file-contract" href="/contracts/payment-operator">
313+
Learn about the core operator contract.
311314
</Card>
312315
<Card title="Conditions" icon="filter" href="/contracts/conditions/overview">
313316
Explore the condition system and combinators.

contracts/examples.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ Keep records of deployed configurations:
851851
## Next Steps
852852

853853
<CardGroup cols={2}>
854-
<Card title="Core Contracts" icon="file-contract" href="/contracts/core-contracts">
854+
<Card title="PaymentOperator" icon="file-contract" href="/contracts/payment-operator">
855855
Review contract methods and security features.
856856
</Card>
857857
<Card title="Conditions" icon="filter" href="/contracts/conditions/overview">

contracts/factories.mdx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Deploys PaymentOperator instances with deterministic addresses.
4646

4747
### Contract Address
4848

49-
**Base Sepolia:** `0xe01CEd771A30A23a7A4C9c1db604C74D4Dc4ebe8`
49+
All factories use unified CREATE3 addresses (same on every chain).
5050

51-
**Base Mainnet:** `0xA50F51254E8B08899EdB76Bd24b4DC6A61ba7dE7`
51+
**PaymentOperatorFactory:** `0x4D9BC2Ba2D0d9AFb6B63E3afBbfC95143E6E8Da9`
5252

5353
### Configuration Structure
5454

@@ -208,9 +208,7 @@ Deploys `EscrowPeriod` contracts - combined recorder and condition for time-base
208208

209209
### Contract Address
210210

211-
**Base Sepolia:** `0x206D4DbB6E7b876e4B5EFAAD2a04e7d7813FB6ba`
212-
213-
**Base Mainnet:** `0x2714EA3e839Ac50F52B2e2a5788F614cACeE5316`
211+
**EscrowPeriodFactory:** `0x15DB06aADEB3a39D47756Bf864a173cc48bafe24`
214212

215213
### Deployment Method
216214

@@ -299,8 +297,7 @@ Deploys `Freeze` condition contracts that block release when a payment is frozen
299297

300298
### Contract Address
301299

302-
**Base Sepolia:** `0x199fed16577773Bb6b2D76CC3cD1c76c22D28835`
303-
**Base Mainnet:** `0xCAEd9474c06bf9139AC36C874dED838e1Bcb9310`
300+
**FreezeFactory:** `0xdf129EFFE040c3403aca597c0F0bb704859a78Fd`
304301

305302
### Deployment Method
306303

@@ -355,11 +352,11 @@ const config = {
355352

356353
Use these pre-deployed condition contracts:
357354

358-
| Condition | Address (Base Sepolia) | Address (Base Mainnet) | Description |
359-
|-----------|------------------------|------------------------|-------------|
360-
| PayerCondition | `0xBAF68176FF94CAdD403EF7FbB776bbca548AC09D` | `0xb33D6502EdBbC47201cd1E53C49d703EC0a660b8` | Only payer can call |
361-
| ReceiverCondition | `0x12EDefd4549c53497689067f165c0f101796Eb6D` | `0xed02d3E5167BCc9582D851885A89b050AB816a56` | Only receiver can call |
362-
| AlwaysTrueCondition | `0x785cC83DEa3d46D5509f3bf7496EAb26D42EE610` | `0xc9BbA6A2CF9838e7Dd8c19BC8B3BAC620B9D8178` | Anyone can call |
355+
| Condition | Address (all chains) | Description |
356+
|-----------|---------------------|-------------|
357+
| PayerCondition | `0x33F5F1154A02d0839266EFd23Fd3b85a3505bB4B` | Only payer can call |
358+
| ReceiverCondition | `0xF41974A853940Ff4c18d46B6565f973c1180E171` | Only receiver can call |
359+
| AlwaysTrueCondition | `0xb295df7E7f786fd84D614AB26b1f2e86026C3483` | Anyone can call |
363360

364361
### Example Deployments
365362

contracts/fees.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ The operator's `FEE_RECIPIENT` varies by use case:
234234
## Next Steps
235235

236236
<CardGroup cols={2}>
237-
<Card title="Core Contracts" icon="file-contract" href="/contracts/core-contracts">
237+
<Card title="PaymentOperator" icon="file-contract" href="/contracts/payment-operator">
238238
See how fees integrate with PaymentOperator.
239239
</Card>
240240
<Card title="Factories" icon="industry" href="/contracts/factories">

contracts/gas-costs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ icon: "gas-pump"
66

77
## Overview
88

9-
x402r adds escrow, refund windows, and dispute resolution on top of [Base Commerce Payments](https://github.com/base/commerce-payments). Here you'll find the **measured gas cost** of every on-chain operation so you can evaluate the overhead.
9+
x402r adds escrow, refund windows, and dispute resolution on top of the [Commerce Payments Protocol](https://github.com/base/commerce-payments). Here you'll find the **measured gas cost** of every on-chain operation so you can evaluate the overhead.
1010

1111
All numbers are from Foundry simulations (`forge test`) with optimizer enabled (200 runs, via IR). The benchmark test is at [`test/gas/GasBenchmark.t.sol`](https://github.com/BackTrackCo/x402r-contracts/blob/main/test/gas/GasBenchmark.t.sol).
1212

contracts/overview.mdx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,25 @@ x402r extends commerce-payments with flexible payment capabilities:
106106
- MEV protection via private mempool support
107107
- Composable via `AndCondition([escrowPeriod, freeze])`
108108

109-
### 4. Factory Pattern
109+
### 4. Arbiter & Evidence System
110110

111-
**PaymentOperatorFactory** - Deploys operators with deterministic CREATE2 addresses
111+
**RefundRequestEvidence** - On-chain evidence submission with IPFS CIDs and arbiter EIP-712 signature approval
112+
113+
### 5. Factory Pattern
114+
115+
**PaymentOperatorFactory** - Deploys operators with deterministic CREATE3 addresses
112116

113117
**EscrowPeriodFactory** - Deploys EscrowPeriod contracts
114118

115119
**FreezeFactory** - Deploys Freeze condition contracts
116120

121+
Plus factories for: StaticFeeCalculator, StaticAddressCondition, AndCondition, OrCondition, NotCondition, RecorderCombinator.
122+
123+
All factories use **unified CREATE3 addresses** — same address on every supported chain.
124+
117125
**Benefits:**
118126
- Predictable addresses for off-chain address generation
127+
- Cross-chain address consistency (same config = same address on every chain)
119128
- Shared configuration reduces deployment costs
120129
- Idempotent deployments (same config = same address)
121130
- Owner controls all deployed instances via factory
@@ -126,11 +135,12 @@ x402r extends commerce-payments with flexible payment capabilities:
126135
|---------|------------------|-------|
127136
| **Refunds** | Manual void/reclaim | Structured refund requests with configurable approval |
128137
| **Escrow Period** | Not enforced | Configurable time-lock before release |
129-
| **Dispute Resolution** | Not built-in | Optional arbiter workflow via conditions |
130-
| **Authorization** | Operator-based only | Pluggable conditions (access, time, combinators) |
138+
| **Dispute Resolution** | Not built-in | Arbiter workflow via conditions, signatures, and evidence |
139+
| **Authorization** | Operator-based only | Pluggable conditions (access, time, signature, combinators) |
131140
| **Freeze Mechanism** | Not available | Configurable freeze during escrow period |
132-
| **Deployment** | Direct deployment | Factory pattern with CREATE2 |
133-
| **Fees** | Not enforced | Configurable protocol and operator fees |
141+
| **Deployment** | Direct deployment | Factory pattern with unified CREATE3 (same address every chain) |
142+
| **Fees** | Not enforced | Additive protocol + operator fees with 7-day timelock |
143+
| **Multi-chain** | Per-chain deployment | Unified CREATE3 addresses across 11 chains |
134144

135145
## Use Cases
136146

@@ -184,7 +194,7 @@ Protocol fee configuration is mutable via `ProtocolFeeConfig` (with 7-day timelo
184194

185195
For a detailed view of how all contracts interact, see [Architecture](/contracts/architecture).
186196

187-
To understand individual contracts, see [Core Contracts](/contracts/core-contracts).
197+
To understand the core operator, see [PaymentOperator](/contracts/payment-operator). For supporting contracts, see [Periphery](/contracts/periphery/overview).
188198

189199
For factory deployment patterns, see [Factories](/contracts/factories).
190200

@@ -194,8 +204,8 @@ For factory deployment patterns, see [Factories](/contracts/factories).
194204
<Card title="Architecture" icon="diagram-project" href="/contracts/architecture">
195205
View system architecture diagrams and payment flows.
196206
</Card>
197-
<Card title="Core Contracts" icon="file-contract" href="/contracts/core-contracts">
198-
Learn about PaymentOperator, RefundRequest, and other core contracts.
207+
<Card title="PaymentOperator" icon="file-contract" href="/contracts/payment-operator">
208+
Learn about the core operator contract.
199209
</Card>
200210
<Card title="Deploy an Operator" icon="rocket" href="/sdk/deploy-operator">
201211
Deploy a PaymentOperator using the SDK.

0 commit comments

Comments
 (0)