Skip to content

Commit 1741438

Browse files
Merge pull request #3 from etherspot/setup-modular-accounts
Setup of modular account code base
2 parents 7ebcb80 + c2f129e commit 1741438

File tree

89 files changed

+17118
-3
lines changed

Some content is hidden

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

89 files changed

+17118
-3
lines changed

.env.example

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
DEPLOYER_PRIVATE_KEY=
2+
3+
ETHERSCAN_API_KEY=
4+
ARBISCAN_API_KEY=
5+
OPTIMISM_EXPLORER_API_KEY=
6+
POLYSCAN_API_KEY=
7+
FUSE_EXPLORER_API_KEY=
8+
GNOSISSCAN_API_KEY=
9+
CHIADO_EXPLORER_API_KEY=
10+
AVALANCHE_EXPLORER_API_KEY=
11+
BSC_EXPLORER_API_KEY=
12+
BASESCAN_API_KEY=
13+
BASEGOERLI_BLOCKSCOUT_API_KEY=
14+
XDC_API_KEY=
15+
OPBNB_EXPLORER_API_KEY=
16+
17+
ALCHEMY_ETHEREUM_API_KEY=
18+
ALCHEMY_POLYGON_API_KEY=
19+
ALCHEMY_SEPOLIA_API_KEY=
20+
ALCHEMY_GOELRI_API_KEY=
21+
ALCHEMY_MUMBAI_API_KEY=
22+
23+
AMOY_RPC_URL=https://polygon-amoy-bor-rpc.publicnode.com
24+
ANCIENT8_RPC_URL=https://rpc.ancient8.gg
25+
ANCIENT8_TESTNET_RPC_URL=https://rpcv2-testnet.ancient8.gg/
26+
ARBITRUM_RPC_URL=https://arbitrum-one.publicnode.com
27+
ARBITRUM_SEPOLIA_RPC_URL=https://arbitrum-sepolia-rpc.publicnode.com
28+
AVALANCHE_RPC_URL=https://avalanche-c-chain.publicnode.com
29+
BASE_RPC_URL=https://base.publicnode.com
30+
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
31+
BINANCE_RPC_URL=https://bsc.publicnode.com
32+
BINANCE_TESTNET_RPC_URL=https://bsc-testnet.publicnode.com
33+
CELO_RPC_URL=https://forno.celo.org
34+
CELO_TESTNET_RPC_URL=https://alfajores-forno.celo-testnet.org
35+
CHIADO_RPC_URL=https://rpc.chiadochain.net
36+
ETHEREUM_RPC_URL=https://rpc.ankr.com/eth
37+
FLARE_RPC_URL=https://flare-api-tracer.flare.network/ext/C/rpc?auth=<add_key>
38+
FLARE_COSTON2_RPC_URL=https://coston2-api.flare.network/ext/C/rpc
39+
FUJI_RPC_URL=https://avalanche-fuji-c-chain.publicnode.com
40+
FUSE_RPC_URL=https://fuse.liquify.com
41+
FUSE_SPARKNET_RPC_URL=https://rpc.fusespark.io
42+
GNOSIS_RPC_URL=https://rpc.ankr.com/gnosis
43+
KAKAROT_SEPOLIA_RPC_URL=https://sepolia-rpc.kakarot.org
44+
KROMA_SEPOLIA_RPC_URL=https://api.sepolia.kroma.network
45+
LINEA_RPC_URL=https://linea-rpc.publicnode.com
46+
LINEA_SEPOLIA_RPC_URL=https://rpc.sepolia.linea.build
47+
MANTLE_RPC_URL=https://rpc.mantle.xyz
48+
MANTLE_SEPOLIA_RPC_URL=https://rpc.sepolia.mantle.xyz
49+
ODYSSEY_ITHICA_RPC_URL=https://odyssey.ithaca.xyz
50+
OPBNB_RPC_URL=https://opbnb-rpc.publicnode.com
51+
OPTIMISM_RPC_URL=https://rpc.ankr.com/optimism
52+
OPTIMISM_SEPOLIA_RPC_URL=https://sepolia.optimism.io/
53+
POLYGON_RPC_URL=https://rpc.ankr.com/polygon
54+
ROOTSTOCK_RPC_URL=https://public-node.rsk.co
55+
ROOTSTOCK_TESTNET_RPC_URL=https://public-node.testnet.rsk.co
56+
SCROLL_RPC_URL=https://rpc.scroll.io
57+
SCROLL_SEPOLIA_RPC_URL=https://sepolia-rpc.scroll.io/
58+
SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
59+
SX_TORONTO_RPC_URL=https://rpc.sx-rollup-testnet.t.raas.gelato.cloud
60+
XDC_RPC_URL=https://rpc.xdc.org
61+
XDC_APOTHEM_RPC_URL=https://erpc.apothem.network

