Skip to content

Commit

Permalink
Removed transfer_data setup from payments_setup function
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Baltariu <[email protected]>
  • Loading branch information
andreiblt1304 committed Oct 18, 2024
1 parent f11d6b4 commit e2f7628
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions esdt-safe/interactor/src/interactor_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,16 @@ impl ContractInteract {

async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation<StaticApi> {

Check warning on line 931 in esdt-safe/interactor/src/interactor_main.rs

View workflow job for this annotation

GitHub Actions / Contracts / Rust tests

unused variable: `has_transfer_data`

Check warning on line 931 in esdt-safe/interactor/src/interactor_main.rs

View workflow job for this annotation

GitHub Actions / Contracts / Test Coverage

unused variable: `has_transfer_data`

Check warning on line 931 in esdt-safe/interactor/src/interactor_main.rs

View workflow job for this annotation

GitHub Actions / Contracts / Wasm tests

unused variable: `has_transfer_data`

Check warning on line 931 in esdt-safe/interactor/src/interactor_main.rs

View workflow job for this annotation

GitHub Actions / clippy

[clippy] esdt-safe/interactor/src/interactor_main.rs#L931

warning: unused variable: `has_transfer_data` --> esdt-safe/interactor/src/interactor_main.rs:931:41 | 931 | async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation<StaticApi> { | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_has_transfer_data` | = note: `#[warn(unused_variables)]` on by default
Raw output
esdt-safe/interactor/src/interactor_main.rs:931:41:w:warning: unused variable: `has_transfer_data`
   --> esdt-safe/interactor/src/interactor_main.rs:931:41
    |
931 |     async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation<StaticApi> {
    |                                         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_has_transfer_data`
    |
    = note: `#[warn(unused_variables)]` on by default


__END__

Check warning on line 931 in esdt-safe/interactor/src/interactor_main.rs

View workflow job for this annotation

GitHub Actions / clippy

[clippy] esdt-safe/interactor/src/interactor_main.rs#L931

warning: unused variable: `has_transfer_data` --> esdt-safe/interactor/src/interactor_main.rs:931:41 | 931 | async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation<StaticApi> { | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_has_transfer_data` | = note: `#[warn(unused_variables)]` on by default
Raw output
esdt-safe/interactor/src/interactor_main.rs:931:41:w:warning: unused variable: `has_transfer_data`
   --> esdt-safe/interactor/src/interactor_main.rs:931:41
    |
931 |     async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation<StaticApi> {
    |                                         ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_has_transfer_data`
    |
    = note: `#[warn(unused_variables)]` on by default


__END__
let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address());
let payments_tuple = self.setup_payments().await;
let (tokens, data) = payments_tuple;
let payments = self.setup_payments().await;

Operation::new(to, tokens, data)
let op_sender = managed_address!(&self.wallet_address);
let transfer_data: OperationData<StaticApi> = OperationData {
op_nonce: 1,
op_sender,
opt_transfer_data: Option::None,
};

Operation::new(to, payments, transfer_data)
}

async fn register_operations(&mut self, operation: &Operation<StaticApi>) {
Expand Down Expand Up @@ -970,12 +976,7 @@ impl ContractInteract {
println!("Result: {response:?}");
}

async fn setup_payments(
&mut self,
) -> (
ManagedVec<StaticApi, OperationEsdtPayment<StaticApi>>,
OperationData<StaticApi>,
) {
async fn setup_payments(&mut self) -> ManagedVec<StaticApi, OperationEsdtPayment<StaticApi>> {
let mut tokens: ManagedVec<StaticApi, OperationEsdtPayment<StaticApi>> = ManagedVec::new();
let token_ids = vec![TOKEN_ID];

Expand All @@ -989,14 +990,7 @@ impl ContractInteract {
tokens.push(payment);
}

let op_sender = managed_address!(&self.wallet_address);
let data: OperationData<StaticApi> = OperationData {
op_nonce: 1,
op_sender,
opt_transfer_data: Option::None,
};

(tokens, data)
tokens
}

fn get_operation_hash(&mut self, operation: &Operation<StaticApi>) -> [u8; SHA256_RESULT_LEN] {
Expand Down Expand Up @@ -1032,7 +1026,7 @@ async fn test_execute_operation_no_transfer_data() {
interact.unpause_endpoint().await;
interact.header_verifier_set_esdt_address().await;

let operation = interact.setup_operation().await;
let operation = interact.setup_operation(false).await;
interact.register_operations(&operation).await;
interact.execute_operations(&operation).await;
}

0 comments on commit e2f7628

Please sign in to comment.