Skip to content

Commit b85e070

Browse files
authored
feat: add optimism extra cost calculation (#146)
* feat: add oracle address for optimism * feat: add network gas modifier trait * feat: add transformation of tx data to alloy types * feat: support for price modifiers in price calculator * feat: add optimisms trait to support oracle calls * feat: create optimism gas modifier service * refactor: price calculator hashmap support * refactor: use tx data to check if its eip1559 * refactor: remove hashmap of gas modifiers * fix: wrong import * feat: rename to extra fee and implement it on calc * style: remove unused import * feat: use tokio join for multiple calls * feat: rename optimism extra fee service * docs: add docs and comments * refactor: migrate optimism gas price fetching to use EvmProviderTrait * refactor: replace Box dyn with enums * docs: add function docs * refactor(price-calculator): reduce code duplication in price calculator * test: add test coverage for extra fee calculation in gas price bumping * style: rustfmt to file * style: rustfmt to file * fix: clippy issues * fix: clippy issues * ci: remove wrong cli flag * style: remove variable underscore * refactor(price-calculator): use enums instead of option
1 parent d55542d commit b85e070

File tree

15 files changed

+959
-58
lines changed

15 files changed

+959
-58
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ jobs:
182182

183183
- name: Report status
184184
run: cargo clippy --all-features --all-targets -- -D warnings --allow deprecated
185-
--locked
186185

187186
test:
188187
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files

src/config/server_config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ impl ServerConfig {
4444
/// - `RATE_LIMIT_BURST_SIZE` defaults to `300`.
4545
/// - `METRICS_PORT` defaults to `8081`.
4646
pub fn from_env() -> Self {
47-
let conf_dir = env::var("IN_DOCKER")
47+
let conf_dir = if env::var("IN_DOCKER")
4848
.map(|val| val == "true")
4949
.unwrap_or(false)
50-
.then(|| "config/".to_string())
51-
.unwrap_or_else(|| env::var("CONFIG_DIR").unwrap_or_else(|_| "./config".to_string()));
50+
{
51+
"config/".to_string()
52+
} else {
53+
env::var("CONFIG_DIR").unwrap_or_else(|_| "./config".to_string())
54+
};
5255

5356
let conf_dir = format!("{}/", conf_dir.trim_end_matches('/'));
5457

src/constants/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ pub use public_endpoints::*;
1919

2020
mod validation;
2121
pub use validation::*;
22+
23+
mod oracles;
24+
pub use oracles::*;

src/constants/oracles.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub const OPTIMISM_GAS_PRICE_ORACLE_ADDRESS: &str = "0x420000000000000000000000000000000000000F";

src/domain/transaction/evm/evm_transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ mod tests {
732732
max_fee_per_gas: None,
733733
max_priority_fee_per_gas: None,
734734
is_min_bumped: Some(true),
735+
extra_fee: Some(0),
735736
})
736737
});
737738

0 commit comments

Comments
 (0)