difftreelog
fix rft transfer/burn
in: master
1 file changed
pallets/refungible/src/lib.rsdiffbeforeafterboth452 token: TokenId,452 token: TokenId,453 amount: u128,453 amount: u128,454 ) -> DispatchResult {454 ) -> DispatchResult {455 if <Balance<T>>::get((collection.id, token, owner)) == 0 {456 return Err(<CommonError<T>>::MustBeTokenOwner.into());457 }458455 let total_supply = <TotalSupply<T>>::get((collection.id, token))459 let total_supply = <TotalSupply<T>>::get((collection.id, token))456 .checked_sub(amount)460 .checked_sub(amount)740744741 let initial_balance_from = <Balance<T>>::get((collection.id, token, from));745 let initial_balance_from = <Balance<T>>::get((collection.id, token, from));746747 if initial_balance_from == 0 {748 return Err(<CommonError<T>>::MustBeTokenOwner.into());749 }750742 let updated_balance_from = initial_balance_from751 let updated_balance_from = initial_balance_from743 .checked_sub(amount)752 .checked_sub(amount)744 .ok_or(<CommonError<T>>::TokenValueTooLow)?;753 .ok_or(<CommonError<T>>::TokenValueTooLow)?;745 let mut create_target = false;754 let mut create_target = false;746 let from_to_differ = from != to;755 let from_to_differ = from != to;747 let updated_balance_to = if from != to {756 let updated_balance_to = if from != to && amount != 0 {748 let old_balance = <Balance<T>>::get((collection.id, token, to));757 let old_balance = <Balance<T>>::get((collection.id, token, to));749 if old_balance == 0 {758 if old_balance == 0 {750 create_target = true;759 create_target = true;786795787 // =========796 // =========797798 if let Some(updated_balance_to) = updated_balance_to {799 // from != to && amount != 0788800789 <PalletStructure<T>>::nest_if_sent_to_token(801 <PalletStructure<T>>::nest_if_sent_to_token(790 from.clone(),802 from.clone(),794 nesting_budget,806 nesting_budget,795 )?;807 )?;796808797 if let Some(updated_balance_to) = updated_balance_to {798 // from != to799 if updated_balance_from == 0 {809 if updated_balance_from == 0 {800 <Balance<T>>::remove((collection.id, token, from));810 <Balance<T>>::remove((collection.id, token, from));801 <PalletStructure<T>>::unnest_if_nested(from, collection.id, token);811 <PalletStructure<T>>::unnest_if_nested(from, collection.id, token);811 <AccountBalance<T>>::insert((collection.id, to), account_balance_to);821 <AccountBalance<T>>::insert((collection.id, to), account_balance_to);812 <Owned<T>>::insert((collection.id, to, token), true);822 <Owned<T>>::insert((collection.id, to, token), true);813 }823 }814 }824 }815825816 <PalletEvm<T>>::deposit_log(826 <PalletEvm<T>>::deposit_log(817 ERC20Events::Transfer {827 ERC20Events::Transfer {