JSON output - Building Secure Contracts (original) (raw)

Building Secure Contracts

Top-level Command Output

At the top level, the JSON output provided by slither will appear in the following format:

{
  "success": true,
  "error": null,
  "results": {}
}

Command Results

The underlying results item above will appear in the following format:

{
  "detectors": [],
  "upgradeability-check": {}
}

Detector Results

A detector result found in the detectors array above will be of the following format:

{
    "check": "...",
    "impact": "...",
    "confidence": "...",
    "description": "...",
    "elements": []
}

Detector Result Elements

Each element found in elements above is of the form:

{
  "type": "...",
  "name": "...",
  "source_mapping": {},
  "type_specific_fields": {},
  "additional_fields": {}
}

Source Mapping

Each source_mapping object is used to map an element to some portion of source. It is of the form:

"source_mapping": {
    "start": 45
    "length": 58,
    "filename_relative": "contracts/tests/constant.sol",
    "filename_absolute": "/tmp/contracts/tests/constant.sol",
    "filename_short": "tests/constant.sol",
    "filename_used": "contracts/tests/constant.sol",
    "lines": [
        5,
        6,
        7
     ],
     "starting_column": 1,
     "ending_column": 24,
}

Detector-specific additional fields

Some detectors have custom elements output via the additional_fields field of their result, or result elements. Annotations here will specify result or result-element to specify the location of the additional fields.

Slither Check Upgradeability

The slither-check-upgradeability tool also produces JSON output (with the use of the --json option). At the top level, this JSON output will appear in the format similar to that of Slither above:

{
  "success": true,
  "error": null,
  "results": {
    "upgradeability-check": {}
  }
}

Command Results

The underlying upgradeability-check item above will appear in the following format:

{
  "check-initialization": {},
  "check-initialization-v2": {},
  "compare-function-ids": {},
  "compare-variables-order-proxy": {},
  "compare-variables-order-implementation": {}
}