Unverified Commit a1f0e434 authored by Qinxuan Chen's avatar Qinxuan Chen Committed by GitHub
Browse files

Companion for substrate #7159 (#1747)



* Companion for paritytech/substrate#7159
Signed-off-by: default avatarkoushiro <koushiro.cqx@gmail.com>

* update WithdrawReason in xcm
Signed-off-by: default avatarkoushiro <koushiro.cqx@gmail.com>

* "Update Substrate"

Co-authored-by: parity-processbot <>
parent be669685
Pipeline #112577 passed with stages
in 22 minutes and 48 seconds
This diff is collapsed.
......@@ -69,7 +69,7 @@
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, storage::child, ensure,
traits::{
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
Currency, Get, OnUnbalanced, WithdrawReasons, ExistenceRequirement::AllowDeath
},
};
use frame_system::ensure_signed;
......@@ -273,7 +273,7 @@ decl_module! {
ensure!(end > <frame_system::Module<T>>::block_number(), Error::<T>::CannotEndInPast);
let deposit = T::SubmissionDeposit::get();
let transfer = WithdrawReason::Transfer.into();
let transfer = WithdrawReasons::TRANSFER;
let imb = T::Currency::withdraw(&owner, deposit, transfer, AllowDeath)?;
let index = FundCount::get();
......@@ -455,7 +455,7 @@ decl_module! {
// Avoid using transfer to ensure we don't pay any fees.
let fund_account = &Self::fund_account_id(index);
let transfer = WithdrawReason::Transfer.into();
let transfer = WithdrawReasons::TRANSFER;
let imbalance = T::Currency::withdraw(fund_account, balance, transfer, AllowDeath)?;
let _ = T::Currency::resolve_into_existing(&who, imbalance);
......@@ -485,7 +485,7 @@ decl_module! {
let account = Self::fund_account_id(index);
// Avoid using transfer to ensure we don't pay any fees.
let transfer = WithdrawReason::Transfer.into();
let transfer = WithdrawReasons::TRANSFER;
let imbalance = T::Currency::withdraw(&account, fund.deposit, transfer, AllowDeath)?;
let _ = T::Currency::resolve_into_existing(&fund.owner, imbalance);
......
......@@ -25,7 +25,7 @@ use sp_runtime::traits::{
use codec::{Encode, Decode, Codec};
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure, dispatch::DispatchResult,
traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get, Randomness},
traits::{Currency, ReservableCurrency, WithdrawReasons, ExistenceRequirement, Get, Randomness},
weights::{DispatchClass, Weight},
};
use primitives::v1::{
......@@ -630,7 +630,7 @@ impl<T: Trait> Module<T> {
if T::Currency::withdraw(
&bidder.who,
amount,
WithdrawReason::Fee.into(),
WithdrawReasons::FEE,
ExistenceRequirement::AllowDeath
).is_err() {
continue;
......@@ -667,7 +667,7 @@ impl<T: Trait> Module<T> {
if T::Currency::withdraw(
&para_id.into_account(),
additional,
WithdrawReason::Fee.into(),
WithdrawReasons::FEE,
ExistenceRequirement::AllowDeath
).is_err() {
continue;
......
......@@ -17,7 +17,7 @@
use sp_std::{result, convert::TryInto, marker::PhantomData};
use xcm::v0::{Error, Result, MultiAsset, MultiLocation};
use sp_arithmetic::traits::SaturatedConversion;
use frame_support::traits::{ExistenceRequirement::AllowDeath, WithdrawReason};
use frame_support::traits::{ExistenceRequirement::AllowDeath, WithdrawReasons};
use xcm_executor::traits::{MatchesFungible, LocationConversion, TransactAsset};
pub struct CurrencyAdapter<Currency, Matcher, AccountIdConverter, AccountId>(
......@@ -48,7 +48,7 @@ impl<
let amount = Matcher::matches_fungible(&what).ok_or(())?.saturated_into();
let who = AccountIdConverter::from_location(who).ok_or(())?;
let balance_amount = amount.try_into().map_err(|_| ())?;
Currency::withdraw(&who, balance_amount, WithdrawReason::Transfer.into(), AllowDeath).map_err(|_| ())?;
Currency::withdraw(&who, balance_amount, WithdrawReasons::TRANSFER, AllowDeath).map_err(|_| ())?;
Ok(what.clone())
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment