@@ -111,6 +111,7 @@ pub struct MultiCurrencyAdapter<
111111 CurrencyId ,
112112 CurrencyIdConvert ,
113113 DepositFailureHandler ,
114+ CheckingAccount ,
114115> (
115116 PhantomData < (
116117 MultiCurrency ,
@@ -121,6 +122,7 @@ pub struct MultiCurrencyAdapter<
121122 CurrencyId ,
122123 CurrencyIdConvert ,
123124 DepositFailureHandler ,
125+ CheckingAccount ,
124126 ) > ,
125127) ;
126128
@@ -133,6 +135,7 @@ impl<
133135 CurrencyId : FullCodec + Eq + PartialEq + Copy + MaybeSerializeDeserialize + Debug ,
134136 CurrencyIdConvert : Convert < Asset , Option < CurrencyId > > ,
135137 DepositFailureHandler : OnDepositFail < CurrencyId , AccountId , MultiCurrency :: Balance > ,
138+ CheckingAccount : Get < AccountId > ,
136139 > TransactAsset
137140 for MultiCurrencyAdapter <
138141 MultiCurrency ,
@@ -143,6 +146,7 @@ impl<
143146 CurrencyId ,
144147 CurrencyIdConvert ,
145148 DepositFailureHandler ,
149+ CheckingAccount ,
146150 >
147151{
148152 fn deposit_asset ( asset : & Asset , location : & Location , _context : Option < & XcmContext > ) -> Result {
@@ -152,8 +156,14 @@ impl<
152156 Match :: matches_fungible ( asset) ,
153157 ) {
154158 // known asset
155- ( Some ( who) , Some ( currency_id) , Some ( amount) ) => MultiCurrency :: deposit ( currency_id, & who, amount)
156- . or_else ( |err| DepositFailureHandler :: on_deposit_currency_fail ( err, currency_id, & who, amount) ) ,
159+ ( Some ( who) , Some ( currency_id) , Some ( amount) ) => MultiCurrency :: transfer (
160+ currency_id,
161+ & CheckingAccount :: get ( ) ,
162+ & who,
163+ amount,
164+ ExistenceRequirement :: KeepAlive ,
165+ )
166+ . or_else ( |err| DepositFailureHandler :: on_deposit_currency_fail ( err, currency_id, & who, amount) ) ,
157167 // unknown asset
158168 _ => UnknownAsset :: deposit ( asset, location)
159169 . or_else ( |err| DepositFailureHandler :: on_deposit_unknown_asset_fail ( err, asset, location) ) ,
@@ -173,8 +183,14 @@ impl<
173183 let amount: MultiCurrency :: Balance = Match :: matches_fungible ( asset)
174184 . ok_or_else ( || XcmError :: from ( Error :: FailedToMatchFungible ) ) ?
175185 . saturated_into ( ) ;
176- MultiCurrency :: withdraw ( currency_id, & who, amount, ExistenceRequirement :: AllowDeath )
177- . map_err ( |e| XcmError :: FailedToTransactAsset ( e. into ( ) ) )
186+ MultiCurrency :: transfer (
187+ currency_id,
188+ & who,
189+ & CheckingAccount :: get ( ) ,
190+ amount,
191+ ExistenceRequirement :: AllowDeath ,
192+ )
193+ . map_err ( |e| XcmError :: FailedToTransactAsset ( e. into ( ) ) )
178194 } ) ?;
179195
180196 Ok ( asset. clone ( ) . into ( ) )
0 commit comments