Skip to content

Commit

Permalink
mdBook generated from gitorial
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Jul 22, 2024
1 parent 9dd1f37 commit 52c316a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
25 changes: 4 additions & 21 deletions src/26/solution/solution.diff
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
diff --git a/src/lib.rs b/src/lib.rs
index 7e04986..abe1450 100644
index 7e04986..482733a 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<BalanceOf<T>>,
}

/// Learn about storage value.
@@ -61,11 +60,7 @@ pub mod pallet {
@@ -61,11 +61,7 @@ pub mod pallet {
pub enum Event<T: Config> {
Created { owner: T::AccountId },
Transferred { from: T::AccountId, to: T::AccountId, kitty_id: [u8; 16] },
Expand All @@ -23,7 +15,7 @@ index 7e04986..abe1450 100644
}

#[pallet::error]
@@ -99,17 +94,15 @@ pub mod pallet {
@@ -99,17 +95,15 @@ pub mod pallet {
Ok(())
}

Expand All @@ -50,16 +42,7 @@ index 7e04986..abe1450 100644
}

// Learn about internal functions.
@@ -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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

@@ -175,15 +168,13 @@ pub mod pallet {
@@ -175,15 +169,13 @@ pub mod pallet {
Ok(())
}

Expand Down
3 changes: 2 additions & 1 deletion src/26/solution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BalanceOf<T>>,
}

/// Learn about storage value.
Expand Down Expand Up @@ -125,7 +126,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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

Expand Down
21 changes: 2 additions & 19 deletions src/27/template/template.diff
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
diff --git a/src/lib.rs b/src/lib.rs
index abe1450..c5fa2cb 100644
index 482733a..c5fa2cb 100644
--- a/src/lib.rs
+++ b/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<BalanceOf<T>>,
}

/// Learn about storage value.
@@ -125,7 +126,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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

@@ -173,6 +174,14 @@ pub mod pallet {
@@ -174,6 +174,14 @@ pub mod pallet {
kitty_id: [u8; 16],
new_price: Option<BalanceOf<T>>,
) -> DispatchResult {
Expand Down

0 comments on commit 52c316a

Please sign in to comment.