Search⌘ K
AI Features

Source File Layout

Explore the layout of a Solidity source file by examining its key parts such as the SPDX license identifier, compiler pragmas, file imports, comments, and the contract definition. Understand how each section functions to build a solid foundation for smart contract development using Remix IDE.

Coding components

We learned about Remix and its basic features by writing a simple test contract. In this lesson, we’ll go through the different sections of the code to understand the components of a Solidity file and what each one does. Let’s begin with the file below:

Solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "hardhat/console.sol";
/**
* @title Contact
* @dev Store & retrieve contacts of friends and family
*/
contract Contact {
// contract code goes here.
}
  • Line 1: We ...