difftreelog
fix unnest tokens on transfer
in: master
3 files changed
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -256,6 +256,11 @@
// from != to
if balance_from == 0 {
<Balance<T>>::remove((collection.id, from));
+ <PalletStructure<T>>::unnest_if_nested(
+ from,
+ collection.id,
+ TokenId::default()
+ );
} else {
<Balance<T>>::insert((collection.id, from), balance_from);
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth340 .checked_sub(1)340 .checked_sub(1)341 .ok_or(ArithmeticError::Overflow)?;341 .ok_or(ArithmeticError::Overflow)?;342343 // =========342344343 if balance == 0 {345 if balance == 0 {344 <AccountBalance<T>>::remove((collection.id, token_data.owner.clone()));346 <AccountBalance<T>>::remove((collection.id, token_data.owner.clone()));345 } else {347 } else {346 <AccountBalance<T>>::insert((collection.id, token_data.owner.clone()), balance);348 <AccountBalance<T>>::insert((collection.id, token_data.owner.clone()), balance);347 }349 }348350351 <PalletStructure<T>>::unnest_if_nested(349 if let Some(owner) = T::CrossTokenAddressMapping::address_to_token(&token_data.owner) {352 &token_data.owner,350 Self::unnest(owner, (collection.id, token));353 collection.id,351 }354 token352355 );353 // =========354356355 <Owned<T>>::remove((collection.id, &token_data.owner, token));357 <Owned<T>>::remove((collection.id, &token_data.owner, token));356 <TokensBurnt<T>>::insert(collection.id, burnt);358 <TokensBurnt<T>>::insert(collection.id, burnt);593595594 // =========596 // =========597598 <PalletStructure<T>>::unnest_if_nested(599 from,600 collection.id,601 token602 );595603596 <TokenData<T>>::insert(604 <TokenData<T>>::insert(597 (collection.id, token),605 (collection.id, token),pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -395,6 +395,11 @@
// from != to
if balance_from == 0 {
<Balance<T>>::remove((collection.id, token, from));
+ <PalletStructure<T>>::unnest_if_nested(
+ from,
+ collection.id,
+ token
+ );
} else {
<Balance<T>>::insert((collection.id, token, from), balance_from);
}