Skip to content

Commit

Permalink
is_guardian message
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofziobro committed Nov 14, 2023
1 parent ede52ca commit 106254c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions azero/contracts/membrane/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ pub mod membrane {
Ok(())
}

/// Checks if the caller is a guardian
#[ink(message)]
pub fn is_guardian(&self, account: AccountId) -> Result<(), MembraneError> {
if self.guardians.contains(account) {
Ok(())
} else {
Err(MembraneError::NotGuardian(account))
}
}

fn ensure_owner(&mut self) -> Result<(), MembraneError> {
let caller = self.env().caller();
match caller.eq(&self.owner) {
Expand Down Expand Up @@ -339,14 +349,6 @@ pub mod membrane {
let mut psp22: ink::contract_ref!(Mintable) = token.into();
psp22.mint(to, amount)
}

fn is_guardian(&self, account: AccountId) -> Result<(), MembraneError> {
if self.guardians.contains(account) {
Ok(())
} else {
Err(MembraneError::NotGuardian(account))
}
}
}

#[cfg(test)]
Expand Down

0 comments on commit 106254c

Please sign in to comment.