v4.6.0
版本发布时间: 2022-04-29 14:52:21
OpenZeppelin/openzeppelin-contracts最新发布版本:v5.1.0-rc.0(2024-10-03 22:56:46)
-
crosschain
: Add a new set of contracts for cross-chain applications.CrossChainEnabled
is a base contract with instantiations for several chains and bridges, andAccessControlCrossChain
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 theonlyRole
modifier behavior. (#3137) -
EnumerableMap
: add newAddressToUintMap
map type. (#3150) -
EnumerableMap
: add newBytes32ToBytes32Map
map type. (#3192) -
ERC20FlashMint
: support infinite allowance when paying back a flash loan. (#3226) -
ERC20Wrapper
: thedecimals()
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
: replaceimmutable
withconstant
for_PERMIT_TYPEHASH
since thekeccak256
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 ofonlyGovernance
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. Theparams
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
: ImplementIERC721Receiver
andIERC1155Receiver
to improve token custody by governors. (#3230) -
TimelockController
: ImplementIERC721Receiver
andIERC1155Receiver
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
: makeroyaltiInfo
public to allow super call in overrides. (#3305)
Upgradeability notice
-
TimelockController
: (Action needed) The upgrade from <4.6 to >=4.6 introduces a newCANCELLER_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 theTimelockControllerWith46MigrationUpgradeable
contract and then calling themigrateTo46
function.
Breaking changes
-
Governor
: Adds internal virtual_getVotes
method that must be implemented; this is a breaking change for existing concrete extensions toGovernor
. To fix this on an existing voting module extension, renamegetVotes
to_getVotes
and add abytes memory
argument. (#3043) -
Governor
: Addsparams
parameter to internal virtual_countVote
method; this is a breaking change for existing concrete extensions toGovernor
. To fix this on an existing counting module extension, add abytes memory
argument to_countVote
. (#3043) -
Governor
: Does not emitVoteCast
event when params data is non-empty; instead emitsVoteCastWithParams
event. To fix this on an integration that consumes theVoteCast
event, also fetch/monitorVoteCastWithParams
events. (#3043) -
Votes
: The internal virtual function_getVotingUnits
was madeview
(which was accidentally missing). Any overrides should now be updated so they areview
as well.