-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bmacer/feat/core-children-send-and-burn
implement children and iterative burning
- Loading branch information
Showing
3 changed files
with
348 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use super::*; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn is_x_descendent_of_y( | ||
child_collection_id: T::CollectionId, | ||
child_nft_id: T::NftId, | ||
parent_collection_id: T::CollectionId, | ||
parent_nft_id: T::NftId, | ||
) -> bool { | ||
let mut found_child = false; | ||
if let Some(children) = Children::<T>::get(parent_collection_id, parent_nft_id) { | ||
for child in children { | ||
if child == (child_collection_id, child_nft_id) { | ||
return true; | ||
} else { | ||
if Pallet::<T>::is_x_descendent_of_y( | ||
child_collection_id, | ||
child_nft_id, | ||
child.0, | ||
child.1, | ||
) { | ||
found_child = true; | ||
} | ||
} | ||
} | ||
} | ||
found_child | ||
} | ||
} |
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
Oops, something went wrong.