import * as React from 'react'; import { render, hydrate } from 'react-dom'; import * as Loadable from 'react-loadable'; import { Lead } from 'ts/components/Typography'; import context from 'ts/context/compiler'; import Base from 'ts/components/Base'; import Content from 'ts/components/Content'; import ContentBlock from 'ts/components/ContentBlock'; import Code from 'ts/components/Code'; import InlineCode from 'ts/components/InlineCode'; import CompilerComponent from 'ts/components/Compiler'; import Breakout from 'ts/components/Breakout'; import Hero from 'ts/components/Hero'; const Animation = Loadable({ loader: () => System.import(/* webpackChunkName: 'compiler-animation' */ 'ts/components/Animations/Compiler'), loading: () =>
, delay: 1000, }); function Compiler() { return (npm install @0x/sol-compiler --g
cd /your_project_dir && sol-compiler
Configure via a
mkdir compiler.json
Example of settings:
{`{
"contractsDir": "contracts",
"artifactsDir": "artifacts",
"contracts": "*",
"compilerSettings": {
"optimizer": { "enabled": false },
"outputSelection": {
"*": {
"*": ["abi", "evm.bytecode.object"]
}
}
}
}`}
Sol compiler uses solidity standard JSON output format for the artifacts. This way, you can define which parts of the artifact you need.
{`{
"compilerSettings": {
"outputSelection": {
"*": {
"*": ["abi"]
}
}
}
}`}
{`{
"compilerOutput": {
"abi": [...],
},
}`}
Sometimes you need to use some debuggers or other dev tools and you’ll need more info in the artifact.
{`{
"compilerSettings": {
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
]
}
}
}
}`}
{`{
"compilerOutput": {
"abi": [...],
"evm": {
"bytecode": {
"object": "0xdeadbeef",
"sourceMap": "26:480:..."
},
"deployedBytecode": {
"object": "0xdeadbeef",
"sourceMap": "26:480:0..."
}
}
}
"sources": {
"Migrations.sol": {
"id": 0
}
},
}`}