diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..e032b53 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,9 @@ +## What's new in this PR? + +In bullet point format, please describe what's new in this PR. + +## Why? + +What problem does this solve? +Why is this important? +What's the context? diff --git a/nest/.github/workflows/test.yml b/.github/workflows/continuous-integration.yml similarity index 59% rename from nest/.github/workflows/test.yml rename to .github/workflows/continuous-integration.yml index 9282e82..5deca91 100644 --- a/nest/.github/workflows/test.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,6 +1,12 @@ -name: test +name: Continuous Integration -on: workflow_dispatch +on: + push: + branches: + - main + pull_request: + branches: + - main env: FOUNDRY_PROFILE: ci @@ -10,7 +16,7 @@ jobs: strategy: fail-fast: true - name: Foundry project + name: Build and Test Contracts runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -28,7 +34,12 @@ jobs: forge build --sizes id: build - - name: Run Forge tests + - name: Run Forge format run: | - forge test -vvv - id: test + forge fmt + id: format + + # - name: Run Forge tests + # run: | + # forge test -vvv + # id: test diff --git a/foundry-template/.gitignore b/foundry-template/.gitignore new file mode 100644 index 0000000..c38a98e --- /dev/null +++ b/foundry-template/.gitignore @@ -0,0 +1,15 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/*/18230/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/foundry-template/README.md b/foundry-template/README.md new file mode 100644 index 0000000..e38039d --- /dev/null +++ b/foundry-template/README.md @@ -0,0 +1,9 @@ +## Foundry Template Setup + +Copy this folder to start a new Foundry project, then run the following to initialize the submodules: + +```bash +$ forge install foundry-rs/forge-std +$ forge install OpenZeppelin/openzeppelin-foundry-upgrades +$ forge install OpenZeppelin/openzeppelin-contracts-upgradeable +``` diff --git a/foundry-template/foundry.toml b/foundry-template/foundry.toml new file mode 100644 index 0000000..b5d5cbd --- /dev/null +++ b/foundry-template/foundry.toml @@ -0,0 +1,26 @@ +[profile.default] +solc = "0.8.25" +evm_version = "cancun" +src = "src" +out = "out" +libs = ["lib"] +ffi = true +ast = true +build_info = true +extra_output = ["storageLayout"] + +[fmt] +single_line_statement_blocks = "multi" +multiline_func_header = "params_first" +sort_imports = true +contract_new_lines = true +bracket_spacing = true +int_types = "long" +quote_style = "double" +number_underscore = "thousands" +wrap_comments = true + +remappings = [ + "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", + "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", +] diff --git a/nest/.gitignore b/nest/.gitignore index 85198aa..c38a98e 100644 --- a/nest/.gitignore +++ b/nest/.gitignore @@ -5,6 +5,7 @@ out/ # Ignores development broadcast logs !/broadcast /broadcast/*/31337/ +/broadcast/*/18230/ /broadcast/**/dry-run/ # Docs diff --git a/nest/foundry.toml b/nest/foundry.toml index 25b918f..b5d5cbd 100644 --- a/nest/foundry.toml +++ b/nest/foundry.toml @@ -1,6 +1,26 @@ [profile.default] +solc = "0.8.25" +evm_version = "cancun" src = "src" out = "out" libs = ["lib"] +ffi = true +ast = true +build_info = true +extra_output = ["storageLayout"] -# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options +[fmt] +single_line_statement_blocks = "multi" +multiline_func_header = "params_first" +sort_imports = true +contract_new_lines = true +bracket_spacing = true +int_types = "long" +quote_style = "double" +number_underscore = "thousands" +wrap_comments = true + +remappings = [ + "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", + "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", +] diff --git a/nest/script/Counter.s.sol b/nest/script/Counter.s.sol deleted file mode 100644 index df9ee8b..0000000 --- a/nest/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Script, console} from "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/nest/src/Counter.sol b/nest/src/Counter.sol deleted file mode 100644 index aded799..0000000 --- a/nest/src/Counter.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -contract Counter { - uint256 public number; - - function setNumber(uint256 newNumber) public { - number = newNumber; - } - - function increment() public { - number++; - } -} diff --git a/nest/test/Counter.t.sol b/nest/test/Counter.t.sol deleted file mode 100644 index 54b724f..0000000 --- a/nest/test/Counter.t.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console} from "forge-std/Test.sol"; -import {Counter} from "../src/Counter.sol"; - -contract CounterTest is Test { - Counter public counter; - - function setUp() public { - counter = new Counter(); - counter.setNumber(0); - } - - function test_Increment() public { - counter.increment(); - assertEq(counter.number(), 1); - } - - function testFuzz_SetNumber(uint256 x) public { - counter.setNumber(x); - assertEq(counter.number(), x); - } -}