├── .gas-snapshot ├── img └── forge-template.png ├── src └── Contract.sol ├── .env.example ├── .gitignore ├── remappings.txt ├── .gitmodules ├── foundry.toml ├── test └── Contract.t.sol ├── .github └── workflows │ ├── ci.yml │ └── lint.yml ├── LICENSE └── README.md /.gas-snapshot: -------------------------------------------------------------------------------- 1 | TestContract:testBar() (gas: 401) 2 | -------------------------------------------------------------------------------- /img/forge-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pollum-io/forge-template/HEAD/img/forge-template.png -------------------------------------------------------------------------------- /src/Contract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Unlicense 2 | pragma solidity ^0.8.13; 3 | 4 | contract Contract { } 5 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | GOERLI_RPC_URL= 2 | MAINNET_RPC_URL 3 | TESTNET_PRIVATE_KEY= 4 | MAINNET_PRIVATE_KEY= 5 | ETHERSCAN_API_KEY= 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | .env 4 | .idea 5 | /node_modules/ 6 | /broadcast/ 7 | broadcast/** 8 | .DS_Store 9 | **/.DS_Store 10 | -------------------------------------------------------------------------------- /remappings.txt: -------------------------------------------------------------------------------- 1 | ds-test/=lib/forge-std/lib/ds-test/src/ 2 | forge-std/=lib/forge-std/src/ 3 | openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/ 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | path = lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | branch = v1.2.0 5 | [submodule "lib/openzeppelin-contracts"] 6 | path = lib/openzeppelin-contracts 7 | url = https://github.com/Openzeppelin/openzeppelin-contracts 8 | branch = v4.8.2 9 | -------------------------------------------------------------------------------- /foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | solc = "0.8.13" 6 | gas_reports = ["Contract"] 7 | 8 | [rpc_endpoints] 9 | goerli = "${GOERLI_RPC_URL}" 10 | 11 | [etherscan] 12 | goerli = { key = "${ETHERSCAN_API_KEY}" } 13 | 14 | 15 | # See more config options https://github.com/foundry-rs/foundry/tree/master/config -------------------------------------------------------------------------------- /test/Contract.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Unlicense 2 | pragma solidity ^0.8.13; 3 | 4 | import "forge-std/Test.sol"; 5 | 6 | import "src/Contract.sol"; 7 | 8 | contract TestContract is Test { 9 | Contract c; 10 | 11 | function setUp() public { 12 | c = new Contract(); 13 | } 14 | 15 | function testBar() public { 16 | assertEq(uint256(1), uint256(1), "ok"); 17 | } 18 | 19 | function testFoo(uint256 x) public { 20 | vm.assume(x < type(uint128).max); 21 | assertEq(x + x, x * 2); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Forge Tests 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | 8 | env: 9 | FOUNDRY_PROFILE: ci 10 | 11 | jobs: 12 | run-ci: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v3 16 | 17 | - name: Install Foundry 18 | uses: foundry-rs/foundry-toolchain@v1 19 | with: 20 | version: nightly 21 | 22 | - name: Install deps 23 | run: forge install 24 | 25 | - name: Check gas snapshots 26 | run: forge snapshot --check 27 | 28 | - name: Run tests 29 | run: forge test 30 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | 8 | jobs: 9 | run-ci: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Install Foundry 15 | uses: foundry-rs/foundry-toolchain@v1 16 | with: 17 | version: nightly 18 | 19 | - name: Install deps 20 | run: forge install 21 | 22 | - name: Run Slither 23 | uses: crytic/slither-action@main 24 | id: slither 25 | continue-on-error: true 26 | with: 27 | sarif: results.sarif 28 | 29 | - name: Upload SARIF file 30 | uses: github/codeql-action/upload-sarif@v2 31 | with: 32 | sarif_file: ${{ steps.slither.outputs.sarif }} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Pollum Labs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #forge-template 2 | 3 |  4 | 5 | Template repository for getting started quickly with Foundry projects. 6 | 7 | Forked from [Foundry's original repo](https://github.com/foundry-rs/forge-template/) with extra code to save you time. 8 | 9 | 12 | 13 |
14 |
15 |