Skip to content

Commit

Permalink
Merge branch 'master' into lib-895-add-governor-signature-nonces
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx authored Jun 29, 2023
2 parents 2ed9be3 + 874c2d3 commit 2ae0a13
Show file tree
Hide file tree
Showing 176 changed files with 429 additions and 380 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-apes-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openzeppelin-solidity': major
---

Switched to using explicit Solidity import statements. Some previously available symbols may now have to be separately imported.
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"modifier-name-mixedcase": "error",
"private-vars-leading-underscore": "error",
"var-name-mixedcase": "error",
"imports-on-top": "error"
"imports-on-top": "error",
"no-global-import": "error"
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Once installed, you can use the contracts in the library by importing them:
```solidity
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract MyCollectible is ERC721 {
constructor() ERC721("MyCollectible", "MCO") {
Expand Down
8 changes: 4 additions & 4 deletions contracts/access/AccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

pragma solidity ^0.8.19;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {Strings} from "../utils/Strings.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
* @dev Contract module that allows children to implement role-based access
Expand Down
9 changes: 5 additions & 4 deletions contracts/access/AccessControlDefaultAdminRules.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

pragma solidity ^0.8.19;

import "./AccessControl.sol";
import "./IAccessControlDefaultAdminRules.sol";
import "../utils/math/SafeCast.sol";
import "../interfaces/IERC5313.sol";
import {AccessControl, IAccessControl} from "./AccessControl.sol";
import {IAccessControlDefaultAdminRules} from "./IAccessControlDefaultAdminRules.sol";
import {SafeCast} from "../utils/math/SafeCast.sol";
import {Math} from "../utils/math/Math.sol";
import {IERC5313} from "../interfaces/IERC5313.sol";

/**
* @dev Extension of {AccessControl} that allows specifying special rules to manage
Expand Down
6 changes: 3 additions & 3 deletions contracts/access/AccessControlEnumerable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

pragma solidity ^0.8.19;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
import {IAccessControlEnumerable} from "./IAccessControlEnumerable.sol";
import {AccessControl} from "./AccessControl.sol";
import {EnumerableSet} from "../utils/structs/EnumerableSet.sol";

/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/IAccessControlDefaultAdminRules.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "./IAccessControl.sol";
import {IAccessControl} from "./IAccessControl.sol";

/**
* @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection.
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/IAccessControlEnumerable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "./IAccessControl.sol";
import {IAccessControl} from "./IAccessControl.sol";

/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/Ownable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../utils/Context.sol";
import {Context} from "../utils/Context.sol";

/**
* @dev Contract module which provides a basic access control mechanism, where
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/Ownable2Step.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "./Ownable.sol";
import {Ownable} from "./Ownable.sol";

/**
* @dev Contract module which provides access control mechanism, where
Expand Down
7 changes: 4 additions & 3 deletions contracts/finance/VestingWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// OpenZeppelin Contracts (last updated v4.9.0) (finance/VestingWallet.sol)
pragma solidity ^0.8.19;

import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
import {IERC20} from "../token/ERC20/IERC20.sol";
import {SafeERC20} from "../token/ERC20/utils/SafeERC20.sol";
import {Address} from "../utils/Address.sol";
import {Context} from "../utils/Context.sol";

/**
* @title VestingWallet
Expand Down
22 changes: 11 additions & 11 deletions contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

pragma solidity ^0.8.19;

import "../token/ERC721/IERC721Receiver.sol";
import "../token/ERC1155/IERC1155Receiver.sol";
import "../utils/cryptography/ECDSA.sol";
import "../utils/cryptography/EIP712.sol";
import "../utils/introspection/ERC165.sol";
import "../utils/math/SafeCast.sol";
import "../utils/structs/DoubleEndedQueue.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
import "../utils/Nonces.sol";
import "./IGovernor.sol";
import {IERC721Receiver} from "../token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "../token/ERC1155/IERC1155Receiver.sol";
import {ECDSA} from "../utils/cryptography/ECDSA.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {IERC165, ERC165} from "../utils/introspection/ERC165.sol";
import {SafeCast} from "../utils/math/SafeCast.sol";
import {DoubleEndedQueue} from "../utils/structs/DoubleEndedQueue.sol";
import {Address} from "../utils/Address.sol";
import {Context} from "../utils/Context.sol";
import {Nonces} from "../utils/Nonces.sol";
import {IGovernor, IERC6372} from "./IGovernor.sol";

/**
* @dev Core of the governance system, designed to be extended though various modules.
Expand Down
4 changes: 2 additions & 2 deletions contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

pragma solidity ^0.8.19;

import "../interfaces/IERC165.sol";
import "../interfaces/IERC6372.sol";
import {IERC165} from "../interfaces/IERC165.sol";
import {IERC6372} from "../interfaces/IERC6372.sol";

/**
* @dev Interface of the {Governor} core.
Expand Down
9 changes: 5 additions & 4 deletions contracts/governance/TimelockController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

pragma solidity ^0.8.19;

import "../access/AccessControl.sol";
import "../token/ERC721/utils/ERC721Holder.sol";
import "../token/ERC1155/utils/ERC1155Holder.sol";
import "../utils/Address.sol";
import {AccessControl} from "../access/AccessControl.sol";
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
import {ERC1155Receiver} from "../token/ERC1155/utils/ERC1155Receiver.sol";
import {Address} from "../utils/Address.sol";

/**
* @dev Contract module which acts as a timelocked controller. When set as the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

pragma solidity ^0.8.19;

import "../../utils/math/SafeCast.sol";
import "../extensions/IGovernorTimelock.sol";
import "../Governor.sol";
import "./IGovernorCompatibilityBravo.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {IGovernorTimelock} from "../extensions/IGovernorTimelock.sol";
import {IGovernor, Governor} from "../Governor.sol";
import {IGovernorCompatibilityBravo} from "./IGovernorCompatibilityBravo.sol";

/**
* @dev Compatibility layer that implements GovernorBravo compatibility on top of {Governor}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../IGovernor.sol";
import {IGovernor} from "../IGovernor.sol";

/**
* @dev Interface extension that adds missing functions to the {Governor} core to provide `GovernorBravo` compatibility.
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/GovernorCountingSimple.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../Governor.sol";
import {Governor} from "../Governor.sol";

/**
* @dev Extension of {Governor} for simple, 3 options, vote counting.
Expand Down
4 changes: 2 additions & 2 deletions contracts/governance/extensions/GovernorPreventLateQuorum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

pragma solidity ^0.8.19;

import "../Governor.sol";
import "../../utils/math/Math.sol";
import {Governor} from "../Governor.sol";
import {Math} from "../../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
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/GovernorSettings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../Governor.sol";
import {Governor} from "../Governor.sol";

/**
* @dev Extension of {Governor} for settings updatable through governance.
Expand Down
10 changes: 6 additions & 4 deletions contracts/governance/extensions/GovernorTimelockCompound.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

pragma solidity ^0.8.19;

import "./IGovernorTimelock.sol";
import "../Governor.sol";
import "../../utils/math/SafeCast.sol";
import "../../vendor/compound/ICompoundTimelock.sol";
import {IGovernorTimelock} from "./IGovernorTimelock.sol";
import {IGovernor, Governor} from "../Governor.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {ICompoundTimelock} from "../../vendor/compound/ICompoundTimelock.sol";
import {IERC165} from "../../interfaces/IERC165.sol";
import {Address} from "../../utils/Address.sol";

/**
* @dev Extension of {Governor} that binds the execution process to a Compound Timelock. This adds a delay, enforced by
Expand Down
7 changes: 4 additions & 3 deletions contracts/governance/extensions/GovernorTimelockControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

pragma solidity ^0.8.19;

import "./IGovernorTimelock.sol";
import "../Governor.sol";
import "../TimelockController.sol";
import {IGovernorTimelock} from "./IGovernorTimelock.sol";
import {IGovernor, Governor} from "../Governor.sol";
import {TimelockController} from "../TimelockController.sol";
import {IERC165} from "../../interfaces/IERC165.sol";

/**
* @dev Extension of {Governor} that binds the execution process to an instance of {TimelockController}. This adds a
Expand Down
6 changes: 4 additions & 2 deletions contracts/governance/extensions/GovernorVotes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

pragma solidity ^0.8.19;

import "../Governor.sol";
import "../../interfaces/IERC5805.sol";
import {Governor} from "../Governor.sol";
import {IVotes} from "../utils/IVotes.sol";
import {IERC5805} from "../../interfaces/IERC5805.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";

/**
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

pragma solidity ^0.8.19;

import "./GovernorVotes.sol";
import "../../utils/math/SafeCast.sol";
import "../../utils/structs/Checkpoints.sol";
import {GovernorVotes} from "./GovernorVotes.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";

/**
* @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token and a quorum expressed as a
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/IGovernorTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../IGovernor.sol";
import {IGovernor} from "../IGovernor.sol";

/**
* @dev Extension of the {IGovernor} for timelock supporting modules.
Expand Down
12 changes: 7 additions & 5 deletions contracts/governance/utils/Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/Votes.sol)
pragma solidity ^0.8.19;

import "../../interfaces/IERC5805.sol";
import "../../utils/Context.sol";
import "../../utils/Nonces.sol";
import "../../utils/cryptography/EIP712.sol";
import "../../utils/structs/Checkpoints.sol";
import {IERC5805} from "../../interfaces/IERC5805.sol";
import {Context} from "../../utils/Context.sol";
import {Nonces} from "../../utils/Nonces.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";
import {SafeCast} from "../../utils/math/SafeCast.sol";
import {ECDSA} from "../../utils/cryptography/ECDSA.sol";

/**
* @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../token/ERC1155/IERC1155.sol";
import {IERC1155} from "../token/ERC1155/IERC1155.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC1155MetadataURI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../token/ERC1155/extensions/IERC1155MetadataURI.sol";
import {IERC1155MetadataURI} from "../token/ERC1155/extensions/IERC1155MetadataURI.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC1155Receiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../token/ERC1155/IERC1155Receiver.sol";
import {IERC1155Receiver} from "../token/ERC1155/IERC1155Receiver.sol";
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC1363.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

pragma solidity ^0.8.19;

import "./IERC20.sol";
import "./IERC165.sol";
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
* @dev Interface of an ERC1363 compliant contract, as defined in the
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC165.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../utils/introspection/IERC165.sol";
import {IERC165} from "../utils/introspection/IERC165.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../token/ERC20/IERC20.sol";
import {IERC20} from "../token/ERC20/IERC20.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC20Metadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

pragma solidity ^0.8.19;

import "../token/ERC20/extensions/IERC20Metadata.sol";
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC2612.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

pragma solidity ^0.8.19;

import "../token/ERC20/extensions/IERC20Permit.sol";
import {IERC20Permit} from "../token/ERC20/extensions/IERC20Permit.sol";

interface IERC2612 is IERC20Permit {}
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC2981.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "../utils/introspection/IERC165.sol";
import {IERC165} from "../utils/introspection/IERC165.sol";

/**
* @dev Interface for the NFT Royalty Standard.
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IERC3156.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

pragma solidity ^0.8.19;

import "./IERC3156FlashBorrower.sol";
import "./IERC3156FlashLender.sol";
import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol";
import {IERC3156FlashLender} from "./IERC3156FlashLender.sol";
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC3156FlashLender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pragma solidity ^0.8.19;

import "./IERC3156FlashBorrower.sol";
import {IERC3156FlashBorrower} from "./IERC3156FlashBorrower.sol";

/**
* @dev Interface of the ERC3156 FlashLender, as defined in
Expand Down
Loading

0 comments on commit 2ae0a13

Please sign in to comment.