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

EIP-6551 compat #27

Merged
merged 43 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
23c3a86
upgrade to latest account-abstraction contracts
jfschwarz Apr 26, 2023
f76da22
fix package json
jfschwarz May 10, 2023
4170293
adjust tests
jfschwarz May 10, 2023
4e7cf06
trial to fix vercel routes
jfschwarz May 10, 2023
217223d
fix deploy script for gnosis chain
jfschwarz May 11, 2023
6e53bb0
implement IERC6551Account
jfschwarz May 30, 2023
3d6d79d
restructure contract inheritance hierarchy
jfschwarz Jun 7, 2023
203d1d2
add mech factory
jfschwarz Jun 7, 2023
1f67b0c
refactor contracts
jfschwarz Jun 12, 2023
de98dec
add erc20 threshold mech
jfschwarz Jun 12, 2023
c749149
cleanup
jfschwarz Jun 12, 2023
e264243
update docs
jfschwarz Jun 12, 2023
06d0971
adjust all deploy functions and migrate them to viem
jfschwarz Jun 14, 2023
b608faa
add hierarchy graph
jfschwarz Jun 20, 2023
139d356
adding exports
jfschwarz Jul 13, 2023
f8436f9
Merge branch 'main' into erc-6551
jfschwarz Aug 18, 2023
52484d9
fixes after merge
jfschwarz Aug 18, 2023
cdab142
upgrade deps
jfschwarz Aug 18, 2023
98c79c1
6551 updates and prevent ownership cycles
jfschwarz Aug 21, 2023
eb19c39
fine-tune execution interface
jfschwarz Aug 21, 2023
81dbd52
upgrade tooling
jfschwarz Aug 21, 2023
00304e4
ethers v5 -> v6 migration
jfschwarz Aug 21, 2023
8d249e6
erc165
jfschwarz Aug 21, 2023
a5a32fe
tokenbound deterministic deployment test green
jfschwarz Aug 25, 2023
cd7e95d
update 4337 entrypoint address
jfschwarz Aug 25, 2023
4167db5
fix 4337 tests
jfschwarz Aug 25, 2023
f399e1d
fix missing onlyOperator annotation
jfschwarz Aug 25, 2023
ee82d3f
improve test coverage
jfschwarz Aug 25, 2023
c2f8e3c
test fixes
jfschwarz Aug 28, 2023
a39dc16
front-end updates
jfschwarz Aug 28, 2023
5186a9c
fix deploy scripts
jfschwarz Aug 28, 2023
9fe7e05
migrate from n.xyz to sequencer
jfschwarz Sep 1, 2023
9f371eb
Merge pull request #28 from gnosis/sequencer
jfschwarz Sep 1, 2023
c57769b
deploy 6551 factory
jfschwarz Sep 4, 2023
3198123
more solid deploy script
jfschwarz Sep 4, 2023
1381bd4
fix wallet connect
jfschwarz Sep 4, 2023
63edc04
fix a JS error when switching chains
jfschwarz Oct 12, 2023
7354c08
work around issue of tokenID not being set by sequence api
jfschwarz Oct 12, 2023
0c7cc8c
fix walletconnect v2 issues
jfschwarz Oct 12, 2023
3ca7ec0
fix a ux issue
jfschwarz Oct 12, 2023
bf94f2e
upgrade to latest 6551 contract and adjust accordingly
jfschwarz Oct 13, 2023
11e9b4d
fix tests
jfschwarz Oct 13, 2023
39ef6c7
update eip6551 registry address
jfschwarz Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
upgrade to latest account-abstraction contracts
  • Loading branch information
jfschwarz committed Apr 26, 2023
commit 23c3a866549a7f4607bbb3da84dde18d5d0be71b
25 changes: 7 additions & 18 deletions contracts/base/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ abstract contract Account is BaseAccount {
// return value in case of signature validation success, with no time-range.
uint256 private constant SIG_VALIDATION_SUCCEEDED = 0;

uint256 private _nonce = 0;

/**
* @dev Hard-code the ERC4337 entry point contract address for gas efficiency
* @dev Hard-code the ERC4337 entry point contract address so it cannot be changed by anyone
*/
IEntryPoint private constant _entryPoint =
IEntryPoint(0x0576a174D229E3cFA37253523E645A78A0C91B57);

/// @inheritdoc BaseAccount
function nonce() public view virtual override returns (uint256) {
return _nonce;
function entryPoint() public view virtual override returns (IEntryPoint) {
return _entryPoint;
}

/// @inheritdoc BaseAccount
function entryPoint() public view virtual override returns (IEntryPoint) {
return _entryPoint;
function _validateNonce(uint256 nonce) internal view virtual override {
// First 192 bits are the sequence key, remaining 64 bits are the sequence number
// We only use the nonce sequence with key 0, so no out-of-order nonce is possible.
require(nonce < type(uint64).max, "Invalid nonce");
}

/**
Expand Down Expand Up @@ -59,15 +59,4 @@ abstract contract Account is BaseAccount {
bytes32 hash,
bytes memory signature
) public view virtual returns (bytes4 magicValue);

/**
* @dev Validate the current nonce matches the UserOperation nonce, then increment nonce to prevent replay of this user operation.
* Called only if initCode is empty (since "nonce" field is used as "salt" on account creation)
* @param userOp The user operation to validate.
*/
function _validateAndUpdateNonce(
UserOperation calldata userOp
) internal virtual override {
require(_nonce++ == userOp.nonce, "Invalid nonce");
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"homepage": "https://github.com/gnosis/mech#readme",
"devDependencies": {
"@account-abstraction/contracts": "^0.5.0",
"@account-abstraction/contracts": "^0.6.0",
"@ambire/signature-validator": "^1.1.0",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ __metadata:
version: 6
cacheKey: 8

"@account-abstraction/contracts@npm:^0.5.0":
version: 0.5.0
resolution: "@account-abstraction/contracts@npm:0.5.0"
checksum: 792a82e9ac3dac2d0c6b92133998b567acfc980aea6bb6d51377d95039a2a4c8cbd764c02ebe4d16ea7f7e18ff0724a0ae41970ba2b1bbcaf89e9bf875806ec5
"@account-abstraction/contracts@npm:^0.6.0":
version: 0.6.0
resolution: "@account-abstraction/contracts@npm:0.6.0"
checksum: 745e838e2cb04c89a9c0df11d022c1d604b1e440c9cd65c2014edd9b1056809fec2e363b42ec09883d49dbe09f9597d8339c90d57763a1621fb515edf5fef35d
languageName: node
linkType: hard

Expand Down Expand Up @@ -14042,7 +14042,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "mech-contracts@workspace:."
dependencies:
"@account-abstraction/contracts": ^0.5.0
"@account-abstraction/contracts": ^0.6.0
"@ambire/signature-validator": ^1.1.0
"@ethersproject/abi": ^5.7.0
"@ethersproject/bytes": ^5.7.0
Expand Down