Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-v4.7' into patched/rel…
Browse files Browse the repository at this point in the history
…ease-v4.7
  • Loading branch information
Amxx committed Jun 30, 2022
2 parents 6d4c354 + 8c49ad7 commit ec1fcdd
Show file tree
Hide file tree
Showing 64 changed files with 214 additions and 108 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Changelog

## 4.7.0
## 4.7.0 (2022-06-29)

* `TimelockController`: Migrate `_call` to `_execute` and allow inheritance and overriding similar to `Governor`. ([#3317](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3317))
* `CrossChainEnabledPolygonChild`: replace the `require` statement with the custom error `NotCrossChainCall`. ([#3380](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3380))
* `ERC20FlashMint`: Add customizable flash fee receiver. ([#3327](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3327))
* `ERC20TokenizedVault`: add an extension of `ERC20` that implements the ERC4626 Tokenized Vault Standard. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
* `ERC4626`: add an extension of `ERC20` that implements the ERC4626 Tokenized Vault Standard. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
* `SafeERC20`: add `safePermit` as mitigation against phantom permit functions. ([#3280](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3280))
* `Math`: add a `mulDiv` function that can round the result either up or down. ([#3171](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3171))
* `Math`: Add a `sqrt` function to compute square roots of integers, rounding either up or down. ([#3242](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3242))
Expand Down
2 changes: 1 addition & 1 deletion contracts/access/AccessControl.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (access/AccessControl.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/Ownable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (access/Ownable.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/crosschain/amb/CrossChainEnabledAMB.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/amb/CrossChainEnabledAMB.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/amb/CrossChainEnabledAMB.sol)

pragma solidity ^0.8.4;

Expand Down
2 changes: 1 addition & 1 deletion contracts/crosschain/amb/LibAMB.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/amb/LibAMB.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/amb/LibAMB.sol)

pragma solidity ^0.8.4;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol)

pragma solidity ^0.8.4;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol)

pragma solidity ^0.8.4;

Expand Down
2 changes: 1 addition & 1 deletion contracts/crosschain/arbitrum/LibArbitrumL1.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/arbitrum/LibArbitrumL1.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/arbitrum/LibArbitrumL1.sol)

pragma solidity ^0.8.4;

Expand Down
2 changes: 1 addition & 1 deletion contracts/crosschain/arbitrum/LibArbitrumL2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/arbitrum/LibArbitrumL2.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/arbitrum/LibArbitrumL2.sol)

pragma solidity ^0.8.4;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/optimism/CrossChainEnabledOptimism.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/optimism/CrossChainEnabledOptimism.sol)

pragma solidity ^0.8.4;

Expand Down
2 changes: 1 addition & 1 deletion contracts/crosschain/optimism/LibOptimism.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/optimism/LibOptimism.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/optimism/LibOptimism.sol)

pragma solidity ^0.8.4;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (crosschain/polygon/CrossChainEnabledPolygonChild.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (crosschain/polygon/CrossChainEnabledPolygonChild.sol)

pragma solidity ^0.8.4;

Expand Down
5 changes: 3 additions & 2 deletions contracts/finance/PaymentSplitter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (finance/PaymentSplitter.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (finance/PaymentSplitter.sol)

pragma solidity ^0.8.0;

Expand All @@ -14,7 +14,8 @@ import "../utils/Context.sol";
*
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
* an amount proportional to the percentage of total shares they were assigned.
* an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the
* time of contract deployment and can't be updated thereafter.
*
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
Expand Down
2 changes: 1 addition & 1 deletion contracts/finance/VestingWallet.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (finance/VestingWallet.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (finance/VestingWallet.sol)
pragma solidity ^0.8.0;

import "../token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (governance/Governor.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (governance/Governor.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (governance/IGovernor.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (governance/IGovernor.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/TimelockController.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (governance/TimelockController.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (governance/TimelockController.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC3156FlashBorrower.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (interfaces/IERC3156FlashBorrower.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC4626.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (interfaces/IERC4626.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/metatx/ERC2771Context.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (metatx/ERC2771Context.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.9;

Expand Down
2 changes: 1 addition & 1 deletion contracts/metatx/MinimalForwarder.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (metatx/MinimalForwarder.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (metatx/MinimalForwarder.sol)

pragma solidity ^0.8.0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

pragma solidity ^0.8.0;

import "../token/ERC20/extensions/ERC20TokenizedVault.sol";
import "../token/ERC20/extensions/ERC4626.sol";

// mock class using ERC20
contract ERC20TokenizedVaultMock is ERC20TokenizedVault {
contract ERC4626Mock is ERC4626 {
constructor(
IERC20Metadata asset,
string memory name,
string memory symbol
) ERC20(name, symbol) ERC20TokenizedVault(asset) {}
) ERC20(name, symbol) ERC4626(asset) {}

function mockMint(address account, uint256 amount) public {
_mint(account, amount);
Expand Down
25 changes: 21 additions & 4 deletions contracts/mocks/MerkleProofWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,36 @@ contract MerkleProofWrapper {
}

function multiProofVerify(
bytes32[] memory proofs,
bool[] memory proofFlag,
bytes32 root,
bytes32[] memory leaves
) public pure returns (bool) {
return MerkleProof.multiProofVerify(proofs, proofFlag, root, leaves);
}

function multiProofVerifyCalldata(
bytes32[] calldata proofs,
bool[] calldata proofFlag,
bytes32 root,
bytes32[] calldata leaves
bytes32[] memory leaves
) public pure returns (bool) {
return MerkleProof.multiProofVerify(proofs, proofFlag, root, leaves);
return MerkleProof.multiProofVerifyCalldata(proofs, proofFlag, root, leaves);
}

function processMultiProof(
bytes32[] memory proofs,
bool[] memory proofFlag,
bytes32[] memory leaves
) public pure returns (bytes32) {
return MerkleProof.processMultiProof(proofs, proofFlag, leaves);
}

function processMultiProofCalldata(
bytes32[] calldata proofs,
bool[] calldata proofFlag,
bytes32[] calldata leaves
bytes32[] memory leaves
) public pure returns (bytes32) {
return MerkleProof.processMultiProof(proofs, proofFlag, leaves);
return MerkleProof.processMultiProofCalldata(proofs, proofFlag, leaves);
}
}
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openzeppelin/contracts-upgradeable",
"description": "Secure Smart Contract library for Solidity",
"version": "4.7.0-rc.0",
"version": "4.7.0",
"files": [
"**/*.sol",
"/build/contracts/*.json",
Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/Clones.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (proxy/Clones.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/Clones.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/ERC1967/ERC1967Proxy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (proxy/ERC1967/ERC1967Proxy.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/beacon/BeaconProxy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (proxy/beacon/BeaconProxy.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)

pragma solidity ^0.8.0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (proxy/transparent/TransparentUpgradeableProxy.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/utils/Initializable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (proxy/utils/Initializable.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

Expand Down
2 changes: 1 addition & 1 deletion contracts/security/Pausable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (security/Pausable.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/security/PullPayment.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (security/PullPayment.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (security/PullPayment.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC1155/ERC1155.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC1155/IERC1155.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC1155/IERC1155.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC1155/extensions/ERC1155Burnable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC1155/extensions/ERC1155Burnable.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC20/ERC20.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC20/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Additionally there are multiple custom extensions, including:
* {ERC20Votes}: support for voting and vote delegation.
* {ERC20VotesComp}: support for voting and vote delegation (compatible with Compound's token, with uint96 restrictions).
* {ERC20Wrapper}: wrapper to create an ERC20 backed by another ERC20, with deposit and withdraw methods. Useful in conjunction with {ERC20Votes}.
* {ERC20TokenizedVault}: tokenized vault that manages shares (represented as ERC20) that are backed by assets (another ERC20).
* {ERC4626}: tokenized vault that manages shares (represented as ERC20) that are backed by assets (another ERC20).
Finally, there are some utilities to interact with ERC20 contracts in various ways.

Expand Down Expand Up @@ -63,7 +63,7 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel

{{ERC20FlashMint}}

{{ERC20TokenizedVault}}
{{ERC4626}}

== Draft EIPs

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/extensions/ERC20FlashMint.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC20/extensions/ERC20FlashMint.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20FlashMint.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/extensions/ERC20Snapshot.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0-rc.0) (token/ERC20/extensions/ERC20Snapshot.sol)
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)

pragma solidity ^0.8.0;

Expand Down
Loading

0 comments on commit ec1fcdd

Please sign in to comment.