Skip to content

Commit

Permalink
Merge pull request #3066 from MATsxm/patch-1
Browse files Browse the repository at this point in the history
Update compile.md
  • Loading branch information
ryestew committed May 23, 2022
2 parents cdddac0 + 402141d commit fcd1d9e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions docs/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ Compiler (Solidity)

Clicking the Solidity icon in the icon panel brings you to the Solidity Compiler.

Compiling is triggered when you click the compile button ( **F. in image below**). If you want the file to be compiled each time the file is saved or when another file is selected - check the auto compile checkbox ( **D. in image below**).
Compiling is triggered when you click the compile button (**F. in image below**). If you want the file to be compiled each time the file is saved or when another file is selected - check the auto compile checkbox (**D. in image below**).

### Solidity versions & Remix functionality
Since the Solidity version `0.5.7`, it is possible to compile `Yul` files. Please read the ([solidity documentation about Yul](https://solidity.readthedocs.io/en/latest/yul.html)) which contain some code examples.
You can use the language dropdown ( **B. in image below**) to switch the language. **This dropdown list is only available for versions greater than or equal to `0.5.7`.**
You can use the language dropdown (**B. in image below**) to switch the language. **This dropdown list is only available for versions greater than or equal to `0.5.7`.**

You can compile (and deploy) contracts with versions of Solidity **older than 0.4.12**.
However, the older compilers use a legacy AST — which we no longer support. Consequently, some plugins may not work and some functionality - like source highlighting in the Editor may only be partially working.

### Select an Ethereum fork
The "fork selection" dropdown list ( **C. in image below**) allows to compile code against a specific **ethereum hard fork**.
The `compiler default` corresponds to the default hard fork used by a specific version.
The "fork selection" dropdown list (**C. in image below**) allows to compile code against a specific **ethereum hard fork**.
The `compiler default` corresponds to the default hard fork used by a specific version.

To see the name of the hard fork used in the current compilation, click the "Compilation Details" button( **H. in image below**) and in the `Metadata` section will be a sub-section called **settings**. Open up the **settings** to see the hard fork's name.
To see the name of the hard fork used in the current compilation, click the "Compilation Details" button(**H. in image below**) and in the `Metadata` section will be a sub-section called **settings**. Open up the **settings** to see the hard fork's name.

![](images/a-sol-compiler.png)

Expand All @@ -26,9 +26,9 @@ If a contract has a lot of dependencies it can take a while to compile - so you
### Enable optimization
According to the the Solidity Docs, "the optimizer tries to simplify complicated expressions, which reduces both code size and execution cost, i.e., it can reduce gas needed for contract deployment as well as for external calls made to the contract."

For recent versions of Solidity, it is [recommended to enable optimization](https://blog.soliditylang.org/2020/11/04/solidity-ama-1-recap/#why-do-you-think-people-are-generally-suspicious-of-the-optimizer-and-are-they-right-to-be) .
For recent versions of Solidity, it is [recommended to enable optimization](https://blog.soliditylang.org/2020/11/04/solidity-ama-1-recap/#why-do-you-think-people-are-generally-suspicious-of-the-optimizer-and-are-they-right-to-be) .

To learn more about optimization, ( **F. in the image**) visit the [Solidity docs on the optimizer](https://docs.soliditylang.org/en/latest/internals/optimizer.html).
To learn more about optimization, (**F. in the image**) visit the [Solidity docs on the optimizer](https://docs.soliditylang.org/en/latest/internals/optimizer.html).

To the right of the **Enable optimization** checkbox is the box to input the number of Optimization runs. The default value is 200.

Expand All @@ -40,24 +40,23 @@ To learn more about the optimization runs, visit the [Solidity docs about Optimi

### Compilation Details and Publishing

Because a solidity file can include multiple contracts and because contracts can import other contracts, **multiple contracts are often compiled**. **However**, only 1 contract's compilation details can be retrieved at a time.
Because a solidity file can include multiple contracts and because contracts can import other contracts, **multiple contracts are often compiled**. **However**, only 1 contract's compilation details can be retrieved at a time.

To select the desired contract, use the **Contract select box** ( **G. in the image**).
To select the desired contract, use the **Contract select box** (**G. in the image**).

Using the publish button, you can upload your contract to Swarm (only non
abstract contracts can be published) & IPFS.
Using the publish button, you can upload your contract to Swarm (only non abstract contracts can be published) & IPFS.

When publishing contracts that import other contract, the main contract and all of its imported contracts will be published - each to their own address.

**Published data contains the `abi` and the solidity source code.**

After a contract is published, **a modal will pop up**. This modal contains the contract's address as well as the addreses of the contracts that it imported and the address of the contract's **metadata**.

When the "Compilation Details" button is clicked ( **H. in image**), a modal opens displaying detailed information about the current selected contract.
When the "Compilation Details" button is clicked (**H. in image**), a modal opens displaying detailed information about the current selected contract.

### Compilation Errors and Warning
Compilation Errors and Warning are displayed below the contract section.
At each compilation, the static analysis tab builds a report.
At each compilation, the static analysis tab builds a report.

It is important to address reported issues even if the compiler doesn't complain. ([see more](static_analysis.html))

Expand Down

0 comments on commit fcd1d9e

Please sign in to comment.