git.delta.rocks / unique-network / refs/commits / b5533c6f03d9

difftreelog

refactor rename structure dispatch* fns

Daniel Shiposha2022-05-27parent: #bb64e8b.patch.diff
in: master

4 files changed

modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -236,7 +236,7 @@
 
 		// =========
 
-		<PalletStructure<T>>::try_nest_if_sent_to_token(
+		<PalletStructure<T>>::nest_if_sent_to_token(
 			from.clone(),
 			to,
 			collection.id,
@@ -320,7 +320,7 @@
 		<TotalSupply<T>>::insert(collection.id, total_supply);
 		for (user, amount) in balances {
 			<Balance<T>>::insert((collection.id, &user), amount);
-			<PalletStructure<T>>::nest_if_sent_to_token(&user, collection.id, TokenId::default());
+			<PalletStructure<T>>::nest_if_sent_to_token_unchecked(&user, collection.id, TokenId::default());
 			<PalletEvm<T>>::deposit_log(
 				ERC20Events::Transfer {
 					from: H160::default(),
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -585,7 +585,7 @@
 			None
 		};
 
-		<PalletStructure<T>>::try_nest_if_sent_to_token(
+		<PalletStructure<T>>::nest_if_sent_to_token(
 			from.clone(),
 			to,
 			collection.id,
@@ -704,7 +704,7 @@
 					},
 				);
 
-				<PalletStructure<T>>::nest_if_sent_to_token(&data.owner, collection.id, TokenId(token));
+				<PalletStructure<T>>::nest_if_sent_to_token_unchecked(&data.owner, collection.id, TokenId(token));
 
 				if let Err(e) = Self::set_token_properties(
 					collection,
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
375375
376 // =========376 // =========
377377
378 <PalletStructure<T>>::try_nest_if_sent_to_token(378 <PalletStructure<T>>::nest_if_sent_to_token(
379 from.clone(),379 from.clone(),
380 to,380 to,
381 collection.id,381 collection.id,
518 }518 }
519 <Balance<T>>::insert((collection.id, token_id, &user), amount);519 <Balance<T>>::insert((collection.id, token_id, &user), amount);
520 <Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);520 <Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);
521 <PalletStructure<T>>::nest_if_sent_to_token(&user, collection.id, TokenId(token_id));521 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&user, collection.id, TokenId(token_id));
522522
523 // TODO: ERC20 transfer event523 // TODO: ERC20 transfer event
524 <PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(524 <PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -191,7 +191,7 @@
 		token_id: TokenId,
 		nesting_budget: &dyn Budget
 	) -> DispatchResult {
-		Self::try_dispatched(
+		Self::try_exec_if_owner_is_valid_nft(
 			under,
 			|d, parent_id| d.check_nesting(
 				from,
@@ -202,14 +202,14 @@
 		)
 	}
 
-	pub fn try_nest_if_sent_to_token(
+	pub fn nest_if_sent_to_token(
 		from: T::CrossAccountId,
 		under: &T::CrossAccountId,
 		collection_id: CollectionId,
 		token_id: TokenId,
 		nesting_budget: &dyn Budget
 	) -> DispatchResult {
-		Self::try_dispatched(
+		Self::try_exec_if_owner_is_valid_nft(
 			under,
 			|d, parent_id| {
 				d.check_nesting(
@@ -226,12 +226,12 @@
 		)
 	}
 
-	pub fn nest_if_sent_to_token(
+	pub fn nest_if_sent_to_token_unchecked(
 		owner: &T::CrossAccountId,
 		collection_id: CollectionId,
 		token_id: TokenId
 	) {
-		Self::dispatched(
+		Self::exec_if_owner_is_valid_nft(
 			owner,
 			|d, parent_id| d.nest(
 				parent_id,
@@ -245,7 +245,7 @@
 		collection_id: CollectionId,
 		token_id: TokenId
 	) {
-		Self::dispatched(
+		Self::exec_if_owner_is_valid_nft(
 			owner,
 			|d, parent_id| d.unnest(
 			parent_id,
@@ -254,11 +254,11 @@
 		);
 	}
 
-	fn dispatched(
+	fn exec_if_owner_is_valid_nft(
 		account: &T::CrossAccountId,
 		action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId)
 	) {
-		Self::try_dispatched(
+		Self::try_exec_if_owner_is_valid_nft(
 			account,
 			|d, id| {
 				action(d, id);
@@ -267,7 +267,7 @@
 		).unwrap();
 	}
 
-	fn try_dispatched(
+	fn try_exec_if_owner_is_valid_nft(
 		account: &T::CrossAccountId,
 		action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId) -> DispatchResult
 	) -> DispatchResult {