-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Adds retry + usd estimate logic + prevents submission above threshold #105
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
script/bin/operator.rs
Outdated
| N: Network, | ||
| { | ||
| let wei = Unit::ETHER.wei_const().to::<u64>() as f64; | ||
| let gas_estimate = provider.estimate_gas(tx_request.clone()).await.unwrap() as f64; |
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.
This will panic
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.
Added error propagation
|
|
||
| pub async fn fetch_eth_to_usd_rate() -> CoingekoApiResponse { | ||
| pub async fn fetch_usd_rate() -> CoingekoApiResponse { | ||
| let from_token: String = env::var("ASSET_TO_USD_CONVERSION").unwrap_or("ethereum".to_string()); |
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.
This still fetches only the eth usd rate.
Can it be ignored for other chains?
script/bin/operator.rs
Outdated
| message = "USD Gas fee too high!!", | ||
| usd_estimate = round_to_decimals(effective_gas_estimate, 2) | ||
| ); | ||
| sleep_until(Instant::now() + Duration::from_secs(retry_sleep_interval)).await; |
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.
why not tokio::time::sleep(retry_sleep_interval).await;
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.
Can be, no worries.
Description