Solmate: Gas optimized smart contract building blocks
A collection of gas-optimized Solidity contracts including ERC token implementations and utility libraries.
Learn more about Solmate
Solmate is a library of Solidity smart contracts that provides implementations of common token standards and utility functions. The contracts are written with gas optimization as a primary focus, often sacrificing some safety features for efficiency. It includes implementations of ERC20, ERC721, ERC1155, ERC4626, and ERC6909 token standards, along with authorization patterns and utility libraries for mathematical operations, storage optimization, and security guards. The library is designed for experienced developers who understand the trade-offs between gas efficiency and built-in safety mechanisms.
Gas Optimization Focus
Contracts are specifically designed to minimize gas consumption, often removing safety checks and optimizations found in other libraries. This results in lower transaction costs but requires careful implementation.
Minimal Implementation Approach
Provides bare-bones implementations of token standards and utilities without extensive feature sets. The contracts focus on core functionality rather than comprehensive feature coverage.
Opinionated Design Choices
Makes specific architectural decisions that prioritize performance over flexibility. The library assumes developers will handle safety considerations at the application level.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ERC20} from "solmate/tokens/ERC20.sol";
import {Owned} from "solmate/auth/Owned.sol";
contract MyToken is ERC20, Owned {
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _initialSupply
) ERC20(_name, _symbol, _decimals) Owned(msg.sender) {
_mint(msg.sender, _initialSupply);
}
function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount);
}
function burn(address from, uint256 amount) external onlyOwner {
_burn(from, amount);
}
// Override transfer to add custom logic if needed
function transfer(address to, uint256 amount) public override returns (bool) {
require(to != address(0), "Cannot transfer to zero address");
return super.transfer(to, amount);
}
}Top in Crypto
Related Repositories
Discover similar tools and frameworks used by developers
Cosmos SDK
Open-source framework for building customizable Layer 1 blockchains with native interoperability support.
LND
Complete Lightning Network node implementation with channel management, payment routing, and BOLT specification compliance.
OpenZeppelin Contracts
A library of audited Solidity components for secure smart contract development on Ethereum and EVM-compatible chains.
NEAR Core
Reference implementation of NEAR Protocol blockchain, providing infrastructure for smart contracts and applications.
rippled
C++ XRP Ledger implementation operating as a P2P node for transaction processing and consensus.
Related Reading
Guides and comparisons from the Greptile content library
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.
Best AI Code Review Tools for GitLab
Enterprise-grade AI code review tools for GitLab teams. In-depth comparison of accuracy, security, and integration features to accelerate your merge request workflows.
Best Developer Productivity Tools in 2026
The best developer productivity tools in 2026, compared by the workflow problem they solve: code review, autocomplete, AI-native editing, terminal agents, code search, observability, and security.
10 Powerful Code Quality Tools That Catch Bugs Before Deployment
We tested 10 code quality tools that catch bugs before production. Detailed comparison with real-world examples, pricing, and ROI analysis for dev teams.