1-
21//! Implementations for `nonfungibles` traits.
32
43use super :: * ;
5- use frame_support:: {
6- traits:: tokens:: nonfungibles:: { Inspect , Transfer } ,
7- } ;
4+ use frame_support:: traits:: tokens:: nonfungibles:: { Inspect , Transfer } ;
85use sp_runtime:: DispatchResult ;
96
107impl < T : Config > Inspect < <T as frame_system:: Config >:: AccountId > for Pallet < T > {
@@ -15,7 +12,7 @@ impl<T: Config> Inspect<<T as frame_system::Config>::AccountId> for Pallet<T> {
1512 class : & Self :: ClassId ,
1613 instance : & Self :: InstanceId ,
1714 ) -> Option < <T as frame_system:: Config >:: AccountId > {
18- orml_nft:: Pallet :: < T > :: tokens ( class, instance) . map ( |a| a. owner )
15+ orml_nft:: Pallet :: < T > :: tokens ( class, instance) . map ( |a| a. owner )
1916 }
2017
2118 fn class_owner ( class : & Self :: ClassId ) -> Option < <T as frame_system:: Config >:: AccountId > {
@@ -48,20 +45,20 @@ impl<T: Config> Inspect<<T as frame_system::Config>::AccountId> for Pallet<T> {
4845 fn class_attribute ( class : & Self :: ClassId , key : & [ u8 ] ) -> Option < Vec < u8 > > {
4946 if key. is_empty ( ) {
5047 // We make the empty key map to the instance metadata value.
51- orml_nft:: Pallet :: < T > :: classes ( class) . map ( |a| a. metadata . into ( ) )
48+ orml_nft:: Pallet :: < T > :: classes ( class) . map ( |a| a. metadata . into ( ) )
5249 } else {
53- return None
50+ return None
5451 }
5552 }
5653
5754 /// Returns `true` if the asset `instance` of `class` may be transferred.
5855 ///
5956 /// Default implementation is that all assets are transferable.
6057 fn can_transfer ( class : & Self :: ClassId , instance : & Self :: InstanceId ) -> bool {
61- match orml_nft:: Pallet :: < T > :: classes ( class) {
62- Some ( class) => class. data . properties . 0 . contains ( ClassProperty :: Transferable ) ,
63- _ => false ,
64- }
58+ match orml_nft:: Pallet :: < T > :: classes ( class) {
59+ Some ( class) => class. data . properties . 0 . contains ( ClassProperty :: Transferable ) ,
60+ _ => false ,
61+ }
6562 }
6663}
6764
@@ -71,8 +68,10 @@ impl<T: Config> Transfer<T::AccountId> for Pallet<T> {
7168 instance : & Self :: InstanceId ,
7269 destination : & T :: AccountId ,
7370 ) -> DispatchResult {
74- let from = orml_nft:: Pallet :: < T > :: tokens ( class, instance) . map ( |a| a. owner ) . ok_or ( Error :: < T > :: TokenIdNotFound ) ?;
71+ let from = orml_nft:: Pallet :: < T > :: tokens ( class, instance)
72+ . map ( |a| a. owner )
73+ . ok_or ( Error :: < T > :: TokenIdNotFound ) ?;
7574 Self :: do_transfer ( & from, & destination, ( * class, * instance) ) ?;
76- Ok ( ( ) )
75+ Ok ( ( ) )
7776 }
7877}
0 commit comments