Skip to content

Releases: OpenZeppelin/openzeppelin-contracts

v4.8.0-rc.0

08 Sep 03:10
Compare
Choose a tag to compare
v4.8.0-rc.0 Pre-release
Pre-release

This prerelease is now available for open review! Try it out, look at the code, and share your feedback.

To reward issues found we have a bug bounty going up to $25,000 with an additional reward for any findings introduced in this release candidate.

  • ERC721Consecutive: Efficient batch minting of NFTs (EIP-2309)
  • Optimizations in ERC20Votes, ERC721Votes: Best case cost reduced to 50%!
  • 🆕 Ownable2Step: An extension of Ownable with 2-step transferOwnership
  • 🆕 Math.log2/log10: Integer logarithm
  • 💯 ERC4626 decimals changes: Remove decimals from on-chain calculations
  • Many small optimizations

See the changelog for all the release details.

v4.7.3

10 Aug 19:14
Compare
Choose a tag to compare

⚠️ 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).

v4.7.2

28 Jul 16:01
Compare
Choose a tag to compare

⚠️ 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)

v4.7.1

20 Jul 14:30
Compare
Choose a tag to compare

⚠️ 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)

v4.7.0

30 Jun 10:06
Compare
Choose a tag to compare
  • 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.

v4.7.0-rc.0

07 Jun 22:41
Compare
Choose a tag to compare
v4.7.0-rc.0 Pre-release
Pre-release

This prerelease is now available for open review! Let us know your feedback and if you find any security issues.

We have a bug bounty with rewards of up to USD $25,000 and a special POAP for submitting a valid issue.

See the announcement for more details.

v4.6.0

29 Apr 06:52
Compare
Choose a tag to compare
  • 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.

v4.6.0-rc.0

01 Apr 21:14
Compare
Choose a tag to compare
v4.6.0-rc.0 Pre-release
Pre-release

This prerelease is now available for open review! Let us know your feedback and if you find any security issues.

We have a bug bounty with rewards of up to USD $25,000 and a special POAP for submitting a valid issue.

See the announcement for some more details.

v4.5.0

09 Feb 20:15
Compare
Choose a tag to compare
  • 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.

v4.5.0-rc.0

14 Jan 21:39
Compare
Choose a tag to compare
v4.5.0-rc.0 Pre-release
Pre-release

This prerelease is now available for review! Let us know your feedback and if you find any security issues.

We have a bug bounty with rewards of up to USD $25,000 and a special POAP for submitting a valid issue.

See the announcement for some more details.