v4.5.0
版本发布时间: 2022-02-10 04:15:54
OpenZeppelin/openzeppelin-contracts最新发布版本:v5.1.0-rc.0(2024-10-03 22:56:46)
-
ERC2981
: add implementation of the royalty standard, and the respective extensions forERC721
andERC1155
. (#3012) -
GovernorTimelockControl
: improve thestate()
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 usingencode(bytes memory)
function, and provide examples to show how to use to build URL-safetokenURIs
. (#2884) -
ERC20
: reduce allowance before triggering transfer. (#3056) -
ERC20
: do not update allowance ontransferFrom
when allowance istype(uint256).max
. (#3085) -
ERC20
: add a_spendAllowance
internal function. (#3170) -
ERC20Burnable
: do not update allowance onburnFrom
when allowance istype(uint256).max
. (#3170) -
ERC777
: do not update allowance ontransferFrom
when allowance istype(uint256).max
. (#3085) -
ERC777
: add a_spendAllowance
internal function. (#3170) -
SignedMath
: a new signed version of the Math library withmax
,min
, andaverage
. (#2686) -
SignedMath
: add aabs(int256)
method that returns the unsigned absolute value of a signed value. (#2984) -
ERC1967Upgrade
: Refactor the secure upgrade to useERC1822
instead of the previous rollback mechanism. This reduces code complexity and attack surface with similar security guarantees. (#3021) -
UUPSUpgradeable
: AddERC1822
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 theaccount.code.length
syntax that replaces inline assembly. This may require users to bump their compiler version from0.8.0
to0.8.1
or later. Note that other parts of the code already include stricter requirements.