Skip to content

Commit 54ff5be

Browse files
apollo_l1_gas_price_types: rename EthToStrkOracleClientTrait to PriceOracleClientTrait
1 parent 36d4d38 commit 54ff5be

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

crates/apollo_l1_gas_price/src/eth_to_strk_oracle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::time::Duration;
77
use apollo_config::secrets::Sensitive;
88
use apollo_l1_gas_price_config::config::EthToStrkOracleConfig;
99
use apollo_l1_gas_price_types::errors::PriceOracleClientError;
10-
use apollo_l1_gas_price_types::EthToStrkOracleClientTrait;
10+
use apollo_l1_gas_price_types::PriceOracleClientTrait;
1111
use apollo_metrics::metrics::set_unix_now_seconds;
1212
use async_trait::async_trait;
1313
use futures::FutureExt;
@@ -188,7 +188,7 @@ fn resolve_query(body: String) -> Result<u128, PriceOracleClientError> {
188188
}
189189

190190
#[async_trait]
191-
impl EthToStrkOracleClientTrait for EthToStrkOracleClient {
191+
impl PriceOracleClientTrait for EthToStrkOracleClient {
192192
/// The HTTP response must include the following fields:
193193
/// - `price`: a hexadecimal string representing the price.
194194
/// - `decimals`: a `u64` value, must be equal to `ETH_TO_STRK_QUANTIZATION`.

crates/apollo_l1_gas_price/src/eth_to_strk_oracle_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::Duration;
33

44
use apollo_config::converters::UrlAndHeaders;
55
use apollo_l1_gas_price_types::errors::PriceOracleClientError;
6-
use apollo_l1_gas_price_types::EthToStrkOracleClientTrait;
6+
use apollo_l1_gas_price_types::PriceOracleClientTrait;
77
use mockito::{Mock, ServerGuard};
88
use serde_json::json;
99
use tokio::{self};

crates/apollo_l1_gas_price/src/l1_gas_price_provider.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use apollo_infra_utils::info_every_n_ms;
77
use apollo_l1_gas_price_config::config::L1GasPriceProviderConfig;
88
use apollo_l1_gas_price_types::errors::L1GasPriceProviderError;
99
use apollo_l1_gas_price_types::{
10-
EthToStrkOracleClientTrait,
1110
GasPriceData,
1211
L1GasPriceProviderResult,
1312
PriceInfo,
13+
PriceOracleClientTrait,
1414
};
1515
use async_trait::async_trait;
1616
use starknet_api::block::BlockTimestamp;
@@ -58,13 +58,13 @@ pub struct L1GasPriceProvider {
5858
config: L1GasPriceProviderConfig,
5959
// If received data before initialization (is None), it means the scraper has restarted.
6060
price_samples_by_block: Option<RingBuffer<GasPriceData>>,
61-
eth_to_strk_oracle_client: Arc<dyn EthToStrkOracleClientTrait>,
61+
eth_to_strk_oracle_client: Arc<dyn PriceOracleClientTrait>,
6262
}
6363

6464
impl L1GasPriceProvider {
6565
pub fn new(
6666
config: L1GasPriceProviderConfig,
67-
eth_to_strk_oracle_client: Arc<dyn EthToStrkOracleClientTrait>,
67+
eth_to_strk_oracle_client: Arc<dyn PriceOracleClientTrait>,
6868
) -> Self {
6969
Self { config, price_samples_by_block: None, eth_to_strk_oracle_client }
7070
}

crates/apollo_l1_gas_price/src/l1_gas_price_provider_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::Arc;
22

33
use apollo_l1_gas_price_config::config::L1GasPriceProviderConfig;
4-
use apollo_l1_gas_price_types::{GasPriceData, MockEthToStrkOracleClientTrait, PriceInfo};
4+
use apollo_l1_gas_price_types::{GasPriceData, MockPriceOracleClientTrait, PriceInfo};
55
use starknet_api::block::{BlockTimestamp, GasPrice};
66

77
use crate::l1_gas_price_provider::{L1GasPriceProvider, L1GasPriceProviderError};
@@ -10,7 +10,7 @@ use crate::l1_gas_price_provider::{L1GasPriceProvider, L1GasPriceProviderError};
1010
// To get the prices for the middle three blocks use the timestamp for block[3].
1111
// Returns the provider, a vector of block prices to compare with, and the timestamp of block[3].
1212
fn make_provider() -> (L1GasPriceProvider, Vec<PriceInfo>, u64) {
13-
let eth_to_strk_oracle_client = Arc::new(MockEthToStrkOracleClientTrait::new());
13+
let eth_to_strk_oracle_client = Arc::new(MockPriceOracleClientTrait::new());
1414
let mut provider = L1GasPriceProvider::new(
1515
L1GasPriceProviderConfig { number_of_blocks_for_mean: 3, ..Default::default() },
1616
eth_to_strk_oracle_client,
@@ -116,7 +116,7 @@ fn gas_price_provider_timestamp_changes_mean() {
116116

117117
#[test]
118118
fn gas_price_provider_can_start_at_nonzero_height() {
119-
let eth_to_strk_oracle_client = Arc::new(MockEthToStrkOracleClientTrait::new());
119+
let eth_to_strk_oracle_client = Arc::new(MockPriceOracleClientTrait::new());
120120
let mut provider = L1GasPriceProvider::new(
121121
L1GasPriceProviderConfig { number_of_blocks_for_mean: 3, ..Default::default() },
122122
eth_to_strk_oracle_client,
@@ -129,7 +129,7 @@ fn gas_price_provider_can_start_at_nonzero_height() {
129129

130130
#[test]
131131
fn gas_price_provider_uninitialized_error() {
132-
let eth_to_strk_oracle_client = Arc::new(MockEthToStrkOracleClientTrait::new());
132+
let eth_to_strk_oracle_client = Arc::new(MockPriceOracleClientTrait::new());
133133
let mut provider = L1GasPriceProvider::new(
134134
L1GasPriceProviderConfig { number_of_blocks_for_mean: 3, ..Default::default() },
135135
eth_to_strk_oracle_client,

crates/apollo_l1_gas_price_types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub trait L1GasPriceProviderClient: Send + Sync {
104104

105105
#[cfg_attr(any(feature = "testing", test), automock)]
106106
#[async_trait]
107-
pub trait EthToStrkOracleClientTrait: Send + Sync + Debug {
107+
pub trait PriceOracleClientTrait: Send + Sync + Debug {
108108
/// Fetches the eth to fri rate for a given timestamp.
109109
async fn eth_to_fri_rate(&self, timestamp: u64) -> Result<u128, PriceOracleClientError>;
110110
}

0 commit comments

Comments
 (0)