19
19
20
20
use crate :: {
21
21
chainx_value_shrink, runner:: Runner as RunnerT , AccountCodes , AccountStorages , AddressMapping ,
22
- BlockHashMapping , Config , Error , Event , FeeCalculator , OnChargeEVMTransaction , Pallet ,
22
+ BlockHashMapping , Config , Error , Event , FeeCalculator , OnChargeEVMTransaction , Pallet , BalanceOf
23
23
} ;
24
24
use evm:: {
25
25
backend:: Backend as BackendT ,
@@ -41,7 +41,10 @@ pub struct Runner<T: Config> {
41
41
_marker : PhantomData < T > ,
42
42
}
43
43
44
- impl < T : Config > Runner < T > {
44
+ impl < T : Config > Runner < T >
45
+ where
46
+ BalanceOf < T > : TryFrom < U256 > + Into < U256 > ,
47
+ {
45
48
/// Execute an EVM operation.
46
49
pub fn execute < ' config , ' precompiles , F , R > (
47
50
source : H160 ,
@@ -223,7 +226,10 @@ impl<T: Config> Runner<T> {
223
226
}
224
227
}
225
228
226
- impl < T : Config > RunnerT < T > for Runner < T > {
229
+ impl < T : Config > RunnerT < T > for Runner < T >
230
+ where
231
+ BalanceOf < T > : TryFrom < U256 > + Into < U256 > ,
232
+ {
227
233
type Error = Error < T > ;
228
234
229
235
fn call (
@@ -521,6 +527,8 @@ impl<'vicinity, 'config, T: Config> BackendT for SubstrateStackState<'vicinity,
521
527
522
528
impl < ' vicinity , ' config , T : Config > StackStateT < ' config >
523
529
for SubstrateStackState < ' vicinity , ' config , T >
530
+ where
531
+ BalanceOf < T > : TryFrom < U256 > + Into < U256 > ,
524
532
{
525
533
fn metadata ( & self ) -> & StackSubstateMetadata < ' config > {
526
534
self . substate . metadata ( )
@@ -611,10 +619,12 @@ impl<'vicinity, 'config, T: Config> StackStateT<'config>
611
619
T :: Currency :: transfer (
612
620
& source,
613
621
& target,
614
- value. low_u128 ( ) . unique_saturated_into ( ) ,
622
+ value
623
+ . try_into ( )
624
+ . map_err ( |_| ExitError :: OutOfFund ) ?,
615
625
ExistenceRequirement :: AllowDeath ,
616
626
)
617
- . map_err ( |_| ExitError :: OutOfFund )
627
+ . map_err ( |_| ExitError :: OutOfFund )
618
628
}
619
629
620
630
fn reset_balance ( & mut self , _address : H160 ) {
0 commit comments