File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,11 @@ where
3535 #[ precompile:: public( "getAlphaPrice(uint16)" ) ]
3636 #[ precompile:: view]
3737 fn get_alpha_price ( _handle : & mut impl PrecompileHandle , netuid : u16 ) -> EvmResult < U256 > {
38- let price =
38+ let current_alpha_price =
3939 <pallet_subtensor_swap:: Pallet < R > as SwapHandler >:: current_alpha_price ( netuid. into ( ) ) ;
40+ let price = current_alpha_price. saturating_mul ( U96F32 :: from_num ( 1_000_000_000 ) ) ;
4041 let price: SubstrateBalance = price. saturating_to_num :: < u64 > ( ) . into ( ) ;
41- let price_eth = <R as pallet_evm:: Config >:: BalanceConverter :: into_evm_balance ( price)
42+ let price_eth = <R as pallet_evm:: Config >:: BalanceConverter :: into_evm_balance ( price. into ( ) )
4243 . map ( |amount| amount. into_u256 ( ) )
4344 . ok_or ( ExitError :: InvalidRange ) ?;
4445
4849 #[ precompile:: public( "getMovingAlphaPrice(uint16)" ) ]
4950 #[ precompile:: view]
5051 fn get_moving_alpha_price ( _handle : & mut impl PrecompileHandle , netuid : u16 ) -> EvmResult < U256 > {
51- let price: U96F32 = pallet_subtensor:: Pallet :: < R > :: get_moving_alpha_price ( netuid. into ( ) ) ;
52+ let moving_alpha_price: U96F32 =
53+ pallet_subtensor:: Pallet :: < R > :: get_moving_alpha_price ( netuid. into ( ) ) ;
54+ let price = moving_alpha_price. saturating_mul ( U96F32 :: from_num ( 1_000_000_000 ) ) ;
5255 let price: SubstrateBalance = price. saturating_to_num :: < u64 > ( ) . into ( ) ;
53- let price_eth = <R as pallet_evm:: Config >:: BalanceConverter :: into_evm_balance ( price)
56+ let price_eth = <R as pallet_evm:: Config >:: BalanceConverter :: into_evm_balance ( price. into ( ) )
5457 . map ( |amount| amount. into_u256 ( ) )
5558 . ok_or ( ExitError :: InvalidRange ) ?;
5659
You can’t perform that action at this time.
0 commit comments