From ecede4a9ae8eae3015e6dbc04d203ad7c0c66c6b Mon Sep 17 00:00:00 2001 From: Anton Cheng Date: Wed, 25 Oct 2023 12:09:21 +0800 Subject: [PATCH] build: add deployment simple skeleton --- foundry.toml | 3 +++ script/Counter.s.sol | 12 --------- script/Deploy.s.sol | 60 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 12 deletions(-) delete mode 100644 script/Counter.s.sol create mode 100644 script/Deploy.s.sol diff --git a/foundry.toml b/foundry.toml index 25b918f..58fb607 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,3 +4,6 @@ out = "out" libs = ["lib"] # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options + +[netrpc_endpointsworks] +op_goerli = "https://endpoints.omniatech.io/v1/op/goerli/public" diff --git a/script/Counter.s.sol b/script/Counter.s.sol deleted file mode 100644 index 1a47b40..0000000 --- a/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Script, console2} from "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol new file mode 100644 index 0000000..6a259e3 --- /dev/null +++ b/script/Deploy.s.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Script, console2} from "forge-std/Script.sol"; +import {LyraSelfPayingForwarder} from "src/gelato/LyraSelfPayingForwarder.sol"; +import {LyraSponsoredForwarder} from "src/gelato/LyraSponsoredForwarder.sol"; + + +contract Deploy is Script { + function setUp() public {} + + struct DeploymentConfig { + address trustedForwarder; + address usdcLocal; + address usdcRemote; + address bridge; + address socketVault; + } + + function run() public { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + vm.startBroadcast(deployerPrivateKey); + + address deployer = vm.addr(deployerPrivateKey); + console2.log("Start deploying core contracts! deployer: ", deployer); + + DeploymentConfig memory config = _getConfig(); + + // deploy LyraSponsoredForwarder + LyraSponsoredForwarder sponsoredForwarder = new LyraSponsoredForwarder( + config.trustedForwarder, + config.usdcLocal, + config.usdcRemote, + config.bridge, + config.socketVault + ); + + console2.log("LyraSponsoredForwarder deployed at: ", address(sponsoredForwarder)); + + + vm.stopBroadcast(); + } + + function _getConfig() internal returns (DeploymentConfig memory) { + + uint opgoerli = 420; + + if (block.chainid == opgoerli) { + return DeploymentConfig({ + trustedForwarder: 0xd8253782c45a12053594b9deB72d8e8aB2Fca54c, + usdcLocal: 0xe05606174bac4A6364B31bd0eCA4bf4dD368f8C6, // official USDC op goerli + usdcRemote: 0x0000000000000000000000000000000000000000, // + bridge: 0x0000000000000000000000000000000000000000, // not testing l1 standard bridge on goerli + socketVault: 0x0000000000000000000000000000000000000000 // todo: add socket vault + }); + } + + revert("Need config set! Please set config in script/Deploy.s.sol"); + } +}