OpenZeppelin Contracts

Changelog

v5.4.0 - 2025-07-17

Breaking changes

  • Update minimum pragma to 0.8.24 in SignatureChecker, Governor and Governor's extensions. (#5716).

Pragma changes

  • Reduced pragma requirement of interface files

Changes by category

Account

  • Account: Added a simple ERC-4337 account implementation with minimal logic to process user operations. (#5657)
  • AccountERC7579: Extension of Account that implements support for ERC-7579 modules of type executor, validator, and fallback handler. (#5657)
  • AccountERC7579Hooked: Extension of AccountERC7579 that implements support for ERC-7579 hook modules. (#5657)
  • EIP7702Utils: Add a library for checking if an address has an EIP-7702 delegation in place. (#5587)
  • IERC7821, ERC7821: Interface and logic for minimal batch execution. No support for additional opData is included. (#5657)

Governance

  • GovernorNoncesKeyed: Extension of Governor that adds support for keyed nonces when voting by sig. (#5574)

Tokens

  • ERC20Bridgeable: Implementation of ERC-7802 that makes an ERC-20 compatible with crosschain bridges. (#5739)

Cryptography

Signers
  • AbstractSigner, SignerECDSA, SignerP256, and SignerRSA: Add an abstract contract and various implementations for contracts that deal with signature verification. (#5657)
  • SignerERC7702: Implementation of AbstractSigner for Externally Owned Accounts (EOAs). Useful with ERC-7702. (#5657)
  • SignerERC7913: Abstract signer that verifies signatures using the ERC-7913 workflow. (#5659)
  • MultiSignerERC7913: Implementation of AbstractSigner that supports multiple ERC-7913 signers with a threshold-based signature verification system. (#5659)
  • MultiSignerERC7913Weighted: Extension of MultiSignerERC7913 that supports assigning different weights to each signer, enabling more flexible governance schemes. (#5741)
Verifiers
  • ERC7913P256Verifier and ERC7913RSAVerifier: Ready to use ERC-7913 verifiers that implement key verification for P256 (secp256r1) and RSA keys. (#5659)
Other
  • SignatureChecker: Add support for ERC-7913 signatures alongside existing ECDSA and ERC-1271 signature verification. (#5659)
  • ERC7739: An abstract contract to validate signatures following the rehashing scheme from ERC7739Utils. (#5664)
  • ERC7739Utils: Add a library that implements a defensive rehashing mechanism to prevent replayability of smart contract signatures based on the ERC-7739. (#5664)

Structures

  • EnumerableMap: Add support for BytesToBytesMap type. (#5658)
  • EnumerableMap: Add keys(uint256,uint256) that returns a subset (slice) of the keys in the map. (#5713)
  • EnumerableSet: Add support for StringSet and BytesSet types. (#5658)
  • EnumerableSet: Add values(uint256,uint256) that returns a subset (slice) of the values in the set. (#5713)

Utils

  • Arrays: Add unsafeAccess, unsafeMemoryAccess and unsafeSetLength for bytes[] and string[]. (#5568)
  • Blockhash: Add a library that provides access to historical block hashes using EIP-2935's history storage, extending the standard 256-block limit to 8191 blocks. (#5642)
  • Bytes: Fix lastIndexOf(bytes,byte,uint256) with empty buffers and finite position to correctly return type(uint256).max instead of accessing uninitialized memory sections. (#5797)

Changes

v5.3.0 - 2025-04-09

Breaking Changes

  • Replace GovernorCountingOverridable.VoteReceipt struct parameter member names hasOverriden and overridenWeight for hasOverridden and overriddenWeight respectively.

Custom error changes

  • Replace GovernorAlreadyOverridenVote with GovernorAlreadyOverriddenVote.
  • Replace GovernorOnlyProposer with GovernorUnableToCancel.

Changes by category

Account

  • ERC4337Utils: Update the hash function to call getUserOpHash on the specified entrypoint and add an ENTRYPOINT_V08 constant. (#5614)
  • ERC7579Utils: Add ABI decoding checks on calldata bounds within decodeBatch. (#5371)
  • ERC7579Utils: Replace address(0) with address(this) during execution for calldata compression efficiency. (#5614)

Governance

  • IGovernor: Add the getProposalId function to the governor interface. (#5290)
  • GovernorProposalGuardian: Add a governance extension that defines a proposal guardian who can cancel proposals at any stage in their lifecycle. (#5303)
  • GovernorSequentialProposalId: Adds a Governor extension that sequentially numbers proposal ids instead of using the hash. (#5290)
  • GovernorSuperQuorum: Add a governance extension to support a super quorum. Proposals that meet the super quorum (and have a majority of for votes) advance to the Succeeded state before the proposal deadline. (#5526)
  • GovernorVotesSuperQuorumFraction: Add a variant of the GovernorSuperQuorum extensions where the super quorum is expressed as a fraction of the total supply. (#5526)
  • TimelockController: Receive function is now virtual. (#5509)

Structures

  • EnumerableSet: Add clear function to EnumerableSets which deletes all values in the set. (#5486)
  • EnumerableMap: Add clear function to EnumerableMaps which deletes all entries in the map. (#5486)
  • MerkleTree: Add an update function that replaces a previously inserted leaf with a new value, updating the tree root along the way. (#5526)

Tokens

  • ERC4626: Use the asset getter in totalAssets, _deposit and _withdraw. (#5322)
  • IERC6909: Add the interface for ERC-6909. (#5343)
  • ERC6909: Add a standard implementation of ERC6909. (#5394)
  • ERC6909TokenSupply: Add an extension of ERC6909 which tracks total supply for each token id. (#5394)
  • ERC6909Metadata: Add an extension of ERC6909 which adds metadata functionality. (#5394)
  • ERC6909ContentURI: Add an extension of ERC6909 which adds content URI functionality. (#5394)
  • SafeERC20: Add trySafeTransfer and trySafeTransferFrom that do not revert and return false if the transfer is not successful. (#5483)

Other

  • Address: bubble up revert data on sendValue failed call. (#5379)
  • Calldata: Library with emptyBytes and emptyString functions to generate empty bytes and string calldata types. (#5422)
  • ERC2771Forwarder: Expose the _isTrustedByTarget internal function to check whether a target trusts the forwarder. (#5416)
  • Hashes: Expose efficientKeccak256 for hashing non-commutative pairs of bytes32 without allocating extra memory. (#5442)
  • Initializable: Add _initializableStorageSlot function that returns a pointer to the storage struct. The function allows customizing with a custom storage slot with an override. (#5526)
  • Math: Add add512, mul512 and mulShr. (#5526)
  • Math: Add saturating arithmetic operations saturatingAdd, saturatingSub and saturatingMul. (#5526)
  • MessageHashUtils: Add toDataWithIntendedValidatorHash(address, bytes32). (#5526)
  • P256: Adjust precompile detection in verifyNative to consider empty returndata on invalid verification. Previously, invalid signatures would've reverted with a MissingPrecompile error in chains with RIP-7212 support. (#5620)
  • Pausable: Stop explicitly setting paused to false during construction. (#5448)
  • Strings: Add espaceJSON that escapes special characters in JSON strings. (#5526)

Changes

v5.2.0 - 2025-01-09

Breaking Changes

Custom error changes

This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:

  • Replace Errors.FailedCall with a bubbled-up revert reason in Address.sendValue.

Changes by category

General

  • Update some pragma directives to ensure that all file requirements match that of the files they import. (#5273)

Account

  • ERC4337Utils: Add a reusable library to manipulate user operations and interact with ERC-4337 contracts (#5274)
  • ERC7579Utils: Add a reusable library to interact with ERC-7579 modular accounts (#5274)

Governance

  • GovernorCountingOverridable: Add a governor counting module that enables token holders to override the vote of their delegate. (#5192)
  • VotesExtended: Create an extension of Votes which checkpoints balances and delegates. (#5192)

Proxy

  • Clones: Add cloneWithImmutableArgs and cloneDeterministicWithImmutableArgs variants that create clones with per-instance immutable arguments. The immutable arguments can be retrieved using fetchCloneArgs. The corresponding predictDeterministicWithImmutableArgs function is also included. (#5109)

Tokens

  • ERC1363Utils: Add helper similar to the existing ERC721Utils and ERC1155Utils (#5133)

Utils

  • Address: bubble up revert data on sendValue failed call (#5418)
  • Bytes: Add a library of common operations that operate on bytes objects. (#5252)
  • CAIP2 and CAIP10: Add libraries for formatting and parsing CAIP-2 and CAIP-10 identifiers. (#5252)
  • NoncesKeyed: Add a variant of Nonces that implements the ERC-4337 entrypoint nonce system. (#5272)
  • Packing: Add variants for packing bytes10 and bytes22 (#5274)
  • Strings: Add parseUint, parseInt, parseHexUint and parseAddress to parse strings into numbers and addresses. Also provide variants of these functions that parse substrings, and tryXxx variants that do not revert on invalid input. (#5166)

Changes

v5.1.0 - 2024-10-23

Breaking changes

  • ERC1967Utils: Removed duplicate declaration of the Upgraded, AdminChanged and BeaconUpgraded events. These events are still available through the IERC1967 interface located under the contracts/interfaces/ directory. Minimum pragma version is now 0.8.21.
  • Governor, GovernorCountingSimple: The _countVote virtual function now returns an uint256 with the total votes casted. This change allows for more flexibility for partial and fractional voting. Upgrading users may get a compilation error that can be fixed by adding a return statement to the _countVote function.

Custom error changes

This version comes with changes to the custom error identifiers. Contracts previously depending on the following errors should be replaced accordingly:

  • Replace Address.FailedInnerCall with Errors.FailedCall
  • Replace Address.AddressInsufficientBalance with Errors.InsufficientBalance
  • Replace Clones.Create2InsufficientBalance with Errors.InsufficientBalance
  • Replace Clones.ERC1167FailedCreateClone with Errors.FailedDeployment
  • Replace Clones.Create2FailedDeployment with Errors.FailedDeployment
  • SafeERC20: Replace Address.AddressEmptyCode with SafeERC20FailedOperation if there is no code at the token's address.
  • SafeERC20: Replace generic Error(string) with SafeERC20FailedOperation if the returned data can't be decoded as bool.
  • SafeERC20: Replace generic SafeERC20FailedOperation with the revert message from the contract call if it fails.

Changes by category

General

  • AccessManager, VestingWallet, TimelockController and ERC2771Forwarder: Added a public initializer function in their corresponding upgradeable variants. (#5008)

Access

  • AccessControlEnumerable: Add a getRoleMembers method to return all accounts that have role. (#4546)
  • AccessManager: Allow the onlyAuthorized modifier to restrict functions added to the manager. (#5014)

Finance

  • VestingWalletCliff: Add an extension of the VestingWallet contract with an added cliff. (#4870)

Governance

  • GovernorCountingFractional: Add a governor counting module that allows distributing voting power amongst 3 options (For, Against, Abstain). (#5045)
  • Votes: Set _moveDelegateVotes visibility to internal instead of private. (#5007)

Proxy

  • Clones: Add version of clone and cloneDeterministic that support sending value at creation. (#4936)
  • TransparentUpgradeableProxy: Make internal _proxyAdmin() getter have view visibility. (#4688)
  • ProxyAdmin: Fixed documentation for UPGRADE_INTERFACE_VERSION getter. (#5031)

Tokens

  • ERC1363: Add implementation of the token payable standard allowing execution of contract code after transfers and approvals. (#4631)
  • ERC20TemporaryApproval: Add an ERC-20 extension that implements temporary approval using transient storage, based on ERC7674 (draft). (#5071)
  • SafeERC20: Add "relaxed" function for interacting with ERC-1363 functions in a way that is compatible with EOAs. (#4631)
  • SafeERC20: Document risks of safeIncreaseAllowance and safeDecreaseAllowance when associated with ERC-7674. (#5262)
  • ERC721Utils and ERC1155Utils: Add reusable libraries with functions to perform acceptance checks on IERC721Receiver and IERC1155Receiver implementers. (#4845)
  • ERC1363Utils: Add helper similar to the existing ERC721Utils and ERC1155Utils. (#5133)

Utils

  • Arrays: add a sort functions for address[], bytes32[] and uint256[] memory arrays. (#4846)
  • Arrays: add new functions lowerBound, upperBound, lowerBoundMemory and upperBoundMemory for lookups in sorted arrays with potential duplicates. (#4842)
  • Arrays: deprecate findUpperBound in favor of the new lowerBound. (#4842)
  • Base64: Add encodeURL following section 5 of RFC4648 for URL encoding (#4822)
  • Comparator: A library of comparator functions, useful for customizing the behavior of the Heap structure. (#5084)
  • Create2: Bubbles up returndata from a deployed contract that reverted during construction. (#5052)
  • Create2, Clones: Mask computeAddress and cloneDeterministic outputs to produce a clean value for an address type (i.e. only use 20 bytes) (#4941)
  • Errors: New library of common custom errors. (#4936)
  • Hashes: A library with commonly used hash functions. (#3617)
  • Packing: Added a new utility for packing, extracting and replacing bytesXX values. (#4992)
  • Panic: Add a library for reverting with panic codes. (#3298)
  • ReentrancyGuardTransient: Added a variant of ReentrancyGuard that uses transient storage. (#4988)
  • Strings: Added a utility function for converting an address to checksummed string. (#5067)
  • SlotDerivation: Add a library of methods for derivating common storage slots. (#4975)
  • TransientSlot: Add primitives for operating on the transient storage space using a typed-slot representation. (#4980)
Cryptography
  • SignatureChecker: refactor isValidSignatureNow to avoid validating ECDSA signatures if there is code deployed at the signer's address. (#4951)
  • MerkleProof: Add variations of verify, processProof, multiProofVerify and processMultiProof (and equivalent calldata version) with support for custom hashing functions. (#4887)
  • P256: Library for verification and public key recovery of P256 (aka secp256r1) signatures. (#4881)
  • RSA: Library to verify signatures according to RFC 8017 Signature Verification Operation (#4952)

Math

  • Math: add an invMod function to get the modular multiplicative inverse of a number in Z/nZ. (#4839)
  • Math: Add modExp function that exposes the EIP-198 precompile. Includes uint256 and bytes memory versions. (#3298)
  • Math: Custom errors replaced with native panic codes. (#3298)
  • Math, SignedMath: Add a branchless ternary function that computescond ? a : b in constant gas cost. (#4976)
  • SafeCast: Add toUint(bool) for operating on bool values as uint256. (#4878)

Structures

  • CircularBuffer: Add a data structure that stores the last N values pushed to it. (#4913)
  • DoubleEndedQueue: Custom errors replaced with native panic codes. (#4872)
  • EnumerableMap: add UintToBytes32Map, AddressToAddressMap, AddressToBytes32Map and Bytes32ToAddressMap. (#4843)
  • Heap: A data structure that implements a heap-based priority queue. (#5084)
  • MerkleTree: A data structure that allows inserting elements into a merkle tree and updating its root hash. (#3617)

Changes

v5.0.2 - 2024-02-29

  • Base64: Fix issue where dirty memory located just after the input buffer is affecting the result. (#4926)

Changes

v4.9.6 - 2024-02-29

  • Base64: Fix issue where dirty memory located just after the input buffer is affecting the result. (#4929)

Changes

v4.9.5 - 2023-12-08

  • Multicall: Make aware of non-canonical context (i.e. msg.sender is not _msgSender()), allowing compatibility with ERC2771Context. Patch duplicated Address.functionDelegateCall in v4.9.4 (removed).

Changes

v5.0.1 - 2023-12-07

  • ERC2771Context and Context: Introduce a _contextPrefixLength() getter, used to trim extra information appended to msg.data.
  • Multicall: Make aware of non-canonical context (i.e. msg.sender is not _msgSender()), allowing compatibility with ERC2771Context.

Changes

v4.9.4 - 2023-12-07

  • ERC2771Context and Context: Introduce a _contextPrefixLength() getter, used to trim extra information appended to msg.data.
  • Multicall: Make aware of non-canonical context (i.e. msg.sender is not _msgSender()), allowing compatibility with ERC2771Context.

Changes

v5.0.0 - 2023-10-05

Additions Summary

The following contracts and libraries were added:

  • AccessManager: A consolidated system for managing access control in complex systems.
    • AccessManaged: A module for connecting a contract to an authority in charge of its access control.
    • GovernorTimelockAccess: An adapter for time-locking governance proposals using an AccessManager.
    • AuthorityUtils: A library of utilities for interacting with authority contracts.
  • GovernorStorage: A Governor module that stores proposal details in storage.
  • ERC2771Forwarder: An ERC2771 forwarder for meta transactions.
  • ERC1967Utils: A library with ERC1967 events, errors and getters.
  • Nonces: An abstraction for managing account nonces.
  • MessageHashUtils: A library for producing digests for ECDSA operations.
  • Time: A library with helpers for manipulating time-related objects.

Removals Summary

The following contracts, libraries, and functions were removed:

  • Address.isContract (because of its ambiguous nature and potential for misuse)
  • Checkpoints.History
  • Counters
  • ERC20Snapshot
  • ERC20VotesComp
  • ERC165Storage (in favor of inheritance based approach)
  • ERC777
  • ERC1820Implementer
  • GovernorVotesComp
  • GovernorProposalThreshold (deprecated since 4.4)
  • PaymentSplitter
  • PullPayment
  • SafeMath
  • SignedSafeMath
  • Timers
  • TokenTimelock (in favor of VestingWallet)
  • All escrow contracts (Escrow, ConditionalEscrow and RefundEscrow)
  • All cross-chain contracts, including AccessControlCrossChain and all the vendored bridge interfaces
  • All presets in favor of OpenZeppelin Contracts Wizard

These removals were implemented in the following PRs: #3637, #3880, #3945, #4258, #4276, #4289

Changes by category

General

  • Replaced revert strings and require statements with custom errors. (#4261)
  • Bumped minimum compiler version required to 0.8.20 (#4288)
  • Use of abi.encodeCall in place of abi.encodeWithSelector and abi.encodeWithSignature for improved type-checking of parameters (#4293)
  • Replaced some uses of abi.encodePacked with clearer alternatives (e.g. bytes.concat, string.concat). (#4504) (#4296)
  • Overrides are now used internally for a number of functions that were previously hardcoded to their default implementation in certain locations: ERC1155Supply.totalSupply, ERC721.ownerOf, ERC721.balanceOf and ERC721.totalSupply in ERC721Enumerable, ERC20.totalSupply in ERC20FlashMint, and ERC1967._getImplementation in ERC1967Proxy. (#4299)
  • Removed the override specifier from functions that only override a single interface function. (#4315)
  • Switched to using explicit Solidity import statements. Some previously available symbols may now have to be separately imported. (#4399)
  • Governor, Initializable, and UUPSUpgradeable: Use internal functions in modifiers to optimize bytecode size. (#4472)
  • Upgradeable contracts now use namespaced storage (EIP-7201). (#4534)
  • Upgradeable contracts no longer transpile interfaces and libraries. (#4628)

Access

  • Ownable: Added an initialOwner parameter to the constructor, making the ownership initialization explicit. (#4267)
  • Ownable: Prevent using address(0) as the initial owner. (#4531)
  • AccessControl: Added a boolean return value to the internal _grantRole and _revokeRole functions indicating whether the role was granted or revoked. (#4241)
  • access: Moved AccessControl extensions to a dedicated directory. (#4359)
  • AccessManager: Added a new contract for managing access control of complex systems in a consolidated location. (#4121)
  • AccessManager, AccessManaged, GovernorTimelockAccess: Ensure that calldata shorter than 4 bytes is not padded to 4 bytes. (#4624)
  • AccessManager: Use named return parameters in functions that return multiple values. (#4624)
  • AccessManager: Make schedule and execute more conservative when delay is 0. (#4644)

Finance

  • VestingWallet: Fixed revert during 1 second time window when duration is 0. (#4502)
  • VestingWallet: Use Ownable instead of an immutable beneficiary. (#4508)

Governance

  • Governor: Optimized use of storage for proposal data (#4268)
  • Governor: Added validation in ERC1155 and ERC721 receiver hooks to ensure Governor is the executor. (#4314)
  • Governor: Refactored internals to implement common queuing logic in the core module of the Governor. Added queue and _queueOperations functions that act at different levels. Modules that implement queuing via timelocks are expected to override _queueOperations to implement the timelock-specific logic. Added _executeOperations as the equivalent for execution. (#4360)
  • Governor: Added voter and nonce parameters in signed ballots, to avoid forging signatures for random addresses, prevent signature replay, and allow invalidating signatures. Add voter as a new parameter in the castVoteBySig and castVoteWithReasonAndParamsBySig functions. (#4378)
  • Governor: Added support for casting votes with ERC-1271 signatures by using a bytes memory signature instead of r, s and v arguments in the castVoteBySig and castVoteWithReasonAndParamsBySig functions. (#4418)
  • Governor: Added a mechanism to restrict the address of the proposer using a suffix in the description.
  • GovernorStorage: Added a new governor extension that stores the proposal details in storage, with an interface that operates on proposalId, as well as proposal enumerability. This replaces the old GovernorCompatibilityBravo module. (#4360)
  • GovernorTimelockAccess: Added a module to connect a governor with an instance of AccessManager, allowing the governor to make calls that are delay-restricted by the manager using the normal queue workflow. (#4523)
  • GovernorTimelockControl: Clean up timelock id on execution for gas refund. (#4118)
  • GovernorTimelockControl: Added the Governor instance address as part of the TimelockController operation salt to avoid operation id collisions between governors using the same TimelockController. (#4432)
  • TimelockController: Changed the role architecture to use DEFAULT_ADMIN_ROLE as the admin for all roles, instead of the bespoke TIMELOCK_ADMIN_ROLE that was used previously. This aligns with the general recommendation for AccessControl and makes the addition of new roles easier. Accordingly, the admin parameter and timelock will now be granted DEFAULT_ADMIN_ROLE instead of TIMELOCK_ADMIN_ROLE. (#3799)
  • TimelockController: Added a state getter that returns an OperationState enum. (#4358)
  • Votes: Use Trace208 for checkpoints. This enables EIP-6372 clock support for keys but reduces the max supported voting power to uint208. (#4539)

Metatx

  • ERC2771Forwarder: Added deadline for expiring transactions, batching, and more secure handling of msg.value. (#4346)
  • ERC2771Context: Return the forwarder address whenever the msg.data of a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. msg.data.length is less than 20 bytes), as specified by ERC-2771. (#4481)
  • ERC2771Context: Prevent revert in _msgData() when a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. msg.data.length is less than 20 bytes). Return the full calldata in that case. (#4484)

Proxy

  • ProxyAdmin: Removed getProxyAdmin and getProxyImplementation getters. (#3820)
  • TransparentUpgradeableProxy: Removed admin and implementation getters, which were only callable by the proxy owner and thus not very useful. (#3820)
  • ERC1967Utils: Refactored the ERC1967Upgrade abstract contract as a library. (#4325)
  • TransparentUpgradeableProxy: Admin is now stored in an immutable variable (set during construction) to avoid unnecessary storage reads on every proxy call. This removed the ability to ever change the admin. Transfer of the upgrade capability is exclusively handled through the ownership of the ProxyAdmin. (#4354)
  • Moved the logic to validate ERC-1822 during an upgrade from ERC1967Utils to UUPSUpgradeable. (#4356)
  • UUPSUpgradeable, TransparentUpgradeableProxy and ProxyAdmin: Removed upgradeTo and upgrade functions, and made upgradeToAndCall and upgradeAndCall ignore the data argument if it is empty. It is no longer possible to invoke the receive function (or send value with empty data) along with an upgrade. (#4382)
  • BeaconProxy: Reject value in initialization unless a payable function is explicitly invoked. (#4382)
  • Proxy: Removed redundant receive function. (#4434)
  • BeaconProxy: Use an immutable variable to store the address of the beacon. It is no longer possible for a BeaconProxy to upgrade by changing to another beacon. (#4435)
  • Initializable: Use the namespaced storage pattern to avoid putting critical variables in slot 0. Allow reinitializer versions greater than 256. (#4460)
  • Initializable: Use intermediate variables to improve readability. (#4576)

Token

  • ERC20, ERC721, ERC1155: Deleted _beforeTokenTransfer and _afterTokenTransfer hooks, added a new internal _update function for customizations, and refactored all extensions using those hooks to use _update instead. (#3838, #3876, #4377)
  • ERC20: Removed Approval event previously emitted in transferFrom to indicate that part of the allowance was consumed. With this change, allowances are no longer reconstructible from events. See the code for guidelines on how to re-enable this event if needed. (#4370)
  • ERC20: Removed the non-standard increaseAllowance and decreaseAllowance functions. (#4585)
  • ERC20Votes: Changed internal vote accounting to reusable Votes module previously used by ERC721Votes. Removed implicit ERC20Permit inheritance. Note that the DOMAIN_SEPARATOR getter was previously guaranteed to be available for ERC20Votes contracts, but is no longer available unless ERC20Permit is explicitly used; ERC-5267 support is included in ERC20Votes with EIP712 and is recommended as an alternative. (#3816)
  • SafeERC20: Refactored safeDecreaseAllowance and safeIncreaseAllowance to support USDT-like tokens. (#4260)
  • SafeERC20: Removed safePermit in favor of documentation-only permit recommendations. Based on recommendations from @trust1995 (#4582)
  • ERC721: _approve no longer allows approving the owner of the tokenId. (#4377) _setApprovalForAll no longer allows setting address(0) as an operator. (#4377)
  • ERC721: Renamed _requireMinted to _requireOwned and added a return value with the current owner. Implemented ownerOf in terms of _requireOwned. (#4566)
  • ERC721Consecutive: Added a _firstConsecutiveId internal function that can be overridden to change the id of the first token minted through _mintConsecutive. (#4097)
  • ERC721URIStorage: Allow setting the token URI prior to minting. (#4559)
  • ERC721URIStorage, ERC721Royalty: Stop resetting token-specific URI and royalties when burning. (#4561)
  • ERC1155: Optimized array allocation. (#4196)
  • ERC1155: Removed check for address zero in balanceOf. (#4263)
  • ERC1155: Optimized array accesses by skipping bounds checking when unnecessary. (#4300)
  • ERC1155: Bubble errors triggered in the onERC1155Received and onERC1155BatchReceived hooks. (#4314)
  • ERC1155Supply: Added a totalSupply() function that returns the total amount of token circulating, this change will restrict the total tokens minted across all ids to 2**256-1 . (#3962)
  • ERC1155Receiver: Removed in favor of ERC1155Holder. (#4450)

Utils

  • Address: Removed the ability to customize error messages. A common custom error is always used if the underlying revert reason cannot be bubbled up. (#4502)
  • Arrays: Added unsafeMemoryAccess helpers to read from a memory array without checking the length. (#4300)
  • Arrays: Optimized findUpperBound by removing redundant SLOAD. (#4442)
  • Checkpoints: Library moved from utils to utils/structs (#4275)
  • DoubleEndedQueue: Refactored internal structure to use uint128 instead of int128. This has no effect on the library interface. (#4150)
  • ECDSA: Use unchecked arithmetic for the tryRecover function that receives the r and vs short-signature fields separately. (#4301)
  • EIP712: Added internal getters for the name and version strings (#4303)
  • Math: Makes ceilDiv to revert on 0 division even if the numerator is 0 (#4348)
  • Math: Optimized stack operations in mulDiv. (#4494)
  • Math: Renamed members of Rounding enum, and added a new rounding mode for "away from zero". (#4455)
  • MerkleProof: Use custom error to report invalid multiproof instead of reverting with overflow panic. (#4564)
  • MessageHashUtils: Added a new library for creating message digest to be used along with signing or recovery such as ECDSA or ERC-1271. These functions are moved from the ECDSA library. (#4430)
  • Nonces: Added a new contract to keep track of user nonces. Used for signatures in ERC20Permit, ERC20Votes, and ERC721Votes. (#3816)
  • ReentrancyGuard, Pausable: Moved to utils directory. (#4551)
  • Strings: Renamed toString(int256) to toStringSigned(int256). (#4330)
  • Optimized Strings.equal (#4262)

How to migrate from 4.x

ERC20, ERC721, and ERC1155

These breaking changes will require modifications to ERC20, ERC721, and ERC1155 contracts, since the _afterTokenTransfer and _beforeTokenTransfer functions were removed. Thus, any customization made through those hooks should now be done overriding the new _update function instead.

Minting and burning are implemented by _update and customizations should be done by overriding this function as well. _transfer, _mint and _burn are no longer virtual (meaning they are not overridable) to guard against possible inconsistencies.

For example, a contract using ERC20's _beforeTokenTransfer hook would have to be changed in the following way.

-function _beforeTokenTransfer(
+function _update(
   address from,
   address to,
   uint256 amount
 ) internal virtual override {
-  super._beforeTokenTransfer(from, to, amount);
   require(!condition(), "ERC20: wrong condition");
+  super._update(from, to, amount);
 }

More about ERC721

In the case of ERC721, the _update function does not include a from parameter, as the sender is implicitly the previous owner of the tokenId. The address of this previous owner is returned by the _update function, so it can be used for a posteriori checks. In addition to to and tokenId, a third parameter (auth) is present in this function. This parameter enabled an optional check that the caller/spender is approved to do the transfer. This check cannot be performed after the transfer (because the transfer resets the approval), and doing it before _update would require a duplicate call to _ownerOf.

In this logic of removing hidden SLOADs, the _isApprovedOrOwner function was removed in favor of a new _isAuthorized function. Overrides that used to target the _isApprovedOrOwner should now be performed on the _isAuthorized function. Calls to _isApprovedOrOwner that preceded a call to _transfer, _burn or _approve should be removed in favor of using the auth argument in _update and _approve. This is showcased in ERC721Burnable.burn and in ERC721Wrapper.withdrawTo.

The _exists function was removed. Calls to this function can be replaced by _ownerOf(tokenId) != address(0).

More about ERC1155

Batch transfers will now emit TransferSingle if the batch consists of a single token, while in previous versions the TransferBatch event would be used for all transfers initiated through safeBatchTransferFrom. Both behaviors are compliant with the ERC-1155 specification.

ERC165Storage

Users that were registering EIP-165 interfaces with _registerInterface from ERC165Storage should instead do so so by overriding the supportsInterface function as seen below:

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
}

SafeMath

Methods in SafeMath superseded by native overflow checks in Solidity 0.8.0 were removed along with operations providing an interface for revert strings. The remaining methods were moved to utils/Math.sol.

- import "@openzeppelin/contracts/utils/math/SafeMath.sol";
+ import "@openzeppelin/contracts/utils/math/Math.sol";

 function tryOperations(uint256 x, uint256 y) external view {
-  (bool overflowsAdd, uint256 resultAdd) = SafeMath.tryAdd(x, y);
+  (bool overflowsAdd, uint256 resultAdd) = Math.tryAdd(x, y);
-  (bool overflowsSub, uint256 resultSub) = SafeMath.trySub(x, y);
+  (bool overflowsSub, uint256 resultSub) = Math.trySub(x, y);
-  (bool overflowsMul, uint256 resultMul) = SafeMath.tryMul(x, y);
+  (bool overflowsMul, uint256 resultMul) = Math.tryMul(x, y);
-  (bool overflowsDiv, uint256 resultDiv) = SafeMath.tryDiv(x, y);
+  (bool overflowsDiv, uint256 resultDiv) = Math.tryDiv(x, y);
   // ...
 }

Adapting Governor modules

Custom Governor modules that override internal functions may require modifications if migrated to v5. In particular, the new internal functions _queueOperations and _executeOperations may need to be used. If assistance with this migration is needed reach out via the OpenZeppelin Support Forum.

ECDSA and MessageHashUtils

The ECDSA library is now focused on signer recovery. Previously it also included utility methods for producing digests to be used with signing or recovery. These utilities have been moved to the MessageHashUtils library and should be imported if needed:

 import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
+import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";

 contract Verifier {
   using ECDSA for bytes32;
+  using MessageHashUtils for bytes32;

   function _verify(bytes32 data, bytes memory signature, address account) internal pure returns (bool) {
     return data
       .toEthSignedMessageHash()
       .recover(signature) == account;
   }
 }

Interfaces and libraries in upgradeable contracts

The upgradeable version of the contracts library used to include a variant suffixed with Upgradeable for every contract. These variants, which are produced automatically, mainly include changes for dealing with storage that don't apply to libraries and interfaces.

The upgradeable library no longer includes upgradeable variants for libraries and interfaces. Projects migrating to 5.0 should replace their library and interface imports with their corresponding non-upgradeable version:

 // Libraries
-import {AddressUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol';
+import {Address} from '@openzeppelin/contracts/utils/Address.sol';

 // Interfaces
-import {IERC20Upgradeable} from '@openzeppelin/contracts-upgradeable/interfaces/IERC20.sol';
+import {IERC20} from '@openzeppelin/contracts/interfaces/IERC20.sol';

Offchain Considerations

Some changes may affect offchain systems if they rely on assumptions that are changed along with these new breaking changes. These cases are:

Relying on revert strings for processing errors

A concrete example is AccessControl, where it was previously advised to catch revert reasons using the following regex:

/^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/

Instead, contracts now revert with custom errors. Systems that interact with smart contracts outside of the network should consider reliance on revert strings and possibly support the new custom errors.

Relying on storage locations for retrieving data

After 5.0, the storage location of some variables were changed. This is the case for Initializable and all the upgradeable contracts since they now use namespaced storaged locations. Any system relying on storage locations for retrieving data or detecting capabilities should be updated to support these new locations.

Changes

v4.9.3 - 2023-07-28

Note This release contains a fix for GHSA-g4vp-m682-qqmp.

  • ERC2771Context: Return the forwarder address whenever the msg.data of a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. msg.data.length is less than 20 bytes), as specified by ERC-2771. (#4481)
  • ERC2771Context: Prevent revert in _msgData() when a call originating from a trusted forwarder is not long enough to contain the request signer address (i.e. msg.data.length is less than 20 bytes). Return the full calldata in that case. (#4484)

Changes

v4.9.2 - 2023-06-16

Note This release contains a fix for GHSA-wprv-93r4-jj2p.

  • MerkleProof: Fix a bug in processMultiProof and processMultiProofCalldata that allows proving arbitrary leaves if the tree contains a node with value 0 at depth 1.

Changes

v4.9.1 - 2023-06-07

Note This release contains a fix for GHSA-5h3x-9wvq-w4m2.

  • Governor: Add a mechanism to restrict the address of the proposer using a suffix in the description.

Changes

v4.9.0 - 2023-05-23

  • ReentrancyGuard: Add a _reentrancyGuardEntered function to expose the guard status. (#3714)
  • ERC721Wrapper: add a new extension of the ERC721 token which wraps an underlying token. Deposit and withdraw guarantee that the ownership of each token is backed by a corresponding underlying token with the same identifier. (#3863)
  • EnumerableMap: add a keys() function that returns an array containing all the keys. (#3920)
  • Governor: add a public cancel(uint256) function. (#3983)
  • Governor: Enable timestamp operation for blockchains without a stable block time. This is achieved by connecting a Governor's internal clock to match a voting token's EIP-6372 interface. (#3934)
  • Strings: add equal method. (#3774)
  • IERC5313: Add an interface for EIP-5313 that is now final. (#4013)
  • IERC4906: Add an interface for ERC-4906 that is now Final. (#4012)
  • StorageSlot: Add support for string and bytes. (#4008)
  • Votes, ERC20Votes, ERC721Votes: support timestamp checkpointing using EIP-6372. (#3934)
  • ERC4626: Add mitigation to the inflation attack through virtual shares and assets. (#3979)
  • Strings: add toString method for signed integers. (#3773)
  • ERC20Wrapper: Make the underlying variable private and add a public accessor. (#4029)
  • EIP712: add EIP-5267 support for better domain discovery. (#3969)
  • AccessControlDefaultAdminRules: Add an extension of AccessControl with additional security rules for the DEFAULT_ADMIN_ROLE. (#4009)
  • SignatureChecker: Add isValidERC1271SignatureNow for checking a signature directly against a smart contract using ERC-1271. (#3932)
  • SafeERC20: Add a forceApprove function to improve compatibility with tokens behaving like USDT. (#4067)
  • ERC1967Upgrade: removed contract-wide oz-upgrades-unsafe-allow delegatecall annotation, replaced by granular annotation in UUPSUpgradeable. (#3971)
  • ERC20Wrapper: self wrapping and deposit by the wrapper itself are now explicitly forbidden. (#4100)
  • ECDSA: optimize bytes32 computation by using assembly instead of abi.encodePacked. (#3853)
  • ERC721URIStorage: Emit ERC-4906 MetadataUpdate in _setTokenURI. (#4012)
  • ShortStrings: Added a library for handling short strings in a gas efficient way, with fallback to storage for longer strings. (#4023)
  • SignatureChecker: Allow return data length greater than 32 from EIP-1271 signers. (#4038)
  • UUPSUpgradeable: added granular oz-upgrades-unsafe-allow-reachable annotation to improve upgrade safety checks on latest version of the Upgrades Plugins (starting with @openzeppelin/upgrades-core@1.21.0). (#3971)
  • Initializable: optimize _disableInitializers by using != instead of <. (#3787)
  • Ownable2Step: make acceptOwnership public virtual to enable usecases that require overriding it. (#3960)
  • UUPSUpgradeable.sol: Change visibility to the functions upgradeTo and upgradeToAndCall from external to public. (#3959)
  • TimelockController: Add the CallSalt event to emit on operation schedule. (#4001)
  • Reformatted codebase with latest version of Prettier Solidity. (#3898)
  • Math: optimize log256 rounding check. (#3745)
  • ERC20Votes: optimize by using unchecked arithmetic. (#3748)
  • Multicall: annotate multicall function as upgrade safe to not raise a flag for its delegatecall. (#3961)
  • ERC20Pausable, ERC721Pausable, ERC1155Pausable: Add note regarding missing public pausing functionality (#4007)
  • ECDSA: Add a function toDataWithIntendedValidatorHash that encodes data with version 0x00 following EIP-191. (#4063)
  • MerkleProof: optimize by using unchecked arithmetic. (#3745)

Breaking changes

  • EIP712: Addition of ERC5267 support requires support for user defined value types, which was released in Solidity version 0.8.8. This requires a pragma change from ^0.8.0 to ^0.8.8.
  • EIP712: Optimization of the cache for the upgradeable version affects the way name and version are set. This is no longer done through an initializer, and is instead part of the implementation's constructor. As a consequence, all proxies using the same implementation will necessarily share the same name and version. Additionally, an implementation upgrade risks changing the EIP712 domain unless the same name and version are used when deploying the new implementation contract.

Deprecations

  • ERC20Permit: Added the file IERC20Permit.sol and ERC20Permit.sol and deprecated draft-IERC20Permit.sol and draft-ERC20Permit.sol since EIP-2612 is no longer a Draft. Developers are encouraged to update their imports. (#3793)
  • Timers: The Timers library is now deprecated and will be removed in the next major release. (#4062)
  • ERC777: The ERC777 token standard is no longer supported by OpenZeppelin. Our implementation is now deprecated and will be removed in the next major release. The corresponding standard interfaces remain available. (#4066)
  • ERC1820Implementer: The ERC1820 pseudo-introspection mechanism is no longer supported by OpenZeppelin. Our implementation is now deprecated and will be removed in the next major release. The corresponding standard interfaces remain available. (#4066)

Changes

v4.8.3 - 2023-04-13

Note This release contains fixes for https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-mx2q-35m2-x2rh and https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-93hq-5wgc-jc82.

  • GovernorCompatibilityBravo: Fix encoding of proposal data when signatures are missing.
  • TransparentUpgradeableProxy: Fix transparency in case of selector clash with non-decodable calldata or payable mutability. (#4154)

Changes

v4.8.2 - 2023-03-02

Note This release contains a fix for https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-878m-3g6q-594q.

  • ERC721Consecutive: Fixed a bug when _mintConsecutive is used for batches of size 1 that could lead to balance overflow. Refer to the breaking changes section in the changelog for a note on the behavior of ERC721._beforeTokenTransfer.

Breaking changes

  • ERC721: The internal function _beforeTokenTransfer no longer updates balances, which it previously did when batchSize was greater than 1. This change has no consequence unless a custom ERC721 extension is explicitly invoking _beforeTokenTransfer. Balance updates in extensions must now be done explicitly using __unsafe_increaseBalance, with a name that indicates that there is an invariant that has to be manually verified.

Changes

v4.8.1 - 2023-01-13

  • ERC4626: Use staticcall instead of call when fetching underlying ERC-20 decimals. (#3943)

Changes

v4.8.0 - 2022-11-08

Note Don't miss the section on Breaking changes at the end.

  • TimelockController: Added a new admin constructor parameter that is assigned the admin role instead of the deployer account. (#3722)
  • Initializable: add internal functions _getInitializedVersion and _isInitializing (#3598)
  • ERC165Checker: add supportsERC165InterfaceUnchecked for consulting individual interfaces without the full ERC165 protocol. (#3339)
  • Address: optimize functionCall by calling functionCallWithValue directly. (#3468)
  • Address: optimize functionCall functions by checking contract size only if there is no returned data. (#3469)
  • Governor: make the relay function payable, and add support for EOA payments. (#3730)
  • GovernorCompatibilityBravo: remove unused using statements. (#3506)
  • ERC20: optimize _transfer, _mint and _burn by using unchecked arithmetic when possible. (#3513)
  • ERC20Votes, ERC721Votes: optimize getPastVotes for looking up recent checkpoints. (#3673)
  • ERC20FlashMint: add an internal _flashFee function for overriding. (#3551)
  • ERC4626: use the same decimals() as the underlying asset by default (if available). (#3639)
  • ERC4626: add internal _initialConvertToShares and _initialConvertToAssets functions to customize empty vaults behavior. (#3639)
  • ERC721: optimize transfers by making approval clearing implicit instead of emitting an event. (#3481)
  • ERC721: optimize burn by making approval clearing implicit instead of emitting an event. (#3538)
  • ERC721: Fix balance accounting when a custom _beforeTokenTransfer hook results in a transfer of the token under consideration. (#3611)
  • ERC721: use unchecked arithmetic for balance updates. (#3524)
  • ERC721Consecutive: Implementation of EIP-2309 that allows batch minting of ERC721 tokens during construction. (#3311)
  • ReentrancyGuard: Reduce code size impact of the modifier by using internal functions. (#3515)
  • SafeCast: optimize downcasting of signed integers. (#3565)
  • ECDSA: Remove redundant check on the v value. (#3591)
  • VestingWallet: add releasable getters. (#3580)
  • VestingWallet: remove unused library Math.sol. (#3605)
  • VestingWallet: make constructor payable. (#3665)
  • Create2: optimize address computation by using assembly instead of abi.encodePacked. (#3600)
  • Clones: optimized the assembly to use only the scratch space during deployments, and optimized predictDeterministicAddress to use fewer operations. (#3640)
  • Checkpoints: Use procedural generation to support multiple key/value lengths. (#3589)
  • Checkpoints: Add new lookup mechanisms. (#3589)
  • Arrays: Add unsafeAccess functions that allow reading and writing to an element in a storage array bypassing Solidity's "out-of-bounds" check. (#3589)
  • Strings: optimize toString. (#3573)
  • Ownable2Step: extension of Ownable that makes the ownership transfers a two step process. (#3620)
  • Math and SignedMath: optimize function max by using > instead of >=. (#3679)
  • Math: Add log2, log10 and log256. (#3670)
  • Arbitrum: Update the vendored arbitrum contracts to match the nitro upgrade. (#3692)

Breaking changes

  • ERC721: In order to add support for batch minting via ERC721Consecutive it was necessary to make a minor breaking change in the internal interface of ERC721. Namely, the hooks _beforeTokenTransfer and _afterTokenTransfer have one additional argument that may need to be added to overrides:
 function _beforeTokenTransfer(
     address from,
     address to,
     uint256 tokenId,
+    uint256 batchSize
 ) internal virtual override
  • ERC4626: Conversion from shares to assets (and vice-versa) in an empty vault used to consider the possible mismatch between the underlying asset's and the vault's decimals. This initial conversion rate is now set to 1-to-1 irrespective of decimals, which are meant for usability purposes only. The vault now uses the assets decimals by default, so off-chain the numbers should appear the same. Developers overriding the vault decimals to a value that does not match the underlying asset may want to override the _initialConvertToShares and _initialConvertToAssets to replicate the previous behavior.

  • TimelockController: During deployment, the TimelockController used to grant the TIMELOCK_ADMIN_ROLE to the deployer and to the timelock itself. The deployer was then expected to renounce this role once configuration of the timelock is over. Failing to renounce that role allows the deployer to change the timelock permissions (but not to bypass the delay for any time-locked actions). The role is no longer given to the deployer by default. A new parameter admin can be set to a non-zero address to grant the admin role during construction (to the deployer or any other address). Just like previously, this admin role should be renounced after configuration. If this param is given address(0), the role is not allocated and doesn't need to be revoked. In any case, the timelock itself continues to have this role.

Deprecations

  • EIP712: Added the file EIP712.sol and deprecated draft-EIP712.sol since the EIP is no longer a Draft. Developers are encouraged to update their imports. (#3621)
-import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
+import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
  • ERC721Votes: Added the file ERC721Votes.sol and deprecated draft-ERC721Votes.sol since it no longer depends on a Draft EIP (EIP-712). Developers are encouraged to update their imports. (#3699)
-import "@openzeppelin/contracts/token/ERC721/extensions/draft-ERC721Votes.sol";
+import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Votes.sol";

ERC-721 Compatibility Note

ERC-721 integrators that interpret contract state from events should make sure that they implement the clearing of approval that is implicit in every transfer according to the EIP. Previous versions of OpenZeppelin Contracts emitted an explicit Approval event even though it was not required by the specification, and this is no longer the case.

With the new ERC721Consecutive extension, the internal workings of ERC721 are slightly changed. Custom extensions to ERC721 should be reviewed to ensure they remain correct. The internal functions that should be considered are _ownerOf (new), _beforeTokenTransfer, and _afterTokenTransfer.

Changes

v4.7.3 - 2022-08-10

:warning: This is a patch for a high severity issue. For more information visit the security advisory.

Breaking changes

  • ECDSA: recover(bytes32,bytes) and tryRecover(bytes32,bytes) no longer accept compact signatures to prevent malleability. Compact signature support remains available using recover(bytes32,bytes32,bytes32) and tryRecover(bytes32,bytes32,bytes32).

Changes

v4.7.2 - 2022-07-28

:warning: This is a patch for three issues, including a high severity issue in GovernorVotesQuorumFraction. For more information visit the security advisories (1, 2, 3).

  1. GovernorVotesQuorumFraction: Fixed quorum updates so they do not affect past proposals that failed due to lack of quorum. (#3561)
  2. ERC165Checker: Added protection against large returndata. (#3587)
  3. LibArbitrumL2, CrossChainEnabledArbitrumL2: Fixed detection of cross-chain calls for EOAs. Previously, calls from EOAs would be classified as cross-chain calls. (#3578)

Changes

v4.7.1 - 2022-07-20

:warning: This is a patch for a medium severity issue affecting SignatureChecker and a high severity issue affecting ERC165Checker. For more information visit the security advisories (1, 2).

  • SignatureChecker: Fix an issue that causes isValidSignatureNow to revert when the target contract returns ill-encoded data. (#3552)
  • ERC165Checker: Fix an issue that causes supportsInterface to revert when the target contract returns ill-encoded data. (#3552)

Changes

v4.7.0 - 2022-06-30

  • TimelockController: Migrate _call to _execute and allow inheritance and overriding similar to Governor. (#3317)
  • CrossChainEnabledPolygonChild: replace the require statement with the custom error NotCrossChainCall. (#3380)
  • ERC20FlashMint: Add customizable flash fee receiver. (#3327)
  • ERC4626: add an extension of ERC20 that implements the ERC4626 Tokenized Vault Standard. (#3171)
  • SafeERC20: add safePermit as mitigation against phantom permit functions. (#3280)
  • Math: add a mulDiv function that can round the result either up or down. (#3171)
  • Math: Add a sqrt function to compute square roots of integers, rounding either up or down. (#3242)
  • Strings: add a new overloaded function toHexString that converts an address with fixed length of 20 bytes to its not checksummed ASCII string hexadecimal representation. (#3403)
  • EnumerableMap: add new UintToUintMap map type. (#3338)
  • EnumerableMap: add new Bytes32ToUintMap map type. (#3416)
  • SafeCast: add support for many more types, using procedural code generation. (#3245)
  • MerkleProof: add multiProofVerify to prove multiple values are part of a Merkle tree. (#3276)
  • MerkleProof: add calldata versions of the functions to avoid copying input arrays to memory and save gas. (#3200)
  • ERC721, ERC1155: simplified revert reasons. (#3254, (#3438))
  • ERC721: removed redundant require statement. (#3434)
  • PaymentSplitter: add releasable getters. (#3350)
  • Initializable: refactored implementation of modifiers for easier understanding. (#3450)
  • Proxies: remove runtime check of ERC1967 storage slots. (#3455)

Breaking changes

  • Initializable: functions decorated with the modifier reinitializer(1) may no longer invoke each other.

Changes

v4.6.0 - 2022-04-29

  • crosschain: Add a new set of contracts for cross-chain applications. CrossChainEnabled is a base contract with instantiations for several chains and bridges, and AccessControlCrossChain is an extension of access control that allows cross-chain operation. (#3183)
  • AccessControl: add a virtual _checkRole(bytes32) function that can be overridden to alter the onlyRole modifier behavior. (#3137)
  • EnumerableMap: add new AddressToUintMap map type. (#3150)
  • EnumerableMap: add new Bytes32ToBytes32Map map type. (#3192)
  • ERC20FlashMint: support infinite allowance when paying back a flash loan. (#3226)
  • ERC20Wrapper: the decimals() function now tries to fetch the value from the underlying token instance. If that calls revert, then the default value is used. (#3259)
  • draft-ERC20Permit: replace immutable with constant for _PERMIT_TYPEHASH since the keccak256 of string literals is treated specially and the hash is evaluated at compile time. (#3196)
  • ERC1155: Add a _afterTokenTransfer hook for improved extensibility. (#3166)
  • ERC1155URIStorage: add a new extension that implements a _setURI behavior similar to ERC721's _setTokenURI. (#3210)
  • DoubleEndedQueue: a new data structure that supports efficient push and pop to both front and back, useful for FIFO and LIFO queues. (#3153)
  • Governor: improved security of onlyGovernance modifier when using an external executor contract (e.g. a timelock) that can operate without necessarily going through the governance protocol. (#3147)
  • Governor: Add a way to parameterize votes. This can be used to implement voting systems such as fractionalized voting, ERC721 based voting, or any number of other systems. The params argument added to _countVote method, and included in the newly added _getVotes method, can be used by counting and voting modules respectively for such purposes. (#3043)
  • Governor: rewording of revert reason for consistency. (#3275)
  • Governor: fix an inconsistency in data locations that could lead to invalid bytecode being produced. (#3295)
  • Governor: Implement IERC721Receiver and IERC1155Receiver to improve token custody by governors. (#3230)
  • TimelockController: Implement IERC721Receiver and IERC1155Receiver to improve token custody by timelocks. (#3230)
  • TimelockController: Add a separate canceller role for the ability to cancel. (#3165)
  • Initializable: add a reinitializer modifier that enables the initialization of new modules, added to already initialized contracts through upgradeability. (#3232)
  • Initializable: add an Initialized event that tracks initialized version numbers. (#3294)
  • ERC2981: make royaltiInfo public to allow super call in overrides. (#3305)

Upgradeability notice

  • TimelockController: (Action needed) The upgrade from <4.6 to >=4.6 introduces a new CANCELLER_ROLE that requires set up to be assignable. After the upgrade, only addresses with this role will have the ability to cancel. Proposers will no longer be able to cancel. Assigning cancellers can be done by an admin (including the timelock itself) once the role admin is set up. To do this, we recommend upgrading to the TimelockControllerWith46MigrationUpgradeable contract and then calling the migrateTo46 function.

Breaking changes

  • Governor: Adds internal virtual _getVotes method that must be implemented; this is a breaking change for existing concrete extensions to Governor. To fix this on an existing voting module extension, rename getVotes to _getVotes and add a bytes memory argument. (#3043)
  • Governor: Adds params parameter to internal virtual _countVote method; this is a breaking change for existing concrete extensions to Governor. To fix this on an existing counting module extension, add a bytes memory argument to _countVote. (#3043)
  • Governor: Does not emit VoteCast event when params data is non-empty; instead emits VoteCastWithParams event. To fix this on an integration that consumes the VoteCast event, also fetch/monitor VoteCastWithParams events. (#3043)
  • Votes: The internal virtual function _getVotingUnits was made view (which was accidentally missing). Any overrides should now be updated so they are view as well.

Changes

v4.5.0 - 2022-02-09

  • ERC2981: add implementation of the royalty standard, and the respective extensions for ERC721 and ERC1155. (#3012)
  • GovernorTimelockControl: improve the state() function to have it reflect cases where a proposal has been canceled directly on the timelock. (#2977)
  • Preset contracts are now deprecated in favor of Contracts Wizard. (#2986)
  • Governor: add a relay function to help recover assets sent to a governor that is not its own executor (e.g. when using a timelock). (#2926)
  • GovernorPreventLateQuorum: add new module to ensure a minimum voting duration is available after the quorum is reached. (#2973)
  • ERC721: improved revert reason when transferring from wrong owner. (#2975)
  • Votes: Added a base contract for vote tracking with delegation. (#2944)
  • ERC721Votes: Added an extension of ERC721 enabled with vote tracking and delegation. (#2944)
  • ERC2771Context: use immutable storage to store the forwarder address, no longer an issue since Solidity >=0.8.8 allows reading immutable variables in the constructor. (#2917)
  • Base64: add a library to parse bytes into base64 strings using encode(bytes memory) function, and provide examples to show how to use to build URL-safe tokenURIs. (#2884)
  • ERC20: reduce allowance before triggering transfer. (#3056)
  • ERC20: do not update allowance on transferFrom when allowance is type(uint256).max. (#3085)
  • ERC20: add a _spendAllowance internal function. (#3170)
  • ERC20Burnable: do not update allowance on burnFrom when allowance is type(uint256).max. (#3170)
  • ERC777: do not update allowance on transferFrom when allowance is type(uint256).max. (#3085)
  • ERC777: add a _spendAllowance internal function. (#3170)
  • SignedMath: a new signed version of the Math library with max, min, and average. (#2686)
  • SignedMath: add a abs(int256) method that returns the unsigned absolute value of a signed value. (#2984)
  • ERC1967Upgrade: Refactor the secure upgrade to use ERC1822 instead of the previous rollback mechanism. This reduces code complexity and attack surface with similar security guarantees. (#3021)
  • UUPSUpgradeable: Add ERC1822 compliance to support the updated secure upgrade mechanism. (#3021)
  • Some more functions have been made virtual to customize them via overrides. In many cases this will not imply that other functions in the contract will automatically adapt to the overridden definitions. People who wish to override should consult the source code to understand the impact and if they need to override any additional functions to achieve the desired behavior.

Breaking changes

  • ERC1967Upgrade: The function _upgradeToAndCallSecure was renamed to _upgradeToAndCallUUPS, along with the change in security mechanism described above.
  • Address: The Solidity pragma is increased from ^0.8.0 to ^0.8.1. This is required by the account.code.length syntax that replaces inline assembly. This may require users to bump their compiler version from 0.8.0 to 0.8.1 or later. Note that other parts of the code already include stricter requirements.

Changes

v4.4.2 - 2022-01-11

:warning: This is a patch for a medium severity issue. For more information visit the security advisory.

  • GovernorCompatibilityBravo: Fix error in the encoding of calldata for proposals submitted through the compatibility interface with explicit signatures. (#3100)

Changes

v4.4.1 - 2021-12-14

:warning: This is a patch for a low severity vulnerability. For more information visit the security advisory.

  • Initializable: change the existing initializer modifier and add a new onlyInitializing modifier to prevent reentrancy risk. (#3006)

Breaking change

It is no longer possible to call an initializer-protected function from within another initializer function outside the context of a constructor. Projects using OpenZeppelin upgradeable proxies should continue to work as is, since in the common case the initializer is invoked in the constructor directly. If this is not the case for you, the suggested change is to use the new onlyInitializing modifier in the following way:

 contract A {
-    function initialize() public   initializer { ... }
+    function initialize() internal onlyInitializing { ... }
 }
 contract B is A {
     function initialize() public initializer {
         A.initialize();
     }
 }

Changes

v4.4.0 - 2021-11-25

Check out the first OpenZeppelin Community Call where the team discussed everything that is included in this release.

And if you missed it, we recently announced an official bug bounty program for OpenZeppelin Contracts. Check it out!

  • Ownable: add an internal _transferOwnership(address). (#2568)
  • AccessControl: add internal _grantRole(bytes32,address) and _revokeRole(bytes32,address). (#2568)
  • AccessControl: mark _setupRole(bytes32,address) as deprecated in favor of _grantRole(bytes32,address). (#2568)
  • AccessControlEnumerable: hook into _grantRole(bytes32,address) and _revokeRole(bytes32,address). (#2946)
  • EIP712: cache address(this) to immutable storage to avoid potential issues if a vanilla contract is used in a delegatecall context. (#2852)
  • Add internal _setApprovalForAll to ERC721 and ERC1155. (#2834)
  • Governor: shift vote start and end by one block to better match Compound's GovernorBravo and prevent voting at the Governor level if the voting snapshot is not ready. (#2892)
  • GovernorCompatibilityBravo: consider quorum an inclusive rather than exclusive minimum to match Compound's GovernorBravo. (#2974)
  • GovernorSettings: a new governor module that manages voting settings updatable through governance actions. (#2904)
  • PaymentSplitter: now supports ERC20 assets in addition to Ether. (#2858)
  • ECDSA: add a variant of toEthSignedMessageHash for arbitrary length message hashing. (#2865)
  • MerkleProof: add a processProof function that returns the rebuilt root hash given a leaf and a proof. (#2841)
  • VestingWallet: new contract that handles the vesting of Ether and ERC20 tokens following a customizable vesting schedule. (#2748)
  • Governor: enable receiving Ether when a Timelock contract is not used. (#2748)
  • GovernorTimelockCompound: fix ability to use Ether stored in the Timelock contract. (#2748)

Changes

v4.3.3 - 2021-11-15

:warning: This is a security patch. For more information visit the security advisory.

  • ERC1155Supply: Handle totalSupply changes by hooking into _beforeTokenTransfer to ensure consistency of balances and supply during IERC1155Receiver.onERC1155Received calls.

Changes

v4.3.2 - 2021-09-14

:warning: This is a security patch. For more information visit the security advisory.

  • UUPSUpgradeable: Add modifiers to prevent upgradeTo and upgradeToAndCall being executed on any contract that is not the active ERC1967 proxy. This prevents these functions being called on implementation contracts or minimal ERC1167 clones, in particular.

Changes

v4.3.1 - 2021-08-26

:warning: This is a security patch. For more information visit the security advisory.

  • TimelockController: Add additional isOperationReady check.

Changes

v3.4.2-solc-0.7 - 2021-08-26

  • TimelockController: Add additional isOperationReady check.

Changes

v3.4.2 - 2021-08-26

  • TimelockController: Add additional isOperationReady check.

Changes

v4.3.0 - 2021-08-17

Visit our blog for the full 4.3 announcement as well as Governor announcement!

  • ERC2771Context: use private variable from storage to store the forwarder address. Fixes issues where _msgSender() was not callable from constructors. (#2754)
  • EnumerableSet: add values() functions that returns an array containing all values in a single call. (#2768)
  • Governor: added a modular system of Governor contracts based on GovernorAlpha and GovernorBravo. (#2672)
  • Add an interfaces folder containing solidity interfaces to final ERCs. (#2517)
  • ECDSA: add tryRecover functions that will not throw if the signature is invalid, and will return an error flag instead. (#2661)
  • SignatureChecker: Reduce gas usage of the isValidSignatureNow function for the "signature by EOA" case. (#2661)

Changes

v4.2.0 - 2021-06-30

Read the full announcement in the blog!


  • ERC20Votes: add a new extension of the ERC20 token with support for voting snapshots and delegation. (#2632)
  • ERC20VotesComp: Variant of ERC20Votes that is compatible with Compound's Comp token interface but restricts supply to uint96. (#2706)
  • ERC20Wrapper: add a new extension of the ERC20 token which wraps an underlying token. Deposit and withdraw guarantee that the total supply is backed by a corresponding amount of underlying token. (#2633)
  • Enumerables: Improve gas cost of removal in EnumerableSet and EnumerableMap.
  • Enumerables: Improve gas cost of lookup in EnumerableSet and EnumerableMap.
  • Counter: add a reset method. (#2678)
  • Tokens: Wrap definitely safe subtractions in unchecked blocks.
  • Math: Add a ceilDiv method for performing ceiling division.
  • ERC1155Supply: add a new ERC1155 extension that keeps track of the totalSupply of each tokenId. (#2593)
  • BitMaps: add a new BitMaps library that provides a storage efficient datastructure for uint256 to bool mapping with contiguous keys. (#2710)

Breaking Changes

  • ERC20FlashMint is no longer a Draft ERC. (#2673))

How to update: Change your import paths by removing the draft- prefix from @openzeppelin/contracts/token/ERC20/extensions/draft-ERC20FlashMint.sol.

See Releases and Stability: Drafts.

Changes

v4.1.0 - 2021-04-30

Read the full announcement in the blog or check out the changelog.

  • IERC20Metadata: add a new extended interface that includes the optional name(), symbol() and decimals() functions. (#2561)
  • ERC777: make reception acquirement optional in _mint. (#2552)
  • ERC20Permit: add a _useNonce to enable further usage of ERC712 signatures. (#2565)
  • ERC20FlashMint: add an implementation of the ERC3156 extension for flash-minting ERC20 tokens. (#2543)
  • SignatureChecker: add a signature verification library that supports both EOA and ERC1271 compliant contracts as signers. (#2532)
  • Multicall: add abstract contract with multicall(bytes[] calldata data) function to bundle multiple calls together (#2608)
  • ECDSA: add support for ERC2098 short-signatures. (#2582)
  • AccessControl: add a onlyRole modifier to restrict specific function to callers bearing a specific role. (#2609)
  • StorageSlot: add a library for reading and writing primitive types to specific storage slots. (#2542)
  • UUPS Proxies: add UUPSUpgradeable to implement the UUPS proxy pattern together with EIP1967Proxy. (#2542)

Changes

v4.0.0 - 2021-03-24

Read the full announcement in the blog or check out the changelog.

Changelog

  • Now targeting the 0.8.x line of Solidity compilers. For 0.6.x (resp 0.7.x) support, use version 3.4.0 (resp 3.4.0-solc-0.7) of OpenZeppelin.
  • Context: making _msgData return bytes calldata instead of bytes memory (#2492)
  • ERC20: removed the _setDecimals function and the storage slot associated to decimals. (#2502)
  • Strings: addition of a toHexString function. (#2504)
  • EnumerableMap: change implementation to optimize for key → value lookups instead of enumeration. (#2518)
  • GSN: deprecate GSNv1 support in favor of upcoming support for GSNv2. (#2521)
  • ERC165: remove uses of storage in the base ERC165 implementation. ERC165 based contracts now use storage-less virtual functions. Old behavior remains available in the ERC165Storage extension. (#2505)
  • Initializable: make initializer check stricter during construction. (#2531)
  • ERC721: remove enumerability of tokens from the base implementation. This feature is now provided separately through the ERC721Enumerable extension. (#2511)
  • AccessControl: removed enumerability by default for a more lightweight contract. It is now opt-in through AccessControlEnumerable. (#2512)
  • Meta Transactions: add ERC2771Context and a MinimalForwarder for meta-transactions. (#2508)
  • Overall reorganization of the contract folder to improve clarity and discoverability. (#2503)
  • ERC20Capped: optimize gas usage by enforcing the check directly in _mint. (#2524)
  • Rename UpgradeableProxy to ERC1967Proxy. (#2547)
  • ERC777: optimize the gas costs of the constructor. (#2551)
  • ERC721URIStorage: add a new extension that implements the _setTokenURI behavior as it was available in 3.4.0. (#2555)
  • AccessControl: added ERC165 interface detection. (#2562)
  • ERC1155: make uri public so overloading function can call it using super. (#2576)

How to upgrade from 3.x

Since this version has moved a few contracts to different directories, users upgrading from a previous version will need to adjust their import statements. To make this easier, the package includes a script that will migrate import statements automatically. After upgrading to the latest version of the package, run:

npx openzeppelin-contracts-migrate-imports

Make sure you're using git or another version control system to be able to recover from any potential error in our script.

Changes

v3.4.0 - 2021-02-03

Read the full announcement in the blog or check out the changelog.

Security Fixes

  • ERC777: fix potential reentrancy issues for custom extensions to ERC777. (#2483)

If you're using our implementation of ERC777 from version 3.3.0 or earlier, and you define a custom _beforeTokenTransfer function that writes to a storage variable, you may be vulnerable to a reentrancy attack. If you're affected and would like assistance please write to security@openzeppelin.com. Read more in the pull request.

Changes

v3.3.0 - 2020-11-27

Read the full announcement in the forum or check out the changelog.

  • Now supports both Solidity 0.6 and 0.7. Compiling with solc 0.7 will result in warnings. Install the solc-0.7 tag to compile without warnings.
  • TimelockController: added a contract to augment access control schemes with a delay. (#2354)
  • Address: added functionStaticCall, similar to the existing functionCall. (#2333)
  • EnumerableSet: added Bytes32Set, for sets of bytes32. (#2395)

Changes

v3.2.1 for Solidity 0.7 (v3.2.1-solc-0.7) - 2020-09-15

This is a special release for Solidity 0.7 that gets rid of a warning in ERC777 using one of the new features of the language. (#2327)

Note: The variant for Solidity 0.7 can be installed using npm install @openzeppelin/contracts@solc-0.7.

Changes

v3.2.0 - 2020-09-11

Welcome to a new release of OpenZeppelin Contracts! :dancers:

The big feature in this release is that we’ve migrated our proxy contracts from OpenZeppelin SDK into the Contracts project. We hope this will make more people aware of upgrades in Ethereum, and we also think the contracts will benefit greatly from the continued scrutiny by all of you in the community. This was also a migration of the proxies from Solidity 0.5 to 0.6, which we know some users have been waiting for.

For Solidity 0.7 users, a reminder that we have support for the newer compiler version published on npm under the tag solc-0.7, the latest release being 3.2.0-solc-0.7. We’re considering officially switching to 0.7 for the release after this one.

There is additionally a small breaking change in ERC20Snapshot that may affect some of its users. If you’re one of them please take a look at the changelog.

Changes

v3.1.0 - 2020-06-29

This is the first release since v3.0, our last major release. It includes the long-awaited ERC1155 token and helpers for safe calls and downcasts, as well as a number of minor improvements.

To install this release, run:

npm install --save-dev @openzeppelin/contracts

ERC1155

This is a new token standard developed by the gaming industry, focusing on gas efficiency. It's key difference is that it is a multi-token contract: a single ERC1155 can be used to represent an arbitrary number of tokens, which is very useful in applications that require many tokens by removing the high gas costs associated with deploying them. Check out our new documentation page to learn more!.

More Replacements for call

The low-level call primitive can be hard to use correctly and is often considered unsafe. With the addition of sendValue in Contracts and try-catch in Solidity, there's only a few scenarios in which call is still needed, the most troublesome one being forwarding calls.

The new functionCall helpers can forward call data to a recipient contract while imitating Solidity's function call semantics, such as bubbling up revert reasons and rejecting calls to EOAs. We expect the addition of these functions to greatly reduce the need to rely on call.

Using SafeMath on Small Signed Integers

We've expanded the scope of the SafeCast library to also include signed integer downcasting, which allows for users that need small types (such as int8 or int32) to perform checked arithmetic on them by using SafeMath, and then downcast the result to the intended size.

Changes

OpenZeppelin Contracts 3.0.1 (v3.0.1) - 2020-04-27

This is a small bugfix release, addressing an issue that allowed for some internal functions in ERC777 to be called with the zero address as one of their arguments.

This was reported in #2208, fixed in #2212 for the v2.5 branch, and ported to the v3.0 branch in #2213.

Changes

OpenZeppelin Contracts 2.5.1 (v2.5.1) - 2020-04-27

This is a small bugfix release, addressing an issue that allowed for some internal functions in ERC777 to be called with the zero address as one of their arguments.

This was reported in #2208 and fixed in #2212.

Changes

OpenZeppelin Contracts 3.0 (v3.0.0) - 2020-04-20

We're thrilled to finally announce the release of OpenZeppelin Contracts v3.0 :sparkles:

Among other things, this release features the migration to Solidity v0.6, as well as a revamped access control system, streamlined token contracts, and new libraries for enumerable mappings.

To install this latest release, run:

npm install --save-dev @openzeppelin/contracts

What's New

  • All contracts were migrated to Solidity v0.6.
  • AccessControl was designed with help from the community and has replaced Roles contracts (such as MinterRole and PauserRole), which were removed.
  • Crowdsales were removed: we'll continue to provide support for security issues on the v2.5 release, but will not bring them over to v3.0.
  • We've added hooks, a new feature of the library that will make extending it easier than ever.
  • ERC20 and ERC721 were simplified and streamlined, including all optional parts of the standard by default, and simplifying some of our own custom extensions.
  • Support for better mapping types that let you efficiently iterate over all keys using EnumerableSet and EnumerableMap
  • Many, many breaking changes with small improvements. We've also moved some contracts around (e.g. Ownable is now found under the access directory) and deleted some that were not being used. Head to our changelog to see the full list.

Compiling v0.6 Contracts

You can use the OpenZeppelin CLI to compile any Solidity v0.6 contract: just update the pragma statement on your source code and you'll be good to go!

pragma solidity ^0.6.0;

Note that you will need to use the v2.7 release of the CLI or newer to have Solidity v0.6 support. For detailed information about using the CLI compiler, head to its documenation.

Revamped Access Control

One of our most widely-used contracts is Ownable, providing a simple authorization scheme. However, this fell short in complex systems with multiple permissions.

The v3.0 release introduces AccessControl, a one-stop-shop for all authorization needs. It lets you easily define multiple roles with different permissions, as well as which accounts are allowed to grant and revoke each role. It also boosts transparency by enabling enumeration of all privileged accounts in a system.

AccessControl was designed with a security-first mindset, receiving input from a wide array of users and incorporating best practices in the field. Head to our Access Control guide for more information!

Preset Contracts

OpenZeppelin Contracts shine when you need the building blocks to get to the right feature set, but that's not all they can do! We've added a new family of Preset contracts starting with ERC20 and ERC721 tokens that you can quickly deploy as-is without having to write any Solidity code. Check out their documentation!

Migrating From OpenZeppelin Contracts v2.5

Other than the moved and deleted contracts mentioned above, the library API is pretty much the same as in the v2.5 release, so the migration should be straightforward. For instructions on how to update your Solidity v0.5 contracts to v0.6, refer to the official documentation.

If you're using the ERC20 or ERC721 tokens however, you'll have to remove all references to optional extensions (ERC20Detailed, ERC721Enumerable, etc.) - these have been included in the base contracts.

The other exception to this are contracts that use the Gas Station Network (GSN): if you're inheriting from GSNRecipient or one of the other GSN contracts, you'll need to add the following snippet to your contracts:

function _msgSender() internal view override(Context, GSNRecipient) returns (address payable) {
    return GSNRecipient._msgSender();
}

function _msgData() internal view override(Context, GSNRecipient) returns (bytes memory) {
    return GSNRecipient._msgData();
}

Using Hooks

To improve library flexibility, we're introducing hooks: functions that are called at specific moments during a contract's operation that you can use to hook into the internals and extend as you wish.

For example, the _beforeTokenTransfer hook in ERC20, ERC721 and ERC777 makes it very easy to add additional checks or actions to execute whenever tokens are transferred, minted or burned, regardless of what prompted it.

// Tokens can only be transferred, minted or burned if the contract is not paused
contract ERC20Pausable is ERC20, Pausable {
    function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal virtual override
    {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }
}

As an additional benefit, using hooks will allow you to side-step some of the edge-cases product of the new override keyword.

Head over to our brand new guide on Extending the OpenZeppelin Contracts to learn more!

What's Next

We've started work in some exciting features for the upcoming releases, including fixed-point arithmetic and the ERC1155 token standard. To read more and find out how you can contribute, check out our Q2 2020 roadmap!

Changes

OpenZeppelin Contracts 2.5 (v2.5.0) - 2020-02-05

We're very happy the announce the release of OpenZeppelin Contracts v2.5!

This new release features:

  • EnumerableSet: similar to Solidity's mapping, but that lets you retrieve all the keys! Useful for dapps that need to display a set of accounts with some property, and cannot rely on events alone.
  • Create2: a simple library for using the CREATE2 opcode, allowing for deployment and pre-computation of addresses when using it. To learn more about all the cool things you can do with it, head to Getting the Most out of CREATE2
  • ERC721Metadata.baseURI: a neat extension for massive gas savings when the token URIs share a prefix, like https://my.cool.app/token/<id>

There are also some minor improvements, such as gas optimizations for ReentrancyGuard and additional extensibility of ERC777, among others.

For the complete list of changes, head to our changelog.

To install the new release, run:

$ npm install @openzeppelin/contracts@latest

New Documentation :books:

We've also recently done some some improvements to our documentation website, including new detailed guides and documentation for our other tools, such as the Test Helpers, our blazing-fast Test Environment and the OpenZeppelin Command Line Interface. Check them out for a radically better development experience!

Saying Goodbye to Solidity v0.5 :wave:

December 2019 saw the release of Solidity v0.6. This new version of the language has major improvements, and we're already underway to release the next version of OpenZeppelin Contracts with support for Solidity v0.6.

However, it also includes a lot of breaking changes, making it difficult to support both v0.5 and v0.6 code at the same time. For this reason, we've decided OpenZeppelin Contracts v2.5 will be the last version supporting Solidity v0.5.

The exciting good news it that the next OpenZeppelin Contracts release will be v3.0, where we'll get to redesign some quirky bits of the library, improving ease of use and flexibility. Stay tuned!

Changes

OpenZeppelin 2.4 (v2.4.0) - 2019-11-01

In 2.4 we're releasing support for the Gas Station Network for user onboarding and metatransactions :fuelpump:, new functions to safeguard your contracts against the Istanbul hard fork, and improvements to error messages.

Read the full announcement in the OpenZeppelin Forum, and make sure to check out the details in the changelog!

Enjoy!

Changes

OpenZeppelin 2.3 (v2.3.0) - 2019-06-03

In 2.3 we're introducing ERC777, revert reasons, and a new documentation site. :fireworks: Take a look and tell us what you think in the announcement thread!

Take a look and tell us what you think!

ERC777

The long awaited sequel to ERC20. Its main additions are transfer hooks and operators. Hooks let your contracts react to token transfers. In other words, running code when a contract receives tokens is a built-in feature: no more messing around with approve and transferFrom!

The other special feature, operators, provides simpler and more flexible ways of delegating usage of your tokens to other people or contracts, like decentralized exchanges.

All of this with full compatibility with ERC20!

Start building on it and tell us what you think! We're looking for ideas for extensions, custom operators, or utilities. Share your ideas here or in a new thread.

Revert reasons

Are you tired of running into cryptic errors like VM Exception while processing transaction: revert? All errors in OpenZeppelin now have proper error messages that will be displayed when you test your code! We've kept them succinct and to the point. Each error message is unique, so if you're having trouble figuring out exactly which require statement you've hit, it is easy to look up the error string in the source code, and look at the actual condition that is not being met.

Documentation site

We've revamped the docs, take a look!

It'll be super helpful to both people looking to get started in smart contract development, and veteran OpenZeppelin users who just need to quickly recall a function signature. Among other improvements, we've bundled together related concepts, added overviews for each section, and added crosslinks to other contracts and functions to make exploring the docsite a breeze!

Everything is automatically generated from the comments in the source code, so if you spot a typo or have a suggestion, simply open an issue or PR to get it sorted out in no time!

Some sections still require a bit of work to get them to where we want them to be, stay tuned!

More

Some more things are included in this release such as an implementation of ERC1820, and a fix for a bug in PostDeliveryCrowdsale. Take a look at the changelog! We have revamped the documentation site infrastructure and feel, take a look! It'll be super helpful to both people looking to get started in smart contract development and OpenZeppelin, and veteran users who just need to quickly recall an API. Among other improvements, we've bundled together related concepts, added overviews for each section, and added crosslinks to other contracts and functions to make exploring the docsite a breeze!

Everything is automatically generated from the comments in the source code, so if you spot a typo or have a suggestion, simply open an issue or PR to get it sorted out in no time!

Some sections still require a bit of work to get them to where we want them to be, stay tuned!

More

Some more things are included in this release such as an implementation of ERC1820, and a fix for a bug in PostDeliveryCrowdsale. Take a look at the changelog!

Changes

OpenZeppelin 2.2 (v2.2.0) - 2019-03-14

No changes from the release candidate for this one, we're ironing out the kinks in the release process! :no_entry_sign: :bug:

This minor release includes a way to store token balances and supply so that they can be later queried in a gas-efficient manner :bookmark:, allows safe interaction with some old, non-compliant tokens :lock:, prevents user errors when using ECDSA signatures :memo: (the magic behind metatransactions! :sparkles:), and provides multiple minor additions and improvements to the API.

To install the release run npm install openzeppelin-solidity@latest.

We would love your help by reviewing newly added contracts, their interface and documentation so that we can make names clearer, features easier to use, and the library better as a whole! Your feedback is extremely useful to us :)

Highlights

New features

  • ERC20Snapshot: this variant allows for snapshots to be created on demand, storing the current token balances and total supply so that they can be later retrieved in a gas-efficient manner and e.g. calculate dividends at a past time. (#1617)
  • SafeERC20: the ERC20 standard requires that all function calls (e.g. transfer, approve, etc.) return a boolean value indicating success. However, they are multiple widely used tokens out there that return no such value: they simply revert when encountering an error condition. Since Solidity v0.4.22, special code was needed to interact with this non-compliant tokens: now, all of SafeERC20 can be used to safely call both compliant and non-compliant tokens, without the developer having to worry about it. (#1655)
  • TimedCrowdsale: an internal _extendTime(uint256 newClosingTime) function was added (with a corresponding TimedCrowdsaleExtended(uint256 prevClosingTime, uint256 newClosingTime) event) allowing for users to safely develop mechanisms to extend the durations of unclosed crowdsales. Note that due to it being internal, there's no out-of-the-box way to do it: this feature is opt-in and must be explicitly invoked by users.

Improvements

  • ECDSA: recover no longer accepts malleable signatures (those using upper-range values for s, or 0/1 for v). This helps prevent multiple issues when using signatures as unique identifiers. Read more about common ECDSA issues here. (#1622)
  • ERC721's transfers are now more gas efficient due to removal of unnecessary SafeMath calls. (#1610)

Bugfixes:

  • (minor) SafeERC20: safeApprove wasn't properly checking for a zero allowance when attempting to set a non-zero allowance. This bug was reported independently by @nikeshnazareth. Thanks a lot! (#1647)

Breaking changes in drafts:

  • TokenMetadata has been renamed to ERC20Metadata. (#1618)
  • The library Counter has been renamed to Counters and its API has been improved. See an example in ERC721, lines 17 and 204. (#1610)

You can also see all details of this release in our changelog.

Changes

OpenZeppelin 2.1.3 (v2.1.3) - 2019-02-26

Bugfix release :bug: :wrench:

A minor issue with SafeERC20.safeApprove was identified and reported independently by @nikeshnazareth (thanks once again!), this release contains the correspondig fix: OpenZeppelin/openzeppelin-solidity#1647.

This bug has been present since v2.0.0. Updating to this latest version is recommended, but no immediate emergency action should be required for production code using affected versions, due to the low severity of the issue.

These independent reviews are a great way to keep our code secure and correct: we'll be making a push for a properly funded bug bounty during these next weeks to continue encouraging them. Stay tuned!

Changes

OpenZeppelin 2.0.1 (v2.0.1) - 2019-02-26

Bugfix release :bug: :wrench:

This is a backport of the 2.1.3 bugfix release for the 2.0.x line, which features Solidity v0.4.25 support: if you're still using OpenZeppelin v2.0.0, you can upgrade to this version instead of migrating to v2.1 and Solidity v0.5.

Changes

OpenZeppelin 2.1.2 (v2.1.2) - 2019-03-01

This release was mostly the migration from Truffle 4 to Truffle 5, which should not affect end users.

The only user facing change here is removing the tests and tests helpers from the npm package. If you used the test helpers, you will now find them in the openzeppelin-test-helpers package.

Changes

OpenZeppelin 2.1 (v2.1.1) - 2019-01-04

2.1 is finally out! :tada:

The most significant change is that OpenZeppelin now works with Solidity 0.5.0. This new release of the compiler introduced many breaking changes, and our old contracts were no longer compatible with it. After much discussion, we've decided to drop the Solidity compiler version out of our stability guarantees: in an attempt to both use the best possible tools and push the industry forward, our releases will target a recent compiler version, which may change between minor releases.

This means that installing this new OpenZeppelin version will require you to upgrade your compiler to the 0.5.x line, which can be easily done with the recently released truffle v5.0.0. The 2.0 release will be the last OpenZeppelin release with support for Solidity ^0.4.24, which we will still support in the form of bugfixes, if any are found.

In general, if you're not sure whether you'll want to upgrade your compiler version, feel free to pin an OpenZeppelin version during installation: :pushpin:

npm install openzeppelin-solidity@2.1 --save-exact

If you want to know more about our rationale behind this decision, and why we discarded other possible approaches, read here.

Highlights

  • Added WhitelistCrowdsale, a crowdsale where only whitelisted accounts (WhitelistedRole) can purchase tokens. Adding or removing accounts from the whitelist is done by whitelister admins (WhitelistAdminRole). Similar to the pre-2.0 WhitelistedCrowdsale. (#1525, #1589)
  • ERC20's transferFrom and _burnFrom now emit Approval events, to represent the token's state comprehensively through events. (#1524)
  • SignedSafeMath now supports signed integers (int256). (#1559, #1588)
  • ERC20 and ERC721 are now more gas efficient due to removed redundant SSTOREs and requires. (#1409 and #1549)

The first 2.1 release will be 2.1.1, due to a minor mishap that caused a conflict in the npm registry :man_facepalming:

:new: See the details in our brand new CHANGELOG!

Changes

OpenZeppelin 2.0 (v2.0.0) - 2018-10-21

OpenZeppelin 2.0 is finally here!!!

The major feature in this release is that we are now commiting to a stable API. In the process of stabilizing we've also reviewed a lot of the existing API in order to ensure a more straightforward experience for users.

Featuring...

Stable API

So far OpenZeppelin's API has sometimes changed from release to release, in backwards-incompatible ways. This has enabled us to iterate on features and design ideas, but we're at a point now where we want to commit to having a stable API and delivering reliable updates.

You can expect the external and internal API of contracts to remain stable. We're only making an exception to this for the contracts in the drafts/ subdirectory; this is where ERCs in Draft status, as well as more experimental contracts will go, and might have breaking changes in minor versions. We'll be documenting exactly what stability guarantees we provide in the coming weeks.

Granular permissions

Features which require permissions have used the almighty Ownable so far. We are now moving towards a more granular system of roles, like the MinterRole. Just like Ownable, the creator of a contract is assigned all roles at first, but they can selectively give them out to other accounts.

Improved test suite

Although this is not visible to users, we have been improving the test suite, increasing coverage to 100%, and cleaning up all of our tests, which had diverged in style. This is part of a bigger effort towards making contributing easier and involving our amazing contributors more in the entire process of building OpenZeppelin.

A new audit

The awesome LevelK team audited our 2.0.0 Release Candidate and they found some severe issues and suggested many improvements. We fixed almost all the issues and notes they reported, leaving only a few minor details for 2.1.0. Check out the LevelK Audit - OpenZeppelin 2.0 project for all the details.

We want to thank @cwhinfrey, @pcowgill and @shanefontaine for their very detailed reviews, high quality standards, and human support during the closing phase of this release. This audit gave us a great confidence boost on the code that we are now publishing.

Tons of community love

Now hold your breath, because this release was only possible because of the contributions of many, many people from everywhere in the world, and we want to thank all of them:

@3sGgpQ8H, @Aniket-Engg, @barakman, @BrendanChou, @cardmaniac992, @dougiebuckets, @dwardu, @facuspagnuolo, @fulldecent, @glesaint, @Glisch, @jacobherrington, @jbogacz, @jdetychey, @JeanoLee, @k06a, @lamengao, @ldub, @leonardoalt, @Miraj98, @mswezey23, @pw94, @shishir99111, @sohkai, @sweatyc, @tinchoabbate, @tinchou, @urvalla, @viquezclaudio, @vyomshm, @yaronvel, @ZumZoom.

Also we would like to thank all the people who are constantly helping others in our Slack channel, the ones who have given us feedback about the release, and the ones helping us triage and discuss our GitHub issues. If you are reading this wanting to jump in and make your first free software contributions, but you are unsure of where and how, talk to us! We can help you getting started, and we could use the extra hands.

With ❤️ from the maintainers team of this release. -- @shrugs, @nventuro, @frangio and @elopio

Changelog

The changelog is pretty big. We are introducing new concepts and new designs, together with many renames and restructures. If you have problems, comments or suggestions, please join our Slack channel.

https://github.com/OpenZeppelin/openzeppelin-solidity/compare/v1.12.0...v2.0.0

  • Ownable contracts have moved to role based access. (#1291, #1302, #1303)
  • ERC contracts have all been renamed to follow the same convention. The interfaces are called IERC##, and their implementations are ERC##. Check out, for example, IERC20 and ERC20. (#1252, #1288)
  • All state variables are now private, which means that derived contracts cannot access them directly, but have to use getters. This is to increase encapsulation, to be able to reason better about the code. (#1197, #1265, #1267, #1269, #1270, #1268, #1281)
  • Events have been changed to be consistently in the past tense except for those which are defined by an ERC. (#1181)
  • Separated ERC721 into the different optional interfaces, and introduced ERC721Full which implements all. (#1304)
  • Added ERC165Query to query support for ERC165 interfaces. (#1086)
  • Added an experimental contract for migration between ERC20 tokens. (#1054)
  • Added SafeMath.mod. (#915)
  • Added Math.average. (#1170)
  • Added ERC721Pausable. (#1154)
  • Changed SafeMath to use require instead of assert. (#1187, #1120, interesting discussion!)
  • Removed restriction on who can release funds in PullPayments, PaymentSplitter, PostDeliveryCrowdsale, RefundableCrowdsale. (#1275)
  • Optimized ReentrancyMutex gas usage. (#1155)
  • Made ERC721.exists internal. (#1193)
  • Changed preconditions on PaymentSplitter constructor arguments. (#1131)
  • Fixed ERC721.getApproved to be in compliance with spec. (#1256)
  • Simplified interface of IndividuallyCappedCrowdsale. (#1296)
  • Renamed ERC20.decreaseApproval to decreaseAllowance, and changed its semantics slightly to be more secure. (#1293)
  • Renamed MerkleProof.verifyProof to MerkleProof.verify. (#1294)
  • Renamed ECRecovery to ECDSA, and AddressUtils to Address. (#1253)
  • Moved ECDSA and MerkleProof to a cryptography/ subdirectory. (#1253)
  • Moved ReentrancyGuard, and Address to a utils/ subdirectory. (#1253)
  • Renamed proposals/ subdirectory to drafts/. (#1271)
  • Moved TokenVesting, SignatureBouncer to drafts/. (#1271)
  • Removed ERC20Basic, now there's only ERC20. (#1125)
  • Removed Math.min64 and Math.max64, left only the uint256 variants. (#1156)
  • Removed Mint and Burn events from ERC20Mintable and ERC20Burnable. (#1305)
  • Removed underscores from event arguments. (#1258)
  • Removed a few contracts that we thought were not generally secure enough: LimitBalance, HasNoEther, HasNoTokens, HasNoContracts, NoOwner, Destructible, TokenDestructible, CanReclaimToken. (#1253, #1254, #1306)
  • Removed extensions of Owable: Claimable, DelayedClaimable, Heritable. (#1274)
  • Renamed AutoIncrementing to Counter and moved it to drafts\. ((1307, #1332)
  • Added events to roles on construction and when renouncing. (#1329)
  • Separated ERC721Mintable into two contracts, one with metadata (token URI) and one without. (#1365)
  • Added an ERC20 internal _transfer function. (#1370)
  • Added an Arrays library. (#1375)
  • Improved the OwnershipTransfer event and removed OwnershipRenounced. (#1397)
  • Removed the BreakInvariantBounty contract because of a front-running issue. (#1424)
  • Improved encapsulation on ERC165 making the _supportedInterfaces map private. (#1379)
  • Renamed RefundsEscrow event to RefundsClosed. (#1418)
  • Moved Escrow and RefundsEscrow to contracts/payment/escrow/. (#1430)
  • Made private the TokenVesting functions _releasableAmount and _vestedAmount. (#1427)
  • Made internal the constructors of contracts that should only be used inherited from others. (#1433, #1439)
  • Renamed ERC165 function supportsInterfaces to _supportsAllInterfaces. (#1435)
  • Added the address to Paused and Unpaused events. (#1410)
  • Renamed SplitPayment to PaymentSplitter, and added the events PayeeAdded, PaymentReleased and PaymentReceived. (#1417)
  • Renamed the TokenVesting events to TokensReleased and TokenVestingRevoked. (#1431)
  • Improved the SafeERC20 allowance handling. (#1407)
  • Made getCurrentRate from IncreasingPriceCrowdsale return 0 when the crowdsale is not open. (#1442)
  • Made tokenURI from ERC721Metadata external, to match the specification. (#1444)
  • Fixed a reentrancy issue on FinalizableCrowdsale. (#1447)
  • Fixed how allowance crowdsale checks remaining tokens. (#1449)
  • Added the nonReentrant safeguard for buyTokens in the Crowdsale contract. (#1438)

Changes

v1.12.0 - 2018-08-11

And thus concludes another release cycle of OpenZeppelin! :smile:

Among other things, we have been busy enhancing the quality and consistency of the test suite. We think this will improve the experience for future contributors. Check it out! :bookmark_tabs: :raised_hands:

This is the last release before our planned 2.0 release, which will mark a commitment to a stable API. Keep an eye out for it! :eye:

Changelog

https://github.com/OpenZeppelin/openzeppelin-solidity/compare/v1.11.0...v1.12.0

Additions

  • We now have a code of conduct! (#1061)
  • A small library with a Counter datatype. (#1023)
  • A description in the README of the different categories of contracts we have and their organization. (#1089)

Improvements

  • Moved ERC165 interface IDs to interface contracts. (#1070)
  • Moved RBAC contract to the access directory. (#1114)
  • Fixed an inheritance order that was causing some contracts to fail linearization. (#1128)
  • Lots of test improvements, including the removal of Babel. (#1009, #1050, #1074, #1094, #1116, #1112, #1117)
  • Fix assertRevert test helper. (#1123)
  • Some gas optimizations. (#1043, #1063, #1030, #1017, #1057)
  • Removed unnecessary payable constructor from Destructible. (#1107)
  • Documentation tidbits. (#1035, #1082, #1084, #1083, #1060, #1101)
  • Made code style more consistent with prefix underscore in all arguments. (#1133)
  • Fixes for Solidity 0.5.0. (#1080, #1134)
  • Silenced a compilation warning in HasNoTokens. (#1122)

Changes

v1.11.0 - 2018-07-13

We hit our 1000th issue during this release cycle! Congrats to everyone and thank you for the hard work. :smile:

Changelog

https://github.com/OpenZeppelin/openzeppelin-solidity/compare/v1.10.0...v1.11.0

Added

  • :card_file_box: Escrow, a new class of contracts that we used to enhance the security of PullPayments. (#1014)
  • :writing_hand: isValidSignatureAndData, a new method of SignatureBouncer to validate signed function calls. (#973)
  • :memo: Initial implementation of ERC1046. (#933)

Changed

  • :volcano: Updated the ERC721 contracts to the final version of the protocol. (#972, #993, #1047)
  • :shark: Updated minor things for the newer versions of Solidity. (#951, #1002, #1008, #1033)
  • :shield: Fixed unchecked token transfer in Crowdsale. (#1006)
  • :seat: Moved Whitelist to access directory. (#994)

Removed

  • :warning: We removed the implementation of ERC827 due to concerns about its security (#1044). The code was moved to windingtree/erc827.

Changes

v1.10.0 - 2018-06-05

The release includes the new constructor syntax in Solidity (goodbye warnings :wave:).

:tada: :tada: :tada:

Changelog

https://github.com/OpenZeppelin/zeppelin-solidity/compare/v1.9.0...v1.10.0

Changes

v1.9.0 - 2018-04-27

:warning: Beginning with this release we're renaming the npm package to openzeppelin-solidity. Make sure to update your dependencies!

The release includes the new emit keyword in Solidity, some new functionality, and other enhancements. Thanks everyone for participating!

:tada: :tada: :tada:

Changelog

https://github.com/OpenZeppelin/zeppelin-solidity/compare/v1.8.0...v1.9.0

  • :ribbon: Updated our contracts for Solidity 0.4.21, including the new emit keyword (#876)
  • :fire: Added StandardBurnableToken with a burnFrom function (#870)
  • :woman_teacher: Changed MerkleProof interface slightly (#879)
  • :policewoman: Removed admin functionality from RBAC (#836)
  • :memo: Changes to ERC827 (#871, #838)
  • :wrench: Cleaned up the npm package files and dependencies (#843, #904)

Changes

v1.8.0 - 2018-03-23

This release contains the full implementation of EIP721, following the last details settled in the recently closed EIP. Thanks to all the community for your contributions! 🚀

Changelog

https://github.com/OpenZeppelin/zeppelin-solidity/compare/v1.7.0...v1.8.0

  • ✨ Final EIP721 implementation (#803)
  • 🔥 Add Transfer event to BurnableToken (#735)
  • 👨‍🏫 ECRecovery recover is now internal (#818)
  • 💅 Documentation and tests enhancements

Changes

v1.7.0 - 2018-02-20

This release contains a big refactor of the Crowdsale contract, which allowed us to implement some really cool new crowdsale models. We also have a shiny new documentation site. Thanks to all the community for the awesome contributions! :rocket:

Changelog

https://github.com/OpenZeppelin/zeppelin-solidity/compare/v1.6.0...v1.7.0

Project updates:

Changes

v1.6.0 - 2018-01-23

This time we bring you a new release, which includes the much hyped ERC721 for non-fungible tokens, to create your own digital collectibles and more. 🐈 🌍 🚀 🎉

During this release cycle the team has been very active improving the development process itself, and we're already seeing great results in the speed with which we respond to new issues and PRs. Take a peek at the status of development at our waffle.io board.

We'll be waiting for your contributions!

Changelog

v1.5.0...v1.6.0

  • 🆕 Added ERC721 non-fungible token implementation (#615) 🐈
  • 🆕 Added ERC827 token implementation provides transfer, transferFrom and approve methods which additionally perform a call to the recipients (#518)
  • 🆕 Added Heritable, an extension of Ownable with a designated heir (#680)
  • Added getTokenAmount for dynamic rate crowdsales (#638)
  • Added the totalSupply function to the ERC20 interface (#666)

Project changes

  • Enhanced tests and documentation
  • Updated documentation for contributors (#684)
  • Added Issue/PR templates (#641)
  • Added linting configuration and Travis CI step (#673)

Changes

v1.5.0 - 2017-12-22

A small release this time to keep the release cycle going! 🚀

Changelog

  • 🆕 Added RBAC to enable more complex access control patterns. (#580)
  • Several enhancements to project quality. (#581)
  • And a few small changes. 🙂

Changes

v1.4.0 - 2017-11-23

Thanks to all members of the community that contributed to this release! 🎉 🚀

Changelog

  • 🆕 Added TokenVesting which implements vesting of tokens. It replaces the old VestedToken with a more modular approach. (#476)
  • 🆕 Added SplitPayment which implements distributing payments to multiple people proportionally to shares. (#417)
  • 🆕 Added DetailedERC20 which adds to a token state variables with the optional ERC20 metadata. (#477)
  • 🆕 Added CappedToken which is a MintableToken with capped supply. (#515)
  • Made MintableToken's finishMinting executable only once. (#505)
  • Upgraded to Truffle 4.0.1 and Solidity 0.4.18. (#573, #460, #576, #506)
  • Removed deprecated claim() from TokenTimelock. (#469)

And some additional changes to code style, tests, documentation and continuous integration.

Changes

v1.3.0 - 2017-09-21

After a long wait, we're finally releasing version 1.3.0 of OpenZeppelin. This is a big release with a lot of small fixes, exciting new features, and enhancements to the developer experience.

This release includes commits from 29 contributors! Huge thanks to all of you! 🎉 🎉

Changelog

  • Removed MultisigWallet in favor of gnosis/MultiSigWallet. (#328)
  • Added a directory with examples. (#333, #342)
  • Migrated the crowdsale contracts to timestamps instead of block numbers. (#350)
  • Removed the call to finishMinting in FinalizableCrowdsale. (#364)
  • Made approve pausable in PausableToken. (#448)
  • Added an OwnershipTransferred event. (#424)
  • Added the BurnableToken contract. (#341)
  • Added the CanReclaimToken contract. (#348)
  • Added the SafeERC20 library for interaction with ERC20 tokens. (#413)
  • Added the MerkleProof library for merkle proof verification. (#260)
  • Fixed some small issues in ERC20 compliance. (#345, #405, #446)
  • Fixed a bug in transferFrom. (#377)
  • Fixed transferOwnership to revert on failure instead of silently failing. (#323)
  • Fixed a bug in TokenTimelock. (#430)
  • Several enhancements to tests and documentation.
  • Parallelized coverage and tests in Travis for faster test results in PRs. (#369)
  • Removed the only production dependency (was actually a dev dependency). Now installing via npm install --only=prod zeppelin-solidity should install zero extra dependencies! (#357)

Changes

v1.2.0 - 2017-07-18

Changelog

  • Fix ERC20 interface and implementations to conform to standard.
  • Rename claim to release in TokenTimelock.
  • Bugfixes in VestedToken.
  • Deprecated throw in favor of require(), assert() and revert().
  • Small improvements on crowdsale contracts.
  • Added ECRecovery library.

Changes

v1.1.0 - 2017-07-02

Changelog

Changes

v1.0.6 - 2017-05-29

Changelog

  • Add external audit report to repo.
  • Minor improvements to Destructible.
  • Revert to usig npm as preferred installation method, as ethpm is still immature.
  • Add solidity-coverage
  • Add natspec documentation
  • Add revokability and burnablity options to VestedToken and general refactor and optimizations

Security

  • Add fix for the approve() mitigation.
  • Protect transferFrom against short hand attack.
  • Fix attack on VestedToken#grantVestedTokens()

Thanks to @misteraverin, @miohtama, @izqui, @cgewecke, @maurelian, @JGcarv and @DavidKnott for your contributions to this release!

Changes

v1.0.5 - 2017-05-09

Changelog:

  • Added new TokenDestructible lifecycle helper for contracts that want to transfer owned tokens when destroyed.
  • Decouple transferable logic from VestedToken as LimitedTransferToken.
  • Added new ownership helpers HasNoEther, HasNoContracts, NoOwner.
  • Added ReentrancyGuard to prevent contract from calling itself, directly or indirectly.
  • Several refactors and small fixes.
  • New MintableToken token with minting functions.
  • New PausableToken token with pausable transfers (it's a Pausable instance)
  • Make SafeMath a library.
  • External audit security fixes. (Audit link will be published soon).

Thanks to @Recmo, @izqui, @demibrener, @frangio, @roderik, @jdetychey, @DavidKnott, @lastperson, @tatiesmars, @AugustoL, @ORBAT for your contributions! This release wouldn't be the same without your work.

Changes

v1.0.4 - 2017-03-09

  • Add integration and publish to ethpm.

Changes

On this page

v5.4.0 - 2025-07-17Breaking changesPragma changesChanges by categoryAccountGovernanceTokensCryptographySignersVerifiersOtherStructuresUtilsv5.3.0 - 2025-04-09Breaking ChangesCustom error changesChanges by categoryAccountGovernanceStructuresTokensOtherv5.2.0 - 2025-01-09Breaking ChangesCustom error changesChanges by categoryGeneralAccountGovernanceProxyTokensUtilsv5.1.0 - 2024-10-23Breaking changesCustom error changesChanges by categoryGeneralAccessFinanceGovernanceProxyTokensUtilsCryptographyMathStructuresv5.0.2 - 2024-02-29v4.9.6 - 2024-02-29v4.9.5 - 2023-12-08v5.0.1 - 2023-12-07v4.9.4 - 2023-12-07v5.0.0 - 2023-10-05Additions SummaryRemovals SummaryChanges by categoryGeneralAccessFinanceGovernanceMetatxProxyTokenUtilsHow to migrate from 4.xERC20, ERC721, and ERC1155More about ERC721More about ERC1155ERC165StorageSafeMathAdapting Governor modulesECDSA and MessageHashUtilsInterfaces and libraries in upgradeable contractsOffchain ConsiderationsRelying on revert strings for processing errorsRelying on storage locations for retrieving datav4.9.3 - 2023-07-28v4.9.2 - 2023-06-16v4.9.1 - 2023-06-07v4.9.0 - 2023-05-23Breaking changesDeprecationsv4.8.3 - 2023-04-13v4.8.2 - 2023-03-02Breaking changesv4.8.1 - 2023-01-13v4.8.0 - 2022-11-08Breaking changesDeprecationsERC-721 Compatibility Notev4.7.3 - 2022-08-10Breaking changesv4.7.2 - 2022-07-28v4.7.1 - 2022-07-20v4.7.0 - 2022-06-30Breaking changesv4.6.0 - 2022-04-29Upgradeability noticeBreaking changesv4.5.0 - 2022-02-09Breaking changesv4.4.2 - 2022-01-11v4.4.1 - 2021-12-14Breaking changev4.4.0 - 2021-11-25v4.3.3 - 2021-11-15v4.3.2 - 2021-09-14v4.3.1 - 2021-08-26v3.4.2-solc-0.7 - 2021-08-26v3.4.2 - 2021-08-26v4.3.0 - 2021-08-17v4.2.0 - 2021-06-30Breaking Changesv4.1.0 - 2021-04-30v4.0.0 - 2021-03-24ChangelogHow to upgrade from 3.xv3.4.0 - 2021-02-03Security Fixesv3.3.0 - 2020-11-27v3.2.1 for Solidity 0.7 (v3.2.1-solc-0.7) - 2020-09-15v3.2.0 - 2020-09-11v3.1.0 - 2020-06-29ERC1155More Replacements for callUsing SafeMath on Small Signed IntegersOpenZeppelin Contracts 3.0.1 (v3.0.1) - 2020-04-27OpenZeppelin Contracts 2.5.1 (v2.5.1) - 2020-04-27OpenZeppelin Contracts 3.0 (v3.0.0) - 2020-04-20What's NewCompiling v0.6 ContractsRevamped Access ControlPreset ContractsMigrating From OpenZeppelin Contracts v2.5Using HooksWhat's NextOpenZeppelin Contracts 2.5 (v2.5.0) - 2020-02-05New Documentation :books:Saying Goodbye to Solidity v0.5 :wave:OpenZeppelin 2.4 (v2.4.0) - 2019-11-01OpenZeppelin 2.3 (v2.3.0) - 2019-06-03ERC777Revert reasonsDocumentation siteMoreMoreOpenZeppelin 2.2 (v2.2.0) - 2019-03-14HighlightsNew featuresImprovementsBugfixes:Breaking changes in drafts:OpenZeppelin 2.1.3 (v2.1.3) - 2019-02-26Bugfix release :bug: :wrench:OpenZeppelin 2.0.1 (v2.0.1) - 2019-02-26Bugfix release :bug: :wrench:OpenZeppelin 2.1.2 (v2.1.2) - 2019-03-01OpenZeppelin 2.1 (v2.1.1) - 2019-01-042.1 is finally out! :tada:HighlightsOpenZeppelin 2.0 (v2.0.0) - 2018-10-21Featuring...Stable APIGranular permissionsImproved test suiteA new auditTons of community loveChangelogv1.12.0 - 2018-08-11ChangelogAdditionsImprovementsv1.11.0 - 2018-07-13ChangelogAddedChangedRemovedv1.10.0 - 2018-06-05Changelogv1.9.0 - 2018-04-27Changelogv1.8.0 - 2018-03-23Changelogv1.7.0 - 2018-02-20ChangelogProject updates:v1.6.0 - 2018-01-23ChangelogProject changesv1.5.0 - 2017-12-22Changelogv1.4.0 - 2017-11-23Changelogv1.3.0 - 2017-09-21Changelogv1.2.0 - 2017-07-18Changelogv1.1.0 - 2017-07-02Changelogv1.0.6 - 2017-05-29ChangelogSecurityv1.0.5 - 2017-05-09Changelog:v1.0.4 - 2017-03-09