From f2c31cdb2992aa5b532a7d612a6f36682ae7a9ea Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 13 Nov 2024 12:44:51 +0200 Subject: [PATCH 1/5] Added interactor files Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 422 ++++++++++------ .../src/proxies/fee_market_proxy.rs | 278 +++++++++++ .../src/proxies/header_verifier_proxy.rs | 174 +++++++ esdt-safe/interactor/src/proxies/mod.rs | 5 + .../src/proxies/price_aggregator_proxy.rs | 416 ++++++++++++++++ esdt-safe/interactor/src/proxies/proxy.rs | 458 ++++++++++++++++++ .../src/proxies/testing_sc_proxy.rs | 95 ++++ esdt-safe/interactor/state.toml | 9 +- 8 files changed, 1712 insertions(+), 145 deletions(-) create mode 100644 esdt-safe/interactor/src/proxies/fee_market_proxy.rs create mode 100644 esdt-safe/interactor/src/proxies/header_verifier_proxy.rs create mode 100644 esdt-safe/interactor/src/proxies/mod.rs create mode 100644 esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs create mode 100644 esdt-safe/interactor/src/proxies/proxy.rs create mode 100644 esdt-safe/interactor/src/proxies/testing_sc_proxy.rs diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 536cb988..74dc900c 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -2,26 +2,31 @@ // TODO: Remove this when interactor setup is complete #![allow(dead_code)] -mod price_aggregator_proxy; -mod proxy; +mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; +use header_verifier_proxy::HeaderverifierProxy; +use multiversx_sc_scenario::meta::tools::find_current_workspace; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; +use multiversx_sc_scenario::scenario_model::TxResponseStatus; use multiversx_sc_snippets::imports::*; -use multiversx_sc_snippets::sdk; +use multiversx_sc_snippets::sdk::{self}; +use proxies::*; use serde::{Deserialize, Serialize}; use std::{ io::{Read, Write}, path::Path, }; -use transaction::OperationEsdtPayment; +use testing_sc_proxy::TestingScProxy; use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; - +use transaction::{OperationEsdtPayment, TransferData}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; -const TOKEN_ID: &[u8] = b"SVT-805b28"; +const TOKEN_ID: &[u8] = b"SOV-101252"; +const TOKEN_ID_FOR_EXECUTE: &[u8] = b"x-SOV-101252"; const WHITELISTED_TOKEN_ID: &[u8] = b"CHOCOLATE-daf625"; +const INTERACTOR_SCENARIO_TRACE_PATH: &str = "interactor_trace.scen.json"; type OptionalTransferData = OptionalValue, ManagedVec>>>; @@ -44,7 +49,7 @@ async fn main() { "addSigners" => interact.add_signers().await, "removeSigners" => interact.remove_signers().await, "registerToken" => interact.register_token().await, - "executeBridgeOps" => interact.execute_operations().await, + // "executeBridgeOps" => interact.execute_operations().await, "setMaxTxBatchSize" => interact.set_max_tx_batch_size().await, "setMaxTxBatchBlockDuration" => interact.set_max_tx_batch_block_duration().await, "getCurrentTxBatch" => interact.get_current_tx_batch().await, @@ -75,6 +80,7 @@ struct State { fee_market_address: Option, price_aggregator_address: Option, header_verifier_address: Option, + testing_sc_address: Option, } impl State { @@ -107,12 +113,28 @@ impl State { self.header_verifier_address = Some(address); } + pub fn set_testing_sc_address(&mut self, address: Bech32Address) { + self.testing_sc_address = Some(address); + } + /// Returns the contract address pub fn current_address(&self) -> &Bech32Address { self.contract_address .as_ref() .expect("no known contract, deploy first") } + + pub fn get_header_verifier_address(&self) -> Address { + self.header_verifier_address.clone().unwrap().to_address() + } + + pub fn get_fee_market_address(&self) -> Address { + self.fee_market_address.clone().unwrap().to_address() + } + + pub fn get_testing_sc_address(&self) -> Address { + self.testing_sc_address.clone().unwrap().to_address() + } } impl Drop for State { @@ -127,62 +149,70 @@ impl Drop for State { struct ContractInteract { interactor: Interactor, wallet_address: Address, - bob_address: Address, + frank_address: Address, alice_address: Address, mike_address: Address, judy_address: Address, - contract_code: BytesValue, - fee_market_code: BytesValue, - price_aggregator_code: BytesValue, - header_verifier_code: BytesValue, + esdt_safe_code: String, + fee_market_code: String, + price_aggregator_code: String, + header_verifier_code: String, + testing_sc_code: String, state: State, } impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY).await; - let wallet_address = interactor.register_wallet(test_wallets::frank()); - let bob_address = interactor.register_wallet(test_wallets::bob()); - let alice_address = interactor.register_wallet(test_wallets::alice()); - let mike_address = interactor.register_wallet(test_wallets::mike()); - let judy_address = interactor.register_wallet(test_wallets::judy()); - - let contract_code = BytesValue::interpret_from( - "mxsc:../output/esdt-safe.mxsc.json", - &InterpreterContext::default(), - ); - - let fee_market_code = BytesValue::interpret_from( - "mxsc:contract-codes/fee-market.mxsc.json", - &InterpreterContext::default(), - ); - - let price_aggregator_code = BytesValue::interpret_from( - "mxsc:contract-codes/multiversx-price-aggregator-sc.mxsc.json", - &InterpreterContext::default(), - ); - - let header_verifier_code = BytesValue::interpret_from( - "mxsc:contract-codes/header-verifier.mxsc.json", - &InterpreterContext::default(), - ); + let mut interactor = Interactor::new(GATEWAY, false).await; + + interactor.set_current_dir_from_workspace("esdt-safe/interactor"); + + let wallet_address = interactor.register_wallet(test_wallets::bob()).await; + let frank_address = interactor.register_wallet(test_wallets::frank()).await; + let alice_address = interactor.register_wallet(test_wallets::alice()).await; + let mike_address = interactor.register_wallet(test_wallets::mike()).await; + let judy_address = interactor.register_wallet(test_wallets::judy()).await; + + let current_dir = find_current_workspace().unwrap(); + println!("Current directory is: {}", current_dir.display()); + + let repo_dir = current_dir + .ancestors() + .nth(2) + .expect("Failed to go up 2 levels"); + println!("Repo directory is: {}", repo_dir.display()); + + let fee_market_code = "../../fee-market/output/fee-market.mxsc.json".to_owned(); + + let header_verifier_code = + "../../header-verifier/output/header-verifier.mxsc.json".to_owned(); + + let esdt_safe_code = "../output/esdt-safe.mxsc.json".to_owned(); + + let price_aggregator_code = + "contract-codes/multiversx-price-aggregator-sc.mxsc.json".to_owned(); + + let testing_sc_code = "../../testing-sc/output/testing-sc.mxsc.json".to_owned(); ContractInteract { interactor, wallet_address, - bob_address, + frank_address, alice_address, mike_address, judy_address, - contract_code, + esdt_safe_code, fee_market_code, price_aggregator_code, header_verifier_code, + testing_sc_code, state: State::load_state(), } } async fn deploy(&mut self, is_sov_chain: bool) { + let code_path = MxscPath::new(self.esdt_safe_code.as_ref()); + let new_address = self .interactor .tx() @@ -190,11 +220,11 @@ impl ContractInteract { .gas(110_000_000u64) .typed(proxy::EsdtSafeProxy) .init(is_sov_chain) - .code(&self.contract_code) + .code(code_path) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state.set_address(Bech32Address::from_bech32_string( new_address_bech32.clone(), @@ -213,6 +243,7 @@ impl ContractInteract { }, }; + let fee_market_code_path = MxscPath::new(&self.fee_market_code); let new_address = self .interactor .tx() @@ -220,11 +251,11 @@ impl ContractInteract { .gas(100_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) .init(self.state.current_address(), Option::Some(fee)) - .code(&self.fee_market_code) + .code(fee_market_code_path) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_fee_market_address(Bech32Address::from_bech32_string( @@ -234,8 +265,9 @@ impl ContractInteract { } async fn deploy_price_aggregator(&mut self) { + let price_agggregator_code_path = MxscPath::new(&self.price_aggregator_code); let mut oracles = MultiValueEncoded::new(); - let first_oracle_adress = managed_address!(&self.bob_address.clone()); + let first_oracle_adress = managed_address!(&self.frank_address.clone()); let second_oracle_adress = managed_address!(&self.alice_address.clone()); let third_oracle_adress = managed_address!(&self.mike_address.clone()); let forth_oracle_address = managed_address!(&self.judy_address.clone()); @@ -258,11 +290,11 @@ impl ContractInteract { 3u8, oracles, ) - .code(&self.price_aggregator_code) + .code(price_agggregator_code_path) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_price_aggregator_address(Bech32Address::from_bech32_string( @@ -272,18 +304,20 @@ impl ContractInteract { } async fn deploy_header_verifier_contract(&mut self) { + let header_verifier_code_path = MxscPath::new(&self.header_verifier_code); + let new_address = self .interactor .tx() .from(&self.wallet_address) .gas(100_000_000u64) - .typed(proxy::EsdtSafeProxy) - .init(false) - .code(&self.header_verifier_code) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(MultiValueEncoded::new()) + .code(header_verifier_code_path) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_header_verifier_address(Bech32Address::from_bech32_string( @@ -293,7 +327,49 @@ impl ContractInteract { println!("new header_verifier_address: {new_address_bech32}"); } + async fn deploy_testing_contract(&mut self) { + let testing_sc_code_path = MxscPath::new(&self.testing_sc_code); + + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(100_000_000u64) + .typed(TestingScProxy) + .init() + .code(testing_sc_code_path) + .returns(ReturnsNewAddress) + .run() + .await; + + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_testing_sc_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); + + println!("new testing_sc_address: {new_address_bech32}"); + } + + async fn call_hello_endpoint(&mut self, value: u64) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(&self.state.get_testing_sc_address()) + .gas(50_000_000u64) + .typed(TestingScProxy) + .hello(value) + .returns(ReturnsResultUnmanaged) + .run() + .await; + + println!("Result: {response:?}"); + } + async fn upgrade(&mut self) { + let code_path = MxscPath::new(&self.esdt_safe_code); + let response = self .interactor .tx() @@ -302,10 +378,9 @@ impl ContractInteract { .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) .upgrade() - .code(&self.contract_code) + .code(code_path) .code_metadata(CodeMetadata::UPGRADEABLE) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; @@ -323,7 +398,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_fee_market_address(fee_market_address) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -342,7 +416,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_header_verifier_address(header_verifier_address) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -358,7 +431,7 @@ impl ContractInteract { let token_nonce = 0u64; let token_amount = BigUint::::from(20u64); - let to = &self.bob_address; + let to = &self.frank_address; let mut payments = PaymentsVec::new(); payments.push(EsdtTokenPayment::new( TokenIdentifier::from(token_id), @@ -377,7 +450,6 @@ impl ContractInteract { .deposit(to, transfer_data) .payment(payments) .returns(error) - .prepare_async() .run() .await; } @@ -391,7 +463,6 @@ impl ContractInteract { .deposit(to, transfer_data) .payment(payments) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -410,7 +481,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_min_valid_signers(new_value) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -429,7 +499,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_signers(signers) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -448,7 +517,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_signers(signers) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -458,10 +526,10 @@ impl ContractInteract { async fn register_token(&mut self) { let egld_amount = BigUint::::from(50_000_000_000_000_000u64); - let sov_token_id = TokenIdentifier::from_esdt_bytes(&b"SOV"[..]); + let sov_token_id = TokenIdentifier::from_esdt_bytes(b"x-SOV-101252"); let token_type = EsdtTokenType::Fungible; - let token_display_name = ManagedBuffer::new_from_bytes(&b"SOVEREIGN"[..]); - let token_ticker = ManagedBuffer::new_from_bytes(&b"SVCT"[..]); + let token_display_name = ManagedBuffer::new_from_bytes(b"TESDT"); + let token_ticker = ManagedBuffer::new_from_bytes(b"TEST"); let num_decimals = 18u32; let response = self @@ -480,40 +548,42 @@ impl ContractInteract { ) .egld(egld_amount) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; println!("Result: {response:?}"); } - async fn execute_operations(&mut self) { - let (tokens, data) = self.setup_payments().await; - let to = managed_address!(&self.bob_address); - let operation = Operation::new(to, tokens, data); - let operation_hash = self.get_operation_hash(&operation).await; + async fn execute_operations( + &mut self, + operation: &Operation, + expect_error: Option, + ) { + let hash_of_hashes = sha256(&self.get_operation_hash(operation)); let response = self .interactor .tx() .from(&self.wallet_address) .to(self.state.current_address()) - .gas(30_000_000u64) + .gas(70_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(operation_hash, operation) - .returns(ReturnsResultUnmanaged) - .prepare_async() + .execute_operations(&hash_of_hashes, operation) + .returns(ReturnsHandledOrError::new().returns(ReturnsResultUnmanaged)) .run() .await; - println!("Result: {response:?}"); + if let Err(err) = response { + assert!(err == expect_error.unwrap()); + } } async fn execute_operations_with_error(&mut self, error_msg: ExpectError<'_>) { - let (tokens, data) = self.setup_payments().await; - let to = managed_address!(&self.bob_address); - let operation = Operation::new(to, tokens, data); - let operation_hash = self.get_operation_hash(&operation).await; + let tokens = self.setup_payments().await; + let operation_data = self.setup_operation_data(false).await; + let to = managed_address!(&self.frank_address); + let operation = Operation::new(to, tokens, operation_data); + let operation_hash = self.get_operation_hash(&operation); let response = self .interactor @@ -522,9 +592,8 @@ impl ContractInteract { .to(self.state.current_address()) .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(operation_hash, operation) + .execute_operations(&operation_hash, operation) .returns(error_msg) - .prepare_async() .run() .await; @@ -543,7 +612,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_tx_batch_size(new_max_tx_batch_size) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -562,7 +630,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_tx_batch_block_duration(new_max_tx_batch_block_duration) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -577,7 +644,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_current_tx_batch() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -590,7 +656,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_first_batch_any_status() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -605,7 +670,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_batch(batch_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -619,7 +683,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_batch_status(batch_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -632,7 +695,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .first_batch_id() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -647,7 +709,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .last_batch_id() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -667,7 +728,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_bridged_amount(token_id, max_amount) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -684,7 +744,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .max_bridged_amount(token_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -701,7 +760,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .end_setup_phase() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -720,7 +778,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_tokens_to_whitelist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -739,7 +796,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_tokens_from_whitelist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -758,7 +814,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_tokens_to_blacklist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -777,7 +832,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_tokens_from_blacklist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -792,7 +846,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .token_whitelist() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -807,7 +860,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .token_blacklist() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -824,7 +876,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .pause_endpoint() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -841,7 +892,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .unpause_endpoint() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -856,7 +906,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .paused_status() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -868,81 +917,172 @@ impl ContractInteract { .interactor .tx() .from(&self.wallet_address) - .to(self.state.fee_market_address.clone().unwrap().as_address()) + .to(self.state.get_fee_market_address()) .gas(30_000_000u64) .typed(FeeMarketProxy) .remove_fee(TOKEN_ID) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; println!("Result: {response:?}"); } - async fn setup_payments( - &mut self, - ) -> ( - ManagedVec>, - OperationData, - ) { + async fn header_verifier_set_esdt_address(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.get_header_verifier_address()) + .gas(30_000_000u64) + .typed(HeaderverifierProxy) + .set_esdt_safe_address(self.state.current_address()) + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation { + let to = managed_address!(&self.state.get_testing_sc_address()); + let payments = self.setup_payments().await; + + let operation_data = self.setup_operation_data(has_transfer_data).await; + + Operation::new(to, payments, operation_data) + } + + async fn setup_operation_data(&mut self, has_transfer_data: bool) -> OperationData { + let op_sender = managed_address!(&self.wallet_address); + + let transfer_data = if has_transfer_data { + let mut args = ManagedVec::new(); + let value = BigUint::::from(0u64); + args.push(ManagedBuffer::from(value.to_bytes_be())); + + Some(TransferData::new( + 30_000_000u64, + ManagedBuffer::from("hello"), + args, + )) + } else { + None + }; + + let operation_data: OperationData = OperationData { + op_nonce: 1, + op_sender, + opt_transfer_data: transfer_data, + }; + + operation_data + } + + async fn register_operations(&mut self, operation: &Operation) { + let bls_signature = ManagedByteArray::default(); + let operation_hash = self.get_operation_hash(operation); + let hash_of_hashes = sha256(&operation_hash); + + let mut managed_operation_hashes = + MultiValueEncoded::>::new(); + + let managed_operation_hash = ManagedBuffer::::from(&operation_hash); + let managed_hash_of_hashes = ManagedBuffer::::from(&hash_of_hashes); + + managed_operation_hashes.push(managed_operation_hash); + + let header_verifier_address = self.state.get_header_verifier_address(); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + bls_signature, + managed_hash_of_hashes, + managed_operation_hashes, + ) + .returns(ReturnsResult) + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn setup_payments(&mut self) -> ManagedVec> { let mut tokens: ManagedVec> = ManagedVec::new(); - let token_ids = vec![TOKEN_ID]; + let token_ids = vec![TOKEN_ID_FOR_EXECUTE]; for token_id in token_ids { let payment: OperationEsdtPayment = OperationEsdtPayment { token_identifier: token_id.into(), - token_nonce: 1, - token_data: EsdtTokenData::default(), + token_nonce: 0, + token_data: EsdtTokenData { + token_type: EsdtTokenType::Fungible, + amount: BigUint::from(10_000u64), + frozen: false, + hash: ManagedBuffer::new(), + name: ManagedBuffer::from("SovToken"), + attributes: ManagedBuffer::new(), + creator: managed_address!(&self.frank_address), + royalties: BigUint::zero(), + uris: ManagedVec::new(), + }, }; tokens.push(payment); } - let op_sender = managed_address!(&self.wallet_address); - let data: OperationData = OperationData { - op_nonce: 1, - op_sender, - opt_transfer_data: Option::None, - }; - - (tokens, data) + tokens } - async fn get_operation_hash( - &mut self, - operation: &Operation, - ) -> ManagedBuffer { + fn get_operation_hash(&mut self, operation: &Operation) -> [u8; SHA256_RESULT_LEN] { let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); let _ = operation.top_encode(&mut serialized_operation); - let sha256 = sha256(&serialized_operation.to_vec()); - - ManagedBuffer::new_from_bytes(&sha256) + sha256(&serialized_operation.to_vec()) } -} -#[tokio::test] -#[ignore] -async fn test_deploy() { - let mut interact = ContractInteract::new().await; - interact.deploy(false).await; - interact.deploy_price_aggregator().await; - interact.deploy_fee_market().await; - interact.set_fee_market_address().await; - interact.remove_fee().await; - interact.unpause_endpoint().await; + fn get_hash(&mut self, operation: &ManagedBuffer) -> ManagedBuffer { + let mut array = [0; 1024]; + + let len = { + let byte_array = operation.load_to_byte_array(&mut array); + byte_array.len() + }; + + let trimmed_slice = &array[..len]; + let hash = sha256(trimmed_slice); + + ManagedBuffer::from(&hash) + } } #[tokio::test] #[ignore] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; - interact.deploy(true).await; - interact.deploy_price_aggregator().await; + interact.deploy(false).await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; interact.remove_fee().await; interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; + interact.header_verifier_set_esdt_address().await; + interact.deploy_testing_contract().await; + interact.register_token().await; + + let operation = interact.setup_operation(true).await; + interact.register_operations(&operation).await; + interact + .execute_operations( + &operation, + Some(TxResponseStatus::new( + ReturnCode::UserError, + "Value should be greater than 0", + )), + ) + .await; } diff --git a/esdt-safe/interactor/src/proxies/fee_market_proxy.rs b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs new file mode 100644 index 00000000..b595c0f6 --- /dev/null +++ b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs @@ -0,0 +1,278 @@ +// 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 FeeMarketProxy; + +impl TxProxyTrait for FeeMarketProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = FeeMarketProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + FeeMarketProxyMethods { wrapped_tx: tx } + } +} + +pub struct FeeMarketProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl FeeMarketProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + esdt_safe_address: Arg0, + price_aggregator_address: Arg1, + fee: Arg2, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&esdt_safe_address) + .argument(&price_aggregator_address) + .argument(&fee) + .original_result() + } +} + +#[rustfmt::skip] +impl FeeMarketProxyMethods +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 FeeMarketProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee< + Arg0: ProxyArg>, + >( + self, + fee_struct: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addFee") + .argument(&fee_struct) + .original_result() + } + + pub fn disable_fee< + Arg0: ProxyArg>, + >( + self, + base_token: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeFee") + .argument(&base_token) + .original_result() + } + + pub fn token_fee< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenFee") + .argument(&token_id) + .original_result() + } + + pub fn add_users_to_whitelist< + Arg0: ProxyArg>>, + >( + self, + users: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addUsersToWhitelist") + .argument(&users) + .original_result() + } + + pub fn remove_users_from_whitelist< + Arg0: ProxyArg>>, + >( + self, + users: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeUsersFromWhitelist") + .argument(&users) + .original_result() + } + + /// Percentages have to be between 0 and 10_000, and must all add up to 100% (i.e. 10_000) + pub fn distribute_fees< + Arg0: ProxyArg, usize>>>, + >( + self, + address_percentage_pairs: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("distributeFees") + .argument(&address_percentage_pairs) + .original_result() + } + + pub fn subtract_fee< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + >( + self, + original_caller: Arg0, + total_transfers: Arg1, + opt_gas_limit: Arg2, + ) -> TxTypedCall> { + self.wrapped_tx + .raw_call("subtractFee") + .argument(&original_caller) + .argument(&total_transfers) + .argument(&opt_gas_limit) + .original_result() + } + + pub fn users_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getUsersWhitelist") + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} + +#[type_abi] +#[derive(TopDecode, TopEncode, NestedEncode, NestedDecode, Clone)] +pub struct FeeStruct +where + Api: ManagedTypeApi, +{ + pub base_token: TokenIdentifier, + pub fee_type: FeeType, +} + +#[rustfmt::skip] +#[type_abi] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] +pub enum FeeType +where + Api: ManagedTypeApi, +{ + None, + Fixed { + token: TokenIdentifier, + per_transfer: BigUint, + per_gas: BigUint, + }, + AnyToken { + base_fee_token: TokenIdentifier, + per_transfer: BigUint, + per_gas: BigUint, + }, +} + +#[type_abi] +#[derive(TopEncode, TopDecode)] +pub struct FinalPayment +where + Api: ManagedTypeApi, +{ + pub fee: EsdtTokenPayment, + pub remaining_tokens: EsdtTokenPayment, +} diff --git a/esdt-safe/interactor/src/proxies/header_verifier_proxy.rs b/esdt-safe/interactor/src/proxies/header_verifier_proxy.rs new file mode 100644 index 00000000..4f57c709 --- /dev/null +++ b/esdt-safe/interactor/src/proxies/header_verifier_proxy.rs @@ -0,0 +1,174 @@ +// 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 HeaderverifierProxy; + +impl TxProxyTrait for HeaderverifierProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = HeaderverifierProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + HeaderverifierProxyMethods { wrapped_tx: tx } + } +} + +pub struct HeaderverifierProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl HeaderverifierProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>>, + >( + self, + bls_pub_keys: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&bls_pub_keys) + .original_result() + } +} + +#[rustfmt::skip] +impl HeaderverifierProxyMethods +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 HeaderverifierProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn register_bridge_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + signature: Arg0, + bridge_operations_hash: Arg1, + operations_hashes: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("registerBridgeOps") + .argument(&signature) + .argument(&bridge_operations_hash) + .argument(&operations_hashes) + .original_result() + } + + pub fn set_esdt_safe_address< + Arg0: ProxyArg>, + >( + self, + esdt_safe_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setEsdtSafeAddress") + .argument(&esdt_safe_address) + .original_result() + } + + pub fn remove_executed_hash< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation_hash: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeExecutedHash") + .argument(&hash_of_hashes) + .argument(&operation_hash) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} diff --git a/esdt-safe/interactor/src/proxies/mod.rs b/esdt-safe/interactor/src/proxies/mod.rs new file mode 100644 index 00000000..171e160b --- /dev/null +++ b/esdt-safe/interactor/src/proxies/mod.rs @@ -0,0 +1,5 @@ +pub mod fee_market_proxy; +pub mod header_verifier_proxy; +pub mod price_aggregator_proxy; +pub mod proxy; +pub mod testing_sc_proxy; diff --git a/esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs b/esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs new file mode 100644 index 00000000..7a7e2aaa --- /dev/null +++ b/esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs @@ -0,0 +1,416 @@ +// 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 PriceAggregatorProxy; + +impl TxProxyTrait for PriceAggregatorProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = PriceAggregatorProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + PriceAggregatorProxyMethods { wrapped_tx: tx } + } +} + +pub struct PriceAggregatorProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +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>>, + >( + self, + staking_token: Arg0, + staking_amount: Arg1, + slash_amount: Arg2, + slash_quorum: Arg3, + submission_count: Arg4, + oracles: Arg5, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&staking_token) + .argument(&staking_amount) + .argument(&slash_amount) + .argument(&slash_quorum) + .argument(&submission_count) + .argument(&oracles) + .original_result() + } +} + +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +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 PriceAggregatorProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn change_amounts< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + staking_amount: Arg0, + slash_amount: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("changeAmounts") + .argument(&staking_amount) + .argument(&slash_amount) + .original_result() + } + + pub fn add_oracles< + Arg0: ProxyArg>>, + >( + self, + oracles: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addOracles") + .argument(&oracles) + .original_result() + } + + /// Also receives submission count, + /// so the owner does not have to update it manually with setSubmissionCount before this call + pub fn remove_oracles< + Arg0: ProxyArg, + Arg1: ProxyArg>>, + >( + self, + submission_count: Arg0, + oracles: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeOracles") + .argument(&submission_count) + .argument(&oracles) + .original_result() + } + + pub fn submit< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + from: Arg0, + to: Arg1, + submission_timestamp: Arg2, + price: Arg3, + decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submit") + .argument(&from) + .argument(&to) + .argument(&submission_timestamp) + .argument(&price) + .argument(&decimals) + .original_result() + } + + pub fn submit_batch< + Arg0: ProxyArg, ManagedBuffer, u64, BigUint, u8>>>, + >( + self, + submissions: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submitBatch") + .argument(&submissions) + .original_result() + } + + pub fn latest_round_data( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestRoundData") + .original_result() + } + + pub fn latest_price_feed< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestPriceFeed") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn latest_price_feed_optional< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestPriceFeedOptional") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn set_submission_count< + Arg0: ProxyArg, + >( + self, + submission_count: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setSubmissionCount") + .argument(&submission_count) + .original_result() + } + + pub fn get_oracles( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getOracles") + .original_result() + } + + pub fn set_pair_decimals< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg, + >( + self, + from: Arg0, + to: Arg1, + decimals: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setPairDecimals") + .argument(&from) + .argument(&to) + .argument(&decimals) + .original_result() + } + + pub fn get_pair_decimals< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getPairDecimals") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn submission_count( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submission_count") + .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() + } + + pub fn stake( + self, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("stake") + .original_result() + } + + pub fn unstake< + Arg0: ProxyArg>, + >( + self, + unstake_amount: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unstake") + .argument(&unstake_amount) + .original_result() + } + + pub fn vote_slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("voteSlashMember") + .argument(&member_to_slash) + .original_result() + } + + pub fn cancel_vote_slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("cancelVoteSlashMember") + .argument(&member_to_slash) + .original_result() + } + + pub fn slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("slashMember") + .argument(&member_to_slash) + .original_result() + } +} + +#[type_abi] +#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] +pub struct PriceFeed +where + Api: ManagedTypeApi, +{ + pub round_id: u32, + pub from: ManagedBuffer, + pub to: ManagedBuffer, + pub timestamp: u64, + pub price: BigUint, + pub decimals: u8, +} + +#[type_abi] +#[derive(TopEncode)] +pub struct NewRoundEvent +where + Api: ManagedTypeApi, +{ + pub price: BigUint, + pub timestamp: u64, + pub decimals: u8, + pub block: u64, + pub epoch: u64, +} + +#[type_abi] +#[derive(TopEncode)] +pub struct DiscardSubmissionEvent { + pub submission_timestamp: u64, + pub first_submission_timestamp: u64, + pub has_caller_already_submitted: bool, +} diff --git a/esdt-safe/interactor/src/proxies/proxy.rs b/esdt-safe/interactor/src/proxies/proxy.rs new file mode 100644 index 00000000..81e2e31d --- /dev/null +++ b/esdt-safe/interactor/src/proxies/proxy.rs @@ -0,0 +1,458 @@ +// 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, +{ + pub fn init< + Arg0: ProxyArg, + >( + self, + is_sovereign_chain: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&is_sovereign_chain) + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +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 EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee_market_address< + Arg0: ProxyArg>, + >( + self, + fee_market_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setFeeMarketAddress") + .argument(&fee_market_address) + .original_result() + } + + pub fn set_header_verifier_address< + Arg0: ProxyArg>, + >( + self, + header_verifier_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setHeaderVerifierAddress") + .argument(&header_verifier_address) + .original_result() + } + + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + >( + self, + max_user_tx_gas_limit: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxGasLimit") + .argument(&max_user_tx_gas_limit) + .original_result() + } + + pub fn set_banned_endpoint< + Arg0: ProxyArg>, + >( + self, + endpoint_name: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBannedEndpoint") + .argument(&endpoint_name) + .original_result() + } + + pub fn deposit< + Arg0: ProxyArg>, + Arg1: ProxyArg, ManagedVec>>>>, + >( + self, + to: Arg0, + optional_transfer_data: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deposit") + .argument(&to) + .argument(&optional_transfer_data) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } + + pub fn register_token< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + sov_token_id: Arg0, + token_type: Arg1, + token_display_name: Arg2, + token_ticker: Arg3, + num_decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("registerToken") + .argument(&sov_token_id) + .argument(&token_type) + .argument(&token_display_name) + .argument(&token_ticker) + .argument(&num_decimals) + .original_result() + } + + pub fn execute_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("executeBridgeOps") + .argument(&hash_of_hashes) + .argument(&operation) + .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, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + 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 end_setup_phase( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("endSetupPhase") + .original_result() + } + + /// Tokens in the whitelist can be transferred without fees + pub fn add_tokens_to_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToWhitelist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromWhitelist") + .argument(&tokens) + .original_result() + } + + /// Tokens in blacklist cannot be transferred + pub fn add_tokens_to_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn token_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenWhitelist") + .original_result() + } + + pub fn token_blacklist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenBlacklist") + .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/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs b/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs new file mode 100644 index 00000000..ecfec395 --- /dev/null +++ b/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs @@ -0,0 +1,95 @@ +// 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 TestingScProxy; + +impl TxProxyTrait for TestingScProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = TestingScProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + TestingScProxyMethods { wrapped_tx: tx } + } +} + +pub struct TestingScProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl TestingScProxyMethods +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 TestingScProxyMethods +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 TestingScProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn hello< + Arg0: ProxyArg>, + >( + self, + value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("hello") + .argument(&value) + .original_result() + } +} diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 76c22a65..203020a1 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqyczw89pfr8aj54j4crvr7z700duqge4xt7asyhkfsm" -fee_market_address = "erd1qqqqqqqqqqqqqpgq0r6lzfdz4uhqar7kmspxhg0kr8ezmw64t7aswthejh" -price_aggregator_address = "erd1qqqqqqqqqqqqqpgqxutn5wwtjesh73fl3pz0ua9p9tqsys8vt7as36y3vf" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqzt6lf09qhz8fdq4k67mz3e8h8yjmmlcvt7asftyk47" +contract_address = "erd1qqqqqqqqqqqqqpgqx6td5ezm7f2kynjsdg9u54lwwyhr0e8srruqazhkq2" +fee_market_address = "erd1qqqqqqqqqqqqqpgqqa6f8u9mzqwft2v9lgwhyjfehuhmylegrruq8mrtuw" +price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqqyhlhxwke87nwyvxafg5r6q9wfgyh2chrruq7qjcnj" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqmsd3tr2e3t863dp8kc4y9sdu0fdfzcc0rruq872jth" From 387907219c8765d4fd3b2bf51696d9728292b3b7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 13 Nov 2024 13:01:09 +0200 Subject: [PATCH 2/5] Fixed interactor Signed-off-by: Andrei Baltariu --- Cargo.lock | 1558 ++++++++++++++++++- Cargo.toml | 1 + esdt-safe/interactor/src/interactor_main.rs | 20 +- 3 files changed, 1519 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f9d906f..89e6cf9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,32 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -14,6 +40,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.6.13" @@ -80,6 +115,21 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.22.0" @@ -98,6 +148,35 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +[[package]] +name = "bip39" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" +dependencies = [ + "bitcoin_hashes", + "rand", + "rand_core", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + [[package]] name = "bitflags" version = "2.6.0" @@ -128,6 +207,21 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + +[[package]] +name = "cc" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8" +dependencies = [ + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -172,6 +266,16 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.5.4" @@ -243,6 +347,22 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -262,6 +382,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -307,6 +436,18 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -345,12 +486,45 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "esdt-safe" version = "0.0.0" @@ -380,6 +554,12 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "fastrand" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + [[package]] name = "fee-market" version = "0.0.0" @@ -406,6 +586,125 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -427,6 +726,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + [[package]] name = "hashbrown" version = "0.14.3" @@ -462,12 +767,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "hex-literal" version = "0.4.1" @@ -475,108 +792,429 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] -name = "indexmap" -version = "2.2.6" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "equivalent", - "hashbrown", - "serde", + "digest", ] [[package]] -name = "itertools" -version = "0.13.0" +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "either", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "itoa" -version = "1.0.11" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] [[package]] -name = "keccak" -version = "0.1.5" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ - "cpufeatures", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "httparse" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] -name = "leb128" -version = "0.2.5" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] -name = "libc" -version = "0.2.153" +name = "hyper" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] [[package]] -name = "log" -version = "0.4.21" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] [[package]] -name = "max-bridged-amount-module" -version = "0.0.0" +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] -name = "memchr" -version = "2.7.2" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] [[package]] -name = "multiversx-chain-core" -version = "0.11.0" +name = "icu_locid" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" dependencies = [ - "bitflags", - "multiversx-sc-codec", + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", ] [[package]] -name = "multiversx-chain-scenario-format" -version = "0.23.0" +name = "icu_locid_transform" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" dependencies = [ - "bech32", - "hex", - "num-bigint", - "num-traits", - "serde", - "serde_json", - "sha3", + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", ] [[package]] -name = "multiversx-chain-vm" -version = "0.11.0" +name = "icu_locid_transform_data" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d885c04e117cf5ca37303825a578385dbc880ee89890b0649dbbb22ad19dc59" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "max-bridged-amount-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", +] + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d885c04e117cf5ca37303825a578385dbc880ee89890b0649dbbb22ad19dc59" dependencies = [ "bitflags", "colored", @@ -709,6 +1347,87 @@ dependencies = [ "unwrap-infallible", ] +[[package]] +name = "multiversx-sc-snippets" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83eec6ebd7efc32eb77d19ea29f3f13d42b7d848662b173c920201741ec3897e" +dependencies = [ + "anyhow", + "base64", + "env_logger", + "futures", + "hex", + "log", + "multiversx-chain-scenario-format", + "multiversx-sc-scenario", + "multiversx-sdk", + "multiversx-sdk-http", + "tokio", +] + +[[package]] +name = "multiversx-sdk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c393e7b58c5eafcfc814bb13efe2a09f20fa0dbfee93bc501ca4236135a7647" +dependencies = [ + "aes", + "anyhow", + "base64", + "bech32", + "bip39", + "ctr", + "hex", + "hmac", + "itertools", + "log", + "multiversx-chain-core", + "pbkdf2", + "pem", + "rand", + "scrypt", + "serde", + "serde_json", + "serde_repr", + "sha2", + "sha3", + "uuid", + "zeroize", +] + +[[package]] +name = "multiversx-sdk-http" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0727639c2b44d21d024f8134231c37d50ad76788675c77bee342016a63e226" +dependencies = [ + "anyhow", + "hex", + "itertools", + "log", + "multiversx-sdk", + "reqwest", + "tokio", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nibble_vec" version = "0.1.0" @@ -746,18 +1465,143 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "openssl" +version = "0.10.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.4", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.10.2" @@ -768,6 +1612,12 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -841,6 +1691,106 @@ dependencies = [ "rand_core", ] +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rust-interact" +version = "0.0.0" +dependencies = [ + "clap", + "esdt-safe", + "fee-market", + "multiversx-sc", + "multiversx-sc-scenario", + "multiversx-sc-snippets", + "serde", + "toml", + "transaction", + "tx-batch-module", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + [[package]] name = "rustc_version" version = "0.4.0" @@ -850,11 +1800,98 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + [[package]] name = "ryu" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "password-hash", + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "semver" @@ -888,11 +1925,23 @@ version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ + "indexmap", "itoa", "ryu", "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_spanned" version = "0.6.5" @@ -902,6 +1951,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "setup-phase" version = "0.0.0" @@ -931,6 +1992,21 @@ dependencies = [ "keccak", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + [[package]] name = "signature" version = "2.2.0" @@ -940,12 +2016,31 @@ dependencies = [ "rand_core", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spki" version = "0.7.3" @@ -956,6 +2051,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.11.1" @@ -979,6 +2080,36 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -988,6 +2119,31 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "token-whitelist" version = "0.0.0" @@ -999,6 +2155,45 @@ dependencies = [ "utils", ] +[[package]] +name = "tokio" +version = "1.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "toml" version = "0.8.12" @@ -1034,6 +2229,31 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + [[package]] name = "transaction" version = "0.0.0" @@ -1041,6 +2261,12 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "tx-batch-module" version = "0.0.0" @@ -1062,6 +2288,15 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -1080,6 +2315,29 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" +[[package]] +name = "url" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.1" @@ -1094,18 +2352,109 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +dependencies = [ + "getrandom", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + [[package]] name = "wasm-encoder" version = "0.220.0" @@ -1173,6 +2522,16 @@ dependencies = [ "wast", ] +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1345,6 +2704,52 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -1365,8 +2770,51 @@ dependencies = [ "syn", ] +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 709827ac..f73bdeaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "chain-factory", "chain-factory/meta", "esdt-safe", + "esdt-safe/interactor", "esdt-safe/meta", "fee-market", "fee-market/meta", diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 74dc900c..b6debec7 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -4,8 +4,7 @@ mod proxies; -use fee_market::fee_market_proxy::FeeMarketProxy; -use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; +use fee_market_proxy::{FeeStruct, FeeType}; use header_verifier_proxy::HeaderverifierProxy; use multiversx_sc_scenario::meta::tools::find_current_workspace; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; @@ -135,6 +134,10 @@ impl State { pub fn get_testing_sc_address(&self) -> Address { self.testing_sc_address.clone().unwrap().to_address() } + + pub fn get_price_aggregator_address(&self) -> Address { + self.price_aggregator_address.clone().unwrap().to_address() + } } impl Drop for State { @@ -250,7 +253,11 @@ impl ContractInteract { .from(&self.wallet_address) .gas(100_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) - .init(self.state.current_address(), Option::Some(fee)) + .init( + self.state.current_address(), + self.state.get_price_aggregator_address(), + Option::Some(fee), + ) .code(fee_market_code_path) .returns(ReturnsNewAddress) .run() @@ -919,8 +926,8 @@ impl ContractInteract { .from(&self.wallet_address) .to(self.state.get_fee_market_address()) .gas(30_000_000u64) - .typed(FeeMarketProxy) - .remove_fee(TOKEN_ID) + .typed(fee_market_proxy::FeeMarketProxy) + .disable_fee(TOKEN_ID) .returns(ReturnsResultUnmanaged) .run() .await; @@ -1059,6 +1066,9 @@ impl ContractInteract { } } +// NOTE: +// All interactor tests should only be ignored when pushed to Github +// Those System Tests are intended to run locally since they won't work on Github Actions #[tokio::test] #[ignore] async fn test_deploy_sov() { From 14c569ff2383c0b36885b6b65dd1b426e7a068a9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 13 Nov 2024 13:20:37 +0200 Subject: [PATCH 3/5] Removed proxies from src/ folder Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/fee_market_proxy.rs | 278 ------------ .../interactor/src/header_verifier_proxy.rs | 174 -------- esdt-safe/interactor/src/interactor_main.rs | 10 +- .../interactor/src/price_aggregator_proxy.rs | 416 ------------------ .../src/proxies/fee_market_proxy.rs | 22 +- 5 files changed, 19 insertions(+), 881 deletions(-) delete mode 100644 esdt-safe/interactor/src/fee_market_proxy.rs delete mode 100644 esdt-safe/interactor/src/header_verifier_proxy.rs delete mode 100644 esdt-safe/interactor/src/price_aggregator_proxy.rs diff --git a/esdt-safe/interactor/src/fee_market_proxy.rs b/esdt-safe/interactor/src/fee_market_proxy.rs deleted file mode 100644 index b595c0f6..00000000 --- a/esdt-safe/interactor/src/fee_market_proxy.rs +++ /dev/null @@ -1,278 +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 FeeMarketProxy; - -impl TxProxyTrait for FeeMarketProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = FeeMarketProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - FeeMarketProxyMethods { wrapped_tx: tx } - } -} - -pub struct FeeMarketProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl FeeMarketProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, - >( - self, - esdt_safe_address: Arg0, - price_aggregator_address: Arg1, - fee: Arg2, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&esdt_safe_address) - .argument(&price_aggregator_address) - .argument(&fee) - .original_result() - } -} - -#[rustfmt::skip] -impl FeeMarketProxyMethods -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 FeeMarketProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn set_fee< - Arg0: ProxyArg>, - >( - self, - fee_struct: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addFee") - .argument(&fee_struct) - .original_result() - } - - pub fn disable_fee< - Arg0: ProxyArg>, - >( - self, - base_token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeFee") - .argument(&base_token) - .original_result() - } - - pub fn token_fee< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenFee") - .argument(&token_id) - .original_result() - } - - pub fn add_users_to_whitelist< - Arg0: ProxyArg>>, - >( - self, - users: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addUsersToWhitelist") - .argument(&users) - .original_result() - } - - pub fn remove_users_from_whitelist< - Arg0: ProxyArg>>, - >( - self, - users: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeUsersFromWhitelist") - .argument(&users) - .original_result() - } - - /// Percentages have to be between 0 and 10_000, and must all add up to 100% (i.e. 10_000) - pub fn distribute_fees< - Arg0: ProxyArg, usize>>>, - >( - self, - address_percentage_pairs: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("distributeFees") - .argument(&address_percentage_pairs) - .original_result() - } - - pub fn subtract_fee< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - original_caller: Arg0, - total_transfers: Arg1, - opt_gas_limit: Arg2, - ) -> TxTypedCall> { - self.wrapped_tx - .raw_call("subtractFee") - .argument(&original_caller) - .argument(&total_transfers) - .argument(&opt_gas_limit) - .original_result() - } - - pub fn users_whitelist( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getUsersWhitelist") - .original_result() - } - - pub fn set_min_valid_signers< - Arg0: ProxyArg, - >( - self, - new_value: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMinValidSigners") - .argument(&new_value) - .original_result() - } - - pub fn add_signers< - Arg0: ProxyArg>>, - >( - self, - signers: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addSigners") - .argument(&signers) - .original_result() - } - - pub fn remove_signers< - Arg0: ProxyArg>>, - >( - self, - signers: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeSigners") - .argument(&signers) - .original_result() - } -} - -#[type_abi] -#[derive(TopDecode, TopEncode, NestedEncode, NestedDecode, Clone)] -pub struct FeeStruct -where - Api: ManagedTypeApi, -{ - pub base_token: TokenIdentifier, - pub fee_type: FeeType, -} - -#[rustfmt::skip] -#[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] -pub enum FeeType -where - Api: ManagedTypeApi, -{ - None, - Fixed { - token: TokenIdentifier, - per_transfer: BigUint, - per_gas: BigUint, - }, - AnyToken { - base_fee_token: TokenIdentifier, - per_transfer: BigUint, - per_gas: BigUint, - }, -} - -#[type_abi] -#[derive(TopEncode, TopDecode)] -pub struct FinalPayment -where - Api: ManagedTypeApi, -{ - pub fee: EsdtTokenPayment, - pub remaining_tokens: EsdtTokenPayment, -} diff --git a/esdt-safe/interactor/src/header_verifier_proxy.rs b/esdt-safe/interactor/src/header_verifier_proxy.rs deleted file mode 100644 index 4f57c709..00000000 --- a/esdt-safe/interactor/src/header_verifier_proxy.rs +++ /dev/null @@ -1,174 +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 HeaderverifierProxy; - -impl TxProxyTrait for HeaderverifierProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = HeaderverifierProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - HeaderverifierProxyMethods { wrapped_tx: tx } - } -} - -pub struct HeaderverifierProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl HeaderverifierProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>>, - >( - self, - bls_pub_keys: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&bls_pub_keys) - .original_result() - } -} - -#[rustfmt::skip] -impl HeaderverifierProxyMethods -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 HeaderverifierProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn register_bridge_operations< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, - >( - self, - signature: Arg0, - bridge_operations_hash: Arg1, - operations_hashes: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("registerBridgeOps") - .argument(&signature) - .argument(&bridge_operations_hash) - .argument(&operations_hashes) - .original_result() - } - - pub fn set_esdt_safe_address< - Arg0: ProxyArg>, - >( - self, - esdt_safe_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&esdt_safe_address) - .original_result() - } - - pub fn remove_executed_hash< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - hash_of_hashes: Arg0, - operation_hash: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeExecutedHash") - .argument(&hash_of_hashes) - .argument(&operation_hash) - .original_result() - } - - pub fn set_min_valid_signers< - Arg0: ProxyArg, - >( - self, - new_value: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMinValidSigners") - .argument(&new_value) - .original_result() - } - - pub fn add_signers< - Arg0: ProxyArg>>, - >( - self, - signers: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addSigners") - .argument(&signers) - .original_result() - } - - pub fn remove_signers< - Arg0: ProxyArg>>, - >( - self, - signers: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeSigners") - .argument(&signers) - .original_result() - } -} diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index b6debec7..1b340aa7 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -2,7 +2,7 @@ // TODO: Remove this when interactor setup is complete #![allow(dead_code)] -mod proxies; +pub mod proxies; use fee_market_proxy::{FeeStruct, FeeType}; use header_verifier_proxy::HeaderverifierProxy; @@ -253,11 +253,7 @@ impl ContractInteract { .from(&self.wallet_address) .gas(100_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) - .init( - self.state.current_address(), - self.state.get_price_aggregator_address(), - Option::Some(fee), - ) + .init(self.state.current_address(), Option::Some(fee)) .code(fee_market_code_path) .returns(ReturnsNewAddress) .run() @@ -927,7 +923,7 @@ impl ContractInteract { .to(self.state.get_fee_market_address()) .gas(30_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee(TOKEN_ID) + .remove_fee(TOKEN_ID) .returns(ReturnsResultUnmanaged) .run() .await; diff --git a/esdt-safe/interactor/src/price_aggregator_proxy.rs b/esdt-safe/interactor/src/price_aggregator_proxy.rs deleted file mode 100644 index 7a7e2aaa..00000000 --- a/esdt-safe/interactor/src/price_aggregator_proxy.rs +++ /dev/null @@ -1,416 +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 PriceAggregatorProxy; - -impl TxProxyTrait for PriceAggregatorProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = PriceAggregatorProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - PriceAggregatorProxyMethods { wrapped_tx: tx } - } -} - -pub struct PriceAggregatorProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl PriceAggregatorProxyMethods -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>>, - >( - self, - staking_token: Arg0, - staking_amount: Arg1, - slash_amount: Arg2, - slash_quorum: Arg3, - submission_count: Arg4, - oracles: Arg5, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&staking_token) - .argument(&staking_amount) - .argument(&slash_amount) - .argument(&slash_quorum) - .argument(&submission_count) - .argument(&oracles) - .original_result() - } -} - -#[rustfmt::skip] -impl PriceAggregatorProxyMethods -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 PriceAggregatorProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn change_amounts< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - staking_amount: Arg0, - slash_amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeAmounts") - .argument(&staking_amount) - .argument(&slash_amount) - .original_result() - } - - pub fn add_oracles< - Arg0: ProxyArg>>, - >( - self, - oracles: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addOracles") - .argument(&oracles) - .original_result() - } - - /// Also receives submission count, - /// so the owner does not have to update it manually with setSubmissionCount before this call - pub fn remove_oracles< - Arg0: ProxyArg, - Arg1: ProxyArg>>, - >( - self, - submission_count: Arg0, - oracles: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeOracles") - .argument(&submission_count) - .argument(&oracles) - .original_result() - } - - pub fn submit< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg>, - Arg4: ProxyArg, - >( - self, - from: Arg0, - to: Arg1, - submission_timestamp: Arg2, - price: Arg3, - decimals: Arg4, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("submit") - .argument(&from) - .argument(&to) - .argument(&submission_timestamp) - .argument(&price) - .argument(&decimals) - .original_result() - } - - pub fn submit_batch< - Arg0: ProxyArg, ManagedBuffer, u64, BigUint, u8>>>, - >( - self, - submissions: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("submitBatch") - .argument(&submissions) - .original_result() - } - - pub fn latest_round_data( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("latestRoundData") - .original_result() - } - - pub fn latest_price_feed< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - from: Arg0, - to: Arg1, - ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("latestPriceFeed") - .argument(&from) - .argument(&to) - .original_result() - } - - pub fn latest_price_feed_optional< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - from: Arg0, - to: Arg1, - ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("latestPriceFeedOptional") - .argument(&from) - .argument(&to) - .original_result() - } - - pub fn set_submission_count< - Arg0: ProxyArg, - >( - self, - submission_count: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setSubmissionCount") - .argument(&submission_count) - .original_result() - } - - pub fn get_oracles( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getOracles") - .original_result() - } - - pub fn set_pair_decimals< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - >( - self, - from: Arg0, - to: Arg1, - decimals: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setPairDecimals") - .argument(&from) - .argument(&to) - .argument(&decimals) - .original_result() - } - - pub fn get_pair_decimals< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - from: Arg0, - to: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPairDecimals") - .argument(&from) - .argument(&to) - .original_result() - } - - pub fn submission_count( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("submission_count") - .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() - } - - pub fn stake( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("stake") - .original_result() - } - - pub fn unstake< - Arg0: ProxyArg>, - >( - self, - unstake_amount: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("unstake") - .argument(&unstake_amount) - .original_result() - } - - pub fn vote_slash_member< - Arg0: ProxyArg>, - >( - self, - member_to_slash: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("voteSlashMember") - .argument(&member_to_slash) - .original_result() - } - - pub fn cancel_vote_slash_member< - Arg0: ProxyArg>, - >( - self, - member_to_slash: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("cancelVoteSlashMember") - .argument(&member_to_slash) - .original_result() - } - - pub fn slash_member< - Arg0: ProxyArg>, - >( - self, - member_to_slash: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("slashMember") - .argument(&member_to_slash) - .original_result() - } -} - -#[type_abi] -#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] -pub struct PriceFeed -where - Api: ManagedTypeApi, -{ - pub round_id: u32, - pub from: ManagedBuffer, - pub to: ManagedBuffer, - pub timestamp: u64, - pub price: BigUint, - pub decimals: u8, -} - -#[type_abi] -#[derive(TopEncode)] -pub struct NewRoundEvent -where - Api: ManagedTypeApi, -{ - pub price: BigUint, - pub timestamp: u64, - pub decimals: u8, - pub block: u64, - pub epoch: u64, -} - -#[type_abi] -#[derive(TopEncode)] -pub struct DiscardSubmissionEvent { - pub submission_timestamp: u64, - pub first_submission_timestamp: u64, - pub has_caller_already_submitted: bool, -} diff --git a/esdt-safe/interactor/src/proxies/fee_market_proxy.rs b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs index b595c0f6..d65c1106 100644 --- a/esdt-safe/interactor/src/proxies/fee_market_proxy.rs +++ b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs @@ -45,19 +45,16 @@ where { pub fn init< Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, + Arg1: ProxyArg>>, >( self, esdt_safe_address: Arg0, - price_aggregator_address: Arg1, - fee: Arg2, + fee: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&esdt_safe_address) - .argument(&price_aggregator_address) .argument(&fee) .original_result() } @@ -91,6 +88,19 @@ where To: TxTo, Gas: TxGas, { + pub fn set_price_aggregator_address< + Arg0: ProxyArg>, + >( + self, + price_aggregator_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setPriceAggregatorAddress") + .argument(&price_aggregator_address) + .original_result() + } + pub fn set_fee< Arg0: ProxyArg>, >( @@ -104,7 +114,7 @@ where .original_result() } - pub fn disable_fee< + pub fn remove_fee< Arg0: ProxyArg>, >( self, From 93663a19686902f5f3e183f4d99120acf43a164f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 13 Nov 2024 13:20:47 +0200 Subject: [PATCH 4/5] Updated fee-market to create proxy in interactor Signed-off-by: Andrei Baltariu --- fee-market/sc-config.toml | 3 +++ fee-market/src/fee_market_proxy.rs | 2 +- fee-market/src/fee_type.rs | 2 +- fee-market/wasm-fee-marker-full/src/lib.rs | 2 +- fee-market/wasm/src/lib.rs | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fee-market/sc-config.toml b/fee-market/sc-config.toml index 78a84c24..a53b25d4 100644 --- a/fee-market/sc-config.toml +++ b/fee-market/sc-config.toml @@ -17,3 +17,6 @@ add-labels = ["fee-market-external-view"] [[proxy]] path = "src/fee_market_proxy.rs" + +[[proxy]] +path = "../esdt-safe/interactor/src/proxies/fee_market_proxy.rs" diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index 36ed1bc8..d65c1106 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -114,7 +114,7 @@ where .original_result() } - pub fn disable_fee< + pub fn remove_fee< Arg0: ProxyArg>, >( self, diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index 9621d436..50e7d4f9 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -61,7 +61,7 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule #[only_owner] #[endpoint(removeFee)] - fn disable_fee(&self, base_token: TokenIdentifier) { + fn remove_fee(&self, base_token: TokenIdentifier) { self.token_fee(&base_token).clear(); self.fee_enabled().set(false); } diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-marker-full/src/lib.rs index a07b92d6..7e1433a9 100644 --- a/fee-market/wasm-fee-marker-full/src/lib.rs +++ b/fee-market/wasm-fee-marker-full/src/lib.rs @@ -22,7 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setPriceAggregatorAddress => set_price_aggregator_address addFee => set_fee - removeFee => disable_fee + removeFee => remove_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist diff --git a/fee-market/wasm/src/lib.rs b/fee-market/wasm/src/lib.rs index a07b92d6..7e1433a9 100644 --- a/fee-market/wasm/src/lib.rs +++ b/fee-market/wasm/src/lib.rs @@ -22,7 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setPriceAggregatorAddress => set_price_aggregator_address addFee => set_fee - removeFee => disable_fee + removeFee => remove_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist From 5ea20683b86bc52fe3949ba509e7125b191b8426 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 13 Nov 2024 13:22:58 +0200 Subject: [PATCH 5/5] Used correct endpoint name in tests Signed-off-by: Andrei Baltariu --- fee-market/tests/fee_market_blackbox_test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs index f7d43b25..c4baf4d0 100644 --- a/fee-market/tests/fee_market_blackbox_test.rs +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -133,13 +133,13 @@ impl FeeMarketTestState { } } - fn disable_fee(&mut self) { + fn remove_fee(&mut self) { self.world .tx() .from(OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee(TOKEN_ID) + .remove_fee(TOKEN_ID) .run(); } @@ -283,7 +283,7 @@ fn test_substract_fee_no_fee() { let mut state = FeeMarketTestState::new(); state.deploy_fee_market(); - state.disable_fee(); + state.remove_fee(); state.substract_fee("Correct", None);