@@ -7,7 +7,10 @@ use frame_support::{
77 sp_runtime:: traits:: AtLeast32BitUnsigned ,
88 sp_std:: fmt:: Debug ,
99 traits:: {
10- tokens:: { fungibles, nonfungibles} ,
10+ tokens:: {
11+ fungibles:: { self , Mutate } ,
12+ nonfungibles,
13+ } ,
1114 Currency ,
1215 ExistenceRequirement :: { AllowDeath , KeepAlive } ,
1316 OneSessionHandler , StorageVersion ,
@@ -619,6 +622,12 @@ pub mod pallet {
619622 class : T :: ClassId ,
620623 instance : T :: InstanceId ,
621624 } ,
625+ /// Some asset was force-minted.
626+ ForceAssetMinted {
627+ asset_id : T :: AssetId ,
628+ who : T :: AccountId ,
629+ amount : T :: AssetBalance ,
630+ } ,
622631 }
623632
624633 // Errors inform users that something went wrong.
@@ -1097,6 +1106,22 @@ pub mod pallet {
10971106 ) ;
10981107 Ok ( ( ) )
10991108 }
1109+
1110+ #[ pallet:: weight( 0 ) ]
1111+ pub fn force_mint_asset (
1112+ origin : OriginFor < T > ,
1113+ asset_id : T :: AssetId ,
1114+ who : <T :: Lookup as StaticLookup >:: Source ,
1115+ amount : T :: AssetBalance ,
1116+ ) -> DispatchResult {
1117+ ensure_root ( origin) ?;
1118+ let who = T :: Lookup :: lookup ( who) ?;
1119+ T :: Assets :: mint_into ( asset_id, & who, amount) ?;
1120+
1121+ Self :: deposit_event ( Event :: ForceAssetMinted { asset_id, who, amount } ) ;
1122+
1123+ Ok ( ( ) )
1124+ }
11001125 }
11011126
11021127 impl < T : Config > TokenIdAndAssetIdProvider < T :: AssetId > for Pallet < T > {
0 commit comments