diff --git a/precompiles/src/alpha.rs b/precompiles/src/alpha.rs index 9dd0379f10..8dcea0e829 100644 --- a/precompiles/src/alpha.rs +++ b/precompiles/src/alpha.rs @@ -35,8 +35,9 @@ where #[precompile::public("getAlphaPrice(uint16)")] #[precompile::view] fn get_alpha_price(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { - let price = + let current_alpha_price = as SwapHandler>::current_alpha_price(netuid.into()); + let price = current_alpha_price.saturating_mul(U96F32::from_num(1_000_000_000)); let price: SubstrateBalance = price.saturating_to_num::().into(); let price_eth = ::BalanceConverter::into_evm_balance(price) .map(|amount| amount.into_u256()) @@ -48,7 +49,9 @@ where #[precompile::public("getMovingAlphaPrice(uint16)")] #[precompile::view] fn get_moving_alpha_price(_handle: &mut impl PrecompileHandle, netuid: u16) -> EvmResult { - let price: U96F32 = pallet_subtensor::Pallet::::get_moving_alpha_price(netuid.into()); + let moving_alpha_price: U96F32 = + pallet_subtensor::Pallet::::get_moving_alpha_price(netuid.into()); + let price = moving_alpha_price.saturating_mul(U96F32::from_num(1_000_000_000)); let price: SubstrateBalance = price.saturating_to_num::().into(); let price_eth = ::BalanceConverter::into_evm_balance(price) .map(|amount| amount.into_u256()) @@ -202,7 +205,8 @@ where } } - let price: SubstrateBalance = sum_alpha_price.saturating_to_num::().into(); + let price = sum_alpha_price.saturating_mul(U96F32::from_num(1_000_000_000)); + let price: SubstrateBalance = price.saturating_to_num::().into(); let price_eth = ::BalanceConverter::into_evm_balance(price) .map(|amount| amount.into_u256()) .ok_or(ExitError::InvalidRange)?; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f6843c50ee..9ece1dd025 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 346, + spec_version: 347, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,