From 610dc9563104f237e754095e8523194f18a83f16 Mon Sep 17 00:00:00 2001 From: Wyatt West <> Date: Sat, 6 Jan 2024 23:51:51 -0300 Subject: [PATCH 1/2] This is a fix that updates the LayerZero/solidity-examples code to be compatible to the OpenZeppelin V5 update regarding the Ownable class inheritance. --- contracts/lzApp/LzApp.sol | 2 +- contracts/token/oft/v2/fee/Fee.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/lzApp/LzApp.sol b/contracts/lzApp/LzApp.sol index a922e9d9..98a8a355 100644 --- a/contracts/lzApp/LzApp.sol +++ b/contracts/lzApp/LzApp.sol @@ -28,7 +28,7 @@ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicatio event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); - constructor(address _endpoint) { + constructor(address _endpoint) Ownable(_msgSender()){ lzEndpoint = ILayerZeroEndpoint(_endpoint); } diff --git a/contracts/token/oft/v2/fee/Fee.sol b/contracts/token/oft/v2/fee/Fee.sol index c44e819f..a9733e75 100644 --- a/contracts/token/oft/v2/fee/Fee.sol +++ b/contracts/token/oft/v2/fee/Fee.sol @@ -20,7 +20,7 @@ abstract contract Fee is Ownable { event SetDefaultFeeBp(uint16 feeBp); event SetFeeOwner(address feeOwner); - constructor(){ + constructor() Ownable(_msgSender()){ feeOwner = owner(); } From 20311f2c78f753ed0510ec37c7977f634acc4cb5 Mon Sep 17 00:00:00 2001 From: Wyatt West <> Date: Sun, 7 Jan 2024 01:54:30 -0300 Subject: [PATCH 2/2] This fixes all remaining contracts to be compactible with the OpenZeppelin V5 update. --- contracts/token/oft/v1/NativeOFT.sol | 2 +- contracts/token/oft/v2/NativeOFTV2.sol | 2 +- contracts/token/oft/v2/fee/NativeOFTWithFee.sol | 2 +- contracts/token/onft721/ONFT721Core.sol | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/token/oft/v1/NativeOFT.sol b/contracts/token/oft/v1/NativeOFT.sol index ce6be21b..697d303f 100644 --- a/contracts/token/oft/v1/NativeOFT.sol +++ b/contracts/token/oft/v1/NativeOFT.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./OFT.sol"; contract NativeOFT is OFT, ReentrancyGuard { diff --git a/contracts/token/oft/v2/NativeOFTV2.sol b/contracts/token/oft/v2/NativeOFTV2.sol index 9e84fab3..23dd393d 100644 --- a/contracts/token/oft/v2/NativeOFTV2.sol +++ b/contracts/token/oft/v2/NativeOFTV2.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./OFTV2.sol"; contract NativeOFTV2 is OFTV2, ReentrancyGuard { diff --git a/contracts/token/oft/v2/fee/NativeOFTWithFee.sol b/contracts/token/oft/v2/fee/NativeOFTWithFee.sol index a0970075..8888f174 100644 --- a/contracts/token/oft/v2/fee/NativeOFTWithFee.sol +++ b/contracts/token/oft/v2/fee/NativeOFTWithFee.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./OFTWithFee.sol"; contract NativeOFTWithFee is OFTWithFee, ReentrancyGuard { diff --git a/contracts/token/onft721/ONFT721Core.sol b/contracts/token/onft721/ONFT721Core.sol index 8698dfb8..bee407e1 100644 --- a/contracts/token/onft721/ONFT721Core.sol +++ b/contracts/token/onft721/ONFT721Core.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import "./interfaces/IONFT721Core.sol"; import "../../lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; -import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; abstract contract ONFT721Core is NonblockingLzApp, ERC165, ReentrancyGuard, IONFT721Core { uint16 public constant FUNCTION_TYPE_SEND = 1;