Skip to content
Snippets Groups Projects
Unverified Commit ea8b8774 authored by wangjj9219's avatar wangjj9219 Committed by GitHub
Browse files

modify WithdrawReason to adapt pallet_balances (#186)

parent d2d7eafd
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ use frame_support::{ ...@@ -35,7 +35,7 @@ use frame_support::{
decl_error, decl_event, decl_module, decl_storage, decl_error, decl_event, decl_module, decl_storage,
traits::{ traits::{
Currency as PalletCurrency, ExistenceRequirement, Get, LockableCurrency as PalletLockableCurrency, Currency as PalletCurrency, ExistenceRequirement, Get, LockableCurrency as PalletLockableCurrency,
ReservableCurrency as PalletReservableCurrency, WithdrawReason, ReservableCurrency as PalletReservableCurrency, WithdrawReasons,
}, },
}; };
use sp_runtime::{ use sp_runtime::{
...@@ -555,7 +555,7 @@ where ...@@ -555,7 +555,7 @@ where
BalanceConvert::from(new_balance).into() BalanceConvert::from(new_balance).into()
}; };
let amount_pallet = BalanceConvert::from(amount).into(); let amount_pallet = BalanceConvert::from(amount).into();
Currency::ensure_can_withdraw(who, amount_pallet, WithdrawReason::Transfer.into(), new_balance_pallet) Currency::ensure_can_withdraw(who, amount_pallet, WithdrawReasons::all(), new_balance_pallet)
} }
fn transfer(from: &AccountId, to: &AccountId, amount: Self::Balance) -> DispatchResult { fn transfer(from: &AccountId, to: &AccountId, amount: Self::Balance) -> DispatchResult {
...@@ -572,7 +572,7 @@ where ...@@ -572,7 +572,7 @@ where
Currency::withdraw( Currency::withdraw(
who, who,
BalanceConvert::from(amount).into(), BalanceConvert::from(amount).into(),
WithdrawReason::Transfer.into(), WithdrawReasons::all(),
ExistenceRequirement::AllowDeath, ExistenceRequirement::AllowDeath,
) )
.map(|_| ()) .map(|_| ())
...@@ -632,7 +632,7 @@ where ...@@ -632,7 +632,7 @@ where
lock_id, lock_id,
who, who,
BalanceConvert::from(amount).into(), BalanceConvert::from(amount).into(),
WithdrawReason::Transfer | WithdrawReason::Reserve, WithdrawReasons::all(),
); );
} }
...@@ -641,7 +641,7 @@ where ...@@ -641,7 +641,7 @@ where
lock_id, lock_id,
who, who,
BalanceConvert::from(amount).into(), BalanceConvert::from(amount).into(),
WithdrawReason::Transfer | WithdrawReason::Reserve, WithdrawReasons::all(),
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment