Skip to content

feat(evm): add optional ERC-8021 Builder Code attribution to settlement transactions#31

Open
CECILIA-MULANDI wants to merge 1 commit intocoinbase:mainfrom
CECILIA-MULANDI:feat/erc-8021-builder-code
Open

feat(evm): add optional ERC-8021 Builder Code attribution to settlement transactions#31
CECILIA-MULANDI wants to merge 1 commit intocoinbase:mainfrom
CECILIA-MULANDI:feat/erc-8021-builder-code

Conversation

@CECILIA-MULANDI
Copy link
Copy Markdown

Description

Adds optional ERC-8021 (Builder Code) attribution to facilitator settlement transactions.

When builderCode is configured on ExactEvmScheme or UptoEvmScheme, an ERC-8021 trailing suffix is appended to settlement calldata. Smart contracts ignore trailing calldata beyond ABI-decoded arguments, so this is non-breaking. Without builderCode set, all paths fall through to the existing writeContract behavior — zero change.

Covers all settlement paths: Permit2 direct, settleWithPermit (EIP-2612), ERC-20 approval, and EIP-3009 transferWithAuthorization.


Usage

new ExactEvmScheme(signer, { builderCode: "myapp" })
new UptoEvmScheme(signer, { builderCode: "myapp" })

What Changed

  • New erc8021.ts utility with buildErc8021Suffix() and writeContractWithBuilderCode() helper
  • Added builderCode?: string to ExactEvmSchemeConfig, UptoEvmSchemeConfig, Permit2FacilitatorConfig, and EIP3009FacilitatorConfig
  • Modified all settle functions to use writeContractWithBuilderCode (or append suffix to raw calldata for extension signer paths)
  • Exported buildErc8021Suffix from @x402/evm

Tests

  • pnpm build --filter @x402/evm passes cleanly
  • pnpm test --filter @x402/evm — 339/339 tests pass
  • pnpm lint --filter @x402/evm — 0 errors
  • Existing tests unaffected (no behavioral change without builderCode)

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge)
  • I added a changelog fragment for user-facing changes

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

Development

Successfully merging this pull request may close these issues.

1 participant