Documentation changes.

This commit is contained in:
chriseth 2020-05-13 16:53:54 +02:00
parent af44c05f1a
commit 0148525aee
3 changed files with 43 additions and 3 deletions

View File

@ -31,8 +31,12 @@ Storage Example
}
}
The first line tells you that the source code is written for
Solidity version 0.4.0, or a newer version of the language up to, but not including version 0.7.0.
The first line tells you that the source code is licensed under the
GPL version 3.0. Machine-readable license specifiers are important
in a setting where publishing the source code is the default.
The next line specifies that the source code is written for
Solidity version 0.4.16, or a newer version of the language up to, but not including version 0.7.0.
This is to ensure that the contract is not compilable with a new (breaking) compiler version, where it could behave differently.
:ref:`Pragmas<pragma>` are common instructions for compilers about how to treat the
source code (e.g. `pragma once <https://en.wikipedia.org/wiki/Pragma_once>`_).

View File

@ -7,6 +7,38 @@ Source files can contain an arbitrary number of
:ref:`pragma directives<pragma>` and
:ref:`struct<structs>` and :ref:`enum<enums>` definitions.
.. index:: ! license, spdx
SPDX License Identifier
=======================
Trust in smart contract can be better established if their source code
is available. Since making source code available always touches on legal problems
with regards to copyright, the Solidity compiler encouranges the use
of machine-readable `SPDX license identifiers <https://spdx.org>`_.
Every source file should start with a comment indicating its license:
``// SPDX-License-Identifier: MIT``
The compiler does not validate that the license is part of the
`list allowed by SPDX <https://spdx.org/licenses/>`_, but
it does include the supplied string in the `bytecode metadata <metadata>`_.
If you do not want to specify a license or if the source code is
not open-source, please use the special value ``UNLICENSED``.
Supplying this comment of course does not free you from other
obligations related to licensing like having to mention
a specific license header in each source file or the
original copyright holder.
The comment is recognized by the compiler anywhere in the file at the
file level, but it is recommended to put it at the top of the file.
More information about how to use SPDX license identifiers
can be found at the `SPDX website <https://spdx.org/ids-how>`_.
.. index:: ! pragma
.. _pragma:

View File

@ -1,3 +1,5 @@
.. _metadata:
#################
Contract Metadata
#################
@ -54,7 +56,9 @@ explanatory purposes.
// Required (unless "content" is used, see below): Sorted URL(s)
// to the source file, protocol is more or less arbitrary, but a
// Swarm URL is recommended
"urls": [ "bzzr://56ab..." ]
"urls": [ "bzzr://56ab..." ],
// Optional: SPDX license identifier as given in the source file
"license": "MIT"
},
"destructible": {
// Required: keccak256 hash of the source file