Skip to content

Commit

Permalink
Update clear_identity to allow for identified argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayden Brewer committed Oct 31, 2023
1 parent e66888d commit 4de469a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pallets/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,17 @@ pub mod pallet {

#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::clear_identity())]
pub fn clear_identity(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
pub fn clear_identity(origin: OriginFor<T>, identified: T::AccountId) -> DispatchResultWithPostInfo {
let who = ensure_signed(origin)?;
ensure!(T::CanRegister::can_register(&who, &identified), Error::<T>::CannotRegister);

let id = <IdentityOf<T>>::take(&who).ok_or(Error::<T>::NotRegistered)?;
let id = <IdentityOf<T>>::take(&identified).ok_or(Error::<T>::NotRegistered)?;
let deposit = id.total_deposit();

let err_amount = T::Currency::unreserve(&who, deposit);
debug_assert!(err_amount.is_zero());

Self::deposit_event(Event::IdentityDissolved { who });
Self::deposit_event(Event::IdentityDissolved { who: identified });

Ok(().into())
}
Expand Down

0 comments on commit 4de469a

Please sign in to comment.