--- a/pallets/fungible/src/lib.rs +++ b/pallets/fungible/src/lib.rs @@ -379,7 +379,7 @@ let balance_from = >::get((collection.id, from)) .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; - let balance_to = if from != to { + let balance_to = if from != to && amount != 0 { Some( >::get((collection.id, to)) .checked_add(amount) @@ -391,16 +391,17 @@ // ========= - >::nest_if_sent_to_token( - from.clone(), - to, - collection.id, - TokenId::default(), - nesting_budget, - )?; - if let Some(balance_to) = balance_to { - // from != to + // from != to && amount != 0 + + >::nest_if_sent_to_token( + from.clone(), + to, + collection.id, + TokenId::default(), + nesting_budget, + )?; + if balance_from == 0 { >::remove((collection.id, from)); >::unnest_if_nested(from, collection.id, TokenId::default());