-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Gas Oracle): Conversion rate component #1319
feat(Gas Oracle): Conversion rate component #1319
Conversation
let mut rng = rand::thread_rng(); | ||
let random_number: u64 = rng.gen_range(1..=100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'll be too volatile for any actual usage. Let's hardcode this as a const for now and later alter the logic as soon as it's needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in latest commit:
async fn get_conversion_rate(extract::Path(_token_address): extract::Path<String>) -> Json<u64> {
tracing::info!("Received request for conversion rate");
Json(42)
}
core/lib/zksync_core/src/lib.rs
Outdated
/// Conversion rate API, for local development. | ||
ConversionRateApi, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to prepend it with Dev
here and everywhere else to clearly indicate that it's a local development utility and not something that is needed for production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few leftovers
// basic handler that responds with a static string | ||
async fn get_conversion_rate(extract::Path(_token_address): extract::Path<String>) -> Json<u64> { | ||
tracing::info!("Received request for conversion rate"); | ||
Json(42) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
core/lib/zksync_core/src/lib.rs
Outdated
@@ -270,6 +273,7 @@ impl FromStr for Components { | |||
"eth_tx_manager" => Ok(Components(vec![Component::EthTxManager])), | |||
"proof_data_handler" => Ok(Components(vec![Component::ProofDataHandler])), | |||
"native_token_fetcher" => Ok(Components(vec![Component::NativeTokenFetcher])), | |||
"conversion_rate_api" => Ok(Components(vec![Component::DevConversionRateApi])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conversion_rate_api
-> dev_conversion_rate_api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
core/lib/zksync_core/src/lib.rs
Outdated
@@ -76,6 +76,7 @@ use crate::{ | |||
}, | |||
}; | |||
|
|||
pub mod api_conversion_rate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api_conversion_rate
-> dev_api_conversion_rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed too.
feaf132
into
matter-labs:lambdaclass_gas_oracle
What ❔
Why ❔
Checklist
zk fmt
andzk lint
.zk spellcheck
.zk linkcheck
.