.github/pull_request_template.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Description
2+
<!--- Describe your changes in detail -->
3+
-
4+
5+
## Motivation and Context
6+
<!--- Why is this change required? What problem does it solve? -->
7+
<!--- If it fixes an open issue, please link to the issue here. -->
8+
-
9+
10+
## How Has This Been Tested?
11+
<!--- Please describe in detail how you tested your changes. -->
12+
<!--- Include details of your testing environment, and the tests you ran to -->
13+
<!--- see how your change affects other areas of the code, etc. -->
14+
-
15+
16+
## Screenshots (if appropriate)
17+
18+
## Types of changes
19+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
20+
- [ ] Bug fix (non-breaking change which fixes an issue)
21+
- [ ] New feature (non-breaking change which adds functionality)
22+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OS
2+
.DS_Store
3+
4+
# Compiler files
5+
cache/
6+
forge_cache/
7+
out/
8+
9+
# Ignores development broadcast logs
10+
!/broadcast
11+
/broadcast/*/31337/
12+
/broadcast/**/dry-run/
13+
14+
15+
# Dotenv file
16+
.env
17+
18+
# Coverage
19+
lcov.info
20+
coverage/
21+
22+
# Node
23+
node_modules/

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "lib/solady"]
2+
path = lib/solady
3+
url = https://github.com/vectorized/solady
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
7+
[submodule "lib/account-abstraction"]
8+
path = lib/account-abstraction
9+
url = https://github.com/eth-infinitism/account-abstraction
10+
[submodule "lib/forge-std"]
11+
path = lib/forge-std
12+
url = https://github.com/foundry-rs/forge-std

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

DEPLOYMENTS.md

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

