From 0755c2927ffcbeefa654af9dd05baf3c79031fa0 Mon Sep 17 00:00:00 2001 From: Sahil Vasava Date: Thu, 13 Jul 2023 00:53:27 +0200 Subject: [PATCH] feat: added DeployMultiECDSAKernelFactory script --- scripts/DeployMultiECDSAKernelFactory.s.sol | 32 +++++++++++++++++++++ scripts/DeploySessionKey.s.sol | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 scripts/DeployMultiECDSAKernelFactory.s.sol diff --git a/scripts/DeployMultiECDSAKernelFactory.s.sol b/scripts/DeployMultiECDSAKernelFactory.s.sol new file mode 100644 index 00000000..8e0b94da --- /dev/null +++ b/scripts/DeployMultiECDSAKernelFactory.s.sol @@ -0,0 +1,32 @@ +pragma solidity ^0.8.0; + +import "src/factory/KernelFactory.sol"; +import "src/validator/MultiECDSAValidator.sol"; +import "src/factory/MultiECDSAKernelFactory.sol"; +import "forge-std/Script.sol"; +import "forge-std/console.sol"; +contract DeployMultiECDSAKernelFactory is Script { + address internal constant DETERMINISTIC_CREATE2_FACTORY = 0x7A0D94F55792C434d74a40883C6ed8545E406D12; + function run() public { + uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY"); + vm.startBroadcast(key); + + bytes memory bytecode; + bool success; + bytes memory returnData; + + bytecode = type(MultiECDSAValidator).creationCode; + (success, returnData) = DETERMINISTIC_CREATE2_FACTORY.call(abi.encodePacked(bytecode)); + require(success, "Failed to deploy MultiECDSAValidator"); + address validator = address(bytes20(returnData)); + console.log("MultiECDSAValidator deployed at: %s", validator); + + bytecode = type(MultiECDSAKernelFactory).creationCode; + (success, returnData) = DETERMINISTIC_CREATE2_FACTORY.call(abi.encodePacked(bytecode, abi.encode(KernelFactory(0x5D006d3880645ec6e254E18C1F879DAC9Dd71A39)), abi.encode(validator), abi.encode(IEntryPoint(0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789)))); + require(success, "Failed to deploy MultiECDSAKernelFactory"); + address multiEcdsaFactory = address(bytes20(returnData)); + console.log("MultiECDSAKernelFactory deployed at: %s", multiEcdsaFactory); + vm.stopBroadcast(); + } +} + diff --git a/scripts/DeploySessionKey.s.sol b/scripts/DeploySessionKey.s.sol index ac521b38..d7eec008 100644 --- a/scripts/DeploySessionKey.s.sol +++ b/scripts/DeploySessionKey.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import "src/factory/KernelFactory.sol"; import "src/validator/ECDSAValidator.sol"; import "src/factory/ECDSAKernelFactory.sol"; -import "src/executor/ERC721Actions.sol"; +import "src/executor/TokenActions.sol"; import "src/validator/ERC165SessionKeyValidator.sol"; import "forge-std/Script.sol"; import "forge-std/console.sol"; @@ -12,7 +12,7 @@ contract DeploySessionKey is Script { function run() public { uint256 key = vm.envUint("DEPLOYER_PRIVATE_KEY"); vm.startBroadcast(key); - ERC721Actions action = new ERC721Actions(); + TokenActions action = new TokenActions(); bytes memory bytecode = type(ERC165SessionKeyValidator).creationCode; (bool success, bytes memory returnData) = DETERMINISTIC_CREATE2_FACTORY.call(abi.encodePacked(bytecode, abi.encode(action)));