-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ef8191
commit e273ed1
Showing
154 changed files
with
2,821 additions
and
2,320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use super::*; | ||
use frame_support::pallet_prelude::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
diff --git a/src/lib.rs b/src/lib.rs | ||
index 356e547..59a65fe 100644 | ||
--- a/src/lib.rs | ||
+++ b/src/lib.rs | ||
@@ -49,12 +49,9 @@ pub mod pallet { | ||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
fn mint(owner: T::AccountId) -> DispatchResult { | ||
- /* TODO: | ||
- - `get` the current count of kitties. | ||
- - `unwrap_or` set the count to `0`. | ||
- - increment the count by one. | ||
- - `set` the new count of kitties. | ||
- */ | ||
+ let current_count: u64 = CountForKitties::<T>::get().unwrap_or(0); | ||
+ let new_count = current_count + 1; | ||
+ CountForKitties::<T>::set(Some(new_count)); | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
diff --git a/src/impls.rs b/src/impls.rs | ||
index 67fd2a0..ef53a56 100644 | ||
--- a/src/impls.rs | ||
+++ b/src/impls.rs | ||
@@ -4,12 +4,9 @@ use frame_support::pallet_prelude::*; | ||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
- /* TODO: | ||
- - `get` the current count of kitties. | ||
- - `unwrap_or` set the count to `0`. | ||
- - increment the count by one. | ||
- - `set` the new count of kitties. | ||
- */ | ||
+ let current_count: u64 = CountForKitties::<T>::get().unwrap_or(0); | ||
+ let new_count = current_count + 1; | ||
+ CountForKitties::<T>::set(Some(new_count)); | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use super::*; | ||
use frame_support::pallet_prelude::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
let current_count: u64 = CountForKitties::<T>::get().unwrap_or(0); | ||
let new_count = current_count + 1; | ||
CountForKitties::<T>::set(Some(new_count)); | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use super::*; | ||
use frame_support::pallet_prelude::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
/* TODO: | ||
- `get` the current count of kitties. | ||
- `unwrap_or` set the count to `0`. | ||
- increment the count by one. | ||
- `set` the new count of kitties. | ||
*/ | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
diff --git a/src/lib.rs b/src/lib.rs | ||
index 67dd167..356e547 100644 | ||
--- a/src/lib.rs | ||
+++ b/src/lib.rs | ||
@@ -49,6 +49,12 @@ pub mod pallet { | ||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
fn mint(owner: T::AccountId) -> DispatchResult { | ||
+ /* TODO: | ||
+ - `get` the current count of kitties. | ||
+ - `unwrap_or` set the count to `0`. | ||
+ - increment the count by one. | ||
+ - `set` the new count of kitties. | ||
+ */ | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
diff --git a/src/impls.rs b/src/impls.rs | ||
index 869c781..67fd2a0 100644 | ||
--- a/src/impls.rs | ||
+++ b/src/impls.rs | ||
@@ -4,6 +4,12 @@ use frame_support::pallet_prelude::*; | ||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
+ /* TODO: | ||
+ - `get` the current count of kitties. | ||
+ - `unwrap_or` set the count to `0`. | ||
+ - increment the count by one. | ||
+ - `set` the new count of kitties. | ||
+ */ | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use super::*; | ||
use frame_support::pallet_prelude::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
// Learn about `AccountId`. | ||
pub fn mint(owner: T::AccountId) -> DispatchResult { | ||
let current_count: u64 = CountForKitties::<T>::get().unwrap_or(0); | ||
let new_count = current_count.checked_add(1).ok_or(Error::<T>::TooManyKitties)?; | ||
CountForKitties::<T>::set(Some(new_count)); | ||
Self::deposit_event(Event::<T>::Created { owner }); | ||
Ok(()) | ||
} | ||
} |
Oops, something went wrong.