Skip to content

Commit

Permalink
Added sync value for safe contract script (#262)
Browse files Browse the repository at this point in the history
* - added sync value for safe contract

* - added empty line

* - added empty line
  • Loading branch information
iulianpascalau authored Dec 4, 2024
1 parent 13782bd commit 8c65060
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
4 changes: 4 additions & 0 deletions multisig/interaction/config/menu_functions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,7 @@ function pause-v2-contracts {
confirmation-with-skip pauseAggregatorV2
confirmation-with-skip wrapper-pauseV2
}

function sync-value-with-eth-denom {
syncValueWithEthereumDenom
}
21 changes: 21 additions & 0 deletions multisig/interaction/config/multisig-snippets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion multisig/interaction/release-v3/menu_functions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ function set-roles-on-esdt-safe-bsc {

function unpause-wrapper {
confirmation-with-skip wrapper-unpause
}
}
6 changes: 5 additions & 1 deletion multisig/interaction/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 " } "
;;
Expand Down

0 comments on commit 8c65060

Please sign in to comment.