1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// SPDX-FileCopyrightText: 2025 Semiotic AI, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//! OP-stack chain support for Odos SDK.
//!
//! This module provides specialized types for OP-stack chains (Optimism, Base,
//! Fraxtal) that give access to L1 gas information in transaction receipts.
//!
//! # L1 Gas Information
//!
//! When executing swaps on OP-stack chains, the total transaction cost includes both L2 execution
//! and L1 data availability costs. The OP-stack receipt types expose this information:
//!
//! ```rust,ignore
//! use odos_sdk::op_stack::OpTransactionReceipt;
//!
//! // After executing a swap on Base/Optimism
//! let receipt: OpTransactionReceipt = /* ... */;
//!
//! // Access L1 gas information
//! if let Some(l1_gas_used) = receipt.l1_gas_used {
//! println!("L1 gas used: {l1_gas_used}");
//! }
//! if let Some(l1_fee) = receipt.l1_fee {
//! println!("L1 fee: {l1_fee}");
//! }
//! if let Some(l1_gas_price) = receipt.l1_gas_price {
//! println!("L1 gas price: {l1_gas_price}");
//! }
//! if let Some(l1_fee_scalar) = receipt.l1_fee_scalar {
//! println!("L1 fee scalar: {l1_fee_scalar}");
//! }
//! ```
//!
//! # Supported OP-stack Chains
//!
//! - **Optimism** (chain ID 10)
//! - **Base** (chain ID 8453)
//! - **Fraxtal** (chain ID 252)
//!
//! # Usage with Standard Routers
//!
//! The standard [`V2Router`](crate::V2Router) and [`V3Router`](crate::V3Router) work on OP-stack
//! chains. To access L1 gas information, create a provider with the `Optimism` network type:
//!
//! ```rust,ignore
//! use odos_sdk::op_stack::Optimism;
//! use alloy_provider::ProviderBuilder;
//!
//! // Create a provider for OP-stack chains
//! let provider = ProviderBuilder::new()
//! .network::<Optimism>()
//! .connect_http("https://mainnet.base.org".parse()?);
//!
//! // Get transaction receipt with L1 gas info
//! let receipt = provider.get_transaction_receipt(tx_hash).await?;
//! if let Some(l1_fee) = receipt.inner.l1_fee {
//! println!("L1 fee paid: {l1_fee}");
//! }
//! ```
pub use Optimism;
pub use OpTransactionReceipt;
/// Checks if a chain ID is an OP-stack chain supported by Odos.
///
/// Returns `true` for Optimism (10), Base (8453), and Fraxtal (252).
pub const