diff --git a/frame/support/src/traits/tokens/fungible/regular.rs b/frame/support/src/traits/tokens/fungible/regular.rs index 574392cac8256..5a201b33b7cd9 100644 --- a/frame/support/src/traits/tokens/fungible/regular.rs +++ b/frame/support/src/traits/tokens/fungible/regular.rs @@ -327,9 +327,9 @@ pub trait Mutate: Inspect + Unbalanced { fn set_balance(who: &AccountId, amount: Self::Balance) -> Self::Balance { let b = Self::balance(who); if b > amount { - Self::burn_from(who, b - amount, BestEffort, Force).map(|d| amount.saturating_sub(d)) + Self::burn_from(who, b - amount, BestEffort, Force).map(|d| b.saturating_sub(d)) } else { - Self::mint_into(who, amount - b).map(|d| amount.saturating_add(d)) + Self::mint_into(who, amount - b).map(|d| b.saturating_add(d)) } .unwrap_or(b) } diff --git a/frame/support/src/traits/tokens/fungibles/regular.rs b/frame/support/src/traits/tokens/fungibles/regular.rs index 03c14988015ab..27d1a50b34805 100644 --- a/frame/support/src/traits/tokens/fungibles/regular.rs +++ b/frame/support/src/traits/tokens/fungibles/regular.rs @@ -365,10 +365,9 @@ pub trait Mutate: Inspect + Unbalanced { fn set_balance(asset: Self::AssetId, who: &AccountId, amount: Self::Balance) -> Self::Balance { let b = Self::balance(asset, who); if b > amount { - Self::burn_from(asset, who, b - amount, BestEffort, Force) - .map(|d| amount.saturating_sub(d)) + Self::burn_from(asset, who, b - amount, BestEffort, Force).map(|d| b.saturating_sub(d)) } else { - Self::mint_into(asset, who, amount - b).map(|d| amount.saturating_add(d)) + Self::mint_into(asset, who, amount - b).map(|d| b.saturating_add(d)) } .unwrap_or(b) }