diff --git a/archive/scripts/Tasks/diamondMakeImmutable.sh b/archive/scripts/Tasks/diamondMakeImmutable.sh index 281c8dbb9..7c959f565 100755 --- a/archive/scripts/Tasks/diamondMakeImmutable.sh +++ b/archive/scripts/Tasks/diamondMakeImmutable.sh @@ -13,7 +13,7 @@ diamondMakeImmutable() { FILE_SUFFIX=$(getFileSuffix "$ENVIRONMENT") # get user-selected network from list - NETWORK=$(cat ./networks | gum filter --placeholder "Network") + NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") checkRequiredVariablesInDotEnv $NETWORK # define path of JSON file to get diamond address from diff --git a/archive/scripts/removeUnusableFunctionsForImmutable.sh b/archive/scripts/removeUnusableFunctionsForImmutable.sh index a62e747ba..5ee75a6f8 100755 --- a/archive/scripts/removeUnusableFunctionsForImmutable.sh +++ b/archive/scripts/removeUnusableFunctionsForImmutable.sh @@ -17,7 +17,7 @@ removeUnusableFunctionsForImmutable() { ENVIRONMENT="$2" # get user-selected network from list - NETWORK=$(cat ./networks | gum filter --placeholder "Network") + NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") if [[ -z "$NETWORK" ]]; then error "invalid selection - exiting script" exit 1 diff --git a/config/dexs.json b/config/dexs.json index 0840e0d96..d08ff5706 100644 --- a/config/dexs.json +++ b/config/dexs.json @@ -845,7 +845,8 @@ "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D", "0xadf8d87723ec7f011ae56ddd6dc10fa8b2c3863a", - "0x85CD07Ea01423b1E937929B44E4Ad8c40BbB5E71" + "0x85CD07Ea01423b1E937929B44E4Ad8c40BbB5E71", + "0x3925eFbD0C1d9c119eC771649052eed7587094AA" ], "taiko": [ "0xDd8A081efC90DFFD79940948a1528C51793C4B03", @@ -906,7 +907,7 @@ "0x4000f76450d9d40558fd60F66863F583B7A5BCCb", "0xb9061e38fee7d30134f56aef7117e2f6d1580666", "0xc67879F4065d3B9fe1C09EE990B891Aa8E3a4c2f", - "0x70487a4CB3e097B90699e4B5AA35D75f2b7ad160" + "0xE6fD46600A97CE06703b58333B9C2399F4bF6FEc" ], "---------------FROM HERE ON JUST OLD NETWORKS - PLEASE ADD NEW NETWORKS ABOVE IN ALPHABETICAL ORDER ^^^^ ----------": [], "goerli": [ diff --git a/config/relay.json b/config/relay.json index a0d4b2fc3..9eb724b81 100644 --- a/config/relay.json +++ b/config/relay.json @@ -118,6 +118,11 @@ "relayReceiver": "0x7f4babd2c7d35221e72ab67ea72cba99573a0089", "relaySolver": "0xf70da97812CB96acDF810712Aa562db8dfA3dbEF" }, + "sonic": { + "chainId": 146, + "relayReceiver": "0x7f4babd2c7d35221e72ab67ea72cba99573a0089", + "relaySolver": "0xf70da97812CB96acDF810712Aa562db8dfA3dbEF" + }, "taiko": { "chainId": 167000, "relayReceiver": "0xa06e1351e2fd2d45b5d35633ca7ecf328684a109", diff --git a/config/stargateV2.json b/config/stargateV2.json index 05163cca6..47e6a2d94 100644 --- a/config/stargateV2.json +++ b/config/stargateV2.json @@ -39,6 +39,7 @@ "mode": "0x1a44076050125825900e736c501f859c50fE728c", "mantle": "0x1a44076050125825900e736c501f859c50fE728c", "soneium": "0x4bcb6a963a9563c33569d7a512d35754221f3a19", + "sonic": "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B", "scroll": "0x1a44076050125825900e736c501f859c50fE728c", "taiko": "0x1a44076050125825900e736c501f859c50fE728c", "xlayer": "0x0000000000000000000000000000000000000000", @@ -50,6 +51,7 @@ }, "tokenMessaging": { "LinkToDeployedToAddresses": "https://stargateprotocol.gitbook.io/stargate/v/v2-developer-docs/technical-reference/mainnet-contracts", + "LinkToDeployedToAddressesAlternative": "https://github.com/stargate-protocol/stargate-v2/tree/main/packages/stg-evm-v2/deployments", "mainnet": "0x6d6620eFa72948C5f68A3C8646d58C00d3f4A980", "berachain": "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", "bsc": "0x6e3d884c96d640526f273c61dfcf08915ebd7e2b", @@ -74,6 +76,7 @@ "sei": "0x1502FA4be69d526124D453619276FacCab275d3D", "scroll": "0x4e422b0acb2bd7e3ac70b5c0e5eb806e86a94038", "soneium": "0xAF54BE5B6eEc24d6BFACf1cce4eaF680A8239398", + "sonic": "0x2086f755A6d9254045C257ea3d382ef854849B0f", "taiko": "0x45d417612e177672958dC0537C45a8f8d754Ac2E", "zksync": "---comingSoon---" } diff --git a/deployments/_deployments_log_file.json b/deployments/_deployments_log_file.json index 44f97894e..5e5d74c26 100644 --- a/deployments/_deployments_log_file.json +++ b/deployments/_deployments_log_file.json @@ -25478,6 +25478,20 @@ } ] } + }, + "sonic": { + "production": { + "1.0.1": [ + { + "ADDRESS": "0x8D4cE7275C269FA5a7E9ca76EA146e01bc0fC540", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2025-02-25 15:55:35", + "CONSTRUCTOR_ARGS": "0x0000000000000000000000002086f755a6d9254045c257ea3d382ef854849b0f", + "SALT": "", + "VERIFIED": "true" + } + ] + } } }, "ReceiverStargateV2": { @@ -25814,6 +25828,20 @@ } ] } + }, + "sonic": { + "production": { + "1.1.0": [ + { + "ADDRESS": "0xB05796e54CfADA2C4F7771A0553D6538DD66Ba9a", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2025-02-25 15:55:50", + "CONSTRUCTOR_ARGS": "0x000000000000000000000000156cebba59deb2cb23742f70dcb0a11cc775591f0000000000000000000000001b874aae59d738079fe3e4f7d90b5793d3a514810000000000000000000000002086f755a6d9254045c257ea3d382ef854849b0f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b00000000000000000000000000000000000000000000000000000000000186a0", + "SALT": "", + "VERIFIED": "true" + } + ] + } } }, "LiFiDEXAggregator": { @@ -29675,6 +29703,20 @@ } ] } + }, + "sonic": { + "production": { + "1.0.0": [ + { + "ADDRESS": "0xd9aeA8f746888739B0A063Fd608851e1195AF8F3", + "OPTIMIZER_RUNS": "1000000", + "TIMESTAMP": "2025-02-25 15:48:35", + "CONSTRUCTOR_ARGS": "0x0000000000000000000000007f4babd2c7d35221e72ab67ea72cba99573a0089000000000000000000000000f70da97812cb96acdf810712aa562db8dfa3dbef", + "SALT": "", + "VERIFIED": "true" + } + ] + } } }, "GetGasFacet": { diff --git a/deployments/sonic.diamond.json b/deployments/sonic.diamond.json index d4862ac10..a9e22c0e0 100644 --- a/deployments/sonic.diamond.json +++ b/deployments/sonic.diamond.json @@ -60,6 +60,14 @@ "0xC8C286F373c5b4a4c6a2D6369003477D76584D7F": { "Name": "SymbiosisFacet", "Version": "1.0.0" + }, + "0xd9aeA8f746888739B0A063Fd608851e1195AF8F3": { + "Name": "RelayFacet", + "Version": "1.0.0" + }, + "0x8D4cE7275C269FA5a7E9ca76EA146e01bc0fC540": { + "Name": "StargateFacetV2", + "Version": "1.0.1" } }, "Periphery": { @@ -72,7 +80,7 @@ "Permit2Proxy": "", "Receiver": "0xbE539601FDf7736A4Dd730008082Bf2C16e6f728", "ReceiverAcrossV3": "", - "ReceiverStargateV2": "", + "ReceiverStargateV2": "0xB05796e54CfADA2C4F7771A0553D6538DD66Ba9a", "RelayerCelerIM": "", "TokenWrapper": "0x51f5A9675A0663C3EC2b46121eB1504687922911" } diff --git a/deployments/sonic.json b/deployments/sonic.json index 2ee2ba399..5f1db95f8 100644 --- a/deployments/sonic.json +++ b/deployments/sonic.json @@ -22,5 +22,8 @@ "TokenWrapper": "0x51f5A9675A0663C3EC2b46121eB1504687922911", "LiFiDEXAggregator": "0xAdf8d87723Ec7f011Ae56DDD6dC10FA8b2C3863A", "GasZipPeriphery": "0x3925eFbD0C1d9c119eC771649052eed7587094AA", - "SymbiosisFacet": "0xC8C286F373c5b4a4c6a2D6369003477D76584D7F" + "SymbiosisFacet": "0xC8C286F373c5b4a4c6a2D6369003477D76584D7F", + "RelayFacet": "0xd9aeA8f746888739B0A063Fd608851e1195AF8F3", + "StargateFacetV2": "0x8D4cE7275C269FA5a7E9ca76EA146e01bc0fC540", + "ReceiverStargateV2": "0xB05796e54CfADA2C4F7771A0553D6538DD66Ba9a" } \ No newline at end of file diff --git a/script/config.example.sh b/script/config.example.sh index b9bebe886..454714087 100644 --- a/script/config.example.sh +++ b/script/config.example.sh @@ -64,8 +64,8 @@ VERIFY_CONTRACTS=true # contract verification will be deactivated for any network listed here DO_NOT_VERIFY_IN_THESE_NETWORKS="gnosis,testNetwork,aurora,localanvil" -# the path to the file that contains a list of all networks -NETWORKS_FILE_PATH="./networks" +# the path to the file that contains a list of all networks and their details +NETWORKS_JSON_FILE_PATH="$(dirname "$0")/../config/networks.json" # the path to the file that contains a list of all networks GLOBAL_FILE_PATH="$(dirname "$0")/../config/global.json" @@ -106,3 +106,6 @@ COMPILE_ON_STARTUP=false # if this flag is set to true, diamondCut and registerPeriphery tx will not be proposed to SAFE but executed directly DEPLOY_NEW_NETWORK_MODE=true + +# webhook URL for sending messages to Slack 'dev-sc-general' channel +SLACK_WEBHOOK_SC_GENERAL= \ No newline at end of file diff --git a/script/deploy/_targetState.json b/script/deploy/_targetState.json index 48231c54f..37a788935 100644 --- a/script/deploy/_targetState.json +++ b/script/deploy/_targetState.json @@ -1155,7 +1155,10 @@ "LiFiDEXAggregator": "1.6.0", "GasZipPeriphery": "1.0.1", "GasZipFacet": "2.0.2", - "SymbiosisFacet": "1.0.0" + "SymbiosisFacet": "1.0.0", + "RelayFacet": "1.0.0", + "StargateFacetV2": "1.0.1", + "ReceiverStargateV2": "1.1.0" } } }, diff --git a/script/deploy/deployFacetAndAddToDiamond.sh b/script/deploy/deployFacetAndAddToDiamond.sh index bda543842..5841e22de 100755 --- a/script/deploy/deployFacetAndAddToDiamond.sh +++ b/script/deploy/deployFacetAndAddToDiamond.sh @@ -21,7 +21,7 @@ function deployFacetAndAddToDiamond() { # if no NETWORK was passed to this function, ask user to select it if [[ -z "$NETWORK" ]]; then - NETWORK=$(cat ./networks | gum filter --placeholder "Network") + NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") checkRequiredVariablesInDotEnv $NETWORK fi diff --git a/script/deploy/safe/propose-to-safe.ts b/script/deploy/safe/propose-to-safe.ts index 87d1f4c32..df5fa3511 100644 --- a/script/deploy/safe/propose-to-safe.ts +++ b/script/deploy/safe/propose-to-safe.ts @@ -123,8 +123,11 @@ const main = defineCommand({ .limit(1) .toArray() + // it seems that different versions of the SAFE package produce different object structures for "latestTx" so we use this approach to cover both cases const nextNonce = - latestTx.length > 0 ? latestTx[0].nonce + 1 : await protocolKit.getNonce() + latestTx.length > 0 + ? (latestTx[0].safeTx?.data?.nonce || latestTx[0].data?.nonce) + 1 + : await protocolKit.getNonce() const safeTransactionData: SafeTransactionDataPartial = { to: args.to, value: '0', diff --git a/script/helperFunctions.sh b/script/helperFunctions.sh index 7d37c59b2..81e38fba4 100755 --- a/script/helperFunctions.sh +++ b/script/helperFunctions.sh @@ -1966,13 +1966,13 @@ function getAddressOfDeployedContractFromDeploymentsFiles() { } function getAllNetworksArray() { # prepare required variables - local FILE="$NETWORKS_FILE_PATH" + local FILE="$NETWORKS_JSON_FILE_PATH" local ARRAY=() # loop through networks list and add each network to ARRAY that is not excluded - while IFS= read -r line; do - ARRAY+=("$line") - done <"$FILE" + while IFS= read -r network; do + ARRAY+=("$network") + done < <(jq -r 'keys[]' "$FILE") # return ARRAY printf '%s\n' "${ARRAY[@]}" @@ -2013,18 +2013,18 @@ function getCoreFacetsArray() { function getIncludedNetworksArray() { # prepare required variables - local FILE="$NETWORKS_FILE_PATH" + local FILE="$NETWORKS_JSON_FILE_PATH" local ARRAY=() # extract list of excluded networks from config local EXCLUDED_NETWORKS_REGEXP="^($(echo "$EXCLUDE_NETWORKS" | tr ',' '|'))$" # loop through networks list and add each network to ARRAY that is not excluded - while IFS= read -r line; do - if ! [[ "$line" =~ $EXCLUDED_NETWORKS_REGEXP ]]; then - ARRAY+=("$line") + while IFS= read -r network; do + if ! [[ "$network" =~ $EXCLUDED_NETWORKS_REGEXP ]]; then + ARRAY+=("$network") fi - done <"$FILE" + done < <(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH") # return ARRAY printf '%s\n' "${ARRAY[@]}" @@ -2149,7 +2149,7 @@ function userDialogSelectDiamondType() { } function getUserSelectedNetwork() { # get user-selected network - local NETWORK=$(cat ./networks | gum filter --placeholder "Network...") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network...") # if no value was returned (e.g. when pressing ESC, end script) if [[ -z "$NETWORK" ]]; then @@ -2848,17 +2848,16 @@ function getPrivateKey() { function getChainId() { local NETWORK="$1" - local NETWORKS_JSON="config/networks.json" - if [[ ! -f "$NETWORKS_JSON" ]]; then - echo "Error: JSON file '$NETWORKS_JSON' not found." >&2 + if [[ ! -f "$NETWORKS_JSON_FILE_PATH" ]]; then + echo "Error: JSON file '$NETWORKS_JSON_FILE_PATH' not found." >&2 return 1 fi - local CHAIN_ID=$(jq -r --arg network "$NETWORK" '.[$network].chainId // empty' "$NETWORKS_JSON") + local CHAIN_ID=$(jq -r --arg network "$NETWORK" '.[$network].chainId // empty' "$NETWORKS_JSON_FILE_PATH") if [[ -z "$CHAIN_ID" ]]; then - echo "Error: Network '$NETWORK' not found in '$NETWORKS_JSON'." >&2 + echo "Error: Network '$NETWORK' not found in '$NETWORKS_JSON_FILE_PATH'." >&2 return 1 fi @@ -3390,33 +3389,31 @@ function compareAddresses() { return 1 fi } -function sendMessageToDiscordSmartContractsChannel() { +function sendMessageToSlackSmartContractsChannel() { # read function arguments into variable local MESSAGE=$1 - if [ -z "$DISCORD_WEBHOOK_DEV_SMARTCONTRACTS" ]; then + if [ -z "$SLACK_WEBHOOK_SC_GENERAL" ]; then echo "" - warning "Discord webhook URL for dev-smartcontracts is missing. Cannot send log message." + warning "Slack webhook URL for dev-sc-general is missing. Cannot send log message." echo "" return 1 fi echo "" - echoDebug "sending the following message to Discord webhook ('dev-smartcontracts' channel):" + echoDebug "sending the following message to Slack webhook ('dev-sc-general' channel):" echoDebug "$MESSAGE" echo "" # Send the message curl -H "Content-Type: application/json" \ -X POST \ - -d "{\"content\": \"$MESSAGE\"}" \ - $DISCORD_WEBHOOK_DEV_SMARTCONTRACTS + -d "{\"text\": \"$MESSAGE\"}" \ + $SLACK_WEBHOOK_SC_GENERAL - echoDebug "Log message sent to Discord" + echoDebug "Log message sent to Slack" return 0 - - } function getUserInfo() { diff --git a/script/scriptMaster.sh b/script/scriptMaster.sh index 5117196be..fa2829f25 100755 --- a/script/scriptMaster.sh +++ b/script/scriptMaster.sh @@ -118,7 +118,7 @@ scriptMaster() { echo "[info] selected use case: Deploy one specific contract to one network" # get user-selected network from list - local NETWORK=$(cat ./networks | gum filter --placeholder "Network") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") echo "[info] selected network: $NETWORK" echo "[info] loading deployer wallet balance..." @@ -245,7 +245,7 @@ scriptMaster() { echo "[info] selected use case: Deploy all contracts to one selected network (=new network)" # get user-selected network from list - local NETWORK=$(cat ./networks | gum filter --placeholder "Network") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") # get deployer wallet balance BALANCE=$(getDeployerBalance "$NETWORK" "$ENVIRONMENT") @@ -500,7 +500,7 @@ scriptMaster() { updateDiamondLogs else # get user-selected network from list - local NETWORK=$(cat ./networks | gum filter --placeholder "Network") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") echo "[info] selected network: $NETWORK" echo "[info] loading deployer wallet balance..." diff --git a/script/tasks/acceptOwnershipTransferPeriphery.sh b/script/tasks/acceptOwnershipTransferPeriphery.sh index 7ad69df64..b4d9afd85 100755 --- a/script/tasks/acceptOwnershipTransferPeriphery.sh +++ b/script/tasks/acceptOwnershipTransferPeriphery.sh @@ -28,7 +28,7 @@ acceptOwnershipTransferPeriphery() { NETWORKS=($(getIncludedNetworksArray)) else # get user-selected network from list - local NETWORK=$(cat ./networks | gum filter --placeholder "Network") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") # create array with selected network as only entry NETWORKS=($NETWORK) fi diff --git a/script/tasks/checkExecutorAndReceiver.sh b/script/tasks/checkExecutorAndReceiver.sh index 4384830a4..bfe52c4c1 100755 --- a/script/tasks/checkExecutorAndReceiver.sh +++ b/script/tasks/checkExecutorAndReceiver.sh @@ -47,7 +47,7 @@ checkExecutorAndReceiver() { NETWORKS=($(getIncludedNetworksArray)) else # get user-selected network from list - local NETWORK=$(cat ./networks | gum filter --placeholder "Network") + local NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") # create array with selected network as only entry NETWORKS=($NETWORK) fi diff --git a/script/tasks/diamondEMERGENCYPause.sh b/script/tasks/diamondEMERGENCYPause.sh index be8fb2e81..cb3f57474 100755 --- a/script/tasks/diamondEMERGENCYPause.sh +++ b/script/tasks/diamondEMERGENCYPause.sh @@ -23,7 +23,7 @@ function diamondEMERGENCYPause { # find out if script should be executed for one network or for all networks echo "" echo "Should the script be executed on one network or all networks?" - NETWORK=$(echo -e "All (non-excluded) Networks\n$(cat ./networks)" | gum filter --placeholder "Network") + NETWORK=$(echo -e "All (non-excluded) Networks\n$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH")" | gum filter --placeholder "Network") echo "[info] selected network: $NETWORK" if [[ "$NETWORK" != "All (non-excluded) Networks" ]]; then @@ -88,7 +88,7 @@ function diamondEMERGENCYPause { # get user info and send message to discord server local USER_INFO=$(getUserInfo) - sendMessageToDiscordSmartContractsChannel ":warning: an emergency diamond action was just triggered (action: $ACTION, user info: $USER_INFO). Please immediately investigate if this action was not planned. :warning:" + sendMessageToSlackSmartContractsChannel ":warning: an emergency diamond action was just triggered (action: $ACTION, user info: $USER_INFO). Please immediately investigate if this action was not planned. :warning:" # Initialize return status local RETURN=0 diff --git a/script/tasks/diamondSyncDEXs.sh b/script/tasks/diamondSyncDEXs.sh index 3ee3d9623..8ef6e914e 100755 --- a/script/tasks/diamondSyncDEXs.sh +++ b/script/tasks/diamondSyncDEXs.sh @@ -20,7 +20,7 @@ function diamondSyncDEXs { # find out if script should be executed for one network or for all networks echo "" echo "Should the script be executed on one network or all networks" - NETWORK=$(echo -e "All (non-excluded) Networks\n$(cat ./networks)" | gum filter --placeholder "Network") + NETWORK=$(echo -e "All (non-excluded) Networks\n$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH")" | gum filter --placeholder "Network") if [[ "$NETWORK" != "All (non-excluded) Networks" ]]; then checkRequiredVariablesInDotEnv $NETWORK fi diff --git a/script/tasks/diamondSyncSigs.sh b/script/tasks/diamondSyncSigs.sh index 8ea5ecb58..fd179d9a3 100755 --- a/script/tasks/diamondSyncSigs.sh +++ b/script/tasks/diamondSyncSigs.sh @@ -20,7 +20,7 @@ function diamondSyncSigs { # find out if script should be executed for one network or for all networks echo "" echo "Should the script be executed on one network or all networks?" - NETWORK=$(echo -e "All (non-excluded) Networks\n$(cat ./networks)" | gum filter --placeholder "Network") + NETWORK=$(echo -e "All (non-excluded) Networks\n$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH")" | gum filter --placeholder "Network") echo "[info] selected network: $NETWORK" if [[ "$NETWORK" != "All (non-excluded) Networks" ]]; then diff --git a/script/tasks/diamondUpdatePeriphery.sh b/script/tasks/diamondUpdatePeriphery.sh index 96e7e4aa2..94b67044d 100755 --- a/script/tasks/diamondUpdatePeriphery.sh +++ b/script/tasks/diamondUpdatePeriphery.sh @@ -19,7 +19,7 @@ function diamondUpdatePeriphery() { # if no NETWORK was passed to this function, ask user to select it if [[ -z "$NETWORK" ]]; then - NETWORK=$(cat ./networks | gum filter --placeholder "Network") + NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network") checkRequiredVariablesInDotEnv $NETWORK fi diff --git a/script/tasks/diamondUpdateSgConfig.sh b/script/tasks/diamondUpdateSgConfig.sh index 76f631229..a26c83721 100755 --- a/script/tasks/diamondUpdateSgConfig.sh +++ b/script/tasks/diamondUpdateSgConfig.sh @@ -27,7 +27,7 @@ diamondUpdateSgConfig() { fi # get user-selected network from list - NETWORK=$(cat ./networks | gum filter --placeholder "Network...") + NETWORK=$(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum filter --placeholder "Network...") # get user-selected script from list SCRIPT="UpdateConfigForStargate" diff --git a/script/tasks/updateFacetConfig.sh b/script/tasks/updateFacetConfig.sh index f3c5bdf8b..59d6ffc15 100755 --- a/script/tasks/updateFacetConfig.sh +++ b/script/tasks/updateFacetConfig.sh @@ -17,7 +17,7 @@ updateFacetConfig() { echo "Select Networks" if command -v gum >/dev/null 2>&1; then # Read the networks into an array, works on both Mac and Linux - IFS=$'\n' read -r -d '' -a NETWORKS < <(cat ./networks | gum choose --no-limit) + IFS=$'\n' read -r -d '' -a NETWORKS < <(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH" | gum choose --no-limit) if [[ ${#NETWORKS[@]} -eq 0 ]]; then error "No networks selected - exiting script" diff --git a/script/utils/diamondEMERGENCYPauseGitHub.sh b/script/utils/diamondEMERGENCYPauseGitHub.sh index 0b911c89d..b94e65546 100755 --- a/script/utils/diamondEMERGENCYPauseGitHub.sh +++ b/script/utils/diamondEMERGENCYPauseGitHub.sh @@ -172,10 +172,10 @@ function main { # create array with network/s for which the script should be executed local NETWORKS=() - # loop through networks list and add each network to ARRAY that is not excluded - while IFS= read -r line; do - NETWORKS+=("$line") - done <"./networks" + # loop through networks.json list and add each network to ARRAY that is not excluded + while IFS= read -r network; do + NETWORKS+=("$network") + done < <(jq -r 'keys[]' "$NETWORKS_JSON_FILE_PATH") echo "networks found: ${NETWORKS[@]}" diff --git a/script/utils/network.ts b/script/utils/network.ts index 9d04cc6be..d403cf649 100644 --- a/script/utils/network.ts +++ b/script/utils/network.ts @@ -1,8 +1,5 @@ import 'dotenv/config' -import * as fs from 'fs' -import path from 'path' -import { Chain } from 'viem' -import * as chains from 'viem/chains' + export function node_url(networkName: string): string { if (networkName) { const uri = process.env['ETH_NODE_URI_' + networkName.toUpperCase()] @@ -31,57 +28,3 @@ export function node_url(networkName: string): string { } return uri } - -export function getMnemonic(networkName?: string): string { - if (networkName) { - const mnemonic = process.env['MNEMONIC_' + networkName.toUpperCase()] - if (mnemonic && mnemonic !== '') { - return mnemonic - } - } - - const mnemonic = process.env.MNEMONIC - if (!mnemonic || mnemonic === '') { - return 'test test test test test test test test test test test junk' - } - return mnemonic -} - -export function accounts(networkName?: string): { mnemonic: string } { - return { mnemonic: getMnemonic(networkName) } -} - -// get a list of all networks from our ./networks file -export function getAllNetworks(): string[] { - try { - // Read file contents - const fileContents = fs.readFileSync( - path.join(__dirname, '../networks'), - 'utf-8' - ) - - // Split the contents by new lines to get an array of network names - const networkNames = fileContents - .split('\n') - .map((name) => name.trim()) - .filter((name) => name !== '') - - return networkNames - } catch (error) { - console.error(`Error reading file: ${JSON.stringify(error, null, 2)}`) - return [] - } -} - -// viem chain handling -const chainNameMappings: Record = { - apechain: 'apeChain', - zksync: 'zkSync', - polygonzkevm: 'polygonZkEvm', -} - -const chainMap: Record = {} -for (const [k, v] of Object.entries(chains)) { - // @ts-ignore - chainMap[k] = v -} diff --git a/test/solidity/Facets/CalldataVerificationFacet.t.sol b/test/solidity/Facets/CalldataVerificationFacet.t.sol index 717e9ce46..1a4684e2c 100644 --- a/test/solidity/Facets/CalldataVerificationFacet.t.sol +++ b/test/solidity/Facets/CalldataVerificationFacet.t.sol @@ -447,6 +447,42 @@ contract CalldataVerificationFacetTest is TestBase { assertFalse(badCall); } + function testRevert_WhenCallToAddressIsTooShort() public { + uint16 ASSET_ID_USDC = 1; + address STARGATE_POOL_USDC = 0xc026395860Db2d07ee33e05fE50ed7bD583189C7; + + StargateFacetV2.StargateData memory stargateData = StargateFacetV2 + .StargateData({ + assetId: ASSET_ID_USDC, + sendParams: IStargate.SendParam({ + dstEid: 30150, + to: USER_RECEIVER.addressToBytes32(), + amountLD: defaultUSDCAmount, + minAmountLD: (defaultUSDCAmount * 9e4) / 1e5, + extraOptions: "", + composeMsg: bytes("foobarbytes"), + oftCmd: OftCmdHelper.bus() + }), + fee: IStargate.MessagingFee({ nativeFee: 0, lzTokenFee: 0 }), + refundAddress: payable(USER_REFUND) + }); + bytes memory callData = abi.encodeWithSelector( + StargateFacetV2.startBridgeTokensViaStargate.selector, + bridgeData, + stargateData + ); + + bytes memory invalidCallTo = hex"1234"; // too short (length < 20) + + vm.expectRevert("Invalid callTo length; expected at least 20 bytes"); + + calldataVerificationFacet.validateDestinationCalldata( + callData, + invalidCallTo, + bytes("foobarbytes") + ); + } + function test_CanValidateCelerIMDestinationCalldata() public { CelerIM.CelerIMData memory cimData = CelerIM.CelerIMData({ maxSlippage: 1,