From 9dd1f37dcf702990e05e4c376c10fe0973a0ea57 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Mon, 22 Jul 2024 18:24:39 -0400 Subject: [PATCH] mdBook generated from gitorial --- src/26/solution/solution.diff | 25 +++++++++++++++++++++---- src/26/template/src/lib.rs | 3 ++- src/26/template/template.diff | 25 ++++--------------------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/26/solution/solution.diff b/src/26/solution/solution.diff index 8ed55c43..0f1cf4c4 100644 --- a/src/26/solution/solution.diff +++ b/src/26/solution/solution.diff @@ -1,8 +1,16 @@ diff --git a/src/lib.rs b/src/lib.rs -index 6dd3fb3..abe1450 100644 +index 7e04986..abe1450 100644 --- a/src/lib.rs +++ b/src/lib.rs -@@ -60,11 +60,7 @@ pub mod pallet { +@@ -36,7 +36,6 @@ pub mod pallet { + // Using 16 bytes to represent a kitty DNA + pub dna: [u8; 16], + pub owner: T::AccountId, +- pub price: Option>, + } + + /// Learn about storage value. +@@ -61,11 +60,7 @@ pub mod pallet { pub enum Event { Created { owner: T::AccountId }, Transferred { from: T::AccountId, to: T::AccountId, kitty_id: [u8; 16] }, @@ -15,7 +23,7 @@ index 6dd3fb3..abe1450 100644 } #[pallet::error] -@@ -98,17 +94,15 @@ pub mod pallet { +@@ -99,17 +94,15 @@ pub mod pallet { Ok(()) } @@ -42,7 +50,16 @@ index 6dd3fb3..abe1450 100644 } // Learn about internal functions. -@@ -174,15 +168,13 @@ pub mod pallet { +@@ -132,7 +125,7 @@ pub mod pallet { + + // Learn about `AccountId`. + fn mint(owner: T::AccountId, dna: [u8; 16]) -> DispatchResult { +- let kitty = Kitty { dna, owner: owner.clone(), price: None }; ++ let kitty = Kitty { dna, owner: owner.clone() }; + // Check if the kitty does not already exist in our storage map + ensure!(!Kitties::::contains_key(dna), Error::::DuplicateKitty); + +@@ -175,15 +168,13 @@ pub mod pallet { Ok(()) } diff --git a/src/26/template/src/lib.rs b/src/26/template/src/lib.rs index 6dd3fb36..7e04986e 100644 --- a/src/26/template/src/lib.rs +++ b/src/26/template/src/lib.rs @@ -36,6 +36,7 @@ pub mod pallet { // Using 16 bytes to represent a kitty DNA pub dna: [u8; 16], pub owner: T::AccountId, + pub price: Option>, } /// Learn about storage value. @@ -131,7 +132,7 @@ pub mod pallet { // Learn about `AccountId`. fn mint(owner: T::AccountId, dna: [u8; 16]) -> DispatchResult { - let kitty = Kitty { dna, owner: owner.clone() }; + let kitty = Kitty { dna, owner: owner.clone(), price: None }; // Check if the kitty does not already exist in our storage map ensure!(!Kitties::::contains_key(dna), Error::::DuplicateKitty); diff --git a/src/26/template/template.diff b/src/26/template/template.diff index 438645ae..4ccb0d1e 100644 --- a/src/26/template/template.diff +++ b/src/26/template/template.diff @@ -1,16 +1,8 @@ diff --git a/src/lib.rs b/src/lib.rs -index 267a7cf..6dd3fb3 100644 +index 267a7cf..7e04986 100644 --- a/src/lib.rs +++ b/src/lib.rs -@@ -36,7 +36,6 @@ pub mod pallet { - // Using 16 bytes to represent a kitty DNA - pub dna: [u8; 16], - pub owner: T::AccountId, -- pub price: Option>, - } - - /// Learn about storage value. -@@ -61,6 +60,11 @@ pub mod pallet { +@@ -61,6 +61,11 @@ pub mod pallet { pub enum Event { Created { owner: T::AccountId }, Transferred { from: T::AccountId, to: T::AccountId, kitty_id: [u8; 16] }, @@ -22,7 +14,7 @@ index 267a7cf..6dd3fb3 100644 } #[pallet::error] -@@ -93,6 +97,18 @@ pub mod pallet { +@@ -93,6 +98,18 @@ pub mod pallet { Self::do_transfer(who, to, kitty_id)?; Ok(()) } @@ -41,16 +33,7 @@ index 267a7cf..6dd3fb3 100644 } // Learn about internal functions. -@@ -115,7 +131,7 @@ pub mod pallet { - - // Learn about `AccountId`. - fn mint(owner: T::AccountId, dna: [u8; 16]) -> DispatchResult { -- let kitty = Kitty { dna, owner: owner.clone(), price: None }; -+ let kitty = Kitty { dna, owner: owner.clone() }; - // Check if the kitty does not already exist in our storage map - ensure!(!Kitties::::contains_key(dna), Error::::DuplicateKitty); - -@@ -157,5 +173,16 @@ pub mod pallet { +@@ -157,5 +174,16 @@ pub mod pallet { Self::deposit_event(Event::::Transferred { from, to, kitty_id }); Ok(()) }