From 166b5309e619f49b75ec00b5802187e692c63164 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Fri, 2 Jul 2021 11:08:35 +0300 Subject: [PATCH] give real value to Rialto and Millau tokens (#1038) --- .../src/chains/millau_messages_to_rialto.rs | 4 ++-- bridges/relays/bin-substrate/src/chains/mod.rs | 9 +++++++++ .../src/chains/rialto_messages_to_millau.rs | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs b/bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs index 21a5f6fd27..7761834672 100644 --- a/bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs +++ b/bridges/relays/bin-substrate/src/chains/millau_messages_to_rialto.rs @@ -225,8 +225,8 @@ pub(crate) fn add_standalone_metrics( metrics_prefix, metrics_params, source_client, - None, - None, + Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID), + Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID), Some(( sp_core::storage::StorageKey(millau_runtime::rialto_messages::RialtoToMillauConversionRate::key().to_vec()), millau_runtime::rialto_messages::INITIAL_RIALTO_TO_MILLAU_CONVERSION_RATE, diff --git a/bridges/relays/bin-substrate/src/chains/mod.rs b/bridges/relays/bin-substrate/src/chains/mod.rs index b79bfcaaad..bd228ac7c4 100644 --- a/bridges/relays/bin-substrate/src/chains/mod.rs +++ b/bridges/relays/bin-substrate/src/chains/mod.rs @@ -32,6 +32,15 @@ mod rococo; mod westend; 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}; pub(crate) fn add_polkadot_kusama_price_metrics( diff --git a/bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs b/bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs index 1c0fc0a52e..c2764c20d8 100644 --- a/bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs +++ b/bridges/relays/bin-substrate/src/chains/rialto_messages_to_millau.rs @@ -224,8 +224,8 @@ pub(crate) fn add_standalone_metrics( metrics_prefix, metrics_params, source_client, - None, - None, + Some(crate::chains::RIALTO_ASSOCIATED_TOKEN_ID), + Some(crate::chains::MILLAU_ASSOCIATED_TOKEN_ID), Some(( sp_core::storage::StorageKey(rialto_runtime::millau_messages::MillauToRialtoConversionRate::key().to_vec()), rialto_runtime::millau_messages::INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE,