From 8958cb908a19898bb27fe6942a1eca434c814acf Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Tue, 9 Apr 2024 16:11:36 -0700 Subject: [PATCH] Updated template with solc, env, gitignore --- .env.example | 27 +++++++++++++++++++++++++++ .envrc.example | 27 --------------------------- .github/workflows/coverage.yml | 3 ++- .gitignore | 11 +++++++++++ .prettierrc | 2 +- .solhint.json | 2 +- foundry.toml | 2 +- script/Foo.s.sol | 2 +- src/Foo.sol | 2 +- test/Foo.t.sol | 2 +- 10 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 .env.example delete mode 100644 .envrc.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3f8e331 --- /dev/null +++ b/.env.example @@ -0,0 +1,27 @@ +# Mnemonic phrase +MNEMONIC="" + +# Private key +PRIVATE_KEY="" + +# Mainnet RPC URLs +MAINNET_RPC_URL="" +ARBITRUM_RPC_URL="" +OPTIMISM_RPC_URL="" + +# Testnet RPC URLs +SEPOLIA_RPC_URL="" +ARBITRUM_SEPOLIA_RPC_URL="" +OPTIMISM_SEPOLIA_RPC_URL="" + +# Used for verifying contracts on Etherscan +ETHERSCAN_API_KEY="" +ARBITRUM_ETHERSCAN_API_KEY="" +OPTIMISM_ETHERSCAN_API_KEY="" +POLYGONSCAN_API_KEY="" + +# Used to run Hardhat scripts in fork mode +FORK_ENABLED=true + +# Used to report gas usage when running Forge tests +FORGE_GAS_REPORT=true diff --git a/.envrc.example b/.envrc.example deleted file mode 100644 index 3290889..0000000 --- a/.envrc.example +++ /dev/null @@ -1,27 +0,0 @@ -# Mnemonic phrase -export MNEMONIC="" - -# Private key -export PRIVATE_KEY="" - -# Mainnet RPC URLs -export MAINNET_RPC_URL="" -export ARBITRUM_RPC_URL="" -export OPTIMISM_RPC_URL="" - -# Testnet RPC URLs -export SEPOLIA_RPC_URL="" -export ARBITRUM_SEPOLIA_RPC_URL="" -export OPTIMISM_SEPOLIA_RPC_URL="" - -# Used for verifying contracts on Etherscan -export ETHERSCAN_API_KEY="" -export ARBITRUM_ETHERSCAN_API_KEY="" -export OPTIMISM_ETHERSCAN_API_KEY="" -export POLYGONSCAN_API_KEY="" - -# Used to run Hardhat scripts in fork mode -export FORK_ENABLED=true - -# Used to report gas usage when running Forge tests -export FORGE_GAS_REPORT=true diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3225192..e899c04 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -7,6 +7,7 @@ env: jobs: forge: + environment: ci strategy: fail-fast: true permissions: @@ -50,5 +51,5 @@ jobs: uses: zgosalvez/github-actions-report-lcov@v1.5.0 with: coverage-files: lcov.info - minimum-coverage: 90 + minimum-coverage: 100 github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 8ba5f15..4055aef 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,18 @@ out/ /broadcast/*/31337/ /broadcast/**/dry-run/ +# Mac .DS_Store + +# Secrets +.env .envrc + +# Coverage lcov.info + +# VS Code +.history + +# Modules node_modules diff --git a/.prettierrc b/.prettierrc index 6aa5b6c..2a85410 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ { "files": "*.sol", "options": { - "compiler": "0.8.21", + "compiler": "0.8.24", "bracketSpacing": true, "printWidth": 120, "tabWidth": 4 diff --git a/.solhint.json b/.solhint.json index 627068c..8637181 100644 --- a/.solhint.json +++ b/.solhint.json @@ -3,7 +3,7 @@ "plugins": ["prettier"], "rules": { "avoid-low-level-calls": "off", - "compiler-version": ["error", "0.8.21"], + "compiler-version": ["error", "0.8.24"], "func-visibility": "off", "no-empty-blocks": "off", "no-inline-assembly": "off" diff --git a/foundry.toml b/foundry.toml index f245684..8e10681 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,7 +3,7 @@ src = 'src' out = 'out' test = 'test' libs = ['lib'] -solc = "0.8.21" +solc = "0.8.24" fs_permissions = [{ access = "read", path = "./broadcast" }] gas_reports = ["Foo"] diff --git a/script/Foo.s.sol b/script/Foo.s.sol index 5ebcf9b..47d35ed 100644 --- a/script/Foo.s.sol +++ b/script/Foo.s.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.21; +pragma solidity ^0.8.24; import { Script } from "forge-std/Script.sol"; import { Foo } from "../src/Foo.sol"; diff --git a/src/Foo.sol b/src/Foo.sol index 5d193b6..1bf1320 100644 --- a/src/Foo.sol +++ b/src/Foo.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.21; +pragma solidity ^0.8.24; contract Foo { function getFoo() external pure returns (string memory) { diff --git a/test/Foo.t.sol b/test/Foo.t.sol index 375e1bb..101faee 100644 --- a/test/Foo.t.sol +++ b/test/Foo.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.21; +pragma solidity ^0.8.24; import "forge-std/Test.sol";