Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging setup #270

Open
wants to merge 1 commit into
base: distribute-payments-async-call
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions common/sc-proxies/src/multi_transfer_esdt_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ where
.original_result()
}

pub fn my_storage(
self,
) -> TxTypedCall<Env, From, To, NotPayable, Gas, EsdtTokenPayment<Env::Api>> {
self.wrapped_tx
.payment(NotPayable)
.raw_call("myStorage")
.original_result()
}

pub fn move_refund_batch_to_safe(
self,
) -> TxTypedCall<Env, From, To, NotPayable, Gas, ()> {
Expand Down
29 changes: 27 additions & 2 deletions multi-transfer-esdt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,38 @@ pub trait MultiTransferEsdt:
}

valid_tx_list.push(eth_tx.clone());
valid_payments_list.push(EsdtTokenPayment::new(eth_tx.token_id, 0, eth_tx.amount));
valid_payments_list.push(EsdtTokenPayment::new(
eth_tx.token_id.clone(),
0,
eth_tx.amount.clone(),
));
self.my_storage().set(EsdtTokenPayment::new(
eth_tx.token_id.clone(),
0,
eth_tx.amount,
));

sc_print!("payment {}\n", eth_tx.token_id);
let a = valid_payments_list.get(0).clone();
sc_print!("payment {}\n", a.token_identifier);
sc_print!("payment {}\n", a.clone().token_identifier);
let b = self.my_storage().get();
sc_print!("payment {}\n", b.token_identifier);
}

for p in valid_payments_list.clone() {
sc_print!("payment {}\n", p.token_identifier);
}
let payments_after_wrapping = self.wrap_tokens(valid_payments_list);
self.distribute_payments(valid_tx_list, payments_after_wrapping, batch_id);

self.add_multiple_tx_to_batch(&refund_tx_list);
}

#[view(myStorage)]
#[storage_mapper("unprocessedRefundTxs")]
fn my_storage(&self) -> SingleValueMapper<EsdtTokenPayment<Self::Api>>;

#[only_owner]
#[endpoint(moveRefundBatchToSafe)]
fn move_refund_batch_to_safe(&self) {
Expand Down Expand Up @@ -293,9 +316,11 @@ pub trait MultiTransferEsdt:
.single_esdt(&p.token_identifier, 0, &p.amount)
.sync_call();
} else {
let payment = p.clone();
self.tx()
.to(&eth_tx.to)
.single_esdt(&p.token_identifier, 0, &p.amount)
.raw_call("")
.single_esdt(&payment.token_identifier, 0, &payment.amount)
.callback(self.callbacks().transfer_callback(eth_tx.clone(), batch_id))
.gas(self.blockchain().get_gas_left())
// .gas_for_callback(CALLBACK_ESDT_TRANSFER_GAS_LIMIT)
Expand Down
5 changes: 3 additions & 2 deletions multi-transfer-esdt/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

// Init: 1
// Upgrade: 1
// Endpoints: 13
// Endpoints: 14
// Async Callback (empty): 1
// Promise callbacks: 1
// Total number of exported functions: 17
// Total number of exported functions: 18

#![no_std]

Expand All @@ -22,6 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! {
init => init
upgrade => upgrade
batchTransferEsdtToken => batch_transfer_esdt_token
myStorage => my_storage
moveRefundBatchToSafe => move_refund_batch_to_safe
addUnprocessedRefundTxToBatch => add_unprocessed_refund_tx_to_batch
setMaxTxBatchSize => set_max_tx_batch_size
Expand Down
Loading