{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://veri.how/facts.schema.json",
  "title": "veri.how facts",
  "description": "Facts about Veritaseum’s VERI token and Veri SmartMetal contracts.",
  "type": "object",
  "required": [
    "description",
    "license",
    "chains",
    "contracts",
    "lookup",
    "series"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "description": {
      "type": "string"
    },
    "license": {
      "const": "MIT"
    },
    "chains": {
      "description": "Chains by slug.",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "name",
          "caip2",
          "explorer",
          "rpcs"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "caip2": {
            "type": "string",
            "pattern": "^eip155:[0-9]+$",
            "description": "CAIP-2 chain id."
          },
          "explorer": {
            "type": "object",
            "required": [
              "name",
              "url"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "secondaryExplorer": {
            "type": "object",
            "required": [
              "name",
              "url"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "rpcs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Public JSON-RPC endpoints."
          }
        }
      }
    },
    "contracts": {
      "description": "Contracts by slug.",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "name",
          "chain",
          "caip10",
          "address",
          "explorer",
          "abi",
          "verified"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "standard": {
            "enum": [
              "ERC-20",
              "ERC-1155"
            ]
          },
          "decimals": {
            "type": "integer",
            "minimum": 0
          },
          "chain": {
            "type": "object",
            "required": [
              "id",
              "name",
              "caip2"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "caip2": {
                "type": "string"
              }
            }
          },
          "caip10": {
            "type": "string",
            "description": "CAIP-10 account id, lowercase."
          },
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "EIP-55 checksummed."
          },
          "explorer": {
            "type": "object",
            "required": [
              "summary",
              "transactions",
              "source"
            ],
            "additionalProperties": false,
            "properties": {
              "summary": {
                "type": "string",
                "format": "uri"
              },
              "transactions": {
                "type": "string",
                "format": "uri"
              },
              "source": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "abi": {
            "type": "string",
            "format": "uri",
            "description": "The contract’s ABI as standard Solidity ABI JSON."
          },
          "proxy": {
            "enum": [
              "ERC-1967"
            ]
          },
          "implementation": {
            "type": "string",
            "description": "Slug of the implementation contract."
          },
          "deployment": {
            "type": "object",
            "required": [
              "date"
            ],
            "additionalProperties": false,
            "properties": {
              "block": {
                "type": "integer",
                "minimum": 1
              },
              "tx": {
                "type": "string",
                "pattern": "^0x[0-9a-f]{64}$"
              },
              "date": {
                "type": "string",
                "anyOf": [
                  {
                    "format": "date"
                  },
                  {
                    "format": "date-time"
                  }
                ]
              }
            }
          },
          "verified": {
            "type": "object",
            "required": [
              "date"
            ],
            "additionalProperties": false,
            "properties": {
              "block": {
                "type": "integer",
                "minimum": 1
              },
              "tx": {
                "type": "string",
                "pattern": "^0x[0-9a-f]{64}$"
              },
              "date": {
                "type": "string",
                "anyOf": [
                  {
                    "format": "date"
                  },
                  {
                    "format": "date-time"
                  }
                ]
              }
            },
            "description": "When the facts were last read on chain."
          }
        }
      }
    },
    "lookup": {
      "type": "string",
      "description": "How a token id finds its series and metadata."
    },
    "series": {
      "description": "SmartMetal series by slug.",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "name",
          "contract",
          "seriesId",
          "cid",
          "tokenIds",
          "metadata",
          "created"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "contract": {
            "type": "string",
            "description": "Slug of the token contract."
          },
          "seriesId": {
            "type": "string",
            "pattern": "^0x[0-9a-f]{64}$",
            "description": "keccak256 of the CID string."
          },
          "cid": {
            "type": "string",
            "description": "The metadata folder on IPFS."
          },
          "tokenIds": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "from",
                  "to"
                ],
                "additionalProperties": false,
                "properties": {
                  "from": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "to": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0
                },
                "minItems": 1
              }
            ]
          },
          "metadata": {
            "type": "string",
            "description": "Metadata URI template; {id} is the token id."
          },
          "created": {
            "type": "object",
            "required": [
              "date"
            ],
            "additionalProperties": false,
            "properties": {
              "block": {
                "type": "integer",
                "minimum": 1
              },
              "tx": {
                "type": "string",
                "pattern": "^0x[0-9a-f]{64}$"
              },
              "date": {
                "type": "string",
                "anyOf": [
                  {
                    "format": "date"
                  },
                  {
                    "format": "date-time"
                  }
                ]
              }
            }
          }
        }
      }
    }
  }
}
