Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update alpha release #136

Merged
merged 11 commits into from
Feb 2, 2024
17 changes: 12 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ REQUIRED_STAKE_AMOUNT=1
UNSTAKE_DELAY_SEC=86400

ENTRYPOINT=
# MSCA_IMPL=
# OWNER_FACTORY=
# OWNER_TOKEN_RECEIVER_FACTORY=

# MA_IMPL=
# FACTORY=
# OWNER_PLUGIN=
# TOKEN_RECEIVER_PLUGIN=
# SESSION_KEY_PLUGIN=

# MA_IMPL_SALT=
# FACTORY_SALT=
# MULTI_OWNER_PLUGIN_SALT=
# SESSION_KEY_PLUGIN_SALT=

# EXPECTED_MA_IMPL=
# EXPECTED_FACTORY=
# EXPECTED_OWNER_PLUGIN=
# EXPECTED_SESSION_KEY_PLUGIN=

RPC_URL=
1,359 changes: 907 additions & 452 deletions .gasestimates.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ lcov.info

# secret
.env

# deployments
broadcast/**/run-latest.json
broadcast/**/dry-run/**/*
51 changes: 21 additions & 30 deletions .storagelayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,43 @@ Generated via `bash utils/inspect.sh`.
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|

`forge inspect --pretty src/account/PluginManagerInternals.sol:PluginManagerInternals storage-layout`
`forge inspect --pretty src/account/AccountStorageV1.sol:AccountStorageV1 storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|

`forge inspect --pretty src/account/UpgradeableModularAccount.sol:UpgradeableModularAccount storage-layout`
`forge inspect --pretty src/account/PluginManagerInternals.sol:PluginManagerInternals storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|

`forge inspect --pretty src/factory/MultiOwnerMSCAFactory.sol:MultiOwnerMSCAFactory storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|--------|---------|------|--------|-------|-------------------------------------------------------------|
| _owner | address | 0 | 0 | 20 | src/factory/MultiOwnerMSCAFactory.sol:MultiOwnerMSCAFactory |

`forge inspect --pretty src/factory/MultiOwnerTokenReceiverMSCAFactory.sol:MultiOwnerTokenReceiverMSCAFactory storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|--------|---------|------|--------|-------|---------------------------------------------------------------------------------------|
| _owner | address | 0 | 0 | 20 | src/factory/MultiOwnerTokenReceiverMSCAFactory.sol:MultiOwnerTokenReceiverMSCAFactory |

`forge inspect --pretty src/libraries/AccountStorageV1.sol:AccountStorageV1 storage-layout`
`forge inspect --pretty src/account/UpgradeableModularAccount.sol:UpgradeableModularAccount storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|

`forge inspect --pretty src/plugins/BasePlugin.sol:BasePlugin storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|
`forge inspect --pretty src/factory/MultiOwnerModularAccountFactory.sol:MultiOwnerModularAccountFactory storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|---------------|---------|------|--------|-------|---------------------------------------------------------------------------------|
| _owner | address | 0 | 0 | 20 | src/factory/MultiOwnerModularAccountFactory.sol:MultiOwnerModularAccountFactory |
| _pendingOwner | address | 1 | 0 | 20 | src/factory/MultiOwnerModularAccountFactory.sol:MultiOwnerModularAccountFactory |

`forge inspect --pretty src/plugins/TokenReceiverPlugin.sol:TokenReceiverPlugin storage-layout`
`forge inspect --pretty src/plugins/BasePlugin.sol:BasePlugin storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------|------|------|--------|-------|----------|

`forge inspect --pretty src/plugins/owner/MultiOwnerPlugin.sol:MultiOwnerPlugin storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|------------------|--------------------------------|------|--------|-------|---------------------------------------------------------|
| _nameFallback | string | 0 | 0 | 32 | src/plugins/owner/MultiOwnerPlugin.sol:MultiOwnerPlugin |
| _versionFallback | string | 1 | 0 | 32 | src/plugins/owner/MultiOwnerPlugin.sol:MultiOwnerPlugin |
| _owners | struct AssociatedLinkedListSet | 2 | 0 | 32 | src/plugins/owner/MultiOwnerPlugin.sol:MultiOwnerPlugin |
| Name | Type | Slot | Offset | Bytes | Contract |
|---------|--------------------------------|------|--------|-------|---------------------------------------------------------|
| _owners | struct AssociatedLinkedListSet | 0 | 0 | 32 | src/plugins/owner/MultiOwnerPlugin.sol:MultiOwnerPlugin |

`forge inspect --pretty src/plugins/session/SessionKeyPlugin.sol:SessionKeyPlugin storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|--------------|--------------------------------|------|--------|-------|-----------------------------------------------------------|
| _sessionKeys | struct AssociatedLinkedListSet | 0 | 0 | 32 | src/plugins/session/SessionKeyPlugin.sol:SessionKeyPlugin |
| Name | Type | Slot | Offset | Bytes | Contract |
|---------------|--------------------------------|------|--------|-------|-----------------------------------------------------------|
| _keyIdCounter | mapping(address => uint256) | 0 | 0 | 32 | src/plugins/session/SessionKeyPlugin.sol:SessionKeyPlugin |
| _sessionKeys | struct AssociatedLinkedListSet | 1 | 0 | 32 | src/plugins/session/SessionKeyPlugin.sol:SessionKeyPlugin |

