{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gulltoppr-dev/json-schema/gulltoppr-dev-abi-result-schema.json",
  "title": "AbiResult",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gulltoppr-dev-openapi.json#/components/schemas/AbiResult",
  "type": "object",
  "required": [
    "chain",
    "address",
    "interface",
    "abi",
    "provenance",
    "abi_for",
    "cached"
  ],
  "properties": {
    "chain": {
      "type": "integer"
    },
    "address": {
      "$ref": "#/$defs/Address"
    },
    "interface": {
      "$ref": "#/$defs/ContractInterface"
    },
    "abi": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "provenance": {
      "$ref": "#/$defs/Provenance"
    },
    "proxy": {
      "$ref": "#/$defs/ProxyChain"
    },
    "token": {
      "$ref": "#/$defs/TokenMeta"
    },
    "abi_for": {
      "$ref": "#/$defs/Address"
    },
    "cached": {
      "type": "boolean"
    }
  },
  "$defs": {
    "Address": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$"
    },
    "BytecodeMatchProvenance": {
      "type": "object",
      "required": [
        "chain",
        "address",
        "source",
        "confidence"
      ],
      "description": "Original ABI source reused because the metadata-stripped runtime bytecode skeleton matched.",
      "properties": {
        "chain": {
          "type": "integer",
          "description": "EIP-155 chain id where the reusable bytecode skeleton was first resolved."
        },
        "address": {
          "$ref": "#/$defs/Address"
        },
        "source": {
          "$ref": "#/$defs/ProvenanceSource"
        },
        "confidence": {
          "$ref": "#/$defs/Confidence"
        }
      }
    },
    "Confidence": {
      "type": "string",
      "enum": [
        "verified",
        "partial",
        "decompiled",
        "selector-only"
      ]
    },
    "ContractInterface": {
      "type": "object",
      "required": [
        "reads",
        "writes"
      ],
      "properties": {
        "reads": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ReadCapability"
          }
        },
        "writes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WriteCapability"
          }
        }
      }
    },
    "IoParam": {
      "type": "object",
      "required": [
        "name",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "Provenance": {
      "type": "object",
      "required": [
        "source",
        "confidence",
        "verified",
        "names_synthetic",
        "natspec"
      ],
      "properties": {
        "source": {
          "$ref": "#/$defs/ProvenanceSource"
        },
        "confidence": {
          "$ref": "#/$defs/Confidence"
        },
        "verified": {
          "type": "boolean"
        },
        "names_synthetic": {
          "type": "boolean"
        },
        "natspec": {
          "type": "boolean"
        },
        "bytecode_match": {
          "$ref": "#/$defs/BytecodeMatchProvenance"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "ProvenanceSource": {
      "type": "string",
      "enum": [
        "etherscan",
        "sourcify",
        "proxy-impl",
        "bytecode-match",
        "heimdall-decompiled",
        "4byte"
      ]
    },
    "ProxyChain": {
      "type": "object",
      "required": [
        "is_proxy",
        "pattern",
        "hops"
      ],
      "properties": {
        "is_proxy": {
          "type": "boolean",
          "const": true
        },
        "pattern": {
          "type": "string",
          "enum": [
            "eip1967",
            "uups",
            "transparent",
            "beacon",
            "diamond",
            "minimal-1167",
            "unknown"
          ]
        },
        "hops": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "address",
              "role"
            ],
            "properties": {
              "address": {
                "$ref": "#/$defs/Address"
              },
              "role": {
                "type": "string",
                "enum": [
                  "proxy",
                  "implementation",
                  "beacon",
                  "facet"
                ]
              }
            }
          }
        },
        "resolved_implementation": {
          "$ref": "#/$defs/Address"
        }
      }
    },
    "ReadCapability": {
      "type": "object",
      "required": [
        "function",
        "signature",
        "inputs",
        "outputs",
        "names_synthetic"
      ],
      "properties": {
        "function": {
          "type": "string"
        },
        "signature": {
          "type": "string"
        },
        "inputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IoParam"
          }
        },
        "outputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IoParam"
          }
        },
        "names_synthetic": {
          "type": "boolean"
        },
        "hint": {
          "type": "string"
        }
      }
    },
    "TokenMeta": {
      "type": "object",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "erc20",
            "erc721",
            "erc1155",
            null
          ]
        },
        "symbol": {
          "type": "string"
        },
        "decimals": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "WriteCapability": {
      "type": "object",
      "required": [
        "function",
        "signature",
        "inputs",
        "payable",
        "names_synthetic"
      ],
      "properties": {
        "function": {
          "type": "string"
        },
        "signature": {
          "type": "string"
        },
        "inputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IoParam"
          }
        },
        "payable": {
          "type": "boolean"
        },
        "names_synthetic": {
          "type": "boolean"
        },
        "hint": {
          "type": "string"
        }
      }
    }
  }
}