Skip to content

Commit

Permalink
Merge pull request #215 from rmrk-team/bug/208-locked-collection-allo…
Browse files Browse the repository at this point in the history
…w-minting-after-burn

fix issue 208 allow minting after burn
  • Loading branch information
ilionic authored Oct 17, 2022
2 parents 6485ffd + b7e011b commit bb505e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pallets/rmrk-core/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ where
) -> Result<CollectionId, DispatchError> {
Collections::<T>::try_mutate_exists(collection_id, |collection| -> DispatchResult {
let collection = collection.as_mut().ok_or(Error::<T>::CollectionUnknown)?;
collection.max = Some(collection.nfts_count);
collection.max = Some(0);
Ok(())
})?;

Expand Down
4 changes: 2 additions & 2 deletions pallets/rmrk-core/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ fn lock_collection_works() {
assert_ok!(RMRKCore::burn_nft(Origin::signed(ALICE), COLLECTION_ID_0, NFT_ID_0, MAX_BURNS));
// Should now have only three NFTS in collection
assert_eq!(RMRKCore::collections(COLLECTION_ID_0).unwrap().nfts_count, 3);
// Still we should be unable to mint another NFT
assert_ok!(basic_mint(5));
// After burning, we should still be unable to mint another NFT
assert_noop!(basic_mint(5), Error::<Test>::CollectionFullOrLocked);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/util/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ export async function lockCollection(

await getCollection(api, collectionId).then((collectionOption) => {
const collection = collectionOption.unwrap();
expect(collection.max.unwrap().toNumber()).to.be.equal(max);
expect(collection.max.unwrap().toNumber()).to.be.equal(0);
});
}

Expand Down

0 comments on commit bb505e6

Please sign in to comment.