Skip to content

Commit c867c19

Browse files
committed
Merge branch 'develop' into feat/npm
2 parents 79a2e23 + 1e1bccc commit c867c19

File tree

94 files changed

+614
-9171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+614
-9171
lines changed

LICENSE

Lines changed: 21 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,53 @@
11
# ERC-6900 Reference Implementation
22

3-
Reference implementation for [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900).
3+
[![tg_badge]][tg_link]
44

5-
The implementation includes an upgradable modular account with 5 modules (`SingleSignerValidationModule`, `TokenReceiverModule`, `AllowlistModule`, `ERC20TokenLimitModule`, and `NativeTokenLimitModule`). It is compliant with the latest version of ERC-6900.
5+
[tg_badge]: https://img.shields.io/endpoint?color=neon&logo=telegram&label=chat&url=https://mogyo.ro/quart-apis/tgmembercount?chat_id=modular_account_standards
6+
[tg_link]: https://t.me/modular_account_standards
67

7-
## Important callouts
8+
Reference implementation for [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900).
89

9-
- **Not audited and SHOULD NOT be used in production**.
10-
- Not optimized in both deployments and execution. We’ve explicitly removed some optimizations in favor of clarity.
10+
This repository contains the contracts below which are compliant with the latest version of ERC-6900. They are not optimized in both deployments and execution. We’ve explicitly removed some optimizations in favor of clarity.
11+
12+
> [!IMPORTANT]
13+
> Unless otherwise stated, these contracts are not audited and SHOULD NOT be used in production.
14+
15+
- Reference account implementations
16+
- [ReferenceModularAccount](src/account/ReferenceModularAccount.sol): A simple ERC-6900 compatible account.
17+
- [SemiModularAccount](src/account/SemiModularAccount.sol): An ERC-6900 account that includes a fallback validation mechanism.
18+
- Factory
19+
- [AccountFactory](src/account/AccountFactory.sol): Deploys both account types.
20+
- ERC-6900 interfaces: [src/interfaces](src/interfaces/)
21+
- Helpers
22+
- [CollectReturnData](src/helpers/CollectReturnData.sol)
23+
- [Constants](src/helpers/Constants.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
24+
- [EmptyCalldataSlice](src/helpers/EmptyCalldataSlice.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
25+
- [ValidationResHelpers](src/helpers/ValidationResHelpers.sol)
26+
- Libraries
27+
- [HookConfigLib](src/libraries/HookConfigLib.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
28+
- [KnownSelectorsLib](src/libraries/KnownSelectorsLib.sol)
29+
- [ModuleEntityLib](src/libraries/ModuleEntityLib.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
30+
- [ModuleStorageLib](src/libraries/ModuleStorageLib.sol)
31+
- [SparseCalldataSegmentLib](src/libraries/SparseCalldataSegmentLib.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
32+
- [ValidationConfigLib](src/libraries/ValidationConfigLib.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
33+
- ERC-6900 compatible modules
34+
- Validation modules:
35+
- [SingleSignerValidationModule](src/modules/validation/SingleSignerValidationModule.sol): Enables validation for a single signer (EOA or contract).
36+
- Permission-enforcing hook modules:
37+
- [AllowlistModule](src/modules/permissions/AllowlistModule.sol): Enforces address/selector allowlists.
38+
- [ERC20TokenLimitModule](src/modules/permissions/ERC20TokenLimitModule.sol): Enforces ERC-20 spend limits.
39+
- [NativeTokenLimitModule](src/modules/permissions/NativeTokenLimitModule.sol): Enforces native token spend limits.
40+
- Execution modules:
41+
- [TokenReceiverModule](src/modules/TokenReceiverModule.sol): Allows the account to receive ERC-721 and ERC-1155 tokens.
42+
- Module utilities
43+
- [ModuleEIP712](src/modules/ModuleEIP712.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
44+
- [ReplaySafeWrapper](src/modules/ReplaySafeWrapper.sol): ✅ Audited ([reports](https://github.com/alchemyplatform/modular-account/tree/develop/audits))
1145

1246
## Development
1347

14-
Anyone is welcome to submit feedback and/or PRs to improve code.
48+
Anyone is welcome to submit feedback and/or PRs to improve the code. For standard improvement proposals and discussions, join us at https://github.com/erc6900/resources/issues or [Ethereum Magicians](https://ethereum-magicians.org/t/erc-6900-modular-smart-contract-accounts-and-plugins/13885).
1549

16-
### Testing
50+
## Testing
1751

1852
The default Foundry profile can be used to compile (without IR) and test the entire project. The default profile should be used when generating coverage and debugging.
1953

@@ -29,9 +63,9 @@ FOUNDRY_PROFILE=optimized-build forge build
2963
FOUNDRY_PROFILE=optimized-test forge test -vvv
3064
```
3165

32-
## Integration testing
66+
### Integration testing
3367

34-
The reference implementation provides a sample factory and deploy script for the factory, account implementation, and the demo validation module `SingleSignerValidationModule`. This is not audited nor intended for production use. Limitations set by the GPLv3 license apply.
68+
The reference implementation provides a sample factory and deploy script for the factory, account implementation, and the demo validation module `SingleSignerValidationModule`. This is not audited nor intended for production use. Limitations set by the MIT license apply.
3569

3670
To run this script, provide appropriate values in a `.env` file based on the `.env.example` template, then run:
3771

funding.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"opRetro": {
3+
"projectId": "0x27cbcfd7678c199355b12b66d6449531a4015998d1793640456392e8564af155"
4+
}
5+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"erc6900"
2424
],
2525
"author": "ERC6900 Community",
26-
"license": "GPL-3.0",
26+
"license": "MIT",
2727
"bugs": {
2828
"url": "https://github.com/erc6900/reference-implementation/issues"
2929
},

script/Deploy.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

script/DeployAllowlistModule.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
import {Script, console} from "forge-std/Script.sol";

src/account/AccountExecutor.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
abstract contract AccountExecutor {

src/account/AccountFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

src/account/AccountStorage.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
55

6-
import {HookConfig, ModuleEntity} from "../interfaces/IModularAccount.sol";
6+
import {HookConfig, ModuleEntity, ValidationFlags} from "../interfaces/IERC6900Account.sol";
77

88
// bytes = keccak256("ERC6900.ReferenceModularAccount.Storage")
99
bytes32 constant _ACCOUNT_STORAGE_SLOT = 0xc531f081ecdb5a90f38c197521797881a6e5c752a7d451780f325a95f8b91f45;
@@ -25,12 +25,12 @@ struct ExecutionStorage {
2525
}
2626

2727
struct ValidationStorage {
28-
// Whether or not this validation can be used as a global validation function.
29-
bool isGlobal;
30-
// Whether or not this validation is allowed to validate ERC-1271 signatures.
31-
bool isSignatureValidation;
32-
// Whether or not this validation is allowed to validate ERC-4337 user operations.
33-
bool isUserOpValidation;
28+
// ValidationFlags layout:
29+
// 0b00000___ // unused
30+
// 0b_____A__ // isGlobal
31+
// 0b______B_ // isSignatureValidation
32+
// 0b_______C // isUserOpValidation
33+
ValidationFlags validationFlags;
3434
// The validation hooks for this validation function.
3535
HookConfig[] validationHooks;
3636
// Execution hooks to run with this validation function.

src/account/AccountStorageInitializable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-3.0
1+
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

44
import {AccountStorage, getAccountStorage} from "./AccountStorage.sol";

0 commit comments

Comments
 (0)