{
  "openapi": "3.1.0",
  "info": {
    "title": "Token Evidence",
    "version": "0.7.0",
    "description": "Source-linked Aave liquidation reports, US Federal Register editions, and finalized ERC-20 supply observations on Base.",
    "termsOfService": "https://rustinference.org/terms/",
    "contact": {
      "name": "Token Evidence support - Brain Dados Publicos - Inova Simples (I.S.)",
      "url": "https://rustinference.org/service/#publisher",
      "email": "contato@empregoexterior.com"
    },
    "x-guidance": "Read the purchase terms and service guide before authorizing payment. The dated Aave liquidation and Federal Register editions cost 0.020 USDC each. The on-demand ERC-20 supply query costs 0.002 USDC. The live x402 offer states the payment requirements."
  },
  "externalDocs": {
    "description": "Agent integration guide and x402 request examples",
    "url": "https://rustinference.org/agents/"
  },
  "servers": [{"url": "https://rustinference.org"}],
  "paths": {
    "/service.json": {
      "get": {
        "operationId": "getServiceInformation",
        "summary": "Read service scope, versions, and the last unsigned quote check",
        "responses": {
          "200": {
            "description": "Published service information and timestamped checks. Read the live x402 quote to confirm current payment terms.",
            "content": {"application/json": {"schema": {
              "type": "object",
              "required": ["schema_version", "documentation_version", "stage", "service_page", "terms", "operator", "services"],
              "properties": {
                "schema_version": {"const": 2},
                "documentation_version": {"type": "string"},
                "stage": {"const": "commercial"},
                "service_page": {"type": "string", "format": "uri"},
                "terms": {"type": "string", "format": "uri"},
                "operator": {"type": "object", "required": ["public_legal_entity", "cnpj", "responsible_person", "public_operator_contact"]},
                "services": {"type": "array", "items": {"type": "object"}}
              }
            }}}
          }
        }
      }
    },
    "/btc-liquidations-sample.json": {
      "get": {
        "operationId": "getAaveBitcoinLiquidationsSample",
        "summary": "Read the free Aave V3 Bitcoin collateral liquidation summary",
        "responses": {
          "200": {
            "description": "December 4, 2026 summary with scope, totals and sample Aave receipts.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AaveBitcoinLiquidationsSample"}}}
          }
        }
      }
    },
    "/0xbd6d3fe2b3a786b3a9daf5e0184a9ef626e12b31/aave-bitcoin-liquidations": {
      "get": {
        "operationId": "getAaveBitcoinLiquidationsEdition",
        "summary": "Get the December 4 Aave V3 Bitcoin collateral liquidation report",
        "description": "Read source-linked LiquidationCall evidence for cbBTC collateral on Base and WBTC, cbBTC, and tBTC collateral on Ethereum. The edition records its UTC window and finality checkpoints.",
        "servers": [{"url": "https://x402.bankr.bot"}],
        "x-payment-info": {
          "price": {"mode": "fixed", "currency": "USD", "amount": "0.020"},
          "protocols": [{"x402": {}}]
        },
        "parameters": [{
          "name": "edition",
          "in": "query",
          "description": "The date of the published incident report.",
          "schema": {"type": "string", "format": "date", "enum": ["2026-12-04"], "default": "2026-12-04"},
          "example": "2026-12-04"
        }],
        "responses": {
          "200": {
            "description": "Full edition with event-level amounts, block coverage and receipt references.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AaveBitcoinLiquidationsEdition"}}}
          },
          "400": {"description": "Invalid or repeated query parameters."},
          "402": {"description": "Payment required. Exact payment of 0.020 native USDC on Base mainnet."},
          "404": {"description": "The requested edition is unavailable."},
          "503": {"description": "The edition could not be served."}
        }
      }
    },
    "/editions.json": {
      "get": {
        "operationId": "listEvidenceEditions",
        "summary": "List available editions, sample URLs and exact purchase requests",
        "responses": {
          "200": {
            "description": "Free index of documented editions and payment terms. The live HTTP 402 is authoritative for a purchase.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["schema_version", "currency", "asset", "network", "editions"],
                  "properties": {
                    "schema_version": {"const": 1},
                    "currency": {"const": "USDC"},
                    "asset": {"type": "string"},
                    "network": {"const": "eip155:8453"},
                    "updates": {"type": "string", "format": "uri"},
                    "editions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["id", "date", "title", "documentation", "sample", "purchase"],
                        "properties": {
                          "id": {"type": "string"},
                          "date": {"type": "string", "format": "date"},
                          "title": {"type": "string"},
                          "documentation": {"type": "string", "format": "uri"},
                          "sample": {"type": "string", "format": "uri"},
                          "purchase": {
                            "type": "object",
                            "required": ["method", "url", "protocol", "scheme", "price_usdc", "amount_atomic"],
                            "properties": {
                              "method": {"const": "GET"},
                              "url": {"type": "string", "format": "uri"},
                              "protocol": {"const": "x402"},
                              "scheme": {"const": "exact"},
                              "price_usdc": {"type": "string"},
                              "amount_atomic": {"type": "string", "pattern": "^[0-9]+$"}
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/official-changes-sample.json": {
      "get": {
        "operationId": "getOfficialChangesSample",
        "summary": "Read two Federal Register records from December 3, 2026",
        "responses": {
          "200": {
            "description": "Two records with summaries, dates and GovInfo links.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/OfficialChanges"}}}
          }
        }
      }
    },
    "/0xbd6d3fe2b3a786b3a9daf5e0184a9ef626e12b31/official-changes-us": {
      "get": {
        "operationId": "getOfficialChangesEdition",
        "summary": "Read all rules and proposed rules for the supported Federal Register edition",
        "servers": [{"url": "https://x402.bankr.bot"}],
        "x-payment-info": {
          "price": {"mode": "fixed", "currency": "USD", "amount": "0.020"},
          "protocols": [{"x402": {}}]
        },
        "parameters": [
          {
            "name": "edition",
            "in": "query",
            "description": "Federal Register publication date.",
            "schema": {"type": "string", "format": "date", "enum": ["2026-12-03"], "default": "2026-12-03"},
            "example": "2026-12-03"
          }
        ],
        "responses": {
          "200": {
            "description": "Full edition with 11 records, dates, source evidence and links.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/OfficialChanges"}}}
          },
          "400": {"description": "Invalid or repeated query parameters."},
          "402": {"description": "Payment required. Exact payment of 0.020 native USDC on Base mainnet."},
          "404": {"description": "The requested edition is unavailable."}
        }
      }
    },
    "/sample.json": {
      "get": {
        "operationId": "getSupplyEvidenceSample",
        "summary": "Read the historical USDC supply evidence sample",
        "responses": {
          "200": {
            "description": "Block-pinned ERC-20 supply observations and sampled receipts.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupplyEvidence"}}}
          }
        }
      }
    },
    "/0xbd6d3fe2b3a786b3a9daf5e0184a9ef626e12b31/base-token-supply": {
      "get": {
        "operationId": "reconcileBaseTokenSupply",
        "summary": "Reconcile Base ERC-20 supply changes between finalized blocks",
        "description": "Compare totalSupply at both finalized block hashes and reconcile observed transfers from and to the zero address. A request supports up to 10,000 blocks and 1,000 matching events.",
        "servers": [{"url": "https://x402.bankr.bot"}],
        "x-payment-info": {
          "price": {"mode": "fixed", "currency": "USD", "amount": "0.002"},
          "protocols": [{"x402": {}}]
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "description": "ERC-20 contract address on Base.",
            "schema": {"type": "string", "pattern": "^0x[0-9a-fA-F]{40}$"},
            "example": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          {
            "name": "fromBlock",
            "in": "query",
            "required": true,
            "description": "Starting block number, excluded from the event window.",
            "schema": {"type": "integer", "minimum": 1},
            "example": 66096733
          },
          {
            "name": "toBlock",
            "in": "query",
            "description": "Ending block number, included in the event window. Defaults to the latest finalized block.",
            "schema": {"type": "integer", "minimum": 1},
            "example": 66097084
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence for the requested token and block window.",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SupplyEvidence"}}}
          },
          "400": {"description": "Invalid or repeated query parameters."},
          "402": {
            "description": "x402 payment required. The live offer specifies 0.002 native USDC on Base mainnet.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 payment requirements.",
                "schema": {"type": "string"}
              }
            }
          },
          "422": {"description": "The block window or event count exceeds the supported range, the end block is not finalized, or the token supply could not be read at a requested block."},
          "503": {"description": "The Base source is unavailable or its response could not be verified."}
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AaveBitcoinLiquidations": {
        "type": "object",
        "required": ["schema_version", "edition", "output", "coverage", "totals", "sources", "receipt_samples"],
        "properties": {
          "schema_version": {"const": 1},
          "edition": {"const": "2026-12-04"},
          "output": {"enum": ["sample", "complete_edition"]},
          "coverage": {
            "type": "object",
            "required": ["start_inclusive_utc", "end_exclusive_utc", "observed_at_utc", "chains"],
            "properties": {
              "start_inclusive_utc": {"type": "string", "format": "date-time"},
              "end_exclusive_utc": {"type": "string", "format": "date-time"},
              "observed_at_utc": {"type": "string", "format": "date-time"},
              "chains": {"type": "array", "items": {"type": "object"}}
            }
          },
          "totals": {"type": "object"},
          "sources": {"type": "object"},
          "receipt_samples": {
            "type": "array",
            "items": {"allOf": [
              {"$ref": "#/components/schemas/AaveLiquidationEvent"},
              {"type": "object", "required": ["receipt_status", "receipt_url"], "properties": {
                "receipt_status": {"const": "success"},
                "receipt_url": {"type": "string", "format": "uri"}
              }}
            ]}
          }
        }
      },
      "AaveBitcoinLiquidationsSample": {
        "allOf": [
          {"$ref": "#/components/schemas/AaveBitcoinLiquidations"},
          {"type": "object", "properties": {"output": {"const": "sample"}}, "not": {"required": ["events"]}}
        ]
      },
      "AaveBitcoinLiquidationsEdition": {
        "allOf": [
          {"$ref": "#/components/schemas/AaveBitcoinLiquidations"},
          {"type": "object", "required": ["events"], "properties": {
            "output": {"const": "complete_edition"},
            "events": {"type": "array", "items": {"$ref": "#/components/schemas/AaveLiquidationEvent"}}
          }}
        ]
      },
      "AaveLiquidationEvent": {
        "type": "object",
        "required": ["chain_id", "block_number", "block_hash", "transaction_hash", "log_index", "timestamp_utc", "finality", "collateral_asset", "debt_asset", "collateral_amount_atomic", "debt_to_cover_atomic"],
        "properties": {
          "chain_id": {"enum": [1, 8453]},
          "block_number": {"type": "integer", "minimum": 1},
          "block_hash": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
          "transaction_hash": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
          "log_index": {"type": "integer", "minimum": 0},
          "timestamp_utc": {"type": "string", "format": "date-time"},
          "finality": {"enum": ["safe", "finalized"], "description": "Finality at the observation time stated by the edition."},
          "collateral_asset": {"type": "object"},
          "debt_asset": {"type": "object"},
          "collateral_amount_atomic": {"type": "string", "pattern": "^[0-9]+$"},
          "debt_to_cover_atomic": {"type": "string", "pattern": "^[0-9]+$"}
        }
      },
      "OfficialChanges": {
        "type": "object",
        "required": ["schema_version", "edition", "output", "coverage", "source", "documents", "dates_index"],
        "properties": {
          "schema_version": {"const": 1},
          "edition": {"type": "string", "format": "date"},
          "output": {"enum": ["sample", "complete_edition"]},
          "coverage": {"type": "object"},
          "source": {"type": "object"},
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["document_number", "type", "title", "published_on", "change_summary", "effective_on", "comments_close_on"],
              "properties": {
                "document_number": {"type": "string"},
                "type": {"enum": ["Rule", "Proposed Rule"]},
                "title": {"type": "string"},
                "change_summary": {"type": "string"},
                "published_on": {"type": "string", "format": "date"},
                "effective_on": {"type": ["string", "null"], "format": "date"},
                "comments_close_on": {"type": ["string", "null"], "format": "date"}
              }
            }
          },
          "dates_index": {"type": "array", "items": {"type": "object"}}
        }
      },
      "Block": {
        "type": "object",
        "required": ["number", "hash", "time", "total_supply_raw", "decimals"],
        "properties": {
          "number": {"type": "integer", "minimum": 1},
          "hash": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
          "time": {"type": "string", "format": "date-time"},
          "total_supply_raw": {"type": "string", "pattern": "^[0-9]+$"},
          "decimals": {"type": ["integer", "null"], "minimum": 0, "maximum": 255}
        }
      },
      "SupplyEvidence": {
        "type": "object",
        "required": ["schema_version", "chain_id", "token_address", "start_exclusive", "end_inclusive", "supply_delta_raw", "difference_raw", "reconciliation", "event_samples"],
        "properties": {
          "schema_version": {"const": 1},
          "chain_id": {"const": 8453},
          "token_address": {"type": "string", "pattern": "^0x[0-9a-f]{40}$"},
          "start_exclusive": {"$ref": "#/components/schemas/Block"},
          "end_inclusive": {"$ref": "#/components/schemas/Block"},
          "supply_delta_raw": {"type": "string", "pattern": "^-?[0-9]+$"},
          "difference_raw": {"type": "string", "pattern": "^-?[0-9]+$"},
          "reconciliation": {"type": "string"},
          "event_samples": {"type": "array", "items": {
            "type": "object",
            "required": ["transaction_hash", "amount_raw", "block_number", "block_hash", "log_index", "kind"],
            "properties": {
              "transaction_hash": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
              "amount_raw": {"type": "string", "pattern": "^[0-9]+$"},
              "block_number": {"type": "integer", "minimum": 1},
              "block_hash": {"type": "string", "pattern": "^0x[0-9a-f]{64}$"},
              "log_index": {"type": "integer", "minimum": 0},
              "kind": {"enum": ["from_zero", "to_zero", "zero_to_zero"]}
            }
          }}
        }
      }
    }
  }
}
