Skip to content

Commit

Permalink
Merge branch 'main' of github.com:lifinance/contracts into deprecate-…
Browse files Browse the repository at this point in the history
…unused-interfaces
  • Loading branch information
0xDEnYO committed Mar 3, 2025
2 parents aa669e4 + ce8e3b4 commit d22e13f
Show file tree
Hide file tree
Showing 25 changed files with 156 additions and 109 deletions.
2 changes: 1 addition & 1 deletion archive/scripts/Tasks/diamondMakeImmutable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion archive/scripts/removeUnusableFunctionsForImmutable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions config/dexs.json
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@
"0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
"0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D",
"0xadf8d87723ec7f011ae56ddd6dc10fa8b2c3863a",
"0x85CD07Ea01423b1E937929B44E4Ad8c40BbB5E71"
"0x85CD07Ea01423b1E937929B44E4Ad8c40BbB5E71",
"0x3925eFbD0C1d9c119eC771649052eed7587094AA"
],
"taiko": [
"0xDd8A081efC90DFFD79940948a1528C51793C4B03",
Expand Down Expand Up @@ -906,7 +907,7 @@
"0x4000f76450d9d40558fd60F66863F583B7A5BCCb",
"0xb9061e38fee7d30134f56aef7117e2f6d1580666",
"0xc67879F4065d3B9fe1C09EE990B891Aa8E3a4c2f",
"0x70487a4CB3e097B90699e4B5AA35D75f2b7ad160"
"0xE6fD46600A97CE06703b58333B9C2399F4bF6FEc"
],
"---------------FROM HERE ON JUST OLD NETWORKS - PLEASE ADD NEW NETWORKS ABOVE IN ALPHABETICAL ORDER ^^^^ ----------": [],
"goerli": [
Expand Down
5 changes: 5 additions & 0 deletions config/relay.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
"relayReceiver": "0x7f4babd2c7d35221e72ab67ea72cba99573a0089",
"relaySolver": "0xf70da97812CB96acDF810712Aa562db8dfA3dbEF"
},
"sonic": {
"chainId": 146,
"relayReceiver": "0x7f4babd2c7d35221e72ab67ea72cba99573a0089",
"relaySolver": "0xf70da97812CB96acDF810712Aa562db8dfA3dbEF"
},
"taiko": {
"chainId": 167000,
"relayReceiver": "0xa06e1351e2fd2d45b5d35633ca7ecf328684a109",
Expand Down
3 changes: 3 additions & 0 deletions config/stargateV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"mode": "0x1a44076050125825900e736c501f859c50fE728c",
"mantle": "0x1a44076050125825900e736c501f859c50fE728c",
"soneium": "0x4bcb6a963a9563c33569d7a512d35754221f3a19",
"sonic": "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B",
"scroll": "0x1a44076050125825900e736c501f859c50fE728c",
"taiko": "0x1a44076050125825900e736c501f859c50fE728c",
"xlayer": "0x0000000000000000000000000000000000000000",
Expand All @@ -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",
Expand All @@ -74,6 +76,7 @@
"sei": "0x1502FA4be69d526124D453619276FacCab275d3D",
"scroll": "0x4e422b0acb2bd7e3ac70b5c0e5eb806e86a94038",
"soneium": "0xAF54BE5B6eEc24d6BFACf1cce4eaF680A8239398",
"sonic": "0x2086f755A6d9254045C257ea3d382ef854849B0f",
"taiko": "0x45d417612e177672958dC0537C45a8f8d754Ac2E",
"zksync": "---comingSoon---"
}
Expand Down
42 changes: 42 additions & 0 deletions deployments/_deployments_log_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
10 changes: 9 additions & 1 deletion deployments/sonic.diamond.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -72,7 +80,7 @@
"Permit2Proxy": "",
"Receiver": "0xbE539601FDf7736A4Dd730008082Bf2C16e6f728",
"ReceiverAcrossV3": "",
"ReceiverStargateV2": "",
"ReceiverStargateV2": "0xB05796e54CfADA2C4F7771A0553D6538DD66Ba9a",
"RelayerCelerIM": "",
"TokenWrapper": "0x51f5A9675A0663C3EC2b46121eB1504687922911"
}
Expand Down
5 changes: 4 additions & 1 deletion deployments/sonic.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"TokenWrapper": "0x51f5A9675A0663C3EC2b46121eB1504687922911",
"LiFiDEXAggregator": "0xAdf8d87723Ec7f011Ae56DDD6dC10FA8b2C3863A",
"GasZipPeriphery": "0x3925eFbD0C1d9c119eC771649052eed7587094AA",
"SymbiosisFacet": "0xC8C286F373c5b4a4c6a2D6369003477D76584D7F"
"SymbiosisFacet": "0xC8C286F373c5b4a4c6a2D6369003477D76584D7F",
"RelayFacet": "0xd9aeA8f746888739B0A063Fd608851e1195AF8F3",
"StargateFacetV2": "0x8D4cE7275C269FA5a7E9ca76EA146e01bc0fC540",
"ReceiverStargateV2": "0xB05796e54CfADA2C4F7771A0553D6538DD66Ba9a"
}
7 changes: 5 additions & 2 deletions script/config.example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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=
5 changes: 4 additions & 1 deletion script/deploy/_targetState.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/deployFacetAndAddToDiamond.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion script/deploy/safe/propose-to-safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
45 changes: 21 additions & 24 deletions script/helperFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down Expand Up @@ -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[@]}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions script/scriptMaster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion script/tasks/acceptOwnershipTransferPeriphery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion script/tasks/checkExecutorAndReceiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit d22e13f

Please sign in to comment.