diff --git a/broadcast.sh b/broadcast.sh index e7c12c3..e9b951e 100755 --- a/broadcast.sh +++ b/broadcast.sh @@ -5,7 +5,6 @@ else echo "Error: .broadcast.env file not found." fi -verify_arg="" extra_argument="" for arg in "$@"; do @@ -20,6 +19,15 @@ done # Remove the @ character from the end of extra_argument extra_argument="${extra_argument%%@}" +op_command="" +## Check if the private key is stored in the .env file +if [[ ! $extra_argument == *"sender"* ]] && [[ ! $extra_argument == *"trezor"* ]]; then + source .env + if [[ $MAINNET_PK == op* ]] || [[ $TESTNET_PK == op* ]] || [[ $LOCAL_PK == op* ]]; then + op_command="op run --env-file="./.env" --" + fi +fi + echo Broadcast Tx... echo From: ${FROM} echo To: ${TO} @@ -28,4 +36,4 @@ echo GasAmount: ${GAS} echo Calldata: cast pretty-calldata ${CALLDATA} calldata=$(cast calldata 'broadcast(address,address,uint256,uint256,bytes)' ${FROM} ${TO} ${GAS} ${VALUE} ${CALLDATA}) -forge script ${verify_arg} ${@} -g 200 OnchainExecutor --sig 'run(bytes,string)' ${calldata} "${extra_argument}" \ No newline at end of file +${op_command} forge script ${verify_arg} ${@} -g 200 OnchainExecutor --sig 'run(bytes,string)' ${calldata} "${extra_argument}" \ No newline at end of file diff --git a/debug.sh b/debug.sh index dcaeab7..e2659e1 100755 --- a/debug.sh +++ b/debug.sh @@ -5,7 +5,6 @@ else echo "Error: .debug.env file not found." fi -verify_arg="" extra_argument="" for arg in "$@"; do diff --git a/run.sh b/run.sh index 0de149a..47d9932 100755 --- a/run.sh +++ b/run.sh @@ -6,9 +6,17 @@ for arg in "$@"; do --trezor) extra_argument+=trezor@ ;; - --log) - set -- "${@/#--log/}" - extra_argument+=log@ + --disable-postcheck) + set -- "${@/#--disable-postcheck/}" + extra_argument+=no-postcheck@ + ;; + --generate-artifacts) + set -- "${@/#--generate-artifacts/}" + extra_argument+=generate-artifact@ + ;; + -atf) + set -- "${@/#-atf/}" + extra_argument+=generate-artifact@ ;; *) ;; esac @@ -17,5 +25,14 @@ done # Remove the @ character from the end of extra_argument extra_argument="${extra_argument%%@}" +op_command="" +## Check if the private key is stored in the .env file +if [[ ! $extra_argument == *"sender"* ]] && [[ ! $extra_argument == *"trezor"* ]]; then + source .env + if [[ $MAINNET_PK == op* ]] || [[ $TESTNET_PK == op* ]] || [[ $LOCAL_PK == op* ]]; then + op_command="op run --env-file="./.env" --" + fi +fi + calldata=$(cast calldata 'run()') -forge script ${verify_arg} ${@} -g 200 --sig 'run(bytes,string)' ${calldata} "${extra_argument}" +${op_command} forge script ${verify_arg} ${@} -g 200 --sig 'run(bytes,string)' ${calldata} "${extra_argument}" \ No newline at end of file diff --git a/script/configs/RuntimeConfig.sol b/script/configs/RuntimeConfig.sol index 1078ed7..2025a1a 100644 --- a/script/configs/RuntimeConfig.sol +++ b/script/configs/RuntimeConfig.sol @@ -33,8 +33,9 @@ abstract contract RuntimeConfig is IRuntimeConfig { uint256 length = args.length; for (uint256 i; i < length;) { - if (args[i].eq("log")) _option.log = true; + if (args[i].eq("generate-artifact")) _option.generateArtifact = true; else if (args[i].eq("trezor")) _option.trezor = true; + else if (args[i].eq("no-postcheck")) _option.disablePostcheck = true; else console.log(StdStyle.yellow("Unsupported command: "), args[i]); unchecked { diff --git a/script/interfaces/configs/IRuntimeConfig.sol b/script/interfaces/configs/IRuntimeConfig.sol index 614a288..b3ec019 100644 --- a/script/interfaces/configs/IRuntimeConfig.sol +++ b/script/interfaces/configs/IRuntimeConfig.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.19; interface IRuntimeConfig { struct Option { - bool log; + bool generateArtifact; bool trezor; + bool disablePostcheck; } function isPostChecking() external view returns (bool);