Skip to content

Commit

Permalink
chore: organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
huaweigu committed Sep 13, 2024
1 parent 2b20be5 commit 77ee743
Show file tree
Hide file tree
Showing 129 changed files with 991 additions and 850 deletions.
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ depth = 15
[fmt]
line_length = 120
wrap_comments = true
sort_imports = true
2 changes: 1 addition & 1 deletion script/001_DeployPluginManager.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {console, Script} from "forge-std/src/Script.sol";
import {PluginManager} from "../src/msca/6900/v0.7/managers/PluginManager.sol";
import {Script, console} from "forge-std/src/Script.sol";

contract DeployPluginManagerScript is Script {
address constant EXPECTED_PLUGIN_MANAGER = address(0x5c2099d54979B1F4c84eB5d3fc50041a78aE4E15);
Expand Down
2 changes: 1 addition & 1 deletion script/002_DeployUpgradableMSCAFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {console, Script} from "forge-std/src/Script.sol";
import {UpgradableMSCAFactory} from "../src/msca/6900/v0.7/factories/UpgradableMSCAFactory.sol";
import {Script, console} from "forge-std/src/Script.sol";

contract DeployUpgradableMSCAFactoryScript is Script {
address constant PLUGIN_MANAGER = 0x5c2099d54979B1F4c84eB5d3fc50041a78aE4E15;
Expand Down
2 changes: 1 addition & 1 deletion script/003_DeploySingleOwnerMSCAFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import "forge-std/src/Script.sol";
import "../src/msca/6900/v0.7/factories/semi/SingleOwnerMSCAFactory.sol";
import "forge-std/src/Script.sol";

contract DeploySingleOwnerMSCAFactoryScript is Script {
address constant PLUGIN_MANAGER = 0xc751A2bFA2A4a5b27E94ad735534c16a0999d871;
Expand Down
2 changes: 1 addition & 1 deletion script/004_DeploySingleOwnerPlugin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import "forge-std/src/Script.sol";
import "../src/msca/6900/v0.7/plugins/v1_0_0/acl/SingleOwnerPlugin.sol";
import "forge-std/src/Script.sol";

contract DeploySingleOwnerPluginScript is Script {
address payable constant EXPECTED_PLUGIN_ADDRESS = payable(address(0xFfC2440999EF1F84089Ca1418b673D4B9c089bBe));
Expand Down
2 changes: 1 addition & 1 deletion script/005_DeployECDSAAccountFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import "forge-std/src/Script.sol";
import "../src/account/v1/factory/ECDSAAccountFactory.sol";
import "forge-std/src/Script.sol";

/// @dev We actually still used hardhat deployment for this legacy contract. This script is more for convenience
/// purpose.
Expand Down
2 changes: 1 addition & 1 deletion script/006_DeployAddressBookPlugin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
pragma solidity 0.8.24;

import {AddressBookPlugin} from "../src/msca/6900/v0.7/plugins/v1_0_0/addressbook/AddressBookPlugin.sol";
import {Script} from "forge-std/src/Script.sol";
import {console} from "forge-std/src/console.sol";
import {AddressBookPlugin} from "../src/msca/6900/v0.7/plugins/v1_0_0/addressbook/AddressBookPlugin.sol";

contract DeployAddressBookPluginScript is Script {
// TODO: replace this with officially deployed address
Expand Down
4 changes: 2 additions & 2 deletions script/007_DeployColdStorageAddressBookPlugin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
pragma solidity 0.8.24;

import {Script} from "forge-std/src/Script.sol";
import {console} from "forge-std/src/console.sol";
import {ColdStorageAddressBookPlugin} from
"../src/msca/6900/v0.7/plugins/v1_0_0/addressbook/ColdStorageAddressBookPlugin.sol";
import {Script} from "forge-std/src/Script.sol";
import {console} from "forge-std/src/console.sol";

contract DeployColdStorageAddressBookPluginScript is Script {
address payable constant EXPECTED_PLUGIN_ADDRESS = payable(address(0x7E7e5B99F9C3dF2E2f38418e0F7C08C3911a4413));
Expand Down
4 changes: 2 additions & 2 deletions script/008_DeployWeightedWebauthnMultisigPlugin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
pragma solidity 0.8.24;

import {Script} from "forge-std/src/Script.sol";
import {console} from "forge-std/src/console.sol";
import {WeightedWebauthnMultisigPlugin} from
"../src/msca/6900/v0.7/plugins/v1_0_0/multisig/WeightedWebauthnMultisigPlugin.sol";
import {Script} from "forge-std/src/Script.sol";
import {console} from "forge-std/src/console.sol";

contract DeployWeightedWebauthnMultisigPlugin is Script {
address payable constant EXPECTED_PLUGIN_ADDRESS = payable(address(0x5FC0e9da759812cd862625bF6d3EA02EB0666160));
Expand Down
2 changes: 1 addition & 1 deletion script/009_SetUpgradableMSCAFactoryPlugins.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {console, Script} from "forge-std/src/Script.sol";
import {UpgradableMSCAFactory} from "../src/msca/6900/v0.7/factories/UpgradableMSCAFactory.sol";
import {Script, console} from "forge-std/src/Script.sol";

contract SetUpgradableMSCAFactoryPlugins is Script {
address payable constant EXPECTED_FACTORY_ADDRESS = payable(address(0x95abd14795D32A4e636e976Ff31dC634Ad33A09E));
Expand Down
2 changes: 1 addition & 1 deletion script/010_StakeUpgradableMSCAFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {console, Script} from "forge-std/src/Script.sol";
import {UpgradableMSCAFactory} from "../src/msca/6900/v0.7/factories/UpgradableMSCAFactory.sol";
import {Script, console} from "forge-std/src/Script.sol";

contract StakeUpgradableMSCAFactory is Script {
address payable constant EXPECTED_FACTORY_ADDRESS = payable(address(0x95abd14795D32A4e636e976Ff31dC634Ad33A09E));
Expand Down
2 changes: 1 addition & 1 deletion script/011_DeployTokenCallbackPlugin.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {Script, console} from "forge-std/src/Script.sol";
import {DefaultTokenCallbackPlugin} from "../src/msca/6900/v0.7/plugins/v1_0_0/utility/DefaultTokenCallbackPlugin.sol";
import {Script, console} from "forge-std/src/Script.sol";

contract DeployTokenCallbackPluginScript is Script {
// Safety check to avoid accidental deploy. Change address to 0x0 if you want to deploy a new version.
Expand Down
10 changes: 5 additions & 5 deletions src/account/CoreAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
*/
pragma solidity 0.8.24;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {DefaultCallbackHandler} from "../callback/DefaultCallbackHandler.sol";
import {ExecutionUtils} from "../utils/ExecutionUtils.sol";
import {BaseAccount} from "@account-abstraction/contracts/core/BaseAccount.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import {BaseAccount} from "@account-abstraction/contracts/core/BaseAccount.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {ExecutionUtils} from "../utils/ExecutionUtils.sol";
import {DefaultCallbackHandler} from "../callback/DefaultCallbackHandler.sol";

/**
* @dev Upgradable & ownable contract. One of the most common templates.
Expand Down
12 changes: 6 additions & 6 deletions src/account/v1/ECDSAAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
*/
pragma solidity 0.8.24;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import {SIG_VALIDATION_FAILED} from "../../common/Constants.sol";
import "../CoreAccount.sol";

Check warning on line 22 in src/account/v1/ECDSAAccount.sol

View workflow job for this annotation

GitHub Actions / lint_and_test

global import of path ../CoreAccount.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@account-abstraction/contracts/interfaces/IEntryPoint.sol";

Check warning on line 23 in src/account/v1/ECDSAAccount.sol

View workflow job for this annotation

GitHub Actions / lint_and_test

global import of path @account-abstraction/contracts/interfaces/IEntryPoint.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "@account-abstraction/contracts/interfaces/PackedUserOperation.sol";

Check warning on line 24 in src/account/v1/ECDSAAccount.sol

View workflow job for this annotation

GitHub Actions / lint_and_test

global import of path @account-abstraction/contracts/interfaces/PackedUserOperation.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "../CoreAccount.sol";
import {SIG_VALIDATION_FAILED} from "../../common/Constants.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";

/**
* @dev Upgradable & ownable (by EOA key) contract. One of the most common templates.
Expand Down
2 changes: 1 addition & 1 deletion src/account/v1/factory/ECDSAAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
pragma solidity 0.8.24;

import "../ECDSAAccount.sol";
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
import "../ECDSAAccount.sol";

/**
* @dev Account factory that creates the upgradeable account signed and verified by ECDSA.
Expand Down
6 changes: 3 additions & 3 deletions src/callback/DefaultCallbackHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
pragma solidity 0.8.24;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {IERC777Recipient} from "@openzeppelin/contracts/interfaces/IERC777Recipient.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
* @dev Token callback handler. Allowing account receiving these tokens.
Expand Down
2 changes: 1 addition & 1 deletion src/libs/RecipientAddressLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
pragma solidity 0.8.24;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libs/WebAuthnLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
pragma solidity 0.8.24;

import {WebAuthnData} from "../common/CommonStructs.sol";
import {FCL_ecdsa} from "@fcl/FCL_ecdsa.sol";
import {FCL_Elliptic_ZZ} from "@fcl/FCL_elliptic.sol";
import {WebAuthnData} from "../common/CommonStructs.sol";

/// @title WebAuthn
///
Expand Down
2 changes: 1 addition & 1 deletion src/msca/6900/shared/libs/AddressDLLLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
pragma solidity 0.8.24;

import {ItemAlreadyExists, ItemDoesNotExist, InvalidLimit} from "../common/Errors.sol";
import {InvalidLimit, ItemAlreadyExists, ItemDoesNotExist} from "../common/Errors.sol";
import {AddressDLL} from "../common/Structs.sol";

/**
Expand Down
4 changes: 2 additions & 2 deletions src/msca/6900/shared/libs/Bytes32DLLLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
pragma solidity 0.8.24;

import {InvalidItem, ItemAlreadyExists, ItemDoesNotExist, InvalidLimit} from "../../shared/common/Errors.sol";
import {Bytes32DLL} from "../common/Structs.sol";
import {SENTINEL_BYTES32} from "../../../../common/Constants.sol";
import {InvalidItem, InvalidLimit, ItemAlreadyExists, ItemDoesNotExist} from "../../shared/common/Errors.sol";
import {Bytes32DLL} from "../common/Structs.sol";

/**
* @dev Enumerable & ordered doubly linked list built using mapping(bytes32 => bytes32).
Expand Down
4 changes: 2 additions & 2 deletions src/msca/6900/shared/libs/Bytes4DLLLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
pragma solidity 0.8.24;

import {ItemAlreadyExists, ItemDoesNotExist, InvalidLimit} from "../../shared/common/Errors.sol";
import {Bytes4DLL} from "../common/Structs.sol";
import {SENTINEL_BYTES4} from "../../../../common/Constants.sol";
import {InvalidLimit, ItemAlreadyExists, ItemDoesNotExist} from "../../shared/common/Errors.sol";
import {Bytes4DLL} from "../common/Structs.sol";

/**
* @dev Enumerable & ordered doubly linked list built using mapping(bytes4 => bytes4).
Expand Down
64 changes: 33 additions & 31 deletions src/msca/6900/v0.7/account/BaseMSCA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,47 @@
*/
pragma solidity 0.8.24;

import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {PackedUserOperation} from "@account-abstraction/contracts/interfaces/PackedUserOperation.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {
EMPTY_FUNCTION_REFERENCE,
SENTINEL_BYTES21,
WALLET_AUTHOR,
WALLET_VERSION_1
} from "../../../../common/Constants.sol";
import {ExecutionUtils} from "../../../../utils/ExecutionUtils.sol";
import {
InvalidAuthorizer,
InvalidExecutionFunction,
InvalidValidationFunctionId,
NotFoundSelector,
UnauthorizedCaller
} from "../../shared/common/Errors.sol";
import {AddressDLL, ValidationData} from "../../shared/common/Structs.sol";
import {AddressDLLLib} from "../../shared/libs/AddressDLLLib.sol";
import {ValidationDataLib} from "../../shared/libs/ValidationDataLib.sol";
import {
PRE_HOOK_ALWAYS_DENY_FUNCTION_REFERENCE,
RUNTIME_VALIDATION_ALWAYS_ALLOW_FUNCTION_REFERENCE
} from "../common/Constants.sol";
import "../common/Structs.sol";
import {IAccountLoupe} from "../interfaces/IAccountLoupe.sol";
import {IPlugin} from "../interfaces/IPlugin.sol";
import {IPluginExecutor} from "../interfaces/IPluginExecutor.sol";
import {IAccountLoupe} from "../interfaces/IAccountLoupe.sol";
import {IPluginManager} from "../interfaces/IPluginManager.sol";
import {IStandardExecutor} from "../interfaces/IStandardExecutor.sol";
import {PluginManager} from "../managers/PluginManager.sol";
import {StandardExecutor} from "../managers/StandardExecutor.sol";
import {PluginExecutor} from "../managers/PluginExecutor.sol";
import {WalletStorageV1Lib} from "../libs/WalletStorageV1Lib.sol";
import {ExecutionHookLib} from "../libs/ExecutionHookLib.sol";
import {WalletStorageInitializable} from "./WalletStorageInitializable.sol";
import {RepeatableFunctionReferenceDLLLib} from "../libs/RepeatableFunctionReferenceDLLLib.sol";
import {FunctionReferenceLib} from "../libs/FunctionReferenceLib.sol";
import {AddressDLLLib} from "../../shared/libs/AddressDLLLib.sol";
import {ValidationDataLib} from "../../shared/libs/ValidationDataLib.sol";
import {RepeatableFunctionReferenceDLLLib} from "../libs/RepeatableFunctionReferenceDLLLib.sol";

import {SelectorRegistryLib} from "../libs/SelectorRegistryLib.sol";
import {
UnauthorizedCaller,
NotFoundSelector,
InvalidValidationFunctionId,
InvalidAuthorizer,
InvalidExecutionFunction
} from "../../shared/common/Errors.sol";
import "../common/Structs.sol";
import {
WALLET_AUTHOR,
WALLET_VERSION_1,
SENTINEL_BYTES21,
EMPTY_FUNCTION_REFERENCE
} from "../../../../common/Constants.sol";
import {ValidationData, AddressDLL} from "../../shared/common/Structs.sol";
import {
RUNTIME_VALIDATION_ALWAYS_ALLOW_FUNCTION_REFERENCE,
PRE_HOOK_ALWAYS_DENY_FUNCTION_REFERENCE
} from "../common/Constants.sol";
import {WalletStorageV1Lib} from "../libs/WalletStorageV1Lib.sol";
import {PluginExecutor} from "../managers/PluginExecutor.sol";
import {PluginManager} from "../managers/PluginManager.sol";
import {StandardExecutor} from "../managers/StandardExecutor.sol";

import {WalletStorageInitializable} from "./WalletStorageInitializable.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {PackedUserOperation} from "@account-abstraction/contracts/interfaces/PackedUserOperation.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
* @dev Base MSCA implementation with **authentication**.
Expand Down
15 changes: 8 additions & 7 deletions src/msca/6900/v0.7/account/UpgradableMSCA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
*/
pragma solidity 0.8.24;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {BaseMSCA} from "./BaseMSCA.sol";
import {DefaultCallbackHandler} from "../../../../callback/DefaultCallbackHandler.sol";
import {ExecutionUtils} from "../../../../utils/ExecutionUtils.sol";
import {PluginManager} from "../managers/PluginManager.sol";
import {InvalidInitializationInput} from "../../shared/common/Errors.sol";
import {FunctionReference} from "../common/Structs.sol";
import {DefaultCallbackHandler} from "../../../../callback/DefaultCallbackHandler.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {PluginManager} from "../managers/PluginManager.sol";
import {BaseMSCA} from "./BaseMSCA.sol";
import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";

/**
* @dev Leverage {ERC1967Proxy} brought by UUPS proxies, when this contract is set as the implementation behind such a
Expand Down
Loading

0 comments on commit 77ee743

Please sign in to comment.