Skip to content

Commit e27f83f

Browse files
apollo_l1_gas_price: rename ETH_TO_STRK_QUANTIZATION to ORACLE_PRICE_DECIMALS
1 parent c5109d4 commit e27f83f

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

crates/apollo_integration_tests/src/utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use apollo_http_server::test_utils::create_http_server_config;
5151
use apollo_infra::trace_util::configure_tracing;
5252
use apollo_infra_utils::test_utils::{AvailablePorts, TestIdentifier};
5353
use apollo_l1_events_config::config::{L1EventsProviderConfig, L1EventsScraperConfig};
54-
use apollo_l1_gas_price::eth_to_strk_oracle::ETH_TO_STRK_QUANTIZATION;
54+
use apollo_l1_gas_price::price_oracle::ORACLE_PRICE_DECIMALS;
5555
use apollo_l1_gas_price_config::config::{
5656
L1GasPriceProviderConfig,
5757
L1GasPriceScraperConfig,
@@ -532,7 +532,8 @@ async fn get_price(Query(query): Query<EthToStrkOracleQuery>) -> Json<serde_json
532532
// TODO(Asmaa): Retrun timestamp as price once we start mocking out time in the
533533
// tests.
534534
let price = format!("0x{DEFAULT_ETH_TO_FRI_RATE:x}");
535-
let response = json!({ "timestamp": query.timestamp ,"price": price, "decimals": ETH_TO_STRK_QUANTIZATION });
535+
let response =
536+
json!({ "timestamp": query.timestamp ,"price": price, "decimals": ORACLE_PRICE_DECIMALS });
536537
Json(response)
537538
}
538539

crates/apollo_l1_gas_price/src/price_oracle.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::metrics::{
3030
#[path = "eth_to_strk_oracle_test.rs"]
3131
pub mod eth_to_strk_oracle_test;
3232

33-
pub const ETH_TO_STRK_QUANTIZATION: u64 = 18;
33+
pub const ORACLE_PRICE_DECIMALS: u64 = 18;
3434

3535
fn btreemap_to_headermap(hash_map: BTreeMap<String, String>) -> HeaderMap {
3636
let mut header_map = HeaderMap::new();
@@ -175,11 +175,8 @@ fn resolve_query(body: String) -> Result<u128, PriceOracleClientError> {
175175
return Err(PriceOracleClientError::MissingFieldError("decimals".to_string(), body));
176176
}
177177
};
178-
if decimals != ETH_TO_STRK_QUANTIZATION {
179-
return Err(PriceOracleClientError::InvalidDecimalsError(
180-
ETH_TO_STRK_QUANTIZATION,
181-
decimals,
182-
));
178+
if decimals != ORACLE_PRICE_DECIMALS {
179+
return Err(PriceOracleClientError::InvalidDecimalsError(ORACLE_PRICE_DECIMALS, decimals));
183180
}
184181
ETH_TO_STRK_SUCCESS_COUNT.increment(1);
185182
set_unix_now_seconds(&ETH_TO_STRK_LAST_SUCCESS_TIMESTAMP_SECONDS);

0 commit comments

Comments
 (0)