From 1358a9bd6efb8ab93b6e661bc91188ee65ef2545 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Tue, 06 Dec 2022 13:07:32 +0000 Subject: [PATCH] fix: fungible transfer --- --- 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()); -- gitstuff