From 8c650601e1d2599d7dc82086109ba82ed795f27d Mon Sep 17 00:00:00 2001 From: Iulian Pascalau <36724586+iulianpascalau@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:04:17 +0200 Subject: [PATCH] Added sync value for safe contract script (#262) * - added sync value for safe contract * - added empty line * - added empty line --- .../interaction/config/menu_functions.cfg | 4 ++++ .../interaction/config/multisig-snippets.sh | 21 +++++++++++++++++++ .../interaction/release-v3/menu_functions.cfg | 2 +- multisig/interaction/script.sh | 6 +++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/multisig/interaction/config/menu_functions.cfg b/multisig/interaction/config/menu_functions.cfg index 844dd030..7219962b 100644 --- a/multisig/interaction/config/menu_functions.cfg +++ b/multisig/interaction/config/menu_functions.cfg @@ -220,3 +220,7 @@ function pause-v2-contracts { confirmation-with-skip pauseAggregatorV2 confirmation-with-skip wrapper-pauseV2 } + +function sync-value-with-eth-denom { + syncValueWithEthereumDenom +} diff --git a/multisig/interaction/config/multisig-snippets.sh b/multisig/interaction/config/multisig-snippets.sh index 8485a624..785c4a1a 100644 --- a/multisig/interaction/config/multisig-snippets.sh +++ b/multisig/interaction/config/multisig-snippets.sh @@ -248,6 +248,27 @@ initSupplyMintBurn() { --send --proxy=${PROXY} --chain=${CHAIN_ID} } +syncValueWithEthereumDenom() { + CHECK_VARIABLES MULTISIG SAFE + + read -p "Chain specific token (human readable): " TOKEN + read -p "Denominated value on Ethereum (should contain all digits): " ETH_VALUE + + EXISTING_BURN=$(mxpy contract query ${SAFE} --proxy=${PROXY} --function getBurnBalances --arguments str:$TOKEN | jq '.[0].number') + EXISTING_MINT=$(mxpy contract query ${SAFE} --proxy=${PROXY} --function getMintBalances --arguments str:$TOKEN | jq '.[0].number') + NEW_MINT=$(echo "$ETH_VALUE+$EXISTING_BURN" | bc) + DIFF=$(echo "$EXISTING_MINT-$EXISTING_BURN" | bc) + NEW_DIFF=$(echo "$NEW_MINT-$EXISTING_BURN" | bc) + + echo "For token ${TOKEN} the existing mint is ${EXISTING_MINT} and existing burn is ${EXISTING_BURN}. The minted value will be replaced with ${NEW_MINT}" + echo "Existing diff ${DIFF}, new diff will be ${NEW_DIFF}" + + mxpy contract call ${MULTISIG} --recall-nonce "${MXPY_SIGN[@]}" \ + --gas-limit=60000000 --function="initSupplyMintBurnEsdtSafe" \ + --arguments str:${TOKEN} ${NEW_MINT} ${EXISTING_BURN} \ + --send --proxy=${PROXY} --chain=${CHAIN_ID} +} + upgradeMultisig() { CHECK_VARIABLES SAFE MULTI_TRANSFER BRIDGE_PROXY MULTISIG_WASM diff --git a/multisig/interaction/release-v3/menu_functions.cfg b/multisig/interaction/release-v3/menu_functions.cfg index a838bd3c..9e04c279 100644 --- a/multisig/interaction/release-v3/menu_functions.cfg +++ b/multisig/interaction/release-v3/menu_functions.cfg @@ -184,4 +184,4 @@ function set-roles-on-esdt-safe-bsc { function unpause-wrapper { confirmation-with-skip wrapper-unpause -} \ No newline at end of file +} diff --git a/multisig/interaction/script.sh b/multisig/interaction/script.sh index b4e3f493..bc758c1d 100755 --- a/multisig/interaction/script.sh +++ b/multisig/interaction/script.sh @@ -127,6 +127,10 @@ case "$1" in confirmation pause-v2-contracts ;; +'sync-value-with-eth-denom') + confirmation sync-value-with-eth-denom + ;; + *) echo "Usage: Invalid choice: '"$1"'" echo -e @@ -136,7 +140,7 @@ case "$1" in echo " \"pause-contracts\", \"unpause-contracts\", \"add-relayer\", \"remove-relayer\", \"pause-v2-contracts\", " echo " \"set-safe-max-tx\", \"set-safe-batch-block-duration\", \"change-quorum\", \"set-swap-fee\", " echo " \"whitelist-token\", \"whitelist-native-token\", \"remove-whitelist-token\", \"upgrade-wrapper-universal-token\", \"upgrade-wrapper-chain-specific-token\", " - echo " \"mint-chain-specific\", \"init-supply-mint-burn\", " + echo " \"mint-chain-specific\", \"init-supply-mint-burn\", \"sync-value-with-eth-denom\", " echo " \"faucet-deposit\", \"deploy-test-caller\"" echo " } " ;;