GAS_REPORT.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# MODULAR ETHERSPOT WALLET IMPLEMENTATION GAS CONSUMPTION
2+
3+
<!-- ### aa-benchmark results - OLD
4+
5+
| | Creation | Native transfer | ERC20 transfer | Total |
6+
| ----------------- | -------- | --------------- | -------------- | ------ |
7+
| ERC7579 reference | 289438 | 103811 | 93213 | 486462 |
8+
| Etherspot ERC7579 | 319604 | 105012 | 94402 | 519018 | -->
9+
10+
### complete gas usage by function (11/03/2024)
11+
12+
| MultipleOwnerECDSAValidator.sol | | | | | |
13+
|-------------------|-----------------|-------|--------|-------|---------|
14+
| Deployment Cost | Deployment Size | | | | |
15+
| 471705 | 2388 | | | | |
16+
| Function Name | min | avg | median | max | # calls |
17+
| onInstall | 22812 | 22812 | 22812 | 22812 | 48 |
18+
| validateUserOp | 6568 | 7176 | 7244 | 7515 | 6 |
19+
20+
| ERC20SessionKeyValidator.sol | | | | | |
21+
|---------------------------------|-----------------|--------|--------|--------|---------|
22+
| Deployment Cost | Deployment Size | | | | |
23+
| 1297006 | 6014 | | | | |
24+
| Function Name | min | avg | median | max | # calls |
25+
| checkSessionKeyPaused | 744 | 744 | 744 | 744 | 2 |
26+
| disableSessionKey | 30926 | 30926 | 30926 | 30926 | 2 |
27+
| enableSessionKey | 67518 | 132245 | 138694 | 138754 | 11 |
28+
| getAssociatedSessionKeys | 1309 | 1309 | 1309 | 1309 | 1 |
29+
| getSessionKeyData | 1609 | 1609 | 1609 | 1609 | 7 |
30+
| rotateSessionKey | 124571 | 124571 | 124571 | 124571 | 1 |
31+
| toggleSessionKeyPause | 27002 | 27002 | 27002 | 27002 | 1 |
32+
33+
| ModularEtherspotWallet.sol | | | | | |
34+
|---------------------------------|-----------------|--------|--------|--------|---------|
35+
| Deployment Cost | Deployment Size | | | | |
36+
| 3638796 | 16660 | | | | |
37+
| Function Name | min | avg | median | max | # calls |
38+
| addGuardian | 2666 | 53902 | 38154 | 82311 | 67 |
39+
| addOwner | 2666 | 21847 | 33824 | 33824 | 10 |
40+
| changeProposalTimelock | 2569 | 13595 | 13595 | 24622 | 2 |
41+
| discardCurrentProposal | 4754 | 13426 | 13849 | 18574 | 5 |
42+
| execute | 28900 | 35672 | 28900 | 64182 | 7 |
43+
| executeFromExecutor | 14852 | 34298 | 31885 | 62932 | 7 |
44+
| getProposal | 406 | 1829 | 2014 | 2517 | 6 |
45+
| getValidatorPaginated | 2154 | 2462 | 2462 | 2771 | 2 |
46+
| guardianCosign | 2489 | 37991 | 30750 | 75300 | 8 |
47+
| guardianCount | 407 | 407 | 407 | 407 | 2 |
48+
| guardianPropose | 2619 | 104797 | 146827 | 146827 | 20 |
49+
| initializeAccount | 22129 | 157242 | 152821 | 225206 | 317 |
50+
| installModule | 33403 | 70212 | 70214 | 107018 | 4 |
51+
| isGuardian | 624 | 1024 | 624 | 2624 | 5 |
52+
| isModuleInstalled | 1184 | 1184 | 1184 | 1184 | 9 |
53+
| isOwner | 601 | 976 | 601 | 2601 | 16 |
54+
| ownerCount | 386 | 386 | 386 | 386 | 2 |
55+
| proposalId | 407 | 407 | 407 | 407 | 1 |
56+
| proposalTimelock | 340 | 340 | 340 | 340 | 1 |
57+
| removeGuardian | 2688 | 10014 | 4916 | 18775 | 5 |
58+
| removeOwner | 2667 | 7426 | 4956 | 14542 | 6 |
59+
| transferERC20Action | 47042 | 47042 | 47042 | 47042 | 1 |
60+
| uninstallModule | 22368 | 23465 | 23465 | 24563 | 2 |
61+
| validateUserOp | 15567 | 37311 | 40493 | 53590 | 12 |
62+
63+
64+
| ModularEtherspotWalletFactory.sol | | | | | |
65+
|-----------------------|-----------------|--------|--------|--------|---------|
66+
| Deployment Cost | Deployment Size | | | | |
67+
| 239733 | 1380 | | | | |
68+
| createAccount | 1754 | 243094 | 249694 | 249694 | 55 |
69+
| getAddress | 1644 | 1654 | 1656 | 1656 | 7 |
70+
| implementation | 216 | 216 | 216 | 216 | 1 |
71+
72+
| SessionKeyValidator.sol | | | | | |
73+
|-------------------------------|-----------------|--------|--------|---------|---------|
74+
| Deployment Cost | Deployment Size | | | | |
75+
| 2912129 | 13270 | | | | |
76+
| Function Name | min | avg | median | max | # calls |
77+
| addPermission | 26801 | 160379 | 169980 | 170544 | 268 |
78+
| disableSessionKey | 24171 | 66488 | 80594 | 80594 | 4 |
79+
| enableSessionKey | 26961 | 388750 | 364043 | 1532971 | 3992 |
80+
| getSessionKeyData | 1346 | 1346 | 1346 | 1346 | 1546 |
81+
| getSessionKeyPermissions | 730 | 4343 | 4019 | 20783 | 2060 |
82+
| getSessionKeysByWallet | 758 | 1430 | 1103 | 3570 | 517 |
83+
| getUsesLeft | 682 | 682 | 682 | 682 | 259 |
84+
| isInitialized | 574 | 1240 | 574 | 2574 | 3 |
85+
| isModuleType | 347 | 347 | 347 | 347 | 3 |
86+
| isSessionLive | 715 | 715 | 715 | 715 | 6195 |
87+
| isValidSignatureWithSender | 733 | 733 | 733 | 733 | 1 |
88+
| modifyPermission | 25262 | 64480 | 64544 | 66363 | 261 |
89+
| removePermission | 24148 | 63992 | 64220 | 82468 | 261 |
90+
| rotateSessionKey | 233698 | 249491 | 249695 | 249944 | 257 |
91+
| toggleSessionKeyPause | 24174 | 36677 | 25982 | 47882 | 6196 |
92+
| updateUses | 24389 | 31047 | 31122 | 31434 | 259 |
93+
| updateValidUntil | 24289 | 29313 | 29336 | 29360 | 261 |

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Etherspot
3+
Copyright (c) 2023 Etherspot
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,66 @@
1-
# etherspot-modular-accounts
2-
Etherspot Modular Accounts
1+
# Etherspot Modular Accounts
2+
3+
[![NPM version][npm-image]][npm-url]
4+
![MIT licensed][license-image]
5+
6+
Smart contract infrastructure for Etherspot Modular Accounts, supporting ERC7579 modular implementations.
7+
8+
## Installation & Setup
9+
10+
Ensure that (Foundry)[https://github.com/foundry-rs/foundry] is installed.
11+
12+
```
13+
forge install
14+
forge build
15+
forge test
16+
```
17+
18+
## ERC7579 Modular Contract Deployments
19+
20+
### Prerequisites
21+
22+
Set up your `.env` file following the example found in `.env.example`.
23+
24+
### Deployments
25+
26+
Can be found in `/script` folder.
27+
There are scripts for individual contract deployments and for staking/unstaking the wallet factory.
28+
There is also an all in one script to deploy all required contracts and stake the wallet factory.
29+
30+
To run all in one script:
31+
32+
`forge script script/DeployAllAndSetup.s.sol:DeployAllAndSetupScript --broadcast -vvvv --rpc-url <NETWORK_NAME>`
33+
34+
For individual deployment scripts (example):
35+
36+
`forge script script/ModularEtherspotWallet.s.sol:ModularEtherspotWalletScript --broadcast -vvvv --rpc-url <NETWORK_NAME>`
37+
38+
39+
### Test Suite
40+
41+
`forge test`
42+
43+
### Solidity Usage
44+
45+
```solidity
46+
// SPDX-License-Identifier: MIT
47+
pragma solidity 0.8.23;
48+
49+
import "@etherspot/modular-accounts/src/wallet/ModularEtherspotWallet.sol";
50+
51+
// ...
52+
```
53+
54+
## Documentation
55+
56+
- [ERC4337 Specification](https://eips.ethereum.org/EIPS/eip-4337)
57+
- [ERC7579 Specification](https://eips.ethereum.org/EIPS/eip-7579)
58+
- [Integration Guide](https://docs.etherspot.dev)
59+
60+
## License
61+
62+
MIT
63+
64+
[npm-image]: https://badge.fury.io/js/%40etherspot%2Flite-contracts.svg
65+
[npm-url]: https://npmjs.org/package/@etherspot/lite-contracts
66+
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reporting security issues
2+
3+
If you think you have found a security vulnerability, please send an email to [security@etherspot.io](mailto:security@etherspot.io). This address can be used for all of Etherspot's open source (including but not limited to SDK, Prime SDK, BUIDler, React Etherspot Kit).
4+
5+
Etherspot will send you a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
6+
7+
**Important:** We ask you to not disclose the vulnerability before it have been fixed and announced, unless you received a response from the Etherspot security team that you can do so.

0 commit comments

Comments
 (0)