OpenZeppelin Contracts: Secure smart contract library
A library of audited Solidity components for secure smart contract development on Ethereum and EVM-compatible chains.
Learn more about OpenZeppelin Contracts
OpenZeppelin Contracts is a library of reusable Solidity smart contract components designed for secure blockchain development. The library provides implementations of standard token contracts (ERC20, ERC721, ERC1155), access control mechanisms, and utility functions that developers can inherit and extend. All contracts undergo rigorous security audits and follow semantic versioning to ensure backwards compatibility and safe upgrades. The library is commonly used as a foundation for building decentralized applications, token systems, and complex blockchain protocols.
Audited Security
All stable releases undergo comprehensive security audits and are covered by a bug bounty program. The library follows rigorous security practices and maintains a detailed security policy.
Standard Implementations
Provides battle-tested implementations of Ethereum standards including ERC20, ERC721, ERC1155, and ERC6909 tokens. Includes flexible role-based access control and permission systems.
Upgrade Safety
Uses semantic versioning to communicate API and storage layout compatibility. Provides clear guidance on safe upgrade paths for upgradeable contract systems.
pragma solidity ^0.8.20;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MyCollectible is ERC721 {
uint256 private _tokenIdCounter;
constructor() ERC721("MyCollectible", "MCO") {
_tokenIdCounter = 0;
}
function mint(address to) public {
uint256 tokenId = _tokenIdCounter;
_tokenIdCounter++;
_mint(to, tokenId);
}
function totalSupply() public view returns (uint256) {
return _tokenIdCounter;
}
}v5.6.0-rc.1: Add ERC-165 detection for the `IERC6909ContentURI`, `IERC6909TokenSupply` and `IERC6909Metadata` int
- –Add ERC-165 detection for the `IERC6909ContentURI`, `IERC6909TokenSupply` and `IERC6909Metadata` interfaces in the `ERC6909ContentURI`, `ERC6909TokenSupply` and `ERC6909Metadata` contracts respectively
- –(#6246) and (#6247)
v5.6.0-rc.0: `ERC721` and `ERC1155`: Prevent setting an operator for `address(0)`. In the case of `ERC721` this t
- –`ERC721` and `ERC1155`: Prevent setting an operator for `address(0)`. In the case of `ERC721` this type of operator allowance could lead to obfuscated mint permission. (#6171)
- –`Account`: Update default version of the ERC-4337 entrypoint to v0.9. (#6135)
- –`AccountERC7579`: Do not revert and perform the uninstall if the `onUninstall` hook of a module reverts. (#6142)
- –`ERC1155`: Introduce the `_checkAuthorized` internal virtual function to encapsulate `isApprovedForAll` and `msg.sender == from` checks. (#6133)
- –`ERC1155`: Call `IERC1155Receiver.onERC1155BatchReceived` when performing a batch transfers with exactly one id/value in the batch. (#6170)
v5.5.0: `ERC165Checker`: Ensure the `supportsERC165` function returns false if the target reverts during the
- –`ERC165Checker`: Ensure the `supportsERC165` function returns false if the target reverts during the `supportsInterface(0xffffffff)` call. (#5810)
- –`SignerERC7702` is renamed as `SignerEIP7702`. Imports and inheritance must be updated to that new name and path. Behavior is unmodified. (#5932)
- –`ECDSA` signature malleability protection is partly deprecated. See documentation for more details. #5814
- –`ERC4626`: compute `maxWithdraw` using `maxRedeem` and `previewRedeem` so that changes to the preview functions affect the max functions. (#5130)
- –`InteroperableAddress`: Add a library for formatting and parsing ERC-7930 interoperable addresses. (#5736)
Related Repositories
Discover similar tools and frameworks used by developers
Substrate
A modular framework for building custom blockchains with configurable consensus and runtime logic.
Sui
A blockchain platform using Move programming language with parallel transaction processing and asset-oriented design.
Solmate
A collection of gas-optimized Solidity contracts including ERC token implementations and utility libraries.
Solidity StringUtils
A gas-efficient string utility library for Solidity using slice abstractions for string manipulation operations.
Optimism
Layer 2 blockchain that scales Ethereum using optimistic rollup technology and the open-source OP Stack framework.