From 266fcde9f776af63ecf55b973ba9c7e855d9515a Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Fri, 26 May 2023 17:09:18 -0700 Subject: [PATCH] make modifiers virtual and return result from internal _call function --- contracts/smart-wallet/non-upgradeable/Account.sol | 7 ++++--- contracts/smart-wallet/utils/AccountExtension.sol | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contracts/smart-wallet/non-upgradeable/Account.sol b/contracts/smart-wallet/non-upgradeable/Account.sol index 39fcfb233..dd494c345 100644 --- a/contracts/smart-wallet/non-upgradeable/Account.sol +++ b/contracts/smart-wallet/non-upgradeable/Account.sol @@ -73,7 +73,7 @@ contract Account is } /// @notice Checks whether the caller is the EntryPoint contract or the admin. - modifier onlyAdminOrEntrypoint() { + modifier onlyAdminOrEntrypoint() virtual { require( msg.sender == address(entryPoint()) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Account: not admin or EntryPoint." @@ -170,8 +170,9 @@ contract Account is address _target, uint256 value, bytes memory _calldata - ) internal virtual { - (bool success, bytes memory result) = _target.call{ value: value }(_calldata); + ) internal virtual returns (bytes memory result) { + bool success; + (success, result) = _target.call{ value: value }(_calldata); if (!success) { assembly { revert(add(result, 32), mload(result)) diff --git a/contracts/smart-wallet/utils/AccountExtension.sol b/contracts/smart-wallet/utils/AccountExtension.sol index d1660de66..98bbfdc3c 100644 --- a/contracts/smart-wallet/utils/AccountExtension.sol +++ b/contracts/smart-wallet/utils/AccountExtension.sol @@ -53,7 +53,7 @@ contract AccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Hold } /// @notice Checks whether the caller is the EntryPoint contract or the admin. - modifier onlyAdminOrEntrypoint() { + modifier onlyAdminOrEntrypoint() virtual { require( msg.sender == entrypointContract || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Account: not admin or EntryPoint." @@ -107,8 +107,9 @@ contract AccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Hold address _target, uint256 value, bytes memory _calldata - ) internal { - (bool success, bytes memory result) = _target.call{ value: value }(_calldata); + ) internal virtual returns (bytes memory result) { + bool success; + (success, result) = _target.call{ value: value }(_calldata); if (!success) { assembly { revert(add(result, 32), mload(result))