Skip to content

LazerTechnologies/LazerForge

Repository files navigation

LazerForge Logo

LazerForge

LazerForge is a Foundry template for smart contract development. For more information on Foundry check out the foundry book.

Overview

LazerForge is a batteries included template with the following configurations:

  • OpenZeppelin, Solady, and the full Uniswap suite (v2, v3-core & v3-periphery, v4-core & v4-periphery) smart contracts are included as dependencies along with solc remappings so you can work with a wide range of deployed contracts out of the box!
  • forge fmt configured as the default formatter for VSCode projects
  • Github Actions workflows that run forge fmt --check and forge test on every push and PR
    • A separate action to automatically fix formatting issues on PRs by commenting !fix on the PR
  • A pre-configured, but still minimal foundry.toml

Quick Start

  1. Install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup
  1. Create a new project:
forge init --template lazertechnologies/lazerforge <project_name>

💡 To install a minimal template without tutorials and extra dependencies:

forge init --template lazertechnologies/lazerforge --branch minimal <project_name>
  1. Build the project:
forge build

Branch Structure

LazerForge maintains two primary branches to cater to different needs:

  • main Branch: Contains tutorials, additional example contracts, and comprehensive dependencies.
  • minimal Branch: Provides a lightweight template without extra tutorials and dependencies.

For detailed info on branches and contribution, check out the Contributing Guide.

Syncing Changes Between Branches

We use a dedicated synchronization workflow to maintain consistency between branches while respecting their different purposes.

To sync changes from main to minimal:

  1. Ensure your changes are merged to main first
  2. Run the sync script:
./tools/sync-to-minimal.sh
  1. The script will:

    • Update a dedicated sync branch with the latest from main
    • Open a PR creation page targeting minimal
  2. During PR review:

    • Verify only appropriate files are included
    • Exclude tutorial content or other files not needed in minimal

For emergency fixes in minimal:

If you need to make a hotfix directly to minimal and then sync back to main:

  1. Make and merge your changes to minimal
  2. Run:
./tools/sync-to-main.sh
  1. Complete a PR to sync these changes back to main

Always make feature development PRs to main first, and use the sync scripts rather than manually cherry-picking to maintain consistency.

Documentation

For detailed guides on various aspects of LazerForge, check out:

Reinitialize Submodules

When working across branches with different dependencies, submodules may need to be reinitialized. Run

./reinit-submodules

Gas Snapshots

Forge can generate gas snapshots for all test functions to see how much gas contracts will consume, or to compare gas usage before and after optimizations.

forge snapshot

Coverage Reports

If you plan on generating coverage reports, you'll need to install lcov as well.

On macOS, you can do this with the following command:

brew install lcov

To generate reports, run

./coverage-report

About

Foundry template for Solidity smart contract development

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published