LazerForge is a Foundry template for smart contract development. For more information on Foundry check out the foundry book.
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
solcremappings so you can work with a wide range of deployed contracts out of the box! forge fmtconfigured as the default formatter for VSCode projects- Github Actions workflows that run
forge fmt --checkandforge teston every push and PR- A separate action to automatically fix formatting issues on PRs by commenting
!fixon the PR
- A separate action to automatically fix formatting issues on PRs by commenting
- A pre-configured, but still minimal
foundry.toml- multiple profiles for various development and testing scenarios (see LazerForge Profiles)
- high optimizer settings by default for gas-efficient smart contracts
- an explicit
solccompiler version for reproducible builds - no extra injected
solcmetadata for simpler Etherscan verification and deterministic cross-chain deploys via CREATE2. - block height and timestamp variables for deterministic testing
- mapped network identifiers to RPC URLs and Etherscan API keys using environment variables
- Install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup- Create a new project using one of the templates:
Full repo with example contracts, Uniswap dependencies, and docs:
forge init --template lazertechnologies/lazerforge <project_name>Minimal repo with just optimized config:
forge init --template lazertechnologies/lazerforge --branch minimal <project_name>- DeFi Starter: 🚧 coming soon
- NFT Starter: 🚧 coming soon
- Stablecoin Starter: 🚧 coming soon
- Cross-Chain starter: 🚧 coming soon
- Build the project:
forge buildLazerForge maintains two primary branches to cater to different needs:
mainBranch: Contains tutorials, additional example contracts, and comprehensive dependencies.minimalBranch: Provides a lightweight template without extra tutorials and dependencies.
For detailed info on branches and contribution, check out the Contributing Guide.
See sync script usage for automating branch sync.
When working across branches with different dependencies, submodules may need to be reinitialized. Run
./reinit-submodulesForge 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 snapshotIf 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 lcovTo generate reports, run
./coverage-reportFor detailed guides on various aspects of LazerForge, check out:
- Setup Guide - Initial setup and configuration
- Testing Guide - Writing and running tests
- Deployment Guide - Deploying contracts
- Network Configuration - Setting up networks and RPC endpoints
- Profiles - Using different Foundry profiles
