@x402r/core package includes deployment utilities that handle the full lifecycle of deploying a PaymentOperator and all its supporting contracts.
Run the example on GitHub
Clone the deploy-operator example and deploy your own operator in minutes.
Overview
A complete marketplace operator deployment includes:- EscrowPeriod — Records authorization time, enforces waiting period before release
- Freeze — Allows payer to freeze payment during escrow, receiver to unfreeze
- StaticAddressCondition — Restricts refund approval to the designated arbiter
- OrCondition — Allows either the receiver OR the arbiter to approve in-escrow refunds
- StaticFeeCalculator — Optional operator fee (basis points)
- PaymentOperator — The main contract tying everything together
Deploy Your Operator
Prerequisites:- Node.js 20+, pnpm 9.15+
- A private key with Base Sepolia ETH (get testnet ETH)
Configure your deployment
Copy the example env file and set your private key:Edit
.env with your values. Only PRIVATE_KEY is required — everything else has sensible defaults:| Variable | Default | Description |
|---|---|---|
PRIVATE_KEY | — | Deployer wallet (required) |
ARBITER | deployer address | Dispute resolver |
FEE_RECIPIENT | deployer address | Receives operator fees |
ESCROW_PERIOD | 604800 (7 days) | Escrow period in seconds |
FREEZE_DURATION | 259200 (3 days) | Freeze duration in seconds |
FEE_BPS | 100 (1%) | Operator fee in basis points |
NETWORK_ID | eip155:84532 | Chain identifier |
RPC_URL | https://sepolia.base.org | RPC endpoint |
Using the SDK Directly
If you want to integrate deployment into your own code:Configuration Options
| Option | Type | Description |
|---|---|---|
feeRecipient | Address | Address that receives operator fees |
arbiter | Address | Arbiter address for dispute resolution |
escrowPeriodSeconds | bigint | Escrow waiting period (e.g., 604800n for 7 days) |
freezeDurationSeconds | bigint | How long freezes last. Default: 0n (permanent until unfrozen) |
operatorFeeBps | bigint | Fee in basis points. Default: 0n (no fee). 100n = 1% |
Deployment Result
ThedeployMarketplaceOperator function returns:
Preview Addresses (No Deploy)
You can preview what addresses will be created without actually deploying:Operator Slot Configuration
The deployed operator has the following slot configuration:| Slot | Contract | Purpose |
|---|---|---|
AUTHORIZE_CONDITION | UsdcTvlLimit | Safety limit on authorization |
AUTHORIZE_RECORDER | EscrowPeriod | Records authorization timestamp |
CHARGE_CONDITION | (none) | No restrictions on charge |
RELEASE_CONDITION | EscrowPeriod | Blocks release during escrow period |
REFUND_IN_ESCROW_CONDITION | OR(Receiver, Arbiter) | Receiver or arbiter can approve |
REFUND_POST_ESCROW_CONDITION | Receiver | Only receiver after escrow |
FEE_CALCULATOR | StaticFeeCalculator | Fixed percentage fee |
FEE_RECIPIENT | Your address | Receives fees |
Network Support
Deployment is supported on all configured networks:| Network | Chain ID | EIP-155 ID |
|---|---|---|
| Base Sepolia | 84532 | eip155:84532 |
| Base Mainnet | 8453 | eip155:8453 |
| Ethereum | 1 | eip155:1 |
| Ethereum Sepolia | 11155111 | eip155:11155111 |
| Arbitrum Sepolia | 421614 | eip155:421614 |
| Polygon | 137 | eip155:137 |
| Arbitrum | 42161 | eip155:42161 |
| Optimism | 10 | eip155:10 |
| Avalanche | 43114 | eip155:43114 |
| Celo | 42220 | eip155:42220 |
| Monad | 143 | eip155:143 |
Next Steps
Example on GitHub
Clone and run the deploy-operator example.
Examples
See working merchant and client examples.
Helpers
Mark payment options as refundable with your operator.
Smart Contracts
Understand the underlying contract architecture.
