Compiling a Contract
Do the following in the Remix IDE:
- Create a new blank workspace using the File Explorer.
- Create a new file and name it Storage.sol.
- Copy the below code and paste it into Storage.sol. This code is from the Solidity tutorial.
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.16 <0.9.0; contract SimpleStorage { uint storedData; function set(uint x) public { storedData = x; } function get() public view returns (uint) { return storedData; } }
- Click on the Solidity compiler icon and click on the Compile Storage.sol to compile the contract.
- Introduce a bug in Storage.sol by changing the line
uint storeData;
touint store;
. Click the Compile Storage.sol button again and check that errors are reported. - Undo the bug and continue with the next section.