give real value to Rialto and Millau tokens (#1038)

This commit is contained in:
Svyatoslav Nikolsky
2021-07-02 11:08:35 +03:00
committed by Bastian Köcher
parent fd39d3519e
commit 166b5309e6
3 changed files with 13 additions and 4 deletions
@@ -225,8 +225,8 @@ pub(crate) fn add_standalone_metrics(
metrics_prefix, metrics_prefix,
metrics_params, metrics_params,
source_client, source_client,
None, Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID),
None, Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID),
Some(( Some((
sp_core::storage::StorageKey(millau_runtime::rialto_messages::RialtoToMillauConversionRate::key().to_vec()), sp_core::storage::StorageKey(millau_runtime::rialto_messages::RialtoToMillauConversionRate::key().to_vec()),
millau_runtime::rialto_messages::INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE, millau_runtime::rialto_messages::INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE,
@@ -32,6 +32,15 @@ mod rococo;
mod westend; mod westend;
mod wococo; mod wococo;
// Millau/Rialto tokens have no any real value, so the conversion rate we use is always 1:1. But we want to
// test our code that is intended to work with real-value chains. So to keep it close to 1:1, we'll be treating
// Rialto as BTC and Millau as wBTC (only in relayer).
/// The identifier of token, which value is associated with Rialto token value by relayer.
pub(crate) const RIALTO_ASSOCIATED_TOKEN_ID: &str = "bitcoin";
/// The identifier of token, which value is associated with Millau token value by relayer.
pub(crate) const MILLAU_ASSOCIATED_TOKEN_ID: &str = "wrapped-bitcoin";
use relay_utils::metrics::{FloatJsonValueMetric, MetricsParams, PrometheusError, Registry}; use relay_utils::metrics::{FloatJsonValueMetric, MetricsParams, PrometheusError, Registry};
pub(crate) fn add_polkadot_kusama_price_metrics<T: finality_relay::FinalitySyncPipeline>( pub(crate) fn add_polkadot_kusama_price_metrics<T: finality_relay::FinalitySyncPipeline>(
@@ -224,8 +224,8 @@ pub(crate) fn add_standalone_metrics(
metrics_prefix, metrics_prefix,
metrics_params, metrics_params,
source_client, source_client,
None, Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID),
None, Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID),
Some(( Some((
sp_core::storage::StorageKey(rialto_runtime::millau_messages::MillauToRialtoConversionRate::key().to_vec()), sp_core::storage::StorageKey(rialto_runtime::millau_messages::MillauToRialtoConversionRate::key().to_vec()),
rialto_runtime::millau_messages::INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE, rialto_runtime::millau_messages::INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE,