Skip to content
Snippets Groups Projects
Commit d7b13164 authored by Svyatoslav Nikolsky's avatar Svyatoslav Nikolsky Committed by Bastian Köcher
Browse files

Relayer reward metric (#1742)

* use StorageDoubleMapKeyProvider in RelayerRewards

* add metrics

* clippy

* fixed alerts that have caused missing dashboards

* fix metric name

* fix metric name again

* add new metrics to the RialtoParachain <> Millau maintenance dashboard

* remove obsolete dashboard
parent b06cd924
Branches
No related merge requests found
Showing
with 127 additions and 21 deletions
...@@ -15,6 +15,7 @@ scale-info = { version = "2.1.1", default-features = false, features = ["derive" ...@@ -15,6 +15,7 @@ scale-info = { version = "2.1.1", default-features = false, features = ["derive"
bp-messages = { path = "../../primitives/messages", default-features = false } bp-messages = { path = "../../primitives/messages", default-features = false }
bp-relayers = { path = "../../primitives/relayers", default-features = false } bp-relayers = { path = "../../primitives/relayers", default-features = false }
bp-runtime = { path = "../../primitives/runtime", default-features = false }
# Substrate Dependencies # Substrate Dependencies
...@@ -37,6 +38,7 @@ default = ["std"] ...@@ -37,6 +38,7 @@ default = ["std"]
std = [ std = [
"bp-messages/std", "bp-messages/std",
"bp-relayers/std", "bp-relayers/std",
"bp-runtime/std",
"codec/std", "codec/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#![warn(missing_docs)] #![warn(missing_docs)]
use bp_messages::LaneId; use bp_messages::LaneId;
use bp_relayers::PaymentProcedure; use bp_relayers::{PaymentProcedure, RelayerRewardsKeyProvider};
use bp_runtime::StorageDoubleMapKeyProvider;
use frame_support::sp_runtime::Saturating; use frame_support::sp_runtime::Saturating;
use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero}; use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
use sp_std::marker::PhantomData; use sp_std::marker::PhantomData;
...@@ -46,6 +47,10 @@ pub mod pallet { ...@@ -46,6 +47,10 @@ pub mod pallet {
use frame_support::pallet_prelude::*; use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*; use frame_system::pallet_prelude::*;
/// `RelayerRewardsKeyProvider` for given configuration.
type RelayerRewardsKeyProviderOf<T> =
RelayerRewardsKeyProvider<<T as frame_system::Config>::AccountId, <T as Config>::Reward>;
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// The overarching event type.
...@@ -146,11 +151,11 @@ pub mod pallet { ...@@ -146,11 +151,11 @@ pub mod pallet {
#[pallet::getter(fn relayer_reward)] #[pallet::getter(fn relayer_reward)]
pub type RelayerRewards<T: Config> = StorageDoubleMap< pub type RelayerRewards<T: Config> = StorageDoubleMap<
_, _,
Blake2_128Concat, <RelayerRewardsKeyProviderOf<T> as StorageDoubleMapKeyProvider>::Hasher1,
T::AccountId, <RelayerRewardsKeyProviderOf<T> as StorageDoubleMapKeyProvider>::Key1,
Identity, <RelayerRewardsKeyProviderOf<T> as StorageDoubleMapKeyProvider>::Hasher2,
LaneId, <RelayerRewardsKeyProviderOf<T> as StorageDoubleMapKeyProvider>::Key2,
T::Reward, <RelayerRewardsKeyProviderOf<T> as StorageDoubleMapKeyProvider>::Value,
OptionQuery, OptionQuery,
>; >;
} }
......
...@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" ...@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
# Bridge Dependencies # Bridge Dependencies
bp-messages = { path = "../messages", default-features = false } bp-messages = { path = "../messages", default-features = false }
bp-runtime = { path = "../runtime", default-features = false }
# Substrate Dependencies # Substrate Dependencies
...@@ -27,6 +28,7 @@ hex-literal = "0.3" ...@@ -27,6 +28,7 @@ hex-literal = "0.3"
default = ["std"] default = ["std"]
std = [ std = [
"bp-messages/std", "bp-messages/std",
"bp-runtime/std",
"frame-support/std", "frame-support/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
use bp_messages::LaneId; use bp_messages::LaneId;
use bp_runtime::StorageDoubleMapKeyProvider;
use frame_support::{Blake2_128Concat, Identity};
use sp_runtime::{ use sp_runtime::{
codec::{Decode, Encode}, codec::{Codec, Decode, Encode, EncodeLike},
traits::AccountIdConversion, traits::AccountIdConversion,
}; };
use sp_std::{fmt::Debug, marker::PhantomData}; use sp_std::{fmt::Debug, marker::PhantomData};
...@@ -65,6 +67,24 @@ where ...@@ -65,6 +67,24 @@ where
} }
} }
/// Can be use to access the runtime storage key within the `RelayerRewards` map of the relayers
/// pallet.
pub struct RelayerRewardsKeyProvider<AccountId, Reward>(PhantomData<(AccountId, Reward)>);
impl<AccountId, Reward> StorageDoubleMapKeyProvider for RelayerRewardsKeyProvider<AccountId, Reward>
where
AccountId: Codec + EncodeLike,
Reward: Codec + EncodeLike,
{
const MAP_NAME: &'static str = "RelayerRewards";
type Hasher1 = Blake2_128Concat;
type Key1 = AccountId;
type Hasher2 = Identity;
type Key2 = LaneId;
type Value = Reward;
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
......
...@@ -61,8 +61,8 @@ use crate::{ ...@@ -61,8 +61,8 @@ use crate::{
use bp_messages::LaneId; use bp_messages::LaneId;
use bp_runtime::BalanceOf; use bp_runtime::BalanceOf;
use relay_substrate_client::{ use relay_substrate_client::{
AccountIdOf, AccountKeyPairOf, Chain, ChainWithBalances, ChainWithTransactions, Client, AccountIdOf, AccountKeyPairOf, Chain, ChainWithBalances, ChainWithMessages,
Parachain, ChainWithTransactions, Client, Parachain,
}; };
use relay_utils::metrics::MetricsParams; use relay_utils::metrics::MetricsParams;
use sp_core::Pair; use sp_core::Pair;
...@@ -259,9 +259,9 @@ where ...@@ -259,9 +259,9 @@ where
type Base: Full2WayBridgeBase<Left = Self::Left, Right = Self::Right>; type Base: Full2WayBridgeBase<Left = Self::Left, Right = Self::Right>;
/// The left relay chain. /// The left relay chain.
type Left: ChainWithTransactions + ChainWithBalances + CliChain; type Left: ChainWithTransactions + ChainWithBalances + ChainWithMessages + CliChain;
/// The right relay chain. /// The right relay chain.
type Right: ChainWithTransactions + ChainWithBalances + CliChain; type Right: ChainWithTransactions + ChainWithBalances + ChainWithMessages + CliChain;
/// Left to Right bridge. /// Left to Right bridge.
type L2R: MessagesCliBridge<Source = Self::Left, Target = Self::Right>; type L2R: MessagesCliBridge<Source = Self::Left, Target = Self::Right>;
...@@ -317,28 +317,36 @@ where ...@@ -317,28 +317,36 @@ where
self.mut_base().start_on_demand_headers_relayers().await?; self.mut_base().start_on_demand_headers_relayers().await?;
// add balance-related metrics // add balance-related metrics
let lanes = self
.base()
.common()
.shared
.lane
.iter()
.cloned()
.map(Into::into)
.collect::<Vec<_>>();
{ {
let common = self.mut_base().mut_common(); let common = self.mut_base().mut_common();
substrate_relay_helper::messages_metrics::add_relay_balances_metrics( substrate_relay_helper::messages_metrics::add_relay_balances_metrics::<_, Self::Right>(
common.left.client.clone(), common.left.client.clone(),
&mut common.metrics_params, &mut common.metrics_params,
&common.left.accounts, &common.left.accounts,
&lanes,
) )
.await?; .await?;
substrate_relay_helper::messages_metrics::add_relay_balances_metrics( substrate_relay_helper::messages_metrics::add_relay_balances_metrics::<_, Self::Left>(
common.right.client.clone(), common.right.client.clone(),
&mut common.metrics_params, &mut common.metrics_params,
&common.right.accounts, &common.right.accounts,
&lanes,
) )
.await?; .await?;
} }
let lanes = self.base().common().shared.lane.clone();
// Need 2x capacity since we consider both directions for each lane // Need 2x capacity since we consider both directions for each lane
let mut message_relays = Vec::with_capacity(lanes.len() * 2); let mut message_relays = Vec::with_capacity(lanes.len() * 2);
for lane in lanes { for lane in lanes {
let lane = lane.into();
let left_to_right_messages = substrate_relay_helper::messages_lane::run::< let left_to_right_messages = substrate_relay_helper::messages_lane::run::<
<Self::L2R as MessagesCliBridge>::MessagesLane, <Self::L2R as MessagesCliBridge>::MessagesLane,
>(self.left_to_right().messages_relay_params( >(self.left_to_right().messages_relay_params(
......
...@@ -110,6 +110,7 @@ impl ChainWithTransactions for BridgeHubRococo { ...@@ -110,6 +110,7 @@ impl ChainWithTransactions for BridgeHubRococo {
impl ChainWithMessages for BridgeHubRococo { impl ChainWithMessages for BridgeHubRococo {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME; bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME;
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = None;
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
bp_bridge_hub_rococo::TO_BRIDGE_HUB_ROCOCO_MESSAGE_DETAILS_METHOD; bp_bridge_hub_rococo::TO_BRIDGE_HUB_ROCOCO_MESSAGE_DETAILS_METHOD;
......
...@@ -110,6 +110,7 @@ impl ChainWithTransactions for BridgeHubWococo { ...@@ -110,6 +110,7 @@ impl ChainWithTransactions for BridgeHubWococo {
impl ChainWithMessages for BridgeHubWococo { impl ChainWithMessages for BridgeHubWococo {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME; bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME;
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = None;
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
bp_bridge_hub_wococo::TO_BRIDGE_HUB_WOCOCO_MESSAGE_DETAILS_METHOD; bp_bridge_hub_wococo::TO_BRIDGE_HUB_WOCOCO_MESSAGE_DETAILS_METHOD;
......
...@@ -45,6 +45,8 @@ impl ChainWithGrandpa for Millau { ...@@ -45,6 +45,8 @@ impl ChainWithGrandpa for Millau {
impl ChainWithMessages for Millau { impl ChainWithMessages for Millau {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
bp_millau::WITH_MILLAU_MESSAGES_PALLET_NAME; bp_millau::WITH_MILLAU_MESSAGES_PALLET_NAME;
// TODO (https://github.com/paritytech/parity-bridges-common/issues/1692): change the name
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = Some("BridgeRelayers");
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
bp_millau::TO_MILLAU_MESSAGE_DETAILS_METHOD; bp_millau::TO_MILLAU_MESSAGE_DETAILS_METHOD;
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
......
...@@ -63,6 +63,8 @@ impl ChainWithBalances for RialtoParachain { ...@@ -63,6 +63,8 @@ impl ChainWithBalances for RialtoParachain {
impl ChainWithMessages for RialtoParachain { impl ChainWithMessages for RialtoParachain {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
bp_rialto_parachain::WITH_RIALTO_PARACHAIN_MESSAGES_PALLET_NAME; bp_rialto_parachain::WITH_RIALTO_PARACHAIN_MESSAGES_PALLET_NAME;
// TODO (https://github.com/paritytech/parity-bridges-common/issues/1692): change the name
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = Some("BridgeRelayers");
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
bp_rialto_parachain::TO_RIALTO_PARACHAIN_MESSAGE_DETAILS_METHOD; bp_rialto_parachain::TO_RIALTO_PARACHAIN_MESSAGE_DETAILS_METHOD;
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
......
...@@ -63,6 +63,8 @@ impl ChainWithGrandpa for Rialto { ...@@ -63,6 +63,8 @@ impl ChainWithGrandpa for Rialto {
impl ChainWithMessages for Rialto { impl ChainWithMessages for Rialto {
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str =
bp_rialto::WITH_RIALTO_MESSAGES_PALLET_NAME; bp_rialto::WITH_RIALTO_MESSAGES_PALLET_NAME;
// TODO (https://github.com/paritytech/parity-bridges-common/issues/1692): change the name
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = Some("BridgeRelayers");
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
bp_rialto::TO_RIALTO_MESSAGE_DETAILS_METHOD; bp_rialto::TO_RIALTO_MESSAGE_DETAILS_METHOD;
const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str =
......
...@@ -101,6 +101,16 @@ pub trait ChainWithMessages: Chain { ...@@ -101,6 +101,16 @@ pub trait ChainWithMessages: Chain {
/// the same name. /// the same name.
const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str; const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str;
// TODO (https://github.com/paritytech/parity-bridges-common/issues/1692): check all the names
// after the issue is fixed - all names must be changed
/// Name of the bridge relayers pallet (used in `construct_runtime` macro call) that is deployed
/// at some other chain to bridge with this `ChainWithMessages`.
///
/// We assume that all chains that are bridging with this `ChainWithMessages` are using
/// the same name.
const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str>;
/// Name of the `To<ChainWithMessages>OutboundLaneApi::message_details` runtime API method. /// Name of the `To<ChainWithMessages>OutboundLaneApi::message_details` runtime API method.
/// The method is provided by the runtime that is bridged with this `ChainWithMessages`. /// The method is provided by the runtime that is bridged with this `ChainWithMessages`.
const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str; const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str;
......
...@@ -12,6 +12,7 @@ async-std = "1.9.0" ...@@ -12,6 +12,7 @@ async-std = "1.9.0"
async-trait = "0.1" async-trait = "0.1"
codec = { package = "parity-scale-codec", version = "3.1.5" } codec = { package = "parity-scale-codec", version = "3.1.5" }
futures = "0.3.12" futures = "0.3.12"
hex = "0.4"
num-traits = "0.2" num-traits = "0.2"
log = "0.4.17" log = "0.4.17"
...@@ -20,6 +21,7 @@ log = "0.4.17" ...@@ -20,6 +21,7 @@ log = "0.4.17"
bp-header-chain = { path = "../../primitives/header-chain" } bp-header-chain = { path = "../../primitives/header-chain" }
bp-parachains = { path = "../../primitives/parachains" } bp-parachains = { path = "../../primitives/parachains" }
bp-polkadot-core = { path = "../../primitives/polkadot-core" } bp-polkadot-core = { path = "../../primitives/polkadot-core" }
bp-relayers = { path = "../../primitives/relayers" }
bridge-runtime-common = { path = "../../bin/runtime-common" } bridge-runtime-common = { path = "../../bin/runtime-common" }
finality-grandpa = { version = "0.16.0" } finality-grandpa = { version = "0.16.0" }
......
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
use crate::TaggedAccount; use crate::TaggedAccount;
use bp_messages::LaneId;
use bp_runtime::StorageDoubleMapKeyProvider;
use codec::Decode; use codec::Decode;
use frame_system::AccountInfo; use frame_system::AccountInfo;
use pallet_balances::AccountData; use pallet_balances::AccountData;
use relay_substrate_client::{ use relay_substrate_client::{
metrics::{FloatStorageValue, FloatStorageValueMetric}, metrics::{FloatStorageValue, FloatStorageValueMetric},
AccountIdOf, BalanceOf, Chain, ChainWithBalances, Client, Error as SubstrateError, IndexOf, AccountIdOf, BalanceOf, Chain, ChainWithBalances, ChainWithMessages, Client,
Error as SubstrateError, IndexOf,
}; };
use relay_utils::metrics::{MetricsParams, StandaloneMetric}; use relay_utils::metrics::{MetricsParams, StandaloneMetric};
use sp_core::storage::StorageData; use sp_core::storage::StorageData;
...@@ -31,10 +34,11 @@ use sp_runtime::{FixedPointNumber, FixedU128}; ...@@ -31,10 +34,11 @@ use sp_runtime::{FixedPointNumber, FixedU128};
use std::{convert::TryFrom, fmt::Debug, marker::PhantomData}; use std::{convert::TryFrom, fmt::Debug, marker::PhantomData};
/// Add relay accounts balance metrics. /// Add relay accounts balance metrics.
pub async fn add_relay_balances_metrics<C: ChainWithBalances>( pub async fn add_relay_balances_metrics<C: ChainWithBalances, BC: ChainWithMessages>(
client: Client<C>, client: Client<C>,
metrics: &mut MetricsParams, metrics: &mut MetricsParams,
relay_accounts: &Vec<TaggedAccount<AccountIdOf<C>>>, relay_accounts: &Vec<TaggedAccount<AccountIdOf<C>>>,
lanes: &[LaneId],
) -> anyhow::Result<()> ) -> anyhow::Result<()>
where where
BalanceOf<C>: Into<u128> + std::fmt::Debug, BalanceOf<C>: Into<u128> + std::fmt::Debug,
...@@ -68,13 +72,30 @@ where ...@@ -68,13 +72,30 @@ where
for account in relay_accounts { for account in relay_accounts {
let relay_account_balance_metric = FloatStorageValueMetric::new( let relay_account_balance_metric = FloatStorageValueMetric::new(
FreeAccountBalance::<C> { token_decimals, _phantom: Default::default() }, AccountBalanceFromAccountInfo::<C> { token_decimals, _phantom: Default::default() },
client.clone(), client.clone(),
C::account_info_storage_key(account.id()), C::account_info_storage_key(account.id()),
format!("at_{}_relay_{}_balance", C::NAME, account.tag()), format!("at_{}_relay_{}_balance", C::NAME, account.tag()),
format!("Balance of the {} relay account at the {}", account.tag(), C::NAME), format!("Balance of the {} relay account at the {}", account.tag(), C::NAME),
)?; )?;
relay_account_balance_metric.register_and_spawn(&metrics.registry)?; relay_account_balance_metric.register_and_spawn(&metrics.registry)?;
if let Some(relayers_pallet_name) = BC::WITH_CHAIN_RELAYERS_PALLET_NAME {
for lane in lanes {
let relay_account_reward_metric = FloatStorageValueMetric::new(
AccountBalance::<C> { token_decimals, _phantom: Default::default() },
client.clone(),
bp_relayers::RelayerRewardsKeyProvider::<AccountIdOf<C>, BalanceOf<C>>::final_key(
relayers_pallet_name,
account.id(),
lane,
),
format!("at_{}_relay_{}_reward_for_lane_{}_with_{}", C::NAME, account.tag(), hex::encode(lane.as_ref()), BC::NAME),
format!("Reward of the {} relay account for serving lane {:?} with {} at the {}", account.tag(), lane, BC::NAME, C::NAME),
)?;
relay_account_reward_metric.register_and_spawn(&metrics.registry)?;
}
}
} }
Ok(()) Ok(())
...@@ -82,12 +103,12 @@ where ...@@ -82,12 +103,12 @@ where
/// Adapter for `FloatStorageValueMetric` to decode account free balance. /// Adapter for `FloatStorageValueMetric` to decode account free balance.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
struct FreeAccountBalance<C> { struct AccountBalanceFromAccountInfo<C> {
token_decimals: u32, token_decimals: u32,
_phantom: PhantomData<C>, _phantom: PhantomData<C>,
} }
impl<C> FloatStorageValue for FreeAccountBalance<C> impl<C> FloatStorageValue for AccountBalanceFromAccountInfo<C>
where where
C: Chain, C: Chain,
BalanceOf<C>: Into<u128>, BalanceOf<C>: Into<u128>,
...@@ -110,6 +131,34 @@ where ...@@ -110,6 +131,34 @@ where
} }
} }
/// Adapter for `FloatStorageValueMetric` to decode account free balance.
#[derive(Clone, Debug)]
struct AccountBalance<C> {
token_decimals: u32,
_phantom: PhantomData<C>,
}
impl<C> FloatStorageValue for AccountBalance<C>
where
C: Chain,
BalanceOf<C>: Into<u128>,
{
type Value = FixedU128;
fn decode(
&self,
maybe_raw_value: Option<StorageData>,
) -> Result<Option<Self::Value>, SubstrateError> {
maybe_raw_value
.map(|raw_value| {
BalanceOf::<C>::decode(&mut &raw_value.0[..])
.map_err(SubstrateError::ResponseParseFailed)
.map(|balance| convert_to_token_balance(balance.into(), self.token_decimals))
})
.transpose()
}
}
/// Convert from raw `u128` balance (nominated in smallest chain token units) to the float regular /// Convert from raw `u128` balance (nominated in smallest chain token units) to the float regular
/// tokens value. /// tokens value.
fn convert_to_token_balance(balance: u128, token_decimals: u32) -> FixedU128 { fn convert_to_token_balance(balance: u128, token_decimals: u32) -> FixedU128 {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment