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.
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 browser storage and they are subject to browser behavior, cache, and history. Always download 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 new window named Edit Contract HelloWorld opens up in the main area, splitting up the view. Alternatively, it is possible to open the configuration settings into a new window 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. Actions triggered from the editor top bar result in successive window splits while doing the same actions from the left side menu will always open the content in a new separate window if such window is not already open.
The available contract configuration options are the contract name and the constructor arguments. The contract name is the file name and it must match the actual contract name definition. 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
- contract: a previously defined, existing contract to reference to
- value: any value, for example, a string
Constructor arguments can be added by clicking the plus icon next to the contract name 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 Wodl!". After modifying the contract settings, click the Save button and the window will automatically close.
Add and remove
In order to add new contract files to the contracts folder, click the New contract button (document icon) located next to the contracts folder in the Files hierarchy, on the left side menu. It is possible to rearrange the order in which the contracts appear by clicking the up or down arrows next to the contract name in the Files hierarchy. Contracts can be deleted by clicking the Delete contract button (the trash can icon).