@@ -71,7 +71,11 @@ impl StakingPrecompile {
71
71
72
72
let amount_sub =
73
73
<Runtime as pallet_evm:: Config >:: BalanceConverter :: into_substrate_balance ( amount)
74
- . ok_or ( ExitError :: OutOfFund ) ?;
74
+ . ok_or ( PrecompileFailure :: Error {
75
+ exit_status : ExitError :: Other (
76
+ "error converting balance from ETH to subtensor" . into ( ) ,
77
+ ) ,
78
+ } ) ?;
75
79
76
80
let ( hotkey, _) = get_pubkey ( address. as_bytes ( ) ) ?;
77
81
let netuid = try_u16_from_u256 ( netuid) ?;
@@ -96,16 +100,13 @@ impl StakingPrecompile {
96
100
handle. context ( ) . caller ,
97
101
) ;
98
102
99
- let amount_sub =
100
- <Runtime as pallet_evm:: Config >:: BalanceConverter :: into_substrate_balance ( amount)
101
- . ok_or ( ExitError :: OutOfFund ) ?;
102
-
103
103
let ( hotkey, _) = get_pubkey ( address. as_bytes ( ) ) ?;
104
104
let netuid = try_u16_from_u256 ( netuid) ?;
105
+ let amount_unstaked = amount. unique_saturated_into ( ) ;
105
106
let call = RuntimeCall :: SubtensorModule ( pallet_subtensor:: Call :: < Runtime > :: remove_stake {
106
107
hotkey,
107
108
netuid,
108
- amount_unstaked : amount_sub . unique_saturated_into ( ) ,
109
+ amount_unstaked,
109
110
} ) ;
110
111
111
112
try_dispatch_runtime_call ( handle, call, RawOrigin :: Signed ( account_id) )
@@ -161,9 +162,7 @@ impl StakingPrecompile {
161
162
& hotkey, & coldkey, netuid,
162
163
) ;
163
164
164
- // Convert to EVM decimals
165
- <Runtime as pallet_evm:: Config >:: BalanceConverter :: into_evm_balance ( stake. into ( ) )
166
- . ok_or ( ExitError :: InvalidRange . into ( ) )
165
+ Ok ( stake. into ( ) )
167
166
}
168
167
169
168
fn transfer_back_to_caller (
0 commit comments