Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v3 into v3.5 11.11 #253

Merged
merged 12 commits into from
Nov 13, 2024
17 changes: 0 additions & 17 deletions bridge-proxy/scenarios/bridge_proxy_execute_crowdfunding.scen.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,6 @@
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "address:owner",
"to": "sc:bridged-tokens-wrapper",
"function": "setEsdtSafeContractAddress",
"arguments": [
"0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f"
],
"gasLimit": "5,000,000"
},
"expect": {
"out": [],
"status": "0"
}
},
{
"step": "scCall",
"id": "",
Expand Down
3 changes: 2 additions & 1 deletion bridged-tokens-wrapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,14 @@ pub trait BridgedTokensWrapper:
fn unwrap_token_create_transaction(
&self,
requested_token: TokenIdentifier,
safe_address: ManagedAddress<Self::Api>,
to: EthAddress<Self::Api>,
) {
let converted_amount = self.unwrap_token_common(&requested_token);

let caller = self.blockchain().get_caller();
self.tx()
.to(self.get_esdt_safe_address())
.to(safe_address)
.typed(esdt_safe_proxy::EsdtSafeProxy)
.create_transaction(
to,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ fn test_unwrap_token_create_transaction_should_fail_case_1() {
let address = convert_to_eth_address(ETH_ADDRESS);
sc.unwrap_token_create_transaction(
managed_token_id!(UNIVERSAL_TOKEN_IDENTIFIER),
ManagedAddress::new_from_bytes(
b"0102030405060708090a0b0c0d0e0f10",
),
address,
);
},
Expand Down Expand Up @@ -428,6 +431,9 @@ fn test_unwrap_token_create_transaction_should_fail_case_2() {
let address = convert_to_eth_address(ETH_ADDRESS);
sc.unwrap_token_create_transaction(
managed_token_id!(UNIVERSAL_TOKEN_IDENTIFIER),
ManagedAddress::new_from_bytes(
b"0102030405060708090a0b0c0d0e0f10",
),
address,
);
},
Expand Down Expand Up @@ -465,6 +471,7 @@ fn test_unwrap_token_create_transaction_should_fail_case_3() {
let address = convert_to_eth_address(ETH_ADDRESS);
sc.unwrap_token_create_transaction(
managed_token_id!(UNIVERSAL_TOKEN_IDENTIFIER),
ManagedAddress::zero(),
address,
);
},
Expand Down Expand Up @@ -537,6 +544,7 @@ fn test_unwrap_token_create_transaction_should_fail_case_4() {
let address = convert_to_eth_address(ETH_ADDRESS);
sc.unwrap_token_create_transaction(
managed_token_id!(UNIVERSAL_TOKEN_IDENTIFIER),
ManagedAddress::zero(),
address,
);
},
Expand Down
7 changes: 5 additions & 2 deletions common/sc-proxies/src/bridged_tokens_wrapper_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,18 @@ where

pub fn unwrap_token_create_transaction<
Arg0: ProxyArg<TokenIdentifier<Env::Api>>,
Arg1: ProxyArg<eth_address::EthAddress<Env::Api>>,
Arg1: ProxyArg<ManagedAddress<Env::Api>>,
Arg2: ProxyArg<eth_address::EthAddress<Env::Api>>,
>(
self,
requested_token: Arg0,
to: Arg1,
safe_address: Arg1,
to: Arg2,
) -> TxTypedCall<Env, From, To, (), Gas, ()> {
self.wrapped_tx
.raw_call("unwrapTokenCreateTransaction")
.argument(&requested_token)
.argument(&safe_address)
.argument(&to)
.original_result()
}
Expand Down
8 changes: 5 additions & 3 deletions multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ fn test_unwrap_token_create_transaction_paused() {
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(
TokenIdentifier::from(UNIVERSAL_TOKEN_IDENTIFIER),
ESDT_SAFE_ADDRESS.to_address(),
EthAddress::zero(),
)
.egld_or_single_esdt(
Expand Down Expand Up @@ -1067,7 +1068,7 @@ fn test_unwrap_token_create_transaction_insufficient_liquidity() {
.from(USER1_ADDRESS)
.to(BRIDGED_TOKENS_WRAPPER_ADDRESS)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, EthAddress::zero())
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, ESDT_SAFE_ADDRESS.to_address(), EthAddress::zero())
.egld_or_single_esdt(
&EgldOrEsdtTokenIdentifier::esdt(UNIVERSAL_TOKEN_IDENTIFIER),
0u64,
Expand Down Expand Up @@ -1126,7 +1127,7 @@ fn test_unwrap_token_create_transaction_should_work() {
.from(USER1_ADDRESS)
.to(BRIDGED_TOKENS_WRAPPER_ADDRESS)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, EthAddress::zero())
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, ESDT_SAFE_ADDRESS.to_address(), EthAddress::zero())
.egld_or_single_esdt(
&EgldOrEsdtTokenIdentifier::esdt(UNIVERSAL_TOKEN_IDENTIFIER),
0u64,
Expand Down Expand Up @@ -1170,7 +1171,7 @@ fn test_unwrap_token_create_transaction_should_fail() {
.from(USER1_ADDRESS)
.to(BRIDGED_TOKENS_WRAPPER_ADDRESS)
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, EthAddress::zero())
.unwrap_token_create_transaction(WRAPPED_TOKEN_ID, ESDT_SAFE_ADDRESS.to_address(), EthAddress::zero())
.egld_or_single_esdt(
&EgldOrEsdtTokenIdentifier::esdt(TOKEN_TICKER),
0u64,
Expand All @@ -1196,6 +1197,7 @@ fn test_unwrap_token_create_transaction_amount_zero() {
.typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy)
.unwrap_token_create_transaction(
TokenIdentifier::from(WRAPPED_TOKEN_ID),
ESDT_SAFE_ADDRESS.to_address(),
EthAddress::zero(),
)
.egld_or_single_esdt(
Expand Down
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}
}
3 changes: 0 additions & 3 deletions multisig/interaction/config/menu_functions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ function deploy-bridge-contracts {
confirmation-with-skip setMultiTransferOnSCProxy
confirmation-with-skip setEsdtSafeOnSCProxy

confirmation-with-skip setEsdtSafeOnWrapper

confirmation-with-skip setBridgedTokensWrapperOnEsdtSafe
confirmation-with-skip setSCProxyOnEsdtSafe

Expand Down Expand Up @@ -179,7 +177,6 @@ function upgrade-aggregator {

function upgrade-wrapper {
wrapper-upgrade
confirmation-with-skip setEsdtSafeOnWrapper
}

function upgrade-safe {
Expand Down
Loading
Loading