From 744cc38c4e82019855813624881fec61c39080a0 Mon Sep 17 00:00:00 2001 From: DiRaiks Date: Wed, 25 Dec 2024 11:36:22 +0300 Subject: [PATCH] fix: update isOwner method --- contracts/0.8.25/vaults/VaultHubViewerV1.sol | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contracts/0.8.25/vaults/VaultHubViewerV1.sol b/contracts/0.8.25/vaults/VaultHubViewerV1.sol index ea05057d9..f85057185 100644 --- a/contracts/0.8.25/vaults/VaultHubViewerV1.sol +++ b/contracts/0.8.25/vaults/VaultHubViewerV1.sol @@ -30,6 +30,9 @@ contract VaultHubViewerV1 { vaultHub = IVaultHub(_vaultHubAddress); } + /// @notice Checks if a given address is a contract + /// @param account The address to check + /// @return True if the address is a contract, false otherwise function isContract(address account) public view returns (bool) { uint256 size; assembly { @@ -47,14 +50,13 @@ contract VaultHubViewerV1 { if (currentOwner == _owner) { return true; } - if (isContract(currentOwner)) { - try IDashboardACL(currentOwner).hasRole(DEFAULT_ADMIN_ROLE, _owner) returns (bool result) { - return result; - } catch { - return false; - } + if (!isContract(currentOwner)) return false; + + try IDashboardACL(currentOwner).hasRole(DEFAULT_ADMIN_ROLE, _owner) returns (bool result) { + return result; + } catch { + return false; } - return false; } /// @notice Checks if a given address has a given role on a vault