`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissions.sol:SessionKeyPermissions storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|---------------|-----------------------------|------|--------|-------|---------------------------------------------------------------------------------|
| _keyIdCounter | mapping(address => uint256) | 0 | 0 | 32 | src/plugins/session/permissions/SessionKeyPermissions.sol:SessionKeyPermissions |

`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissionsBase.sol:SessionKeyPermissionsBase storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
Expand All @@ -67,8 +63,3 @@ Generated via `bash utils/inspect.sh`.
|---------------|-----------------------------|------|--------|-------|-------------------------------------------------------------------------------------------|
| _keyIdCounter | mapping(address => uint256) | 0 | 0 | 32 | src/plugins/session/permissions/SessionKeyPermissionsLoupe.sol:SessionKeyPermissionsLoupe |

`forge inspect --pretty src/plugins/session/permissions/SessionKeyPermissionsPlugin.sol:SessionKeyPermissionsPlugin storage-layout`
| Name | Type | Slot | Offset | Bytes | Contract |
|---------------|-----------------------------|------|--------|-------|---------------------------------------------------------------------------------------------|
| _keyIdCounter | mapping(address => uint256) | 0 | 0 | 32 | src/plugins/session/permissions/SessionKeyPermissionsPlugin.sol:SessionKeyPermissionsPlugin |

File renamed without changes.
File renamed without changes.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ Alchemy's Modular Account is a maximally modular, upgradeable Smart Contract Acc
## Overview

This repository contains:
* [Modular Account implementation](src/account)
* [Modular Account factories](src/factory)
* 3 ERC-6900 compatible plugins:
* [MultiOwnerPlugin](src/plugins/owner) is a plugin supporting 1+ ECDSA owners.
* [TokenReceiverPlugin](src/plugins/TokenReceiverPlugin.sol) contains ERC721/ERC777/ERC1155 token receivers.
* [SessionKeyPlugin](src/plugins/session) enables session keys with optional permissions such as time ranges, token spend limits, and gas spend limits.

- [Modular Account implementation](src/account)
- [Modular Account factory](src/factory)
- 2 ERC-6900 compatible plugins:
- [MultiOwnerPlugin](src/plugins/owner) is a plugin supporting 1+ ECDSA owners.
- [SessionKeyPlugin](src/plugins/session) enables session keys with optional permissions such as time ranges, token spend limits, and gas spend limits.

The account and plugins conform to these ERC versions:
* ERC-4337: 0.6.0
* ERC-6900: 0.7.0

- ERC-4337: 0.6.0
- ERC-6900: 0.7.0

## Development

Expand Down Expand Up @@ -43,20 +44,21 @@ FOUNDRY_PROFILE=lite forge test -vvv
### Deployment

A deployment script can be found in the `scripts/` folder

```bash
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast
```

## Security and Audits

We have done 2 audits from Spearbit and Quantstamp and will upload the reports shortly.
We have done 2 audits from Spearbit and Quantstamp and will upload the reports shortly. Note that these audit reports may contain references to "MSCA". This was the name we used for Modular Account previously.

## License

The Modular Account libraries (all code inside the [src/libraries](src/libraries) directory) are licensed under the MIT License, also included in our repository in [LICENSE](LICENSE).
The Modular Account libraries (all code inside the [src/libraries](src/libraries) directory) are licensed under the MIT License, also included in our repository in [LICENSE-MIT](LICENSE-MIT).

The Modular Account and ERC-6900 interfaces (all code inside the [src/interfaces](src/interfaces) directory) are licensed under the CC0 1.0 Universal License.
The Modular Account interfaces and ERC-6900 interfaces (all code inside the [src/interfaces](src/interfaces) directory) are licensed under the CC0 1.0 Universal License.

All other code for Modular Account is licensed under the GNU General Public License v3.0, also included in our repository in [COPYING](COPYING).
All other code for Modular Account is licensed under the GNU General Public License v3.0, also included in our repository in [LICENSE-GPL](LICENSE-GPL).

