99use frame_support:: {
1010 dispatch:: { DispatchResult , DispatchResultWithPostInfo } ,
1111 ensure,
12- traits:: tokens:: { nonfungibles:: * , Locker } ,
12+ traits:: {
13+ tokens:: { nonfungibles:: * , Locker } ,
14+ EnsureOrigin , IsType ,
15+ } ,
1316 transactional, BoundedVec ,
1417} ;
15- use frame_system:: ensure_signed;
18+ use frame_system:: { ensure_signed, RawOrigin } ;
1619
1720use sp_runtime:: { traits:: StaticLookup , DispatchError , Permill } ;
1821use sp_std:: convert:: TryInto ;
@@ -122,7 +125,7 @@ pub mod pallet {
122125 pub trait Config : frame_system:: Config + pallet_uniques:: Config {
123126 /// Because this pallet emits events, it depends on the runtime's definition of an event.
124127 type RuntimeEvent : From < Event < Self > > + IsType < <Self as frame_system:: Config >:: RuntimeEvent > ;
125- type ProtocolOrigin : EnsureOrigin < Self :: RuntimeOrigin > ;
128+ type ProtocolOrigin : EnsureOrigin < Self :: RuntimeOrigin , Success = Self :: AccountId > ;
126129
127130 /// The maximum resource symbol length
128131 #[ pallet:: constant]
@@ -443,7 +446,7 @@ pub mod pallet {
443446 transferable : bool ,
444447 resources : Option < BoundedResourceInfoTypeOf < T > > ,
445448 ) -> DispatchResult {
446- let sender = ensure_signed ( origin) ?;
449+ let sender = T :: ProtocolOrigin :: ensure_origin ( origin) ?;
447450 if let Some ( collection_issuer) =
448451 pallet_uniques:: Pallet :: < T > :: collection_owner ( collection_id)
449452 {
@@ -483,7 +486,7 @@ pub mod pallet {
483486 /// - `recipient`: Receiver of the royalty
484487 /// - `royalty`: Permillage reward from each trade for the Recipient
485488 /// - `metadata`: Arbitrary data about an nft, e.g. IPFS hash
486- #[ pallet:: call_index( 1 ) ]
489+ #[ pallet:: call_index( 1 ) ]
487490 #[ pallet:: weight( <T as pallet:: Config >:: WeightInfo :: mint_nft_directly_to_nft( T :: NestingBudget :: get( ) ) ) ]
488491 #[ transactional]
489492 pub fn mint_nft_directly_to_nft (
@@ -497,7 +500,7 @@ pub mod pallet {
497500 transferable : bool ,
498501 resources : Option < BoundedResourceInfoTypeOf < T > > ,
499502 ) -> DispatchResult {
500- let sender = ensure_signed ( origin. clone ( ) ) ?;
503+ let sender = T :: ProtocolOrigin :: ensure_origin ( origin. clone ( ) ) ?;
501504
502505 // Collection must exist and sender must be issuer of collection
503506 if let Some ( collection_issuer) =
@@ -535,7 +538,7 @@ pub mod pallet {
535538 max : Option < u32 > ,
536539 symbol : BoundedCollectionSymbolOf < T > ,
537540 ) -> DispatchResult {
538- let sender = ensure_signed ( origin) ?;
541+ let sender = T :: ProtocolOrigin :: ensure_origin ( origin) ?;
539542
540543 Self :: collection_create ( sender, collection_id, metadata, max, symbol) ?;
541544
0 commit comments