Repository navigation
feat(commerce-payments): implement core AuthCaptureEscrow, SpendPermissionPaymentCollector and Permit2PaymentCollector contracts for Base - #96
Open
magqqgq wants to merge 1 commit into
Conversation
…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.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andPermit2PaymentCollector.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):ReentrancyGuardTransient).preApprovalExpiry,authorizationExpiry,refundExpiry) and fee bounds validation (minFeeBps/maxFeeBpsup to 10,000 BPS).LibClone).Spend Permission Integration (
SpendPermissionPaymentCollector.sol):SpendPermissionManagerto pull tokens securely through user-authorized spending limits.MagicSpend.WithdrawRequestflows.Permit2 & ERC-6492 Support (
Permit2PaymentCollector.sol):ISignatureTransfer(Permit2).Abstract Collector Foundation (
TokenCollector.sol):OnlyAuthCaptureEscrowmodifier to ensure token pulls originate solely from the authorized escrow contract._getHashPayerAgnostic) for secure nonce generation.