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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate SafeECDSAPlugin in in-page wallet (#97)
* Refactor to support different account types * Import SafeECDSAPlugin via symlink * Include EntryPoint in deployment * Add sendEth task and document it for bundler * Remove unused method * Add Safe, SafeProxyFactory to deployed contracts * SafeECDSAFactory, consolidate on non-4337 creation * Use deterministic addresses instead of config * SafeECDSAAccountWrapper * Enable choosing account type
- Loading branch information
Showing
27 changed files
with
1,047 additions
and
397 deletions.
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
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
Oops, something went wrong.