Skip to content

Commit

Permalink
refactor: Remove unnecessary comments and update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgonzalezra committed May 20, 2024
1 parent c807957 commit b0779f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/SimpleGuardianModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.25;

import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
// import { console2 } from "forge-std/src/console2.sol";

abstract contract SimpleGuardianModule {
using ECDSA for bytes32;
Expand Down
19 changes: 11 additions & 8 deletions src/SimplePlusAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { IERC1271 } from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; // TODO: use upgradable version
import { SimpleGuardianModule } from "./SimpleGuardianModule.sol";
// import { console2 } from "forge-std/src/console2.sol";

contract SimplePlusAccount is SimpleAccount, SimpleGuardianModule, IERC1271, EIP712 {
using ECDSA for bytes32;
Expand Down Expand Up @@ -41,20 +40,24 @@ contract SimplePlusAccount is SimpleAccount, SimpleGuardianModule, IERC1271, EIP
_initialize(anOwner);
}

/// @dev Revert if the caller is not any of:
/// 1. The entry point
/// 2. The account itself (when redirected through `execute`, etc.)
/// 3. An owner
/**
* @dev Revert if the caller is not any of:
* 1. The entry point
* 2. The account itself (when redirected through `execute`, etc.)
* 3. An owner
*/
function _onlyAuthorized() internal view virtual override returns (bool) {
if (msg.sender != address(entryPoint()) && msg.sender != address(this) && msg.sender != owner) {
revert NotAuthorized();
}
return true;
}

/// @notice Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current
/// owner or from the entry point via a user operation signed by the current owner.
/// @param newOwner The new owner.
/**
* @notice Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current
* owner or from the entry point via a user operation signed by the current owner.
* @param newOwner The new owner.
*/
function transferOwnership(address newOwner) public {
_onlyAuthorized();
if (newOwner == address(0) || newOwner == address(this) || owner == newOwner) {
Expand Down
1 change: 0 additions & 1 deletion test/SimplePlusAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { SimpleAccount } from "@account-abstraction/contracts/samples/SimpleAcco
import { AccountTest } from "./AccountTest.sol";
import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import { SimpleGuardianModule } from "../src/SimpleGuardianModule.sol";
// import { console2 } from "forge-std/src/console2.sol";

contract SimplePlusAccountTest is AccountTest {
uint256 public constant EOA_PRIVATE_KEY = 1;
Expand Down

0 comments on commit b0779f1

Please sign in to comment.