Skip to content

Commit

Permalink
staking/ only Mint and Burn roles are used
Browse files Browse the repository at this point in the history
Signed-off-by: Claudiu Ion Lataretu <claudiu.lataretu@gmail.com>
  • Loading branch information
claudiulataretu committed Apr 20, 2021
1 parent 5057d73 commit 0e8d27a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions elrond_dex_staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,44 +400,43 @@ pub trait Staking {
#[endpoint(setLocalRolesStakeToken)]
fn set_local_roles_stake_token(
&self,
#[var_args] roles: VarArgs<EsdtLocalRole>,
) -> SCResult<AsyncCall<BigUint>> {
require!(self.is_active(), "Not active");
sc_try!(self.require_permissions());
require!(!self.stake_token_id().is_empty(), "No stake token issued");
require!(!roles.is_empty(), "Empty args");

let token = self.stake_token_id().get();
Ok(self.set_local_roles(token, roles))
Ok(self.set_local_roles(token))
}

#[endpoint(setLocalRolesUnstakeToken)]
fn set_local_roles_unstake_token(
&self,
#[var_args] roles: VarArgs<EsdtLocalRole>,
) -> SCResult<AsyncCall<BigUint>> {
require!(self.is_active(), "Not active");
sc_try!(self.require_permissions());
require!(
!self.unstake_token_id().is_empty(),
"No unstake token issued"
);
require!(!roles.is_empty(), "Empty args");

let token = self.unstake_token_id().get();
Ok(self.set_local_roles(token, roles))
Ok(self.set_local_roles(token))
}

fn set_local_roles(
&self,
token: TokenIdentifier,
#[var_args] roles: VarArgs<EsdtLocalRole>,
) -> AsyncCall<BigUint> {
ESDTSystemSmartContractProxy::new()
.set_special_roles(
&self.blockchain().get_sc_address(),
token.as_esdt_identifier(),
roles.as_slice(),
&[
EsdtLocalRole::NftCreate,
EsdtLocalRole::NftBurn,
EsdtLocalRole::NftAddQuantity
],
)
.async_call()
.with_callback(self.callbacks().change_roles_callback())
Expand Down

0 comments on commit 0e8d27a

Please sign in to comment.