Skip to content

Commit 504b8d2

Browse files
authored
Merge pull request #8907 from ethereum/licenseIdentifier
Check for SPDX license identifiers.
2 parents ca9dee4 + d33b67b commit 504b8d2

File tree

247 files changed

+745
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+745
-225
lines changed

docs/050-breaking-changes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Consider you have the following pre-0.5.0 contract already deployed:
292292

293293
::
294294

295+
// SPDX-License-Identifier: GPL-3.0
295296
pragma solidity ^0.4.25;
296297
// This will report a warning until version 0.4.25 of the compiler
297298
// This will not compile after 0.5.0
@@ -309,6 +310,7 @@ This will no longer compile with Solidity v0.5.0. However, you can define a comp
309310

310311
::
311312

313+
// SPDX-License-Identifier: GPL-3.0
312314
pragma solidity >=0.5.0 <0.7.0;
313315
interface OldContract {
314316
function someOldFunction(uint8 a) external;
@@ -326,6 +328,7 @@ Given the interface defined above, you can now easily use the already deployed p
326328

327329
::
328330

331+
// SPDX-License-Identifier: GPL-3.0
329332
pragma solidity >=0.5.0 <0.7.0;
330333

331334
interface OldContract {
@@ -347,6 +350,7 @@ commandline compiler for linking):
347350
::
348351

349352
// This will not compile after 0.6.0
353+
// SPDX-License-Identifier: GPL-3.0
350354
pragma solidity >=0.5.0 <0.5.99;
351355

352356
library OldLibrary {
@@ -370,6 +374,7 @@ Old version:
370374

371375
::
372376

377+
// SPDX-License-Identifier: GPL-3.0
373378
pragma solidity ^0.4.25;
374379
// This will not compile after 0.5.0
375380

@@ -432,6 +437,7 @@ New version:
432437

433438
::
434439

440+
// SPDX-License-Identifier: GPL-3.0
435441
pragma solidity >=0.5.0 <0.5.99;
436442
// This will not compile after 0.6.0
437443

docs/abi-spec.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ Given the contract:
232232

233233
::
234234

235+
// SPDX-License-Identifier: GPL-3.0
235236
pragma solidity >=0.4.16 <0.7.0;
236237

237238
contract Foo {
@@ -535,6 +536,7 @@ For example,
535536

536537
::
537538

539+
// SPDX-License-Identifier: GPL-3.0
538540
pragma solidity >=0.5.0 <0.7.0;
539541

540542

@@ -583,6 +585,7 @@ As an example, the code
583585

584586
::
585587

588+
// SPDX-License-Identifier: GPL-3.0
586589
pragma solidity >=0.4.19 <0.7.0;
587590
pragma experimental ABIEncoderV2;
588591

docs/assembly.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ without a compiler change.
4141

4242
.. code::
4343
44+
// SPDX-License-Identifier: GPL-3.0
4445
pragma solidity >=0.4.16 <0.7.0;
4546
4647
library GetCode {
@@ -66,6 +67,7 @@ efficient code, for example:
6667

6768
.. code::
6869
70+
// SPDX-License-Identifier: GPL-3.0
6971
pragma solidity >=0.4.16 <0.7.0;
7072
7173
@@ -136,6 +138,7 @@ Local Solidity variables are available for assignments, for example:
136138

137139
.. code::
138140
141+
// SPDX-License-Identifier: GPL-3.0
139142
pragma solidity >=0.4.16 <0.7.0;
140143
141144
contract C {

docs/common-patterns.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ you receive the funds of the person who is now the richest.
2727

2828
::
2929

30+
// SPDX-License-Identifier: GPL-3.0
3031
pragma solidity >=0.5.0 <0.7.0;
3132

3233
contract WithdrawalContract {
@@ -60,6 +61,7 @@ This is as opposed to the more intuitive sending pattern:
6061

6162
::
6263

64+
// SPDX-License-Identifier: GPL-3.0
6365
pragma solidity >=0.5.0 <0.7.0;
6466

6567
contract SendContract {
@@ -121,6 +123,7 @@ restrictions highly readable.
121123

122124
::
123125

126+
// SPDX-License-Identifier: GPL-3.0
124127
pragma solidity >=0.4.22 <0.7.0;
125128

126129
contract AccessRestriction {
@@ -273,6 +276,7 @@ function finishes.
273276

274277
::
275278

279+
// SPDX-License-Identifier: GPL-3.0
276280
pragma solidity >=0.4.22 <0.7.0;
277281

278282
contract StateMachine {

docs/contracts/abstract-contracts.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This can be done by using the ``abstract`` keyword as shown in the following exa
1313
defined as abstract, because the function ``utterance()`` was defined, but no implementation was
1414
provided (no implementation body ``{ }`` was given).::
1515

16+
// SPDX-License-Identifier: GPL-3.0
1617
pragma solidity >=0.6.0 <0.7.0;
1718

1819
abstract contract Feline {
@@ -22,6 +23,7 @@ provided (no implementation body ``{ }`` was given).::
2223
Such abstract contracts can not be instantiated directly. This is also true, if an abstract contract itself does implement
2324
all defined functions. The usage of an abstract contract as a base class is shown in the following example::
2425

26+
// SPDX-License-Identifier: GPL-3.0
2527
pragma solidity ^0.6.0;
2628

2729
abstract contract Feline {

docs/contracts/constant-state-variables.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Not all types for constants and immutables are implemented at this time. The onl
1717

1818
::
1919

20+
// SPDX-License-Identifier: GPL-3.0
2021
pragma solidity >0.6.4 <0.7.0;
2122

2223
contract C {

docs/contracts/creating-contracts.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This means that cyclic creation dependencies are impossible.
3434

3535
::
3636

37+
// SPDX-License-Identifier: GPL-3.0
3738
pragma solidity >=0.4.22 <0.7.0;
3839

3940

docs/contracts/events.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ is that they are cheaper to deploy and call.
6565

6666
::
6767

68+
// SPDX-License-Identifier: GPL-3.0
6869
pragma solidity >=0.4.21 <0.7.0;
6970

7071
contract ClientReceipt {
@@ -138,6 +139,7 @@ as topics. The event call above can be performed in the same way as
138139

139140
::
140141

142+
// SPDX-License-Identifier: GPL-3.0
141143
pragma solidity >=0.4.10 <0.7.0;
142144

143145
contract C {

docs/contracts/function-modifiers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ if they are marked ``virtual``. For details, please see
1717

1818
::
1919

20+
// SPDX-License-Identifier: GPL-3.0
2021
pragma solidity >=0.5.0 <0.7.0;
2122

2223
contract owned {

docs/contracts/functions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ unused parameters can be omitted.
2323
For example, if you want your contract to accept one kind of external call
2424
with two integers, you would use something like the following::
2525

26+
// SPDX-License-Identifier: GPL-3.0
2627
pragma solidity >=0.4.16 <0.7.0;
2728

2829
contract Simple {
@@ -55,6 +56,7 @@ Function return variables are declared with the same syntax after the
5556
For example, suppose you want to return two results: the sum and the product of
5657
two integers passed as function parameters, then you use something like::
5758

59+
// SPDX-License-Identifier: GPL-3.0
5860
pragma solidity >=0.4.16 <0.7.0;
5961

6062
contract Simple {
@@ -79,6 +81,7 @@ or you can provide return values
7981
(either a single or :ref:`multiple ones<multi-return>`) directly with the ``return``
8082
statement::
8183

84+
// SPDX-License-Identifier: GPL-3.0
8285
pragma solidity >=0.4.16 <0.7.0;
8386

8487
contract Simple {
@@ -142,6 +145,7 @@ The following statements are considered modifying the state:
142145

143146
::
144147

148+
// SPDX-License-Identifier: GPL-3.0
145149
pragma solidity >=0.5.0 <0.7.0;
146150

147151
contract C {
@@ -187,6 +191,7 @@ In addition to the list of state modifying statements explained above, the follo
187191

188192
::
189193

194+
// SPDX-License-Identifier: GPL-3.0
190195
pragma solidity >=0.5.0 <0.7.0;
191196

192197
contract C {
@@ -280,6 +285,7 @@ Below you can see an example of a Sink contract that uses function ``receive``.
280285

281286
::
282287

288+
// SPDX-License-Identifier: GPL-3.0
283289
pragma solidity ^0.6.0;
284290

285291
// This contract keeps all Ether sent to it with no way
@@ -335,6 +341,7 @@ operations as long as there is enough gas passed on to it.
335341

336342
::
337343

344+
// SPDX-License-Identifier: GPL-3.0
338345
pragma solidity >=0.6.2 <0.7.0;
339346

340347
contract Test {
@@ -407,6 +414,7 @@ The following example shows overloading of the function
407414

408415
::
409416

417+
// SPDX-License-Identifier: GPL-3.0
410418
pragma solidity >=0.4.16 <0.7.0;
411419

412420
contract A {
@@ -425,6 +433,7 @@ externally visible functions differ by their Solidity types but not by their ext
425433

426434
::
427435

436+
// SPDX-License-Identifier: GPL-3.0
428437
pragma solidity >=0.4.16 <0.7.0;
429438

430439
// This will not compile
@@ -458,6 +467,7 @@ candidate, resolution fails.
458467

459468
::
460469

470+
// SPDX-License-Identifier: GPL-3.0
461471
pragma solidity >=0.4.16 <0.7.0;
462472

463473
contract A {

docs/contracts/inheritance.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Details are given in the following example.
3838

3939
::
4040

41+
// SPDX-License-Identifier: GPL-3.0
4142
pragma solidity ^0.6.0;
4243

4344

@@ -125,6 +126,7 @@ Note that above, we call ``Destructible.destroy()`` to "forward" the
125126
destruction request. The way this is done is problematic, as
126127
seen in the following example::
127128

129+
// SPDX-License-Identifier: GPL-3.0
128130
pragma solidity ^0.6.0;
129131

130132
contract owned {
@@ -154,6 +156,7 @@ A call to ``Final.destroy()`` will call ``Base2.destroy`` because we specify it
154156
explicitly in the final override, but this function will bypass
155157
``Base1.destroy``. The way around this is to use ``super``::
156158

159+
// SPDX-License-Identifier: GPL-3.0
157160
pragma solidity >=0.6.0 <0.7.0;
158161

159162
contract owned {
@@ -204,6 +207,7 @@ use the ``override`` keyword in the function header as shown in this example:
204207

205208
::
206209

210+
// SPDX-License-Identifier: GPL-3.0
207211
pragma solidity >=0.6.0 <0.7.0;
208212

209213
contract Base
@@ -227,6 +231,7 @@ bases, it has to explicitly override it:
227231

228232
::
229233

234+
// SPDX-License-Identifier: GPL-3.0
230235
pragma solidity >=0.6.0 <0.7.0;
231236

232237
contract Base1
@@ -253,6 +258,7 @@ that already overrides all other functions.
253258

254259
::
255260

261+
// SPDX-License-Identifier: GPL-3.0
256262
pragma solidity >=0.6.0 <0.7.0;
257263

258264
contract A { function f() public pure{} }
@@ -293,6 +299,7 @@ of the variable:
293299

294300
::
295301

302+
// SPDX-License-Identifier: GPL-3.0
296303
pragma solidity >=0.6.0 <0.7.0;
297304

298305
contract A
@@ -324,6 +331,7 @@ and the ``override`` keyword must be used in the overriding modifier:
324331

325332
::
326333

334+
// SPDX-License-Identifier: GPL-3.0
327335
pragma solidity >=0.6.0 <0.7.0;
328336

329337
contract Base
@@ -342,6 +350,7 @@ explicitly:
342350

343351
::
344352

353+
// SPDX-License-Identifier: GPL-3.0
345354
pragma solidity >=0.6.0 <0.7.0;
346355

347356
contract Base1
@@ -389,6 +398,7 @@ equivalent to ``constructor() public {}``. For example:
389398

390399
::
391400

401+
// SPDX-License-Identifier: GPL-3.0
392402
pragma solidity >=0.5.0 <0.7.0;
393403

394404
contract A {
@@ -419,6 +429,7 @@ The constructors of all the base contracts will be called following the
419429
linearization rules explained below. If the base constructors have arguments,
420430
derived contracts need to specify all of them. This can be done in two ways::
421431

432+
// SPDX-License-Identifier: GPL-3.0
422433
pragma solidity >=0.4.22 <0.7.0;
423434

424435
contract Base {
@@ -478,6 +489,7 @@ error "Linearization of inheritance graph impossible".
478489

479490
::
480491

492+
// SPDX-License-Identifier: GPL-3.0
481493
pragma solidity >=0.4.0 <0.7.0;
482494

483495
contract X {}
@@ -498,6 +510,7 @@ One area where inheritance linearization is especially important and perhaps not
498510

499511
::
500512

513+
// SPDX-License-Identifier: GPL-3.0
501514
pragma solidity >=0.4.22 <0.7.0;
502515

503516
contract Base1 {

docs/contracts/interfaces.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Interfaces are denoted by their own keyword:
2222

2323
::
2424

25+
// SPDX-License-Identifier: GPL-3.0
2526
pragma solidity >=0.6.2 <0.7.0;
2627

2728
interface Token {
@@ -42,6 +43,7 @@ inheritance.
4243

4344
::
4445

46+
// SPDX-License-Identifier: GPL-3.0
4547
pragma solidity >=0.6.2 <0.7.0;
4648

4749
interface ParentA {

0 commit comments

Comments
 (0)