@openzeppelin/contracts
Advanced tools
Changelog
4.4.1 (2021-12-14)
Initializable
: change the existing initializer
modifier and add a new onlyInitializing
modifier to prevent reentrancy risk. (#3006)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();
}
}
Changelog
4.4.0 (2021-11-25)
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)_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. (#2849)GovernorTimelockCompound
: fix ability to use Ether stored in the Timelock contract. (#2849)Changelog
4.3.3 (2021-11-08)
ERC1155Supply
: Handle totalSupply
changes by hooking into _beforeTokenTransfer
to ensure consistency of balances and supply during IERC1155Receiver.onERC1155Received
calls.Changelog
4.3.2 (2021-09-14)
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.