From f43acbe0733414528c1bdeec4c6305c3dd53a8f6 Mon Sep 17 00:00:00 2001 From: Eveline Molnar Date: Wed, 30 Oct 2024 08:43:48 +0200 Subject: [PATCH 1/3] upgrade test --- Cargo.lock | 1 + multi-transfer-esdt/Cargo.toml | 3 +++ .../tests/multi_transfer_blackbox_test.rs | 27 ++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 573f1171..ac17940c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -679,6 +679,7 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multi-transfer-esdt", "mock-multisig", "mock-price-aggregator", "multiversx-sc", diff --git a/multi-transfer-esdt/Cargo.toml b/multi-transfer-esdt/Cargo.toml index fbd83241..817aa361 100644 --- a/multi-transfer-esdt/Cargo.toml +++ b/multi-transfer-esdt/Cargo.toml @@ -38,6 +38,9 @@ path = "../common/storage-module" [dependencies.mock-multisig] path = "../common/mock-contracts/mock-multisig" +[dependencies.mock-multi-transfer-esdt] +path = "../common/mock-contracts/mock-multi-transfer-esdt" + [dependencies.mock-price-aggregator] path = "../common/mock-contracts/mock-price-aggregator" diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index 9ced6e65..28b34bec 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -65,6 +65,9 @@ const BRIDGED_TOKENS_WRAPPER_CODE_PATH: MxscPath = MxscPath::new("../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json"); const MOCK_MULTISIG_CODE_PATH: MxscPath = MxscPath::new("../common/mock-contracts/mock-multisig/output/mock-multisig.mxsc.json"); +const MOCK_MULTI_TRANSFER_CODE_PATH: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-multi-transfer-esdt/output/mock-multi-transfer-esdt.mxsc.json", +); const MOCK_PRICE_AGGREGATOR_CODE_PATH: MxscPath = MxscPath::new( "../common/mock-contracts/mock-price-aggregator/output/mock-price-aggregator.mxsc.json", ); @@ -110,6 +113,11 @@ fn world() -> ScenarioWorld { mock_price_aggregator::ContractBuilder, ); + blockchain.register_contract( + MOCK_MULTI_TRANSFER_CODE_PATH, + mock_multi_transfer_esdt::ContractBuilder, + ); + blockchain } @@ -514,6 +522,21 @@ fn test_config() { state.config_bridged_tokens_wrapper(); } +#[test] +fn test_upgrade() { + let mut state = MultiTransferTestState::new(); + state.deploy_contracts(); + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(MULTI_TRANSFER_ADDRESS) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) + .upgrade() + .code(MULTI_TRANSFER_CODE_PATH) + .run(); +} + #[test] fn basic_transfer_test() { let mut state = MultiTransferTestState::new(); @@ -780,6 +803,8 @@ fn batch_transfer_both_failed_test() { assert!(first_batch.is_none()); } + + #[test] fn test_unwrap_token_create_transaction_paused() { let mut state = MultiTransferTestState::new(); @@ -866,7 +891,7 @@ fn test_unwrap_token_create_transaction_should_work() { state.config_multi_transfer(); state.config_bridged_tokens_wrapper(); - + state .world .tx() From c660c3a36187b3db50c0f26bd31d66c04486c385 Mon Sep 17 00:00:00 2001 From: Eveline Molnar Date: Wed, 30 Oct 2024 13:23:25 +0200 Subject: [PATCH 2/3] delete empty lines --- multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index fa7afbc1..67424224 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -999,8 +999,6 @@ fn batch_transfer_both_failed_test() { assert!(first_batch.is_none()); } - - #[test] fn test_unwrap_token_create_transaction_paused() { let mut state = MultiTransferTestState::new(); From 1ed5fdd45260f3b264c5f1f9a7e6bed1772cbeca Mon Sep 17 00:00:00 2001 From: Eveline Molnar Date: Wed, 30 Oct 2024 15:15:41 +0200 Subject: [PATCH 3/3] new test case --- .../src/bridge_proxy_contract_proxy.rs | 248 ---- .../src/bridged_tokens_wrapper_proxy.rs | 317 ----- multi-transfer-esdt/src/esdt_safe_proxy.rs | 828 ------------ .../src/multi_transfer_esdt_proxy.rs | 304 ----- .../tests/multi_transfer_blackbox_test.rs | 36 +- multisig/src/bridge_proxy_contract_proxy.rs | 248 ---- multisig/src/bridged_tokens_wrapper_proxy.rs | 317 ----- multisig/src/multisig_proxy.rs | 1185 ----------------- 8 files changed, 35 insertions(+), 3448 deletions(-) delete mode 100644 multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs delete mode 100644 multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs delete mode 100644 multi-transfer-esdt/src/esdt_safe_proxy.rs delete mode 100644 multi-transfer-esdt/src/multi_transfer_esdt_proxy.rs delete mode 100644 multisig/src/bridge_proxy_contract_proxy.rs delete mode 100644 multisig/src/bridged_tokens_wrapper_proxy.rs delete mode 100644 multisig/src/multisig_proxy.rs diff --git a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs b/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs deleted file mode 100644 index 768889b6..00000000 --- a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs +++ /dev/null @@ -1,248 +0,0 @@ -// 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 BridgeProxyContractProxy; - -impl TxProxyTrait for BridgeProxyContractProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgeProxyContractProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgeProxyContractProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgeProxyContractProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&opt_multi_transfer_address) - .original_result() - } -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -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 BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn deposit< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - eth_tx: Arg0, - batch_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("deposit") - .argument(ð_tx) - .argument(&batch_id) - .original_result() - } - - pub fn execute< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("execute") - .argument(&tx_id) - .original_result() - } - - pub fn update_lowest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateLowestTxId") - .original_result() - } - - pub fn get_pending_transaction_by_id< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactionById") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transactions( - self, - ) -> TxTypedCall>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactions") - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferAddress") - .argument(&opt_multi_transfer_address) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&opt_address) - .original_result() - } - - pub fn multi_transfer_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferAddress") - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn lowest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("lowestTxId") - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} diff --git a/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs b/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs deleted file mode 100644 index df5b7a63..00000000 --- a/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs +++ /dev/null @@ -1,317 +0,0 @@ -// 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 BridgedTokensWrapperProxy; - -impl TxProxyTrait for BridgedTokensWrapperProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgedTokensWrapperProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgedTokensWrapperProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init( - self, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .original_result() - } -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn add_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn update_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn remove_wrapped_token< - Arg0: ProxyArg>, - >( - self, - universal_bridged_token_ids: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeWrappedToken") - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn whitelist_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - universal_bridged_token_ids: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("whitelistToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn update_whitelisted_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWhitelistedToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .original_result() - } - - pub fn blacklist_token< - Arg0: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("blacklistToken") - .argument(&chain_specific_token_id) - .original_result() - } - - pub fn deposit_liquidity( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositLiquidity") - .original_result() - } - - /// Will wrap what it can, and send back the rest unchanged - pub fn wrap_tokens( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .raw_call("wrapTokens") - .original_result() - } - - pub fn unwrap_token< - Arg0: ProxyArg>, - >( - self, - requested_token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapToken") - .argument(&requested_token) - .original_result() - } - - pub fn unwrap_token_create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - requested_token: Arg0, - to: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapTokenCreateTransaction") - .argument(&requested_token) - .argument(&to) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn universal_bridged_token_ids( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getUniversalBridgedTokenIds") - .original_result() - } - - pub fn token_liquidity< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenLiquidity") - .argument(&token) - .original_result() - } - - pub fn chain_specific_to_universal_mapping< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getChainSpecificToUniversalMapping") - .argument(&token) - .original_result() - } - - pub fn chain_specific_token_ids< - Arg0: ProxyArg>, - >( - self, - universal_token_id: Arg0, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getchainSpecificTokenIds") - .argument(&universal_token_id) - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} diff --git a/multi-transfer-esdt/src/esdt_safe_proxy.rs b/multi-transfer-esdt/src/esdt_safe_proxy.rs deleted file mode 100644 index 59e564f3..00000000 --- a/multi-transfer-esdt/src/esdt_safe_proxy.rs +++ /dev/null @@ -1,828 +0,0 @@ -// 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 EsdtSafeProxy; - -impl TxProxyTrait for EsdtSafeProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = EsdtSafeProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - EsdtSafeProxyMethods { wrapped_tx: tx } - } -} - -pub struct EsdtSafeProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - /// fee_estimator_contract_address - The address of a Price Aggregator contract, - /// which will get the price of token A in token B - /// - /// eth_tx_gas_limit - The gas limit that will be used for transactions on the ETH side. - /// Will be used to compute the fees for the transfer - pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn upgrade< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - Arg3: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - bridge_proxy_contract_address: Arg2, - eth_tx_gas_limit: Arg3, - ) -> TxTypedUpgrade { - self.wrapped_tx - .payment(NotPayable) - .raw_upgrade() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(&bridge_proxy_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - /// Sets the statuses for the transactions, after they were executed on the Ethereum side. - /// - /// Only TransactionStatus::Executed (3) and TransactionStatus::Rejected (4) values are allowed. - /// Number of provided statuses must be equal to number of transactions in the batch. - pub fn set_transaction_batch_status< - Arg0: ProxyArg, - Arg1: ProxyArg>, - >( - self, - batch_id: Arg0, - tx_statuses: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTransactionBatchStatus") - .argument(&batch_id) - .argument(&tx_statuses) - .original_result() - } - - /// Converts failed Ethereum -> MultiversX transactions to MultiversX -> Ethereum transaction. - /// This is done every now and then to refund the tokens. - /// - /// As with normal MultiversX -> Ethereum transactions, a part of the tokens will be - /// subtracted to pay for the fees - pub fn add_refund_batch< - Arg0: ProxyArg>>, - >( - self, - refund_transactions: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addRefundBatch") - .argument(&refund_transactions) - .original_result() - } - - /// Create an MultiversX -> Ethereum transaction. Only fungible tokens are accepted. - /// - /// Every transfer will have a part of the tokens subtracted as fees. - /// The fee amount depends on the global eth_tx_gas_limit - /// and the current GWEI price, respective to the bridged token - /// - /// fee_amount = price_per_gas_unit * eth_tx_gas_limit - pub fn create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>>, - >( - self, - to: Arg0, - opt_refund_info: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("createTransaction") - .argument(&to) - .argument(&opt_refund_info) - .original_result() - } - - pub fn create_transaction_sc_call< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, - >( - self, - to: Arg0, - data: Arg1, - opt_refund_address: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("createTransactionSCCall") - .argument(&to) - .argument(&data) - .argument(&opt_refund_address) - .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. - pub fn claim_refund< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("claimRefund") - .argument(&token_id) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn withdraw_refund_fees_for_ethereum< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawRefundFeesForEthereum") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn withdraw_transaction_fees< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawTransactionFees") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn compute_total_amounts_from_index< - Arg0: ProxyArg, - Arg1: ProxyArg, - >( - self, - start_index: Arg0, - end_index: Arg1, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("computeTotalAmmountsFromIndex") - .argument(&start_index) - .argument(&end_index) - .original_result() - } - - /// Query function that lists all refund amounts for a user. - /// Useful for knowing which token IDs to pass to the claimRefund endpoint. - pub fn get_refund_amounts< - Arg0: ProxyArg>, - >( - self, - address: Arg0, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundAmounts") - .argument(&address) - .original_result() - } - - pub fn get_total_refund_amounts( - self, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalRefundAmounts") - .original_result() - } - - pub fn get_refund_fees_for_ethereum< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundFeesForEthereum") - .argument(&token_id) - .original_result() - } - - pub fn get_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn set_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - - pub fn set_eth_tx_gas_limit< - Arg0: ProxyArg>, - >( - self, - new_limit: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEthTxGasLimit") - .argument(&new_limit) - .original_result() - } - - /// Default price being used if the aggregator lacks a mapping for this token - /// or the aggregator address is not set - pub fn set_default_price_per_gas_unit< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - default_price_per_gas_unit: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setDefaultPricePerGasUnit") - .argument(&token_id) - .argument(&default_price_per_gas_unit) - .original_result() - } - - /// Token ticker being used when querying the aggregator for GWEI prices - pub fn set_token_ticker< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - ticker: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTokenTicker") - .argument(&token_id) - .argument(&ticker) - .original_result() - } - - /// Returns the fee for the given token ID (the fee amount is in the given token) - pub fn calculate_required_fee< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("calculateRequiredFee") - .argument(&token_id) - .original_result() - } - - pub fn fee_estimator_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFeeEstimatorContractAddress") - .original_result() - } - - pub fn default_price_per_gas_unit< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getDefaultPricePerGasUnit") - .argument(&token_id) - .original_result() - } - - pub fn eth_tx_gas_limit( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEthTxGasLimit") - .original_result() - } - - /// Distributes the accumulated fees to the given addresses. - /// Expected arguments are pairs of (address, percentage), - /// where percentages must add up to the PERCENTAGE_TOTAL constant - pub fn distribute_fees< - Arg0: ProxyArg>>, - >( - self, - address_percentage_pairs: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("distributeFees") - .argument(&address_percentage_pairs) - .original_result() - } - - pub fn add_token_to_whitelist< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg, - Arg4: ProxyArg>, - Arg5: ProxyArg>, - Arg6: ProxyArg>, - Arg7: ProxyArg>>, - >( - self, - token_id: Arg0, - ticker: Arg1, - mint_burn_token: Arg2, - native_token: Arg3, - total_balance: Arg4, - mint_balance: Arg5, - burn_balance: Arg6, - opt_default_price_per_gas_unit: Arg7, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addTokenToWhitelist") - .argument(&token_id) - .argument(&ticker) - .argument(&mint_burn_token) - .argument(&native_token) - .argument(&total_balance) - .argument(&mint_balance) - .argument(&burn_balance) - .argument(&opt_default_price_per_gas_unit) - .original_result() - } - - pub fn remove_token_from_whitelist< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeTokenFromWhitelist") - .argument(&token_id) - .original_result() - } - - pub fn get_tokens< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokens") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("initSupply") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply_mint_burn< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - token_id: Arg0, - mint_amount: Arg1, - burn_amount: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("initSupplyMintBurn") - .argument(&token_id) - .argument(&mint_amount) - .argument(&burn_amount) - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn token_whitelist( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAllKnownTokens") - .original_result() - } - - pub fn native_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isNativeToken") - .argument(&token) - .original_result() - } - - pub fn mint_burn_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isMintBurnToken") - .argument(&token) - .original_result() - } - - pub fn multi_transfer_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferContractAddress") - .original_result() - } - - pub fn accumulated_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAccumulatedTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn total_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalBalances") - .argument(&token_id) - .original_result() - } - - pub fn mint_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMintBalances") - .argument(&token_id) - .original_result() - } - - pub fn burn_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBurnBalances") - .argument(&token_id) - .original_result() - } - - pub fn set_max_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - pub fn set_max_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - pub fn get_current_tx_batch( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatch") - .argument(&batch_id) - .original_result() - } - - pub fn get_batch_status< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatchStatus") - .argument(&batch_id) - .original_result() - } - - pub fn first_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchId") - .original_result() - } - - pub fn last_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastBatchId") - .original_result() - } - - pub fn set_max_bridged_amount< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - max_amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxBridgedAmount") - .argument(&token_id) - .argument(&max_amount) - .original_result() - } - - pub fn max_bridged_amount< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMaxBridgedAmount") - .argument(&token_id) - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} - -#[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, PartialEq)] -pub struct RefundInfo -where - Api: ManagedTypeApi, -{ - pub address: ManagedAddress, - pub initial_batch_id: u64, - pub initial_nonce: u64, -} diff --git a/multi-transfer-esdt/src/multi_transfer_esdt_proxy.rs b/multi-transfer-esdt/src/multi_transfer_esdt_proxy.rs deleted file mode 100644 index 68871989..00000000 --- a/multi-transfer-esdt/src/multi_transfer_esdt_proxy.rs +++ /dev/null @@ -1,304 +0,0 @@ -// 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 MultiTransferEsdtProxy; - -impl TxProxyTrait for MultiTransferEsdtProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = MultiTransferEsdtProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - MultiTransferEsdtProxyMethods { wrapped_tx: tx } - } -} - -pub struct MultiTransferEsdtProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl MultiTransferEsdtProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init( - self, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .original_result() - } -} - -#[rustfmt::skip] -impl MultiTransferEsdtProxyMethods -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 MultiTransferEsdtProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn batch_transfer_esdt_token< - Arg0: ProxyArg, - Arg1: ProxyArg>>, - >( - self, - batch_id: Arg0, - transfers: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("batchTransferEsdtToken") - .argument(&batch_id) - .argument(&transfers) - .original_result() - } - - pub fn move_refund_batch_to_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("moveRefundBatchToSafe") - .original_result() - } - - pub fn set_wrapping_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setWrappingContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn add_unprocessed_refund_tx_to_batch< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addUnprocessedRefundTxToBatch") - .argument(&tx_id) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn wrapping_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getWrappingContractAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn set_max_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - pub fn set_max_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - pub fn get_current_tx_batch( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatch") - .argument(&batch_id) - .original_result() - } - - pub fn get_batch_status< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatchStatus") - .argument(&batch_id) - .original_result() - } - - pub fn first_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchId") - .original_result() - } - - pub fn last_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastBatchId") - .original_result() - } - - pub fn set_max_bridged_amount< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - max_amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxBridgedAmount") - .argument(&token_id) - .argument(&max_amount) - .original_result() - } - - pub fn max_bridged_amount< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMaxBridgedAmount") - .argument(&token_id) - .original_result() - } -} diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index 67424224..c01e90b0 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -1208,7 +1208,7 @@ fn test_unwrap_token_create_transaction_amount_zero() { #[test] fn add_refund_batch_test_should_work() { - let mut state = MultiTransferTestState::new(); + let mut state: MultiTransferTestState = MultiTransferTestState::new(); state.multisig_deploy(); state.multi_transfer_deploy(); @@ -1277,3 +1277,37 @@ fn add_refund_batch_test_should_work() { BigUint::zero(), ); } + +#[test] +fn batch_transfer_esdt_token_to_address_zero() { + let mut state: MultiTransferTestState = MultiTransferTestState::new(); + + state.multisig_deploy(); + state.multi_transfer_deploy(); + state.bridge_proxy_deploy(); + state.safe_deploy_real_contract(); + state.bridged_tokens_wrapper_deploy(); + state.config_multi_transfer(); + + let eth_tx = EthTransaction { + from: EthAddress::zero(), + to: ManagedAddress::zero(), + token_id: TokenIdentifier::from(TOKEN_TICKER), + amount: BigUint::from(MAX_AMOUNT), + tx_nonce: 1u64, + call_data: ManagedOption::none(), + }; + + let mut transfers: MultiValueEncoded> = + MultiValueEncoded::new(); + transfers.push(eth_tx.clone()); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(MULTI_TRANSFER_ADDRESS) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) + .batch_transfer_esdt_token(1u32, transfers) + .run(); +} diff --git a/multisig/src/bridge_proxy_contract_proxy.rs b/multisig/src/bridge_proxy_contract_proxy.rs deleted file mode 100644 index 768889b6..00000000 --- a/multisig/src/bridge_proxy_contract_proxy.rs +++ /dev/null @@ -1,248 +0,0 @@ -// 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 BridgeProxyContractProxy; - -impl TxProxyTrait for BridgeProxyContractProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgeProxyContractProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgeProxyContractProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgeProxyContractProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&opt_multi_transfer_address) - .original_result() - } -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -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 BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn deposit< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - eth_tx: Arg0, - batch_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("deposit") - .argument(ð_tx) - .argument(&batch_id) - .original_result() - } - - pub fn execute< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("execute") - .argument(&tx_id) - .original_result() - } - - pub fn update_lowest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateLowestTxId") - .original_result() - } - - pub fn get_pending_transaction_by_id< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactionById") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transactions( - self, - ) -> TxTypedCall>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactions") - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferAddress") - .argument(&opt_multi_transfer_address) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&opt_address) - .original_result() - } - - pub fn multi_transfer_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferAddress") - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn lowest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("lowestTxId") - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} diff --git a/multisig/src/bridged_tokens_wrapper_proxy.rs b/multisig/src/bridged_tokens_wrapper_proxy.rs deleted file mode 100644 index df5b7a63..00000000 --- a/multisig/src/bridged_tokens_wrapper_proxy.rs +++ /dev/null @@ -1,317 +0,0 @@ -// 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 BridgedTokensWrapperProxy; - -impl TxProxyTrait for BridgedTokensWrapperProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgedTokensWrapperProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgedTokensWrapperProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init( - self, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .original_result() - } -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn add_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn update_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn remove_wrapped_token< - Arg0: ProxyArg>, - >( - self, - universal_bridged_token_ids: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeWrappedToken") - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn whitelist_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - universal_bridged_token_ids: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("whitelistToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn update_whitelisted_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWhitelistedToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .original_result() - } - - pub fn blacklist_token< - Arg0: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("blacklistToken") - .argument(&chain_specific_token_id) - .original_result() - } - - pub fn deposit_liquidity( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositLiquidity") - .original_result() - } - - /// Will wrap what it can, and send back the rest unchanged - pub fn wrap_tokens( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .raw_call("wrapTokens") - .original_result() - } - - pub fn unwrap_token< - Arg0: ProxyArg>, - >( - self, - requested_token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapToken") - .argument(&requested_token) - .original_result() - } - - pub fn unwrap_token_create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - requested_token: Arg0, - to: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapTokenCreateTransaction") - .argument(&requested_token) - .argument(&to) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn universal_bridged_token_ids( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getUniversalBridgedTokenIds") - .original_result() - } - - pub fn token_liquidity< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenLiquidity") - .argument(&token) - .original_result() - } - - pub fn chain_specific_to_universal_mapping< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getChainSpecificToUniversalMapping") - .argument(&token) - .original_result() - } - - pub fn chain_specific_token_ids< - Arg0: ProxyArg>, - >( - self, - universal_token_id: Arg0, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getchainSpecificTokenIds") - .argument(&universal_token_id) - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} diff --git a/multisig/src/multisig_proxy.rs b/multisig/src/multisig_proxy.rs deleted file mode 100644 index a652c8ba..00000000 --- a/multisig/src/multisig_proxy.rs +++ /dev/null @@ -1,1185 +0,0 @@ -// 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 MultisigProxy; - -impl TxProxyTrait for MultisigProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = MultisigProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - MultisigProxyMethods { wrapped_tx: tx } - } -} - -pub struct MultisigProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl MultisigProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - /// EsdtSafe and MultiTransferEsdt are expected to be deployed and configured separately, - /// and then having their ownership changed to this Multisig SC. - pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - Arg3: ProxyArg>, - Arg4: ProxyArg>, - Arg5: ProxyArg, - Arg6: ProxyArg>>, - >( - self, - esdt_safe_sc_address: Arg0, - multi_transfer_sc_address: Arg1, - proxy_sc_address: Arg2, - required_stake: Arg3, - slash_amount: Arg4, - quorum: Arg5, - board: Arg6, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&esdt_safe_sc_address) - .argument(&multi_transfer_sc_address) - .argument(&proxy_sc_address) - .argument(&required_stake) - .argument(&slash_amount) - .argument(&quorum) - .argument(&board) - .original_result() - } -} - -#[rustfmt::skip] -impl MultisigProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn upgrade< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - esdt_safe_sc_address: Arg0, - multi_transfer_sc_address: Arg1, - proxy_sc_address: Arg2, - ) -> TxTypedUpgrade { - self.wrapped_tx - .payment(NotPayable) - .raw_upgrade() - .argument(&esdt_safe_sc_address) - .argument(&multi_transfer_sc_address) - .argument(&proxy_sc_address) - .original_result() - } -} - -#[rustfmt::skip] -impl MultisigProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - /// Distributes the accumulated fees to the given addresses. - /// Expected arguments are pairs of (address, percentage), - /// where percentages must add up to the PERCENTAGE_TOTAL constant - pub fn distribute_fees_from_child_contracts< - Arg0: ProxyArg, u32>>>, - >( - self, - dest_address_percentage_pairs: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("distributeFeesFromChildContracts") - .argument(&dest_address_percentage_pairs) - .original_result() - } - - /// Board members have to stake a certain amount of EGLD - /// before being allowed to sign actions - pub fn stake( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("stake") - .original_result() - } - - pub fn unstake< - Arg0: ProxyArg>, - >( - self, - amount: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unstake") - .argument(&amount) - .original_result() - } - - /// After a batch is processed on the Ethereum side, - /// the EsdtSafe expects a list of statuses of said transactions (success or failure). - /// - /// This endpoint proposes an action to set the statuses to a certain list of values. - /// Nothing is changed in the EsdtSafe contract until the action is signed and executed. - pub fn propose_esdt_safe_set_current_transaction_batch_status< - Arg0: ProxyArg, - Arg1: ProxyArg>, - >( - self, - esdt_safe_batch_id: Arg0, - tx_batch_status: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("proposeEsdtSafeSetCurrentTransactionBatchStatus") - .argument(&esdt_safe_batch_id) - .argument(&tx_batch_status) - .original_result() - } - - /// Proposes a batch of Ethereum -> MultiversX transfers. - /// Transactions have to be separated by fields, in the following order: - /// Sender Address, Destination Address, Token ID, Amount, Tx Nonce - pub fn propose_multi_transfer_esdt_batch< - Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, - >( - self, - eth_batch_id: Arg0, - transfers: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("proposeMultiTransferEsdtBatch") - .argument(ð_batch_id) - .argument(&transfers) - .original_result() - } - - /// Failed Ethereum -> MultiversX transactions are saved in the MultiTransfer SC - /// as "refund transactions", and stored in batches, using the same mechanism as EsdtSafe. - /// - /// This function moves the first refund batch into the EsdtSafe SC, - /// converting the transactions into MultiversX -> Ethereum transactions - /// and adding them into EsdtSafe batches - pub fn move_refund_batch_to_safe_from_child_contract( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("moveRefundBatchToSafeFromChildContract") - .original_result() - } - - pub fn init_supply_from_child_contract< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("initSupplyFromChildContract") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn add_unprocessed_refund_tx_to_batch< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addUnprocessedRefundTxToBatch") - .argument(&tx_id) - .original_result() - } - - pub fn withdraw_refund_fees_for_ethereum< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawRefundFeesForEthereum") - .argument(&token_id) - .original_result() - } - - pub fn withdraw_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn withdraw_slashed_amount( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawSlashedAmount") - .original_result() - } - - /// Proposers and board members use this to launch signed actions. - pub fn perform_action_endpoint< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("performAction") - .argument(&action_id) - .original_result() - } - - /// Used by board members to sign actions. - pub fn sign< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("sign") - .argument(&action_id) - .original_result() - } - - pub fn upgrade_child_contract_from_source< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg>>, - >( - self, - child_sc_address: Arg0, - source_address: Arg1, - is_payable: Arg2, - init_args: Arg3, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("upgradeChildContractFromSource") - .argument(&child_sc_address) - .argument(&source_address) - .argument(&is_payable) - .argument(&init_args) - .original_result() - } - - pub fn add_board_member_endpoint< - Arg0: ProxyArg>, - >( - self, - board_member: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addBoardMember") - .argument(&board_member) - .original_result() - } - - pub fn remove_user< - Arg0: ProxyArg>, - >( - self, - board_member: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeUser") - .argument(&board_member) - .original_result() - } - - /// Cuts a fixed amount from a board member's stake. - /// This should be used only in cases where the board member - /// is being actively malicious. - /// - /// After stake is cut, the board member would have to stake again - /// to be able to sign actions. - pub fn slash_board_member< - Arg0: ProxyArg>, - >( - self, - board_member: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("slashBoardMember") - .argument(&board_member) - .original_result() - } - - pub fn change_quorum< - Arg0: ProxyArg, - >( - self, - new_quorum: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeQuorum") - .argument(&new_quorum) - .original_result() - } - - /// Maps an ESDT token to an ERC20 address. Used by relayers. - pub fn add_mapping< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - erc20_address: Arg0, - token_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addMapping") - .argument(&erc20_address) - .argument(&token_id) - .original_result() - } - - pub fn clear_mapping< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - erc20_address: Arg0, - token_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("clearMapping") - .argument(&erc20_address) - .argument(&token_id) - .original_result() - } - - pub fn pause_esdt_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pauseEsdtSafe") - .original_result() - } - - pub fn unpause_esdt_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpauseEsdtSafe") - .original_result() - } - - pub fn init_supply_esdt_safe< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("initSupplyEsdtSafe") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply_mint_burn_esdt_safe< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - token_id: Arg0, - mint_amount: Arg1, - burn_amount: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("initSupplyMintBurnEsdtSafe") - .argument(&token_id) - .argument(&mint_amount) - .argument(&burn_amount) - .original_result() - } - - pub fn pause_proxy( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pauseProxy") - .original_result() - } - - pub fn unpause_proxy( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpauseProxy") - .original_result() - } - - pub fn change_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - - /// Sets the gas limit being used for Ethereum transactions - /// This is used in the EsdtSafe contract to determine the fee amount - /// - /// fee_amount = eth_gas_limit * price_per_gas_unit - /// - /// where price_per_gas_unit is queried from the aggregator (fee estimator SC) - pub fn change_multiversx_to_eth_gas_limit< - Arg0: ProxyArg>, - >( - self, - new_gas_limit: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeMultiversXToEthGasLimit") - .argument(&new_gas_limit) - .original_result() - } - - /// Default price being used if the aggregator lacks a mapping for this token - /// or the aggregator address is not set - pub fn change_default_price_per_gas_unit< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - new_value: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeDefaultPricePerGasUnit") - .argument(&token_id) - .argument(&new_value) - .original_result() - } - - /// Token ticker being used when querying the aggregator for GWEI prices - pub fn change_token_ticker< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - new_ticker: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeTokenTicker") - .argument(&token_id) - .argument(&new_ticker) - .original_result() - } - - pub fn esdt_safe_add_token_to_whitelist< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg, - Arg4: ProxyArg>, - Arg5: ProxyArg>, - Arg6: ProxyArg>, - Arg7: ProxyArg>>, - >( - self, - token_id: Arg0, - ticker: Arg1, - mint_burn_allowed: Arg2, - is_native_token: Arg3, - total_balance: Arg4, - mint_balance: Arg5, - burn_balance: Arg6, - opt_default_price_per_gas_unit: Arg7, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("esdtSafeAddTokenToWhitelist") - .argument(&token_id) - .argument(&ticker) - .argument(&mint_burn_allowed) - .argument(&is_native_token) - .argument(&total_balance) - .argument(&mint_balance) - .argument(&burn_balance) - .argument(&opt_default_price_per_gas_unit) - .original_result() - } - - pub fn set_multi_transfer_on_esdt_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferOnEsdtSafe") - .original_result() - } - - pub fn set_esdt_safe_on_multi_transfer( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeOnMultiTransfer") - .original_result() - } - - pub fn esdt_safe_remove_token_from_whitelist< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("esdtSafeRemoveTokenFromWhitelist") - .argument(&token_id) - .original_result() - } - - /// Sets maximum batch size for the EsdtSafe SC. - /// If a batch reaches this amount of transactions, it is considered full, - /// and a new incoming transaction will be put into a new batch. - pub fn esdt_safe_set_max_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("esdtSafeSetMaxTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - /// Sets the maximum block duration in which an EsdtSafe batch accepts transactions - /// For a batch to be considered "full", it has to either reach `maxTxBatchSize` transactions, - /// or have txBatchBlockDuration blocks pass since the first tx was added in the batch - pub fn esdt_safe_set_max_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("esdtSafeSetMaxTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - /// Sets the maximum bridged amount for the token for the MultiversX -> Ethereum direction. - /// Any attempt to transfer over this amount will be rejected. - pub fn esdt_safe_set_max_bridged_amount_for_token< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - max_amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("esdtSafeSetMaxBridgedAmountForToken") - .argument(&token_id) - .argument(&max_amount) - .original_result() - } - - /// Same as the function above, but for Ethereum -> MultiversX transactions. - pub fn multi_transfer_esdt_set_max_bridged_amount_for_token< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - max_amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("multiTransferEsdtSetMaxBridgedAmountForToken") - .argument(&token_id) - .argument(&max_amount) - .original_result() - } - - /// Any failed Ethereum -> MultiversX transactions are added into so-called "refund batches\ - /// This configures the size of a batch. - pub fn multi_transfer_esdt_set_max_refund_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("multiTransferEsdtSetMaxRefundTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - /// Max block duration for refund batches. Default is "infinite" (u64::MAX) - /// and only max batch size matters - pub fn multi_transfer_esdt_set_max_refund_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("multiTransferEsdtSetMaxRefundTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - /// Sets the wrapping contract address. - /// This contract is used to map multiple tokens to a universal one. - /// Useful in cases where a single token (USDC for example) - /// is being transferred from multiple chains. - /// - /// They will all have different token IDs, but can be swapped 1:1 in the wrapping SC. - /// The wrapping is done automatically, so the user only receives the universal token. - pub fn multi_transfer_esdt_set_wrapping_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_wrapping_contract_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("multiTransferEsdtSetWrappingContractAddress") - .argument(&opt_wrapping_contract_address) - .original_result() - } - - /// Minimum number of signatures needed to perform any action. - pub fn quorum( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getQuorum") - .original_result() - } - - /// Denormalized board member count. - /// It is kept in sync with the user list by the contract. - pub fn num_board_members( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getNumBoardMembers") - .original_result() - } - - /// The required amount to stake for accepting relayer position - pub fn required_stake_amount( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRequiredStakeAmount") - .original_result() - } - - /// Staked amount by each board member. - pub fn amount_staked< - Arg0: ProxyArg>, - >( - self, - board_member_address: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAmountStaked") - .argument(&board_member_address) - .original_result() - } - - /// Amount of stake slashed if a relayer is misbehaving - pub fn slash_amount( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getSlashAmount") - .original_result() - } - - /// Total slashed tokens accumulated - pub fn slashed_tokens_amount( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getSlashedTokensAmount") - .original_result() - } - - pub fn last_executed_eth_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastExecutedEthBatchId") - .original_result() - } - - pub fn last_executed_eth_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastExecutedEthTxId") - .original_result() - } - - /// Mapping between ERC20 Ethereum address and MultiversX ESDT Token Identifiers - pub fn erc20_address_for_token_id< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getErc20AddressForTokenId") - .argument(&token_id) - .original_result() - } - - pub fn token_id_for_erc20_address< - Arg0: ProxyArg>, - >( - self, - erc20_address: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenIdForErc20Address") - .argument(&erc20_address) - .original_result() - } - - 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() - } - - /// Returns the current EsdtSafe batch. - /// - /// First result is the batch ID, then pairs of 6 results, representing transactions - /// split by fields: - /// - /// Block Nonce, Tx Nonce, Sender Address, Receiver Address, Token ID, Amount - pub fn get_current_tx_batch( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - /// Returns the EsdtSafe batch that has the provided batch_id. - /// - /// First result is the batch ID, then pairs of 6 results, representing transactions - /// split by fields: - /// - /// Block Nonce, Tx Nonce, Sender Address, Receiver Address, Token ID, Amount - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatch") - .argument(&batch_id) - .original_result() - } - - /// Returns a batch of failed Ethereum -> MultiversX transactions. - /// The result format is the same as getCurrentTxBatch - pub fn get_current_refund_batch( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentRefundBatch") - .original_result() - } - - /// Actions are cleared after execution, so an empty entry means the action was executed already - /// Returns "false" if the action ID is invalid - pub fn was_action_executed< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("wasActionExecuted") - .argument(&action_id) - .original_result() - } - - /// Used for Ethereum -> MultiversX batches. - /// If the mapping was made, it means that the transfer action was proposed in the past. - /// To check if it was executed as well, use the wasActionExecuted view - pub fn was_transfer_action_proposed< - Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, - >( - self, - eth_batch_id: Arg0, - transfers: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("wasTransferActionProposed") - .argument(ð_batch_id) - .argument(&transfers) - .original_result() - } - - /// Used for Ethereum -> MultiversX batches. - /// If `wasActionExecuted` returns true, then this can be used to get the action ID. - /// Will return 0 if the transfers were not proposed - pub fn get_action_id_for_transfer_batch< - Arg0: ProxyArg, - Arg1: ProxyArg, ManagedAddress, TokenIdentifier, BigUint, u64, ManagedOption>>>>, - >( - self, - eth_batch_id: Arg0, - transfers: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionIdForTransferBatch") - .argument(ð_batch_id) - .argument(&transfers) - .original_result() - } - - /// Used for MultiversX -> Ethereum batches. - /// Returns "true" if an action was already proposed for the given batch, - /// with these exact transaction statuses, in this exact order - pub fn was_set_current_transaction_batch_status_action_proposed< - Arg0: ProxyArg, - Arg1: ProxyArg>, - >( - self, - esdt_safe_batch_id: Arg0, - expected_tx_batch_status: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("wasSetCurrentTransactionBatchStatusActionProposed") - .argument(&esdt_safe_batch_id) - .argument(&expected_tx_batch_status) - .original_result() - } - - /// If `wasSetCurrentTransactionBatchStatusActionProposed` return true, - /// this can be used to get the action ID. - /// Will return 0 if the set status action was not proposed - pub fn get_action_id_for_set_current_transaction_batch_status< - Arg0: ProxyArg, - Arg1: ProxyArg>, - >( - self, - esdt_safe_batch_id: Arg0, - expected_tx_batch_status: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionIdForSetCurrentTransactionBatchStatus") - .argument(&esdt_safe_batch_id) - .argument(&expected_tx_batch_status) - .original_result() - } - - /// Returns `true` (`1`) if the user has signed the action. - /// Does not check whether or not the user is still a board member and the signature valid. - pub fn signed< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - user: Arg0, - action_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("signed") - .argument(&user) - .argument(&action_id) - .original_result() - } - - /// Indicates user rights. - /// `0` = no rights, - /// `1` = can propose. Can also sign if they have enough stake. - pub fn user_role< - Arg0: ProxyArg>, - >( - self, - user: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("userRole") - .argument(&user) - .original_result() - } - - /// Lists all board members - pub fn get_all_board_members( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAllBoardMembers") - .original_result() - } - - /// Lists all board members that staked the correct amount. - /// A board member with not enough stake can propose, but cannot sign. - pub fn get_all_staked_relayers( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAllStakedRelayers") - .original_result() - } - - /// Gets the number of signatures for the action with the given ID - pub fn get_action_signer_count< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionSignerCount") - .argument(&action_id) - .original_result() - } - - /// It is possible for board members to lose their role. - /// They are not automatically removed from all actions when doing so, - /// therefore the contract needs to re-check every time when actions are performed. - /// This function is used to validate the signers before performing an action. - /// It also makes it easy to check before performing an action. - pub fn get_action_valid_signer_count< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionValidSignerCount") - .argument(&action_id) - .original_result() - } - - /// Returns `true` (`1`) if `getActionValidSignerCount >= getQuorum`. - pub fn quorum_reached< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("quorumReached") - .argument(&action_id) - .original_result() - } - - /// The index of the last proposed action. - /// 0 means that no action was ever proposed yet. - pub fn get_action_last_index( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionLastIndex") - .original_result() - } - - /// Serialized action data of an action with index. - pub fn get_action_data< - Arg0: ProxyArg, - >( - self, - action_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getActionData") - .argument(&action_id) - .original_result() - } - - pub fn pause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("pause") - .original_result() - } - - pub fn unpause_endpoint( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unpause") - .original_result() - } - - pub fn paused_status( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isPaused") - .original_result() - } -} - -#[type_abi] -#[derive(TopEncode, TopDecode, Clone, Copy, PartialEq)] -pub enum UserRole { - None, - BoardMember, -} - -#[rustfmt::skip] -#[type_abi] -#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] -pub enum Action -where - Api: ManagedTypeApi, -{ - Nothing, - SetCurrentTransactionBatchStatus { - esdt_safe_batch_id: u64, - tx_batch_status: ManagedVec, - }, - BatchTransferEsdtToken { - eth_batch_id: u64, - transfers: ManagedVec>, - }, -}