-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
347 additions
and
181 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
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 was deleted.
Oops, something went wrong.
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,8 +1,88 @@ | ||
import "../SafeERC7579.sol"; | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity ^0.8.0; | ||
|
||
import { ISafe, SafeERC7579 } from "../SafeERC7579.sol"; | ||
|
||
/** | ||
* Helper contract that gets delegatecalled byt SafeProxy.setup() to setup safe7579 as a module | ||
* (safe module) | ||
* as well as initializing Safe7579 for the SafeProxy | ||
*/ | ||
contract Safe7579Launchpad { | ||
address immutable safe7579Singleton; | ||
|
||
constructor(address _safe7579Singleton) { | ||
safe7579Singleton = _safe7579Singleton; | ||
} | ||
|
||
contract Launchpad { | ||
function initSafe7579(address safe7579, bytes calldata safe7579InitCode) public { | ||
ISafe(address(this)).enableModule(safe7579); | ||
SafeERC7579(payable(safe7579)).initializeAccount(safe7579InitCode); | ||
} | ||
|
||
function predictSafeAddress( | ||
address singleton, | ||
address safeProxyFactory, | ||
bytes memory creationCode, | ||
bytes32 salt, | ||
bytes memory initializer | ||
) | ||
external | ||
pure | ||
returns (address safeProxy) | ||
{ | ||
salt = keccak256(abi.encodePacked(keccak256(initializer), salt)); | ||
|
||
safeProxy = address( | ||
uint160( | ||
uint256( | ||
keccak256( | ||
abi.encodePacked( | ||
bytes1(0xff), | ||
address(safeProxyFactory), | ||
salt, | ||
keccak256( | ||
abi.encodePacked(creationCode, uint256(uint160(address(singleton)))) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
|
||
function getInitCode( | ||
address[] memory signers, | ||
uint256 threshold, | ||
address[] calldata validators, | ||
bytes[] calldata validatorsInitCode, | ||
address[] calldata executors, | ||
bytes[] calldata executorsInitCode | ||
) | ||
external | ||
view | ||
returns (bytes memory initCode) | ||
{ | ||
bytes memory safeLaunchPadSetup = abi.encodeCall( | ||
this.initSafe7579, | ||
( | ||
address(safe7579Singleton), | ||
abi.encode(validators, validatorsInitCode, executors, executorsInitCode) | ||
) | ||
); | ||
// SETUP SAFE | ||
initCode = abi.encodeCall( | ||
ISafe.setup, | ||
( | ||
signers, | ||
threshold, | ||
address(this), | ||
safeLaunchPadSetup, | ||
safe7579Singleton, | ||
address(0), | ||
0, | ||
payable(address(0)) | ||
) | ||
); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
accounts/safe7579/src/utils/SignatureValidatorConstants.sol
This file was deleted.
Oops, something went wrong.
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.