Skip to content

Commit

Permalink
Merge branch 'master' into fix/erc3156-flash-loans-extension-improvem…
Browse files Browse the repository at this point in the history
…ent-#3316
  • Loading branch information
frangio committed May 6, 2022
2 parents ca60378 + 07b1b47 commit cce801e
Show file tree
Hide file tree
Showing 89 changed files with 1,234 additions and 1,189 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
@@ -1,12 +1,13 @@
# Changelog

## Unreleased
* `ERC2981`: make `royaltiInfo` public to allow super call in overrides. ([#3305](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3305))

* `Clones`: optimize clone creation ([#3329](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3329))
* `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))

## Unreleased
## 4.6.0 (2022-04-26)

* `crosschain`: Add a new set of contracts for cross-chain applications. `CrossChainEnabled` is a base contract with instantiations for several chains and bridges, and `AccessControlCrossChain` is an extension of access control that allows cross-chain operation. ([#3183](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3183))
* `AccessControl`: add a virtual `_checkRole(bytes32)` function that can be overridden to alter the `onlyRole` modifier behavior. ([#3137](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3137))
Expand All @@ -27,6 +28,11 @@
* `TimelockController`: Add a separate canceller role for the ability to cancel. ([#3165](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3165))
* `Initializable`: add a reinitializer modifier that enables the initialization of new modules, added to already initialized contracts through upgradeability. ([#3232](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3232))
* `Initializable`: add an Initialized event that tracks initialized version numbers. ([#3294](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3294))
* `ERC2981`: make `royaltyInfo` public to allow super call in overrides. ([#3305](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3305))

### Upgradeability notice

* `TimelockController`: **(Action needed)** The upgrade from <4.6 to >=4.6 introduces a new `CANCELLER_ROLE` that requires set up to be assignable. After the upgrade, only addresses with this role will have the ability to cancel. Proposers will no longer be able to cancel. Assigning cancellers can be done by an admin (including the timelock itself) once the role admin is set up. To do this, we recommend upgrading to the `TimelockControllerWith46MigrationUpgradeable` contract and then calling the `migrateTo46` function.

### Breaking changes

Expand Down
2 changes: 1 addition & 1 deletion contracts/access/AccessControl.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

Expand Down
1 change: 1 addition & 0 deletions contracts/access/AccessControlCrossChain.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControlCrossChain.sol)

pragma solidity ^0.8.4;

Expand Down
1 change: 1 addition & 0 deletions contracts/crosschain/CrossChainEnabled.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/CrossChainEnabled.sol)

pragma solidity ^0.8.4;

Expand Down
22 changes: 12 additions & 10 deletions contracts/crosschain/amb/CrossChainEnabledAMB.sol
@@ -1,24 +1,26 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/CrossChainEnabledAMB.sol)

pragma solidity ^0.8.4;

import "../CrossChainEnabled.sol";
import "./LibAMB.sol";

/**
* @dev [AMB](https://docs.tokenbridge.net/amb-bridge/about-amb-bridge)
* @dev https://docs.tokenbridge.net/amb-bridge/about-amb-bridge[AMB]
* specialization or the {CrossChainEnabled} abstraction.
*
* As of february 2020, AMB bridges are available between the following chains:
* - [ETH <> xDai](https://docs.tokenbridge.net/eth-xdai-amb-bridge/about-the-eth-xdai-amb)
* - [ETH <> qDai](https://docs.tokenbridge.net/eth-qdai-bridge/about-the-eth-qdai-amb)
* - [ETH <> ETC](https://docs.tokenbridge.net/eth-etc-amb-bridge/about-the-eth-etc-amb)
* - [ETH <> BSC](https://docs.tokenbridge.net/eth-bsc-amb/about-the-eth-bsc-amb)
* - [ETH <> POA](https://docs.tokenbridge.net/eth-poa-amb-bridge/about-the-eth-poa-amb)
* - [BSC <> xDai](https://docs.tokenbridge.net/bsc-xdai-amb/about-the-bsc-xdai-amb)
* - [POA <> xDai](https://docs.tokenbridge.net/poa-xdai-amb/about-the-poa-xdai-amb)
* - [Rinkeby <> xDai](https://docs.tokenbridge.net/rinkeby-xdai-amb-bridge/about-the-rinkeby-xdai-amb)
* - [Kovan <> Sokol](https://docs.tokenbridge.net/kovan-sokol-amb-bridge/about-the-kovan-sokol-amb)
*
* - https://docs.tokenbridge.net/eth-xdai-amb-bridge/about-the-eth-xdai-amb[ETH ⇌ xDai]
* - https://docs.tokenbridge.net/eth-qdai-bridge/about-the-eth-qdai-amb[ETH ⇌ qDai]
* - https://docs.tokenbridge.net/eth-etc-amb-bridge/about-the-eth-etc-amb[ETH ⇌ ETC]
* - https://docs.tokenbridge.net/eth-bsc-amb/about-the-eth-bsc-amb[ETH ⇌ BSC]
* - https://docs.tokenbridge.net/eth-poa-amb-bridge/about-the-eth-poa-amb[ETH ⇌ POA]
* - https://docs.tokenbridge.net/bsc-xdai-amb/about-the-bsc-xdai-amb[BSC ⇌ xDai]
* - https://docs.tokenbridge.net/poa-xdai-amb/about-the-poa-xdai-amb[POA ⇌ xDai]
* - https://docs.tokenbridge.net/rinkeby-xdai-amb-bridge/about-the-rinkeby-xdai-amb[Rinkeby ⇌ xDai]
* - https://docs.tokenbridge.net/kovan-sokol-amb-bridge/about-the-kovan-sokol-amb[Kovan ⇌ Sokol]
*
* _Available since v4.6._
*/
Expand Down
3 changes: 2 additions & 1 deletion contracts/crosschain/amb/LibAMB.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/amb/LibAMB.sol)

pragma solidity ^0.8.4;

Expand All @@ -7,7 +8,7 @@ import "../errors.sol";

/**
* @dev Primitives for cross-chain aware contracts using the
* [AMB](https://docs.tokenbridge.net/amb-bridge/about-amb-bridge)
* https://docs.tokenbridge.net/amb-bridge/about-amb-bridge[AMB]
* family of bridges.
*/
library LibAMB {
Expand Down
5 changes: 3 additions & 2 deletions contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol
@@ -1,20 +1,21 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol)

pragma solidity ^0.8.4;

import "../CrossChainEnabled.sol";
import "./LibArbitrumL1.sol";

/**
* @dev [Arbitrum](https://arbitrum.io/) specialization or the
* @dev https://arbitrum.io/[Arbitrum] specialization or the
* {CrossChainEnabled} abstraction the L1 side (mainnet).
*
* This version should only be deployed on L1 to process cross-chain messages
* originating from L2. For the other side, use {CrossChainEnabledArbitrumL2}.
*
* The bridge contract is provided and maintained by the arbitrum team. You can
* find the address of this contract on the rinkeby testnet in
* [Arbitrum's developer documentation](https://developer.offchainlabs.com/docs/useful_addresses).
* https://developer.offchainlabs.com/docs/useful_addresses[Arbitrum's developer documentation].
*
* _Available since v4.6._
*/
Expand Down
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol)

pragma solidity ^0.8.4;

import "../CrossChainEnabled.sol";
import "./LibArbitrumL2.sol";

/**
* @dev [Arbitrum](https://arbitrum.io/) specialization or the
* @dev https://arbitrum.io/[Arbitrum] specialization or the
* {CrossChainEnabled} abstraction the L2 side (arbitrum).
*
* This version should only be deployed on L2 to process cross-chain messages
Expand Down
3 changes: 2 additions & 1 deletion contracts/crosschain/arbitrum/LibArbitrumL1.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/LibArbitrumL1.sol)

pragma solidity ^0.8.4;

Expand All @@ -9,7 +10,7 @@ import "../errors.sol";

/**
* @dev Primitives for cross-chain aware contracts for
* [Arbitrum](https://arbitrum.io/).
* https://arbitrum.io/[Arbitrum].
*
* This version should only be used on L1 to process cross-chain messages
* originating from L2. For the other side, use {LibArbitrumL2}.
Expand Down
3 changes: 2 additions & 1 deletion contracts/crosschain/arbitrum/LibArbitrumL2.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/arbitrum/LibArbitrumL2.sol)

pragma solidity ^0.8.4;

Expand All @@ -7,7 +8,7 @@ import "../errors.sol";

/**
* @dev Primitives for cross-chain aware contracts for
* [Arbitrum](https://arbitrum.io/).
* https://arbitrum.io/[Arbitrum].
*
* This version should only be used on L2 to process cross-chain messages
* originating from L1. For the other side, use {LibArbitrumL1}.
Expand Down
1 change: 1 addition & 0 deletions contracts/crosschain/errors.sol
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/errors.sol)

pragma solidity ^0.8.4;

Expand Down
5 changes: 3 additions & 2 deletions contracts/crosschain/optimism/CrossChainEnabledOptimism.sol
@@ -1,17 +1,18 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/optimism/CrossChainEnabledOptimism.sol)

pragma solidity ^0.8.4;

import "../CrossChainEnabled.sol";
import "./LibOptimism.sol";

/**
* @dev [Optimism](https://www.optimism.io/) specialization or the
* @dev https://www.optimism.io/[Optimism] specialization or the
* {CrossChainEnabled} abstraction.
*
* The messenger (`CrossDomainMessenger`) contract is provided and maintained by
* the optimism team. You can find the address of this contract on mainnet and
* kovan in the [deployments section of Optimism monorepo](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/deployments).
* kovan in the https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/deployments[deployments section of Optimism monorepo].
*
* _Available since v4.6._
*/
Expand Down
5 changes: 3 additions & 2 deletions contracts/crosschain/optimism/LibOptimism.sol
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/optimism/LibOptimism.sol)

pragma solidity ^0.8.4;

import {ICrossDomainMessenger as Optimism_Bridge} from "../../vendor/optimism/ICrossDomainMessenger.sol";
import "../errors.sol";

/**
* @dev Primitives for cross-chain aware contracts for [Optimism](https://www.optimism.io/).
* See the [documentation](https://community.optimism.io/docs/developers/bridge/messaging/#accessing-msg-sender)
* @dev Primitives for cross-chain aware contracts for https://www.optimism.io/[Optimism].
* See the https://community.optimism.io/docs/developers/bridge/messaging/#accessing-msg-sender[documentation]
* for the functionality used here.
*/
library LibOptimism {
Expand Down
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (crosschain/polygon/CrossChainEnabledPolygonChild.sol)

pragma solidity ^0.8.4;

Expand All @@ -10,15 +11,15 @@ import "../../vendor/polygon/IFxMessageProcessor.sol";
address constant DEFAULT_SENDER = 0x000000000000000000000000000000000000dEaD;

/**
* @dev [Polygon](https://polygon.technology/) specialization or the
* @dev https://polygon.technology/[Polygon] specialization or the
* {CrossChainEnabled} abstraction the child side (polygon/mumbai).
*
* This version should only be deployed on child chain to process cross-chain
* messages originating from the parent chain.
*
* The fxChild contract is provided and maintained by the polygon team. You can
* find the address of this contract polygon and mumbai in
* [Polygon's Fx-Portal documentation](https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/#contract-addresses).
* https://docs.polygon.technology/docs/develop/l1-l2-communication/fx-portal/#contract-addresses[Polygon's Fx-Portal documentation].
*
* _Available since v4.6._
*/
Expand Down Expand Up @@ -62,10 +63,10 @@ abstract contract CrossChainEnabledPolygonChild is IFxMessageProcessor, CrossCha
address rootMessageSender,
bytes calldata data
) external override nonReentrant {
require(msg.sender == _fxChild, "unauthorized cross-chain relay");
if (!_isCrossChain()) revert NotCrossChainCall();

_sender = rootMessageSender;
Address.functionDelegateCall(address(this), data, "crosschain execution failled");
Address.functionDelegateCall(address(this), data, "cross-chain execution failed");
_sender = DEFAULT_SENDER;
}
}
6 changes: 3 additions & 3 deletions contracts/finance/VestingWallet.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (finance/VestingWallet.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (finance/VestingWallet.sol)
pragma solidity ^0.8.0;

import "../token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -84,7 +84,7 @@ contract VestingWallet is Context {
/**
* @dev Release the native token (ether) that have already vested.
*
* Emits a {TokensReleased} event.
* Emits a {EtherReleased} event.
*/
function release() public virtual {
uint256 releasable = vestedAmount(uint64(block.timestamp)) - released();
Expand All @@ -96,7 +96,7 @@ contract VestingWallet is Context {
/**
* @dev Release the tokens that have already vested.
*
* Emits a {TokensReleased} event.
* Emits a {ERC20Released} event.
*/
function release(address token) public virtual {
uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token);
Expand Down
4 changes: 2 additions & 2 deletions contracts/governance/Governor.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/Governor.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/Governor.sol)

pragma solidity ^0.8.0;

Expand Down Expand Up @@ -217,7 +217,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive
) internal view virtual returns (uint256);

/**
* @dev Register a vote with a given support and voting weight.
* @dev Register a vote for `proposalId` by `account` with a given `support`, voting `weight` and voting `params`.
*
* Note: Support is generic and can represent various things depending on the voting system used.
*/
Expand Down
6 changes: 3 additions & 3 deletions contracts/governance/IGovernor.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/IGovernor.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/IGovernor.sol)

pragma solidity ^0.8.0;

Expand Down Expand Up @@ -237,7 +237,7 @@ abstract contract IGovernor is IERC165 {
/**
* @dev Cast a vote with a reason and additional encoded parameters
*
* Emits a {VoteCast} event.
* Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
*/
function castVoteWithReasonAndParams(
uint256 proposalId,
Expand All @@ -262,7 +262,7 @@ abstract contract IGovernor is IERC165 {
/**
* @dev Cast a vote with a reason and additional encoded parameters using the user's cryptographic signature.
*
* Emits a {VoteCast} event.
* Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
*/
function castVoteWithReasonAndParamsBySig(
uint256 proposalId,
Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/TimelockController.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (governance/TimelockController.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/TimelockController.sol)

pragma solidity ^0.8.0;

Expand Down
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/compatibility/GovernorCompatibilityBravo.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/compatibility/GovernorCompatibilityBravo.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/GovernorCountingSimple.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorCountingSimple.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorCountingSimple.sol)

pragma solidity ^0.8.0;

Expand Down
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorPreventLateQuorum.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorPreventLateQuorum.sol)

pragma solidity ^0.8.0;

Expand Down
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorTimelockCompound.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorTimelockCompound.sol)

pragma solidity ^0.8.0;

Expand Down
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorTimelockControl.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorTimelockControl.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/GovernorVotes.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/extensions/GovernorVotes.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotes.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/extensions/GovernorVotesComp.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorVotesComp.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotesComp.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance/utils/Votes.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/Votes.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (governance/utils/Votes.sol)
pragma solidity ^0.8.0;

import "../../utils/Context.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC2981.sol
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC3156FlashBorrower.sol
Expand Up @@ -17,7 +17,7 @@ interface IERC3156FlashBorrower {
* @param amount The amount of tokens lent.
* @param fee The additional amount of tokens to repay.
* @param data Arbitrary data structure, intended to contain user-defined parameters.
* @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"
* @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan"
*/
function onFlashLoan(
address initiator,
Expand Down

0 comments on commit cce801e

Please sign in to comment.