difftreelog
Cleanup borrowin in check_white_list
in: master
1 file changed
pallets/nft/src/lib.rsdiffbeforeafterboth502 let target_collection = <Collection<T>>::get(collection_id);502 let target_collection = <Collection<T>>::get(collection_id);503503504 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {504 if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {505 ensure!(target_collection.mint_mode == true, "Collection is not in mint mode");505 ensure!(target_collection.mint_mode == true, "Public minting is not allowed for this collection");506 Self::check_white_list(collection_id, owner.clone())?;506 Self::check_white_list(collection_id, &owner)?;507 Self::check_white_list(collection_id, &sender)?;507 }508 }508509509 match target_collection.mode510 match target_collection.mode576 "Only item owner, collection owner and admins can modify item");577 "Only item owner, collection owner and admins can modify item");577578578 if target_collection.access == AccessMode::WhiteList {579 if target_collection.access == AccessMode::WhiteList {579 Self::check_white_list(collection_id, sender.clone())?;580 Self::check_white_list(collection_id, &sender)?;580 }581 }581582582 match target_collection.mode583 match target_collection.mode605 "Only item owner, collection owner and admins can modify item");606 "Only item owner, collection owner and admins can modify item");606607607 if target_collection.access == AccessMode::WhiteList {608 if target_collection.access == AccessMode::WhiteList {608 Self::check_white_list(collection_id, sender.clone())?;609 Self::check_white_list(collection_id, &sender)?;609 Self::check_white_list(collection_id, recipient.clone())?;610 Self::check_white_list(collection_id, &recipient)?;610 }611 }611612612 match target_collection.mode613 match target_collection.mode632 "Only item owner, collection owner and admins can approve");633 "Only item owner, collection owner and admins can approve");633634634 if target_collection.access == AccessMode::WhiteList {635 if target_collection.access == AccessMode::WhiteList {635 Self::check_white_list(collection_id, sender.clone())?;636 Self::check_white_list(collection_id, &sender)?;636 Self::check_white_list(collection_id, approved.clone())?;637 Self::check_white_list(collection_id, &approved)?;637 }638 }638639639 // amount param stub640 // amount param stub679 "Only item owner, collection owner and admins can modify items");680 "Only item owner, collection owner and admins can modify items");680681681 if target_collection.access == AccessMode::WhiteList {682 if target_collection.access == AccessMode::WhiteList {682 Self::check_white_list(collection_id, sender.clone())?;683 Self::check_white_list(collection_id, &sender)?;683 Self::check_white_list(collection_id, recipient.clone())?;684 Self::check_white_list(collection_id, &recipient)?;684 }685 }685686686 // remove approve687 // remove approve935 }936 }936 }937 }937938938 fn check_white_list(collection_id: u64, address: T::AccountId) -> DispatchResult {939 fn check_white_list(collection_id: u64, address: &T::AccountId) -> DispatchResult {939940940 let mes = "Address is not in white list";941 let mes = "Address is not in white list";941 ensure!(<WhiteList<T>>::contains_key(collection_id), mes);942 ensure!(<WhiteList<T>>::contains_key(collection_id), mes);942 let wl = <WhiteList<T>>::get(collection_id);943 let wl = <WhiteList<T>>::get(collection_id);943 ensure!(wl.contains(&address.clone()), mes);944 ensure!(wl.contains(address), mes);944945945 Ok(())946 Ok(())946 }947 }