blob: 445162f52a95834abb185e931ad4702c63140129 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
********************************
Layout of a Solidity Source File
********************************
Source files can contain an arbitrary number of contract definitions and include directives.
.. index:: source file, ! import
Importing other Source Files
============================
Other source files can be referenced using `import "filename";` and the symbols
defined there will also be available in the current source file.
.. warning::
Import will not work automatically for the commandline-compiler.
Furthermore, this system of importing other files is not completely fleshed out
yet, so please expect changes.
The `browser-based compiler <https://chriseth.github.io/browser-solidity>`_
has quite advanced support for multiple files and can even import files
directly from github, by using e.g.
```import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol";```
If you want to use multiple source files with the (commandline compiler)[../commandline-compiler/] solc,
you have to specify all files you will use as arguments to solc,
the compiler will not yet search your filesystem on its own.
.. index:: ! comment, natspec
Comments
========
Single-line comments (`//`) and multi-line comments (`/*...*/`) are possible.
There are special types of comments called natspec comments
(documentation yet to be written). These are introduced by
triple-slash comments (`///`) or using double asterisks (`/** ... */`).
Right in front of function declarations or statements,
you can use doxygen-style tags inside them to document functions, annotate conditions for formal
verification and provide a **confirmation text** that is shown to users if they want to
invoke a function.
|