difftreelog
refactor rename structure dispatch* fns
in: master
4 files changed
pallets/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(),
pallets/nonfungible/src/lib.rsdiffbeforeafterboth585 None585 None586 };586 };587587588 <PalletStructure<T>>::try_nest_if_sent_to_token(588 <PalletStructure<T>>::nest_if_sent_to_token(589 from.clone(),589 from.clone(),590 to,590 to,591 collection.id,591 collection.id,704 },704 },705 );705 );706706707 <PalletStructure<T>>::nest_if_sent_to_token(&data.owner, collection.id, TokenId(token));707 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&data.owner, collection.id, TokenId(token));708708709 if let Err(e) = Self::set_token_properties(709 if let Err(e) = Self::set_token_properties(710 collection,710 collection,pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -375,7 +375,7 @@
// =========
- <PalletStructure<T>>::try_nest_if_sent_to_token(
+ <PalletStructure<T>>::nest_if_sent_to_token(
from.clone(),
to,
collection.id,
@@ -518,7 +518,7 @@
}
<Balance<T>>::insert((collection.id, token_id, &user), amount);
<Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);
- <PalletStructure<T>>::nest_if_sent_to_token(&user, collection.id, TokenId(token_id));
+ <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&user, collection.id, TokenId(token_id));
// TODO: ERC20 transfer event
<PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(
pallets/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 {