Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gakonst/ethers-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 049036a3fa34f49a94c72eda79e4114b2c60e9f3
Choose a base ref
..
head repository: gakonst/ethers-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 844e57e0cc8ec49b6516150b73f33f03c88be346
Choose a head ref
Showing with 5 additions and 3 deletions.
  1. +2 −0 CHANGELOG.md
  2. +3 −3 ethers-middleware/src/gas_oracle/blocknative.rs
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -237,6 +237,8 @@

- Ensure a consistent chain ID between a Signer and Provider in SignerMiddleware
[#1095](https://gakonst/ethers-rs/pull/1095)
- Add BlockNative gas oracle [#1175](https://github.com/gakonst/ethers-rs/pull/1175)


### 0.6.0

6 changes: 3 additions & 3 deletions ethers-middleware/src/gas_oracle/blocknative.rs
Original file line number Diff line number Diff line change
@@ -49,11 +49,11 @@ impl BlockNativeGasResponse {
Ok(self
.block_prices
.first()
.ok_or_else(|| GasOracleError::InvalidResponse)?
.ok_or(GasOracleError::InvalidResponse)?
.estimated_prices
.iter()
.find(|p| p.confidence == confidence)
.ok_or_else(|| GasOracleError::GasCategoryNotSupported)?
.ok_or(GasOracleError::GasCategoryNotSupported)?
.clone())
}
}
@@ -114,7 +114,7 @@ impl BlockNative {
impl GasOracle for BlockNative {
async fn fetch(&self) -> Result<U256, GasOracleError> {
let prices = self.request().await?.get_estimation_for(&self.gas_category)?;
Ok(U256::from(prices.price * 100 as u64) * U256::from(GWEI_TO_WEI) / U256::from(100))
Ok(U256::from(prices.price * 100_u64) * U256::from(GWEI_TO_WEI) / U256::from(100))
}

async fn estimate_eip1559_fees(&self) -> Result<(U256, U256), GasOracleError> {