From 0667a2508617b2556233dd042a9f204aa919f26b Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Mon, 19 Aug 2024 18:00:13 +0100 Subject: [PATCH] feat: add deploy script for hedera --- foundry.toml | 2 +- hedera.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 hedera.sh diff --git a/foundry.toml b/foundry.toml index 42fcec1..9e93a91 100644 --- a/foundry.toml +++ b/foundry.toml @@ -6,7 +6,7 @@ src = "src" out = "out" libs = ["lib"] solc = "0.8.23" -evm_version = "paris" +evm_version = "shanghai" [profile.default.fuzz] runs = 1000 diff --git a/hedera.sh b/hedera.sh new file mode 100644 index 0000000..1f91748 --- /dev/null +++ b/hedera.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +while getopts ":c:u:e:k:" opt; do + case $opt in + u) rpc="$OPTARG" + ;; + e) etherscan_key="$OPTARG" + ;; + k) private_key="$OPTARG" + ;; + \?) echo "Invalid option -$OPTARG" >&2 + exit 1 + ;; + esac + + case $OPTARG in + -*) echo "Option $opt needs a valid argument" >&2 + exit 1 + ;; + esac +done + +if [ -z ${private_key+x} ]; +then + echo "private key (-k) is unset" >&2 + exit 1 +fi + +set -euo pipefail + +ROOT=$(dirname $0) +FORGE_SCRIPTS=$ROOT/script + +. $ROOT/.hedera.env + +# Use the RPC environment variable if rpc isn't set. +if [ -z ${rpc+x} ]; +then + rpc=$RPC +fi + +# Use the verfifier url environment variable if verifier_url isn't set. +if [ -z ${verifier_url+x} ]; +then + verifier_url=$VERIFIER_URL +fi + +forge script $FORGE_SCRIPTS/DeployOptionMarket.s.sol \ + --rpc-url $rpc \ + --broadcast \ + --private-key $private_key \ + --verify --verifier sourcify --verifier-url $verifier_url \ + --slow \ + --skip test \ No newline at end of file