Forge Std: Standard library for Foundry testing
Collection of contracts and libraries that provide testing utilities and cheatcode wrappers for Forge and Foundry.
Learn more about Forge Std
Forge Std is a standard library that provides helper contracts and utilities for testing Solidity smart contracts with Forge and Foundry. It wraps Forge's cheatcodes in developer-friendly interfaces and includes utilities for error handling, storage manipulation, and test assertions. The library includes stdError for compiler built-in errors, stdStorage for finding and writing to storage slots without knowing the layout, and stdCheats for enhanced pranking functionality. It serves as the foundation for most Foundry-based smart contract testing workflows.
Storage Introspection
Automatically finds and writes to storage slots of any variable without requiring knowledge of the contract's storage layout, using SLOAD/SSTORE recording.
Cheatcode Wrappers
Provides developer-friendly interfaces around Forge's low-level cheatcodes, including enhanced pranking with automatic ETH provisioning and improved assertion utilities.
Built-in Error Handling
Includes comprehensive error definitions for all Solidity compiler built-in errors, making expectRevert testing more reliable and readable.
import "forge-std/Test.sol";
contract TestContract is Test {
ErrorsTest test;
function setUp() public {
test = new ErrorsTest();
}
function testExpectArithmetic() public {
vm.expectRevert(stdError.arithmeticError);
test.arithmeticError(10);
}
}
contract ErrorsTest {
function arithmeticError(uint256 a) public {
a = a - 100; // This will underflow
}
}See how people are using Forge Std
Related Repositories
Discover similar tools and frameworks used by developers
Go Ethereum
Golang execution layer implementation of the Ethereum protocol, providing the geth client and developer tools.
Uniswap V3 Core
Core smart contracts for the Uniswap V3 decentralized exchange protocol on Ethereum.
Ethers.js
A TypeScript library for Ethereum blockchain interaction, providing wallet management, smart contract interfaces, and provider connections.
AvalancheGo
Go-based node implementation for the Avalanche blockchain network with high throughput transaction processing.
CCXT
Unified API library for 100+ cryptocurrency exchanges, standardizing trading, market data, and account management.
Related Reading
Guides and comparisons from the Greptile content library
Top Greptile alternatives to consider in 2026
A tongue-in-cheek list of Greptile alternatives, from printing out your code to hiring a lizard, with pros, cons, and a comparison table for each.
Best CodeRabbit Alternatives for Smarter AI Code Reviews in 2026
7 powerful CodeRabbit alternatives ranked by real dev teams. Feature comparison, pricing analysis, and honest reviews to find your perfect AI code reviewer.
How to Detect if Code Is AI-Generated
How to tell if code was written by AI: detection methods, seven common tells, the bug patterns that show up more often in agent-written PRs, and why knowing where AI code lives should change how you review it.
Best Security-Focused AI Code Review Tools [2026 Guide]
The six best security-focused AI code review tools, compared on SAST, SCA, DAST, and full-repo context, so you can pick the one that fits your codebase and your cycle times.