Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 1.81 KB

File metadata and controls

65 lines (43 loc) · 1.81 KB

30 Days Of Solidity: Licenses and Pragma

Twitter Follow

Author: Vedant Chainani
June, 2022

Day 2 >>

Day X


📔 Day 1

Licenses

// SPDX-License-Identifier: License Name

SPDX license identifiers should be added to the top of contract files. The license should be from one of the following: https://spdx.org/licenses/.

⚠️ If the license identifier isn’t included in the contract file the compiler will now show a warning.

❗ If there are multiple license identifiers in the contract file the compiler will now show an error.

eg -

// SPDX-License-Identifier: MIT

Pragma

In Solidity the pragma keyword is used to configure compiler features and checks. The pragma directive is always local to the current file and is not global. Hence to make it applicable in your entire project of Solidity you have to include pragma directive in every file to work.

The first line is a pragma directive which tells that the source code is written for which Solidity version.

pragma solidity ^0.8.7;
// Anything above 0.8.7

pragma solidity >=0.8.0 <0.9.0;
// Anything between 0.8.0 to 0.9.0 where 0.9.0 is not included.

pragma solidity 0.8.7;
// Only Version 0.8.7

Day 2 >>