pub fn mint(
			owner: &T::AccountId,
			dna: Option<[u8; 16]>,
			gender: Option<Gender>,
		) -> Result<T::Hash, Error<T>> {
			let kitty = Kitty::<T> {
				dna: dna.unwrap_or_else(Self::gen_dna),
				price: None,
				gender: gender.unwrap_or_else(Self::gen_gender),
				owner: owner.clone(),
				date_created: pallet_timestamp::Pallet::<T>::now(),
			};

			let kitty_id = T::Hashing::hash_of(&kitty);

			// Performs this operation first as it may fail
			let new_cnt = Self::kitty_cnt().checked_add(1).ok_or(<Error<T>>::KittyCntOverflow)?;

			// Check if the kitty does not already exist in our storage map
			ensure!(Self::kitties(&kitty_id) == None, <Error<T>>::KittyExists);

			// Performs this operation first because as it may fail
			<KittiesOwned<T>>::try_mutate(&owner, |kitty_vec| kitty_vec.try_push(kitty_id))
				.map_err(|_| <Error<T>>::ExceedMaxKittyOwned)?;

			<Kitties<T>>::insert(kitty_id, kitty);
			<KittyCnt<T>>::put(new_cnt);
			Ok(kitty_id)
		}
// Helper to mint a Kitty.
Helper to mint a Kitty.
Helper to mint a Kitty .
pub fn mint(
			owner: &T::AccountId,
			dna: Option<[u8; 16]>,
			gender: Option<Gender>,
		) -> Result<T::Hash, Error<T>> {
			let kitty = Kitty::<T> {
				dna: dna.unwrap_or_else(Self::gen_dna),
				price: None,
				gender: gender.unwrap_or_else(Self::gen_gender),
				owner: owner.clone(),
				date_created: pallet_timestamp::Pallet::<T>::now(),
			};
			let kitty_id = T::Hashing::hash_of(&kitty);
			// Performs this operation first as it may fail
			let new_cnt = Self::kitty_cnt().checked_add(1).ok_or(<Error<T>>::KittyCntOverflow)?;
			// Check if the kitty does not already exist in our storage map
			ensure!(Self::kitties(&kitty_id) == None, <Error<T>>::KittyExists);
			// Performs this operation first because as it may fail
			<KittiesOwned<T>>::try_mutate(&owner, |kitty_vec| kitty_vec.try_push(kitty_id))
				.map_err(|_| <Error<T>>::ExceedMaxKittyOwned)?;
			<Kitties<T>>::insert(kitty_id, kitty);
			<KittyCnt<T>>::put(new_cnt);
			Ok(kitty_id)
		}
pub fn mint ( owner : & T :: AccountId , dna : Option < [ u8 ; 16 ] > , gender : Option < Gender > , ) -> Result < T :: Hash , Error < T > > { let kitty = Kitty :: < T > { dna : dna . unwrap_or_else ( Self :: gen_dna ) , price : None , gender : gender . unwrap_or_else ( Self :: gen_gender ) , owner : owner . clone ( ) , date_created : pallet_timestamp :: Pallet :: < T > :: now ( ) , } ; let kitty_id = T :: Hashing :: hash_of ( & kitty ) ; // Performs this operation first as it may fail let new_cnt = Self :: kitty_cnt ( ) . checked_add ( 1 ) . ok_or ( < Error < T > > :: KittyCntOverflow ) ? ; // Check if the kitty does not already exist in our storage map ensure ! ( Self kitties ( kitty_id ) None Error T KittyExists ) ; // Performs this operation first because as it may fail < KittiesOwned < T > > :: try_mutate ( & owner , | kitty_vec | kitty_vec . try_push ( kitty_id ) ) . map_err ( | _ | < Error < T > > :: ExceedMaxKittyOwned ) ? ; < Kitties < T > > :: insert ( kitty_id , kitty ) ; < KittyCnt < T > > :: put ( new_cnt ) ; Ok ( kitty_id ) }
Helper to mint a Kitty.
Helper to mint a Kitty .
owner
&T::AccountId
dna
Option<[u8; 16]>
gender
Option<Gender>
owner
&T::AccountId
dna
Option<[u8; 16]>
gender
Option<Gender>