Skip to content

Commit

Permalink
setter
Browse files Browse the repository at this point in the history
  • Loading branch information
dorin-iancu committed Nov 12, 2024
1 parent 742664f commit 9a4f4a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 8 additions & 0 deletions locked-asset/token-unstake/src/fees_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ pub trait FeesHandlerModule:
+ utils::UtilsModule
+ events::EventsModule
{
#[only_owner]
#[endpoint(setFeesBurnPercent)]
fn set_fees_burn_percent(&self, percent: Percent) {
require!(percent <= MAX_PENALTY_PERCENTAGE, "Invalid percent");

self.fees_burn_percentage().set(percent);
}

#[payable("*")]
#[endpoint(depositUserTokens)]
fn deposit_user_tokens(&self, user: ManagedAddress) {
Expand Down
9 changes: 2 additions & 7 deletions locked-asset/token-unstake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ pub mod unbond_tokens;

use common_structs::{Epoch, Percent};

use crate::fees_handler::MAX_PENALTY_PERCENTAGE;

#[multiversx_sc::contract]
pub trait TokenUnstakeModule:
tokens_per_user::TokensPerUserModule
Expand All @@ -33,15 +31,12 @@ pub trait TokenUnstakeModule:
) {
self.require_sc_address(&energy_factory_address);
self.require_sc_address(&fees_collector_address);
require!(
fees_burn_percentage <= MAX_PENALTY_PERCENTAGE,
"Invalid percentage"
);

self.set_fees_burn_percent(fees_burn_percentage);

self.unbond_epochs().set(unbond_epochs);
self.energy_factory_address().set(energy_factory_address);
self.fees_collector_address().set(fees_collector_address);
self.fees_burn_percentage().set(fees_burn_percentage);
}

#[upgrade]
Expand Down
5 changes: 3 additions & 2 deletions locked-asset/token-unstake/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

// Init: 1
// Upgrade: 1
// Endpoints: 10
// Endpoints: 11
// Async Callback (empty): 1
// Total number of exported functions: 13
// Total number of exported functions: 14

#![no_std]

Expand All @@ -24,6 +24,7 @@ multiversx_sc_wasm_adapter::endpoints! {
getUnlockedTokensForUser => unlocked_tokens_for_user
claimUnlockedTokens => claim_unlocked_tokens
cancelUnbond => cancel_unbond
setFeesBurnPercent => set_fees_burn_percent
depositUserTokens => deposit_user_tokens
depositFees => deposit_fees
getFeesBurnPercentage => fees_burn_percentage
Expand Down

0 comments on commit 9a4f4a8

Please sign in to comment.