Skip to content

feat(commerce-payments): implement core AuthCaptureEscrow, SpendPermissionPaymentCollector and Permit2PaymentCollector contracts for Base - #96

Open
magqqgq wants to merge 1 commit into
base:mainfrom
magqqgq:magqqgq-patch-1
Open

magqqgq wants to merge 1 commit into
base:mainfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Oct 16, 2026

Copy link
Copy Markdown

Description

This pull request introduces the core payment processing and collection architecture for Coinbase's commerce payments suite on Base (AuthCaptureEscrow.sol, SpendPermissionPaymentCollector.sol, TokenCollector.sol, and Permit2PaymentCollector.sol). It enables robust two-step payment escrow workflows (authorization and capture), gasless payments via Permit2, and delegated spending via Spend Permissions and MagicSpend.

Key Features & Security Architecture

  • Escrow & Authorization Flow (AuthCaptureEscrow.sol):

    • Implements a 2-step payment pattern (authorization hold and capture distribution) using Solady's transient reentrancy guard (ReentrancyGuardTransient).
    • Enforces strict expiration checks (preApprovalExpiry, authorizationExpiry, refundExpiry) and fee bounds validation (minFeeBps / maxFeeBps up to 10,000 BPS).
    • Manages isolated operator token stores via deterministic minimal clones (LibClone).
  • Spend Permission Integration (SpendPermissionPaymentCollector.sol):

    • Integrates SpendPermissionManager to pull tokens securely through user-authorized spending limits.
    • Supports optional Spend Permission approval signatures and MagicSpend.WithdrawRequest flows.
  • Permit2 & ERC-6492 Support (Permit2PaymentCollector.sol):

    • Facilitates signature-based permit transfers using Uniswap's ISignatureTransfer (Permit2).
    • Includes robust ERC-6492 signature handling for counterfactual and undeployed smart wallet signatures.
  • Abstract Collector Foundation (TokenCollector.sol):

    • Enforces strict access control via OnlyAuthCaptureEscrow modifier to ensure token pulls originate solely from the authorized escrow contract.
    • Provides payer-agnostic hashing utilities (_getHashPayerAgnostic) for secure nonce generation.

…ssionPaymentCollector, and Permit2PaymentCollector contracts for Base

## Description

This pull request introduces the core payment processing and collection architecture for Coinbase's commerce payments suite on Base (`AuthCaptureEscrow.sol`, `SpendPermissionPaymentCollector.sol`, `TokenCollector.sol`, and `Permit2PaymentCollector.sol`). It enables robust two-step payment escrow workflows (authorization and capture), gasless payments via Permit2, and delegated spending via Spend Permissions and MagicSpend.

### Key Features & Security Architecture

* **Escrow & Authorization Flow (`AuthCaptureEscrow.sol`)**:
  * Implements a 2-step payment pattern (authorization hold and capture distribution) using Solady's transient reentrancy guard (`ReentrancyGuardTransient`).
  * Enforces strict expiration checks (`preApprovalExpiry`, `authorizationExpiry`, `refundExpiry`) and fee bounds validation (`minFeeBps` / `maxFeeBps` up to 10,000 BPS).
  * Manages isolated operator token stores via deterministic minimal clones (`LibClone`).

* **Spend Permission Integration (`SpendPermissionPaymentCollector.sol`)**:
  * Integrates `SpendPermissionManager` to pull tokens securely through user-authorized spending limits.
  * Supports optional Spend Permission approval signatures and `MagicSpend.WithdrawRequest` flows.

* **Permit2 & ERC-6492 Support (`Permit2PaymentCollector.sol`)**:
  * Facilitates signature-based permit transfers using Uniswap's `ISignatureTransfer` (Permit2).
  * Includes robust ERC-6492 signature handling for counterfactual and undeployed smart wallet signatures.

* **Abstract Collector Foundation (`TokenCollector.sol`)**:
  * Enforces strict access control via `OnlyAuthCaptureEscrow` modifier to ensure token pulls originate solely from the authorized escrow contract.
  * Provides payer-agnostic hashing utilities (`_getHashPayerAgnostic`) for secure nonce generation.
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants