Permit2 router witness

From cyotee/indexedex · View interactive version

Permit2 router witness is an AI agent skill from the GitHub repository cyotee/indexedex. This skill should be used when the user asks about Permit2 witness signatures for Balancer V3 router swaps, typed-data construction, nonce/deadline handling, or needs the router’s canonical witness type string/typehash.

How to use this skill

Skill file

Permit2 Router Witness (Balancer V3)

Use this skill for signed swap flows that call:

Both routes use Permit2 permitWitnessTransferFrom and must use the router’s exact witness schema.

Canonical Router Witness Values

Source of truth is the router itself (via BalancerV3StandardExchangeRouterPermit2WitnessFacet):

Current canonical witness type string:

Witness witness)TokenPermissions(address token,uint256 amount)Witness(address owner,address pool,address tokenIn,address tokenInVault,address tokenOut,address tokenOutVault,uint256 amountIn,uint256 limit,uint256 deadline,bool wethIsEth,bytes32 userData)

Current canonical witness struct hash preimage:

Witness(address owner,address pool,address tokenIn,address tokenInVault,address tokenOut,address tokenOutVault,uint256 amountIn,uint256 limit,uint256 deadline,bool wethIsEth,bytes32 userData)

Critical Rules

  1. Always read witness constants from router
  1. Typed data must use EIP-712 signing
  1. Nonce and deadline are single-use/strict
  1. Token -> Permit2 allowance still required
  1. Signed mode should not silently downgrade

Known Failure Patterns

Validation Checklist

Useful Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.