{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/m2msentinel-com/json-schema/m2msentinel-com-audit-response-schema.json",
  "title": "AuditResponse",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/m2msentinel-com-openapi.json#/components/schemas/AuditResponse",
  "type": "object",
  "properties": {
    "status": {
      "type": "string"
    },
    "payoutWallet": {
      "type": "string"
    },
    "audit": {
      "type": "object",
      "required": [
        "address",
        "analysisKind",
        "notASafetyGuarantee",
        "reachability",
        "limitations"
      ],
      "properties": {
        "address": {
          "type": "string"
        },
        "analysisKind": {
          "type": "string",
          "const": "STATIC_BYTECODE_CAPABILITY_HEURISTIC"
        },
        "notASafetyGuarantee": {
          "type": "boolean",
          "const": true
        },
        "reachability": {
          "type": "string",
          "const": "NOT_ESTABLISHED"
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "proxyResolution": {
          "$ref": "#/$defs/ProxyResolution"
        },
        "dissection": {
          "$ref": "#/$defs/Dissection"
        },
        "capabilityRating": {
          "type": "string"
        },
        "verdict": {
          "$ref": "#/$defs/Verdict"
        },
        "capabilityScore": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 100
        },
        "scoreBreakdown": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "scoreMeaning": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidenceGrade": {
          "type": "boolean"
        },
        "reproducibility": {
          "$ref": "#/$defs/Reproducibility"
        },
        "network": {
          "type": "string"
        },
        "provenance": {
          "$ref": "#/$defs/Provenance"
        }
      }
    }
  },
  "$defs": {
    "Capability": {
      "type": "object",
      "required": [
        "type",
        "confidence",
        "reachability",
        "evidence"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "DELEGATECALL",
            "SELFDESTRUCT",
            "MINT_SELECTOR",
            "PAUSE_SELECTOR",
            "FREEZE_SELECTOR"
          ]
        },
        "confidence": {
          "type": "string",
          "enum": [
            "HIGH",
            "MEDIUM",
            "LOW"
          ]
        },
        "reachability": {
          "type": "string",
          "const": "NOT_ESTABLISHED"
        },
        "byteOffsetHex": {
          "type": "string"
        },
        "selectorHex": {
          "type": "string"
        },
        "snippetHex": {
          "type": "string"
        },
        "evidence": {
          "type": "string"
        }
      }
    },
    "Dissection": {
      "type": "object",
      "properties": {
        "isValidContract": {
          "type": "boolean"
        },
        "bytecodeSizeBytes": {
          "type": "integer"
        },
        "targetBytecodeHash": {
          "type": [
            "string",
            "null"
          ],
          "description": "Cryptographic SHA-256 hash of the analyzed bytecode"
        },
        "capabilities": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Capability"
          }
        },
        "detectedCapabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metadata": {
          "type": "object",
          "properties": {
            "disclaimer": {
              "type": "string"
            }
          }
        }
      }
    },
    "Provenance": {
      "type": "object",
      "description": "Where a value came from and how old it is. Present on every data response.",
      "properties": {
        "source": {
          "type": "string"
        },
        "endpoint": {
          "type": "string"
        },
        "trustLevel": {
          "type": "string",
          "enum": [
            "HIGH_TRUST_PRIMARY",
            "QUORUM_PUBLIC",
            "DEGRADED_LOW_TRUST"
          ]
        },
        "agreement": {
          "type": "integer",
          "description": "Providers that returned the selected result."
        },
        "sampled": {
          "type": "integer",
          "description": "Providers that answered at all."
        },
        "retrievedAt": {
          "type": "string",
          "format": "date-time"
        },
        "ageSeconds": {
          "type": "integer"
        },
        "network": {
          "type": "string"
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ProxyResolution": {
      "type": "object",
      "properties": {
        "isProxy": {
          "type": "boolean"
        },
        "proxyType": {
          "type": "string",
          "enum": [
            "NONE",
            "EIP1967_DIRECT",
            "EIP1822_UUPS",
            "ZEPPELINOS_LEGACY",
            "EIP1967_BEACON",
            "EIP1967_BEACON_UNRESOLVED",
            "EIP1167_MINIMAL_PROXY",
            "DELEGATECALL_PROXY_SUSPECTED",
            "CYCLE_DETECTED",
            "MAX_DEPTH_EXCEEDED"
          ]
        },
        "targetAddress": {
          "type": "string"
        },
        "beaconAddress": {
          "type": "string"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "HIGH",
            "MEDIUM",
            "LOW"
          ]
        },
        "resolutionPath": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              },
              "via": {
                "type": "string"
              }
            }
          }
        },
        "warning": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "Reproducibility": {
      "type": "object",
      "description": "Deterministic reproducibility metadata and cryptographic bytecode hashes for independent verification.",
      "properties": {
        "chainId": {
          "type": "integer"
        },
        "network": {
          "type": "string"
        },
        "contractAddress": {
          "type": "string"
        },
        "runtimeBytecodeHash": {
          "type": [
            "string",
            "null"
          ],
          "description": "SHA-256 hash of the target contract deployed runtime bytecode."
        },
        "isProxy": {
          "type": "boolean"
        },
        "implementationAddress": {
          "type": [
            "string",
            "null"
          ]
        },
        "implementationBytecodeHash": {
          "type": [
            "string",
            "null"
          ],
          "description": "SHA-256 hash of the implementation bytecode if target is a proxy."
        },
        "rulesetVersion": {
          "type": "string"
        },
        "engineVersion": {
          "type": "string"
        },
        "evidenceGrade": {
          "type": "boolean"
        },
        "trustLevel": {
          "type": "string"
        },
        "retrievedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Verdict": {
      "type": "object",
      "required": [
        "capabilityRating",
        "reachability",
        "evidenceGrade",
        "reason",
        "explanation",
        "executableCapabilities"
      ],
      "properties": {
        "capabilityRating": {
          "type": "string",
          "enum": [
            "NO_SELECTED_CAPABILITIES_DETECTED",
            "REVIEW_RECOMMENDED",
            "MULTIPLE_FLAGS",
            "NOT_A_CONTRACT",
            "UNVERIFIED"
          ]
        },
        "reachability": {
          "type": "string",
          "const": "NOT_ESTABLISHED"
        },
        "evidenceGrade": {
          "type": "boolean",
          "description": "False when RPC trust or proxy resolution was insufficient to publish a capability label."
        },
        "reason": {
          "type": "string"
        },
        "explanation": {
          "type": "string"
        },
        "executableCapabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}