Skip to content

Onchain authorization and capture for trust-minimized commerce.

License

Notifications You must be signed in to change notification settings

AgentaOS/commerce-payments

 
 

Repository files navigation

    •  •  •
      ╱╲
     ╱  ╲
    ╱ ╱╲ ╲
   ╱_╱  ╲_╲

Agentokratia Settlement Protocol

A permissionless protocol for onchain payments that mimics traditional "authorize and capture" payment flows. Built on top of the Commerce Payments Protocol by Coinbase.

Quick Start

The Agentokratia Settlement Protocol facilitates secure escrow-based payments with flexible authorization and capture patterns. Operators drive payment flows using modular token collectors while the protocol ensures payer and merchant protections.

Read the Full Documentation

Key Features

  • Two-Phase Payments: Separate authorization and capture for guaranteed merchant payments and management of real-world complexity
  • Flexible Fee Structure: Configurable fee rates and recipients within predefined ranges
  • Modular Token Collection: Support for multiple authorization methods (ERC-3009, Permit2, cross-token swaps)
  • Cross-Token Payments: SwapCollector enables paying with any whitelisted token via DEX aggregator swaps
  • Built-in Protections: Time-based expiries, amount limits, and reclaim mechanisms
  • Operator Model: Permissionless operators manage payment flows while remaining trust-minimized

Deployed Contracts

The protocol deploys 4 contracts:

Contract Purpose
AuthCaptureEscrow Core escrow engine managing the full payment lifecycle
ERC3009PaymentCollector USDC gasless payments via receiveWithAuthorization signatures
Permit2PaymentCollector Same-token payments for any ERC-20 via Permit2 signatures
SwapCollector Cross-token payments via whitelisted DEX aggregator swaps

Documentation

  • Protocol Overview - Architecture, components, and payment lifecycle
  • Security Analysis - Security features, risk assessment, and mitigation strategies
  • Token Collectors Guide - Modular payment authorization methods
  • Fee System - Comprehensive fee mechanics and examples
  • Core Operations:
    • Authorize - Reserve funds for future capture
    • Capture - Transfer authorized funds to merchants
    • Charge - Immediate authorization and capture
    • Void - Cancel authorizations (operator)
    • Reclaim - Recover expired authorizations (payer)
    • Refund - Return captured funds to payers

Development

# Install dependencies
forge install

# Run tests
forge test

# Deploy
SWAP_COLLECTOR_OWNER=<addr> forge script script/Deploy.s.sol \
  --rpc-url $RPC_URL --broadcast --verify

License

MIT License - see LICENSE file for details.

Security Audits

The underlying Commerce Payments Protocol has been audited by Spearbit and Coinbase Protocol Security.

Audit Date Report
Coinbase Protocol Security audit 1 03/19/2025 Report
Coinbase Protocol Security audit 2 03/26/2025 Report
Spearbit audit 1 04/01/2025 Report
Coinbase Protocol Security audit 3 04/15/2025 Report
Spearbit audit 2 04/22/2025 Report

About

Onchain authorization and capture for trust-minimized commerce.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Solidity 100.0%