Skip to content

Commit

Permalink
Liquid-locking: Add unbond event and upgrade func
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas committed Dec 22, 2023
1 parent 7e6df3d commit 600e60e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/liquid-locking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ pub trait LiquidLocking {
self.unbond_period().set_if_empty(unbond_period);
}

#[upgrade]
fn upgrade(&self, unbond_period: u64) {
self.unbond_period().set_if_empty(unbond_period);
}

#[only_owner]
#[endpoint]
fn set_unbond_period(&self, unbond_period: u64) {
Expand Down Expand Up @@ -126,6 +131,7 @@ pub trait LiquidLocking {
}

require!(!unbond_tokens.is_empty(), "nothing to unbond");
self.unbond_event(&caller, &unbond_tokens);
self.send().direct_multi(&caller, &unbond_tokens);
}

Expand All @@ -135,6 +141,9 @@ pub trait LiquidLocking {
#[event("unlock")]
fn unlock_event(&self, #[indexed] user: &ManagedAddress, tokens: &ManagedVec<EsdtTokenPayment>);

#[event("unbond")]
fn unbond_event(&self, #[indexed] user: &ManagedAddress, tokens: &ManagedVec<EsdtTokenPayment>);

#[view(lockedTokenAmounts)]
fn locked_token_amounts_by_address(
&self,
Expand Down

0 comments on commit 600e60e

Please sign in to comment.