Skip to content
Back to skills

Permit2 Signature Transfer Contract

ASecurity

Solidity contract implementation for permitWitnessTransferFrom. Use when writing Solidity contracts that receive Permit2 signatures.

  • 9 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 10, 2026
designfrontend

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add cyotee/indexedex --skill permit2-signature-transfer-contract --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Permit2 Signature Transfer Contract?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Permit2 Signature Transfer Contract
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cyotee-permit2-signature-transfer-contract/badge)](https://www.skillsdirectory.com/skills/cyotee-permit2-signature-transfer-contract)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: permit2-signature-transfer-contract
description: Solidity contract implementation for permitWitnessTransferFrom. Use when writing Solidity contracts that receive Permit2 signatures.
---

# Permit2 Signature Transfer - Contract Integration

Solidity implementation for `permitWitnessTransferFrom` pattern.

## Contract Setup

```solidity
import {ISignatureTransfer} from "@uniswap/permit2/src/interfaces/ISignatureTransfer.sol";

contract IndexedexRouter {
    address public constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;

    // Must match frontend exactly
    string public constant WITNESS_TYPE_STRING =
        "PermitWitnessTransferFrom(TokenPermissions permitted,address spender,uint256 nonce,uint256 deadline,Witness witness)"
        "TokenPermissions(address token,uint256 amount)"
        "Witness(bytes32 actionId)";

    bytes32 public constant WITNESS_TYPEHASH = keccak256("Witness(bytes32 actionId)");
}
```

## Exchange In Handler

```solidity
function handlePermitSignatureIn(
    ISignatureTransfer.PermitTransferFrom calldata permit,
    ISignatureTransfer.SignatureTransferDetails calldata transferDetails,
    address owner,
    bytes32 actionId,
    bytes calldata signature
) external {
    bytes32 witness = keccak256(abi.encode(WITNESS_TYPEHASH, actionId));

    ISignatureTransfer(PERMIT2).permitWitnessTransferFrom(
        permit,
        transferDetails,
        owner,
        witness,
        WITNESS_TYPE_STRING,
        signature
    );

    // tokens now in this contract - execute the swap
}
```

## Exchange Out Handler

For exact-out swaps, include `maxAmountIn` in the actionId:

```solidity
bytes32 actionId = keccak256(abi.encodePacked(
    tokenIn,
    tokenOut,
    vaultAddress,
    amountOut,
    maxAmountIn
));
```

## Cross-Chain Considerations

- Permit2 address is **canonical** (same on all chains)
- ChainId must match the network where signature will be used
- Signatures are not valid across chains

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…