Skip to content

Sample Policy Rule with Advanced ABI Check

This page provides an example Policy rule that uses Fordefi's advanced ABI check capabilities to check the calldata of an EVM contract call. The example demonstrates how to enforce a swap pair when swapping on Uniswap V4.

For more general information about ABI checks, see Setting ABI Conditions.

General settings

  • Transaction type: "Contract call"

  • Recipient: Uniswap's Universal Router on Arbitrum

  • ABI: the Universal Router's execute (0x3593564c) function with 2 extra parameters

    abi_high_level.png

ABI extra parameters

First condition

  • Path: [1][1]: Both conditions use the same path [1][1] because the SWAP_EXACT_IN action encodes both the input and output tokens in a single bytes field. Each condition is a Contains check, so together they assert that this encoded swap involves both USDT0 and USDC.
  • Type: Bytes
  • Operator: Contains
  • Value: 0x000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9, which is the address of the USDT0 token contract on Arbitrum, left-padded to 32 bytes (with the 0x prefix).

Second condition

  • Path: [1][1], for the same reason as explained above.

  • Type: Bytes

  • Operator: Contains

  • Value: 0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831, which is the address of the USDC token contract on Arbitrum, left-padded to 32 bytes (with the 0x prefix).

    abi_low_level.png
    Notes
    • The Policy rule above will NOT match any allowance or permit transactions; these would need to be handled by separate rules in your Policy.
    • The Policy rule above is designed to match a swap on Uniswap V4 and might not work for other versions.
    • The Contains bytes checks used in the rule above match the pair regardless of direction: both a USDC→USDT0 swap and a USDT0→USDC swap would match.
    • Always use the contract's abi.json as the source of truth to understand a function's signature.