From a469e107db3a055c93b6416b86551e6820010cc9 Mon Sep 17 00:00:00 2001 From: Geoffrey Hayes Date: Tue, 7 Mar 2023 09:39:28 -0800 Subject: [PATCH 1/4] Add Polygon Deploy Script This patch adds a deploy script for Polygon via GitHub Actions. This should more or less all be the same as our mainnet deployment, just for a different network. --- .../{deploy.yml => deploy-mainnet.yml} | 0 .github/workflows/deploy-polygon.yaml | 45 +++++++++++++++++++ script/polygon/deploy.sh | 28 ++++++++++++ 3 files changed, 73 insertions(+) rename .github/workflows/{deploy.yml => deploy-mainnet.yml} (100%) create mode 100644 .github/workflows/deploy-polygon.yaml create mode 100755 script/polygon/deploy.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-mainnet.yml similarity index 100% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-mainnet.yml diff --git a/.github/workflows/deploy-polygon.yaml b/.github/workflows/deploy-polygon.yaml new file mode 100644 index 0000000..31f9ed4 --- /dev/null +++ b/.github/workflows/deploy-polygon.yaml @@ -0,0 +1,45 @@ +name: Deploy Sleuth [Polygon] + +on: + workflow_dispatch: + inputs: + deployer_address: + description: WalletConnect address to deploy from + required: true + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Deploy Sleuth [Polygon] + runs-on: ubuntu-latest + steps: + - name: Start Seacrest + uses: hayesgm/seacrest@v1 + with: + ethereum_url: "${{ secrets.ETH_POLYGON_URL }}" + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + + - name: Forge Deploy Sleuth [Polygon] + run: script/polygon/deploy.sh + env: + POLYGON_API_KEY: "${{ secrets.POLYGON_API_KEY }}" + ETH_FROM: "${{ inputs.deployer_address }}" + RPC_URL: "http://localhost:8585" diff --git a/script/polygon/deploy.sh b/script/polygon/deploy.sh new file mode 100755 index 0000000..00d72a7 --- /dev/null +++ b/script/polygon/deploy.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -exo pipefail + +if [ -n "$ETHEREUM_PK" ]; then + wallet_args="--private-key $ETHEREUM_PK" +else + wallet_args="--unlocked" +fi + +if [ -n "$RPC_URL" ]; then + rpc_args="--rpc-url $RPC_URL" +else + rpc_args="" +fi + +if [ -n "$POLYGON_API_KEY" ]; then + etherscan_args="--verify --etherscan-api-key $POLYGON_API_KEY" +else + etherscan_args="" +fi + +forge create \ + $rpc_args \ + $etherscan_args \ + $wallet_args \ + $@ \ + src/Sleuth.sol:Sleuth From 72bde18808304a4fa9c5845e90ca75eadb829345 Mon Sep 17 00:00:00 2001 From: Geoffrey Hayes Date: Tue, 7 Mar 2023 09:44:52 -0800 Subject: [PATCH 2/4] Temp PR --- .github/workflows/deploy-polygon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-polygon.yaml b/.github/workflows/deploy-polygon.yaml index 31f9ed4..13e2c67 100644 --- a/.github/workflows/deploy-polygon.yaml +++ b/.github/workflows/deploy-polygon.yaml @@ -1,6 +1,7 @@ name: Deploy Sleuth [Polygon] on: + pull_request: workflow_dispatch: inputs: deployer_address: From 1aa8a9fd55effcce97f2a0a75b3b758c9fe1909e Mon Sep 17 00:00:00 2001 From: Geoffrey Hayes Date: Tue, 7 Mar 2023 09:48:48 -0800 Subject: [PATCH 3/4] Connect to Polygon --- .github/workflows/deploy-polygon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-polygon.yaml b/.github/workflows/deploy-polygon.yaml index 13e2c67..30fcf31 100644 --- a/.github/workflows/deploy-polygon.yaml +++ b/.github/workflows/deploy-polygon.yaml @@ -23,6 +23,7 @@ jobs: uses: hayesgm/seacrest@v1 with: ethereum_url: "${{ secrets.ETH_POLYGON_URL }}" + requested_network: 137 - uses: actions/checkout@v3 with: From 28e5453db006a00d3a5083b83294631a6a878ca7 Mon Sep 17 00:00:00 2001 From: Geoffrey Hayes Date: Tue, 7 Mar 2023 15:11:26 -0800 Subject: [PATCH 4/4] Support Goerli --- .github/workflows/deploy-goerli.yml | 47 +++++++++++++++++++ .github/workflows/deploy-mainnet.yml | 2 +- ...deploy-polygon.yaml => deploy-polygon.yml} | 0 script/{mainnet => ethereum}/deploy.sh | 0 script/polygon/deploy.sh | 1 + 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-goerli.yml rename .github/workflows/{deploy-polygon.yaml => deploy-polygon.yml} (100%) rename script/{mainnet => ethereum}/deploy.sh (100%) diff --git a/.github/workflows/deploy-goerli.yml b/.github/workflows/deploy-goerli.yml new file mode 100644 index 0000000..99137c1 --- /dev/null +++ b/.github/workflows/deploy-goerli.yml @@ -0,0 +1,47 @@ +name: Deploy Sleuth [Goerli] + +on: + pull_request: + workflow_dispatch: + inputs: + deployer_address: + description: WalletConnect address to deploy from + required: true + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Deploy Sleuth [Goerli] + runs-on: ubuntu-latest + steps: + - name: Start Seacrest + uses: hayesgm/seacrest@v1 + with: + ethereum_url: "${{ secrets.ETH_GOERLI_URL }}" + requested_network: 5 + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + + - name: Forge Deploy Sleuth [Goerli] + run: script/ethereum/deploy.sh + env: + GOERLI_API_KEY: "${{ secrets.GOERLI_API_KEY }}" + ETH_FROM: "${{ inputs.deployer_address }}" + RPC_URL: "http://localhost:8585" diff --git a/.github/workflows/deploy-mainnet.yml b/.github/workflows/deploy-mainnet.yml index ed9c251..1c27ee1 100644 --- a/.github/workflows/deploy-mainnet.yml +++ b/.github/workflows/deploy-mainnet.yml @@ -38,7 +38,7 @@ jobs: forge build --sizes - name: Forge Deploy Sleuth [Mainnet] - run: script/mainnet/deploy.sh + run: script/ethereum/deploy.sh env: ETHERSCAN_API_KEY: "${{ secrets.ETHERSCAN_API_KEY }}" ETH_FROM: "${{ inputs.deployer_address }}" diff --git a/.github/workflows/deploy-polygon.yaml b/.github/workflows/deploy-polygon.yml similarity index 100% rename from .github/workflows/deploy-polygon.yaml rename to .github/workflows/deploy-polygon.yml diff --git a/script/mainnet/deploy.sh b/script/ethereum/deploy.sh similarity index 100% rename from script/mainnet/deploy.sh rename to script/ethereum/deploy.sh diff --git a/script/polygon/deploy.sh b/script/polygon/deploy.sh index 00d72a7..6a8e4de 100755 --- a/script/polygon/deploy.sh +++ b/script/polygon/deploy.sh @@ -26,3 +26,4 @@ forge create \ $wallet_args \ $@ \ src/Sleuth.sol:Sleuth +s \ No newline at end of file