Skip to content

Commit

Permalink
refactor(v2): move files and add dependencies section to readme (alch…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik authored Mar 16, 2024
1 parent d414af9 commit 36b7299
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ bash utils/inspect.sh
```bash
slither .
```

## Dependencies

Light Account uses dependencies via git submodules, pinned to release branches. Dependencies that cannot be reliably pinned (or those that needed to be modified) have been copied directly into the repository. These are listed below:

| File | Description | Source |
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CustomSlotInitializable.sol](./src/common/CustomSlotInitializable.sol) | A fork of OpenZeppelin's `Initializable` contract that allows custom storage slots to be used. | [Initializable.sol (932fddf)](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/932fddf69a699a9a80fd2396fd1a2ab91cdda123/contracts/proxy/utils/Initializable.sol) |
| [ERC1271.sol](./src/common/ERC1271.sol) | A fork of Solady's `ERC1271` contract that allows for more flexibility in signature checks. | [ERC1271.sol (7a2c4af)](https://github.com/Vectorized/solady/blob/7a2c4afcc7328908ddd3f6eae076d277b2b5da23/src/accounts/ERC1271.sol) |
| [EIP712.sol](./src/external/solady/EIP712.sol) | Copied from Solady. | [EIP712.sol (eac17da)](https://github.com/Vectorized/solady/blob/eac17da6d57d864f179a6d81e02127cabe3b77d9/src/utils/EIP712.sol) |
| [LibClone.sol](./src/external/solady/LibClone.sol) | Copied from Solady. | [LibClone.sol (7a1f591)](https://github.com/Vectorized/solady/blob/7a1f591fe53487bd6952c4df23d3bed26a4b678d/src/utils/LibClone.sol) |
| [UUPSUpgradeable.sol](./src/external/solady/UUPSUpgradeable.sol) | Copied from Solady. | [UUPSUpgradeable.sol (a061f38)](https://github.com/Vectorized/solady/blob/a061f38f27cd7ae330a86d42d3f15b4e7237f064/src/utils/UUPSUpgradeable.sol) |
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ goerli = "${RPC_URL_GOERLI}"
mainnet = { key = "${ETHERSCAN_API_KEY}" }
goerli = { key = "${ETHERSCAN_API_KEY}" }

[fmt]
ignore = ['src/external/**/*']

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
2 changes: 1 addition & 1 deletion src/LightAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.23;

import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";

import {LibClone} from "../ext/solady/LibClone.sol";
import {LibClone} from "./external/solady/LibClone.sol";
import {LightAccount} from "./LightAccount.sol";

/// @title A factory contract for LightAccount.
Expand Down
2 changes: 1 addition & 1 deletion src/MultiOwnerLightAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.23;

import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";

import {LibClone} from "../ext/solady/LibClone.sol";
import {LibClone} from "./external/solady/LibClone.sol";
import {MultiOwnerLightAccount} from "./MultiOwnerLightAccount.sol";

/// @title A factory contract for MultiOwnerLightAccount.
Expand Down
2 changes: 1 addition & 1 deletion src/common/BaseLightAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol";
import {PackedUserOperation} from "account-abstraction/interfaces/PackedUserOperation.sol";
import {TokenCallbackHandler} from "account-abstraction/samples/callback/TokenCallbackHandler.sol";

import {UUPSUpgradeable} from "../../ext/solady/UUPSUpgradeable.sol";
import {UUPSUpgradeable} from "../external/solady/UUPSUpgradeable.sol";
import {ERC1271} from "./ERC1271.sol";

abstract contract BaseLightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, ERC1271 {
Expand Down
12 changes: 8 additions & 4 deletions src/common/CustomSlotInitializable.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.23;

/// @dev Identical to OpenZeppelin's `Initializable`, except that its state variables are kept at a custom storage slot
/// instead of at the start of storage.
/// @dev Identical to OpenZeppelin's `Initializable`, except that custom storage slots can be used.
///
/// This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
/// behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
Expand Down Expand Up @@ -146,10 +145,15 @@ abstract contract CustomSlotInitializable {
/// @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
/// {initializer} and {reinitializer} modifiers, directly or indirectly.
modifier onlyInitializing() {
_checkInitializing();
_;
}

/// @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
_;
}

/// @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
Expand Down
2 changes: 1 addition & 1 deletion src/common/ERC1271.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {EIP712} from "../../ext/solady/EIP712.sol";
import {EIP712} from "../external/solady/EIP712.sol";

/// @title ERC-1271 implementation using nested EIP-712 for replay protection.
/// @dev Identical to Solady's ERC1271, with a minor change to support overriding the signature verification logic.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/LightAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ contract LightAccountTest is Test {
bytes32(uint256(uint160(0x0000000071727De22E5E9d8BAf0edAc6f37da032)))
)
),
0x6e81714395a37e7d98764ff024ec24f3978f47157f8551fcbc0143548f39c8ef
0x7ea0ecf5a976ba72e9bde105c40012e55ee74088186c29da658ec325a8f586c4
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/MultiOwnerLightAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ contract MultiOwnerLightAccountTest is Test {
bytes32(uint256(uint160(0x0000000071727De22E5E9d8BAf0edAc6f37da032)))
)
),
0xead9408e740524880066371b7b1590829216c843719ab5a102236d1bb9d80ea1
0xfdd9cc7620f87cc7b148fd9cbcd5182b03d21a26747e13e17ef49c2939b828a9
);
}

Expand Down

0 comments on commit 36b7299

Please sign in to comment.