This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Demonstrate SafeECDSAPlugin in in-page wallet #97
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e9bcf54
Refactor to support different account types
voltrevo 1742456
Import SafeECDSAPlugin via symlink
voltrevo 18ecdf4
Include EntryPoint in deployment
voltrevo 5b77226
Add sendEth task and document it for bundler
voltrevo 8e5b734
Remove unused method
voltrevo 4a2812a
Add Safe, SafeProxyFactory to deployed contracts
voltrevo edcae48
SafeECDSAFactory, consolidate on non-4337 creation
voltrevo cd6487f
Use deterministic addresses instead of config
voltrevo 035403b
SafeECDSAAccountWrapper
voltrevo 8dea0e3
Enable choosing account type
voltrevo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
ERC4337_TEST_BUNDLER_URL=http://localhost:3000/rpc | ||
ERC4337_TEST_NODE_URL=http://localhost:8545 | ||
ERC4337_TEST_SINGLETON_ADDRESS=0x1CD01F9a3174866c8C89467cb34804E1D5078AC3 | ||
ERC4337_TEST_SAFE_FACTORY_ADDRESS=0xDefeAee1F5188da39dab724a95eE0B347c598577 | ||
MNEMONIC="test test test test test test test test test test test junk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity >=0.7.0 <0.9.0; | ||
pragma abicoder v2; | ||
|
||
import {Safe} from "safe-contracts/contracts/Safe.sol"; | ||
import {SafeProxyFactory} from "safe-contracts/contracts/proxies/SafeProxyFactory.sol"; | ||
import {SafeProxy} from "safe-contracts/contracts/proxies/SafeProxy.sol"; | ||
|
||
import {EntryPoint} from "account-abstraction/contracts/core/EntryPoint.sol"; | ||
|
||
import {SafeECDSAPlugin} from "./SafeECDSAPlugin.sol"; | ||
|
||
contract SafeECDSAFactory { | ||
function create( | ||
Safe safeSingleton, | ||
EntryPoint entryPoint, | ||
address owner, | ||
uint256 saltNonce | ||
) external returns (SafeECDSAPlugin) { | ||
bytes32 salt = keccak256(abi.encodePacked(owner, saltNonce)); | ||
|
||
Safe safe = Safe(payable(new SafeProxy{salt: salt}( | ||
address(safeSingleton) | ||
))); | ||
|
||
address[] memory owners = new address[](1); | ||
owners[0] = owner; | ||
|
||
SafeECDSAPlugin plugin = new SafeECDSAPlugin{salt: salt}( | ||
address(entryPoint), | ||
owner | ||
); | ||
|
||
safe.setup( | ||
owners, | ||
1, | ||
address(plugin), | ||
abi.encodeCall(SafeECDSAPlugin.enableMyself, ()), | ||
address(plugin), | ||
address(0), | ||
0, | ||
payable(address(0)) | ||
); | ||
|
||
return SafeECDSAPlugin(address(safe)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably fine, but bumping solidity versions should be a considered step. If we're using a library that was audited for a particular version of compiler, we should keep that version of compiler in the list, and add any later additional versions (like we did in blswallet for blslibs).
(Related: #94)