Merge branch 'OpenZeppelin:master' into master

pull/2997/head
Michael D. George 3 years ago committed by GitHub
commit 8c0684ad13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      CHANGELOG.md
  2. 2
      README.md
  3. 12
      SECURITY.md
  4. 2
      contracts/access/AccessControl.sol
  5. 2
      contracts/access/AccessControlEnumerable.sol
  6. 2
      contracts/access/IAccessControl.sol
  7. 2
      contracts/access/IAccessControlEnumerable.sol
  8. 2
      contracts/access/Ownable.sol
  9. 2
      contracts/finance/PaymentSplitter.sol
  10. 4
      contracts/finance/VestingWallet.sol
  11. 49
      contracts/governance/Governor.sol
  12. 2
      contracts/governance/IGovernor.sol
  13. 8
      contracts/governance/README.adoc
  14. 2
      contracts/governance/TimelockController.sol
  15. 4
      contracts/governance/compatibility/GovernorCompatibilityBravo.sol
  16. 2
      contracts/governance/compatibility/IGovernorCompatibilityBravo.sol
  17. 2
      contracts/governance/extensions/GovernorCountingSimple.sol
  18. 106
      contracts/governance/extensions/GovernorPreventLateQuorum.sol
  19. 2
      contracts/governance/extensions/GovernorProposalThreshold.sol
  20. 8
      contracts/governance/extensions/GovernorSettings.sol
  21. 2
      contracts/governance/extensions/GovernorTimelockCompound.sol
  22. 6
      contracts/governance/extensions/GovernorTimelockControl.sol
  23. 2
      contracts/governance/extensions/GovernorVotes.sol
  24. 2
      contracts/governance/extensions/GovernorVotesComp.sol
  25. 2
      contracts/governance/extensions/GovernorVotesQuorumFraction.sol
  26. 2
      contracts/governance/extensions/IGovernorTimelock.sol
  27. 2
      contracts/interfaces/IERC1155.sol
  28. 2
      contracts/interfaces/IERC1155MetadataURI.sol
  29. 2
      contracts/interfaces/IERC1155Receiver.sol
  30. 2
      contracts/interfaces/IERC1271.sol
  31. 2
      contracts/interfaces/IERC1363.sol
  32. 2
      contracts/interfaces/IERC1363Receiver.sol
  33. 2
      contracts/interfaces/IERC1363Spender.sol
  34. 2
      contracts/interfaces/IERC165.sol
  35. 2
      contracts/interfaces/IERC1820Implementer.sol
  36. 2
      contracts/interfaces/IERC1820Registry.sol
  37. 2
      contracts/interfaces/IERC20.sol
  38. 2
      contracts/interfaces/IERC20Metadata.sol
  39. 2
      contracts/interfaces/IERC2981.sol
  40. 2
      contracts/interfaces/IERC3156.sol
  41. 2
      contracts/interfaces/IERC3156FlashBorrower.sol
  42. 2
      contracts/interfaces/IERC3156FlashLender.sol
  43. 2
      contracts/interfaces/IERC721.sol
  44. 2
      contracts/interfaces/IERC721Enumerable.sol
  45. 2
      contracts/interfaces/IERC721Metadata.sol
  46. 2
      contracts/interfaces/IERC721Receiver.sol
  47. 2
      contracts/interfaces/IERC777.sol
  48. 2
      contracts/interfaces/IERC777Recipient.sol
  49. 2
      contracts/interfaces/IERC777Sender.sol
  50. 2
      contracts/interfaces/draft-IERC2612.sol
  51. 2
      contracts/metatx/ERC2771Context.sol
  52. 2
      contracts/metatx/MinimalForwarder.sol
  53. 60
      contracts/mocks/GovernorPreventLateQuorumMock.sol
  54. 4
      contracts/mocks/MathMock.sol
  55. 2
      contracts/package.json
  56. 2
      contracts/proxy/Clones.sol
  57. 2
      contracts/proxy/ERC1967/ERC1967Proxy.sol
  58. 2
      contracts/proxy/ERC1967/ERC1967Upgrade.sol
  59. 2
      contracts/proxy/Proxy.sol
  60. 2
      contracts/proxy/beacon/BeaconProxy.sol
  61. 2
      contracts/proxy/beacon/IBeacon.sol
  62. 2
      contracts/proxy/beacon/UpgradeableBeacon.sol
  63. 2
      contracts/proxy/transparent/ProxyAdmin.sol
  64. 2
      contracts/proxy/transparent/TransparentUpgradeableProxy.sol
  65. 4
      contracts/proxy/utils/Initializable.sol
  66. 2
      contracts/proxy/utils/UUPSUpgradeable.sol
  67. 2
      contracts/security/Pausable.sol
  68. 2
      contracts/security/PullPayment.sol
  69. 2
      contracts/security/ReentrancyGuard.sol
  70. 2
      contracts/token/ERC1155/ERC1155.sol
  71. 2
      contracts/token/ERC1155/IERC1155.sol
  72. 2
      contracts/token/ERC1155/IERC1155Receiver.sol
  73. 2
      contracts/token/ERC1155/extensions/ERC1155Burnable.sol
  74. 2
      contracts/token/ERC1155/extensions/ERC1155Pausable.sol
  75. 2
      contracts/token/ERC1155/extensions/ERC1155Supply.sol
  76. 2
      contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
  77. 4
      contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol
  78. 1
      contracts/token/ERC1155/presets/README.md
  79. 2
      contracts/token/ERC1155/utils/ERC1155Holder.sol
  80. 2
      contracts/token/ERC1155/utils/ERC1155Receiver.sol
  81. 2
      contracts/token/ERC20/ERC20.sol
  82. 2
      contracts/token/ERC20/IERC20.sol
  83. 2
      contracts/token/ERC20/extensions/ERC20Burnable.sol
  84. 2
      contracts/token/ERC20/extensions/ERC20Capped.sol
  85. 2
      contracts/token/ERC20/extensions/ERC20FlashMint.sol
  86. 2
      contracts/token/ERC20/extensions/ERC20Pausable.sol
  87. 2
      contracts/token/ERC20/extensions/ERC20Snapshot.sol
  88. 2
      contracts/token/ERC20/extensions/ERC20Votes.sol
  89. 2
      contracts/token/ERC20/extensions/ERC20VotesComp.sol
  90. 2
      contracts/token/ERC20/extensions/ERC20Wrapper.sol
  91. 2
      contracts/token/ERC20/extensions/IERC20Metadata.sol
  92. 2
      contracts/token/ERC20/extensions/draft-ERC20Permit.sol
  93. 2
      contracts/token/ERC20/extensions/draft-IERC20Permit.sol
  94. 4
      contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol
  95. 4
      contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol
  96. 1
      contracts/token/ERC20/presets/README.md
  97. 2
      contracts/token/ERC20/utils/SafeERC20.sol
  98. 2
      contracts/token/ERC20/utils/TokenTimelock.sol
  99. 2
      contracts/token/ERC721/ERC721.sol
  100. 2
      contracts/token/ERC721/IERC721.sol
  101. Some files were not shown because too many files have changed in this diff Show More

