mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 00:11:05 +00:00
Fix fungible and fungibles set_balance return value (#13851)
* Fix fungible set_balance return value * fix fungibles set_balance return value
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -365,10 +365,9 @@ pub trait Mutate<AccountId>: Inspect<AccountId> + Unbalanced<AccountId> {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user