A hybrid template combining the best of Hardhat and Foundry for developing Solidity smart contracts, with modern tooling and sensible defaults.
- Hardhat: TypeScript integration, deployment scripts, verification
- Foundry: Fast compilation, comprehensive testing, gas optimization
- Soldeer: Native Solidity package manager for contract dependencies
- OpenZeppelin Contracts: Installed via Soldeer for secure, tested contract implementations
- Hardhat Tests: TypeScript-based tests with ethers.js integration
- Foundry Tests: High-performance Solidity tests with fuzz testing and gas benchmarking
- Hardhat Deploy: Feature-rich deployment system with migrations
- Foundry Scripts: Secure deployment with Cast wallet integration
- ESLint v9: Modern flat config with TypeScript support
- Forge Formatting: Consistent Solidity code style
- Cross-tool Compatibility: Bytecode alignment for seamless verification
- TypeChain: Generate TypeScript bindings from Foundry artifacts
- Bun (recommended) or Node.js 18+
- Foundry - Install with:
curl -L https://foundry.paradigm.xyz | bash
-
Use this template
# Click "Use this template" button above or clone directly git clone <your-repo-url> cd <your-repo-name>
-
Install dependencies
bun install # or npm install -
Set up configuration
bunx hardhat vars setup # Set required variables: INFURA_API_KEY, MNEMONIC or DEPLOYER_PRIVATE_KEY
# Compile with Foundry (recommended - faster)
forge build
# Compile with Hardhat (includes TypeChain generation)
bun run compile# Run Foundry tests (with fuzz testing)
bun run test:foundry
# Run Hardhat tests (TypeScript)
bun run test:hardhat# Deploy using Cast wallets (secure)
NETWORK=sepolia SENDER=0x... ACCOUNT=my-wallet bun run deploy:foundry# Deploy using Hardhat Deploy
bun run deploy:hardhat --network sepolia# Verify deployed contracts (works with both deployment methods)
bun run task:verify# Lint everything
bun run lint
# Format code
bun run format:writeβββ contracts/ # Solidity contracts
βββ script/ # Foundry deployment scripts
βββ test/
β βββ foundry/ # Foundry tests (.sol)
β βββ lock/ # Hardhat tests (.ts)
βββ deploy/ # Hardhat deployment scripts
βββ tasks/ # Hardhat tasks
βββ config/ # Network and chain configurations
βββ foundry.toml # Foundry configuration
βββ hardhat.config.ts # Hardhat configuration
βββ eslint.config.js # ESLint v9 configuration
bun run test:foundry- Run Foundry testsbun run test:hardhat- Run Hardhat tests
bun run deploy:foundry- Deploy with Foundrybun run deploy:hardhat- Deploy with Hardhat
bun run compile- Compile contractsbun run lint- Lint all codebun run format:write- Format all codebun run clean- Clean build artifacts
forge doc- Generate documentation from NatSpec
The template ensures bytecode compatibility between Foundry and Hardhat:
foundry.toml:bytecode_hash = "none"hardhat.config.ts:bytecodeHash: "none"
This allows Hardhat to verify contracts deployed with Foundry seamlessly.
Networks are configured in config/networks.ts with support for:
- Mainnet, Polygon, Arbitrum, Optimism
- Testnets (Sepolia, etc.)
- Local development (Anvil, Ganache)
- OpenZeppelin Contracts (via Soldeer)
- Forge Standard Library (via Soldeer)
- Hardhat - Ethereum development environment
- Foundry - Rust-based toolkit
- TypeChain - TypeScript bindings
- ESLint v9 - Code linting
- Solhint - Solidity linting
- Foundry: Lightning-fast compilation and testing
- Hardhat: Rich TypeScript ecosystem and tooling
- OpenZeppelin contracts via native package manager
- Secure deployment with Cast wallet integration
- Comprehensive test coverage
- Modern tooling (ESLint v9, Soldeer, TypeScript 5.9)
- Cross-compatible bytecode for seamless workflows
- Extensive documentation and examples
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under MIT - see the LICENSE file for details.