Skip to main content
For Transactions V2 on EVM blockchains, there is a dependency on the Permit2 contract to enable allowance management. To get the benefits of Transactions V2, you must grant a USDC token allowance to the Permit2 contract. This guide shows three examples of how to grant a USDC token allowance to the Permit2 contract. The Permit2 documentation provides additional examples of how to grant this allowance.

Prerequisites

The examples on this page show how to grant a USDC token allowance to the Permit2 contract using a Circle Wallets developer-controlled wallet or a generic EIP-1193 Ethereum wallet. The headless example is for a bring-your-own- wallet (BYOW) OFI that signs transactions in its backend. Before you begin, ensure you have:
  • If you are following the Circle Wallets example:
  • Node.js and npm installed on your development machine
  • A project set up as described in the following section

Set up your project

  1. Initialize a new Node.js project and install dependencies:
  2. In the project root, create a .env file and add the following variables:
    The PERMIT2_CONTRACT_ADDRESS is the same across all EVM blockchains (0x000000000022D473030F116dDEE9F6B43aC78BA3), but you should verify it with the blockchain explorer on the chain you are using. You can find the USDC_CONTRACT_ADDRESS on the USDC contract address page.
    The USDC token has 6 decimals. Set the allowance to cover the expected payment amount plus any associated fees. For a $100 payment, set APPROVAL_AMOUNT to at least 100000000 (100 * 106) plus the fees converted to raw USDC units.
    If you are following the Circle Wallets example, you will also need to add the following variables:
    If you are following the EIP-1193 Ethereum wallet example, or your Circle Wallet is on the generic EVM / EVM-TESTNET chain, you will also need to add the following variable:
  3. Create an index.ts file. You’ll add code step by step in the following sections. Run it with npx tsx index.ts.

Grant a USDC token allowance to the Permit2 contract

The following example code shows the process for granting a USDC token allowance to the Permit2 contract using a Circle Wallets developer-controlled wallet or an EIP-1193 Ethereum wallet.
This example is for a Circle Wallets developer-controlled wallet on specific EVM blockchains (for example, ETH, ETH-SEPOLIA, MATIC, MATIC-AMOY, etc.). If your Circle Wallet is on the generic EVM / EVM-TESTNET chain, use the example in the “Circle Wallets (generic EVM)” tab.
For a BYOW OFI, the preceding approval is a one-time ERC-20 transaction. After it confirms, use the same wallet to sign the EIP-712 messageToBeSigned returned by the create transaction V2 endpoint. Submit the resulting signature in the signedTransaction field of the submit transaction V2 endpoint.