Skip to content

Commit 0144cf2

Browse files
committed
fix
1 parent 187cae6 commit 0144cf2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tokens/src/imbalances.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// wrapping these imbalances in a private module is necessary to ensure absolute
22
// privacy of the inner member.
33
use crate::{Config, TotalIssuance};
4-
use frame_support::traits::{Get, Imbalance, SameOrOther, TryDrop};
4+
use frame_support::traits::{tokens::imbalance::TryMerge, Get, Imbalance, SameOrOther, TryDrop};
55
use sp_runtime::traits::{Saturating, Zero};
66
use sp_std::{marker, mem, result};
77

@@ -184,3 +184,14 @@ impl<T: Config, GetCurrencyId: Get<T::CurrencyId>> Drop for NegativeImbalance<T,
184184
TotalIssuance::<T>::mutate(GetCurrencyId::get(), |v| *v = v.saturating_sub(self.0));
185185
}
186186
}
187+
188+
impl<T: Config, GetCurrencyId: Get<T::CurrencyId>> TryMerge for PositiveImbalance<T, GetCurrencyId> {
189+
fn try_merge(self, other: Self) -> Result<Self, (Self, Self)> {
190+
Ok(self.merge(other))
191+
}
192+
}
193+
impl<T: Config, GetCurrencyId: Get<T::CurrencyId>> TryMerge for NegativeImbalance<T, GetCurrencyId> {
194+
fn try_merge(self, other: Self) -> Result<Self, (Self, Self)> {
195+
Ok(self.merge(other))
196+
}
197+
}

0 commit comments

Comments
 (0)