From 0144cf283b8acb76bcbc465a2197cf204cf3abd2 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Sun, 10 Nov 2024 09:25:22 +0700 Subject: [PATCH] fix --- tokens/src/imbalances.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tokens/src/imbalances.rs b/tokens/src/imbalances.rs index 7463d8c72..858641130 100644 --- a/tokens/src/imbalances.rs +++ b/tokens/src/imbalances.rs @@ -1,7 +1,7 @@ // wrapping these imbalances in a private module is necessary to ensure absolute // privacy of the inner member. use crate::{Config, TotalIssuance}; -use frame_support::traits::{Get, Imbalance, SameOrOther, TryDrop}; +use frame_support::traits::{tokens::imbalance::TryMerge, Get, Imbalance, SameOrOther, TryDrop}; use sp_runtime::traits::{Saturating, Zero}; use sp_std::{marker, mem, result}; @@ -184,3 +184,14 @@ impl> Drop for NegativeImbalance::mutate(GetCurrencyId::get(), |v| *v = v.saturating_sub(self.0)); } } + +impl> TryMerge for PositiveImbalance { + fn try_merge(self, other: Self) -> Result { + Ok(self.merge(other)) + } +} +impl> TryMerge for NegativeImbalance { + fn try_merge(self, other: Self) -> Result { + Ok(self.merge(other)) + } +}