mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 20:47:56 +00:00
[NTFs] Emit CollectionMaxSupplySet on collection create (#2626)
Closes #2293 if the max_supply is set during the collection creation, we emit the `CollectionMaxSupplySet` event
This commit is contained in:
@@ -2191,6 +2191,10 @@ fn max_supply_should_work() {
|
||||
default_collection_config()
|
||||
));
|
||||
assert_eq!(CollectionConfigOf::<Test>::get(collection_id).unwrap().max_supply, None);
|
||||
assert!(!events().contains(&Event::<Test>::CollectionMaxSupplySet {
|
||||
collection: collection_id,
|
||||
max_supply,
|
||||
}));
|
||||
|
||||
assert_ok!(Nfts::set_collection_max_supply(
|
||||
RuntimeOrigin::signed(user_id.clone()),
|
||||
@@ -2242,9 +2246,31 @@ fn max_supply_should_work() {
|
||||
None
|
||||
));
|
||||
assert_noop!(
|
||||
Nfts::mint(RuntimeOrigin::signed(user_id.clone()), collection_id, 2, user_id, None),
|
||||
Nfts::mint(
|
||||
RuntimeOrigin::signed(user_id.clone()),
|
||||
collection_id,
|
||||
2,
|
||||
user_id.clone(),
|
||||
None
|
||||
),
|
||||
Error::<Test>::MaxSupplyReached
|
||||
);
|
||||
|
||||
// validate the event gets emitted when we set the max supply on collection create
|
||||
let collection_id = 1;
|
||||
assert_ok!(Nfts::force_create(
|
||||
RuntimeOrigin::root(),
|
||||
user_id.clone(),
|
||||
CollectionConfig { max_supply: Some(max_supply), ..default_collection_config() }
|
||||
));
|
||||
assert_eq!(
|
||||
CollectionConfigOf::<Test>::get(collection_id).unwrap().max_supply,
|
||||
Some(max_supply)
|
||||
);
|
||||
assert!(events().contains(&Event::<Test>::CollectionMaxSupplySet {
|
||||
collection: collection_id,
|
||||
max_supply,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user