diff --git a/locked-asset/token-unstake/src/fees_handler.rs b/locked-asset/token-unstake/src/fees_handler.rs index 6d28c3c1d..1de93362f 100644 --- a/locked-asset/token-unstake/src/fees_handler.rs +++ b/locked-asset/token-unstake/src/fees_handler.rs @@ -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) { diff --git a/locked-asset/token-unstake/src/lib.rs b/locked-asset/token-unstake/src/lib.rs index 5368699bf..f51713dbb 100644 --- a/locked-asset/token-unstake/src/lib.rs +++ b/locked-asset/token-unstake/src/lib.rs @@ -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 @@ -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] diff --git a/locked-asset/token-unstake/wasm/src/lib.rs b/locked-asset/token-unstake/wasm/src/lib.rs index ea93ce423..4745ad92f 100644 --- a/locked-asset/token-unstake/wasm/src/lib.rs +++ b/locked-asset/token-unstake/wasm/src/lib.rs @@ -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] @@ -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