Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime-config): implement rename-flags #109

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions broadcast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ else
echo "Error: .broadcast.env file not found."
fi

verify_arg=""
extra_argument=""

for arg in "$@"; do
Expand All @@ -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}
Expand All @@ -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}"
${op_command} forge script ${verify_arg} ${@} -g 200 OnchainExecutor --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
1 change: 0 additions & 1 deletion debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ else
echo "Error: .debug.env file not found."
fi

verify_arg=""
extra_argument=""

for arg in "$@"; do
Expand Down
25 changes: 21 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
3 changes: 2 additions & 1 deletion script/configs/RuntimeConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion script/interfaces/configs/IRuntimeConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading