Skip to content

Commit

Permalink
make modifiers virtual and return result from internal _call function
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges committed May 27, 2023
1 parent 7825602 commit 266fcde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions contracts/smart-wallet/non-upgradeable/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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))
Expand Down
7 changes: 4 additions & 3 deletions contracts/smart-wallet/utils/AccountExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 266fcde

Please sign in to comment.