{
  "id": "contract-object.spec.json",
  "$schema": "http://json-schema.org/schema#",
  "title": "Contract Object",
  "description": "Describes a contract consumable by Truffle, possibly including deployed instances on networks",
  "type": "object",
  "properties": {
    "contractName": {
      "allOf": [
        {
          "$ref": "#/definitions/ContractName"
        },
        {
          "description": "Name used to identify the contract",
          "default": "Contract"
        }
      ]
    },
    "abi": {
      "allOf": [
        {
          "$ref": "abi.spec.json#"
        },
        {
          "description": "Interface description returned by compiler for source"
        }
      ]
    },
    "bytecode": {
      "allOf": [
        {
          "$ref": "#/definitions/Bytecode"
        },
        {
          "description": "Bytecode sent as contract-creation transaction data, with unresolved link references"
        }
      ]
    },
    "deployedBytecode": {
      "allOf": [
        {
          "$ref": "#/definitions/Bytecode"
        },
        {
          "description": "On-chain deployed contract bytecode, with unresolved link references"
        }
      ]
    },
    "sourceMap": {
      "allOf": [
        {
          "$ref": "#/definitions/SourceMap"
        },
        {
          "description": "Source mapping for contract-creation transaction data bytecode"
        }
      ]
    },
    "deployedSourceMap": {
      "allOf": [
        {
          "$ref": "#/definitions/SourceMap"
        },
        {
          "description": "Source mapping for contract bytecode"
        }
      ]
    },
    "source": {
      "$ref": "#/definitions/Source"
    },
    "sourcePath": {
      "$ref": "#/definitions/SourcePath"
    },
    "ast": {
      "$ref": "#/definitions/AST"
    },
    "compiler": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "networks": {
      "patternProperties": {
        "^[a-zA-Z0-9]+$": {
          "$ref": "network-object.spec.json#"
        }
      },
      "additionalProperties": false
    },
    "schemaVersion": {
      "$ref": "#/definitions/SchemaVersion"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": ["abi"],
  "patternProperties": {
    "^x-": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "object"
        },
        {
          "type": "array"
        }
      ]
    }
  },
  "additionalProperties": false,
  "definitions": {
    "ContractName": {
      "type": "string",
      "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
    },
    "Bytecode": {
      "type": "string",
      "pattern": "^0x0$|^0x([a-fA-F0-9]{2}|__.{38})+$"
    },
    "Source": {
      "type": "string"
    },
    "SourceMap": {
      "type": "string",
      "examples": [
        "315:637:1:-;;;452:55;;;;;;;-1:-1:-1;;;;;485:9:1;476:19;:8;:19;;;;;;;;;;498:5;476:27;;452:55;315:637;;;;;;;"
      ]
    },
    "SourcePath": {
      "type": "string"
    },
    "AST": {
      "type": "object"
    },
    "SchemaVersion": {
      "type": "string",
      "pattern": "[0-9]+\\.[0-9]+\\.[0-9]+"
    }
  }
}
