diff --git a/bridge-proxy/wasm/Cargo.lock b/bridge-proxy/wasm/Cargo.lock index 27a44e1f..bb3f7599 100644 --- a/bridge-proxy/wasm/Cargo.lock +++ b/bridge-proxy/wasm/Cargo.lock @@ -33,6 +33,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -55,6 +56,7 @@ name = "bridged-tokens-wrapper" version = "0.0.0" dependencies = [ "eth-address", + "mock-esdt-safe", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -108,6 +110,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", @@ -205,7 +208,9 @@ dependencies = [ name = "mock-esdt-safe" version = "0.0.0" dependencies = [ + "eth-address", "multiversx-sc", + "multiversx-sc-modules", ] [[package]] @@ -229,6 +234,13 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-proxies" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-price-aggregator-sc" version = "0.53.2" diff --git a/bridge-proxy/wasm/src/lib.rs b/bridge-proxy/wasm/src/lib.rs index 54e773c8..97c28d7c 100644 --- a/bridge-proxy/wasm/src/lib.rs +++ b/bridge-proxy/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 9 +// Endpoints: 8 // Async Callback (empty): 1 // Promise callbacks: 1 -// Total number of exported functions: 13 +// Total number of exported functions: 12 #![no_std] diff --git a/bridged-tokens-wrapper/wasm/Cargo.lock b/bridged-tokens-wrapper/wasm/Cargo.lock index b9c24aa6..1a3bb6a8 100644 --- a/bridged-tokens-wrapper/wasm/Cargo.lock +++ b/bridged-tokens-wrapper/wasm/Cargo.lock @@ -25,6 +25,7 @@ name = "bridged-tokens-wrapper" version = "0.0.0" dependencies = [ "eth-address", + "mock-esdt-safe", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -75,6 +76,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "multiversx-sc-modules", +] + [[package]] name = "multiversx-sc" version = "0.53.2" diff --git a/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock index ba9f94e7..64083fe1 100644 --- a/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock +++ b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock @@ -26,6 +26,13 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "eth-address" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "hex" version = "0.4.3" @@ -42,7 +49,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" name = "mock-esdt-safe" version = "0.0.0" dependencies = [ + "eth-address", "multiversx-sc", + "multiversx-sc-modules", ] [[package]] @@ -103,6 +112,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.53.2" diff --git a/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml index cf6bffc5..1c88bd9f 100644 --- a/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml +++ b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "=0.53.2" [workspace] members = ["."] diff --git a/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs b/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs index e6872d67..7c9a8414 100644 --- a/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs +++ b/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 0 +// Endpoints: 1 // Async Callback (empty): 1 -// Total number of exported functions: 3 +// Total number of exported functions: 4 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + createTransaction => create_transaction ) } diff --git a/common/sc-proxies/src/esdt_safe_proxy.rs b/common/sc-proxies/src/esdt_safe_proxy.rs index 3b29e253..154e5081 100644 --- a/common/sc-proxies/src/esdt_safe_proxy.rs +++ b/common/sc-proxies/src/esdt_safe_proxy.rs @@ -153,24 +153,6 @@ where .original_result() } - pub fn create_transaction_sc_call< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, - >( - self, - to: Arg0, - data: Arg1, - opt_refund_info: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("createTransactionSCCall") - .argument(&to) - .argument(&data) - .argument(&opt_refund_info) - .original_result() - } - /// Claim funds for failed MultiversX -> Ethereum transactions. /// These are not sent automatically to prevent the contract getting stuck. /// For example, if the receiver is a SC, a frozen account, etc. diff --git a/common/sc-proxies/src/mock_multisig_proxy.rs b/common/sc-proxies/src/mock_multisig_proxy.rs new file mode 100644 index 00000000..8f23fa83 --- /dev/null +++ b/common/sc-proxies/src/mock_multisig_proxy.rs @@ -0,0 +1,156 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct MockMultisigProxy; + +impl TxProxyTrait for MockMultisigProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = MockMultisigProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + MockMultisigProxyMethods { wrapped_tx: tx } + } +} + +pub struct MockMultisigProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl MockMultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg>, + Arg5: ProxyArg>, + Arg6: ProxyArg>, + Arg7: ProxyArg, + Arg8: ProxyArg>>, + >( + self, + esdt_safe_sc_address: Arg0, + multi_transfer_sc_address: Arg1, + proxy_sc_address: Arg2, + bridged_tokens_wrapper_sc_address: Arg3, + price_aggregator_sc_address: Arg4, + _required_stake: Arg5, + _slash_amount: Arg6, + _quorum: Arg7, + _board: Arg8, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&esdt_safe_sc_address) + .argument(&multi_transfer_sc_address) + .argument(&proxy_sc_address) + .argument(&bridged_tokens_wrapper_sc_address) + .argument(&price_aggregator_sc_address) + .argument(&_required_stake) + .argument(&_slash_amount) + .argument(&_quorum) + .argument(&_board) + .original_result() + } +} + +#[rustfmt::skip] +impl MockMultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl MockMultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn esdt_safe_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getEsdtSafeAddress") + .original_result() + } + + pub fn multi_transfer_esdt_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getMultiTransferEsdtAddress") + .original_result() + } + + pub fn proxy_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getProxyAddress") + .original_result() + } + + pub fn bridged_tokens_wrapper_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBridgedTokensWrapperAddress") + .original_result() + } + + pub fn fee_estimator_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFeeEstimatorAddress") + .original_result() + } +} diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index c7aad34a..47c913b4 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -382,45 +382,6 @@ pub trait EsdtSafe: } } - #[payable("*")] - #[endpoint(createTransactionSCCall)] - fn create_transaction_sc_call( - &self, - to: EthAddress, - data: ManagedBuffer, - opt_refund_info: OptionalValue>, - ) { - let transaction_details = self.create_transaction_common(to, opt_refund_info); - - if !transaction_details.is_refund_tx { - self.create_transaction_sc_call_event( - transaction_details.batch_id, - transaction_details.tx_nonce, - transaction_details.payment_token, - transaction_details.actual_bridged_amount, - transaction_details.required_fee, - transaction_details - .refund_info - .address - .as_managed_buffer() - .clone(), - transaction_details.to_address, - data, - ); - } else { - self.create_refund_transaction_sc_call_event( - transaction_details.batch_id, - transaction_details.tx_nonce, - transaction_details.payment_token, - transaction_details.actual_bridged_amount, - transaction_details.required_fee, - transaction_details.refund_info.initial_batch_id, - transaction_details.refund_info.initial_nonce, - data, - ); - } - } - /// Claim funds for failed MultiversX -> Ethereum transactions. /// These are not sent automatically to prevent the contract getting stuck. /// For example, if the receiver is a SC, a frozen account, etc. diff --git a/esdt-safe/tests/esdt_safe_blackbox_test.rs b/esdt-safe/tests/esdt_safe_blackbox_test.rs index ce8a98da..bf6ca44f 100644 --- a/esdt-safe/tests/esdt_safe_blackbox_test.rs +++ b/esdt-safe/tests/esdt_safe_blackbox_test.rs @@ -835,59 +835,6 @@ fn esdt_safe_create_transaction() { assert_eq!(total_balances, 120000u64); } -#[test] -fn esdt_create_transaction_sc_call_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), - ); - - state.config_esdtsafe(); - - let refund_info = sc_proxies::esdt_safe_proxy::RefundInfo:: { - address: ManagedAddress::from(OWNER_ADDRESS.eval_to_array()), - initial_batch_id: 1u64, - initial_nonce: 1u64, - }; - - let data = ManagedBuffer::::from(b"Some data"); - - state - .world - .tx() - .from(BRIDGE_PROXY_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .create_transaction_sc_call( - EthAddress::zero(), - data.clone(), - OptionalValue::Some(refund_info.clone()), - ) - .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) - .returns(ReturnsResult) - .run(); - - state - .world - .tx() - .from(MULTISIG_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .create_transaction_sc_call( - EthAddress::zero(), - data.clone(), - OptionalValue::None::>, - ) - .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) - .returns(ReturnsResult) - .run(); -} - #[test] fn add_refund_batch_test() { let mut state = EsdtSafeTestState::new(); diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 0ddbdbb0..475f88df 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -56,6 +56,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", @@ -178,6 +179,13 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-proxies" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-price-aggregator-sc" version = "0.53.2" diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 283851b2..e4c10874 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 44 +// Endpoints: 43 // Async Callback (empty): 1 -// Total number of exported functions: 47 +// Total number of exported functions: 46 #![no_std] @@ -23,7 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { setTransactionBatchStatus => set_transaction_batch_status addRefundBatch => add_refund_batch createTransaction => create_transaction - createTransactionSCCall => create_transaction_sc_call claimRefund => claim_refund withdrawRefundFeesForEthereum => withdraw_refund_fees_for_ethereum withdrawTransactionFees => withdraw_transaction_fees diff --git a/multi-transfer-esdt/wasm/Cargo.lock b/multi-transfer-esdt/wasm/Cargo.lock index 307057d2..620bff73 100644 --- a/multi-transfer-esdt/wasm/Cargo.lock +++ b/multi-transfer-esdt/wasm/Cargo.lock @@ -33,6 +33,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -47,6 +48,7 @@ name = "bridged-tokens-wrapper" version = "0.0.0" dependencies = [ "eth-address", + "mock-esdt-safe", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -100,6 +102,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", @@ -197,7 +200,9 @@ dependencies = [ name = "mock-esdt-safe" version = "0.0.0" dependencies = [ + "eth-address", "multiversx-sc", + "multiversx-sc-modules", ] [[package]] @@ -221,6 +226,13 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-proxies" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multi-transfer-esdt" version = "0.0.0" @@ -230,8 +242,10 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", diff --git a/multisig/wasm/Cargo.lock b/multisig/wasm/Cargo.lock index 25373d30..5af96c1d 100644 --- a/multisig/wasm/Cargo.lock +++ b/multisig/wasm/Cargo.lock @@ -33,6 +33,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -47,6 +48,7 @@ name = "bridged-tokens-wrapper" version = "0.0.0" dependencies = [ "eth-address", + "mock-esdt-safe", "multiversx-sc", "multiversx-sc-modules", "sc-proxies", @@ -100,6 +102,7 @@ dependencies = [ "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", @@ -197,7 +200,9 @@ dependencies = [ name = "mock-esdt-safe" version = "0.0.0" dependencies = [ + "eth-address", "multiversx-sc", + "multiversx-sc-modules", ] [[package]] @@ -221,6 +226,13 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-proxies" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multi-transfer-esdt" version = "0.0.0" @@ -230,8 +242,10 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "sc-proxies",