After creating a new project or loading an existing one, the Files hierarchy will list all currently available contracts and application files on the left side menu (Explorer button).
The contract files are listed inside the contracts folder, while the application files are contained in the app folder. Folders or directories can be expanded by clicking the arrow next to the folder name.
Open and edit
Following the Hello World template as an example, open the HelloWorld.sol file by clicking the contract name on the menu, located inside the contracts folder. A window named after the contract file name will open on the main area, at the right side of the screen, with the code editor loaded.
Editing code is as simple as clicking inside the editor, changing the file and saving it by clicking the first button - Save - presented in the editor top bar (the disk icon) or by pressing Ctrl+S (Cmd+S on Mac). Please note that projects and files are saved to an external storage and they are subject to that service. Always export the project when a backup is required.
Each contract file contains a set of configurations. Contract configurations can be accessed by clicking the fourth button - Configure - in the editor top bar (the gear icon). A modal window named Configure Contract opens up. Alternatively, it is possible to open the configuration settings by expanding the HelloWorld.sol file clicking the arrow indicator next to the contract name in the Files hierarchy, located in the left side menu. Then, click the Configure button.
The available contract configuration options are the contract Name and the Constructor arguments. The contract Name is a text string used to target a specific contract defined inside the file being configured (useful when dealing with files defining multiple contracts). The Constructor arguments are crucial for generating a compiled binary with the added arguments and, most importantly, for deployment, given that they initialize the contract with data, when applicable. The available argument types are:
- account: a previously defined, existing account to reference to
- value: any value, for example, a string
- array: a comma-separated list of arguments
Constructor arguments can be added by clicking the plus icon below the No. args label in the Constructor arguments section. Removing arguments can be done by clicking the delete button (the trash can icon). In the Hello World template example, the single constructor argument for the HelloWorld.sol contract is set to "Hello World!". After modifying the contract settings, click the Save button. Otherwise, cancel or close the window to discard changes.
Add and remove
In order to add new contract files to the contracts folder, click the New File button (document icon) located next to the contracts folder (or any folder) in the Files hierarchy, on the left side menu. It is possible to rename or move the files by clicking Rename button (pencil icon) next to the contract name in the Files hierarchy. Contracts can be deleted by clicking the Delete contract button (the trash can icon).
For better organizing files, it is always possible to group them up by folders, by clicking the New Folder button and moving files into it. All the actions can also be accessed via the context menu, by clicking with the right mouse button in Files hierarchy.