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 and Solady smart contracts are included as dependencies, along with
solcremappings so you can work with deployed contracts out of the box!
- The full Uniswap suite (v2, v3-core & v3-periphery, v4-core & v4-periphery) is included too, so you can build against a wide range of on-chain liquidity
- Dependencies managed with Soldeer — declared in
foundry.tomland version-locked insoldeer.lock, so they can be added, removed, and upgraded with a single command forge fmtconfigured as the default formatter for VSCode projects- Github Actions workflows that run
forge fmt --check,forge test,forge snapshot --check, andforge coverageon every push and PR. Soldeer dependencies and Forge artifacts are cached across runs.- 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
justfilewith the common Foundry recipes (just --list) - A pre-configured, but still minimal
foundry.toml- multiple profiles for various development and testing scenarios
- 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 variant/minimal <project_name>- DeFi Starter: 🚧 coming soon (
--branch variant/defi) - NFT Starter: 🚧 coming soon (
--branch variant/nft) - Stablecoin Starter: 🚧 coming soon (
--branch variant/stablecoin) - Cross-Chain starter: 🚧 coming soon (
--branch variant/cross-chain)
- Install dependencies:
forge soldeer install- Build the project:
forge buildmain: Contains tutorials, additional example contracts, and comprehensive dependencies.variant/*: Lighter starting points, currentlyvariant/minimal— a lightweight template without extra tutorials and dependencies.
Everything under variant/ is generated from main — a build artifact described by a manifest in variants/ on main and rebuilt by CI on every push. Contributors only ever work on main.
For detailed info on branches and contribution, check out the Contributing Guide.
Dependencies are managed with Soldeer. They are declared in the [dependencies] section of foundry.toml and pinned by version and content hash in soldeer.lock. The dependencies/ directory itself is generated and git-ignored, so a fresh clone needs one command before it will build:
forge soldeer installRun the same command after pulling changes that touch foundry.toml, or after switching branches.
To add, remove, or upgrade a dependency:
forge soldeer install <name>~<version> # add
forge soldeer uninstall <name> # remove
forge soldeer update # upgrade within declared rangesRemappings are maintained by hand in foundry.toml rather than generated, so the template can keep import aliases like @openzeppelin/contracts/. The paths include the version number — update the matching remapping whenever you change a dependency's version.
The Uniswap aliases resolve to the package root, matching the import paths in Uniswap's own documentation. These packages import each other by their full published path, so the alias cannot point any deeper:
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";Common tasks live in the justfile. Install just, then run just (or just --list) to see them:
just build # forge build (src/ only)
just test # forge test (src/ only)
just fmt # forge fmt
just lint # forge lint
just cov # coverage summary + HTML reportThe demo contracts under examples/ build and test through their own profile:
just examples-build # demo contracts under examples/
just examples-test # demo tests
just snapshot # gas snapshot for examplesAnything not covered by a recipe takes FOUNDRY_PROFILE=examples directly. CI checks the gas snapshot for these on every PR.
Recipes accept extra flags (just test --match-test test_Increment). just cov needs lcov (brew install lcov on macOS) and uses a [profile.coverage] with the optimizer off so instrumentation does not hit "stack too deep". CI uploads lcov.info as a workflow artifact.
For 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
