You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the ``--base-path`` and ``--include-path`` options to describe the layout of your project.
33
+
``--base-path`` represents the root of your own source tree while ``--include-path`` allows you to
34
+
specify extra locations containing external code (e.g. libraries installed with a package manager).
35
+
36
+
Note: ensure that all the files you specify on the command line are located inside the base path or
37
+
one of the include paths.
38
+
The compiler refers to files from outside of these directories using absolute paths.
39
+
Having absolute paths in contract metadata will result in your bytecode being reproducible only
40
+
when it's placed in these exact absolute locations.
41
+
29
42
Note: this commandline interface is not compatible with `solc` provided by the Solidity compiler package and thus cannot be
30
43
used in combination with an Ethereum client via the `eth.compile.solidity()` RPC method. Please refer to the
31
44
[Solidity compiler documentation](https://solidity.readthedocs.io/) for instructions to install `solc`.
32
45
Furthermore, the commandline interface to solc-js provides fewer features than the binary release.
33
-
One of the missing features is automatic loading of files from the filesystem if they are not explicitly
34
-
mentioned on the command line.
35
46
36
47
### Usage in Projects
37
48
@@ -44,13 +55,14 @@ There are two ways to use `solc`:
44
55
45
56
The high-level API consists of a single method, `compile`, which expects the [Compiler Standard Input and Output JSON](https://solidity.readthedocs.io/en/v0.5.0/using-the-compiler.html#compiler-input-and-output-json-description).
46
57
47
-
It also accepts an optional callback function to resolve unmet dependencies. This callback receives a path and must synchronously return either an error or the content of the dependency as a string.
48
-
It cannot be used together with callback-based, asynchronous, filesystem access. A workaround is to collect the names of dependencies, return an error, and keep re-running the compiler until all
49
-
of them are resolved.
58
+
It also accepts an optional set of callback functions, which include the ``import`` and the ``smtSolver`` callbacks.
59
+
Starting 0.6.0 it only accepts an object in place of the callback to supply the callbacks.
50
60
51
-
Starting 0.5.12 it also accepts an object in place of the callback to supply different kind of callbacks, however only file imports are supported.
52
-
53
-
_Note_: as an intermittent backwards compatibility feature, between versions 0.5.0 and 0.5.2, `compileStandard` and `compileStandardWrapper` also exists and behave like `compile` does.
61
+
The ``import`` callback function is used to resolve unmet dependencies.
62
+
This callback receives a path and must synchronously return either an error or the content of the dependency
63
+
as a string. It cannot be used together with callback-based, asynchronous,
64
+
filesystem access. A workaround is to collect the names of dependencies, return
65
+
an error, and keep re-running the compiler until all of them are resolved.
54
66
55
67
#### Example usage without the import callback
56
68
@@ -117,10 +129,7 @@ function findImports(path) {
117
129
elsereturn { error:'File not found' };
118
130
}
119
131
120
-
// Current syntax
121
-
var output =JSON.parse(solc.compile(JSON.stringify(input), findImports));
122
-
123
-
// New syntax (supported from 0.5.12)
132
+
// New syntax (supported from 0.5.12, mandatory from 0.6.0)
0 commit comments