{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Uniswap V4 pool selection",
  "description": "The authored PoolKey names the pool; the reviewed deployment supplies the PoolManager and StateView.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "connector",
    "chain",
    "currency0",
    "currency1",
    "fee",
    "tick_spacing"
  ],
  "properties": {
    "connector": {
      "const": "uniswap_v4"
    },
    "chain": {
      "type": "string",
      "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$"
    },
    "currency0": {
      "$ref": "#/$defs/Currency"
    },
    "currency1": {
      "$ref": "#/$defs/Currency"
    },
    "fee": {
      "description": "Static LP fee in pips, or 8388608 (the dynamic-fee flag) for a reviewed hook profile that requires it.",
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        {
          "const": 8388608
        }
      ]
    },
    "tick_spacing": {
      "type": "integer",
      "minimum": 1,
      "maximum": 32767
    },
    "hooks": {
      "description": "The zero address, or a hook with a reviewed profile on this chain; any other hook is refused.",
      "$ref": "#/$defs/Address"
    },
    "assertions": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "pool_manager": {
              "$ref": "#/$defs/Address"
            },
            "state_view": {
              "$ref": "#/$defs/Address"
            },
            "decimals0": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            },
            "decimals1": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "Address": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$"
    },
    "Currency": {
      "type": "string",
      "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}/[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}$"
    }
  }
}
