Skip to content

Commit

Permalink
Merge pull request #252 from multiversx/mainnet-v3-scripts
Browse files Browse the repository at this point in the history
Mainnet v3 deploy scripts
  • Loading branch information
iulianpascalau authored Nov 11, 2024
2 parents 5868e9c + 0890bd4 commit afebbbd
Show file tree
Hide file tree
Showing 15 changed files with 723 additions and 78 deletions.
12 changes: 6 additions & 6 deletions multisig/interaction/config/aggregator-snippets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ deployAggregator() {
CHECK_VARIABLES AGGREGATOR_WASM CHAIN_SPECIFIC_TOKEN ORACLE_ADDR_0 ORACLE_ADDR_1 ORACLE_ADDR_2

STAKE=$(echo "$ORACLE_REQUIRED_STAKE*10^18" | bc)
mxpy --verbose contract deploy --bytecode=${AGGREGATOR_WASM} --recall-nonce --pem=${ALICE} \
mxpy contract deploy --bytecode=${AGGREGATOR_WASM} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=100000000 --arguments str:EGLD ${STAKE} 1 2 3 \
${ORACLE_ADDR_0} ${ORACLE_ADDR_1} ${ORACLE_ADDR_2} \
--send --outfile=deploy-price-agregator-testnet.interaction.json --proxy=${PROXY} --chain=${CHAIN_ID} || return
Expand Down Expand Up @@ -66,7 +66,7 @@ submitAggregatorBatch() {
setPairDecimals() {
CHECK_VARIABLES AGGREGATOR

mxpy --verbose contract call ${AGGREGATOR} --recall-nonce --pem=${ALICE} \
mxpy contract call ${AGGREGATOR} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=15000000 --function="setPairDecimals" \
--arguments str:GWEI str:${CHAIN_SPECIFIC_TOKEN_TICKER} 0 \
--send --proxy=${PROXY} --chain=${CHAIN_ID} || return
Expand All @@ -75,31 +75,31 @@ setPairDecimals() {
pauseAggregator() {
CHECK_VARIABLES AGGREGATOR

mxpy --verbose contract call ${AGGREGATOR} --recall-nonce --pem=${ALICE} \
mxpy contract call ${AGGREGATOR} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=5000000 --function="pause" \
--send --proxy=${PROXY} --chain=${CHAIN_ID} || return
}

pauseAggregatorV2() {
CHECK_VARIABLES AGGREGATOR_v2

mxpy --verbose contract call ${AGGREGATOR_v2} --recall-nonce --pem=${ALICE} \
mxpy contract call ${AGGREGATOR_v2} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=5000000 --function="pause" \
--send --proxy=${PROXY} --chain=${CHAIN_ID} || return
}

unpauseAggregator() {
CHECK_VARIABLES AGGREGATOR

mxpy --verbose contract call ${AGGREGATOR} --recall-nonce --pem=${ALICE} \
mxpy contract call ${AGGREGATOR} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=5000000 --function="unpause" \
--send --proxy=${PROXY} --chain=${CHAIN_ID} || return
}

aggregator-upgrade() {
CHECK_VARIABLES AGGREGATOR AGGREGATOR_WASM

mxpy --verbose contract upgrade ${AGGREGATOR} --bytecode=${AGGREGATOR_WASM} --recall-nonce --pem=${ALICE} \
mxpy contract upgrade ${AGGREGATOR} --bytecode=${AGGREGATOR_WASM} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=100000000 --send \
--outfile="upgrade-aggregator.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return
}
6 changes: 6 additions & 0 deletions multisig/interaction/config/configs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ CHAIN_ID=T
ALICE="./wallets/erd1zsha9cvx7gwraytgp740dcjzwy9v5xwnmas77d33uve6sk0rs0vqel4ln5.pem"
ALICE_ADDRESS=erd1zsha9cvx7gwraytgp740dcjzwy9v5xwnmas77d33uve6sk0rs0vqel4ln5

MXPY_SIGN=()
#use this for signing transactions with a pem file
#MXPY_SIGN+=(--pem=${ALICE})
#use this to sign with ledger
MXPY_SIGN+=(--ledger)

#============WASM FILES==============

AGGREGATOR_WASM="./multiversx-price-aggregator-sc.wasm"
Expand Down
31 changes: 31 additions & 0 deletions multisig/interaction/config/helper.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,37 @@ function manual-update-config-file {
source $SCRIPTPATH/config/configs.cfg
}

function confirmation-multiple {
DISPLAY_STR=""
for var in "$@"
do
DISPLAY_STR="${DISPLAY_STR} & ${var}"
done

echo -e
read -p "Do you want to go on with ${GREEN}${DISPLAY_STR}${NC} (Default No) ? (Yy/Nn)" yn
echo -e

case $yn in
[Yy]* )

echo -e "${GREEN}Proceeding with ${DISPLAY_STR}!${NC}"
for var in "$@"
do
confirmation ${var}
done

;;
[Nn]* )
echo -e "${GREEN}Exiting...${NC}"
;;

* )
echo -e "${GREEN}I'll take that as a no then... ${NC}"
;;
esac
}

function update-config {
TARGET_KEY=$1
REPLACEMENT_VALUE=$2
Expand Down
12 changes: 6 additions & 6 deletions multisig/interaction/config/issue-tokens-snippets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ issueUniversalToken() {
CHECK_VARIABLES ESDT_SYSTEM_SC_ADDRESS ESDT_ISSUE_COST UNIVERSAL_TOKEN_DISPLAY_NAME \
UNIVERSAL_TOKEN_TICKER NR_DECIMALS_UNIVERSAL

mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce --pem=${ALICE} \
mxpy contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=60000000 --value=${ESDT_ISSUE_COST} --function="issue" \
--arguments str:${UNIVERSAL_TOKEN_DISPLAY_NAME} str:${UNIVERSAL_TOKEN_TICKER} \
0 ${NR_DECIMALS_UNIVERSAL} str:canAddSpecialRoles str:true \
Expand All @@ -17,7 +17,7 @@ issueChainSpecificToken() {

VALUE_TO_MINT=$(echo "scale=0; $UNIVERSAL_TOKENS_ALREADY_MINTED*10^$NR_DECIMALS_CHAIN_SPECIFIC/1" | bc)

mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce --pem=${ALICE} \
mxpy contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=60000000 --value=${ESDT_ISSUE_COST} --function="issue" \
--arguments str:${CHAIN_SPECIFIC_TOKEN_DISPLAY_NAME} str:${CHAIN_SPECIFIC_TOKEN_TICKER} \
${VALUE_TO_MINT} ${NR_DECIMALS_CHAIN_SPECIFIC} str:canAddSpecialRoles str:true \
Expand All @@ -29,21 +29,21 @@ transferToSC() {

VALUE_TO_MINT=$(echo "scale=0; $UNIVERSAL_TOKENS_ALREADY_MINTED*10^$NR_DECIMALS_CHAIN_SPECIFIC/1" | bc)

mxpy --verbose contract call ${BRIDGED_TOKENS_WRAPPER} --recall-nonce --pem=${ALICE} \
mxpy contract call ${BRIDGED_TOKENS_WRAPPER} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=5000000 --function="ESDTTransfer" \
--arguments str:${CHAIN_SPECIFIC_TOKEN} ${VALUE_TO_MINT} str:depositLiquidity \
--send --proxy=${PROXY} --chain=${CHAIN_ID}
}

setMintRole() {
mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce --pem=${ALICE} \
mxpy contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=60000000 --function="setSpecialRole" \
--arguments str:${CHAIN_SPECIFIC_TOKEN} ${ALICE_ADDRESS} str:ESDTRoleLocalMint \
--send --proxy=${PROXY} --chain=${CHAIN_ID}
}

unSetMintRole() {
mxpy --verbose contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce --pem=${ALICE} \
mxpy contract call ${ESDT_SYSTEM_SC_ADDRESS} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=60000000 --function="unSetSpecialRole" \
--arguments str:${CHAIN_SPECIFIC_TOKEN} ${ALICE_ADDRESS} str:ESDTRoleLocalMint \
--send --proxy=${PROXY} --chain=${CHAIN_ID}
Expand All @@ -53,7 +53,7 @@ mint() {
CHECK_VARIABLES NR_DECIMALS_CHAIN_SPECIFIC ALICE_ADDRESS CHAIN_SPECIFIC_TOKEN
read -p "Amount to mint(without decimals): " AMOUNT_TO_MINT
VALUE_TO_MINT=$(echo "scale=0; $AMOUNT_TO_MINT*10^$NR_DECIMALS_CHAIN_SPECIFIC/1" | bc)
mxpy --verbose contract call ${ALICE_ADDRESS} --recall-nonce --pem=${ALICE} \
mxpy contract call ${ALICE_ADDRESS} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=300000 --function="ESDTLocalMint" \
--arguments str:${CHAIN_SPECIFIC_TOKEN} ${VALUE_TO_MINT} \
--send --proxy=${PROXY} --chain=${CHAIN_ID}
Expand Down
25 changes: 25 additions & 0 deletions multisig/interaction/config/mainnet-release-v3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
deployMultisigMainnetV3() {
CHECK_VARIABLES RELAYER_ADDR_0 RELAYER_ADDR_1 RELAYER_ADDR_2 RELAYER_ADDR_3 \
RELAYER_ADDR_4 RELAYER_ADDR_5 RELAYER_ADDR_6 RELAYER_ADDR_7 RELAYER_ADDR_8 \
RELAYER_ADDR_9 SAFE MULTI_TRANSFER BRIDGE_PROXY RELAYER_REQUIRED_STAKE SLASH_AMOUNT QUORUM MULTISIG_WASM

MIN_STAKE=$(echo "$RELAYER_REQUIRED_STAKE*10^18" | bc)
mxpy contract deploy --bytecode=${MULTISIG_WASM} --recall-nonce "${MXPY_SIGN[@]}" \
--gas-limit=200000000 \
--arguments ${SAFE} ${MULTI_TRANSFER} ${BRIDGE_PROXY} \
${MIN_STAKE} ${SLASH_AMOUNT} ${QUORUM} \
${RELAYER_ADDR_0} ${RELAYER_ADDR_1} ${RELAYER_ADDR_2} ${RELAYER_ADDR_3} \
${RELAYER_ADDR_4} ${RELAYER_ADDR_5} ${RELAYER_ADDR_6} ${RELAYER_ADDR_7} \
${RELAYER_ADDR_8} ${RELAYER_ADDR_9} \
--send --outfile="deploy-testnet.interaction.json" --proxy=${PROXY} --chain=${CHAIN_ID} || return

TRANSACTION=$(mxpy data parse --file="./deploy-testnet.interaction.json" --expression="data['emitted_tx']['hash']")
ADDRESS=$(mxpy data parse --file="./deploy-testnet.interaction.json" --expression="data['contractAddress']")

mxpy data store --key=address-testnet-multisig --value=${ADDRESS}
mxpy data store --key=deployTransaction-testnet --value=${TRANSACTION}

echo ""
echo "Multisig contract address: ${ADDRESS}"
update-config MULTISIG ${ADDRESS}
}
Loading

0 comments on commit afebbbd

Please sign in to comment.