Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix fungible set_balance return value
  • Loading branch information
liamaharon authored Apr 7, 2023
commit 3df820d60c6fa71f05ba260c6d7080557067d4dc
4 changes: 2 additions & 2 deletions frame/support/src/traits/tokens/fungible/regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ pub trait Mutate<AccountId>: Inspect<AccountId> + Unbalanced<AccountId> {
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)
}
Expand Down