Commit 9a42784c by github-actions

Transpile a60bf641

parent f61fdc11
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
* `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)) * `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))
* `GovernorPreventLateQuorum`: 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)) * `GovernorPreventLateQuorum`: 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))
* `ERC721`: improved revert reason when transferring from wrong owner. ([#2975](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2975)) * `ERC721`: improved revert reason when transferring from wrong owner. ([#2975](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2975))
* `Votes`: Added a base contract for vote tracking with delegation. ([#2944](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2944))
* `ERC721Votes`: Added an extension of ERC721 enabled with vote tracking and delegation. ([#2944](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2944))
## 4.4.1 (2021-12-10) ## 4.4.1 (2021-12-14)
* `Initializable`: change the existing `initializer` modifier and add a new `onlyInitializing` modifier to prevent reentrancy risk. ([#3006](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3006)) * `Initializable`: change the existing `initializer` modifier and add a new `onlyInitializing` modifier to prevent reentrancy risk. ([#3006](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3006))
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol) // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol) // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol) // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (finance/PaymentSplitter.sol) // OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (finance/VestingWallet.sol) // OpenZeppelin Contracts v4.4.1 (finance/VestingWallet.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../token/ERC20/utils/SafeERC20Upgradeable.sol"; import "../token/ERC20/utils/SafeERC20Upgradeable.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/Governor.sol) // OpenZeppelin Contracts v4.4.1 (governance/Governor.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/IGovernor.sol) // OpenZeppelin Contracts v4.4.1 (governance/IGovernor.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
...@@ -200,7 +200,7 @@ abstract contract IGovernorUpgradeable is Initializable, IERC165Upgradeable { ...@@ -200,7 +200,7 @@ abstract contract IGovernorUpgradeable is Initializable, IERC165Upgradeable {
function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance); function castVote(uint256 proposalId, uint8 support) public virtual returns (uint256 balance);
/** /**
* @dev Cast a with a reason * @dev Cast a vote with a reason
* *
* Emits a {VoteCast} event. * Emits a {VoteCast} event.
*/ */
......
...@@ -84,6 +84,10 @@ NOTE: Functions of the `Governor` contract do not include access control. If you ...@@ -84,6 +84,10 @@ NOTE: Functions of the `Governor` contract do not include access control. If you
{{GovernorProposalThreshold}} {{GovernorProposalThreshold}}
== Utils
{{Votes}}
== Timelock == Timelock
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}. 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}.
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/TimelockController.sol) // OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/compatibility/GovernorCompatibilityBravo.sol) // OpenZeppelin Contracts v4.4.1 (governance/compatibility/GovernorCompatibilityBravo.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/compatibility/IGovernorCompatibilityBravo.sol) // OpenZeppelin Contracts v4.4.1 (governance/compatibility/IGovernorCompatibilityBravo.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorCountingSimple.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorCountingSimple.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorProposalThreshold.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorProposalThreshold.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorSettings.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorSettings.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorTimelockCompound.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorTimelockCompound.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorTimelockControl.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorTimelockControl.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
...@@ -11,12 +11,16 @@ import "../../proxy/utils/Initializable.sol"; ...@@ -11,12 +11,16 @@ import "../../proxy/utils/Initializable.sol";
/** /**
* @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a * @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a
* delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The * delay, enforced by the {TimelockController} to all successful proposal (in addition to the voting duration). The
* {Governor} needs the proposer (an ideally the executor) roles for the {Governor} to work properly. * {Governor} needs the proposer (and ideally the executor) roles for the {Governor} to work properly.
* *
* Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus, * Using this model means the proposal will be operated by the {TimelockController} and not by the {Governor}. Thus,
* the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be * the assets and permissions must be attached to the {TimelockController}. Any asset sent to the {Governor} will be
* inaccessible. * inaccessible.
* *
* WARNING: Setting up the TimelockController to have additional proposers besides the governor introduces the risk that
* approved governance proposals could be blocked by the other proposers, effectively executing a Denial of Service attack,
* and therefore blocking access to governance-controlled assets.
*
* _Available since v4.3._ * _Available since v4.3._
*/ */
abstract contract GovernorTimelockControlUpgradeable is Initializable, IGovernorTimelockUpgradeable, GovernorUpgradeable { abstract contract GovernorTimelockControlUpgradeable is Initializable, IGovernorTimelockUpgradeable, GovernorUpgradeable {
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotesComp.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotesComp.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotesQuorumFraction.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotesQuorumFraction.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/GovernorVotes.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotes.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../GovernorUpgradeable.sol"; import "../GovernorUpgradeable.sol";
import "../../token/ERC20/extensions/ERC20VotesUpgradeable.sol"; import "../utils/IVotesUpgradeable.sol";
import "../../utils/math/MathUpgradeable.sol";
import "../../proxy/utils/Initializable.sol"; import "../../proxy/utils/Initializable.sol";
/** /**
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token. * @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token.
* *
* _Available since v4.3._ * _Available since v4.3._
*/ */
abstract contract GovernorVotesUpgradeable is Initializable, GovernorUpgradeable { abstract contract GovernorVotesUpgradeable is Initializable, GovernorUpgradeable {
ERC20VotesUpgradeable public token; IVotesUpgradeable public token;
function __GovernorVotes_init(ERC20VotesUpgradeable tokenAddress) internal onlyInitializing { function __GovernorVotes_init(IVotesUpgradeable tokenAddress) internal onlyInitializing {
__Context_init_unchained(); __Context_init_unchained();
__ERC165_init_unchained(); __ERC165_init_unchained();
__IGovernor_init_unchained(); __IGovernor_init_unchained();
__GovernorVotes_init_unchained(tokenAddress); __GovernorVotes_init_unchained(tokenAddress);
} }
function __GovernorVotes_init_unchained(ERC20VotesUpgradeable tokenAddress) internal onlyInitializing { function __GovernorVotes_init_unchained(IVotesUpgradeable tokenAddress) internal onlyInitializing {
token = tokenAddress; token = tokenAddress;
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (governance/extensions/IGovernorTimelock.sol) // OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IVotes.sol)
pragma solidity ^0.8.0;
/**
* @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
*
* _Available since v4.5._
*/
interface IVotesUpgradeable {
/**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/**
* @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/**
* @dev Returns the current amount of votes that `account` has.
*/
function getVotes(address account) external view returns (uint256);
/**
* @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).
*/
function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);
/**
* @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).
*
* NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
* Votes that have not been delegated are still part of total supply, even though they would not participate in a
* vote.
*/
function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);
/**
* @dev Returns the delegate that `account` has chosen.
*/
function delegates(address account) external view returns (address);
/**
* @dev Delegates votes from the sender to `delegatee`.
*/
function delegate(address delegatee) external;
/**
* @dev Delegates votes from signer to `delegatee`.
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/ContextUpgradeable.sol";
import "../../utils/CountersUpgradeable.sol";
import "../../utils/CheckpointsUpgradeable.sol";
import "../../utils/cryptography/draft-EIP712Upgradeable.sol";
import "./IVotesUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be
* transferred, and provides a system of vote delegation, where an account can delegate its voting units to a sort of
* "representative" that will pool delegated voting units from different accounts and can then use it to vote in
* decisions. In fact, voting units _must_ be delegated in order to count as actual votes, and an account has to
* delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative.
*
* This contract is often combined with a token contract such that voting units correspond to token units. For an
* example, see {ERC721Votes}.
*
* The full history of delegate votes is tracked on-chain so that governance protocols can consider votes as distributed
* at a particular block number to protect against flash loans and double voting. The opt-in delegate system makes the
* cost of this history tracking optional.
*
* When using this module the derived contract must implement {_getVotingUnits} (for example, make it return
* {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the
* previous example, it would be included in {ERC721-_beforeTokenTransfer}).
*
* _Available since v4.5._
*/
abstract contract VotesUpgradeable is Initializable, IVotesUpgradeable, ContextUpgradeable, EIP712Upgradeable {
function __Votes_init() internal onlyInitializing {
__Context_init_unchained();
__Votes_init_unchained();
}
function __Votes_init_unchained() internal onlyInitializing {
}
using CheckpointsUpgradeable for CheckpointsUpgradeable.History;
using CountersUpgradeable for CountersUpgradeable.Counter;
bytes32 private constant _DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping(address => address) private _delegation;
mapping(address => CheckpointsUpgradeable.History) private _delegateCheckpoints;
CheckpointsUpgradeable.History private _totalCheckpoints;
mapping(address => CountersUpgradeable.Counter) private _nonces;
/**
* @dev Returns the current amount of votes that `account` has.
*/
function getVotes(address account) public view virtual override returns (uint256) {
return _delegateCheckpoints[account].latest();
}
/**
* @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {
return _delegateCheckpoints[account].getAtBlock(blockNumber);
}
/**
* @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).
*
* NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
* Votes that have not been delegated are still part of total supply, even though they would not participate in a
* vote.
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {
require(blockNumber < block.number, "Votes: block not yet mined");
return _totalCheckpoints.getAtBlock(blockNumber);
}
/**
* @dev Returns the current total supply of votes.
*/
function _getTotalSupply() internal view virtual returns (uint256) {
return _totalCheckpoints.latest();
}
/**
* @dev Returns the delegate that `account` has chosen.
*/
function delegates(address account) public view virtual override returns (address) {
return _delegation[account];
}
/**
* @dev Delegates votes from the sender to `delegatee`.
*/
function delegate(address delegatee) public virtual override {
address account = _msgSender();
_delegate(account, delegatee);
}
/**
* @dev Delegates votes from signer to `delegatee`.
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= expiry, "Votes: signature expired");
address signer = ECDSAUpgradeable.recover(
_hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
v,
r,
s
);
require(nonce == _useNonce(signer), "Votes: invalid nonce");
_delegate(signer, delegatee);
}
/**
* @dev Delegate all of `account`'s voting units to `delegatee`.
*
* Emits events {DelegateChanged} and {DelegateVotesChanged}.
*/
function _delegate(address account, address delegatee) internal virtual {
address oldDelegate = delegates(account);
_delegation[account] = delegatee;
emit DelegateChanged(account, oldDelegate, delegatee);
_moveDelegateVotes(oldDelegate, delegatee, _getVotingUnits(account));
}
/**
* @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to`
* should be zero. Total supply of voting units will be adjusted with mints and burns.
*/
function _transferVotingUnits(
address from,
address to,
uint256 amount
) internal virtual {
if (from == address(0)) {
_totalCheckpoints.push(_add, amount);
}
if (to == address(0)) {
_totalCheckpoints.push(_subtract, amount);
}
_moveDelegateVotes(delegates(from), delegates(to), amount);
}
/**
* @dev Moves delegated votes from one delegate to another.
*/
function _moveDelegateVotes(
address from,
address to,
uint256 amount
) private {
if (from != to && amount > 0) {
if (from != address(0)) {
(uint256 oldValue, uint256 newValue) = _delegateCheckpoints[from].push(_subtract, amount);
emit DelegateVotesChanged(from, oldValue, newValue);
}
if (to != address(0)) {
(uint256 oldValue, uint256 newValue) = _delegateCheckpoints[to].push(_add, amount);
emit DelegateVotesChanged(to, oldValue, newValue);
}
}
}
function _add(uint256 a, uint256 b) private pure returns (uint256) {
return a + b;
}
function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
return a - b;
}
/**
* @dev Consumes a nonce.
*
* Returns the current value and increments nonce.
*/
function _useNonce(address owner) internal virtual returns (uint256 current) {
CountersUpgradeable.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
/**
* @dev Returns an address nonce.
*/
function nonces(address owner) public view virtual returns (uint256) {
return _nonces[owner].current();
}
/**
* @dev Returns the contract's {EIP712} domain separator.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev Must return the voting units held by an account.
*/
function _getVotingUnits(address) internal virtual returns (uint256);
uint256[46] private __gap;
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155MetadataURI.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1155.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1271.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363Receiver.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363Spender.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Spender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1363.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC165.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1820Implementer.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Implementer.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC1820Registry.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Registry.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC20Metadata.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC20.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC2981.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC2981.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156FlashBorrower.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashBorrower.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156FlashLender.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashLender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC3156.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Enumerable.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Metadata.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC721Receiver.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC721.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC777Recipient.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Recipient.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC777Sender.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Sender.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/IERC777.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (interfaces/draft-IERC2612.sol) // OpenZeppelin Contracts v4.4.1 (interfaces/draft-IERC2612.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol) // OpenZeppelin Contracts v4.4.1 (metatx/ERC2771Context.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (metatx/MinimalForwarder.sol) // OpenZeppelin Contracts v4.4.1 (metatx/MinimalForwarder.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
...@@ -56,9 +56,17 @@ contract MinimalForwarderUpgradeable is Initializable, EIP712Upgradeable { ...@@ -56,9 +56,17 @@ contract MinimalForwarderUpgradeable is Initializable, EIP712Upgradeable {
(bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}( (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(
abi.encodePacked(req.data, req.from) abi.encodePacked(req.data, req.from)
); );
// Validate that the relayer has sent enough gas for the call. // Validate that the relayer has sent enough gas for the call.
// See https://ronan.eth.link/blog/ethereum-gas-dangers/ // See https://ronan.eth.link/blog/ethereum-gas-dangers/
assert(gasleft() > req.gas / 63); if (gasleft() <= req.gas / 63) {
// We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since
// neither revert or assert consume all gas since Solidity 0.8.0
// https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require
assembly {
invalid()
}
}
return (success, returndata); return (success, returndata);
} }
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/CheckpointsUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
contract CheckpointsImplUpgradeable is Initializable {
function __CheckpointsImpl_init() internal onlyInitializing {
__CheckpointsImpl_init_unchained();
}
function __CheckpointsImpl_init_unchained() internal onlyInitializing {
}
using CheckpointsUpgradeable for CheckpointsUpgradeable.History;
CheckpointsUpgradeable.History private _totalCheckpoints;
function latest() public view returns (uint256) {
return _totalCheckpoints.latest();
}
function getAtBlock(uint256 blockNumber) public view returns (uint256) {
return _totalCheckpoints.getAtBlock(blockNumber);
}
function push(uint256 value) public returns (uint256, uint256) {
return _totalCheckpoints.push(value);
}
uint256[49] private __gap;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../token/ERC721/extensions/draft-ERC721VotesUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
contract ERC721VotesMockUpgradeable is Initializable, ERC721VotesUpgradeable {
function __ERC721VotesMock_init(string memory name, string memory symbol) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__EIP712_init_unchained(name, "1");
__Votes_init_unchained();
__ERC721Votes_init_unchained();
__ERC721VotesMock_init_unchained(name, symbol);
}
function __ERC721VotesMock_init_unchained(string memory name, string memory symbol) internal onlyInitializing {}
function getTotalSupply() public view returns (uint256) {
return _getTotalSupply();
}
function mint(address account, uint256 tokenId) public {
_mint(account, tokenId);
}
function burn(uint256 tokenId) public {
_burn(tokenId);
}
function getChainId() external view returns (uint256) {
return block.chainid;
}
uint256[50] private __gap;
}
...@@ -16,7 +16,7 @@ contract GovernorMockUpgradeable is ...@@ -16,7 +16,7 @@ contract GovernorMockUpgradeable is
{ {
function __GovernorMock_init( function __GovernorMock_init(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
uint256 quorumNumerator_ uint256 quorumNumerator_
...@@ -36,7 +36,7 @@ contract GovernorMockUpgradeable is ...@@ -36,7 +36,7 @@ contract GovernorMockUpgradeable is
function __GovernorMock_init_unchained( function __GovernorMock_init_unchained(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
uint256 quorumNumerator_ uint256 quorumNumerator_
......
...@@ -18,7 +18,7 @@ contract GovernorPreventLateQuorumMockUpgradeable is ...@@ -18,7 +18,7 @@ contract GovernorPreventLateQuorumMockUpgradeable is
function __GovernorPreventLateQuorumMock_init( function __GovernorPreventLateQuorumMock_init(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
uint256 quorum_, uint256 quorum_,
...@@ -38,7 +38,7 @@ contract GovernorPreventLateQuorumMockUpgradeable is ...@@ -38,7 +38,7 @@ contract GovernorPreventLateQuorumMockUpgradeable is
function __GovernorPreventLateQuorumMock_init_unchained( function __GovernorPreventLateQuorumMock_init_unchained(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
uint256 quorum_, uint256 quorum_,
......
...@@ -16,7 +16,7 @@ contract GovernorTimelockCompoundMockUpgradeable is ...@@ -16,7 +16,7 @@ contract GovernorTimelockCompoundMockUpgradeable is
{ {
function __GovernorTimelockCompoundMock_init( function __GovernorTimelockCompoundMock_init(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
ICompoundTimelockUpgradeable timelock_, ICompoundTimelockUpgradeable timelock_,
...@@ -38,7 +38,7 @@ contract GovernorTimelockCompoundMockUpgradeable is ...@@ -38,7 +38,7 @@ contract GovernorTimelockCompoundMockUpgradeable is
function __GovernorTimelockCompoundMock_init_unchained( function __GovernorTimelockCompoundMock_init_unchained(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
ICompoundTimelockUpgradeable timelock_, ICompoundTimelockUpgradeable timelock_,
......
...@@ -16,7 +16,7 @@ contract GovernorTimelockControlMockUpgradeable is ...@@ -16,7 +16,7 @@ contract GovernorTimelockControlMockUpgradeable is
{ {
function __GovernorTimelockControlMock_init( function __GovernorTimelockControlMock_init(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
TimelockControllerUpgradeable timelock_, TimelockControllerUpgradeable timelock_,
...@@ -38,7 +38,7 @@ contract GovernorTimelockControlMockUpgradeable is ...@@ -38,7 +38,7 @@ contract GovernorTimelockControlMockUpgradeable is
function __GovernorTimelockControlMock_init_unchained( function __GovernorTimelockControlMock_init_unchained(
string memory name_, string memory name_,
ERC20VotesUpgradeable token_, IVotesUpgradeable token_,
uint256 votingDelay_, uint256 votingDelay_,
uint256 votingPeriod_, uint256 votingPeriod_,
TimelockControllerUpgradeable timelock_, TimelockControllerUpgradeable timelock_,
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../governance/extensions/GovernorCountingSimpleUpgradeable.sol";
import "../governance/extensions/GovernorVotesUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
contract GovernorVoteMocksUpgradeable is Initializable, GovernorVotesUpgradeable, GovernorCountingSimpleUpgradeable {
function __GovernorVoteMocks_init(string memory name_, IVotesUpgradeable token_) internal onlyInitializing {
__Context_init_unchained();
__ERC165_init_unchained();
__EIP712_init_unchained(name_, version());
__IGovernor_init_unchained();
__Governor_init_unchained(name_);
__GovernorVotes_init_unchained(token_);
__GovernorCountingSimple_init_unchained();
__GovernorVoteMocks_init_unchained(name_, token_);
}
function __GovernorVoteMocks_init_unchained(string memory name_, IVotesUpgradeable token_) internal onlyInitializing {}
function quorum(uint256) public pure override returns (uint256) {
return 0;
}
function votingDelay() public pure override returns (uint256) {
return 4;
}
function votingPeriod() public pure override returns (uint256) {
return 16;
}
function cancel(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes32 salt
) public returns (uint256 proposalId) {
return _cancel(targets, values, calldatas, salt);
}
function getVotes(address account, uint256 blockNumber)
public
view
virtual
override(IGovernorUpgradeable, GovernorVotesUpgradeable)
returns (uint256)
{
return super.getVotes(account, blockNumber);
}
uint256[50] private __gap;
}
...@@ -41,7 +41,7 @@ contract ERC20ReturnFalseMockUpgradeable is Initializable, ContextUpgradeable { ...@@ -41,7 +41,7 @@ contract ERC20ReturnFalseMockUpgradeable is Initializable, ContextUpgradeable {
} }
function allowance(address, address) public view returns (uint256) { function allowance(address, address) public view returns (uint256) {
require(_dummy == 0); // Duummy read from a state variable so that the function is view require(_dummy == 0); // Dummy read from a state variable so that the function is view
return 0; return 0;
} }
uint256[48] private __gap; uint256[48] private __gap;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../governance/utils/VotesUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
contract VotesMockUpgradeable is Initializable, VotesUpgradeable {
mapping(address => uint256) private _balances;
mapping(uint256 => address) private _owners;
function __VotesMock_init(string memory name) internal onlyInitializing {
__Context_init_unchained();
__EIP712_init_unchained(name, "1");
__Votes_init_unchained();
__VotesMock_init_unchained(name);
}
function __VotesMock_init_unchained(string memory name) internal onlyInitializing {}
function getTotalSupply() public view returns (uint256) {
return _getTotalSupply();
}
function delegate(address account, address newDelegation) public {
return _delegate(account, newDelegation);
}
function _getVotingUnits(address account) internal virtual override returns (uint256) {
return _balances[account];
}
function mint(address account, uint256 voteId) external {
_balances[account] += 1;
_owners[voteId] = account;
_transferVotingUnits(address(0), account, 1);
}
function burn(uint256 voteId) external {
address owner = _owners[voteId];
_balances[owner] -= 1;
_transferVotingUnits(owner, address(0), 1);
}
function getChainId() external view returns (uint256) {
return block.chainid;
}
uint256[48] private __gap;
}
...@@ -15,7 +15,7 @@ contract MyGovernor1Upgradeable is ...@@ -15,7 +15,7 @@ contract MyGovernor1Upgradeable is
GovernorVotesQuorumFractionUpgradeable, GovernorVotesQuorumFractionUpgradeable,
GovernorCountingSimpleUpgradeable GovernorCountingSimpleUpgradeable
{ {
function __MyGovernor1_init(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing { function __MyGovernor1_init(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {
__Context_init_unchained(); __Context_init_unchained();
__ERC165_init_unchained(); __ERC165_init_unchained();
__EIP712_init_unchained("MyGovernor", version()); __EIP712_init_unchained("MyGovernor", version());
...@@ -29,7 +29,7 @@ contract MyGovernor1Upgradeable is ...@@ -29,7 +29,7 @@ contract MyGovernor1Upgradeable is
__MyGovernor1_init_unchained(_token, _timelock); __MyGovernor1_init_unchained(_token, _timelock);
} }
function __MyGovernor1_init_unchained(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {} function __MyGovernor1_init_unchained(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {}
function votingDelay() public pure override returns (uint256) { function votingDelay() public pure override returns (uint256) {
return 1; // 1 block return 1; // 1 block
......
...@@ -17,7 +17,7 @@ contract MyGovernor2Upgradeable is ...@@ -17,7 +17,7 @@ contract MyGovernor2Upgradeable is
GovernorVotesQuorumFractionUpgradeable, GovernorVotesQuorumFractionUpgradeable,
GovernorCountingSimpleUpgradeable GovernorCountingSimpleUpgradeable
{ {
function __MyGovernor2_init(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing { function __MyGovernor2_init(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {
__Context_init_unchained(); __Context_init_unchained();
__ERC165_init_unchained(); __ERC165_init_unchained();
__EIP712_init_unchained("MyGovernor", version()); __EIP712_init_unchained("MyGovernor", version());
...@@ -32,7 +32,7 @@ contract MyGovernor2Upgradeable is ...@@ -32,7 +32,7 @@ contract MyGovernor2Upgradeable is
__MyGovernor2_init_unchained(_token, _timelock); __MyGovernor2_init_unchained(_token, _timelock);
} }
function __MyGovernor2_init_unchained(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {} function __MyGovernor2_init_unchained(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {}
function votingDelay() public pure override returns (uint256) { function votingDelay() public pure override returns (uint256) {
return 1; // 1 block return 1; // 1 block
......
...@@ -15,7 +15,7 @@ contract MyGovernorUpgradeable is ...@@ -15,7 +15,7 @@ contract MyGovernorUpgradeable is
GovernorVotesUpgradeable, GovernorVotesUpgradeable,
GovernorVotesQuorumFractionUpgradeable GovernorVotesQuorumFractionUpgradeable
{ {
function __MyGovernor_init(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing { function __MyGovernor_init(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {
__Context_init_unchained(); __Context_init_unchained();
__ERC165_init_unchained(); __ERC165_init_unchained();
__EIP712_init_unchained("MyGovernor", version()); __EIP712_init_unchained("MyGovernor", version());
...@@ -30,7 +30,7 @@ contract MyGovernorUpgradeable is ...@@ -30,7 +30,7 @@ contract MyGovernorUpgradeable is
__MyGovernor_init_unchained(_token, _timelock); __MyGovernor_init_unchained(_token, _timelock);
} }
function __MyGovernor_init_unchained(ERC20VotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {} function __MyGovernor_init_unchained(IVotesUpgradeable _token, TimelockControllerUpgradeable _timelock) internal onlyInitializing {}
function votingDelay() public pure override returns (uint256) { function votingDelay() public pure override returns (uint256) {
return 1; // 1 block return 1; // 1 block
......
{ {
"name": "@openzeppelin/contracts-upgradeable", "name": "@openzeppelin/contracts-upgradeable",
"description": "Secure Smart Contract library for Solidity", "description": "Secure Smart Contract library for Solidity",
"version": "4.4.0", "version": "4.4.1",
"files": [ "files": [
"**/*.sol", "**/*.sol",
"/build/contracts/*.json", "/build/contracts/*.json",
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/Clones.sol) // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/ERC1967/ERC1967Upgrade.sol) // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2; pragma solidity ^0.8.2;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/beacon/IBeacon.sol) // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol) // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/UUPSUpgradeable.sol) // OpenZeppelin Contracts v4.4.1 (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol) // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/PullPayment.sol) // OpenZeppelin Contracts v4.4.1 (security/PullPayment.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol) // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol"; import "../proxy/utils/Initializable.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/ERC1155.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Burnable.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Pausable.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/ERC1155Supply.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/extensions/IERC1155MetadataURI.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/presets/ERC1155PresetMinterPauser.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/utils/ERC1155Holder.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/utils/ERC1155Receiver.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Burnable.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Capped.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Capped.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20FlashMint.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20FlashMint.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Pausable.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Snapshot.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Snapshot.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20VotesComp.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20VotesComp.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Votes.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "./draft-ERC20PermitUpgradeable.sol"; import "./draft-ERC20PermitUpgradeable.sol";
import "../../../utils/math/MathUpgradeable.sol"; import "../../../utils/math/MathUpgradeable.sol";
import "../../../governance/utils/IVotesUpgradeable.sol";
import "../../../utils/math/SafeCastUpgradeable.sol"; import "../../../utils/math/SafeCastUpgradeable.sol";
import "../../../utils/cryptography/ECDSAUpgradeable.sol"; import "../../../utils/cryptography/ECDSAUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol"; import "../../../proxy/utils/Initializable.sol";
...@@ -26,7 +27,7 @@ import "../../../proxy/utils/Initializable.sol"; ...@@ -26,7 +27,7 @@ import "../../../proxy/utils/Initializable.sol";
* *
* _Available since v4.2._ * _Available since v4.2._
*/ */
abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable { abstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {
function __ERC20Votes_init_unchained() internal onlyInitializing { function __ERC20Votes_init_unchained() internal onlyInitializing {
} }
struct Checkpoint { struct Checkpoint {
...@@ -42,16 +43,6 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -42,16 +43,6 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
Checkpoint[] private _totalSupplyCheckpoints; Checkpoint[] private _totalSupplyCheckpoints;
/** /**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/**
* @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/**
* @dev Get the `pos`-th checkpoint for `account`. * @dev Get the `pos`-th checkpoint for `account`.
*/ */
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
...@@ -68,14 +59,14 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -68,14 +59,14 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
/** /**
* @dev Get the address `account` is currently delegating to. * @dev Get the address `account` is currently delegating to.
*/ */
function delegates(address account) public view virtual returns (address) { function delegates(address account) public view virtual override returns (address) {
return _delegates[account]; return _delegates[account];
} }
/** /**
* @dev Gets the current votes balance for `account` * @dev Gets the current votes balance for `account`
*/ */
function getVotes(address account) public view returns (uint256) { function getVotes(address account) public view override returns (uint256) {
uint256 pos = _checkpoints[account].length; uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
} }
...@@ -87,7 +78,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -87,7 +78,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
* *
* - `blockNumber` must have been already mined * - `blockNumber` must have been already mined
*/ */
function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) { function getPastVotes(address account, uint256 blockNumber) public view override returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined"); require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_checkpoints[account], blockNumber); return _checkpointsLookup(_checkpoints[account], blockNumber);
} }
...@@ -100,7 +91,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -100,7 +91,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
* *
* - `blockNumber` must have been already mined * - `blockNumber` must have been already mined
*/ */
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) { function getPastTotalSupply(uint256 blockNumber) public view override returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined"); require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
} }
...@@ -137,7 +128,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -137,7 +128,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
/** /**
* @dev Delegate votes from the sender to `delegatee`. * @dev Delegate votes from the sender to `delegatee`.
*/ */
function delegate(address delegatee) public virtual { function delegate(address delegatee) public virtual override {
_delegate(_msgSender(), delegatee); _delegate(_msgSender(), delegatee);
} }
...@@ -151,7 +142,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable ...@@ -151,7 +142,7 @@ abstract contract ERC20VotesUpgradeable is Initializable, ERC20PermitUpgradeable
uint8 v, uint8 v,
bytes32 r, bytes32 r,
bytes32 s bytes32 s
) public virtual { ) public virtual override {
require(block.timestamp <= expiry, "ERC20Votes: signature expired"); require(block.timestamp <= expiry, "ERC20Votes: signature expired");
address signer = ECDSAUpgradeable.recover( address signer = ECDSAUpgradeable.recover(
_hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))), _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Wrapper.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Wrapper.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-ERC20Permit.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/draft-IERC20Permit.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/presets/ERC20PresetFixedSupply.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/presets/ERC20PresetFixedSupply.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import "../extensions/ERC20BurnableUpgradeable.sol"; import "../extensions/ERC20BurnableUpgradeable.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/presets/ERC20PresetMinterPauser.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/presets/ERC20PresetMinterPauser.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/TokenTimelock.sol) // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/TokenTimelock.sol)
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment