{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://morpheusradar.com/dados/v1/schema/transacoes.schema.json",
  "title": "Morpheus Radar open data v1 · transactions (one row per liquidation transaction)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema_version",
    "dataset",
    "content",
    "window_start",
    "window_end",
    "generated_at",
    "min_delay_seconds",
    "license",
    "csv",
    "columns",
    "rows"
  ],
  "properties": {
    "$schema": {
      "const": "https://morpheusradar.com/dados/v1/schema/transacoes.schema.json"
    },
    "schema_version": {
      "type": "string",
      "pattern": "^1\\.[0-9]+$"
    },
    "dataset": {
      "type": "string"
    },
    "content": {
      "const": "transactions"
    },
    "window_start": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "window_end": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "generated_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "min_delay_seconds": {
      "type": "integer",
      "minimum": 3600
    },
    "license": {
      "const": {
        "id": "CC-BY-4.0",
        "url": "https://creativecommons.org/licenses/by/4.0/",
        "attribution": "Source: Morpheus Radar (morpheusradar.com)"
      }
    },
    "csv": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "bytes",
        "rows",
        "sha256"
      ],
      "properties": {
        "url": {
          "type": "string",
          "pattern": "^/dados/v1/.+\\.csv$"
        },
        "bytes": {
          "type": "integer",
          "minimum": 1
        },
        "rows": {
          "type": "integer",
          "minimum": 0
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "columns": {
      "const": [
        "tx",
        "block",
        "tx_index",
        "time_utc",
        "via_atlas_auction",
        "markets",
        "liquidations",
        "gross_bonus_usd",
        "winning_bid_wei",
        "winning_bid_usd",
        "bid_over_bonus",
        "eth_usd",
        "eth_usd_source",
        "tx_gas_wei"
      ]
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "tx",
          "block",
          "tx_index",
          "time_utc",
          "via_atlas_auction",
          "markets",
          "liquidations",
          "gross_bonus_usd",
          "winning_bid_wei",
          "winning_bid_usd",
          "bid_over_bonus",
          "eth_usd",
          "eth_usd_source",
          "tx_gas_wei"
        ],
        "properties": {
          "tx": {
            "description": "Transaction hash on Base.",
            "type": "string",
            "pattern": "^0x[0-9a-f]{64}$"
          },
          "block": {
            "description": "Block number of the transaction.",
            "type": "integer",
            "minimum": 0
          },
          "tx_index": {
            "description": "Position of the transaction in its block.",
            "type": "integer",
            "minimum": 0
          },
          "time_utc": {
            "description": "Block time in UTC (ISO 8601).",
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
          },
          "via_atlas_auction": {
            "description": "Whether the transaction went through an Atlas (Chainlink SVR) auction.",
            "type": "boolean"
          },
          "markets": {
            "description": "Morpho market IDs liquidated in the transaction, separated by spaces.",
            "type": "string",
            "pattern": "^0x[0-9a-f]{64}( 0x[0-9a-f]{64})*$"
          },
          "liquidations": {
            "description": "Number of Liquidate events.",
            "type": "integer",
            "minimum": 0
          },
          "gross_bonus_usd": {
            "description": "Gross liquidation bonus in USD. USDC loans only. Not profit.",
            "type": [
              "number",
              "null"
            ]
          },
          "winning_bid_wei": {
            "description": "Winning bid of the auction, in wei.",
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+$"
          },
          "winning_bid_usd": {
            "description": "Winning bid in USD, converted at the Chainlink ETH/USD price in that block. Applies to any loan token.",
            "type": [
              "number",
              "null"
            ]
          },
          "bid_over_bonus": {
            "description": "Winning bid divided by gross bonus. Can exceed 1. Not what the protocol receives.",
            "type": [
              "number",
              "null"
            ]
          },
          "eth_usd": {
            "description": "Chainlink ETH/USD price on Base, read at the block, used to convert the bid.",
            "type": "number"
          },
          "eth_usd_source": {
            "description": "Where the ETH price came from (oracle and block).",
            "type": "string"
          },
          "tx_gas_wei": {
            "description": "Gas fee paid by the transaction, in wei.",
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "if": {
          "properties": {
            "gross_bonus_usd": {
              "type": "null"
            }
          },
          "required": [
            "gross_bonus_usd"
          ]
        },
        "then": {
          "properties": {
            "bid_over_bonus": {
              "type": "null"
            }
          }
        }
      }
    }
  }
}
