contracts: x402r extensions (payment-operator + condition plugins)#3
Open
A1igator wants to merge 1 commit into
Open
contracts: x402r extensions (payment-operator + condition plugins)#3A1igator wants to merge 1 commit into
A1igator wants to merge 1 commit into
Conversation
Stacks on top of the base commerce-payments port. Adds the x402r-specific layer: - payment-operator: factory + slot dispatch. create_operator allocates a per-merchant OperatorState PDA at ["operator", authority] whose address IS the merchant's operator pubkey. Wraps escrow authorize/capture/void/ charge/refund with pre-action conditions + post-action hooks, CPI'ing into escrow as the per-merchant PDA via invoke_signed. update_operator rotates the slot config under the existing authority. - static-address-condition: generic ICondition reference impl. Outer signer must equal a configured target. - receiver-condition: stateless ICondition. Outer signer == payment_info. receiver. - payer-condition: stateless ICondition. Outer signer == payment_info. payer. - fuzz_slot_dispatch: Trident scaffold for fuzzing the slot fan-out. - Re-adds the slot-dispatch test cases removed from the base PR. Workspace plumbing (Anchor.toml, Cargo workspace, codama generator, pin-program-ids, fuzz Cargo) is updated to include the new programs. reclaim stays on the escrow and is called by the payer directly: it intentionally bypasses the operator program so the payer's deadline- based escape hatch cannot be defeasibly delegated. Status: pilot, unaudited. Mainnet usage is at users' own risk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
Stacks on top of #2 (base commerce-payments port). Adds the x402r-specific layer on top of the escrow primitive — the second half of the two-PR split of #1.
payment-operatorcreate_operatorallocates a per-merchantOperatorStatePDA at[b"operator", authority](PDA address IS the merchant's operator pubkey). Wraps escrowauthorize/capture/void/charge/refundwith pre-action conditions + post-action hooks, CPI'ing into escrow as the per-merchant PDA viainvoke_signed.update_operatorrotates the slot config under the existing authority.static-address-conditionIConditionreference impl: outer signer must equal a configured target address.receiver-conditionICondition: outer signer must equalpayment_info.receiver.payer-conditionICondition: outer signer must equalpayment_info.payer.Also adds:
fuzz_slot_dispatch: Trident scaffold for fuzzing slot fan-out (input shape only; full banks-client harness is a follow-up).Workspace plumbing (
Anchor.toml,Cargoworkspace,codama/generate.ts,migrations/pin-program-ids.ts,fuzz/Cargo.toml) is updated to include the new programs.reclaimstays on the escrow and is called by the payer directly — it intentionally bypasses the operator program so the payer's deadline-based escape hatch cannot be defeasibly delegated.Review order
This PR will look smaller and cleaner after #2 merges; until then GitHub will show the union diff. Reviewing as
aliabdoli/svm-x402r-extensions...aliabdoli/svm-base-portisolates this PR's changes from the base.Licensing
Same BUSL-1.1 terms as the base PR.
Status
Pilot, unaudited. Mainnet usage is at users' own risk.
🤖 Generated with Claude Code