Skip to content

Commit

Permalink
Disallow burning externally locked nfts (paritytech#13054)
Browse files Browse the repository at this point in the history
* Disallow burning externally locked nfts

* Update docs
  • Loading branch information
jsidorenko authored and ltfschoen committed Feb 22, 2023
1 parent 1a3a17c commit c53479b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions frame/nfts/src/features/create_delete_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
item: T::ItemId,
with_details: impl FnOnce(&ItemDetailsFor<T, I>) -> DispatchResult,
) -> DispatchResult {
ensure!(!T::Locker::is_locked(collection, item), Error::<T, I>::ItemLocked);
let owner = Collection::<T, I>::try_mutate(
&collection,
|maybe_collection_details| -> Result<T::AccountId, DispatchError> {
Expand Down
4 changes: 3 additions & 1 deletion frame/nfts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,9 @@ pub mod pallet {

/// Destroy a single item.
///
/// Origin must be Signed and the sender should be the Admin of the `collection`.
/// Origin must be Signed and the signing account must be either:
/// - the Admin of the `collection`;
/// - the Owner of the `item`;
///
/// - `collection`: The collection of the item to be burned.
/// - `item`: The item to be burned.
Expand Down
1 change: 1 addition & 0 deletions frame/uniques/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
item: T::ItemId,
with_details: impl FnOnce(&CollectionDetailsFor<T, I>, &ItemDetailsFor<T, I>) -> DispatchResult,
) -> DispatchResult {
ensure!(!T::Locker::is_locked(collection, item), Error::<T, I>::Locked);
let owner = Collection::<T, I>::try_mutate(
&collection,
|maybe_collection_details| -> Result<T::AccountId, DispatchError> {
Expand Down
4 changes: 3 additions & 1 deletion frame/uniques/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ pub mod pallet {

/// Destroy a single item.
///
/// Origin must be Signed and the sender should be the Admin of the `collection`.
/// Origin must be Signed and the signing account must be either:
/// - the Admin of the `collection`;
/// - the Owner of the `item`;
///
/// - `collection`: The collection of the item to be burned.
/// - `item`: The item of the item to be burned.
Expand Down

0 comments on commit c53479b

Please sign in to comment.