Skip to content

Commit

Permalink
Merge pull request #686 from ElrondNetwork/wrapping-for-scs
Browse files Browse the repository at this point in the history
wrapping for SCs
  • Loading branch information
sasurobert authored Dec 20, 2022
2 parents 202d539 + b1e486f commit 724891f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions locked-asset/locked-token-wrapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ pub trait LockedTokenWrapper:
fn wrap_locked_token_endpoint(&self) -> EsdtTokenPayment {
let payment = self.call_value().single_esdt();
let caller = self.blockchain().get_caller();
self.deduct_energy_from_sender(
caller.clone(),
&ManagedVec::from_single_item(payment.clone()),
);
if !self.blockchain().is_smart_contract(&caller) {
self.deduct_energy_from_sender(
caller.clone(),
&ManagedVec::from_single_item(payment.clone()),
);
}

self.wrap_locked_token_and_send(&caller, payment)
}
Expand All @@ -43,11 +45,12 @@ pub trait LockedTokenWrapper:
let payment = self.call_value().single_esdt();
let caller = self.blockchain().get_caller();
let original_locked_tokens = self.unwrap_locked_token(payment);

self.add_energy_to_destination(
caller.clone(),
&ManagedVec::from_single_item(original_locked_tokens.clone()),
);
if !self.blockchain().is_smart_contract(&caller) {
self.add_energy_to_destination(
caller.clone(),
&ManagedVec::from_single_item(original_locked_tokens.clone()),
);
}

self.send().direct_esdt(
&caller,
Expand Down

0 comments on commit 724891f

Please sign in to comment.