Newer
Older
};
account.free = value;
Ok(imbalance)
},
)
.unwrap_or_else(|_| SignedImbalance::Positive(Self::PositiveImbalance::zero()))
}
}
impl<T, GetCurrencyId> PalletReservableCurrency<T::AccountId> for CurrencyAdapter<T, GetCurrencyId>
where
T: Config,
GetCurrencyId: Get<T::CurrencyId>,
{
fn can_reserve(who: &T::AccountId, value: Self::Balance) -> bool {
Pallet::<T>::can_reserve(GetCurrencyId::get(), who, value)
}
fn slash_reserved(who: &T::AccountId, value: Self::Balance) -> (Self::NegativeImbalance, Self::Balance) {
let actual = Pallet::<T>::slash_reserved(GetCurrencyId::get(), who, value);
(Self::NegativeImbalance::zero(), actual)
}
fn reserved_balance(who: &T::AccountId) -> Self::Balance {
Pallet::<T>::reserved_balance(GetCurrencyId::get(), who)
}
fn reserve(who: &T::AccountId, value: Self::Balance) -> DispatchResult {
Pallet::<T>::reserve(GetCurrencyId::get(), who, value)
}
fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance {
Pallet::<T>::unreserve(GetCurrencyId::get(), who, value)
fn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status,
) -> sp_std::result::Result<Self::Balance, DispatchError> {
Pallet::<T>::repatriate_reserved(GetCurrencyId::get(), slashed, beneficiary, value, status)
}
}
impl<T, GetCurrencyId> PalletLockableCurrency<T::AccountId> for CurrencyAdapter<T, GetCurrencyId>
where
T: Config,
GetCurrencyId: Get<T::CurrencyId>,
{
type Moment = T::BlockNumber;
type MaxLocks = ();
fn set_lock(id: LockIdentifier, who: &T::AccountId, amount: Self::Balance, _reasons: WithdrawReasons) {
let _ = Pallet::<T>::set_lock(id, GetCurrencyId::get(), who, amount);
}
fn extend_lock(id: LockIdentifier, who: &T::AccountId, amount: Self::Balance, _reasons: WithdrawReasons) {
let _ = Pallet::<T>::extend_lock(id, GetCurrencyId::get(), who, amount);
fn remove_lock(id: LockIdentifier, who: &T::AccountId) {
let _ = Pallet::<T>::remove_lock(id, GetCurrencyId::get(), who);
}
}
impl<T: Config> TransferAll<T::AccountId> for Pallet<T> {
fn transfer_all(source: &T::AccountId, dest: &T::AccountId) -> DispatchResult {
Accounts::<T>::iter_prefix(source).try_for_each(|(currency_id, account_data)| -> DispatchResult {
<Self as MultiCurrency<T::AccountId>>::transfer(currency_id, source, dest, account_data.free)