diff --git a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs index 33449bca..b0087c2b 100644 --- a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs +++ b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs @@ -991,7 +991,7 @@ fn bridge_proxy_empty_endpoint_with_gas_test() { test.world .check_account(BRIDGE_PROXY_ADDRESS) - .check_storage("str:refundTransactions.mapped|u32:1", "0x30313032303330343035303630373038303931300000000000000000050063726f7766756e64696e675f5f5f5f5f5f5f5f5f5f5f0000000d4252494447452d3132333435360000000201f4000000000000000101000000110000000000000000009896800100000000") + .check_storage("str:refundTransactions.mapped|u32:1", "0x30313032303330343035303630373038303931300000000000000000050063726f7766756e64696e675f5f5f5f5f5f5f5f5f5f5f0000000d4252494447452d3132333435360000000201f40000000000000001010000000d00000000000000000098968000") .check_storage("str:refundTransactions.value|u32:1", "0x01") .check_storage("str:refundTransactions.node_id|u32:1", "0x01") .check_storage("str:refundTransactions.info", "0x00000001000000010000000100000001") diff --git a/common/sc-proxies/src/multisig_proxy.rs b/common/sc-proxies/src/multisig_proxy.rs index 06d2b7e7..f3e21fdf 100644 --- a/common/sc-proxies/src/multisig_proxy.rs +++ b/common/sc-proxies/src/multisig_proxy.rs @@ -697,14 +697,6 @@ where .original_result() } - pub fn bridged_tokens_wrapper_deposit_liquidity( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("bridgedTokensWrapperDepositLiquidity") - .original_result() - } - /// Minimum number of signatures needed to perform any action. pub fn quorum( self, diff --git a/esdt-safe/tests/esdt_safe_blackbox_test.rs b/esdt-safe/tests/esdt_safe_blackbox_test.rs index 8ab9799b..c3e3e06e 100644 --- a/esdt-safe/tests/esdt_safe_blackbox_test.rs +++ b/esdt-safe/tests/esdt_safe_blackbox_test.rs @@ -347,7 +347,9 @@ impl EsdtSafeTestState { ) { self.esdt_raw_transaction() .create_transaction( - EthAddress::zero(), + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, OptionalValue::>::None, ) .egld_or_single_esdt( @@ -362,7 +364,9 @@ impl EsdtSafeTestState { fn single_transaction_should_work(&mut self, token_id: TestTokenIdentifier, amount: u64) { self.esdt_raw_transaction() .create_transaction( - EthAddress::zero(), + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, OptionalValue::>::None, ) .egld_or_single_esdt( @@ -717,7 +721,12 @@ fn esdt_safe_create_transaction() { .from(BRIDGE_PROXY_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) - .create_refund_transaction(EthAddress::zero(), OptionalValue::Some(refund_info.clone())) + .create_refund_transaction( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + OptionalValue::Some(refund_info.clone()), + ) .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) .run(); @@ -727,7 +736,12 @@ fn esdt_safe_create_transaction() { .from(BRIDGED_TOKENS_WRAPPER_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) - .create_refund_transaction(EthAddress::zero(), OptionalValue::Some(refund_info.clone())) + .create_transaction( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + OptionalValue::>::None, + ) .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) .run(); @@ -776,6 +790,44 @@ fn esdt_safe_create_transaction() { assert_eq!(total_balances, 120000u64); } +#[test] +fn create_refund_transaction_not_from_bridge_proxy_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + + state.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-WITH", + BigUint::from(10_000_000u64), + ); + + let refund_info = sc_proxies::esdt_safe_proxy::RefundInfo:: { + address: ManagedAddress::from(OWNER_ADDRESS.eval_to_array()), + initial_batch_id: 1u64, + initial_nonce: 1u64, + }; + + state + .world + .tx() + .from(OWNER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_refund_transaction( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + OptionalValue::Some(refund_info.clone()), + ) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .returns(ExpectError( + ERROR, + "Only BridgeProxy SC can call this endpoint", + )) + .run(); +} + #[test] fn add_refund_batch_test() { let mut state = EsdtSafeTestState::new(); @@ -1233,6 +1285,22 @@ fn withdraw_transaction_fees_test() { OptionalValue::>::None, ) .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(1_000_000u64)) + .returns(ExpectError(ERROR, "Cannot send to an empty address")) + .run(); + + state + .world + .tx() + .from(OWNER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + OptionalValue::>::None, + ) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(1_000_000u64)) .returns(ReturnsResult) .run(); diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index 528c5a55..5e193701 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -1173,7 +1173,9 @@ fn test_unwrap_token_create_transaction_should_work() { .unwrap_token_create_transaction( WRAPPED_TOKEN_ID, ESDT_SAFE_ADDRESS.to_address(), - EthAddress::zero(), + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, OptionalValue::>::None, ) .egld_or_single_esdt( diff --git a/multisig/src/setup.rs b/multisig/src/setup.rs index 5c9b348c..8e90cdf1 100644 --- a/multisig/src/setup.rs +++ b/multisig/src/setup.rs @@ -1,10 +1,7 @@ use multiversx_sc::imports::*; use eth_address::EthAddress; -use sc_proxies::{ - bridge_proxy_contract_proxy, esdt_safe_proxy, - multi_transfer_esdt_proxy, -}; +use sc_proxies::{bridge_proxy_contract_proxy, esdt_safe_proxy, multi_transfer_esdt_proxy}; const MAX_BOARD_MEMBERS: usize = 40; diff --git a/multisig/tests/multisig_blackbox_test.rs b/multisig/tests/multisig_blackbox_test.rs index ccbf853f..26588718 100644 --- a/multisig/tests/multisig_blackbox_test.rs +++ b/multisig/tests/multisig_blackbox_test.rs @@ -415,7 +415,9 @@ impl MultiTransferTestState { .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .create_transaction( - EthAddress::zero(), + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, OptionalValue::>::None, ) .single_esdt( @@ -431,7 +433,9 @@ impl MultiTransferTestState { .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .create_transaction( - EthAddress::zero(), + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, OptionalValue::>::None, ) .single_esdt( @@ -1820,7 +1824,9 @@ fn test_add_mapping_success() { let token_id = TokenIdentifier::from(WEGLD_TOKEN_ID); - let erc20_address = EthAddress::zero(); + let erc20_address = EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }; state .world @@ -1858,7 +1864,9 @@ fn test_add_mapping_token_id_already_mapped() { let token_id = TokenIdentifier::from(WEGLD_TOKEN_ID); - let erc20_address = EthAddress::zero(); + let erc20_address = EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }; state .world @@ -1888,7 +1896,9 @@ fn test_add_mapping_erc20_address_already_mapped() { let token_id = TokenIdentifier::from(WEGLD_TOKEN_ID); - let erc20_address = EthAddress::zero(); + let erc20_address = EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }; state .world @@ -1918,7 +1928,9 @@ fn test_clear_mapping_success() { let token_id = TokenIdentifier::from(WEGLD_TOKEN_ID); - let erc20_address = EthAddress::zero(); + let erc20_address = EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }; state .world