diff --git a/docs/assets/images/dev/setup/remix2.png b/docs/assets/images/dev/setup/remix2.png index dd0e809e7..dda83fc75 100644 Binary files a/docs/assets/images/dev/setup/remix2.png and b/docs/assets/images/dev/setup/remix2.png differ diff --git a/docs/dev/getting-started/setup/foundry.md b/docs/dev/getting-started/setup/foundry.md index 1e12cd6be..c2f253442 100644 --- a/docs/dev/getting-started/setup/foundry.md +++ b/docs/dev/getting-started/setup/foundry.md @@ -18,6 +18,7 @@ Foundry can quick-start your development by providing a sample project: ```bash forge init hello_foundry +cd hello_foundry ``` This creates a new directory `hello_foundry` from the default template which should look something like this: @@ -27,12 +28,21 @@ This creates a new directory `hello_foundry` from the default template which sho
Foundry project structure.
+Add the highlighted line to the `foundry.toml` file, to make sure the correct EVM version is used: + +```toml hl_lines="5" +[profile.default] +src = "src" +out = "out" +libs = ["lib"] +evm_version = "london" +``` + ### 3. Build the Contract To build the `Counter.sol` contract in the sample project run: ```bash -cd hello_foundry forge build ``` diff --git a/docs/dev/getting-started/setup/hardhat.md b/docs/dev/getting-started/setup/hardhat.md index 3c9a1cdae..6c934866c 100644 --- a/docs/dev/getting-started/setup/hardhat.md +++ b/docs/dev/getting-started/setup/hardhat.md @@ -122,7 +122,16 @@ require('dotenv').config(); require("@nomicfoundation/hardhat-toolbox"); module.exports = { - solidity: "0.8.24", + solidity: { + compilers: [ + { + version: "0.8.17", + settings: { + evmVersion: "london" + }, + } + ], + }, networks: { hardhat: { }, @@ -248,7 +257,16 @@ require("@nomicfoundation/hardhat-toolbox"); require("@nomicfoundation/hardhat-verify"); module.exports = { - solidity: "0.8.17", + solidity: { + compilers: [ + { + version: "0.8.17", + settings: { + evmVersion: "london" + }, + } + ], + }, networks: { hardhat: { }, diff --git a/docs/dev/getting-started/setup/remix.md b/docs/dev/getting-started/setup/remix.md index 255a50f4d..ec8fc1b46 100644 --- a/docs/dev/getting-started/setup/remix.md +++ b/docs/dev/getting-started/setup/remix.md @@ -49,6 +49,7 @@ contract HelloWorld { ### 3. Compile Your Contract * Go to the Solidity Compiler tab (on the left), and select compiler version `0.8.17`. +* Click on **Advanced Configurations**, and select `london` from the **EVM VERSION** drop down. * Now, click the **Compile HelloWorld.sol** button. After successful compilation, it will show a **Green tick mark** on the **Compiler** tab button. diff --git a/include/runner.md b/include/runner.md index 260f4e8ac..700ab1706 100644 --- a/include/runner.md +++ b/include/runner.md @@ -92,21 +92,36 @@ Get test currency from the faucet an ??? info "Building with Hardhat" 1. Create a new folder and move into it. - 2. Create a new Hardhat project (More information in [the Hardhat setup guide](/dev/getting-started/setup/hardhat/)): + 2. Initialize a new npm project and install dependencies: ```bash npm init - npm install hardhat @nomicfoundation/hardhat-toolbox + npm install hardhat @nomicfoundation/hardhat-toolbox @flarenetwork/flare-periphery-contracts + ``` + 3. Create a new Hardhat project (More information in [the Hardhat setup guide](/dev/getting-started/setup/hardhat/)): + ```bash npx hardhat init ``` - 3. You will not be using the sample project, therefore: + 4. You will not be using the sample project, therefore: * Remove `contracts/Lock.sol` * Remove `test/Lock.js` - 4. Add Flare's Periphery Package as a dependency with: - ```bash - npm install @flarenetwork/flare-periphery-contracts + 5. Edit `hardhat.config.js` to specify the correct EVM version. Make sure you include the highlighted lines: + ```js title="hardhat.config.js" hl_lines="5-12" + require("@nomicfoundation/hardhat-toolbox"); + + /** @type import('hardhat/config').HardhatUserConfig */ + module.exports = { + solidity: { + compilers: [{ + version: "0.8.17", + settings: { + evmVersion: "london" + }, + }], + } + }; ``` - 5. Copy the Solidity code above into a new file called `{{filename}}.sol` in the `contracts` folder. - 6. Compile with: + 6. Copy the Solidity code above into a new file called `{{filename}}.sol` in the `contracts` folder. + 7. Compile with: ```bash npx hardhat compile ``` @@ -117,13 +132,20 @@ Get test currency from the faucet an These instructions quickly show you how to use the former. 1. Build the Hardhat project following the previous instructions. - 2. Modify your `hardhat.config.js` to look like this: - ```js title="hardhat.config.js" + 2. Include network information in the `hardhat.config.js` file. Make sure you include the highlighted lines: + ```js title="hardhat.config.js" hl_lines="13-19" require("@nomicfoundation/hardhat-toolbox"); /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { - solidity: "0.8.19", + solidity: { + compilers: [{ + version: "0.8.17", + settings: { + evmVersion: "london" + }, + }], + }, networks: { hardhat: { forking: { @@ -164,8 +186,9 @@ Get test currency from the faucet an * Remove `src/Counter.sol` * Remove `test/Counter.t.sol` 6. Copy the Solidity code above into a new file called `{{filename}}.sol` in the `src` folder. - 7. Open the `foundry.toml` file, and add the following line at the end: + 7. Open the `foundry.toml` file, and add the following lines at the end: ```toml + evm_version = "london" remappings = [ "@flarenetwork/flare-periphery-contracts/=lib/flare-foundry-periphery-package/src/"] ``` 8. Compile with: @@ -189,7 +212,7 @@ Get test currency from the faucet an ``` === "Using Remix" - [Open In Remix](https://remix.ethereum.org/#url={{ config.site_url }}samples/{{folder}}{{filename}}.sol&evmVersion=paris){ .md-button } + [Open In Remix](https://remix.ethereum.org/#url={{ config.site_url }}samples/{{folder}}{{filename}}.sol&evmVersion=london){ .md-button } {% endmacro %}