@@ -24,7 +24,7 @@ use frame_support::{
2424 dispatch:: { GetDispatchInfo , PostDispatchInfo } ,
2525 sp_runtime:: traits:: { Bounded , CheckedSub , Dispatchable , StaticLookup } ,
2626 storage:: types:: { StorageDoubleMap , StorageMap , ValueQuery } ,
27- traits:: StorageInstance ,
27+ traits:: { OriginTrait , StorageInstance } ,
2828 Blake2_128Concat ,
2929} ;
3030use pallet_balances:: pallet:: {
@@ -194,7 +194,7 @@ where
194194 BalanceOf < Runtime , Instance > : TryFrom < U256 > + Into < U256 > ,
195195 Metadata : Erc20Metadata ,
196196 Instance : InstanceToPrefix + ' static ,
197- Runtime :: AccountId : From < AccountId32 > ,
197+ Runtime :: AccountId : From < AccountId32 > + From < << Runtime as pallet_evm :: Config > :: AccountProvider as fp_evm :: AccountProvider > :: AccountId > ,
198198{
199199 #[ precompile:: public( "totalSupply()" ) ]
200200 #[ precompile:: view]
@@ -212,8 +212,8 @@ where
212212 // Blake2128(16) + AccountId(20) + AccountInfo ((4 * 4) + AccountData(16 * 4))
213213 handle. record_db_read :: < Runtime > ( 116 ) ?;
214214
215- let owner: H160 = owner. into ( ) ;
216- let owner: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( owner) ;
215+ let owner: H160 = owner. into ( ) ;
216+ let owner: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( owner) . into ( ) ;
217217
218218 Ok ( pallet_balances:: Pallet :: < Runtime , Instance > :: usable_balance ( & owner) . into ( ) )
219219 }
@@ -232,8 +232,8 @@ where
232232 let owner: H160 = owner. into ( ) ;
233233 let spender: H160 = spender. into ( ) ;
234234
235- let owner: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( owner) ;
236- let spender: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( spender) ;
235+ let owner: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( owner) . into ( ) ;
236+ let spender: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( spender) . into ( ) ;
237237
238238 Ok ( ApprovesStorage :: < Runtime , Instance > :: get ( owner, spender)
239239 . unwrap_or_default ( )
@@ -253,9 +253,9 @@ where
253253
254254 // Write into storage.
255255 {
256- let caller: Runtime :: AccountId =
257- Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
258- let spender: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( spender) ;
256+ let caller: Runtime :: AccountId =
257+ Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
258+ let spender: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( spender) . into ( ) ;
259259 // Amount saturate if too high.
260260 let value = Self :: u256_to_amount ( value) . unwrap_or_else ( |_| Bounded :: max_value ( ) ) ;
261261
@@ -283,14 +283,14 @@ where
283283
284284 // Build call with origin.
285285 {
286- let origin = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
287- let to = Runtime :: AddressMapping :: into_account_id ( to) ;
286+ let origin: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
287+ let to: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( to) . into ( ) ;
288288 let value = Self :: u256_to_amount ( value) . in_field ( "value" ) ?;
289289
290290 // Dispatch call (if enough gas).
291291 RuntimeHelper :: < Runtime > :: try_dispatch (
292292 handle,
293- RuntimeOrigin :: signed ( origin) ,
293+ < Runtime as frame_system :: Config > :: RuntimeOrigin :: signed ( origin) ,
294294 pallet_balances:: Call :: < Runtime , Instance > :: transfer_allow_death {
295295 dest : Runtime :: Lookup :: unlookup ( to) ,
296296 value,
@@ -324,13 +324,13 @@ where
324324
325325 // Build call with origin.
326326 {
327- let origin = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
328- let value = Self :: u256_to_amount ( value) . in_field ( "value" ) ?;
327+ let origin: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
328+ let value = Self :: u256_to_amount ( value) . in_field ( "value" ) ?;
329329
330330 // Dispatch call (if enough gas).
331331 RuntimeHelper :: < Runtime > :: try_dispatch (
332332 handle,
333- RuntimeOrigin :: signed ( origin) ,
333+ < Runtime as frame_system :: Config > :: RuntimeOrigin :: signed ( origin) ,
334334 pallet_balances:: Call :: < Runtime , Instance > :: transfer_allow_death {
335335 dest : Runtime :: Lookup :: unlookup ( to_account_id) ,
336336 value,
@@ -367,10 +367,10 @@ where
367367 let to: H160 = to. into ( ) ;
368368
369369 {
370- let caller: Runtime :: AccountId =
371- Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
372- let from: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( from) ;
373- let to: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( to) ;
370+ let caller: Runtime :: AccountId =
371+ Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
372+ let from: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( from) . into ( ) ;
373+ let to: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( to) . into ( ) ;
374374 let value = Self :: u256_to_amount ( value) . in_field ( "value" ) ?;
375375
376376 // If caller is "from", it can spend as much as it wants.
@@ -442,9 +442,9 @@ where
442442 return Err ( RevertReason :: UnknownSelector . into ( ) ) ;
443443 }
444444
445- let caller: Runtime :: AccountId =
446- Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
447- let precompile = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . address ) ;
445+ let caller: Runtime :: AccountId =
446+ Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
447+ let precompile: Runtime :: AccountId = Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . address ) . into ( ) ;
448448 let amount = Self :: u256_to_amount ( handle. context ( ) . apparent_value ) ?;
449449
450450 if amount. into ( ) == U256 :: from ( 0u32 ) {
@@ -484,9 +484,9 @@ where
484484 handle. record_log_costs_manual ( 2 , 32 ) ?;
485485
486486 let account_amount: U256 = {
487- let owner: Runtime :: AccountId =
488- Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) ;
489- pallet_balances:: Pallet :: < Runtime , Instance > :: usable_balance ( & owner) . into ( )
487+ let owner: Runtime :: AccountId =
488+ Runtime :: AddressMapping :: into_account_id ( handle. context ( ) . caller ) . into ( ) ;
489+ pallet_balances:: Pallet :: < Runtime , Instance > :: usable_balance ( & owner) . into ( )
490490 } ;
491491
492492 if value > account_amount {
0 commit comments