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 a06489f commit 9dd1f37
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
25 changes: 21 additions & 4 deletions src/26/solution/solution.diff
Original file line number Diff line number Diff line change
@@ -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<BalanceOf<T>>,
}

/// Learn about storage value.
@@ -61,11 +60,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 @@ -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(())
}

Expand All @@ -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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

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

Expand Down
3 changes: 2 additions & 1 deletion src/26/template/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 @@ -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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

Expand Down
25 changes: 4 additions & 21 deletions src/26/template/template.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 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<BalanceOf<T>>,
}

/// Learn about storage value.
@@ -61,6 +60,11 @@ pub mod pallet {
@@ -61,6 +61,11 @@ 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 @@ -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(())
}
Expand All @@ -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::<T>::contains_key(dna), Error::<T>::DuplicateKitty);

@@ -157,5 +173,16 @@ pub mod pallet {
@@ -157,5 +174,16 @@ pub mod pallet {
Self::deposit_event(Event::<T>::Transferred { from, to, kitty_id });
Ok(())
}
Expand Down

0 comments on commit 9dd1f37

Please sign in to comment.