{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gulltoppr-dev/json-schema/gulltoppr-dev-simulation-schema.json",
  "title": "Simulation",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gulltoppr-dev-openapi.json#/components/schemas/Simulation",
  "type": "object",
  "required": [
    "success",
    "gas_used",
    "state_diff",
    "asset_changes",
    "logs"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "gas_used": {
      "type": "integer",
      "minimum": 0
    },
    "return_value": {
      "type": "object",
      "required": [
        "decoded",
        "raw"
      ],
      "properties": {
        "decoded": {
          "type": "array",
          "items": true
        },
        "raw": {
          "$ref": "#/$defs/Calldata"
        }
      }
    },
    "state_diff": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/StateDiffEntry"
      }
    },
    "asset_changes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AssetChange"
      }
    },
    "logs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SimLog"
      }
    },
    "revert": {
      "type": "object",
      "required": [
        "reason"
      ],
      "properties": {
        "reason": {
          "type": "string"
        },
        "decoded": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "Address": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$"
    },
    "AssetChange": {
      "type": "object",
      "required": [
        "address",
        "token",
        "delta",
        "kind"
      ],
      "properties": {
        "address": {
          "$ref": "#/$defs/Address"
        },
        "token": {
          "$ref": "#/$defs/Address"
        },
        "symbol": {
          "type": "string"
        },
        "delta": {
          "$ref": "#/$defs/SignedDecimal"
        },
        "kind": {
          "type": "string",
          "enum": [
            "erc20",
            "erc721",
            "erc1155",
            "native"
          ]
        }
      }
    },
    "Calldata": {
      "type": "string",
      "pattern": "^0x([0-9a-fA-F]{2})*$"
    },
    "SignedDecimal": {
      "type": "string",
      "pattern": "^-?\\d+$",
      "description": "Signed decimal integer string."
    },
    "SimLog": {
      "type": "object",
      "required": [
        "address"
      ],
      "properties": {
        "address": {
          "$ref": "#/$defs/Address"
        },
        "event": {
          "type": "string"
        },
        "args": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "StateDiffEntry": {
      "type": "object",
      "required": [
        "address",
        "before",
        "after"
      ],
      "properties": {
        "address": {
          "$ref": "#/$defs/Address"
        },
        "slot_label": {
          "type": "string"
        },
        "before": {
          "type": "string"
        },
        "after": {
          "type": "string"
        }
      }
    }
  }
}