Having opened a project in Ethereum Studio, you will have access to the files of the project on the left. Right clicking on the root (Files hierarchy) or any of the folders will reveal the context menu.
Clicking on Import File in the context menu opens a modal, where you can import smart-contracts from different libraries. The imported files are placed in the node_modules directory.
The modal is divided into three resizable columns:
- In the first column, users can select the library of their choice.
- The middle column is used for selecting any particular smart contract (e.g.: ERC20, SafeMath, etc.), organized in folders.
- The last column is used for displaying information about the particular selected library or, in case a smart-contract has been selected, showing the name of the chosen smart contract and its source code.
Currently, the only supported library is the OpenZeppelin, which provides secure implementations of different Solidity components to be used in your own project.
If a smart-contract has been selected, the Import button can be clicked. This imports the selected smart contract and its dependencies to the project.
In this example, the Crowdsale.sol smart contract from the crowdsale directory has been imported to the project. As you can see not only the selected smart contract itself, but its dependencies have also been imported.
Now you know how to use this feature to import files into your own projects effortlessly and avoiding unnecessary copy-pasting :)