{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-user-guide/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["img","admonition"]},"redocly_category":"User Guide","type":"markdown"},"seo":{"title":"Sample Policy Rule with Advanced ABI Check","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sample-policy-rule-with-advanced-abi-check","__idx":0},"children":["Sample Policy Rule with Advanced ABI Check"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This page provides an example Policy rule that uses Fordefi's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.fordefi.com/user-guide/policies/policy-rules-conditions-and-actions#abi"},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more general information about ABI checks, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.fordefi.com/user-guide/policies/policy-rules-conditions-and-actions#abi"},"children":["Setting ABI Conditions"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"general-settings","__idx":1},"children":["General settings"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Transaction type"]},": \"Contract call\""]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Recipient"]},": Uniswap's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://arbiscan.io/address/0x8B844f885672f333Bc0042cB669255f93a4C1E6b#code"},"children":["Universal Router on Arbitrum"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ABI"]},": the Universal Router's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["execute (0x3593564c)"]}," function with 2 extra parameters"]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/abi_high_level.1ab7fea8852a519ddca5bec4fb1a2424aaaec3b4c8de8ec8110649cad9d785d3.a3440eb5.png","alt":"abi_high_level.png","framed":false,"withLightbox":true,"width":"","height":""},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"abi-extra-parameters","__idx":2},"children":["ABI extra parameters"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"first-condition","__idx":3},"children":["First condition"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[1][1]"]},": Both conditions use the same path ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[1][1]"]}," because the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/Uniswap/v4-periphery/blob/363226d9e1e2180b67bf6857023dbaad751010c5/src/interfaces/IV4Router.sol#L38"},"children":["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."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type"]},": Bytes"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Operator"]},": Contains"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Value"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0x000000000000000000000000fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"]},", which is the address of the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://arbiscan.io/address/0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"},"children":["USDT0 token contract"]}," on Arbitrum, left-padded to 32 bytes (with the 0x prefix)."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"second-condition","__idx":4},"children":["Second condition"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[1][1]"]},", for the same reason as explained above."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type"]},": Bytes"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Operator"]},": Contains"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Value"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831"]},", which is the address of the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://arbiscan.io/address/0xaf88d065e77c8cc2239327c5edb3a432268e5831"},"children":["USDC token contract"]}," on Arbitrum, left-padded to 32 bytes (with the 0x prefix)."]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/abi_low_level.555f575dea3a59fedf89b64d6be5161a7b9064226bd8ff6cbae96a43ef43b6ed.a3440eb5.png","alt":"abi_low_level.png","framed":false,"withLightbox":true,"width":"","height":""},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Notes"},"children":[{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The Policy rule above will NOT match any allowance or permit transactions; these would need to be handled by separate rules in your Policy."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The Policy rule above is designed to match a swap on Uniswap V4 and might not work for other versions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Always use the contract's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["abi.json"]}," as the source of truth to understand a function's signature."]}]}]}]}]}]},"headings":[{"value":"Sample Policy Rule with Advanced ABI Check","id":"sample-policy-rule-with-advanced-abi-check","depth":1},{"value":"General settings","id":"general-settings","depth":2},{"value":"ABI extra parameters","id":"abi-extra-parameters","depth":2},{"value":"First condition","id":"first-condition","depth":3},{"value":"Second condition","id":"second-condition","depth":3}],"frontmatter":{"seo":{"title":"Sample Policy Rule with Advanced ABI Check"}},"lastModified":"2026-06-26T11:08:51.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/user-guide/policies/sample-advanced-abi-check","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}