Skip to content

Commit f6bd400

Browse files
authored
feat: OpenZeppelin V5 upgrade (#1175)
* feat: OpenZeppelin V5 upgrade Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Removed unused uma contracts Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * pinned foundry/hardhat versions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * downgraded to 0.8.24 Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
1 parent 4f12977 commit f6bd400

File tree

113 files changed

+2565
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2565
-535
lines changed

contracts/AcrossConfigStore.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.0;
33

4-
import "@uma/core/contracts/common/implementation/MultiCaller.sol";
5-
import "@openzeppelin/contracts/access/Ownable.sol";
4+
import "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
5+
import "@openzeppelin/contracts-v4/access/Ownable.sol";
66

77
/**
88
* @title Allows admin to set and update configuration settings for full contract system. These settings are designed

contracts/AdapterStore.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.18;
33

4-
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
4+
import { Ownable } from "@openzeppelin/contracts-v4/access/Ownable.sol";
55
import { IOFT } from "./interfaces/IOFT.sol";
66

77
/**

contracts/Blast_DaiRetriever.sol

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
33

44
import "./Lockable.sol";
55

6-
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
7-
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
8-
import "@uma/core/contracts/common/implementation/MultiCaller.sol";
6+
import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol";
7+
import "@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol";
8+
import "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
99

1010
interface USDYieldManager {
1111
function claimWithdrawal(uint256 _requestId, uint256 _hintId) external returns (bool success);
@@ -36,11 +36,7 @@ contract Blast_DaiRetriever is Lockable, MultiCaller {
3636
* @param _usdYieldManager USDCYieldManager contract on Ethereum.
3737
* @param _dai DAI token to be retrieved.
3838
*/
39-
constructor(
40-
address _hubPool,
41-
USDYieldManager _usdYieldManager,
42-
IERC20Upgradeable _dai
43-
) {
39+
constructor(address _hubPool, USDYieldManager _usdYieldManager, IERC20Upgradeable _dai) {
4440
//slither-disable-next-line missing-zero-check
4541
hubPool = _hubPool;
4642
usdYieldManager = _usdYieldManager;

contracts/BondToken.sol

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22
pragma solidity ^0.8.0;
33

4-
import "@openzeppelin/contracts/access/Ownable.sol";
5-
import "@openzeppelin/contracts/utils/Address.sol";
4+
import "@openzeppelin/contracts-v4/access/Ownable.sol";
5+
import "@openzeppelin/contracts-v4/utils/Address.sol";
66

77
import "./interfaces/HubPoolInterface.sol";
88
import "./external/WETH9.sol";
@@ -71,11 +71,7 @@ contract BondToken is WETH9, Ownable {
7171
* @param amt Amount to transfer.
7272
* @return True on success.
7373
*/
74-
function transferFrom(
75-
address src,
76-
address dst,
77-
uint256 amt
78-
) public override returns (bool) {
74+
function transferFrom(address src, address dst, uint256 amt) public override returns (bool) {
7975
if (dst == address(HUB_POOL)) {
8076
require(proposers[src] || HUB_POOL.rootBundleProposal().proposer != src, "Transfer not permitted");
8177
}

contracts/Ethereum_SpokePool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import "./SpokePool.sol";
5-
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
5+
import "@openzeppelin/contracts-upgradeable-v4/access/OwnableUpgradeable.sol";
66

77
/**
88
* @notice Ethereum L1 specific SpokePool. Used on Ethereum L1 to facilitate L2->L1 transfers.

contracts/HubPool.sol

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ import "./Lockable.sol";
88
import "./interfaces/LpTokenFactoryInterface.sol";
99
import "./external/interfaces/WETH9Interface.sol";
1010

11-
import "@uma/core/contracts/common/implementation/Testable.sol";
12-
import "@uma/core/contracts/common/implementation/MultiCaller.sol";
13-
import "@uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol";
11+
import "contracts/external/uma/core/contracts/common/implementation/Testable.sol";
12+
import "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
13+
import "contracts/external/uma/core/contracts/common/interfaces/AddressWhitelistInterface.sol";
1414

15-
import "@uma/core/contracts/data-verification-mechanism/interfaces/FinderInterface.sol";
16-
import "@uma/core/contracts/data-verification-mechanism/interfaces/IdentifierWhitelistInterface.sol";
17-
import "@uma/core/contracts/data-verification-mechanism/interfaces/StoreInterface.sol";
18-
import "@uma/core/contracts/data-verification-mechanism/implementation/Constants.sol";
15+
import "contracts/external/uma/core/contracts/data-verification-mechanism/interfaces/FinderInterface.sol";
16+
import "contracts/external/uma/core/contracts/data-verification-mechanism/interfaces/IdentifierWhitelistInterface.sol";
17+
import "contracts/external/uma/core/contracts/data-verification-mechanism/interfaces/StoreInterface.sol";
18+
import "contracts/external/uma/core/contracts/data-verification-mechanism/implementation/Constants.sol";
1919

20-
import "@uma/core/contracts/optimistic-oracle-v2/interfaces/SkinnyOptimisticOracleInterface.sol";
21-
import "@uma/core/contracts/common/interfaces/ExpandedIERC20.sol";
20+
import "contracts/external/uma/core/contracts/optimistic-oracle-v2/interfaces/SkinnyOptimisticOracleInterface.sol";
21+
import "contracts/external/uma/core/contracts/common/interfaces/ExpandedIERC20.sol";
2222

23-
import "@openzeppelin/contracts/access/Ownable.sol";
24-
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
25-
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
26-
import "@openzeppelin/contracts/utils/Address.sol";
23+
import "@openzeppelin/contracts-v4/access/Ownable.sol";
24+
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
25+
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
26+
import "@openzeppelin/contracts-v4/utils/Address.sol";
2727

2828
/**
2929
* @notice Contract deployed on Ethereum that houses L1 token liquidity for all SpokePools. A dataworker can interact
@@ -246,12 +246,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
246246
* @param chainId Chain with SpokePool to send message to.
247247
* @param functionData ABI encoded function call to send to SpokePool, but can be any arbitrary data technically.
248248
*/
249-
function relaySpokePoolAdminFunction(uint256 chainId, bytes memory functionData)
250-
public
251-
override
252-
onlyOwner
253-
nonReentrant
254-
{
249+
function relaySpokePoolAdminFunction(
250+
uint256 chainId,
251+
bytes memory functionData
252+
) public override onlyOwner nonReentrant {
255253
_relaySpokePoolAdminFunction(chainId, functionData);
256254
}
257255

@@ -260,12 +258,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
260258
* @param newProtocolFeeCaptureAddress New protocol fee capture address.
261259
* @param newProtocolFeeCapturePct New protocol fee capture %.
262260
*/
263-
function setProtocolFeeCapture(address newProtocolFeeCaptureAddress, uint256 newProtocolFeeCapturePct)
264-
public
265-
override
266-
onlyOwner
267-
nonReentrant
268-
{
261+
function setProtocolFeeCapture(
262+
address newProtocolFeeCaptureAddress,
263+
uint256 newProtocolFeeCapturePct
264+
) public override onlyOwner nonReentrant {
269265
require(newProtocolFeeCapturePct <= 1e18, "Bad protocolFeeCapturePct");
270266
require(newProtocolFeeCaptureAddress != address(0), "Bad protocolFeeCaptureAddress");
271267
protocolFeeCaptureAddress = newProtocolFeeCaptureAddress;
@@ -278,13 +274,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
278274
* @param newBondToken New bond currency.
279275
* @param newBondAmount New bond amount.
280276
*/
281-
function setBond(IERC20 newBondToken, uint256 newBondAmount)
282-
public
283-
override
284-
onlyOwner
285-
noActiveRequests
286-
nonReentrant
287-
{
277+
function setBond(
278+
IERC20 newBondToken,
279+
uint256 newBondAmount
280+
) public override onlyOwner noActiveRequests nonReentrant {
288281
// Bond should not equal final fee otherwise every proposal will get cancelled in a dispute.
289282
// In practice we expect that bond amounts are set >> final fees so this shouldn't be an inconvenience.
290283
// The only way for the bond amount to be equal to the final fee is if the newBondAmount == 0.
@@ -527,11 +520,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
527520
* @param relayedAmount The higher this amount, the higher the utilization.
528521
* @return % of liquid reserves currently being "used" and sitting in SpokePools plus the relayedAmount.
529522
*/
530-
function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount)
531-
public
532-
nonReentrant
533-
returns (uint256)
534-
{
523+
function liquidityUtilizationPostRelay(
524+
address l1Token,
525+
uint256 relayedAmount
526+
) public nonReentrant returns (uint256) {
535527
return _liquidityUtilizationPostRelay(l1Token, relayedAmount);
536528
}
537529

@@ -826,12 +818,10 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
826818
* @return destinationToken address The destination token that is sent to spoke pools after this contract bridges
827819
* the l1Token to the destination chain.
828820
*/
829-
function poolRebalanceRoute(uint256 destinationChainId, address l1Token)
830-
external
831-
view
832-
override
833-
returns (address destinationToken)
834-
{
821+
function poolRebalanceRoute(
822+
uint256 destinationChainId,
823+
address l1Token
824+
) external view override returns (address destinationToken) {
835825
return poolRebalanceRoutes[_poolRebalanceRouteKey(l1Token, destinationChainId)];
836826
}
837827

@@ -1043,11 +1033,9 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable {
10431033
return keccak256(abi.encode(l1Token, destinationChainId));
10441034
}
10451035

1046-
function _getInitializedCrossChainContracts(uint256 chainId)
1047-
internal
1048-
view
1049-
returns (address adapter, address spokePool)
1050-
{
1036+
function _getInitializedCrossChainContracts(
1037+
uint256 chainId
1038+
) internal view returns (address adapter, address spokePool) {
10511039
adapter = crossChainContracts[chainId].adapter;
10521040
spokePool = crossChainContracts[chainId].spokePool;
10531041
require(spokePool != address(0), "SpokePool not initialized");

contracts/Linea_SpokePool.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ pragma solidity ^0.8.19;
77
import "./SpokePool.sol";
88
import "./libraries/CircleCCTPAdapter.sol";
99
import { IMessageService, ITokenBridge, IUSDCBridge } from "./external/interfaces/LineaInterfaces.sol";
10-
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
11-
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10+
import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
11+
import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
1212

1313
/**
1414
* @notice Linea specific SpokePool.

contracts/LpTokenFactory.sol

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity ^0.8.0;
33

44
import "./interfaces/LpTokenFactoryInterface.sol";
55

6-
import "@uma/core/contracts/common/implementation/ExpandedERC20.sol";
6+
import "contracts/external/uma/core/contracts/common/implementation/ExpandedERC20.sol";
77

88
/**
99
* @notice Factory to create new LP ERC20 tokens that represent a liquidity provider's position. HubPool is the
@@ -30,11 +30,7 @@ contract LpTokenFactory is LpTokenFactoryInterface {
3030
return address(lpToken);
3131
}
3232

33-
function _concatenate(
34-
string memory a,
35-
string memory b,
36-
string memory c
37-
) internal pure returns (string memory) {
33+
function _concatenate(string memory a, string memory b, string memory c) internal pure returns (string memory) {
3834
return string(abi.encodePacked(a, b, c));
3935
}
4036
}

contracts/MerkleLib.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "./interfaces/SpokePoolInterface.sol";
55
import "./interfaces/V3SpokePoolInterface.sol";
66
import "./interfaces/HubPoolInterface.sol";
77

8-
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
8+
import "@openzeppelin/contracts-v4/utils/cryptography/MerkleProof.sol";
99

1010
/**
1111
* @notice Library to help with merkle roots, proofs, and claims.

contracts/Ovm_SpokePool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "./SpokePool.sol";
55
import "./external/interfaces/WETH9Interface.sol";
66
import "./libraries/CircleCCTPAdapter.sol";
77

8-
import "@openzeppelin/contracts-upgradeable/crosschain/optimism/LibOptimismUpgradeable.sol";
8+
import "@openzeppelin/contracts-upgradeable-v4/crosschain/optimism/LibOptimismUpgradeable.sol";
99
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
1010

1111
// https://github.com/ethereum-optimism/optimism/blob/bf51c4935261634120f31827c3910aa631f6bf9c/packages/contracts-bedrock/contracts/L2/L2StandardBridge.sol

0 commit comments

Comments
 (0)