git.delta.rocks / unique-network / refs/commits / f2bcdd27f925

difftreelog

Merge pull request #69 from usetech-llc/feature/NFTPAR-289

str-mv2021-01-20parents: #8a8e3dd #1801951.patch.diff
in: master
Return error when non-existing admin is removed

1 file changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
323 CollectionNotFound,323 CollectionNotFound,
324 /// Item not exists.324 /// Item not exists.
325 TokenNotFound,325 TokenNotFound,
326 /// Admin not found
327 AdminNotFound,
326 /// Arithmetic calculation overflow.328 /// Arithmetic calculation overflow.
327 NumOverflow, 329 NumOverflow,
328 /// Account already has admin role.330 /// Account already has admin role.
813 let sender = ensure_signed(origin)?;815 let sender = ensure_signed(origin)?;
814 Self::check_owner_or_admin_permissions(collection_id, sender)?;816 Self::check_owner_or_admin_permissions(collection_id, sender)?;
815
816 if <AdminList<T>>::contains_key(collection_id)817 ensure!(<AdminList<T>>::contains_key(collection_id), Error::<T>::AdminNotFound);
817 {818
818 let mut admin_arr = <AdminList<T>>::get(collection_id);819 let mut admin_arr = <AdminList<T>>::get(collection_id);
819 admin_arr.retain(|i| *i != account_id);820 admin_arr.retain(|i| *i != account_id);
820 <AdminList<T>>::insert(collection_id, admin_arr);821 <AdminList<T>>::insert(collection_id, admin_arr);
821 }
822822
823 Ok(())823 Ok(())
824 }824 }