@ -2,6 +2,14 @@
## Unreleased ## Unreleased
* `GovernorTimelockControl`: improve the `state()` function to have it reflect cases where a proposal has been canceled directly on the timelock. ([#2977](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2977))
* `Math`: add a `abs(int256)` method that returns the unsigned absolute value of a signed value. ([#2984](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2984))
* Preset contracts are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com). ([#2986](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/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](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2926))
* `GovernorExtendedVoting`: add new module to ensure a minimum voting duration is available after the quorum is reached. ([#2973](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2973))
## 4.4.0 (2021-11-25)
* `Ownable`: add an internal `_transferOwnership(address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568)) * `Ownable`: add an internal `_transferOwnership(address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568))
* `AccessControl`: add internal `_grantRole(bytes32,address)` and `_revokeRole(bytes32,address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568)) * `AccessControl`: add internal `_grantRole(bytes32,address)` and `_revokeRole(bytes32,address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568))
* `AccessControl`: mark `_setupRole(bytes32,address)` as deprecated in favor of `_grantRole(bytes32,address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568)) * `AccessControl`: mark `_setupRole(bytes32,address)` as deprecated in favor of `_grantRole(bytes32,address)`. ([#2568](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2568))
@ -9,6 +17,7 @@
* `EIP712`: cache `address(this)` to immutable storage to avoid potential issues if a vanilla contract is used in a delegatecall context. ([#2852](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2852)) * `EIP712`: cache `address(this)` to immutable storage to avoid potential issues if a vanilla contract is used in a delegatecall context. ([#2852](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2852))
* Add internal `_setApprovalForAll` to `ERC721` and `ERC1155`. ([#2834](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2834)) * Add internal `_setApprovalForAll` to `ERC721` and `ERC1155`. ([#2834](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/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](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2892)) * `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](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2892))
* `GovernorCompatibilityBravo`: consider quorum an inclusive rather than exclusive minimum to match Compound's GovernorBravo. ([#2974](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2974))
* `GovernorSettings`: a new governor module that manages voting settings updatable through governance actions. ([#2904](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2904)) * `GovernorSettings`: a new governor module that manages voting settings updatable through governance actions. ([#2904](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2904))
* `PaymentSplitter`: now supports ERC20 assets in addition to Ether. ([#2858](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2858)) * `PaymentSplitter`: now supports ERC20 assets in addition to Ether. ([#2858](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2858))
* `ECDSA`: add a variant of `toEthSignedMessageHash` for arbitrary length message hashing. ([#2865](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2865)) * `ECDSA`: add a variant of `toEthSignedMessageHash` for arbitrary length message hashing. ([#2865](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2865))

@ -66,7 +66,7 @@ The core development principles and strategies that OpenZeppelin Contracts is ba
The latest audit was done on October 2018 on version 2.0.0. The latest audit was done on October 2018 on version 2.0.0.
Please report any security issues you find to security@openzeppelin.org. We have a [**bug bounty program** on Immunefi](https://www.immunefi.com/bounty/openzeppelin). Please report any security issues you find through the Immunefi dashboard, or reach out to security@openzeppelin.com.
Critical bug fixes will be backported to past major releases. Critical bug fixes will be backported to past major releases.

@ -1,5 +1,11 @@
# Security Policy # Security Policy
## Bug Bounty
We have a [**bug bounty program** on Immunefi](https://www.immunefi.com/bounty/openzeppelin). Please report any security issues you find through the Immunefi dashboard, or reach out to security@openzeppelin.com.
Critical bug fixes will be backported to past major releases.
## Supported Versions ## Supported Versions
The recommendation is to use the latest version available. The recommendation is to use the latest version available.
@ -12,9 +18,3 @@ The recommendation is to use the latest version available.
| < 2.0 | :x: | | < 2.0 | :x: |
Note that the Solidity language itself only guarantees security updates for the latest release. Note that the Solidity language itself only guarantees security updates for the latest release.
## Reporting a Vulnerability
Please report any security issues you find to security@openzeppelin.org.
Critical bug fixes will be backported to past major releases.

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (access/AccessControl.sol) // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (access/AccessControlEnumerable.sol) // OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (access/IAccessControl.sol) // OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (access/IAccessControlEnumerable.sol) // OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (access/Ownable.sol) // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (finance/PaymentSplitter.sol) // OpenZeppelin Contracts v4.4.0 (finance/PaymentSplitter.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (finance/VestingWallet.sol) // OpenZeppelin Contracts v4.4.0 (finance/VestingWallet.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../token/ERC20/utils/SafeERC20.sol"; import "../token/ERC20/utils/SafeERC20.sol";
@ -19,7 +19,7 @@ import "../utils/math/Math.sol";
*/ */
contract VestingWallet is Context { contract VestingWallet is Context {
event EtherReleased(uint256 amount); event EtherReleased(uint256 amount);
event ERC20Released(address token, uint256 amount); event ERC20Released(address indexed token, uint256 amount);
uint256 private _released; uint256 private _released;
mapping(address => uint256) private _erc20Released; mapping(address => uint256) private _erc20Released;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/Governor.sol) // OpenZeppelin Contracts v4.4.0 (governance/Governor.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -110,23 +110,36 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
* @dev See {IGovernor-state}. * @dev See {IGovernor-state}.
*/ */
function state(uint256 proposalId) public view virtual override returns (ProposalState) { function state(uint256 proposalId) public view virtual override returns (ProposalState) {
ProposalCore memory proposal = _proposals[proposalId]; ProposalCore storage proposal = _proposals[proposalId];
if (proposal.executed) { if (proposal.executed) {
return ProposalState.Executed; return ProposalState.Executed;
} else if (proposal.canceled) { }
if (proposal.canceled) {
return ProposalState.Canceled; return ProposalState.Canceled;
} else if (proposal.voteStart.getDeadline() >= block.number) { }
uint256 snapshot = proposalSnapshot(proposalId);
if (snapshot == 0) {
revert("Governor: unknown proposal id");
}
if (snapshot >= block.number) {
return ProposalState.Pending; return ProposalState.Pending;
} else if (proposal.voteEnd.getDeadline() >= block.number) { }
uint256 deadline = proposalDeadline(proposalId);
if (deadline >= block.number) {
return ProposalState.Active; return ProposalState.Active;
} else if (proposal.voteEnd.isExpired()) { }
return
_quorumReached(proposalId) && _voteSucceeded(proposalId) if (_quorumReached(proposalId) && _voteSucceeded(proposalId)) {
? ProposalState.Succeeded return ProposalState.Succeeded;
: ProposalState.Defeated;
} else { } else {
revert("Governor: unknown proposal id"); return ProposalState.Defeated;
} }
} }
@ -347,6 +360,20 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
return weight; return weight;
} }
/**
* @dev Relays a transaction or function call to an arbitrary target. In cases where the governance executor
* is some contract other than the governor itself, like when using a timelock, this function can be invoked
* in a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake.
* Note that if the executor is simply the governor itself, use of `relay` is redundant.
*/
function relay(
address target,
uint256 value,
bytes calldata data
) external onlyGovernance {
Address.functionCallWithValue(target, data, value);
}
/** /**
* @dev Address through which the governor executes action. Will be overloaded by module that execute actions * @dev Address through which the governor executes action. Will be overloaded by module that execute actions
* through another contract such as a timelock. * through another contract such as a timelock.

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/IGovernor.sol) // OpenZeppelin Contracts v4.4.0 (governance/IGovernor.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -42,13 +42,15 @@ Other extensions can customize the behavior or interface in multiple ways.
* {GovernorSettings}: Manages some of the settings (voting delay, voting period duration, and proposal threshold) in a way that can be updated through a governance proposal, without requiering an upgrade. * {GovernorSettings}: Manages some of the settings (voting delay, voting period duration, and proposal threshold) in a way that can be updated through a governance proposal, without requiering an upgrade.
* {GovernorPreventLateQuorum}: Ensures there is a minimum voting period after quorum is reached as a security protection against large voters.
In addition to modules and extensions, the core contract requires a few virtual functions to be implemented to your particular specifications: In addition to modules and extensions, the core contract requires a few virtual functions to be implemented to your particular specifications:
* <<Governor-votingDelay-,`votingDelay()`>>: Delay (in number of blocks) since the proposal is submitted until voting power is fixed and voting starts. This can be used to enforce a delay after a proposal is published for users to buy tokens, or delegate their votes. * <<Governor-votingDelay-,`votingDelay()`>>: Delay (in number of blocks) since the proposal is submitted until voting power is fixed and voting starts. This can be used to enforce a delay after a proposal is published for users to buy tokens, or delegate their votes.
* <<Governor-votingPeriod-,`votingPeriod()`>>: Delay (in number of blocks) since the proposal starts until voting ends. * <<Governor-votingPeriod-,`votingPeriod()`>>: Delay (in number of blocks) since the proposal starts until voting ends.
* <<Governor-quorum-uint256-,`quorum(uint256 blockNumber)`>>: Quorum required for a proposal to be successful. This function includes a `blockNumber` argument so the quorum can adapt through time, for example, to follow a token's `totalSupply`. * <<Governor-quorum-uint256-,`quorum(uint256 blockNumber)`>>: Quorum required for a proposal to be successful. This function includes a `blockNumber` argument so the quorum can adapt through time, for example, to follow a token's `totalSupply`.
NOTE: Functions of the `Governor` contract do not include access control. If you want to restrict access, you should add these checks by overloading the particular functions. Among these, {Governor-_cancel} is internal by default, and you will have to expose it (which the right access control mechanism) yourself if this function is needed. NOTE: Functions of the `Governor` contract do not include access control. If you want to restrict access, you should add these checks by overloading the particular functions. Among these, {Governor-_cancel} is internal by default, and you will have to expose it (with the right access control mechanism) yourself if this function is needed.
=== Core === Core
@ -74,6 +76,8 @@ NOTE: Functions of the `Governor` contract do not include access control. If you
{{GovernorSettings}} {{GovernorSettings}}
{{GovernorPreventLateQuorum}}
{{GovernorCompatibilityBravo}} {{GovernorCompatibilityBravo}}
=== Deprecated === Deprecated
@ -82,7 +86,7 @@ NOTE: Functions of the `Governor` contract do not include access control. If you
== Timelock == Timelock
In a governance system, the {TimelockController} contract is in carge of introducing a delay between a proposal and its execution. It can be used with or without a {Governor}. In a governance system, the {TimelockController} contract is in charge of introducing a delay between a proposal and its execution. It can be used with or without a {Governor}.
{{TimelockController}} {{TimelockController}}

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/TimelockController.sol) // OpenZeppelin Contracts v4.4.0 (governance/TimelockController.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/compatibility/GovernorCompatibilityBravo.sol) // OpenZeppelin Contracts v4.4.0 (governance/compatibility/GovernorCompatibilityBravo.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -247,7 +247,7 @@ abstract contract GovernorCompatibilityBravo is IGovernorTimelock, IGovernorComp
*/ */
function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) { function _quorumReached(uint256 proposalId) internal view virtual override returns (bool) {
ProposalDetails storage details = _proposalDetails[proposalId]; ProposalDetails storage details = _proposalDetails[proposalId];
return quorum(proposalSnapshot(proposalId)) < details.forVotes; return quorum(proposalSnapshot(proposalId)) <= details.forVotes;
} }
/** /**

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/compatibility/IGovernorCompatibilityBravo.sol) // OpenZeppelin Contracts v4.4.0 (governance/compatibility/IGovernorCompatibilityBravo.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorCountingSimple.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorCountingSimple.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -0,0 +1,106 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../Governor.sol";
import "../../utils/math/Math.sol";
/**
* @dev A module that ensures there is a minimum voting period after quorum is reached. This prevents a large voter from
* swaying a vote and triggering quorum at the last minute, by ensuring there is always time for other voters to react
* and try to oppose the decision.
*
* If a vote causes quorum to be reached, the proposal's voting period may be extended so that it does not end before at
* least a given number of blocks have passed (the "vote extension" parameter). This parameter can be set by the
* governance executor (e.g. through a governance proposal).
*
* _Available since v4.5._
*/
abstract contract GovernorPreventLateQuorum is Governor {
using SafeCast for uint256;
using Timers for Timers.BlockNumber;
uint64 private _voteExtension;
mapping(uint256 => Timers.BlockNumber) private _extendedDeadlines;
/// @dev Emitted when a proposal deadline is pushed back due to reaching quorum late in its voting period.
event ProposalExtended(uint256 indexed proposalId, uint64 extendedDeadline);
/// @dev Emitted when the {lateQuorumVoteExtension} parameter is changed.
event LateQuorumVoteExtensionSet(uint64 oldVoteExtension, uint64 newVoteExtension);
/**
* @dev Initializes the vote extension parameter: the number of blocks that are required to pass since a proposal
* reaches quorum until its voting period ends. If necessary the voting period will be extended beyond the one set
* at proposal creation.
*/
constructor(uint64 initialVoteExtension) {
_setLateQuorumVoteExtension(initialVoteExtension);
}
/**
* @dev Returns the proposal deadline, which may have been extended beyond that set at proposal creation, if the
* proposal reached quorum late in the voting period. See {Governor-proposalDeadline}.
*/
function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256) {
return Math.max(super.proposalDeadline(proposalId), _extendedDeadlines[proposalId].getDeadline());
}
/**
* @dev Casts a vote and detects if it caused quorum to be reached, potentially extending the voting period. See
* {Governor-_castVote}.
*
* May emit a {ProposalExtended} event.
*/
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual override returns (uint256) {
uint256 result = super._castVote(proposalId, account, support, reason);
Timers.BlockNumber storage extendedDeadline = _extendedDeadlines[proposalId];
if (extendedDeadline.isUnset() && _quorumReached(proposalId)) {
uint64 extendedDeadlineValue = block.number.toUint64() + lateQuorumVoteExtension();
if (extendedDeadlineValue > proposalDeadline(proposalId)) {
emit ProposalExtended(proposalId, extendedDeadlineValue);
}
extendedDeadline.setDeadline(extendedDeadlineValue);
}
return result;
}
/**
* @dev Returns the current value of the vote extension parameter: the number of blocks that are required to pass
* from the time a proposal reaches quorum until its voting period ends.
*/
function lateQuorumVoteExtension() public view virtual returns (uint64) {
return _voteExtension;
}
/**
* @dev Changes the {lateQuorumVoteExtension}. This operation can only be performed by the governance executor,
* generally through a governance proposal.
*
* Emits a {LateQuorumVoteExtensionSet} event.
*/
function setLateQuorumVoteExtension(uint64 newVoteExtension) public virtual onlyGovernance {
_setLateQuorumVoteExtension(newVoteExtension);
}
/**
* @dev Changes the {lateQuorumVoteExtension}. This is an internal function that can be exposed in a public function
* like {setLateQuorumVoteExtension} if another access control mechanism is needed.
*
* Emits a {LateQuorumVoteExtensionSet} event.
*/
function _setLateQuorumVoteExtension(uint64 newVoteExtension) internal virtual {
emit LateQuorumVoteExtensionSet(_voteExtension, newVoteExtension);
_voteExtension = newVoteExtension;
}
}

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorProposalThreshold.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorProposalThreshold.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorSettings.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorSettings.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -58,7 +58,7 @@ abstract contract GovernorSettings is Governor {
* *
* Emits a {VotingDelaySet} event. * Emits a {VotingDelaySet} event.
*/ */
function setVotingDelay(uint256 newVotingDelay) public onlyGovernance { function setVotingDelay(uint256 newVotingDelay) public virtual onlyGovernance {
_setVotingDelay(newVotingDelay); _setVotingDelay(newVotingDelay);
} }
@ -67,7 +67,7 @@ abstract contract GovernorSettings is Governor {
* *
* Emits a {VotingPeriodSet} event. * Emits a {VotingPeriodSet} event.
*/ */
function setVotingPeriod(uint256 newVotingPeriod) public onlyGovernance { function setVotingPeriod(uint256 newVotingPeriod) public virtual onlyGovernance {
_setVotingPeriod(newVotingPeriod); _setVotingPeriod(newVotingPeriod);
} }
@ -76,7 +76,7 @@ abstract contract GovernorSettings is Governor {
* *
* Emits a {ProposalThresholdSet} event. * Emits a {ProposalThresholdSet} event.
*/ */
function setProposalThreshold(uint256 newProposalThreshold) public onlyGovernance { function setProposalThreshold(uint256 newProposalThreshold) public virtual onlyGovernance {
_setProposalThreshold(newProposalThreshold); _setProposalThreshold(newProposalThreshold);
} }

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorTimelockCompound.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorTimelockCompound.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorTimelockControl.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorTimelockControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -57,8 +57,10 @@ abstract contract GovernorTimelockControl is IGovernorTimelock, Governor {
return status; return status;
} else if (_timelock.isOperationDone(queueid)) { } else if (_timelock.isOperationDone(queueid)) {
return ProposalState.Executed; return ProposalState.Executed;
} else { } else if (_timelock.isOperationPending(queueid)) {
return ProposalState.Queued; return ProposalState.Queued;
} else {
return ProposalState.Canceled;
} }
} }

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorVotes.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotes.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorVotesComp.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotesComp.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/GovernorVotesQuorumFraction.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotesQuorumFraction.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (governance/extensions/IGovernorTimelock.sol) // OpenZeppelin Contracts v4.4.0 (governance/extensions/IGovernorTimelock.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1155.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1155MetadataURI.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1271.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1363.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1363Receiver.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1363Spender.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363Spender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC165.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC165.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1820Implementer.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1820Implementer.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC1820Registry.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC1820Registry.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC20.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC20Metadata.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC20Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC2981.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC2981.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC3156.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC3156FlashBorrower.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156FlashBorrower.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC3156FlashLender.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156FlashLender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC721.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC721.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC721Enumerable.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Enumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC721Metadata.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC721Receiver.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC777.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC777.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC777Recipient.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC777Recipient.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/IERC777Sender.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/IERC777Sender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (interfaces/draft-IERC2612.sol) // OpenZeppelin Contracts v4.4.0 (interfaces/draft-IERC2612.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (metatx/ERC2771Context.sol) // OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (metatx/MinimalForwarder.sol) // OpenZeppelin Contracts v4.4.0 (metatx/MinimalForwarder.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -0,0 +1,60 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../governance/extensions/GovernorPreventLateQuorum.sol";
import "../governance/extensions/GovernorSettings.sol";
import "../governance/extensions/GovernorCountingSimple.sol";
import "../governance/extensions/GovernorVotes.sol";
contract GovernorPreventLateQuorumMock is
GovernorSettings,
GovernorVotes,
GovernorCountingSimple,
GovernorPreventLateQuorum
{
uint256 private _quorum;
constructor(
string memory name_,
ERC20Votes token_,
uint256 votingDelay_,
uint256 votingPeriod_,
uint256 quorum_,
uint64 voteExtension_
)
Governor(name_)
GovernorSettings(votingDelay_, votingPeriod_, 0)
GovernorVotes(token_)
GovernorPreventLateQuorum(voteExtension_)
{
_quorum = quorum_;
}
function quorum(uint256) public view virtual override returns (uint256) {
return _quorum;
}
function proposalDeadline(uint256 proposalId)
public
view
virtual
override(Governor, GovernorPreventLateQuorum)
returns (uint256)
{
return super.proposalDeadline(proposalId);
}
function proposalThreshold() public view virtual override(Governor, GovernorSettings) returns (uint256) {
return super.proposalThreshold();
}
function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason
) internal virtual override(Governor, GovernorPreventLateQuorum) returns (uint256) {
return super._castVote(proposalId, account, support, reason);
}
}

@ -20,4 +20,8 @@ contract MathMock {
function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) { function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) {
return Math.ceilDiv(a, b); return Math.ceilDiv(a, b);
} }
function abs(int256 n) public pure returns (uint256) {
return Math.abs(n);
}
} }

@ -1,7 +1,7 @@
{ {
"name": "@openzeppelin/contracts", "name": "@openzeppelin/contracts",
"description": "Secure Smart Contract library for Solidity", "description": "Secure Smart Contract library for Solidity",
"version": "4.3.2", "version": "4.4.0",
"files": [ "files": [
"**/*.sol", "**/*.sol",
"/build/contracts/*.json", "/build/contracts/*.json",

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/Clones.sol) // OpenZeppelin Contracts v4.4.0 (proxy/Clones.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/ERC1967/ERC1967Proxy.sol) // OpenZeppelin Contracts v4.4.0 (proxy/ERC1967/ERC1967Proxy.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/ERC1967/ERC1967Upgrade.sol) // OpenZeppelin Contracts v4.4.0 (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2; pragma solidity ^0.8.2;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/Proxy.sol) // OpenZeppelin Contracts v4.4.0 (proxy/Proxy.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/beacon/BeaconProxy.sol) // OpenZeppelin Contracts v4.4.0 (proxy/beacon/BeaconProxy.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/beacon/IBeacon.sol) // OpenZeppelin Contracts v4.4.0 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/beacon/UpgradeableBeacon.sol) // OpenZeppelin Contracts v4.4.0 (proxy/beacon/UpgradeableBeacon.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/transparent/ProxyAdmin.sol) // OpenZeppelin Contracts v4.4.0 (proxy/transparent/ProxyAdmin.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/transparent/TransparentUpgradeableProxy.sol) // OpenZeppelin Contracts v4.4.0 (proxy/transparent/TransparentUpgradeableProxy.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/utils/Initializable.sol) // OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
/** /**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
* *

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (proxy/utils/UUPSUpgradeable.sol) // OpenZeppelin Contracts v4.4.0 (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (security/Pausable.sol) // OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (security/PullPayment.sol) // OpenZeppelin Contracts v4.4.0 (security/PullPayment.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (security/ReentrancyGuard.sol) // OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/ERC1155.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/IERC1155.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/IERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/extensions/ERC1155Burnable.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/extensions/ERC1155Pausable.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/extensions/ERC1155Supply.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/extensions/IERC1155MetadataURI.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -22,6 +22,8 @@ import "../../../utils/Context.sol";
* The account that deploys the contract will be granted the minter and pauser * The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter * roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts. * and pauser roles to other accounts.
*
* _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
*/ */
contract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155Burnable, ERC1155Pausable { contract ERC1155PresetMinterPauser is Context, AccessControlEnumerable, ERC1155Burnable, ERC1155Pausable {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

@ -0,0 +1 @@
Contract presets are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com/) as a more powerful alternative.

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/utils/ERC1155Holder.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC1155/utils/ERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/ERC20.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/IERC20.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Burnable.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Capped.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Capped.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20FlashMint.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20FlashMint.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Pausable.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Snapshot.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Snapshot.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Votes.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20VotesComp.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20VotesComp.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/ERC20Wrapper.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Wrapper.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/IERC20Metadata.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/draft-ERC20Permit.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-ERC20Permit.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/extensions/draft-IERC20Permit.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/presets/ERC20PresetFixedSupply.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/presets/ERC20PresetFixedSupply.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../extensions/ERC20Burnable.sol"; import "../extensions/ERC20Burnable.sol";
@ -15,6 +15,8 @@ import "../extensions/ERC20Burnable.sol";
* its documentation for details. * its documentation for details.
* *
* _Available since v3.4._ * _Available since v3.4._
*
* _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
*/ */
contract ERC20PresetFixedSupply is ERC20Burnable { contract ERC20PresetFixedSupply is ERC20Burnable {
/** /**

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/presets/ERC20PresetMinterPauser.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/presets/ERC20PresetMinterPauser.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
@ -22,6 +22,8 @@ import "../../../utils/Context.sol";
* The account that deploys the contract will be granted the minter and pauser * The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter * roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts. * and pauser roles to other accounts.
*
* _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
*/ */
contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable { contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

@ -0,0 +1 @@
Contract presets are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com/) as a more powerful alternative.

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/utils/SafeERC20.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC20/utils/TokenTimelock.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/TokenTimelock.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC721/ERC721.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (token/ERC721/IERC721.sol) // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save