From 076159b638c3a6b2456b61ae8579c3eda4b22bed Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 12 Sep 2024 00:44:51 +0400 Subject: [PATCH] deploy --- .gitignore | 1 + package.json | 5 +++-- script/Deploy.s.sol | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 script/Deploy.s.sol diff --git a/.gitignore b/.gitignore index b98b0c4..90a3bfb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ forge-cache/ !/broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ +/broadcast # Docs docs/ diff --git a/package.json b/package.json index ea650c7..6228efb 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "author": "P2P Validator ", "license": "MIT", "scripts": { - "01-test-send-user-operation": "ts-node 01-test-send-user-operation.ts" + "01-test-send-user-operation": "ts-node 01-test-send-user-operation.ts", + "deploy": "forge script script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain holesky --json --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvvvv" }, "dependencies": { "@types/node": "22.5.4", @@ -15,4 +16,4 @@ "typescript": "5.6.2", "viem": "2.21.4" } -} +} \ No newline at end of file diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol new file mode 100644 index 0000000..3cc5e86 --- /dev/null +++ b/script/Deploy.s.sol @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: 2024 P2P Validator +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.17; + +import {Script} from "forge-std/Script.sol"; +import "../src/proofSubmitterFactory/ProofSubmitterFactory.sol"; +import "../src/proofSubmitter/ProofSubmitter.sol"; + +contract Deploy is Script { + function run() + external + returns (ProofSubmitterFactory factory, ProofSubmitter proofSubmitter) + { + uint256 deployerKey = vm.envUint("PRIVATE_KEY"); + + vm.startBroadcast(deployerKey); + factory = new ProofSubmitterFactory(); + proofSubmitter = factory.createProofSubmitter{value: 0.01 ether}(); + vm.stopBroadcast(); + + return (factory, proofSubmitter); + } +}