-
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathDeployEIP7702StatelessDeleGator.s.sol
More file actions
50 lines (41 loc) · 1.92 KB
/
DeployEIP7702StatelessDeleGator.s.sol
File metadata and controls
50 lines (41 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: MIT AND Apache-2.0
pragma solidity ^0.8.23;
import "forge-std/Script.sol";
import { console2 } from "forge-std/console2.sol";
import { IEntryPoint } from "@account-abstraction/interfaces/IEntryPoint.sol";
import { EIP7702StatelessDeleGator } from "../src/EIP7702/EIP7702StatelessDeleGator.sol";
import { IDelegationManager } from "../src/interfaces/IDelegationManager.sol";
/**
* @title DeployEIP7702StatelessDeleGator.s.sol
* @notice Deploys the required contracts for the EIP7702 StatelessDeleGator to function.
* @dev These contracts are likely already deployed on a testnet or mainnet as many are singletons.
* @dev run the script with:
* forge script script/DeployEIP7702StatelessDeleGator.s.sol --rpc-url <your_rpc_url> --private-key $PRIVATE_KEY --broadcast
*/
contract DeployEIP7702StatelessDeleGator is Script {
bytes32 salt;
IEntryPoint entryPoint;
IDelegationManager delegationManager;
address deployer;
function setUp() public {
salt = bytes32(abi.encodePacked(vm.envString("SALT")));
entryPoint = IEntryPoint(vm.envAddress("ENTRYPOINT_ADDRESS"));
delegationManager = IDelegationManager(vm.envAddress("DELEGATION_MANAGER_ADDRESS"));
deployer = msg.sender;
console2.log("~~~");
console2.log("Deployer: %s", address(deployer));
console2.log("Entry Point: %s", address(entryPoint));
console2.log("Delegation Manager: %s", address(delegationManager));
console2.log("Salt:");
console2.logBytes32(salt);
}
function run() public {
console2.log("~~~");
vm.startBroadcast();
address deployedAddress;
// Deploy EIP7702StatelessDeleGator
deployedAddress = address(new EIP7702StatelessDeleGator{ salt: salt }(IDelegationManager(delegationManager), entryPoint));
console2.log("EIP7702StatelessDeleGatorImpl: %s", deployedAddress);
vm.stopBroadcast();
}
}