forked from alchemyplatform/light-account
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update config, validate init code hash
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
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,3 +1,4 @@ | ||
# Foundry build and cache directories | ||
out/ | ||
cache/ | ||
.env |
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,59 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
import {IEntryPoint} from "account-abstraction/interfaces/IEntryPoint.sol"; | ||
|
||
import {LightAccountFactory} from "../src/LightAccountFactory.sol"; | ||
|
||
// @notice Deploys LightAccountFactory to the address `0x006A000bb900dC0781A5290e210F000000e92200` | ||
// @dev Note: EntryPoint must be at 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 | ||
// @dev To run: `forge script script/Deploy_LightAccountFactory.s.sol:Deploy_LightAccountFactory --broadcast --rpc-url ${RPC_URL} --verify -vvvv` | ||
contract Deploy_LightAccountFactory is Script { | ||
error InitCodeHashMismatch(bytes32 initCodeHash); | ||
error DeployedAddressMismatch(address deployed); | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = uint256(vm.envBytes32("DEPLOYER_PRIVATE_KEY")); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// Using entryPoint: 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789 | ||
// Correct as of Oct 3 2023, from https://docs.alchemy.com/reference/eth-supportedentrypoints | ||
IEntryPoint entryPoint = IEntryPoint(payable(0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789)); | ||
|
||
// Init code hash check | ||
bytes32 initCodeHash = keccak256( | ||
abi.encodePacked(type(LightAccountFactory).creationCode, bytes32(uint256(uint160(address(entryPoint))))) | ||
); | ||
|
||
if (initCodeHash != 0x3043a72812fec9b9987853a9b869c1a469dc6e04b0f80da3af2ecb8cf8eed209) { | ||
revert InitCodeHashMismatch(initCodeHash); | ||
} | ||
|
||
console.log("********************************"); | ||
console.log("******** Deploy Inputs *********"); | ||
console.log("********************************"); | ||
console.log("Entrypoint Address is:"); | ||
console.logAddress(address(entryPoint)); | ||
console.log("********************************"); | ||
console.log("******** Deploy ...... *********"); | ||
console.log("********************************"); | ||
|
||
LightAccountFactory factory = | ||
new LightAccountFactory{salt: 0x00000000000000000000000000000000000000007845d3459c316000001d6f83}(entryPoint); | ||
|
||
// Deployed address check | ||
if (address(factory) != 0x000000893A26168158fbeaDD9335Be5bC96592E2) { | ||
revert DeployedAddressMismatch(address(factory)); | ||
} | ||
|
||
console.log("LightAccountFactory address:"); | ||
console.logAddress(address(factory)); | ||
|
||
console.log("Implementation address:"); | ||
console.logAddress(address(factory.accountImplementation())); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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