From f2835dd1b2b7d3aa571785c4c0d0f9a06454a0e3 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 24 Oct 2024 11:31:29 +0800 Subject: [PATCH 1/3] Update LibAddress.sol --- .../protocol/contracts/shared/common/LibAddress.sol | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/protocol/contracts/shared/common/LibAddress.sol b/packages/protocol/contracts/shared/common/LibAddress.sol index f79bad2610b..7d2d17c6827 100644 --- a/packages/protocol/contracts/shared/common/LibAddress.sol +++ b/packages/protocol/contracts/shared/common/LibAddress.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/interfaces/IERC1271.sol"; @@ -74,10 +73,12 @@ library LibAddress { view returns (bool result_) { - if (!Address.isContract(_addr)) return false; - - try IERC165(_addr).supportsInterface(_interfaceId) returns (bool _result) { - result_ = _result; - } catch { } + (bool success, bytes memory data) = + _addr.staticcall(abi.encodeCall(IERC165.supportsInterface, (_interfaceId))); + if (success && data.length == 32) { + result_ = abi.decode(data, (bool)); + } else { + result_ = false; + } } } From 7fb4b2a8590ec075361001205b660a2f13d9f833 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 24 Oct 2024 11:32:40 +0800 Subject: [PATCH 2/3] Update LibAddress.sol --- packages/protocol/contracts/shared/common/LibAddress.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/protocol/contracts/shared/common/LibAddress.sol b/packages/protocol/contracts/shared/common/LibAddress.sol index 7d2d17c6827..5a6547e19ca 100644 --- a/packages/protocol/contracts/shared/common/LibAddress.sol +++ b/packages/protocol/contracts/shared/common/LibAddress.sol @@ -77,8 +77,6 @@ library LibAddress { _addr.staticcall(abi.encodeCall(IERC165.supportsInterface, (_interfaceId))); if (success && data.length == 32) { result_ = abi.decode(data, (bool)); - } else { - result_ = false; } } } From 38077c72c0b28309a76b67e035eda0641256e1d8 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 24 Oct 2024 11:59:53 +0800 Subject: [PATCH 3/3] Update LibAddress.sol --- packages/protocol/contracts/shared/common/LibAddress.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/protocol/contracts/shared/common/LibAddress.sol b/packages/protocol/contracts/shared/common/LibAddress.sol index 5a6547e19ca..6e14eddfff7 100644 --- a/packages/protocol/contracts/shared/common/LibAddress.sol +++ b/packages/protocol/contracts/shared/common/LibAddress.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.24; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; -import "@openzeppelin/contracts/interfaces/IERC1271.sol"; /// @title LibAddress /// @dev Provides utilities for address-related operations.