Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhkovdmitrii committed Jul 12, 2023
1 parent e8db2ac commit 89bf07c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4248,7 +4248,7 @@ impl EthCoin {
// TODO refactor to error_log_passthrough once simple maker bot is merged
let gas_station_price = match &coin.gas_station_url {
Some(url) => {
match GasStationData::get_gas_price(url, coin.gas_station_decimals, &coin.gas_station_policy)
match GasStationData::get_gas_price(url, coin.gas_station_decimals, coin.gas_station_policy.clone())
.compat()
.await
{
Expand Down Expand Up @@ -5002,15 +5002,15 @@ pub struct GasStationData {
}

impl GasStationData {
fn average_gwei(&self, decimals: u8, gas_price_policy: &GasStationPricePolicy) -> NumConversResult<U256> {
fn average_gwei(&self, decimals: u8, gas_price_policy: GasStationPricePolicy) -> NumConversResult<U256> {
let gas_price = match gas_price_policy {
GasStationPricePolicy::MeanAverageFast => ((&self.average + &self.fast) / MmNumber::from(2)).into(),
GasStationPricePolicy::Average => self.average.to_decimal(),
};
wei_from_big_decimal(&gas_price, decimals)
}

fn get_gas_price(uri: &str, decimals: u8, gas_price_policy: &GasStationPricePolicy) -> Web3RpcFut<U256> {
fn get_gas_price(uri: &str, decimals: u8, gas_price_policy: GasStationPricePolicy) -> Web3RpcFut<U256> {
let uri = uri.to_owned();
let fut = async move {
make_gas_station_request(&uri)
Expand Down
4 changes: 2 additions & 2 deletions mm2src/coins/eth/eth_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ fn test_gas_station() {
let res_eth = GasStationData::get_gas_price(
"https://ethgasstation.info/api/ethgasAPI.json",
8,
&GasStationPricePolicy::MeanAverageFast,
GasStationPricePolicy::MeanAverageFast,
)
.wait()
.unwrap();
Expand All @@ -725,7 +725,7 @@ fn test_gas_station() {
let res_polygon = GasStationData::get_gas_price(
"https://gasstation-mainnet.matic.network/",
9,
&GasStationPricePolicy::Average,
GasStationPricePolicy::Average,
)
.wait()
.unwrap();
Expand Down

0 comments on commit 89bf07c

Please sign in to comment.