docs: Fix syntax errors in JSON snippets and enable JavaScript highlighting for them

This commit is contained in:
Kamil Śliwak
2021-07-15 10:14:00 +02:00
parent f3a5c27852
commit 235a39eaef
3 changed files with 51 additions and 52 deletions
+34 -34
View File
@@ -31,24 +31,24 @@ reduce whitespace to a minimum and sort the keys of all objects to arrive at a
unique formatting. Comments are not permitted and used here only for
explanatory purposes.
.. code-block:: none
.. code-block:: javascript
{
// Required: The version of the metadata format
version: "1",
"version": "1",
// Required: Source code language, basically selects a "sub-version"
// of the specification
language: "Solidity",
"language": "Solidity",
// Required: Details about the compiler, contents are specific
// to the language.
compiler: {
"compiler": {
// Required for Solidity: Version of the compiler
version: "0.4.6+commit.2dabbdf0.Emscripten.clang",
"version": "0.4.6+commit.2dabbdf0.Emscripten.clang",
// Optional: Hash of the compiler binary which produced this output
keccak256: "0x123..."
"keccak256": "0x123..."
},
// Required: Compilation source files/source units, keys are file names
sources:
"sources":
{
"myFile.sol": {
// Required: keccak256 hash of the source file
@@ -68,59 +68,59 @@ explanatory purposes.
}
},
// Required: Compiler settings
settings:
"settings":
{
// Required for Solidity: Sorted list of remappings
remappings: [ ":g=/dir" ],
"remappings": [ ":g=/dir" ],
// Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
// and are only given for backwards-compatibility.
optimizer: {
enabled: true,
runs: 500,
details: {
"optimizer": {
"enabled": true,
"runs": 500,
"details": {
// peephole defaults to "true"
peephole: true,
"peephole": true,
// inliner defaults to "true"
inliner: true,
"inliner": true,
// jumpdestRemover defaults to "true"
jumpdestRemover: true,
orderLiterals: false,
deduplicate: false,
cse: false,
constantOptimizer: false,
yul: true,
"jumpdestRemover": true,
"orderLiterals": false,
"deduplicate": false,
"cse": false,
"constantOptimizer": false,
"yul": true,
// Optional: Only present if "yul" is "true"
yulDetails: {
stackAllocation: false,
optimizerSteps: "dhfoDgvulfnTUtnIf..."
"yulDetails": {
"stackAllocation": false,
"optimizerSteps": "dhfoDgvulfnTUtnIf..."
}
}
},
metadata: {
"metadata": {
// Reflects the setting used in the input json, defaults to false
useLiteralContent: true,
"useLiteralContent": true,
// Reflects the setting used in the input json, defaults to "ipfs"
bytecodeHash: "ipfs"
}
"bytecodeHash": "ipfs"
},
// Required for Solidity: File and name of the contract or library this
// metadata is created for.
compilationTarget: {
"compilationTarget": {
"myFile.sol": "MyContract"
},
// Required for Solidity: Addresses for libraries used
libraries: {
"libraries": {
"MyLib": "0x123123..."
}
},
// Required: Generated information about the contract.
output:
"output":
{
// Required: ABI definition of the contract
abi: [ ... ],
"abi": [/* ... */],
// Required: NatSpec user documentation of the contract
userdoc: [ ... ],
"userdoc": [/* ... */],
// Required: NatSpec developer documentation of the contract
devdoc: [ ... ],
"devdoc": [/* ... */]
}
}