Repository: gakonst/dapptools-template Branch: master Commit: f5db6aeeff58 Files: 9 Total size: 3.7 KB Directory structure: gitextract_lxuhaalh/ ├── .gas-snapshot ├── .github/ │ └── workflows/ │ └── ci.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── foundry.toml ├── src/ │ └── Contract.sol └── test/ └── Contract.t.sol ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gas-snapshot ================================================ TestContract:testBar() (gas: 401) ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: - master pull_request: env: FOUNDRY_PROFILE: ci jobs: run-ci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: version: nightly - name: Install deps run: forge install - name: Check gas snapshots run: forge snapshot --check - name: Run tests run: forge test ================================================ FILE: .gitignore ================================================ cache/ out/ ================================================ FILE: .gitmodules ================================================ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std ================================================ FILE: LICENSE ================================================ This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to ================================================ FILE: README.md ================================================ #

Forge Template

**Template repository for getting started quickly with Foundry projects** ![Github Actions](https://github.com/foundry-rs/forge-template/workflows/CI/badge.svg) ## Getting Started Click "Use this template" on [GitHub](https://github.com/foundry-rs/forge-template) to create a new repository with this repo as the initial state. Or, if your repo already exists, run: ```sh forge init forge build forge test ``` ## Writing your first test All you need is to `import forge-std/Test.sol` and then inherit it from your test contract. Forge-std's Test contract comes with a pre-instatiated [cheatcodes environment](https://book.getfoundry.sh/cheatcodes/), the `vm`. It also has support for [ds-test](https://book.getfoundry.sh/reference/ds-test.html)-style logs and assertions. Finally, it supports Hardhat's [console.log](https://github.com/brockelmore/forge-std/blob/master/src/console.sol). The logging functionalities require `-vvvv`. ```solidity pragma solidity 0.8.10; import "forge-std/Test.sol"; contract ContractTest is Test { function testExample() public { vm.roll(100); console.log(1); emit log("hi"); assertTrue(true); } } ``` ## Development This project uses [Foundry](https://getfoundry.sh). See the [book](https://book.getfoundry.sh/getting-started/installation.html) for instructions on how to install and use Foundry. ================================================ FILE: foundry.toml ================================================ [profile.ci.fuzz] runs = 10_000 ================================================ FILE: src/Contract.sol ================================================ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.13; contract Contract { } ================================================ FILE: test/Contract.t.sol ================================================ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.13; import "forge-std/Test.sol"; import "src/Contract.sol"; contract TestContract is Test { Contract c; function setUp() public { c = new Contract(); } function testBar() public { assertEq(uint256(1), uint256(1), "ok"); } function testFoo(uint256 x) public { vm.assume(x < type(uint128).max); assertEq(x + x, x * 2); } }