From bf376a5931f0c22a6ca4352a50aad8df369e8c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Andr=C3=A9s=20Dorado=20Su=C3=A1rez?= Date: Mon, 17 Jun 2024 10:25:07 -0500 Subject: [PATCH] change(pallet-assets): call died hook for Holder whenever necessary --- substrate/frame/assets/src/functions.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/substrate/frame/assets/src/functions.rs b/substrate/frame/assets/src/functions.rs index 5ec85de3b960..4c780f737371 100644 --- a/substrate/frame/assets/src/functions.rs +++ b/substrate/frame/assets/src/functions.rs @@ -370,7 +370,8 @@ impl, I: 'static> Pallet { } Asset::::insert(&id, details); // Executing a hook here is safe, since it is not in a `mutate`. - T::Freezer::died(id, &who); + T::Freezer::died(id.clone(), &who); + T::Holder::died(id, &who); Ok(()) } @@ -401,7 +402,8 @@ impl, I: 'static> Pallet { } Asset::::insert(&id, details); // Executing a hook here is safe, since it is not in a `mutate`. - T::Freezer::died(id, &who); + T::Freezer::died(id.clone(), &who); + T::Holder::died(id, &who); return Ok(()) } @@ -569,7 +571,8 @@ impl, I: 'static> Pallet { // Execute hook outside of `mutate`. if let Some(Remove) = target_died { - T::Freezer::died(id, target); + T::Freezer::died(id.clone(), target); + T::Holder::died(id, target); } Ok(actual) } @@ -593,7 +596,8 @@ impl, I: 'static> Pallet { let (balance, died) = Self::transfer_and_die(id.clone(), source, dest, amount, maybe_need_admin, f)?; if let Some(Remove) = died { - T::Freezer::died(id, source); + T::Freezer::died(id.clone(), source); + T::Holder::died(id, source); } Ok(balance) } @@ -791,6 +795,7 @@ impl, I: 'static> Pallet { for who in &dead_accounts { T::Freezer::died(id.clone(), &who); + T::Holder::died(id.clone(), &who); } Self::deposit_event(Event::AccountsDestroyed { @@ -951,7 +956,8 @@ impl, I: 'static> Pallet { // Execute hook outside of `mutate`. if let Some(Remove) = owner_died { - T::Freezer::died(id, owner); + T::Freezer::died(id.clone(), owner); + T::Holder::died(id, owner); } Ok(()) }