Alchemy Insights, Inc., 548 Market St., PMB 49099, San Francisco, CA 94104; [email protected]
Binary file added audits/2024-01-31_quantstamp_0e3fd1e.pdf
Binary file not shown.
Binary file added audits/2024-01-31_spearbit_0e3fd1e.pdf
Binary file not shown.
125 changes: 125 additions & 0 deletions broadcast/Deploy.s.sol/11155111/run-1706829580.json

Large diffs are not rendered by default.

409 changes: 0 additions & 409 deletions broadcast/Deploy.s.sol/11155111/run-latest.json

This file was deleted.

365 changes: 365 additions & 0 deletions broadcast/Deploy.s.sol/137/run-1706829813.json

Large diffs are not rendered by default.

250 changes: 250 additions & 0 deletions broadcast/Deploy.s.sol/84532/run-1706829406.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ out = 'out'
test = 'test'
libs = ['lib']
optimizer = true
optimizer_runs = 1600
optimizer_runs = 900
ignored_error_codes = []

[fuzz]
Expand Down
10 changes: 10 additions & 0 deletions migrations/base-sepolia/contracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"EntryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"Prod": {
"MSCA Impl": "0x0000006641DB11037b7A187c45d9D50F2aEEE750",
"MultiOwnerPlugin": "0x000000E8F14A838A00505d861c6EF15cdfB05455",
"MultiOwnerModularAccountFactory": "0x000000CC76Ff50cAE2D633E79cCB1Fa1E6978D5a",
"SessionKeyPlugin": "0x000000AAF83f4cbd58193D30643025ffD6C9e724",
"MultiOwnerModularAccountFactory Owner": "0xDdF32240B4ca3184De7EC8f0D5Aba27dEc8B7A5C"
}
}
10 changes: 10 additions & 0 deletions migrations/polygon-mainnet/contracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"EntryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"Prod": {
"MSCA Impl": "0x0000006641DB11037b7A187c45d9D50F2aEEE750",
"MultiOwnerPlugin": "0x000000E8F14A838A00505d861c6EF15cdfB05455",
"MultiOwnerModularAccountFactory": "0x000000CC76Ff50cAE2D633E79cCB1Fa1E6978D5a",
"SessionKeyPlugin": "0x000000AAF83f4cbd58193D30643025ffD6C9e724",
"MultiOwnerModularAccountFactory Owner": "0xDdF32240B4ca3184De7EC8f0D5Aba27dEc8B7A5C"
}
}
23 changes: 5 additions & 18 deletions migrations/sepolia/contracts.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
{
"EntryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"Prod": {
"MSCA Impl": "",
"MultiOwnerPlugin": "",
"TokenReceiverPlugin": "",
"MultiOwnerMSCAFactory": "",
"MultiOwnerTokenReceiverMSCAFactory": "",
"SessionKeyPlugin": "",
"MultiOwnerMSCAFactory Owner": "",
"MultiOwnerTokenReceiverMSCAFactory Owner": ""
},
"Staging": {
"MSCA Impl": "0xDba275F73187F7037cF24D900447d2Ca0504bAF2",
"MultiOwnerPlugin": "0xB76734F322b9f2C8F1dA934252dED3bC3C25b109",
"TokenReceiverPlugin": "0x360b59D3D922fe6b015257390b35E7dBA8632A50",
"MultiOwnerMSCAFactory": "0xC69731F267760466663470256A7ba28F79eDC4d6",
"MultiOwnerTokenReceiverMSCAFactory": "0x852B3a676684031Cb77b69B50D8d7879f4c4807d",
"SessionKeyPlugin": "0x70a64501Fd1398b0A236b69006936009d31C1520",
"MultiOwnerMSCAFactory Owner": "0x7f89Ed1F3F0d52d303904101305471bca3cde710",
"MultiOwnerTokenReceiverMSCAFactory Owner": "0x7f89Ed1F3F0d52d303904101305471bca3cde710"
"MSCA Impl": "0x0000006641DB11037b7A187c45d9D50F2aEEE750",
"MultiOwnerPlugin": "0x000000E8F14A838A00505d861c6EF15cdfB05455",
"MultiOwnerModularAccountFactory": "0x000000CC76Ff50cAE2D633E79cCB1Fa1E6978D5a",
"SessionKeyPlugin": "0x000000AAF83f4cbd58193D30643025ffD6C9e724",
"MultiOwnerModularAccountFactory Owner": "0xDdF32240B4ca3184De7EC8f0D5Aba27dEc8B7A5C"
}
}
Loading
Loading