From 69f75938bdca41d69bd60b628545d3e56551187e Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Fri, 10 May 2024 17:05:31 +0300 Subject: [PATCH 1/6] sovereign bridge scripts --- .../sovereignBridge/config/common.snippets.sh | 75 +++ .../sovereignBridge/config/configs.cfg | 40 ++ .../config/esdt-safe.snippets.sh | 183 +++++++ .../config/fee-market.snippets.sh | 173 +++++++ .../testnet/sovereignBridge/config/helper.cfg | 24 + .../config/multisig-verifier.snippets.sh | 64 +++ .../sovereignBridge/config/py.snippets.sh | 50 ++ .../sovereignBridge/config/token.snippets.sh | 479 ++++++++++++++++++ .../observer/deployObserver.sh | 50 ++ .../sovereignBridge/observer/shard-observer | 12 + .../pyScripts/address_convert.py | 14 + .../pyScripts/address_shard.py | 15 + .../pyScripts/bridge_service.py | 74 +++ .../pyScripts/copy_contracts.py | 41 ++ .../pyScripts/genesis_contract.py | 89 ++++ .../pyScripts/next_contract.py | 16 + .../pyScripts/notifier_round.py | 71 +++ .../pyScripts/read_bls_keys.py | 20 + .../sovereignBridge/pyScripts/update_toml.py | 44 ++ scripts/testnet/sovereignBridge/script.sh | 15 + 20 files changed, 1549 insertions(+) create mode 100644 scripts/testnet/sovereignBridge/config/common.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/config/configs.cfg create mode 100644 scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/config/fee-market.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/config/helper.cfg create mode 100644 scripts/testnet/sovereignBridge/config/multisig-verifier.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/config/py.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/config/token.snippets.sh create mode 100644 scripts/testnet/sovereignBridge/observer/deployObserver.sh create mode 100644 scripts/testnet/sovereignBridge/observer/shard-observer create mode 100644 scripts/testnet/sovereignBridge/pyScripts/address_convert.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/address_shard.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/bridge_service.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/genesis_contract.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/next_contract.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/notifier_round.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/read_bls_keys.py create mode 100644 scripts/testnet/sovereignBridge/pyScripts/update_toml.py create mode 100755 scripts/testnet/sovereignBridge/script.sh diff --git a/scripts/testnet/sovereignBridge/config/common.snippets.sh b/scripts/testnet/sovereignBridge/config/common.snippets.sh new file mode 100644 index 00000000000..cb4bd87b46f --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/common.snippets.sh @@ -0,0 +1,75 @@ +deployAll() { + deployEsdtSafeContract + + deployFeeMarketContract + + setFeeMarketAddress + + disableFeeMarketContract + + unpauseEsdtSafeContract + + issueToken + + setGenesisContract + + updateSovereignConfig + + prepareObserver +} + +upgradeContracts() { + copyContracts + + upgradeEsdtSafeContract + + upgradeFeeMarketContract + + setGenesisContract +} + +sovereignInit() { + updateNotifierNotarizationRound + + ../config.sh + + deployMultisigVerifierContract + + setEsdtSafeAddress + + updateAndStartBridgeService + + ../sovereignStart.sh + + deployObserver + + setMultisigAddress + + setSovereignBridgeAddress + + getFundsInAddressSovereign + + setFeeMarketAddressSovereign + + disableFeeMarketContractSovereign + + unpauseEsdtSafeContractSovereign + + issueTokenSovereign +} + +upgradeContractsAndStartSovereign() { + upgradeContracts + + sovereignInit +} + +stopSovereign() { + ../stop.sh + + screen -S sovereignBridgeService -X kill + + ../clean.sh + + stopObserver +} \ No newline at end of file diff --git a/scripts/testnet/sovereignBridge/config/configs.cfg b/scripts/testnet/sovereignBridge/config/configs.cfg new file mode 100644 index 00000000000..f29604b9f27 --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/configs.cfg @@ -0,0 +1,40 @@ +#============ OWNER ============== + +WALLET="~/wallet.pem" +WALLET_ADDRESS=erd1crq888sv7c3j4y6d9etvlngs3q0tr3endufgls245j5y9yk0ulmqlsuute + +#============ WASM FILES ============== + +ESDT_SAFE_WASM="~/contracts/esdt-safe.wasm" +FEE_MARKET_WASM="~/contracts/fee-market.wasm" +MULTISIG_VERIFIER_WASM="~/contracts/multisigverifier.wasm" + +#=========== CHAIN SPECIFIC CONSTANTS =========== +ESDT_SYSTEM_SC_ADDRESS=erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u +ESDT_ISSUE_COST=50000000000000000 + +PROXY=https://testnet-gateway.multiversx.com +CHAIN_ID=T +PROXY_SOVEREIGN=http://localhost:7950 +CHAIN_ID_SOVEREIGN=local-testnet +PRICE_AGGREGATOR_ADDRESS=erd1qqqqqqqqqqqqqpgqfsfcrxnlym0fjlnuvus2dmlz6ju9cpsfexks8wq4d4 + +#============ ESDT SAFE DEPLOY ARGUMENTS ============== + +MIN_VALID_SIGNERS=0 +INITIATOR_ADDRESS=erd1crq888sv7c3j4y6d9etvlngs3q0tr3endufgls245j5y9yk0ulmqlsuute +SIGNERS= + +#============ ISSUE TOKEN SETTINGS ============== + +TOKEN_TICKER=SVN +TOKEN_DISPLAY_NAME=SovereignTkn +NR_DECIMALS=18 +INITIAL_SUPPLY=111222333 + +#============ TOKEN TO DEPOSIT ============== + +DEPOSIT_TOKEN_IDENTIFIER=SVN-5e3d99 +DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN=SVN-a6aeef +DEPOSIT_TOKEN_NR_DECIMALS=18 +DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER=123 diff --git a/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh new file mode 100644 index 00000000000..84fb6c03d76 --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh @@ -0,0 +1,183 @@ +ESDT_SAFE_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-esdt-safe-contract) +ESDT_SAFE_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-esdt-safe-contract) + +deployEsdtSafeContract() { + mxpy --verbose contract deploy \ + --bytecode=$(eval echo ${ESDT_SAFE_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --arguments \ + false \ + ${MIN_VALID_SIGNERS} \ + ${INITIATOR_ADDRESS} \ + ${SIGNERS} \ + --outfile="${SCRIPT_PATH}/deploy-esdt-safe.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-esdt-safe.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi + + local ADDRESS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-esdt-safe.interaction.json" --expression="data['contractAddress']") + mxpy data store --partition=${CHAIN_ID} --key=address-esdt-safe-contract --value=${ADDRESS} + ESDT_SAFE_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-esdt-safe-contract) + echo -e "ESDT Safe contract: ${ADDRESS}" + + local SOVEREIGN_CONTRACT_ADDRESS=$(firstSovereignContractAddress) + mxpy data store --partition=sovereign --key=address-esdt-safe-contract --value=${SOVEREIGN_CONTRACT_ADDRESS} + ESDT_SAFE_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-esdt-safe-contract) + echo -e "ESDT Safe sovereign contract: ${SOVEREIGN_CONTRACT_ADDRESS}" +} + +upgradeEsdtSafeContract() { + mxpy --verbose contract upgrade ${ESDT_SAFE_ADDRESS} \ + --bytecode=$(eval echo ${ESDT_SAFE_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --outfile="${SCRIPT_PATH}/upgrade-esdt-safe.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/upgrade-esdt-safe.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi +} + +pauseEsdtSafeContract() { + pauseEsdtSafeContractCall ${ESDT_SAFE_ADDRESS} ${PROXY} ${CHAIN_ID} +} +pauseEsdtSafeContractSovereign() { + pauseEsdtSafeContractCall ${ESDT_SAFE_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +pauseEsdtSafeContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="pause" \ + --recall-nonce \ + --wait-result \ + --send || return +} + +unpauseEsdtSafeContract() { + unpauseEsdtSafeContractCall ${ESDT_SAFE_ADDRESS} ${PROXY} ${CHAIN_ID} +} +unpauseEsdtSafeContractSovereign() { + unpauseEsdtSafeContractCall ${ESDT_SAFE_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +unpauseEsdtSafeContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="unpause" \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setFeeMarketAddress() { + setFeeMarketAddressCall ${ESDT_SAFE_ADDRESS} ${FEE_MARKET_ADDRESS} ${PROXY} ${CHAIN_ID} +} +setFeeMarketAddressSovereign() { + setFeeMarketAddressCall ${ESDT_SAFE_ADDRESS_SOVEREIGN} ${FEE_MARKET_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +setFeeMarketAddressCall() { + if [ $# -lt 4 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ESDT_SAFE_CONTRACT_ADDRESS=$1 + local FEE_MARKET_CONTRACT_ADDRESS=$2 + local URL=$3 + local CHAIN=$4 + + mxpy --verbose contract call ${ESDT_SAFE_CONTRACT_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="setFeeMarketAddress" \ + --arguments ${FEE_MARKET_CONTRACT_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setMultisigAddress() { + CHECK_VARIABLES ESDT_SAFE_ADDRESS MULTISIG_VERIFIER_ADDRESS || return + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=10000000 \ + --function="setMultisigAddress" \ + --arguments ${MULTISIG_VERIFIER_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setSovereignBridgeAddress() { + CHECK_VARIABLES ESDT_SAFE_ADDRESS ESDT_SAFE_ADDRESS_SOVEREIGN || return + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=10000000 \ + --function="setSovereignBridgeAddress" \ + --arguments ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +changeEsdtSafeContractOwnerToMultisig() { + CHECK_VARIABLES ESDT_SAFE_ADDRESS MULTISIG_VERIFIER_ADDRESS || return + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=10000000 \ + --function="ChangeOwnerAddress" \ + --arguments ${MULTISIG_VERIFIER_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} diff --git a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh new file mode 100644 index 00000000000..28ae6564e45 --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh @@ -0,0 +1,173 @@ +FEE_MARKET_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-fee-market-contract) +FEE_MARKET_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-fee-market-contract) + +deployFeeMarketContract() { + CHECK_VARIABLES ESDT_SAFE_ADDRESS || return + + mxpy --verbose contract deploy \ + --bytecode=$(eval echo ${FEE_MARKET_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + ${PRICE_AGGREGATOR_ADDRESS} \ + str:USDC-350c4e \ + str:WEGLD-a28c59 \ + --outfile="${SCRIPT_PATH}/deploy-fee-market.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-fee-market.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi + + local ADDRESS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-fee-market.interaction.json" --expression="data['contractAddress']") + mxpy data store --partition=${CHAIN_ID} --key=address-fee-market-contract --value=${ADDRESS} + FEE_MARKET_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-fee-market-contract) + echo -e "Fee Market contract: ${ADDRESS}" + + local SOVEREIGN_CONTRACT_ADDRESS=$(secondSovereignContractAddress) + mxpy data store --partition=sovereign --key=address-fee-market-contract --value=${SOVEREIGN_CONTRACT_ADDRESS} + FEE_MARKET_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-fee-market-contract) + echo -e "Fee Market sovereign contract: ${SOVEREIGN_CONTRACT_ADDRESS}" +} + +upgradeFeeMarketContract() { + CHECK_VARIABLES ESDT_SAFE_ADDRESS || return + + mxpy --verbose contract upgrade ${FEE_MARKET_ADDRESS} \ + --bytecode=$(eval echo ${FEE_MARKET_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --outfile="${SCRIPT_PATH}/upgrade-fee-market.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/upgrade-fee-market.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi +} + +enableFeeMarketContract() { + enableFeeMarketContractCall ${FEE_MARKET_ADDRESS} ${PROXY} ${CHAIN_ID} +} +enableFeeMarketContractSovereign() { + enableFeeMarketContractCall ${FEE_MARKET_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +enableFeeMarketContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="enableFee" \ + --recall-nonce \ + --wait-result \ + --send || return +} + +disableFeeMarketContract() { + disableFeeMarketContractCall ${FEE_MARKET_ADDRESS} ${PROXY} ${CHAIN_ID} +} +disableFeeMarketContractSovereign() { + disableFeeMarketContractCall ${FEE_MARKET_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +disableFeeMarketContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="disableFee" \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setFixedFeeMarketContract() { + setFixedFeeMarketContractCall ${FEE_MARKET_ADDRESS} ${PROXY} ${CHAIN_ID} +} +setFixedFeeMarketContractSovereign() { + setFixedFeeMarketContractCall ${FEE_MARKET_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +setFixedFeeMarketContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="addFee" \ + --arguments \ + str:SVN-c53da0 \ + 0x010000000a53564e2d6335336461300000000901314fb370629800000000000901c9f78d2893e40000 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setAnyTokenFeeMarketContract() { + setAnyTokenFeeMarketContractCall ${FEE_MARKET_ADDRESS} ${PROXY} ${CHAIN_ID} +} +setAnyTokenFeeMarketContractSovereign() { + setAnyTokenFeeMarketContractCall ${FEE_MARKET_ADDRESS_SOVEREIGN} ${PROXY_SOVEREIGN} ${CHAIN_ID_SOVEREIGN} +} +setAnyTokenFeeMarketContractCall() { + if [ $# -lt 3 ]; then + echo "Usage: $0 " + exit 1 + fi + + local ADDRESS=$1 + local URL=$2 + local CHAIN=$3 + + mxpy --verbose contract call ${ADDRESS} \ + --pem=${WALLET} \ + --proxy=${URL} \ + --chain=${CHAIN} \ + --gas-limit=10000000 \ + --function="addFee" \ + --arguments \ + str:SVN-cb685a \ + 0x020000000c5745474c442d64643834373100000008de0b6b3a7640000000000008ebec21ee1da40000 \ + --recall-nonce \ + --wait-result \ + --send || return +} \ No newline at end of file diff --git a/scripts/testnet/sovereignBridge/config/helper.cfg b/scripts/testnet/sovereignBridge/config/helper.cfg new file mode 100644 index 00000000000..f2a77c63c9f --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/helper.cfg @@ -0,0 +1,24 @@ +CONFIG_FILE=$SCRIPT_PATH/config/configs.cfg + +manualUpdateConfigFile() { + source $SCRIPT_PATH/config/configs.cfg +} + +function update-config { + TARGET_KEY=$1 + REPLACEMENT_VALUE=$2 + sed "s/^$TARGET_KEY=.*/$TARGET_KEY=$REPLACEMENT_VALUE/" $CONFIG_FILE > $SCRIPT_PATH/config/temp.x + mv $SCRIPT_PATH/config/temp.x "$CONFIG_FILE" + source $CONFIG_FILE +} + +CHECK_VARIABLES() +{ + VAR_UNSET="" + VARIABLE_NAMES=("$@") + for VARIABLE_NAME in "${VARIABLE_NAMES[@]}"; do + [ -z "${!VARIABLE_NAME}" ] && echo "$VARIABLE_NAME variable is unset." && VAR_UNSET=true + done + [ -n "$VAR_UNSET" ] && return 1 + return 0 +} diff --git a/scripts/testnet/sovereignBridge/config/multisig-verifier.snippets.sh b/scripts/testnet/sovereignBridge/config/multisig-verifier.snippets.sh new file mode 100644 index 00000000000..e841a037f6b --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/multisig-verifier.snippets.sh @@ -0,0 +1,64 @@ +MULTISIG_VERIFIER_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-multisig-verifier-contract) + +deployMultisigVerifierContract() { + manualUpdateConfigFile #update config file + + BLS_PUB_KEYS=$(python3 $SCRIPT_PATH/pyScripts/read_bls_keys.py) + + mxpy --verbose contract deploy \ + --bytecode=$(eval echo ${MULTISIG_VERIFIER_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --arguments ${BLS_PUB_KEYS} \ + --outfile="${SCRIPT_PATH}/deploy-multisig-verifier.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-multisig-verifier.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi + + local ADDRESS=$(mxpy data parse --file="${SCRIPT_PATH}/deploy-multisig-verifier.interaction.json" --expression="data['contractAddress']") + mxpy data store --partition=${CHAIN_ID} --key=address-multisig-verifier-contract --value=${ADDRESS} + MULTISIG_VERIFIER_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-multisig-verifier-contract) + echo -e "Multisig Verifier contract: ${ADDRESS}" +} + +upgradeMultisigVerifierContract() { + manualUpdateConfigFile #update config file + + mxpy --verbose contract upgrade ${MULTISIG_VERIFIER_ADDRESS} \ + --bytecode=$(eval echo ${MULTISIG_VERIFIER_WASM}) \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=200000000 \ + --outfile="${SCRIPT_PATH}/upgrade-multisig-verifier.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local TX_STATUS=$(mxpy data parse --file="${SCRIPT_PATH}/upgrade-multisig-verifier.interaction.json" --expression="data['transactionOnNetwork']['status']") + if [ "$TX_STATUS" != "success" ]; then + echo "Transaction was not successful" + return + fi +} + +setEsdtSafeAddress() { + mxpy --verbose contract call ${MULTISIG_VERIFIER_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=10000000 \ + --function="setEsdtSafeAddress" \ + --arguments ${ESDT_SAFE_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} diff --git a/scripts/testnet/sovereignBridge/config/py.snippets.sh b/scripts/testnet/sovereignBridge/config/py.snippets.sh new file mode 100644 index 00000000000..3f3c7c0dfb5 --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/py.snippets.sh @@ -0,0 +1,50 @@ +firstSovereignContractAddress() { + echo $(python3 $SCRIPT_PATH/pyScripts/next_contract.py $WALLET_ADDRESS 0) +} + +secondSovereignContractAddress() { + echo $(python3 $SCRIPT_PATH/pyScripts/next_contract.py $WALLET_ADDRESS 1) +} + +getShardOfAddress() { + echo $(python3 $SCRIPT_PATH/pyScripts/address_shard.py $WALLET_ADDRESS) +} + +bech32ToHex() { + echo $(python3 $SCRIPT_PATH/pyScripts/address_convert.py $1) +} + +displayContracts() { + echo $"ESDT-SAFE CHAIN[$CHAIN_ID]: $ESDT_SAFE_ADDRESS" + echo $"ESDT-SAFE SOVEREIGN: $ESDT_SAFE_ADDRESS_SOVEREIGN" + echo $"FEE-MARKET: $FEE_MARKET_ADDRESS" + echo $"MULTISIG-VERIFIER: $MULTISIG_VERIFIER_ADDRESS" +} + +updateAndStartBridgeService() { + python3 $SCRIPT_PATH/pyScripts/bridge_service.py $WALLET $PROXY $ESDT_SAFE_ADDRESS $MULTISIG_VERIFIER_ADDRESS +} + +updateNotifierNotarizationRound() { + python3 $SCRIPT_PATH/pyScripts/notifier_round.py $PROXY $(getShardOfAddress) +} + +setGenesisContract() { + if [ "$MIN_VALID_SIGNERS" = "0" ]; then + SIGNERS="" + else + SIGNERS=$MIN_VALID_SIGNERS + fi + local ESDT_SAFE_INIT_PARAMS="01@${SIGNERS}@$(bech32ToHex $INITIATOR_ADDRESS)" + local FEE_MARKET_INIT_PARAMS="$(bech32ToHex $ESDT_SAFE_ADDRESS_SOVEREIGN)@$(bech32ToHex $PRICE_AGGREGATOR_ADDRESS)@555344432d333530633465@5745474c442d613238633539" + + python3 $SCRIPT_PATH/pyScripts/genesis_contract.py $WALLET_ADDRESS $ESDT_SAFE_WASM $ESDT_SAFE_INIT_PARAMS $FEE_MARKET_WASM $FEE_MARKET_INIT_PARAMS +} + +updateSovereignConfig() { + python3 $SCRIPT_PATH/pyScripts/update_toml.py $ESDT_SAFE_ADDRESS $ESDT_SAFE_ADDRESS_SOVEREIGN +} + +copyContracts() { + python3 $SCRIPT_PATH/pyScripts/copy_contracts.py $ESDT_SAFE_WASM $FEE_MARKET_WASM $MULTISIG_VERIFIER_WASM +} diff --git a/scripts/testnet/sovereignBridge/config/token.snippets.sh b/scripts/testnet/sovereignBridge/config/token.snippets.sh new file mode 100644 index 00000000000..e3798999ae2 --- /dev/null +++ b/scripts/testnet/sovereignBridge/config/token.snippets.sh @@ -0,0 +1,479 @@ +issueToken() { + manualUpdateConfigFile #update config file + + local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY*10^$NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=60000000 \ + --value=${ESDT_ISSUE_COST} \ + --function="issue" \ + --arguments \ + str:${TOKEN_DISPLAY_NAME} \ + str:${TOKEN_TICKER} \ + ${TOKENS_TO_MINT} \ + ${NR_DECIMALS} \ + str:canAddSpecialRoles str:true \ + --outfile="${SCRIPT_PATH}/issue-token.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") + local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) + update-config DEPOSIT_TOKEN_IDENTIFIER $TOKEN_IDENTIFIER +} + +depositTokenInSC() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + 2 \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + ${WALLET_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +nftDepositInSC() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + 1 \ + str:SNFT-34c04c \ + 2 \ + 1 \ + str:deposit \ + ${WALLET_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSCAdder() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=30000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + 2 \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + erd1qqqqqqqqqqqqqpgqp6k29tdnray9kzzetsv50fxgyzgkt5pqulmq0yp9c6 \ + 0x0000000001312d00 \ + 0x616464 \ + 0x0000000401312d00 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +issueTokenSovereign() { + manualUpdateConfigFile #update config file + + local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY*10^$NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=60000000 \ + --value=5000000000000000000 \ + --function="issue" \ + --arguments \ + str:${TOKEN_DISPLAY_NAME} \ + str:${TOKEN_TICKER} \ + ${TOKENS_TO_MINT} \ + ${NR_DECIMALS} \ + str:canAddSpecialRoles str:true \ + --outfile="${SCRIPT_PATH}/issue-sovereign-token.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue-sovereign-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") + local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) + update-config DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=100000000 \ + --function="registerToken" \ + --value=50000000000000000 \ + --arguments \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + str:SovToken \ + str:SOVT \ + 0x12 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +setLocalBurnRoleSovereign() { + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN ESDT_SAFE_ADDRESS_SOVEREIGN || return + + mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=60000000 \ + --function="setSpecialRole" \ + --arguments \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + str:ESDTRoleLocalBurn \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSCSovereign() { + manualUpdateConfigFile #update config file + + mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="setSpecialRole" \ + --arguments \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + str:ESDTRoleLocalBurn \ + --recall-nonce \ + --wait-result \ + --send || return + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + 2 \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + ${WALLET_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSCSovereignFail() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + 2 \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + erd1qqqqqqqqqqqqqpgqpzu5ezwlsm7zqnke62ylsxjtwta7qz50ulmqa9xpwa \ + 0x0000000001312d00 \ + 0x61646464 \ + 0x0000000401312d00 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSCSovereignBack() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + 2 \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + ${WALLET_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSCSovereignWithArgs() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + 1 \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + ${WALLET_ADDRESS} \ + 0x0000000001312d00 \ + 0x616464 \ + 0x0000000401312d00 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +getFundsInAddressSovereign() { + mxpy tx new \ + --pem="~/MultiversX/testnet/node/config/walletKey.pem" \ + --pem-index 0 \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --receiver=${WALLET_ADDRESS} \ + --value=200000000000000000000 \ + --gas-limit=50000 \ + --recall-nonce \ + --send + + sleep 6 +} + +getFundsInAddress2Sovereign() { + mxpy tx new \ + --pem="~/MultiversX/testnet/node/config/walletKey.pem" \ + --pem-index 0 \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --receiver=erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ + --value=200000000000000000000 \ + --gas-limit=50000 \ + --recall-nonce \ + --send + + sleep 6 +} + +depositTokenInSC2() { + manualUpdateConfigFile #update config file + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ + --pem="/home/ubuntu/Wallets/wallet.pem" \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + 1 \ + str:SVN-d9b66a \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +issueToken2Sovereign() { + manualUpdateConfigFile #update config file + + local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY*10^$NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ + --pem="/home/ubuntu/Wallets/wallet.pem" \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=60000000 \ + --value=5000000000000000000 \ + --function="issue" \ + --arguments \ + str:${TOKEN_DISPLAY_NAME} \ + str:${TOKEN_TICKER} \ + ${TOKENS_TO_MINT} \ + ${NR_DECIMALS} \ + str:canAddSpecialRoles str:true \ + --outfile="${SCRIPT_PATH}/issue2-sovereign-token.interaction.json" \ + --recall-nonce \ + --wait-result \ + --send || return + + local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue2-sovereign-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") + local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) + update-config DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem="/home/ubuntu/Wallets/wallet.pem" \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=100000000 \ + --function="registerToken" \ + --value=50000000000000000 \ + --arguments \ + str:${DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN} \ + 0 \ + str:SovToken \ + str:SOVT \ + 0x12 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +depositTokenInSC2Sovereign() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ + --pem="/home/ubuntu/Wallets/wallet.pem" \ + --proxy=${PROXY_SOVEREIGN} \ + --chain=${CHAIN_ID_SOVEREIGN} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + 1 \ + str:${DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ + --recall-nonce \ + --wait-result \ + --send || return +} + +dep() { + manualUpdateConfigFile #update config file + + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + + mxpy --verbose contract call ${WALLET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="MultiESDTNFTTransfer" \ + --arguments \ + ${ESDT_SAFE_ADDRESS} \ + 2 \ + str:SVN-c53da0 \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:${DEPOSIT_TOKEN_IDENTIFIER} \ + 0 \ + ${AMOUNT_TO_TRANSFER} \ + str:deposit \ + ${WALLET_ADDRESS} \ + --recall-nonce \ + --wait-result \ + --send || return +} + +distributeFees() { + mxpy --verbose contract call ${FEE_MARKET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="distributeFees" \ + --arguments \ + erd1fp7lg768s4t7yk2e3yz6t69dt6n85hdxq477h7vq3dywszrng8fs3j4ku8 \ + 0x2710 \ + --recall-nonce \ + --wait-result \ + --send || return +} diff --git a/scripts/testnet/sovereignBridge/observer/deployObserver.sh b/scripts/testnet/sovereignBridge/observer/deployObserver.sh new file mode 100644 index 00000000000..36a3b09dbeb --- /dev/null +++ b/scripts/testnet/sovereignBridge/observer/deployObserver.sh @@ -0,0 +1,50 @@ +IMAGE_NAME="multiversx/sov-observer" + +prepareObserver() { + manualUpdateConfigFile #update config file + + local DOCKER_IMAGE="" + + if [ -n "$1" ]; then + DOCKER_IMAGE=$1 + else + case $CHAIN_ID in + "1") + TAG=$(curl -s https://registry.hub.docker.com/v2/repositories/multiversx/chain-mainnet/tags | jq -r '.results[0].name') + DOCKER_IMAGE="multiversx/chain-mainnet:$TAG" + ;; + "D") + TAG=$(curl -s https://registry.hub.docker.com/v2/repositories/multiversx/chain-devnet/tags | jq -r '.results[0].name') + DOCKER_IMAGE="multiversx/chain-devnet:$TAG" + ;; + "T") + TAG=$(curl -s https://registry.hub.docker.com/v2/repositories/multiversx/chain-testnet/tags | jq -r '.results[0].name') + DOCKER_IMAGE="multiversx/chain-testnet:$TAG" + ;; + esac + fi + + local LINE="FROM $DOCKER_IMAGE" + sed -i "1s,.*,${LINE}," "$SCRIPT_PATH/observer/shard-observer" # replace first line with the docker image + + docker image build . -t $IMAGE_NAME -f $SCRIPT_PATH/observer/shard-observer +} + +deployObserver() { + local SHARD=$(getShardOfAddress) + + docker run -d -p 8083:8080 -p 22111:22111 $IMAGE_NAME --destination-shard-as-observer=$SHARD +} + +stopObserver() { + local CONTAINER_IDS=$(docker ps -q --filter "ancestor=${IMAGE_NAME}") + + if [ -z "$CONTAINER_IDS" ]; then + echo "No containers running based on image ${IMAGE_NAME}" + exit 1 + fi + + for CONTAINER_ID in $CONTAINER_IDS; do + docker stop $CONTAINER_ID + done +} diff --git a/scripts/testnet/sovereignBridge/observer/shard-observer b/scripts/testnet/sovereignBridge/observer/shard-observer new file mode 100644 index 00000000000..46ff51e8617 --- /dev/null +++ b/scripts/testnet/sovereignBridge/observer/shard-observer @@ -0,0 +1,12 @@ +FROM multiversx/chain-testnet:T1.7.10.1 + +WORKDIR /go/mx-chain-go/cmd/node/ +RUN sed -i '/\[DbLookupExtensions\]/!b;n;c\\tEnabled = true' ./config/config.toml +RUN sed -i '/\[HostDriversConfig\]/,/^\[/ s/Enabled = false/Enabled = true/' ./config/external.toml +RUN sed -i '/\[HostDriversConfig\]/,/^\[/ s/MarshallerType = "json"/MarshallerType = "gogo protobuf"/' ./config/external.toml +RUN sed -i '/\[HostDriversConfig\]/,/^\[/ s/Mode = "client"/Mode = "server"/' ./config/external.toml +RUN sed -i '/\[HostDriversConfig\]/,/^\[/ s/URL = "127.0.0.1:22111"/URL = "0.0.0.0:22111"/' ./config/external.toml + +EXPOSE 8080 +EXPOSE 22111 +ENTRYPOINT ["/go/mx-chain-go/cmd/node/node", "--log-save", "--log-level=*:DEBUG,core/dblookupext:WARN", "--log-logger-name", "--rest-api-interface=0.0.0.0:8080"] \ No newline at end of file diff --git a/scripts/testnet/sovereignBridge/pyScripts/address_convert.py b/scripts/testnet/sovereignBridge/pyScripts/address_convert.py new file mode 100644 index 00000000000..b6b75a3f23d --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/address_convert.py @@ -0,0 +1,14 @@ +import sys + +from multiversx_sdk_core import Address + + +def main(): + # input arguments + address = Address.from_bech32(sys.argv[1]) + + print(address.to_hex()) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/address_shard.py b/scripts/testnet/sovereignBridge/pyScripts/address_shard.py new file mode 100644 index 00000000000..1496a69e5e6 --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/address_shard.py @@ -0,0 +1,15 @@ +import sys + +from multiversx_sdk_core import Address, AddressComputer + + +def main(): + # input arguments + address = Address.from_bech32(sys.argv[1]) + + address_computer = AddressComputer() + print(address_computer.get_shard_of_address(address)) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py b/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py new file mode 100644 index 00000000000..af72937519c --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py @@ -0,0 +1,74 @@ +import os +import re +import subprocess +import sys +from datetime import datetime + + +def update_env(lines, identifier, value) -> []: + updated_lines = [] + + for line in lines: + if line.startswith(identifier): + line = re.sub(r'"(.*?)"', f'"{value}"', line) + + updated_lines.append(line) + + return updated_lines + + +def build_and_run_server(server_path): + os.chdir(server_path) + + build_command = "go build" + run_service = "screen -L -Logfile sovereignBridgeService.txt -d -m -S sovereignBridgeService ./server" + + build_process = subprocess.run(build_command, shell=True, capture_output=True, text=True) + if build_process.returncode == 0: + print("Go build successful.") + else: + print("Error during Go build.") + return + + # TODO start terminal with server app + run_process = subprocess.run(run_service, shell=True, capture_output=True, text=True) + if run_process.returncode == 0: + print("Bridge service running...") + else: + print("Error running bridge service.") + return + + +def main(): + # input arguments + wallet = sys.argv[1] + proxy = sys.argv[2] + esdt_safe_address = sys.argv[3] + multisig_address = sys.argv[4] + + current_path = os.getcwd() + project = 'mx-chain-go' + index = current_path.find(project) + project_path = current_path[:index] + bridge_service_path = os.path.join(project_path, 'mx-chain-sovereign-bridge-go') + server_path = bridge_service_path + "/server/cmd/server" + env_path = server_path + "/.env" + + with open(env_path, 'r') as file: + lines = file.readlines() + + updated_lines = update_env(lines, "WALLET_PATH", os.path.expanduser(wallet)) + updated_lines = update_env(updated_lines, "MULTIVERSX_PROXY", os.path.expanduser(proxy)) + updated_lines = update_env(updated_lines, "MULTI_SIG_SC_ADDRESS", multisig_address) + updated_lines = update_env(updated_lines, "ESDT_SAFE_SC_ADDRESS", esdt_safe_address) + updated_lines = update_env(updated_lines, "CERT_FILE", os.path.expanduser("~/MultiversX/testnet/node/config/certificate.crt")) + updated_lines = update_env(updated_lines, "CERT_PK_FILE", os.path.expanduser("~/MultiversX/testnet/node/config/private_key.pem")) + + with open(env_path, 'w') as file: + file.writelines(updated_lines) + + build_and_run_server(server_path) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py b/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py new file mode 100644 index 00000000000..e939580fd69 --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py @@ -0,0 +1,41 @@ +import json +import os +import shutil +import sys + + +def copy_contract_wasm(file_path: str, wasm_path: str): + try: + real_wasm_path = os.path.expanduser(wasm_path) + if os.path.exists(real_wasm_path): + os.remove(real_wasm_path) + + shutil.copy2(file_path, real_wasm_path) + print(f"{file_path} copied successfully.") + except FileNotFoundError: + print(f"File {file_path} not found.") + except PermissionError: + print("Permission denied.") + except Exception as e: + print(f"An error occurred: {e}") + + +def main(): + # input arguments + esdt_safe_path = sys.argv[1] + fee_market_path = sys.argv[2] + multisig_path = sys.argv[3] + + current_path = os.getcwd() + project = 'mx-chain-go' + index = current_path.find(project) + project_path = current_path[:index] + contracts_path = os.path.join(project_path, 'mx-sovereign-sc') + + copy_contract_wasm(contracts_path + "/esdt-safe/output/esdt-safe.wasm", esdt_safe_path) + copy_contract_wasm(contracts_path + "/fee-market/output/fee-market.wasm", fee_market_path) + copy_contract_wasm(contracts_path + "/multisigverifier/output/multisigverifier.wasm", multisig_path) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/genesis_contract.py b/scripts/testnet/sovereignBridge/pyScripts/genesis_contract.py new file mode 100644 index 00000000000..771e16d3f27 --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/genesis_contract.py @@ -0,0 +1,89 @@ +import json +import os +import shutil +import sys + + +def copy_wasm_in_project(file_path: str, wasm_path: str): + try: + if os.path.exists(file_path): + os.remove(file_path) + + shutil.copy2(os.path.expanduser(wasm_path), file_path) + print(f"{wasm_path} copied successfully.") + except FileNotFoundError: + print(f"File {wasm_path} not found.") + except PermissionError: + print("Permission denied.") + except Exception as e: + print(f"An error occurred: {e}") + + +def push_genesis_contract(file_path: str, genesis_contract): + try: + with open(file_path, 'r') as file: + data = json.load(file) + + found = False + for item in data: + if item["filename"] == genesis_contract["filename"]: + item.update(genesis_contract) + found = True + break + if not found: + data.append(genesis_contract) + + with open(file_path, 'w') as file: + json.dump(data, file, indent=2) + + with open(file_path, 'a') as file: + file.write('\n') + + print(f"genesis contract pushed successfully") + except Exception as e: + print(f"An error occurred: {e}") + + +def main(): + # input arguments + owner_address = sys.argv[1] + esdt_safe_path = sys.argv[2] + esdt_safe_init_params = sys.argv[3] + fee_market_path = sys.argv[4] + fee_market_init_params = sys.argv[5] + + current_path = os.getcwd() + project = 'mx-chain-go' + index = current_path.find(project) + project_path = current_path[:index + len(project)] + json_path = project_path + "/cmd/node/config/genesisSmartContracts.json" + + # esdt-safe --------------------- + esdt_safe_wasm_path = project_path + "/cmd/node/config/genesisContracts/esdt-safe.wasm" + copy_wasm_in_project(esdt_safe_wasm_path, esdt_safe_path) + + esdt_safe_genesis_contract = { + "owner": owner_address, + "filename": "./config/genesisContracts/esdt-safe.wasm", + "init-parameters": esdt_safe_init_params, + "vm-type": "0500", + "type": "esdt" + } + push_genesis_contract(json_path, esdt_safe_genesis_contract) + + # fee-market ----------------- + fee_market_wasm_path = project_path + "/cmd/node/config/genesisContracts/fee-market.wasm" + copy_wasm_in_project(fee_market_wasm_path, fee_market_path) + + fee_market_genesis_contract = { + "owner": owner_address, + "filename": "./config/genesisContracts/fee-market.wasm", + "init-parameters": fee_market_init_params, + "vm-type": "0500", + "type": "fee" + } + push_genesis_contract(json_path, fee_market_genesis_contract) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/next_contract.py b/scripts/testnet/sovereignBridge/pyScripts/next_contract.py new file mode 100644 index 00000000000..a5e1e52765b --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/next_contract.py @@ -0,0 +1,16 @@ +import sys + +from multiversx_sdk_core import Address, AddressComputer + + +def main(): + # input arguments + address = Address.from_bech32(sys.argv[1]) + nonce = int(sys.argv[2]) + + address_computer = AddressComputer() + print(address_computer.compute_contract_address(address, nonce).to_bech32()) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py b/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py new file mode 100644 index 00000000000..c0b9589805c --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py @@ -0,0 +1,71 @@ +import os +import re +import sys + +import requests + + +def update_notarization_round(lines, section, identifier, round) -> []: + updated_lines = [] + section_found = False + + for line in lines: + if line.startswith("[" + section + "]"): + section_found = True + if section_found and identifier in line: + line = re.sub(r"(MainChainNotarizationStartRound\s*=\s*)\d+", r"\g<1>" + str(round), line) + section_found = False + updated_lines.append(line) + + return updated_lines + + +def get_current_round(proxy, shard): + params = { + "size": 1, + "shard": shard, + "fields": "round" + } + + api = proxy.replace("gateway", "api") + response = requests.get(api + f"/blocks?size=1&shard={shard}&fields=round") + + if response.status_code == 200: + data = response.json() + if data: + return data[0]["round"] + else: + print("No data returned from the API.") + return -1 + else: + print("Failed to retrieve data from the API. Status code:", response.status_code) + return -1 + + +def main(): + # input arguments + proxy = sys.argv[1] + shard = sys.argv[2] + + current_path = os.getcwd() + project = 'mx-chain-go' + index = current_path.find(project) + project_path = current_path[:index + len(project)] + toml_path = project_path + "/cmd/sovereignnode/config/sovereignConfig.toml" + + current_round = get_current_round(proxy, shard) + if current_round == -1: + return + + with open(toml_path, 'r') as file: + lines = file.readlines() + + updated_lines = update_notarization_round(lines, "MainChainNotarization", "MainChainNotarizationStartRound", + current_round) + + with open(toml_path, 'w') as file: + file.writelines(updated_lines) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/read_bls_keys.py b/scripts/testnet/sovereignBridge/pyScripts/read_bls_keys.py new file mode 100644 index 00000000000..f0dbb56f840 --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/read_bls_keys.py @@ -0,0 +1,20 @@ +import json +import os + + +def read_and_concatenate_pubkeys(file_path): + with open(file_path, 'r') as file: + data = json.load(file) + initial_nodes = data["initialNodes"] + pubkeys = [f"0x{node['pubkey']}" for node in initial_nodes] + concatenated_pubkeys = ' '.join(pubkeys) + return concatenated_pubkeys + + +def main(): + file_path = "~/MultiversX/testnet/node/config/nodesSetup.json" + print(read_and_concatenate_pubkeys(os.path.expanduser(file_path))) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/pyScripts/update_toml.py b/scripts/testnet/sovereignBridge/pyScripts/update_toml.py new file mode 100644 index 00000000000..954e420365f --- /dev/null +++ b/scripts/testnet/sovereignBridge/pyScripts/update_toml.py @@ -0,0 +1,44 @@ +import os +import sys +import re + + +def update_toml(lines, section, identifier, main_chain_address) -> []: + updated_lines = [] + section_found = False + + for line in lines: + if line.startswith("[" + section + "]"): + section_found = True + if section_found and identifier in line: + line = re.sub(r'(Addresses\s*=\s*\[)[^\]]*', r'\1' + f"\"{main_chain_address}\"", line) + section_found = False + updated_lines.append(line) + + return updated_lines + + +def main(): + # input arguments + main_chain_address = sys.argv[1] + sovereign_chain_address = sys.argv[2] + + current_path = os.getcwd() + project = 'mx-chain-go' + index = current_path.find(project) + project_path = current_path[:index + len(project)] + toml_path = project_path + "/cmd/sovereignnode/config/sovereignConfig.toml" + + with open(toml_path, 'r') as file: + lines = file.readlines() + + updated_lines = update_toml(lines, "OutgoingSubscribedEvents", "deposit", sovereign_chain_address) + updated_lines = update_toml(updated_lines, "NotifierConfig", "deposit", main_chain_address) + updated_lines = update_toml(updated_lines, "NotifierConfig", "execute", main_chain_address) + + with open(toml_path, 'w') as file: + file.writelines(updated_lines) + + +if __name__ == "__main__": + main() diff --git a/scripts/testnet/sovereignBridge/script.sh b/scripts/testnet/sovereignBridge/script.sh new file mode 100755 index 00000000000..b3d7be360d3 --- /dev/null +++ b/scripts/testnet/sovereignBridge/script.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Current location +SCRIPT_PATH=$(dirname "$(realpath "$BASH_SOURCE")") + +# Source all scripts +source $SCRIPT_PATH/config/configs.cfg +source $SCRIPT_PATH/config/helper.cfg +source $SCRIPT_PATH/config/esdt-safe.snippets.sh +source $SCRIPT_PATH/config/fee-market.snippets.sh +source $SCRIPT_PATH/config/multisig-verifier.snippets.sh +source $SCRIPT_PATH/config/token.snippets.sh +source $SCRIPT_PATH/config/common.snippets.sh +source $SCRIPT_PATH/config/py.snippets.sh +source $SCRIPT_PATH/observer/deployObserver.sh From b117709686e4086c71e8cf9bceb6f7e91218c677 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Mon, 13 May 2024 22:57:31 +0300 Subject: [PATCH 2/6] clean up sovereign bridge deploy scripts --- .../sovereignBridge/config/common.snippets.sh | 20 - .../sovereignBridge/config/configs.cfg | 7 +- .../config/esdt-safe.snippets.sh | 15 - .../config/fee-market.snippets.sh | 28 +- .../sovereignBridge/config/py.snippets.sh | 4 - .../sovereignBridge/config/token.snippets.sh | 358 ++---------------- .../pyScripts/copy_contracts.py | 41 -- 7 files changed, 42 insertions(+), 431 deletions(-) delete mode 100644 scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py diff --git a/scripts/testnet/sovereignBridge/config/common.snippets.sh b/scripts/testnet/sovereignBridge/config/common.snippets.sh index cb4bd87b46f..5fd36d59a96 100644 --- a/scripts/testnet/sovereignBridge/config/common.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/common.snippets.sh @@ -9,8 +9,6 @@ deployAll() { unpauseEsdtSafeContract - issueToken - setGenesisContract updateSovereignConfig @@ -18,16 +16,6 @@ deployAll() { prepareObserver } -upgradeContracts() { - copyContracts - - upgradeEsdtSafeContract - - upgradeFeeMarketContract - - setGenesisContract -} - sovereignInit() { updateNotifierNotarizationRound @@ -54,14 +42,6 @@ sovereignInit() { disableFeeMarketContractSovereign unpauseEsdtSafeContractSovereign - - issueTokenSovereign -} - -upgradeContractsAndStartSovereign() { - upgradeContracts - - sovereignInit } stopSovereign() { diff --git a/scripts/testnet/sovereignBridge/config/configs.cfg b/scripts/testnet/sovereignBridge/config/configs.cfg index f29604b9f27..762c46d7161 100644 --- a/scripts/testnet/sovereignBridge/config/configs.cfg +++ b/scripts/testnet/sovereignBridge/config/configs.cfg @@ -15,9 +15,10 @@ ESDT_ISSUE_COST=50000000000000000 PROXY=https://testnet-gateway.multiversx.com CHAIN_ID=T +PRICE_AGGREGATOR_ADDRESS=erd1qqqqqqqqqqqqqpgqfsfcrxnlym0fjlnuvus2dmlz6ju9cpsfexks8wq4d4 + PROXY_SOVEREIGN=http://localhost:7950 CHAIN_ID_SOVEREIGN=local-testnet -PRICE_AGGREGATOR_ADDRESS=erd1qqqqqqqqqqqqqpgqfsfcrxnlym0fjlnuvus2dmlz6ju9cpsfexks8wq4d4 #============ ESDT SAFE DEPLOY ARGUMENTS ============== @@ -34,7 +35,7 @@ INITIAL_SUPPLY=111222333 #============ TOKEN TO DEPOSIT ============== -DEPOSIT_TOKEN_IDENTIFIER=SVN-5e3d99 -DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN=SVN-a6aeef +DEPOSIT_TOKEN_IDENTIFIER= +DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN= DEPOSIT_TOKEN_NR_DECIMALS=18 DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER=123 diff --git a/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh index 84fb6c03d76..b206d5fe008 100644 --- a/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh @@ -166,18 +166,3 @@ setSovereignBridgeAddress() { --wait-result \ --send || return } - -changeEsdtSafeContractOwnerToMultisig() { - CHECK_VARIABLES ESDT_SAFE_ADDRESS MULTISIG_VERIFIER_ADDRESS || return - - mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=10000000 \ - --function="ChangeOwnerAddress" \ - --arguments ${MULTISIG_VERIFIER_ADDRESS} \ - --recall-nonce \ - --wait-result \ - --send || return -} diff --git a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh index 28ae6564e45..5effcfc4960 100644 --- a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh @@ -158,16 +158,20 @@ setAnyTokenFeeMarketContractCall() { local URL=$2 local CHAIN=$3 - mxpy --verbose contract call ${ADDRESS} \ - --pem=${WALLET} \ - --proxy=${URL} \ - --chain=${CHAIN} \ - --gas-limit=10000000 \ - --function="addFee" \ - --arguments \ - str:SVN-cb685a \ - 0x020000000c5745474c442d64643834373100000008de0b6b3a7640000000000008ebec21ee1da40000 \ - --recall-nonce \ - --wait-result \ - --send || return + echo "NOT IMPLEMENTED YET" +} + +distributeFees() { + mxpy --verbose contract call ${FEE_MARKET_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=20000000 \ + --function="distributeFees" \ + --arguments \ + ${WALLET} \ + 0x2710 \ + --recall-nonce \ + --wait-result \ + --send || return } \ No newline at end of file diff --git a/scripts/testnet/sovereignBridge/config/py.snippets.sh b/scripts/testnet/sovereignBridge/config/py.snippets.sh index 3f3c7c0dfb5..94f906b89ca 100644 --- a/scripts/testnet/sovereignBridge/config/py.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/py.snippets.sh @@ -44,7 +44,3 @@ setGenesisContract() { updateSovereignConfig() { python3 $SCRIPT_PATH/pyScripts/update_toml.py $ESDT_SAFE_ADDRESS $ESDT_SAFE_ADDRESS_SOVEREIGN } - -copyContracts() { - python3 $SCRIPT_PATH/pyScripts/copy_contracts.py $ESDT_SAFE_WASM $FEE_MARKET_WASM $MULTISIG_VERIFIER_WASM -} diff --git a/scripts/testnet/sovereignBridge/config/token.snippets.sh b/scripts/testnet/sovereignBridge/config/token.snippets.sh index e3798999ae2..f83dd8dc1b6 100644 --- a/scripts/testnet/sovereignBridge/config/token.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/token.snippets.sh @@ -55,64 +55,6 @@ depositTokenInSC() { --send || return } -nftDepositInSC() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS} \ - 1 \ - str:SNFT-34c04c \ - 2 \ - 1 \ - str:deposit \ - ${WALLET_ADDRESS} \ - --recall-nonce \ - --wait-result \ - --send || return -} - -depositTokenInSCAdder() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=30000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS} \ - 2 \ - str:${DEPOSIT_TOKEN_IDENTIFIER} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:${DEPOSIT_TOKEN_IDENTIFIER} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - erd1qqqqqqqqqqqqqpgqp6k29tdnray9kzzetsv50fxgyzgkt5pqulmq0yp9c6 \ - 0x0000000001312d00 \ - 0x616464 \ - 0x0000000401312d00 \ - --recall-nonce \ - --wait-result \ - --send || return -} - issueTokenSovereign() { manualUpdateConfigFile #update config file @@ -123,7 +65,7 @@ issueTokenSovereign() { --proxy=${PROXY_SOVEREIGN} \ --chain=${CHAIN_ID_SOVEREIGN} \ --gas-limit=60000000 \ - --value=5000000000000000000 \ + --value=50000000000000000 \ --function="issue" \ --arguments \ str:${TOKEN_DISPLAY_NAME} \ @@ -139,23 +81,27 @@ issueTokenSovereign() { local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue-sovereign-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) update-config DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER +} - mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=100000000 \ - --function="registerToken" \ - --value=50000000000000000 \ - --arguments \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - 0 \ - str:SovToken \ - str:SOVT \ - 0x12 \ - --recall-nonce \ - --wait-result \ - --send || return +registerToken() { + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN || return + + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=100000000 \ + --function="registerToken" \ + --value=50000000000000000 \ + --arguments \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + str:SovToken \ + str:SOVT \ + 0x12 \ + --recall-nonce \ + --wait-result \ + --send || return } setLocalBurnRoleSovereign() { @@ -177,22 +123,6 @@ setLocalBurnRoleSovereign() { } depositTokenInSCSovereign() { - manualUpdateConfigFile #update config file - - mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=20000000 \ - --function="setSpecialRole" \ - --arguments \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - str:ESDTRoleLocalBurn \ - --recall-nonce \ - --wait-result \ - --send || return - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) @@ -219,96 +149,6 @@ depositTokenInSCSovereign() { --send || return } -depositTokenInSCSovereignFail() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - 2 \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - erd1qqqqqqqqqqqqqpgqpzu5ezwlsm7zqnke62ylsxjtwta7qz50ulmqa9xpwa \ - 0x0000000001312d00 \ - 0x61646464 \ - 0x0000000401312d00 \ - --recall-nonce \ - --wait-result \ - --send || return -} - -depositTokenInSCSovereignBack() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - 2 \ - str:${DEPOSIT_TOKEN_IDENTIFIER} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:${DEPOSIT_TOKEN_IDENTIFIER} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - ${WALLET_ADDRESS} \ - --recall-nonce \ - --wait-result \ - --send || return -} - -depositTokenInSCSovereignWithArgs() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - 1 \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - ${WALLET_ADDRESS} \ - 0x0000000001312d00 \ - 0x616464 \ - 0x0000000401312d00 \ - --recall-nonce \ - --wait-result \ - --send || return -} - getFundsInAddressSovereign() { mxpy tx new \ --pem="~/MultiversX/testnet/node/config/walletKey.pem" \ @@ -322,158 +162,4 @@ getFundsInAddressSovereign() { --send sleep 6 -} - -getFundsInAddress2Sovereign() { - mxpy tx new \ - --pem="~/MultiversX/testnet/node/config/walletKey.pem" \ - --pem-index 0 \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --receiver=erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ - --value=200000000000000000000 \ - --gas-limit=50000 \ - --recall-nonce \ - --send - - sleep 6 -} - -depositTokenInSC2() { - manualUpdateConfigFile #update config file - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ - --pem="/home/ubuntu/Wallets/wallet.pem" \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS} \ - 1 \ - str:SVN-d9b66a \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ - --recall-nonce \ - --wait-result \ - --send || return -} - -issueToken2Sovereign() { - manualUpdateConfigFile #update config file - - local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY*10^$NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ - --pem="/home/ubuntu/Wallets/wallet.pem" \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=60000000 \ - --value=5000000000000000000 \ - --function="issue" \ - --arguments \ - str:${TOKEN_DISPLAY_NAME} \ - str:${TOKEN_TICKER} \ - ${TOKENS_TO_MINT} \ - ${NR_DECIMALS} \ - str:canAddSpecialRoles str:true \ - --outfile="${SCRIPT_PATH}/issue2-sovereign-token.interaction.json" \ - --recall-nonce \ - --wait-result \ - --send || return - - local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue2-sovereign-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") - local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) - update-config DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER - - mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ - --pem="/home/ubuntu/Wallets/wallet.pem" \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=100000000 \ - --function="registerToken" \ - --value=50000000000000000 \ - --arguments \ - str:${DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN} \ - 0 \ - str:SovToken \ - str:SOVT \ - 0x12 \ - --recall-nonce \ - --wait-result \ - --send || return -} - -depositTokenInSC2Sovereign() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ - --pem="/home/ubuntu/Wallets/wallet.pem" \ - --proxy=${PROXY_SOVEREIGN} \ - --chain=${CHAIN_ID_SOVEREIGN} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - 1 \ - str:${DEPOSIT_TOKEN2_IDENTIFIER_SOVEREIGN} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - erd1353zkd5yq8shpwk3djgz6r7qq4rkxtajfn2gkk79muvuhun0l5zqavu826 \ - --recall-nonce \ - --wait-result \ - --send || return -} - -dep() { - manualUpdateConfigFile #update config file - - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return - - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) - - mxpy --verbose contract call ${WALLET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=20000000 \ - --function="MultiESDTNFTTransfer" \ - --arguments \ - ${ESDT_SAFE_ADDRESS} \ - 2 \ - str:SVN-c53da0 \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:${DEPOSIT_TOKEN_IDENTIFIER} \ - 0 \ - ${AMOUNT_TO_TRANSFER} \ - str:deposit \ - ${WALLET_ADDRESS} \ - --recall-nonce \ - --wait-result \ - --send || return -} - -distributeFees() { - mxpy --verbose contract call ${FEE_MARKET_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=20000000 \ - --function="distributeFees" \ - --arguments \ - erd1fp7lg768s4t7yk2e3yz6t69dt6n85hdxq477h7vq3dywszrng8fs3j4ku8 \ - 0x2710 \ - --recall-nonce \ - --wait-result \ - --send || return -} +} \ No newline at end of file diff --git a/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py b/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py deleted file mode 100644 index e939580fd69..00000000000 --- a/scripts/testnet/sovereignBridge/pyScripts/copy_contracts.py +++ /dev/null @@ -1,41 +0,0 @@ -import json -import os -import shutil -import sys - - -def copy_contract_wasm(file_path: str, wasm_path: str): - try: - real_wasm_path = os.path.expanduser(wasm_path) - if os.path.exists(real_wasm_path): - os.remove(real_wasm_path) - - shutil.copy2(file_path, real_wasm_path) - print(f"{file_path} copied successfully.") - except FileNotFoundError: - print(f"File {file_path} not found.") - except PermissionError: - print("Permission denied.") - except Exception as e: - print(f"An error occurred: {e}") - - -def main(): - # input arguments - esdt_safe_path = sys.argv[1] - fee_market_path = sys.argv[2] - multisig_path = sys.argv[3] - - current_path = os.getcwd() - project = 'mx-chain-go' - index = current_path.find(project) - project_path = current_path[:index] - contracts_path = os.path.join(project_path, 'mx-sovereign-sc') - - copy_contract_wasm(contracts_path + "/esdt-safe/output/esdt-safe.wasm", esdt_safe_path) - copy_contract_wasm(contracts_path + "/fee-market/output/fee-market.wasm", fee_market_path) - copy_contract_wasm(contracts_path + "/multisigverifier/output/multisigverifier.wasm", multisig_path) - - -if __name__ == "__main__": - main() From e8e15e87a4909cddb6790f54dec95e08a0915718 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Tue, 14 May 2024 10:32:41 +0300 Subject: [PATCH 3/6] issue token in sovereign settings --- .../testnet/sovereignBridge/config/configs.cfg | 18 +++++++++++++++--- .../sovereignBridge/config/token.snippets.sh | 12 ++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/scripts/testnet/sovereignBridge/config/configs.cfg b/scripts/testnet/sovereignBridge/config/configs.cfg index 762c46d7161..df3792c517f 100644 --- a/scripts/testnet/sovereignBridge/config/configs.cfg +++ b/scripts/testnet/sovereignBridge/config/configs.cfg @@ -28,14 +28,26 @@ SIGNERS= #============ ISSUE TOKEN SETTINGS ============== -TOKEN_TICKER=SVN -TOKEN_DISPLAY_NAME=SovereignTkn +TOKEN_TICKER=TKN +TOKEN_DISPLAY_NAME=Token NR_DECIMALS=18 INITIAL_SUPPLY=111222333 #============ TOKEN TO DEPOSIT ============== DEPOSIT_TOKEN_IDENTIFIER= -DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN= DEPOSIT_TOKEN_NR_DECIMALS=18 DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER=123 + +#============ ISSUE SOVEREIGN TOKEN SETTINGS ============== + +TOKEN_TICKER_SOVEREIGN=SVN +TOKEN_DISPLAY_NAME_SOVEREIGN=SovToken +NR_DECIMALS_SOVEREIGN=18 +INITIAL_SUPPLY_SOVEREIGN=333222111 + +#============ SOVEREIGN TOKEN TO DEPOSIT ============== + +DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN= +DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN=18 +DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN=321 diff --git a/scripts/testnet/sovereignBridge/config/token.snippets.sh b/scripts/testnet/sovereignBridge/config/token.snippets.sh index f83dd8dc1b6..bbf6574db0a 100644 --- a/scripts/testnet/sovereignBridge/config/token.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/token.snippets.sh @@ -58,7 +58,7 @@ depositTokenInSC() { issueTokenSovereign() { manualUpdateConfigFile #update config file - local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY*10^$NR_DECIMALS/1" | bc) + local TOKENS_TO_MINT=$(echo "scale=0; $INITIAL_SUPPLY_SOVEREIGN*10^$NR_DECIMALS_SOVEREIGN/1" | bc) mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ --pem=${WALLET} \ @@ -68,10 +68,10 @@ issueTokenSovereign() { --value=50000000000000000 \ --function="issue" \ --arguments \ - str:${TOKEN_DISPLAY_NAME} \ - str:${TOKEN_TICKER} \ + str:${TOKEN_DISPLAY_NAME_SOVEREIGN} \ + str:${TOKEN_TICKER_SOVEREIGN} \ ${TOKENS_TO_MINT} \ - ${NR_DECIMALS} \ + ${NR_DECIMALS_SOVEREIGN} \ str:canAddSpecialRoles str:true \ --outfile="${SCRIPT_PATH}/issue-sovereign-token.interaction.json" \ --recall-nonce \ @@ -123,9 +123,9 @@ setLocalBurnRoleSovereign() { } depositTokenInSCSovereign() { - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN || return - local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) + local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN*10^$DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN/1" | bc) mxpy --verbose contract call ${WALLET_ADDRESS} \ --pem=${WALLET} \ From d7dead9e70ad4f2e9eed396c611d835073b9e309 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Thu, 16 May 2024 15:44:39 +0300 Subject: [PATCH 4/6] fixes after review --- .../sovereignBridge/config/common.snippets.sh | 8 ++-- .../config/fee-market.snippets.sh | 4 +- .../sovereignBridge/config/token.snippets.sh | 42 +++++++++---------- .../sovereignBridge/observer/shard-observer | 2 +- .../pyScripts/bridge_service.py | 6 +-- .../sovereignBridge/pyScripts/update_toml.py | 8 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/scripts/testnet/sovereignBridge/config/common.snippets.sh b/scripts/testnet/sovereignBridge/config/common.snippets.sh index 5fd36d59a96..a70b686142c 100644 --- a/scripts/testnet/sovereignBridge/config/common.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/common.snippets.sh @@ -1,4 +1,4 @@ -deployAll() { +deployMainChainContractsAndSetupObserver() { deployEsdtSafeContract deployFeeMarketContract @@ -16,7 +16,7 @@ deployAll() { prepareObserver } -sovereignInit() { +sovereignDeploy() { updateNotifierNotarizationRound ../config.sh @@ -44,7 +44,7 @@ sovereignInit() { unpauseEsdtSafeContractSovereign } -stopSovereign() { +stopAndCleanSovereign() { ../stop.sh screen -S sovereignBridgeService -X kill @@ -52,4 +52,4 @@ stopSovereign() { ../clean.sh stopObserver -} \ No newline at end of file +} diff --git a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh index 5effcfc4960..7c570a243f4 100644 --- a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh @@ -169,9 +169,9 @@ distributeFees() { --gas-limit=20000000 \ --function="distributeFees" \ --arguments \ - ${WALLET} \ + ${WALLET_ADDRESS} \ 0x2710 \ --recall-nonce \ --wait-result \ --send || return -} \ No newline at end of file +} diff --git a/scripts/testnet/sovereignBridge/config/token.snippets.sh b/scripts/testnet/sovereignBridge/config/token.snippets.sh index bbf6574db0a..da815398f3e 100644 --- a/scripts/testnet/sovereignBridge/config/token.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/token.snippets.sh @@ -65,7 +65,7 @@ issueTokenSovereign() { --proxy=${PROXY_SOVEREIGN} \ --chain=${CHAIN_ID_SOVEREIGN} \ --gas-limit=60000000 \ - --value=50000000000000000 \ + --value=${ESDT_ISSUE_COST} \ --function="issue" \ --arguments \ str:${TOKEN_DISPLAY_NAME_SOVEREIGN} \ @@ -86,22 +86,22 @@ issueTokenSovereign() { registerToken() { CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN || return - mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ - --pem=${WALLET} \ - --proxy=${PROXY} \ - --chain=${CHAIN_ID} \ - --gas-limit=100000000 \ - --function="registerToken" \ - --value=50000000000000000 \ - --arguments \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - 0 \ - str:SovToken \ - str:SOVT \ - 0x12 \ - --recall-nonce \ - --wait-result \ - --send || return + mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ + --pem=${WALLET} \ + --proxy=${PROXY} \ + --chain=${CHAIN_ID} \ + --gas-limit=100000000 \ + --function="registerToken" \ + --value=${ESDT_ISSUE_COST} \ + --arguments \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + 0 \ + str:${TOKEN_DISPLAY_NAME_SOVEREIGN} \ + str:${TOKEN_TICKER_SOVEREIGN} \ + ${NR_DECIMALS_SOVEREIGN} \ + --recall-nonce \ + --wait-result \ + --send || return } setLocalBurnRoleSovereign() { @@ -114,9 +114,9 @@ setLocalBurnRoleSovereign() { --gas-limit=60000000 \ --function="setSpecialRole" \ --arguments \ - str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ - ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ - str:ESDTRoleLocalBurn \ + str:${DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN} \ + ${ESDT_SAFE_ADDRESS_SOVEREIGN} \ + str:ESDTRoleLocalBurn \ --recall-nonce \ --wait-result \ --send || return @@ -162,4 +162,4 @@ getFundsInAddressSovereign() { --send sleep 6 -} \ No newline at end of file +} diff --git a/scripts/testnet/sovereignBridge/observer/shard-observer b/scripts/testnet/sovereignBridge/observer/shard-observer index 46ff51e8617..cac368ebb40 100644 --- a/scripts/testnet/sovereignBridge/observer/shard-observer +++ b/scripts/testnet/sovereignBridge/observer/shard-observer @@ -9,4 +9,4 @@ RUN sed -i '/\[HostDriversConfig\]/,/^\[/ s/URL = "127.0.0.1:22111"/URL = "0.0.0 EXPOSE 8080 EXPOSE 22111 -ENTRYPOINT ["/go/mx-chain-go/cmd/node/node", "--log-save", "--log-level=*:DEBUG,core/dblookupext:WARN", "--log-logger-name", "--rest-api-interface=0.0.0.0:8080"] \ No newline at end of file +ENTRYPOINT ["/go/mx-chain-go/cmd/node/node", "--log-save", "--log-level=*:DEBUG,core/dblookupext:WARN", "--log-logger-name", "--rest-api-interface=0.0.0.0:8080"] diff --git a/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py b/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py index af72937519c..1d94e6539fe 100644 --- a/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py +++ b/scripts/testnet/sovereignBridge/pyScripts/bridge_service.py @@ -17,11 +17,11 @@ def update_env(lines, identifier, value) -> []: return updated_lines -def build_and_run_server(server_path): +def build_and_run_bridge_server(server_path): os.chdir(server_path) build_command = "go build" - run_service = "screen -L -Logfile sovereignBridgeService.txt -d -m -S sovereignBridgeService ./server" + run_service = "screen -L -Logfile sovereignBridgeService.log -d -m -S sovereignBridgeService ./server" build_process = subprocess.run(build_command, shell=True, capture_output=True, text=True) if build_process.returncode == 0: @@ -67,7 +67,7 @@ def main(): with open(env_path, 'w') as file: file.writelines(updated_lines) - build_and_run_server(server_path) + build_and_run_bridge_server(server_path) if __name__ == "__main__": diff --git a/scripts/testnet/sovereignBridge/pyScripts/update_toml.py b/scripts/testnet/sovereignBridge/pyScripts/update_toml.py index 954e420365f..6f00d214bcc 100644 --- a/scripts/testnet/sovereignBridge/pyScripts/update_toml.py +++ b/scripts/testnet/sovereignBridge/pyScripts/update_toml.py @@ -3,7 +3,7 @@ import re -def update_toml(lines, section, identifier, main_chain_address) -> []: +def update_subscribed_addresses(lines, section, identifier, main_chain_address) -> []: updated_lines = [] section_found = False @@ -32,9 +32,9 @@ def main(): with open(toml_path, 'r') as file: lines = file.readlines() - updated_lines = update_toml(lines, "OutgoingSubscribedEvents", "deposit", sovereign_chain_address) - updated_lines = update_toml(updated_lines, "NotifierConfig", "deposit", main_chain_address) - updated_lines = update_toml(updated_lines, "NotifierConfig", "execute", main_chain_address) + updated_lines = update_subscribed_addresses(lines, "OutgoingSubscribedEvents", "deposit", sovereign_chain_address) + updated_lines = update_subscribed_addresses(updated_lines, "NotifierConfig", "deposit", main_chain_address) + updated_lines = update_subscribed_addresses(updated_lines, "NotifierConfig", "execute", main_chain_address) with open(toml_path, 'w') as file: file.writelines(updated_lines) From 255e1ef6cc958a69776b9c4d9b4cfeac37016dac Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Thu, 16 May 2024 18:05:37 +0300 Subject: [PATCH 5/6] fixes after review --- scripts/testnet/sovereignBridge/config/configs.cfg | 8 +++++--- .../sovereignBridge/config/esdt-safe.snippets.sh | 6 +++--- .../sovereignBridge/config/fee-market.snippets.sh | 11 ++++++----- scripts/testnet/sovereignBridge/config/helper.cfg | 4 ++-- .../testnet/sovereignBridge/config/py.snippets.sh | 8 ++++---- .../testnet/sovereignBridge/config/token.snippets.sh | 12 ++++++------ ...{next_contract.py => compute_contract_address.py} | 0 .../sovereignBridge/pyScripts/notifier_round.py | 2 +- 8 files changed, 27 insertions(+), 24 deletions(-) rename scripts/testnet/sovereignBridge/pyScripts/{next_contract.py => compute_contract_address.py} (100%) diff --git a/scripts/testnet/sovereignBridge/config/configs.cfg b/scripts/testnet/sovereignBridge/config/configs.cfg index df3792c517f..a7fe4d005c4 100644 --- a/scripts/testnet/sovereignBridge/config/configs.cfg +++ b/scripts/testnet/sovereignBridge/config/configs.cfg @@ -1,7 +1,7 @@ #============ OWNER ============== WALLET="~/wallet.pem" -WALLET_ADDRESS=erd1crq888sv7c3j4y6d9etvlngs3q0tr3endufgls245j5y9yk0ulmqlsuute +WALLET_ADDRESS=erd1 #============ WASM FILES ============== @@ -16,6 +16,8 @@ ESDT_ISSUE_COST=50000000000000000 PROXY=https://testnet-gateway.multiversx.com CHAIN_ID=T PRICE_AGGREGATOR_ADDRESS=erd1qqqqqqqqqqqqqpgqfsfcrxnlym0fjlnuvus2dmlz6ju9cpsfexks8wq4d4 +WEGLD_TOKEN_ID=WEGLD-a28c59 +USDC_TOKEN_ID=USDC-350c4e PROXY_SOVEREIGN=http://localhost:7950 CHAIN_ID_SOVEREIGN=local-testnet @@ -26,14 +28,14 @@ MIN_VALID_SIGNERS=0 INITIATOR_ADDRESS=erd1crq888sv7c3j4y6d9etvlngs3q0tr3endufgls245j5y9yk0ulmqlsuute SIGNERS= -#============ ISSUE TOKEN SETTINGS ============== +#============ ISSUE MAIN CHAIN TOKEN SETTINGS ============== TOKEN_TICKER=TKN TOKEN_DISPLAY_NAME=Token NR_DECIMALS=18 INITIAL_SUPPLY=111222333 -#============ TOKEN TO DEPOSIT ============== +#============ MAIN CHAIN TOKEN TO DEPOSIT ============== DEPOSIT_TOKEN_IDENTIFIER= DEPOSIT_TOKEN_NR_DECIMALS=18 diff --git a/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh index b206d5fe008..bbe06d5ec3d 100644 --- a/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/esdt-safe.snippets.sh @@ -29,7 +29,7 @@ deployEsdtSafeContract() { ESDT_SAFE_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-esdt-safe-contract) echo -e "ESDT Safe contract: ${ADDRESS}" - local SOVEREIGN_CONTRACT_ADDRESS=$(firstSovereignContractAddress) + local SOVEREIGN_CONTRACT_ADDRESS=$(computeFirstSovereignContractAddress) mxpy data store --partition=sovereign --key=address-esdt-safe-contract --value=${SOVEREIGN_CONTRACT_ADDRESS} ESDT_SAFE_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-esdt-safe-contract) echo -e "ESDT Safe sovereign contract: ${SOVEREIGN_CONTRACT_ADDRESS}" @@ -138,7 +138,7 @@ setFeeMarketAddressCall() { } setMultisigAddress() { - CHECK_VARIABLES ESDT_SAFE_ADDRESS MULTISIG_VERIFIER_ADDRESS || return + checkVariables ESDT_SAFE_ADDRESS MULTISIG_VERIFIER_ADDRESS || return mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ --pem=${WALLET} \ @@ -153,7 +153,7 @@ setMultisigAddress() { } setSovereignBridgeAddress() { - CHECK_VARIABLES ESDT_SAFE_ADDRESS ESDT_SAFE_ADDRESS_SOVEREIGN || return + checkVariables ESDT_SAFE_ADDRESS ESDT_SAFE_ADDRESS_SOVEREIGN || return mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ --pem=${WALLET} \ diff --git a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh index 7c570a243f4..396498b3812 100644 --- a/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/fee-market.snippets.sh @@ -2,7 +2,7 @@ FEE_MARKET_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-fee-ma FEE_MARKET_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-fee-market-contract) deployFeeMarketContract() { - CHECK_VARIABLES ESDT_SAFE_ADDRESS || return + checkVariables ESDT_SAFE_ADDRESS || return mxpy --verbose contract deploy \ --bytecode=$(eval echo ${FEE_MARKET_WASM}) \ @@ -13,8 +13,8 @@ deployFeeMarketContract() { --arguments \ ${ESDT_SAFE_ADDRESS} \ ${PRICE_AGGREGATOR_ADDRESS} \ - str:USDC-350c4e \ - str:WEGLD-a28c59 \ + str:${USDC_TOKEN_ID} \ + str:${WEGLD_TOKEN_ID} \ --outfile="${SCRIPT_PATH}/deploy-fee-market.interaction.json" \ --recall-nonce \ --wait-result \ @@ -31,14 +31,14 @@ deployFeeMarketContract() { FEE_MARKET_ADDRESS=$(mxpy data load --partition=${CHAIN_ID} --key=address-fee-market-contract) echo -e "Fee Market contract: ${ADDRESS}" - local SOVEREIGN_CONTRACT_ADDRESS=$(secondSovereignContractAddress) + local SOVEREIGN_CONTRACT_ADDRESS=$(computeSecondSovereignContractAddress) mxpy data store --partition=sovereign --key=address-fee-market-contract --value=${SOVEREIGN_CONTRACT_ADDRESS} FEE_MARKET_ADDRESS_SOVEREIGN=$(mxpy data load --partition=sovereign --key=address-fee-market-contract) echo -e "Fee Market sovereign contract: ${SOVEREIGN_CONTRACT_ADDRESS}" } upgradeFeeMarketContract() { - CHECK_VARIABLES ESDT_SAFE_ADDRESS || return + checkVariables ESDT_SAFE_ADDRESS || return mxpy --verbose contract upgrade ${FEE_MARKET_ADDRESS} \ --bytecode=$(eval echo ${FEE_MARKET_WASM}) \ @@ -161,6 +161,7 @@ setAnyTokenFeeMarketContractCall() { echo "NOT IMPLEMENTED YET" } +# distribute all the fees to wallet distributeFees() { mxpy --verbose contract call ${FEE_MARKET_ADDRESS} \ --pem=${WALLET} \ diff --git a/scripts/testnet/sovereignBridge/config/helper.cfg b/scripts/testnet/sovereignBridge/config/helper.cfg index f2a77c63c9f..5bb86df9534 100644 --- a/scripts/testnet/sovereignBridge/config/helper.cfg +++ b/scripts/testnet/sovereignBridge/config/helper.cfg @@ -4,7 +4,7 @@ manualUpdateConfigFile() { source $SCRIPT_PATH/config/configs.cfg } -function update-config { +function updateConfig { TARGET_KEY=$1 REPLACEMENT_VALUE=$2 sed "s/^$TARGET_KEY=.*/$TARGET_KEY=$REPLACEMENT_VALUE/" $CONFIG_FILE > $SCRIPT_PATH/config/temp.x @@ -12,7 +12,7 @@ function update-config { source $CONFIG_FILE } -CHECK_VARIABLES() +checkVariables() { VAR_UNSET="" VARIABLE_NAMES=("$@") diff --git a/scripts/testnet/sovereignBridge/config/py.snippets.sh b/scripts/testnet/sovereignBridge/config/py.snippets.sh index 94f906b89ca..00063850f21 100644 --- a/scripts/testnet/sovereignBridge/config/py.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/py.snippets.sh @@ -1,9 +1,9 @@ -firstSovereignContractAddress() { - echo $(python3 $SCRIPT_PATH/pyScripts/next_contract.py $WALLET_ADDRESS 0) +computeFirstSovereignContractAddress() { + echo $(python3 $SCRIPT_PATH/pyScripts/compute_contract_address.py $WALLET_ADDRESS 0) } -secondSovereignContractAddress() { - echo $(python3 $SCRIPT_PATH/pyScripts/next_contract.py $WALLET_ADDRESS 1) +computeSecondSovereignContractAddress() { + echo $(python3 $SCRIPT_PATH/pyScripts/compute_contract_address.py $WALLET_ADDRESS 1) } getShardOfAddress() { diff --git a/scripts/testnet/sovereignBridge/config/token.snippets.sh b/scripts/testnet/sovereignBridge/config/token.snippets.sh index da815398f3e..4114ba2f03e 100644 --- a/scripts/testnet/sovereignBridge/config/token.snippets.sh +++ b/scripts/testnet/sovereignBridge/config/token.snippets.sh @@ -23,13 +23,13 @@ issueToken() { local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) - update-config DEPOSIT_TOKEN_IDENTIFIER $TOKEN_IDENTIFIER + updateConfig DEPOSIT_TOKEN_IDENTIFIER $TOKEN_IDENTIFIER } depositTokenInSC() { manualUpdateConfigFile #update config file - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return + checkVariables DEPOSIT_TOKEN_IDENTIFIER DEPOSIT_TOKEN_NR_DECIMALS DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER || return local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER*10^$DEPOSIT_TOKEN_NR_DECIMALS/1" | bc) @@ -80,11 +80,11 @@ issueTokenSovereign() { local HEX_TOKEN_IDENTIFIER=$(mxpy data parse --file="${SCRIPT_PATH}/issue-sovereign-token.interaction.json" --expression="data['transactionOnNetwork']['logs']['events'][2]['topics'][0]") local TOKEN_IDENTIFIER=$(echo "$HEX_TOKEN_IDENTIFIER" | xxd -r -p) - update-config DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER + updateConfig DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN $TOKEN_IDENTIFIER } registerToken() { - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN || return + checkVariables DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN || return mxpy --verbose contract call ${ESDT_SAFE_ADDRESS} \ --pem=${WALLET} \ @@ -105,7 +105,7 @@ registerToken() { } setLocalBurnRoleSovereign() { - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN ESDT_SAFE_ADDRESS_SOVEREIGN || return + checkVariables DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN ESDT_SAFE_ADDRESS_SOVEREIGN || return mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} \ --pem=${WALLET} \ @@ -123,7 +123,7 @@ setLocalBurnRoleSovereign() { } depositTokenInSCSovereign() { - CHECK_VARIABLES DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN || return + checkVariables DEPOSIT_TOKEN_IDENTIFIER_SOVEREIGN DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN || return local AMOUNT_TO_TRANSFER=$(echo "scale=0; $DEPOSIT_TOKEN_AMOUNT_TO_TRANSFER_SOVEREIGN*10^$DEPOSIT_TOKEN_NR_DECIMALS_SOVEREIGN/1" | bc) diff --git a/scripts/testnet/sovereignBridge/pyScripts/next_contract.py b/scripts/testnet/sovereignBridge/pyScripts/compute_contract_address.py similarity index 100% rename from scripts/testnet/sovereignBridge/pyScripts/next_contract.py rename to scripts/testnet/sovereignBridge/pyScripts/compute_contract_address.py diff --git a/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py b/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py index c0b9589805c..afd0cacfd88 100644 --- a/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py +++ b/scripts/testnet/sovereignBridge/pyScripts/notifier_round.py @@ -61,7 +61,7 @@ def main(): lines = file.readlines() updated_lines = update_notarization_round(lines, "MainChainNotarization", "MainChainNotarizationStartRound", - current_round) + current_round + 5) with open(toml_path, 'w') as file: file.writelines(updated_lines) From 014ec278fba965f2e2d3cf54b52b95eebaff3e1f Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Thu, 16 May 2024 18:07:11 +0300 Subject: [PATCH 6/6] fixes after review --- scripts/testnet/sovereignBridge/config/configs.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testnet/sovereignBridge/config/configs.cfg b/scripts/testnet/sovereignBridge/config/configs.cfg index a7fe4d005c4..6e614ba98fe 100644 --- a/scripts/testnet/sovereignBridge/config/configs.cfg +++ b/scripts/testnet/sovereignBridge/config/configs.cfg @@ -25,7 +25,7 @@ CHAIN_ID_SOVEREIGN=local-testnet #============ ESDT SAFE DEPLOY ARGUMENTS ============== MIN_VALID_SIGNERS=0 -INITIATOR_ADDRESS=erd1crq888sv7c3j4y6d9etvlngs3q0tr3endufgls245j5y9yk0ulmqlsuute +INITIATOR_ADDRESS=erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th SIGNERS= #============ ISSUE MAIN CHAIN TOKEN SETTINGS ==============