diff --git a/Cargo.lock b/Cargo.lock index 23628c0732..8069c1f926 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -453,7 +453,7 @@ checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -641,7 +641,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -658,7 +658,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "syn-solidity", "tiny-keccak", ] @@ -677,7 +677,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.104", + "syn 2.0.108", "syn-solidity", ] @@ -784,7 +784,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -964,7 +964,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1002,7 +1002,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1120,7 +1120,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1131,7 +1131,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1179,7 +1179,7 @@ checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1861,7 +1861,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "syn_derive", ] @@ -2047,7 +2047,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2203,13 +2203,21 @@ name = "contracts" version = "0.1.0" dependencies = [ "alloy", + "alloy-sol-macro-expander", + "alloy-sol-macro-input", "anyhow", "ethcontract", "ethcontract-generate", "paste", + "prettyplease", + "proc-macro2", + "quote", + "serde", "serde_json", + "syn 2.0.108", "tracing", "tracing-subscriber", + "walkdir", ] [[package]] @@ -2459,7 +2467,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2474,7 +2482,7 @@ dependencies = [ "quote", "serde", "strsim", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2485,7 +2493,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core 0.20.9", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2496,7 +2504,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2628,7 +2636,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "unicode-xid", ] @@ -2640,7 +2648,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "unicode-xid", ] @@ -2817,7 +2825,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2875,7 +2883,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2986,7 +2994,7 @@ dependencies = [ "ethcontract-generate", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -3000,7 +3008,7 @@ dependencies = [ "ethcontract-common", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "url", ] @@ -3290,7 +3298,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4217,7 +4225,7 @@ checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4359,7 +4367,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4589,7 +4597,7 @@ checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4694,7 +4702,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4986,7 +4994,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -5090,6 +5098,16 @@ dependencies = [ "termtree", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.108", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -5154,14 +5172,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -5253,7 +5271,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -5266,7 +5284,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -5328,9 +5346,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.36" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] @@ -5938,6 +5956,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.23" @@ -6109,7 +6136,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6181,7 +6208,7 @@ dependencies = [ "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6746,7 +6773,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6768,9 +6795,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -6786,7 +6813,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6798,7 +6825,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6904,7 +6931,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6915,7 +6942,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7032,7 +7059,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7294,7 +7321,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7567,6 +7594,16 @@ dependencies = [ "libc", ] +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -7644,7 +7681,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -7678,7 +7715,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7798,6 +7835,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -7844,7 +7890,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7855,7 +7901,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -8139,7 +8185,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -8159,5 +8205,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] diff --git a/Cargo.toml b/Cargo.toml index 9da5d9bfaf..1c3fd432ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,6 +99,13 @@ tower-http = "0.4" tracing-opentelemetry = "0.31" tracing-serde = "0.2" vergen = "8" +walkdir = "2.5.0" +quote = "1.0.41" +syn = "2.0.108" +prettyplease = "0.2.37" +proc-macro2 = "1.0.103" +alloy-sol-macro-input = "1.4.1" +alloy-sol-macro-expander = "1.4.1" [workspace.lints] clippy.cast_possible_wrap = "deny" diff --git a/crates/autopilot/src/boundary/events/settlement.rs b/crates/autopilot/src/boundary/events/settlement.rs index 1520b67b21..e58ea68ce9 100644 --- a/crates/autopilot/src/boundary/events/settlement.rs +++ b/crates/autopilot/src/boundary/events/settlement.rs @@ -28,7 +28,7 @@ impl AlloyEventRetrieving for GPv2SettlementContract { Filter::new().address(self.address) } - fn provider(&self) -> &contracts::alloy::Provider { + fn provider(&self) -> &alloy::providers::DynProvider { &self.provider } } diff --git a/crates/autopilot/src/database/ethflow_events/event_retriever.rs b/crates/autopilot/src/database/ethflow_events/event_retriever.rs index f4bcd5e4df..aa7ae2e83a 100644 --- a/crates/autopilot/src/database/ethflow_events/event_retriever.rs +++ b/crates/autopilot/src/database/ethflow_events/event_retriever.rs @@ -29,7 +29,7 @@ impl EthFlowRefundRetriever { impl AlloyEventRetrieving for EthFlowRefundRetriever { type Event = CoWSwapEthFlow::CoWSwapEthFlowEvents; - fn provider(&self) -> &contracts::alloy::Provider { + fn provider(&self) -> &alloy::providers::DynProvider { &self.web3.alloy } diff --git a/crates/autopilot/src/database/onchain_order_events/event_retriever.rs b/crates/autopilot/src/database/onchain_order_events/event_retriever.rs index ed99df97bf..bde093e170 100644 --- a/crates/autopilot/src/database/onchain_order_events/event_retriever.rs +++ b/crates/autopilot/src/database/onchain_order_events/event_retriever.rs @@ -42,7 +42,7 @@ impl AlloyEventRetrieving for CoWSwapOnchainOrdersContract { ])) } - fn provider(&self) -> &contracts::alloy::Provider { + fn provider(&self) -> &alloy::providers::DynProvider { &self.web3.alloy } } diff --git a/crates/autopilot/src/database/onchain_order_events/mod.rs b/crates/autopilot/src/database/onchain_order_events/mod.rs index cdaab8fed3..b460768d80 100644 --- a/crates/autopilot/src/database/onchain_order_events/mod.rs +++ b/crates/autopilot/src/database/onchain_order_events/mod.rs @@ -786,7 +786,7 @@ mod test { super::*, crate::database::Config, alloy::primitives::U256, - contracts::alloy::{CoWSwapOnchainOrders, InstanceExt}, + contracts::alloy::CoWSwapOnchainOrders, database::{byte_array::ByteArray, onchain_broadcasted_orders::OnchainOrderPlacement}, ethcontract::H160, ethrpc::Web3, diff --git a/crates/autopilot/src/infra/blockchain/contracts.rs b/crates/autopilot/src/infra/blockchain/contracts.rs index bae638ad3f..11dd601f51 100644 --- a/crates/autopilot/src/infra/blockchain/contracts.rs +++ b/crates/autopilot/src/infra/blockchain/contracts.rs @@ -6,7 +6,6 @@ use { GPv2AllowListAuthentication, GPv2Settlement, HooksTrampoline, - InstanceExt, WETH9, support::Balances, }, diff --git a/crates/autopilot/src/run.rs b/crates/autopilot/src/run.rs index e59bd23a98..f27d667bc1 100644 --- a/crates/autopilot/src/run.rs +++ b/crates/autopilot/src/run.rs @@ -27,7 +27,7 @@ use { alloy::eips::BlockNumberOrTag, chain::Chain, clap::Parser, - contracts::alloy::{BalancerV2Vault, GPv2Settlement, IUniswapV3Factory, InstanceExt, WETH9}, + contracts::alloy::{BalancerV2Vault, GPv2Settlement, IUniswapV3Factory, WETH9}, ethcontract::H160, ethrpc::{ Web3, diff --git a/crates/contracts/.gitignore b/crates/contracts/.gitignore new file mode 100644 index 0000000000..1884d50914 --- /dev/null +++ b/crates/contracts/.gitignore @@ -0,0 +1,2 @@ +# Generated by build.rs, will contain the contract bindings +src/alloy diff --git a/crates/contracts/Cargo.toml b/crates/contracts/Cargo.toml index dbd069dbe8..04ad803035 100644 --- a/crates/contracts/Cargo.toml +++ b/crates/contracts/Cargo.toml @@ -22,8 +22,9 @@ bin = [ [dependencies] alloy = { workspace = true, features = ["sol-types", "json", "contract", "json-abi"] } -paste = { workspace = true } ethcontract = { workspace = true } +paste = { workspace = true } +serde = { workspace = true } serde_json = { workspace = true } # [bin-dependencies] @@ -33,8 +34,14 @@ tracing = { workspace = true, optional = true } tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"], optional = true } [build-dependencies] -ethcontract = { workspace = true } -ethcontract-generate = { workspace = true } +anyhow = { workspace = true } +alloy-sol-macro-expander = {workspace = true} +alloy-sol-macro-input = {workspace = true, features = ["json"]} +prettyplease = {workspace = true} +proc-macro2 = {workspace = true} +quote = {workspace = true} +syn = {workspace = true} +walkdir = {workspace = true} [lints] workspace = true diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs new file mode 100644 index 0000000000..29bdab7bef --- /dev/null +++ b/crates/contracts/build.rs @@ -0,0 +1,1186 @@ +use { + alloy_sol_macro_expander::expand::expand, + alloy_sol_macro_input::{SolInput, SolInputKind}, + anyhow::{Context, Result}, + networks::*, + proc_macro2::{Span, TokenStream}, + quote::{ToTokens, format_ident}, + std::{ + collections::HashMap, + fmt::Write, + path::{Path, PathBuf}, + }, +}; + +mod networks { + pub const MAINNET: u64 = 1; + pub const GNOSIS: u64 = 100; + pub const SEPOLIA: u64 = 11155111; + pub const ARBITRUM_ONE: u64 = 42161; + pub const BASE: u64 = 8453; + pub const POLYGON: u64 = 137; + pub const AVALANCHE: u64 = 43114; + pub const BNB: u64 = 56; + pub const OPTIMISM: u64 = 10; + pub const LENS: u64 = 232; + pub const LINEA: u64 = 59144; + pub const PLASMA: u64 = 9745; +} + +/// Declare a network tuple with an optional block number. +/// +/// Example, without blocks: +/// ```no_run +/// # #[macro_use] extern crate contracts_generate; +/// # use contracts_generate::networks::{MAINNET, SEPOLIA}; +/// # fn main() { +/// # let _: [(_, (_, Option)); _] = +/// networks! { +/// MAINNET => "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", +/// SEPOLIA => "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", +/// }; +/// # } +/// ``` +/// +/// Example, with blocks: +/// ```no_run +/// # #[macro_use] extern crate contracts_generate; +/// # use contracts_generate::networks::{MAINNET, SEPOLIA}; +/// # fn main() { +/// # let _: [(_, (_, Option)); _] = +/// networks! { +/// MAINNET => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 12593265), +/// SEPOLIA => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 4717488), +/// }; +/// # } +/// ``` +#[macro_export] +macro_rules! networks { + // Entry point: accepts a list of entries and delegates to internal rules + [$( + $id:expr => $value:tt + ),* $(,)?] => { + [$( + networks!(@entry $id => $value) + ),*] + }; + + // Internal rule: handle entry with address and block (parenthesized) + (@entry $id:expr => ($addr:expr, $block:expr)) => { + ($id, ($addr, Some($block))) + }; + + // Internal rule: handle entry with just address + (@entry $id:expr => $value:expr) => { + ($id, ($value, None)) + }; +} + +fn main() { + // NOTE: This is a workaround for `rerun-if-changed` directives for + // non-existent files cause the crate's build unit to get flagged for a + // rebuild if any files in the workspace change. + // + // See: + // - https://github.com/rust-lang/cargo/issues/6003 + // - https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpath + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=artifacts/"); + + // Path to the directory containing the vendored contract artifacts. + let vendored_bindings = Path::new(env!("CARGO_MANIFEST_DIR")) + .join("src") + .join("alloy"); + + Module::default() + // 0x + .add_contract(Contract::new("IZeroex").with_networks(networks![ + MAINNET => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + SEPOLIA => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + ARBITRUM_ONE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + BASE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + AVALANCHE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + BNB => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + OPTIMISM => "0xdef1abe32c034e558cdd535791643c58a13acc10", + POLYGON => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + // Not available on Lens + ])) + // Misc + .add_contract(Contract::new("ERC20")) + .add_contract(Contract::new("ERC20Mintable")) + // GnosisSafe + .add_contract(Contract::new("GnosisSafe")) + .add_contract(Contract::new("GnosisSafeCompatibilityFallbackHandler")) + .add_contract(Contract::new("GnosisSafeProxy")) + .add_contract(Contract::new("GnosisSafeProxyFactory")) + // Balancer V2 + .add_contract(Contract::new("BalancerV2Authorizer")) + .add_contract(Contract::new("BalancerV2BasePool")) + .add_contract(Contract::new("BalancerV2BasePoolFactory")) + .add_contract(Contract::new("BalancerV2WeightedPool")) + .add_contract(Contract::new("BalancerV2StablePool")) + .add_contract(Contract::new("BalancerV2ComposableStablePool")) + .add_contract(Contract::new("BalancerV2LiquidityBootstrappingPool")) + // + .add_contract( + Contract::new("BalancerV2WeightedPoolFactory").with_networks(networks![ + // + MAINNET => ("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9", 12272147), + // Not available on Sepolia (only version ≥ 4) + // + // Not available on Lens + ]), + ) + // + .add_contract( + Contract::new("BalancerV2WeightedPoolFactoryV3").with_networks(networks![ + // + MAINNET => ("0x5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b", 16520627), + // + GNOSIS => ("0xC128a9954e6c874eA3d62ce62B468bA073093F25", 26226256), + // + AVALANCHE => ("0x94f68b54191F62f781Fe8298A8A5Fa3ed772d227", 26389236), + // + OPTIMISM => ("0xA0DAbEBAAd1b243BBb243f933013d560819eB66f", 72832703), + // + POLYGON => ("0x82e4cFaef85b1B6299935340c964C942280327f4", 39036828), + // + BNB => ("0x6e4cF292C5349c79cCd66349c3Ed56357dD11B46", 25474982), + // Not available on Sepolia (only version ≥ 4) + // + // Not available on Lens + ]), + ) + .add_contract( + Contract::new("BalancerV2WeightedPoolFactoryV4").with_networks(networks![ + // + MAINNET => ("0x897888115Ada5773E02aA29F775430BFB5F34c51", 16878323), + // + GNOSIS => ("0x6CaD2ea22BFA7F4C14Aae92E47F510Cd5C509bc7", 27055829), + // + // + SEPOLIA => ("0x7920BFa1b2041911b354747CA7A6cDD2dfC50Cfd", 3424893), + // + ARBITRUM_ONE => ("0xc7E5ED1054A24Ef31D827E6F86caA58B3Bc168d7", 72222060), + // + BASE => ("0x4C32a8a8fDa4E24139B51b456B42290f51d6A1c4", 1204869), + // + AVALANCHE => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 27739006), + // + OPTIMISM => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 82737545), + // + POLYGON => ("0xFc8a407Bba312ac761D8BFe04CE1201904842B76", 40611103), + // + BNB => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 26665331), + // Not available on Base and Lens + // + ]), + ) + // + .add_contract( + Contract::new("BalancerV2WeightedPool2TokensFactory").with_networks(networks![ + // + MAINNET => ("0xa5bf2ddf098bb0ef6d120c98217dd6b141c74ee0", 12349891), + ARBITRUM_ONE => ("0xCF0a32Bbef8F064969F21f7e02328FB577382018", 222864), + // + OPTIMISM => ("0xdAE7e32ADc5d490a43cCba1f0c736033F2b4eFca", 7005512), + // + POLYGON => ("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9", 15832998), + // Not available on Sepolia, Base, Avalanche, BNB and Lens + // + // + ]), + ) + // + .add_contract( + Contract::new("BalancerV2StablePoolFactoryV2").with_networks(networks![ + // + MAINNET => ("0x8df6efec5547e31b0eb7d1291b511ff8a2bf987c", 14934936), + // + GNOSIS => ("0xf23b4DB826DbA14c0e857029dfF076b1c0264843", 25415344), + ARBITRUM_ONE => ("0xEF44D6786b2b4d544b7850Fe67CE6381626Bf2D6", 14244664), + // + OPTIMISM => ("0xeb151668006CD04DAdD098AFd0a82e78F77076c3", 11088891), + // + POLYGON => ("0xcA96C4f198d343E251b1a01F3EBA061ef3DA73C1", 29371951), + // Not available on Sepolia, Base, Avalanche, BNB and Lens + // + // + ]), + ) + // + .add_contract( + Contract::new("BalancerV2LiquidityBootstrappingPoolFactory").with_networks(networks![ + // + MAINNET => ("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE", 12871780), + ARBITRUM_ONE => ("0x142B9666a0a3A30477b052962ddA81547E7029ab", 222870), + // + POLYGON => ("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE", 17116402), + // Not available on Sepolia, Base, Avalanche, BNB, Optimism and Lens + // + // + ]), + ) + // + .add_contract( + Contract::new("BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory") + .with_networks(networks![ + // + MAINNET => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 13730248), + // + // + GNOSIS => ("0x85a80afee867aDf27B50BdB7b76DA70f1E853062", 25415236), + // + // + SEPOLIA => ("0x45fFd460cC6642B8D8Fb12373DFd77Ceb0f4932B", 25415236), + ARBITRUM_ONE => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 4859669), + // + BASE => ("0x0c6052254551EAe3ECac77B01DFcf1025418828f", 1206531), + // + AVALANCHE => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 26386552), + // + BNB => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 22691243), + // + OPTIMISM => ("0xf302f9F50958c5593770FDf4d4812309fF77414f", 7005915), + // + POLYGON => ("0x41B953164995c11C81DA73D212ED8Af25741b7Ac", 22067480), + // Not available on Lens + ]), + ) + .add_contract( + Contract::new("BalancerV2ComposableStablePoolFactory").with_networks(networks![ + // + MAINNET => ("0xf9ac7B9dF2b3454E841110CcE5550bD5AC6f875F", 15485885), + ARBITRUM_ONE => ("0xaEb406b0E430BF5Ea2Dc0B9Fe62E4E53f74B3a33", 23227044), + // + BNB => ("0xf302f9F50958c5593770FDf4d4812309fF77414f", 22691193), + // + OPTIMISM => ("0xf145caFB67081895EE80eB7c04A30Cf87f07b745", 22182522), + // + POLYGON => ("0x136FD06Fa01eCF624C7F2B3CB15742c1339dC2c4", 32774224), + // Not available on Sepolia, Gnosis Chain, Base, Avalanche and Lens + // + // + ]), + ) + .add_contract( + Contract::new("BalancerV2ComposableStablePoolFactoryV3").with_networks(networks![ + // + MAINNET => ("0xdba127fBc23fb20F5929C546af220A991b5C6e01", 16580899), + // + GNOSIS => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 26365805), + ARBITRUM_ONE => ("0x1c99324EDC771c82A0DCCB780CC7DDA0045E50e7", 58948370), + // + BNB => ("0xacAaC3e6D6Df918Bf3c809DFC7d42de0e4a72d4C", 25475700), + // + OPTIMISM => ("0xe2E901AB09f37884BA31622dF3Ca7FC19AA443Be", 72832821), + // + POLYGON => ("0x7bc6C0E73EDAa66eF3F6E2f27b0EE8661834c6C9", 39037615), + // Not available on Sepolia (only version ≥ 4) and on Base (only version ≥ 5) + // + // + // Not available on Lens + ]), + ) + .add_contract( + Contract::new("BalancerV2ComposableStablePoolFactoryV4").with_networks(networks![ + // + MAINNET => ("0xfADa0f4547AB2de89D1304A668C39B3E09Aa7c76", 16878679), + // + GNOSIS => ("0xD87F44Df0159DC78029AB9CA7D7e57E7249F5ACD", 27056416), + // + // + SEPOLIA => ("0xA3fd20E29358c056B727657E83DFd139abBC9924", 3425277), + ARBITRUM_ONE => ("0x2498A2B0d6462d2260EAC50aE1C3e03F4829BA95", 72235860), + // + AVALANCHE => ("0x3B1eb8EB7b43882b385aB30533D9A2BeF9052a98", 29221425), + // + BNB => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 26666380), + // + OPTIMISM => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 82748180), + // + POLYGON => ("0x6Ab5549bBd766A43aFb687776ad8466F8b42f777", 40613553), + // Not available on Base and Lens + // + ]), + ) + .add_contract( + Contract::new("BalancerV2ComposableStablePoolFactoryV5").with_networks(networks![ + // + MAINNET => ("0xDB8d758BCb971e482B2C45f7F8a7740283A1bd3A", 17672478), + // + GNOSIS => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 28900564), + // + // + SEPOLIA => ("0xa523f47A933D5020b23629dDf689695AA94612Dc", 3872211), + ARBITRUM_ONE => ("0xA8920455934Da4D853faac1f94Fe7bEf72943eF1", 110212282), + // + BASE => ("0x8df317a729fcaA260306d7de28888932cb579b88", 1204710), + // + AVALANCHE => ("0xE42FFA682A26EF8F25891db4882932711D42e467", 32478827), + // + BNB => ("0x4fb47126Fa83A8734991E41B942Ac29A3266C968", 29877945), + // + OPTIMISM => ("0x043A2daD730d585C44FB79D2614F295D2d625412", 106752707), + // + POLYGON => ("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b", 44961548), + // Not available on Lens + ]), + ) + .add_contract( + Contract::new("BalancerV2ComposableStablePoolFactoryV6").with_networks(networks![ + // + MAINNET => ("0x5B42eC6D40f7B7965BE5308c70e2603c0281C1E9", 19314764), + // + GNOSIS => ("0x47B489bf5836f83ABD928C316F8e39bC0587B020", 32650879), + // + SEPOLIA => ("0x05503B3aDE04aCA81c8D6F88eCB73Ba156982D2B", 5369821), + // + ARBITRUM_ONE => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 184805448), + // + BASE => ("0x956CCab09898C0AF2aCa5e6C229c3aD4E93d9288", 11099703), + // + AVALANCHE => ("0xb9F8AB3ED3F3aCBa64Bc6cd2DcA74B7F38fD7B88", 42186350), + // + BNB => ("0x6B5dA774890Db7B7b96C6f44e6a4b0F657399E2e", 36485719), + // + OPTIMISM => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 116694338), + // + POLYGON => ("0xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E", 53996258), + // Not available on Lens + ]), + ) + // Balancer addresses can be obtained from: + // + .add_contract(Contract::new("BalancerV2Vault").with_networks(networks![ + // + MAINNET => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 12272146), + // + GNOSIS => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 24821598), + // + SEPOLIA => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 3418831), + // + ARBITRUM_ONE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 222832), + // + BASE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 1196036), + // + AVALANCHE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 26386141), + // + BNB => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 22691002), + // + OPTIMISM => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 7003431), + // + POLYGON => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 15832990), + // Not available on Lens + ])) + .add_contract( + Contract::new("BalancerV3BatchRouter").with_networks(networks![ + // + MAINNET => ("0x136f1EFcC3f8f88516B9E94110D56FDBfB1778d1", 21339510), + // + GNOSIS => ("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b", 37377506), + // + SEPOLIA => ("0xC85b652685567C1B074e8c0D4389f83a2E458b1C", 7219301), + // + ARBITRUM_ONE => ("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E", 297828544), + // + BASE => ("0x85a80afee867aDf27B50BdB7b76DA70f1E853062", 25347205), + // + AVALANCHE => ("0xc9b36096f5201ea332Db35d6D195774ea0D5988f", 59965747), + // + OPTIMISM => ("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E", 133969588), + // Not available on Lens, Polygon, BNB + ]), + ) + // UniV2 + .add_contract(Contract::new("BaoswapRouter").with_networks(networks![ + // https://gnosisscan.io/tx/0xdcbfa037f2c6c7456022df0632ec8d6a75d0f9a195238eec679d5d26895eb7b1 + GNOSIS => "0x6093AeBAC87d62b1A5a4cEec91204e35020E38bE", + ])) + .add_contract(Contract::new("HoneyswapRouter").with_networks(networks![ + GNOSIS => "0x1C232F01118CB8B424793ae03F870aa7D0ac7f77", + ])) + .add_contract(Contract::new("PancakeRouter").with_networks(networks![ + // + MAINNET => "0xEfF92A263d31888d860bD50809A8D171709b7b1c", + // + ARBITRUM_ONE => "0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb", + // + BASE => "0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb", + // + BNB => "0x10ED43C718714eb63d5aA57B78B54704E256024E", + ])) + // + .add_contract(Contract::new("SushiSwapRouter").with_networks(networks![ + // + MAINNET => "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", + // + GNOSIS => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + ARBITRUM_ONE => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + BASE => "0x6bded42c6da8fbf0d2ba55b2fa120c5e0c8d7891", + // + AVALANCHE => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + BNB => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + OPTIMISM => "0x2abf469074dc0b54d793850807e6eb5faf2625b1", + // + POLYGON => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // Not available on Lens + ])) + // + .add_contract(Contract::new("SwaprRouter").with_networks(networks![ + // + MAINNET => "0xb9960d9bca016e9748be75dd52f02188b9d0829f", + // + GNOSIS => "0xE43e60736b1cb4a75ad25240E2f9a62Bff65c0C0", + // + ARBITRUM_ONE => "0x530476d5583724A89c8841eB6Da76E7Af4C0F17E", + // Not available on Base and Lens + ])) + .add_contract(Contract::new("ISwaprPair")) + .add_contract( + Contract::new("TestnetUniswapV2Router02").with_networks(networks![ + // + SEPOLIA => "0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98", + ]), + ) + // + .add_contract(Contract::new("UniswapV2Factory").with_networks(networks![ + // + MAINNET => "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", + // + GNOSIS => "0xA818b4F111Ccac7AA31D0BCc0806d64F2E0737D7", + // + ARBITRUM_ONE => "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9", + // + BASE => "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + // + SEPOLIA => "0xF62c03E08ada871A0bEb309762E260a7a6a880E6", + // + AVALANCHE => "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", + // + BNB => "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + // + OPTIMISM => "0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf", + // + POLYGON => "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", + // Not available on Lens + ])) + // + .add_contract(Contract::new("UniswapV2Router02").with_networks(networks![ + // + MAINNET => "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", + // + GNOSIS => "0x1C232F01118CB8B424793ae03F870aa7D0ac7f77", + // + ARBITRUM_ONE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + BASE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + SEPOLIA => "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3", + // + AVALANCHE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + BNB => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + OPTIMISM => "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2", + // + POLYGON => "0xedf6066a2b290C185783862C7F4776A2C8077AD1", + // Not available on Lens + ])) + .add_contract(Contract::new("IUniswapLikeRouter")) + .add_contract(Contract::new("IUniswapLikePair")) + .add_contract(Contract::new("UniswapV3Pool")) + // + .add_contract(Contract::new("UniswapV3QuoterV2").with_networks(networks![ + MAINNET => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + ARBITRUM_ONE => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + BASE => "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a", + AVALANCHE => "0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F", + BNB => "0x78D78E420Da98ad378D7799bE8f4AF69033EB077", + OPTIMISM => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + POLYGON => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + LENS => "0x1eEA2B790Dc527c5a4cd3d4f3ae8A2DDB65B2af1", + LINEA => "0x42bE4D6527829FeFA1493e1fb9F3676d2425C3C1", + // Not listed on Gnosis and Sepolia chains + ])) + // + .add_contract( + Contract::new("UniswapV3SwapRouterV2").with_networks(networks![ + ARBITRUM_ONE => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + MAINNET => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + POLYGON => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + OPTIMISM => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + BASE => "0x2626664c2603336E57B271c5C0b26F421741e481", + AVALANCHE => "0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE", + BNB => "0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2", + LENS => "0x6ddD32cd941041D8b61df213B9f515A7D288Dc13", + LINEA => "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a", + // Not available on Gnosis Chain + ]), + ) + // + .add_contract(Contract::new("IUniswapV3Factory").with_networks(networks![ + MAINNET => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + SEPOLIA => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + ARBITRUM_ONE => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + BASE => "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", + AVALANCHE => "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", + BNB => "0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7", + OPTIMISM => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + POLYGON => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + // not official + LENS => "0xc3A5b857Ba82a2586A45a8B59ECc3AA50Bc3D0e3", + LINEA => "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", + // Not available on Gnosis Chain + ])) + // + .add_contract(Contract::new("HooksTrampoline").with_networks(networks![ + MAINNET => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + // Gnosis is using the old instance of the hook trampoline since it's hardcoded in gnosis pay rebalance integration. + GNOSIS => "0x01DcB88678aedD0C4cC9552B20F4718550250574", + SEPOLIA => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + ARBITRUM_ONE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + BASE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + AVALANCHE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + BNB => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + OPTIMISM => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + POLYGON => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + LENS => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + LINEA => "0x60bf78233f48ec42ee3f101b9a05ec7878728006", + PLASMA => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + ])) + .add_contract(Contract::new("CoWSwapEthFlow").with_networks(networks![ + // + MAINNET => ("0x40a50cf069e992aa4536211b23f286ef88752187", 16169866), + // + GNOSIS => ("0x40a50cf069e992aa4536211b23f286ef88752187", 25414331), + // + // + SEPOLIA => ("0x0b7795E18767259CC253a2dF471db34c72B49516", 4718739), + // + ARBITRUM_ONE => ("0x6DFE75B5ddce1ADE279D4fa6BD6AeF3cBb6f49dB", 204747458), + // + BASE => ("0x3C3eA1829891BC9bEC3d06A81d5d169e52a415e3", 21490258), + // + AVALANCHE => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 60496408), + // + BNB => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 48411237), + // + OPTIMISM => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 134607215), + // + POLYGON => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 71296258), + // + LENS => ("0xFb337f8a725A142f65fb9ff4902d41cc901de222", 3007173), + // + LINEA => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 24522097), + // + PLASMA => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 3521855), + ])) + .add_contract(Contract::new("CoWSwapOnchainOrders")) + .add_contract(Contract::new("ERC1271SignatureValidator")) + // Used in the gnosis/solvers repo for the balancer solver + .add_contract(Contract::new("BalancerQueries").with_networks(networks![ + // + MAINNET => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 15188261), + // + ARBITRUM_ONE => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 18238624), + // + OPTIMISM => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 15288107), + // + BASE => ("0x300Ab2038EAc391f26D9F895dc61F8F66a548833", 1205869), + // + GNOSIS => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 24821845), + // + POLYGON => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 30988035), + // + AVALANCHE => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 26387068), + // Not available on Lens + ])) + // + .add_contract( + Contract::new("LiquoriceSettlement").with_networks(networks![ + MAINNET => "0x0448633eb8B0A42EfED924C42069E0DcF08fb552", + ARBITRUM_ONE => "0x0448633eb8B0A42EfED924C42069E0DcF08fb552", + ]), + ) + .add_contract(Contract::new("FlashLoanRouter").with_networks(networks![ + MAINNET => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + GNOSIS => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + SEPOLIA => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + ARBITRUM_ONE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + BASE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + POLYGON => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + AVALANCHE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + ])) + .add_contract(Contract::new("ICowWrapper")) + .add_contract(Contract::new("ChainalysisOracle").with_networks(networks![ + MAINNET => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + ARBITRUM_ONE => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + BASE => "0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B", + AVALANCHE => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + BNB => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + OPTIMISM => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + POLYGON => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + ])) + // Only used in + .add_contract(Contract::new("Permit2").with_networks(networks![ + // + MAINNET => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 15986406), + // + GNOSIS => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 27338672), + // + SEPOLIA => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 2356287), + // + ARBITRUM_ONE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 38692735), + // + BASE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 1425180), + // + AVALANCHE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 28844415), + // + BNB => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 25343783), + // + OPTIMISM => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 38854427), + // + POLYGON => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 35701901), + ])) + .add_contract( + Contract::new("GPv2AllowListAuthentication").with_networks(networks![ + // + MAINNET => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 12593263), + // + GNOSIS => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 16465099), + // + SEPOLIA => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 4717469), + // + ARBITRUM_ONE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 204702129), + // + BASE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 21407137), + // + AVALANCHE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 59891351), + // + BNB => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 48173639), + // + OPTIMISM => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 134254466), + // + POLYGON => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 45854728), + // + LENS => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 2612937), + // + LINEA => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 24333100), + // + PLASMA => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 3439709), + ]), + ) + .add_contract(Contract::new("GPv2Settlement").with_networks(networks![ + // + MAINNET => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 12593265), + // + GNOSIS => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 16465100), + // + SEPOLIA => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 4717488), + // + ARBITRUM_ONE => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 204704802), + // + BASE => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 21407238), + // + AVALANCHE => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 59891356), + // + BNB => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 48173641), + // + OPTIMISM => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 134254624), + // + POLYGON => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 45859743), + // + LENS => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 2621745), + // + LINEA => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 24333100), + // + PLASMA => ("0x9008D19f58AAbD9eD0D60971565AA8510560ab41", 3439711), + ])) + // Note: the WETH address must be consistent with the one used by the ETH-flow + // contract + .add_contract(Contract::new("WETH9").with_networks(networks![ + MAINNET => "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + GNOSIS => "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", + SEPOLIA => "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", + ARBITRUM_ONE => "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + BASE => "0x4200000000000000000000000000000000000006", + AVALANCHE => "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + BNB => "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + OPTIMISM => "0x4200000000000000000000000000000000000006", + POLYGON => "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + LENS => "0x6bDc36E20D267Ff0dd6097799f82e78907105e2F", + LINEA => "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f", + PLASMA => "0x6100E367285b01F48D07953803A2d8dCA5D19873", + ])) + .add_submodule( + Submodule::new("cow_amm") + .add_contract(Contract::new("CowAmm")) + .add_contract(Contract::new("CowAmmConstantProductFactory").with_networks( + networks![ + // + MAINNET => ("0x40664207e3375FB4b733d4743CE9b159331fd034", 19861952), + // + GNOSIS => ("0xdb1cba3a87f2db53b6e1e6af48e28ed877592ec0", 33874317), + // + SEPOLIA => ("0xb808e8183e3a72d196457d127c7fd4befa0d7fd3", 5874562), + ], + )) + .add_contract(Contract::new("CowAmmLegacyHelper").with_networks(networks![ + // + MAINNET => ("0x3705ceee5eaa561e3157cf92641ce28c45a3999c", 20332745), + // + GNOSIS => ("0xd9ec06b001957498ab1bc716145515d1d0e30ffb", 35026999), + ])) + .add_contract(Contract::new("CowAmmUniswapV2PriceOracle")) + .add_contract(Contract::new("CowAmmFactoryGetter")), + ) + .add_submodule( + Submodule::new("test") // Test Contract for using up a specified amount of gas. + .add_contract(Contract::new("GasHog")) + // Test Contract for incrementing arbitrary counters. + .add_contract(Contract::new("Counter")) + // Token with support for `permit` (for pre-interaction tests) + .add_contract(Contract::new("CowProtocolToken").with_networks(networks![ + MAINNET => "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB", + GNOSIS => "0x177127622c4A00F3d409B75571e12cB3c8973d3c", + SEPOLIA => "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59", + ARBITRUM_ONE => "0xcb8b5CD20BdCaea9a010aC1F8d835824F5C87A04", + BASE => "0xc694a91e6b071bF030A18BD3053A7fE09B6DaE69", + ])), + ) + .add_submodule( + Submodule::new("support") // support module + // Support contracts used for trade and token simulations. + .add_contract(Contract::new("AnyoneAuthenticator")) + .add_contract(Contract::new("Solver")) + .add_contract(Contract::new("Spardose")) + .add_contract(Contract::new("Trader")) + // Support contract used for solver fee simulations in the gnosis/solvers repo. + .add_contract(Contract::new("Swapper")) + .add_contract(Contract::new("Signatures").with_networks(networks![ + MAINNET => "0x8262d639c38470F38d2eff15926F7071c28057Af", + ARBITRUM_ONE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + BASE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + AVALANCHE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + BNB => "0x8262d639c38470F38d2eff15926F7071c28057Af", + OPTIMISM => "0x8262d639c38470F38d2eff15926F7071c28057Af", + POLYGON => "0x8262d639c38470F38d2eff15926F7071c28057Af", + LENS => "0x8262d639c38470F38d2eff15926F7071c28057Af", + GNOSIS => "0x8262d639c38470F38d2eff15926F7071c28057Af", + SEPOLIA => "0x8262d639c38470F38d2eff15926F7071c28057Af", + // built with evm=London, because deployment reverts on Linea otherwise + LINEA => "0xf6E57e72F7dB3D9A51a8B4c149C00475b94A37e4", + PLASMA => "0x8262d639c38470F38d2eff15926F7071c28057Af", + ])) + // Support contracts used for various order simulations. + .add_contract(Contract::new("Balances").with_networks(networks![ + MAINNET => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + ARBITRUM_ONE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + BASE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + AVALANCHE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + BNB => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + OPTIMISM => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + POLYGON => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + LENS => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + GNOSIS => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + SEPOLIA => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + PLASMA => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + // built with evm=London, because deployment reverts on Linea otherwise + LINEA => "0x361350f708f7c0c63c8a505226592c3e5d1faa29", + ])), + ) + .write_formatted(Path::new("artifacts"), true, vendored_bindings) + .unwrap(); +} + +// Codegen implementation starts here + +const MOD_HEADER: &str = r#"#![allow(unused_imports, unused_attributes, clippy::all, rustdoc::all, non_snake_case)] + //! This module contains the sol! generated bindings for solidity contracts. + //! This is autogenerated code. + //! Do not manually edit these files. + //! These files may be overwritten by the codegen system at any time. + "#; + +#[derive(Default)] +pub struct Module { + pub contracts: Vec, + submodules: Vec, +} + +impl Module { + pub fn add_contract(mut self, contract: Contract) -> Self { + self.contracts.push(contract); + self + } + + pub fn add_submodule(mut self, module: Submodule) -> Self { + self.submodules.push(module); + self + } + + pub fn write_formatted( + self, + bindings_folder: P1, + all_derives: bool, + output_folder: P2, + ) -> anyhow::Result<()> + where + P1: AsRef, + P2: AsRef, + { + std::fs::create_dir_all(&output_folder)?; + + let mut mod_file = String::from(MOD_HEADER); + for submodule in self.submodules { + write_mod_name(&mut mod_file, &submodule.name)?; + submodule.write_formatted(bindings_folder.as_ref(), all_derives, &output_folder)?; + } + + for contract in self.contracts { + let name = contract.name.clone(); + contract.write_formatted(bindings_folder.as_ref(), all_derives, &output_folder)?; + write_mod_name(&mut mod_file, &name)?; + } + + let file: syn::File = syn::parse_file(&mod_file)?; + let formatted = prettyplease::unparse(&file); + std::fs::write(output_folder.as_ref().join("mod.rs"), formatted)?; + + Ok(()) + } +} + +pub struct Submodule { + pub name: String, + pub contracts: Vec, + submodules: Vec, +} + +impl Submodule { + pub fn new(name: S) -> Self { + Self { + name: name.to_string(), + contracts: vec![], + submodules: vec![], + } + } + + pub fn add_contract(mut self, contract: Contract) -> Self { + self.contracts.push(contract); + self + } + + pub fn add_submodule(mut self, module: Submodule) -> Self { + self.submodules.push(module); + self + } + + pub fn write_formatted( + self, + bindings_folder: P1, + all_derives: bool, + output_folder: P2, + ) -> anyhow::Result<()> + where + P1: AsRef, + P2: AsRef, + { + let output_folder = output_folder.as_ref().join(self.name); + std::fs::create_dir_all(&output_folder)?; + + let mut mod_file = String::from(MOD_HEADER); + for submodule in self.submodules { + write_mod_name(&mut mod_file, &submodule.name)?; + submodule.write_formatted(bindings_folder.as_ref(), all_derives, &output_folder)?; + } + + for contract in self.contracts { + let name = contract.name.clone(); + contract.write_formatted(bindings_folder.as_ref(), all_derives, &output_folder)?; + write_mod_name(&mut mod_file, &name)?; + } + + let file: syn::File = syn::parse_file(&mod_file)?; + let formatted = prettyplease::unparse(&file); + std::fs::write(output_folder.join("mod.rs"), formatted)?; + + Ok(()) + } +} + +pub struct Contract { + pub name: String, + networks: HashMap)>, +} + +impl Contract { + pub fn new>(name: S) -> Self { + Self { + name: name.as_ref().to_string(), + networks: HashMap::new(), + } + } + + pub fn with_networks(mut self, networks: I) -> Self + where + S: AsRef, + I: IntoIterator))>, + { + for (id, (address, block_number)) in networks.into_iter() { + self.networks + .insert(id, (address.as_ref().to_string(), block_number)); + } + self + } + + fn bindings_path(&self, bindings_folder: &Path) -> PathBuf { + bindings_folder.join(&self.name).with_extension("json") + } + + pub fn generate>( + self, + bindings_folder: P, + all_derives: bool, + ) -> anyhow::Result { + let bindings_path = self.bindings_path(bindings_folder.as_ref()); + let mut macrogen = SolMacroGen::new(bindings_path, self.name.clone()); + generate_binding(&mut macrogen, all_derives)?; + let mut expansion = macrogen + .expansion + .expect("if the expansion failed, it should have errored earlier"); + + let module_name_ident = format_ident!("{}", self.name); + let instance_name_ident = format_ident!("{}Instance", self.name); + let instance = quote::quote! { + pub type Instance = #module_name_ident :: #instance_name_ident<::alloy::providers::DynProvider>; + }; + expansion.extend(instance); + + let no_networks = self.networks.is_empty(); + let networks = self.networks.into_iter().map(NetworkArm::from); + let deployment_info = if no_networks { + proc_macro2::TokenStream::new() + } else { + quote::quote! { + use { + std::{ + sync::LazyLock, + collections::HashMap + }, + anyhow::{Result, Context}, + alloy::{ + providers::{Provider, DynProvider}, + primitives::{address, Address}, + }, + }; + + pub const fn deployment_info(chain_id: u64) -> Option<(Address, Option)> { + match chain_id { + #( #networks ,)* + _ => None + } + } + + /// Returns the contract's deployment address (if one exists) for the given chain. + pub const fn deployment_address(chain_id: &u64) -> Option<::alloy::primitives::Address> { + match deployment_info(*chain_id) { + Some((address, _)) => Some(address), + None => None, + } + } + + /// Returns the contract's deployment block (if one exists) for the given chain. + pub const fn deployment_block(chain_id: &u64) -> Option { + match deployment_info(*chain_id) { + Some((_, block)) => block, + None => None, + } + } + + impl Instance { + pub fn deployed(provider: &DynProvider) -> impl Future> + Send { + async move { + let chain_id = provider + .get_chain_id() + .await + .context("could not fetch current chain id")?; + + let (address, _deployed_block) = deployment_info(chain_id) + .with_context(|| format!("no deployment info for chain {chain_id:?}"))?; + + Ok(Instance::new( + address, + provider.clone(), + )) + } + } + } + } + }; + expansion.extend(deployment_info); + + Ok(expansion) + } + + pub fn write_formatted( + self, + bindings_folder: P1, + all_derives: bool, + output_folder: P2, + ) -> anyhow::Result<()> + where + P1: AsRef, + P2: AsRef, + { + let name = self.name.clone(); + let token_stream = self.generate(bindings_folder, all_derives)?; + let mut buffer = String::new(); + write!(buffer, "{}", token_stream)?; + let file: syn::File = syn::parse_file(&buffer)?; + let formatted = prettyplease::unparse(&file); + std::fs::write( + output_folder.as_ref().join(name).with_extension("rs"), + formatted, + )?; + Ok(()) + } +} + +fn generate_binding(instance: &mut SolMacroGen, all_derives: bool) -> anyhow::Result<()> { + let input = instance + .get_sol_input() + .map_err(|err| anyhow::anyhow!("{:?}", err))? + .normalize_json() + .map_err(|err| anyhow::anyhow!("{:?}", err))?; + let SolInput { + attrs: _, + path: _, + kind, + } = input; + + let tokens = match kind { + SolInputKind::Sol(mut file) => { + let sol_attr: syn::Attribute = if all_derives { + syn::parse_quote! { + #[sol(rpc, alloy_sol_types = alloy::sol_types, alloy_contract = + alloy::contract, all_derives = true, extra_derives(serde::Serialize, + serde::Deserialize))] } + } else { + syn::parse_quote! { + #[sol(rpc, alloy_sol_types = alloy::sol_types, alloy_contract = + alloy::contract)] } + }; + file.attrs.push(sol_attr); + expand(file)? + } + _ => unreachable!(), + }; + + instance.expansion = Some(tokens); + Ok(()) +} + +fn write_mod_name(contents: &mut String, name: &str) -> anyhow::Result<()> { + if syn::parse_str::(&format!("pub mod {name};")).is_ok() { + write!(contents, "pub mod {name};")?; + } else { + write!(contents, "pub mod r#{name};")?; + } + Ok(()) +} + +/// Wrapper to avoid destructuring the vector of tuples into three iterators. +/// +/// The following code: +/// ```ignore +/// // We need to "destructure" the iterator into several due to +/// let chain_ids = self.networks.iter().map(|n| n.0); +/// let addresses = self.networks.iter().map(|n| n.1.0.clone()); +/// let blocks = self.networks.iter().map(|n| match n.1.1 { +/// Some(block) => quote::quote! {Some (#block)}, +/// None => quote::quote! {None}, +/// }); +/// // ... +/// quote::quote! { +/// pub const fn deployment_info(chain_id: u64) -> Option<(Address, Option)> { +/// match chain_id { +/// #(#chain_id => Some((::alloy::primitives::address!(#address), #block_number)),)* +/// _ => None +/// } +/// } +/// } +/// ``` +/// +/// Becomes: +/// ```ignore +/// let networks = self.networks.into_iter().map(NetworkArm::from); +/// // ... +/// quote::quote! { +/// pub const fn deployment_info(chain_id: u64) -> Option<(Address, Option)> { +/// match chain_id { +/// #( #networks ,)* +/// _ => None +/// } +/// } +/// } +/// ``` +struct NetworkArm(u64, (String, Option)); + +impl ToTokens for NetworkArm { + fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { + let chain_id = self.0; + let address = &self.1.0; + let block_number = match self.1.1 { + Some(block) => quote::quote! {Some (#block)}, + None => quote::quote! {None}, + }; + tokens.extend(quote::quote! { + #chain_id => Some((::alloy::primitives::address!(#address), #block_number)) + }); + } +} + +impl From<(u64, (String, Option))> for NetworkArm { + fn from((chain_id, info): (u64, (String, Option))) -> Self { + Self(chain_id, info) + } +} + +/// SolMacroGen implementation vendored from +/// +/// to avoid depending on forge-sol-macro-gen. +pub struct SolMacroGen { + pub path: PathBuf, + pub name: String, + pub expansion: Option, +} + +impl SolMacroGen { + pub fn new(path: PathBuf, name: String) -> Self { + Self { + path, + name, + expansion: None, + } + } + + pub fn get_sol_input(&self) -> Result { + let path = self.path.to_string_lossy().into_owned(); + let name = proc_macro2::Ident::new(&self.name, Span::call_site()); + let tokens = quote::quote! { + #[sol(ignore_unlinked)] + #name, + #path + }; + + let sol_input: SolInput = syn::parse2(tokens).context("failed to parse input")?; + + Ok(sol_input) + } +} diff --git a/crates/contracts/src/alloy.rs b/crates/contracts/src/alloy.rs deleted file mode 100644 index 2729993c66..0000000000 --- a/crates/contracts/src/alloy.rs +++ /dev/null @@ -1,988 +0,0 @@ -pub mod networks { - pub const MAINNET: u64 = 1; - pub const GNOSIS: u64 = 100; - pub const SEPOLIA: u64 = 11155111; - pub const ARBITRUM_ONE: u64 = 42161; - pub const BASE: u64 = 8453; - pub const POLYGON: u64 = 137; - pub const AVALANCHE: u64 = 43114; - pub const BNB: u64 = 56; - pub const OPTIMISM: u64 = 10; - pub const LENS: u64 = 232; - pub const LINEA: u64 = 59144; - pub const PLASMA: u64 = 9745; -} - -crate::bindings!( - ChainalysisOracle, - crate::deployments! { - MAINNET => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ARBITRUM_ONE => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - BASE => address!("0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B"), - AVALANCHE => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - BNB => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - OPTIMISM => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - POLYGON => address!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - } -); - -crate::bindings!( - IZeroex, - crate::deployments! { - MAINNET => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - SEPOLIA => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - ARBITRUM_ONE => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - BASE => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - AVALANCHE => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - BNB => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - OPTIMISM => address!("0xdef1abe32c034e558cdd535791643c58a13acc10"), - POLYGON => address!("0xdef1c0ded9bec7f1a1670819833240f027b25eff"), - // Not available on Lens - } -); - -crate::bindings!(ERC20Mintable); - -crate::bindings!(GnosisSafe); -crate::bindings!(GnosisSafeCompatibilityFallbackHandler); -crate::bindings!(GnosisSafeProxy); -crate::bindings!(GnosisSafeProxyFactory); - -crate::bindings!(BalancerV2Authorizer); -crate::bindings!(BalancerV2BasePool); -crate::bindings!(BalancerV2BasePoolFactory); -crate::bindings!(BalancerV2WeightedPool); -crate::bindings!(BalancerV2StablePool); -crate::bindings!(BalancerV2ComposableStablePool); -crate::bindings!(BalancerV2LiquidityBootstrappingPool); -crate::bindings!( - BalancerV2WeightedPoolFactory, - // - crate::deployments! { - // - MAINNET => (address!("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9"), 12272147) - // Not available on Sepolia (only version ≥ 4) - // - // Not available on Lens - } -); -crate::bindings!( - BalancerV2WeightedPoolFactoryV3, - // - crate::deployments! { - // - MAINNET => (address!("0x5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b"), 16520627), - // - GNOSIS => (address!("0xC128a9954e6c874eA3d62ce62B468bA073093F25"), 26226256), - // - AVALANCHE => (address!("0x94f68b54191F62f781Fe8298A8A5Fa3ed772d227"), 26389236), - // - OPTIMISM => (address!("0xA0DAbEBAAd1b243BBb243f933013d560819eB66f"), 72832703), - // - POLYGON => (address!("0x82e4cFaef85b1B6299935340c964C942280327f4"), 39036828), - // - BNB => (address!("0x6e4cF292C5349c79cCd66349c3Ed56357dD11B46"), 25474982), - // Not available on Sepolia (only version ≥ 4) - // - // Not available on Lens - } -); -crate::bindings!( - BalancerV2WeightedPoolFactoryV4, - crate::deployments! { - // - MAINNET => (address!("0x897888115Ada5773E02aA29F775430BFB5F34c51"), 16878323), - // - GNOSIS => (address!("0x6CaD2ea22BFA7F4C14Aae92E47F510Cd5C509bc7"), 27055829), - // - // - SEPOLIA => (address!("0x7920BFa1b2041911b354747CA7A6cDD2dfC50Cfd"), 3424893), - // - ARBITRUM_ONE => (address!("0xc7E5ED1054A24Ef31D827E6F86caA58B3Bc168d7"), 72222060), - // - BASE => (address!("0x4C32a8a8fDa4E24139B51b456B42290f51d6A1c4"), 1204869), - // - AVALANCHE => (address!("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a"), 27739006), - // - OPTIMISM => (address!("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a"), 82737545), - // - POLYGON => (address!("0xFc8a407Bba312ac761D8BFe04CE1201904842B76"), 40611103), - // - BNB => (address!("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a"), 26665331), - // Not available on Base and Lens - // - } -); -crate::bindings!( - BalancerV2WeightedPool2TokensFactory, - // - crate::deployments! { - // - MAINNET => (address!("0xa5bf2ddf098bb0ef6d120c98217dd6b141c74ee0"), 12349891), - ARBITRUM_ONE => (address!("0xCF0a32Bbef8F064969F21f7e02328FB577382018"), 222864), - // - OPTIMISM => (address!("0xdAE7e32ADc5d490a43cCba1f0c736033F2b4eFca"), 7005512), - // - POLYGON => (address!("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9"), 15832998), - // Not available on Sepolia, Base, Avalanche, BNB and Lens - // - // - } -); -crate::bindings!( - BalancerV2StablePoolFactoryV2, - // - crate::deployments! { - // - MAINNET => (address!("0x8df6efec5547e31b0eb7d1291b511ff8a2bf987c"), 14934936), - // - GNOSIS => (address!("0xf23b4DB826DbA14c0e857029dfF076b1c0264843"), 25415344), - ARBITRUM_ONE => (address!("0xEF44D6786b2b4d544b7850Fe67CE6381626Bf2D6"), 14244664), - // - OPTIMISM => (address!("0xeb151668006CD04DAdD098AFd0a82e78F77076c3"), 11088891), - // - POLYGON => (address!("0xcA96C4f198d343E251b1a01F3EBA061ef3DA73C1"), 29371951), - // Not available on Sepolia, Base, Avalanche, BNB and Lens - // - // - } -); -crate::bindings!( - BalancerV2LiquidityBootstrappingPoolFactory, - // - crate::deployments! { - // - MAINNET => (address!("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE"), 12871780), - ARBITRUM_ONE => (address!("0x142B9666a0a3A30477b052962ddA81547E7029ab"), 222870), - // - POLYGON => (address!("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE"), 17116402), - // Not available on Sepolia, Base, Avalanche, BNB, Optimism and Lens - // - // - } -); -crate::bindings!( - BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory, - // - crate::deployments! { - // - MAINNET => (address!("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e"), 13730248), - // - // - GNOSIS => (address!("0x85a80afee867aDf27B50BdB7b76DA70f1E853062"), 25415236), - // - // - SEPOLIA => (address!("0x45fFd460cC6642B8D8Fb12373DFd77Ceb0f4932B"), 25415236), - ARBITRUM_ONE => (address!("0x1802953277FD955f9a254B80Aa0582f193cF1d77"), 4859669), - // - BASE => (address!("0x0c6052254551EAe3ECac77B01DFcf1025418828f"), 1206531), - // - AVALANCHE => (address!("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e"), 26386552), - // - BNB => (address!("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD"), 22691243), - // - OPTIMISM => (address!("0xf302f9F50958c5593770FDf4d4812309fF77414f"), 7005915), - // - POLYGON => (address!("0x41B953164995c11C81DA73D212ED8Af25741b7Ac"), 22067480), - // Not available on Lens - } -); -crate::bindings!( - BalancerV2ComposableStablePoolFactory, - crate::deployments! { - // - MAINNET => (address!("0xf9ac7B9dF2b3454E841110CcE5550bD5AC6f875F"), 15485885), - ARBITRUM_ONE => (address!("0xaEb406b0E430BF5Ea2Dc0B9Fe62E4E53f74B3a33"), 23227044), - // - BNB => (address!("0xf302f9F50958c5593770FDf4d4812309fF77414f"), 22691193), - // - OPTIMISM => (address!("0xf145caFB67081895EE80eB7c04A30Cf87f07b745"), 22182522), - // - POLYGON => (address!("0x136FD06Fa01eCF624C7F2B3CB15742c1339dC2c4"), 32774224), - // Not available on Sepolia, Gnosis Chain, Base, Avalanche and Lens - // - // - } -); -crate::bindings!( - BalancerV2ComposableStablePoolFactoryV3, - crate::deployments! { - // - MAINNET => (address!("0xdba127fBc23fb20F5929C546af220A991b5C6e01"), 16580899), - // - GNOSIS => (address!("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD"), 26365805), - ARBITRUM_ONE => (address!("0x1c99324EDC771c82A0DCCB780CC7DDA0045E50e7"), 58948370), - // - BNB => (address!("0xacAaC3e6D6Df918Bf3c809DFC7d42de0e4a72d4C"), 25475700), - // - OPTIMISM => (address!("0xe2E901AB09f37884BA31622dF3Ca7FC19AA443Be"), 72832821), - // - POLYGON => (address!("0x7bc6C0E73EDAa66eF3F6E2f27b0EE8661834c6C9"), 39037615), - // Not available on Sepolia (only version ≥ 4) and on Base (only version ≥ 5) - // - // - // Not available on Lens - } -); -crate::bindings!( - BalancerV2ComposableStablePoolFactoryV4, - crate::deployments! { - // - MAINNET => (address!("0xfADa0f4547AB2de89D1304A668C39B3E09Aa7c76"), 16878679), - // - GNOSIS => (address!("0xD87F44Df0159DC78029AB9CA7D7e57E7249F5ACD"), 27056416), - // - // - SEPOLIA => (address!("0xA3fd20E29358c056B727657E83DFd139abBC9924"), 3425277), - ARBITRUM_ONE => (address!("0x2498A2B0d6462d2260EAC50aE1C3e03F4829BA95"), 72235860), - // - AVALANCHE => (address!("0x3B1eb8EB7b43882b385aB30533D9A2BeF9052a98"), 29221425), - // - BNB => (address!("0x1802953277FD955f9a254B80Aa0582f193cF1d77"), 26666380), - // - OPTIMISM => (address!("0x1802953277FD955f9a254B80Aa0582f193cF1d77"), 82748180), - // - POLYGON => (address!("0x6Ab5549bBd766A43aFb687776ad8466F8b42f777"), 40613553), - // Not available on Base and Lens - // - } -); -crate::bindings!( - BalancerV2ComposableStablePoolFactoryV5, - crate::deployments! { - // - MAINNET => (address!("0xDB8d758BCb971e482B2C45f7F8a7740283A1bd3A"), 17672478), - // - GNOSIS => (address!("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7"), 28900564), - // - // - SEPOLIA => (address!("0xa523f47A933D5020b23629dDf689695AA94612Dc"), 3872211), - ARBITRUM_ONE => (address!("0xA8920455934Da4D853faac1f94Fe7bEf72943eF1"), 110212282), - // - BASE => (address!("0x8df317a729fcaA260306d7de28888932cb579b88"), 1204710), - // - AVALANCHE => (address!("0xE42FFA682A26EF8F25891db4882932711D42e467"), 32478827), - // - BNB => (address!("0x4fb47126Fa83A8734991E41B942Ac29A3266C968"), 29877945), - // - OPTIMISM => (address!("0x043A2daD730d585C44FB79D2614F295D2d625412"), 106752707), - // - POLYGON => (address!("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b"), 44961548), - // Not available on Lens - } -); -crate::bindings!( - BalancerV2ComposableStablePoolFactoryV6, - crate::deployments! { - // - MAINNET => (address!("0x5B42eC6D40f7B7965BE5308c70e2603c0281C1E9"), 19314764), - // - GNOSIS => (address!("0x47B489bf5836f83ABD928C316F8e39bC0587B020"), 32650879), - // - SEPOLIA => (address!("0x05503B3aDE04aCA81c8D6F88eCB73Ba156982D2B"), 5369821), - // - ARBITRUM_ONE => (address!("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7"), 184805448), - // - BASE => (address!("0x956CCab09898C0AF2aCa5e6C229c3aD4E93d9288"), 11099703), - // - AVALANCHE => (address!("0xb9F8AB3ED3F3aCBa64Bc6cd2DcA74B7F38fD7B88"), 42186350), - // - BNB => (address!("0x6B5dA774890Db7B7b96C6f44e6a4b0F657399E2e"), 36485719), - // - OPTIMISM => (address!("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7"), 116694338), - // - POLYGON => (address!("0xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E"), 53996258), - // Not available on Lens - } -); -crate::bindings!( - // Balancer addresses can be obtained from: - // - BalancerV2Vault, - crate::deployments! { - // - MAINNET => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 12272146), - // - GNOSIS => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 24821598), - // - SEPOLIA => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 3418831), - // - ARBITRUM_ONE => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 222832), - // - BASE => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 1196036), - // - AVALANCHE => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 26386141), - // - BNB => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 22691002), - // - OPTIMISM => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 7003431), - // - POLYGON => (address!("0xBA12222222228d8Ba445958a75a0704d566BF2C8"), 15832990), - // Not available on Lens - } -); -crate::bindings!( - BalancerV3BatchRouter, - crate::deployments! { - // - MAINNET => (address!("0x136f1EFcC3f8f88516B9E94110D56FDBfB1778d1"), 21339510), - // - GNOSIS => (address!("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b"), 37377506), - // - SEPOLIA => (address!("0xC85b652685567C1B074e8c0D4389f83a2E458b1C"), 7219301), - // - ARBITRUM_ONE => (address!("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E"), 297828544), - // - BASE => (address!("0x85a80afee867aDf27B50BdB7b76DA70f1E853062"), 25347205), - // - AVALANCHE => (address!("0xc9b36096f5201ea332Db35d6D195774ea0D5988f"), 59965747), - // - OPTIMISM => (address!("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E"), 133969588), - // Not available on Lens, Polygon, BNB - } -); - -// UniV2 -crate::bindings!( - BaoswapRouter, - crate::deployments! { - // https://gnosisscan.io/tx/0xdcbfa037f2c6c7456022df0632ec8d6a75d0f9a195238eec679d5d26895eb7b1 - GNOSIS => (address!("0x6093AeBAC87d62b1A5a4cEec91204e35020E38bE")) - } -); -crate::bindings!( - HoneyswapRouter, - crate::deployments! { - GNOSIS => (address!("0x1C232F01118CB8B424793ae03F870aa7D0ac7f77")) - } -); -crate::bindings!( - PancakeRouter, - crate::deployments! { - // - MAINNET => (address!("0xEfF92A263d31888d860bD50809A8D171709b7b1c")), - // - ARBITRUM_ONE => (address!("0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb")), - // - BASE => (address!("0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb")), - // - BNB => (address!("0x10ED43C718714eb63d5aA57B78B54704E256024E")) - } -); -crate::bindings!( - SushiSwapRouter, - // - crate::deployments! { - // - MAINNET => (address!("0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f")), - // - GNOSIS => (address!("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506")), - // - ARBITRUM_ONE => (address!("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506")), - // - BASE => (address!("0x6bded42c6da8fbf0d2ba55b2fa120c5e0c8d7891")), - // - AVALANCHE => (address!("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506")), - // - BNB => (address!("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506")), - // - OPTIMISM => (address!("0x2abf469074dc0b54d793850807e6eb5faf2625b1")), - // - POLYGON => (address!("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506")), - // Not available on Lens - } -); -crate::bindings!( - SwaprRouter, - // - crate::deployments! { - // - MAINNET => address!("0xb9960d9bca016e9748be75dd52f02188b9d0829f"), - // - GNOSIS => address!("0xE43e60736b1cb4a75ad25240E2f9a62Bff65c0C0"), - // - ARBITRUM_ONE => address!("0x530476d5583724A89c8841eB6Da76E7Af4C0F17E"), - // Not available on Base and Lens - } -); -crate::bindings!(ISwaprPair); -crate::bindings!( - TestnetUniswapV2Router02, - crate::deployments! { - // - SEPOLIA => address!("0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98"), - } -); -crate::bindings!( - UniswapV2Factory, - // - crate::deployments! { - // - MAINNET => address!("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"), - // - GNOSIS => address!("0xA818b4F111Ccac7AA31D0BCc0806d64F2E0737D7"), - // - ARBITRUM_ONE => address!("0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9"), - // - BASE => address!("0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6"), - // - SEPOLIA => address!("0xF62c03E08ada871A0bEb309762E260a7a6a880E6"), - // - AVALANCHE => address!("0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C"), - // - BNB => address!("0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6"), - // - OPTIMISM => address!("0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf"), - // - POLYGON => address!("0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C"), - // Not available on Lens - } -); -crate::bindings!( - UniswapV2Router02, - // - crate::deployments! { - // - MAINNET => address!("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"), - // - GNOSIS => address!("0x1C232F01118CB8B424793ae03F870aa7D0ac7f77"), - // - ARBITRUM_ONE => address!("0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24"), - // - BASE => address!("0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24"), - // - SEPOLIA => address!("0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3"), - // - AVALANCHE => address!("0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24"), - // - BNB => address!("0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24"), - // - OPTIMISM => address!("0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2"), - // - POLYGON => address!("0xedf6066a2b290C185783862C7F4776A2C8077AD1"), - // Not available on Lens - } -); -crate::bindings!(IUniswapLikeRouter); -crate::bindings!(IUniswapLikePair); -crate::bindings!(UniswapV3Pool); -crate::bindings!( - UniswapV3QuoterV2, - crate::deployments! { - // - MAINNET => address!("0x61fFE014bA17989E743c5F6cB21bF9697530B21e"), - ARBITRUM_ONE => address!("0x61fFE014bA17989E743c5F6cB21bF9697530B21e"), - BASE => address!("0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a"), - AVALANCHE => address!("0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F"), - BNB => address!("0x78D78E420Da98ad378D7799bE8f4AF69033EB077"), - OPTIMISM => address!("0x61fFE014bA17989E743c5F6cB21bF9697530B21e"), - POLYGON => address!("0x61fFE014bA17989E743c5F6cB21bF9697530B21e"), - LENS => address!("0x1eEA2B790Dc527c5a4cd3d4f3ae8A2DDB65B2af1"), - LINEA => address!("0x42bE4D6527829FeFA1493e1fb9F3676d2425C3C1"), - // Not listed on Gnosis and Sepolia chains - } -); -crate::bindings!( - UniswapV3SwapRouterV2, - crate::deployments! { - // - ARBITRUM_ONE => address!("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"), - MAINNET => address!("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"), - POLYGON => address!("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"), - OPTIMISM => address!("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"), - BASE => address!("0x2626664c2603336E57B271c5C0b26F421741e481"), - AVALANCHE => address!("0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE"), - BNB => address!("0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2"), - LENS => address!("0x6ddD32cd941041D8b61df213B9f515A7D288Dc13"), - LINEA => address!("0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a"), - // Not available on Gnosis Chain - } -); -crate::bindings!( - IUniswapV3Factory, - crate::deployments! { - // - MAINNET => address!( "0x1F98431c8aD98523631AE4a59f267346ea31F984"), - SEPOLIA => address!( "0x1F98431c8aD98523631AE4a59f267346ea31F984"), - ARBITRUM_ONE => address!( "0x1F98431c8aD98523631AE4a59f267346ea31F984"), - BASE => address!( "0x33128a8fC17869897dcE68Ed026d694621f6FDfD"), - AVALANCHE => address!( "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD"), - BNB => address!( "0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7"), - OPTIMISM => address!( "0x1F98431c8aD98523631AE4a59f267346ea31F984"), - POLYGON => address!( "0x1F98431c8aD98523631AE4a59f267346ea31F984"), - // not official - LENS => address!( "0xc3A5b857Ba82a2586A45a8B59ECc3AA50Bc3D0e3"), - LINEA => address!("0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9"), - // Not available on Gnosis Chain - } -); - -crate::bindings!( - HooksTrampoline, - // - crate::deployments! { - MAINNET => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - // Gnosis is using the old instance of the hook trampoline since it's hardcoded in gnosis pay rebalance integration. - GNOSIS => address!("0x01DcB88678aedD0C4cC9552B20F4718550250574"), - SEPOLIA => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - ARBITRUM_ONE => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - BASE => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - AVALANCHE => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - BNB => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - OPTIMISM => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - POLYGON => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - LENS => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - LINEA => address!("0x60bf78233f48ec42ee3f101b9a05ec7878728006"), - PLASMA => address!("0x60Bf78233f48eC42eE3F101b9a05eC7878728006"), - } -); - -crate::bindings!( - CoWSwapEthFlow, - crate::deployments! { - // - MAINNET => (address!("0x40a50cf069e992aa4536211b23f286ef88752187"), 16169866), - // - GNOSIS => (address!("0x40a50cf069e992aa4536211b23f286ef88752187"), 25414331), - // - // - SEPOLIA => (address!("0x0b7795E18767259CC253a2dF471db34c72B49516"), 4718739), - // - ARBITRUM_ONE => (address!("0x6DFE75B5ddce1ADE279D4fa6BD6AeF3cBb6f49dB"), 204747458), - // - BASE => (address!("0x3C3eA1829891BC9bEC3d06A81d5d169e52a415e3"), 21490258), - // - AVALANCHE => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 60496408), - // - BNB => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 48411237), - // - OPTIMISM => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 134607215), - // - POLYGON => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 71296258), - // - LENS => (address!("0xFb337f8a725A142f65fb9ff4902d41cc901de222"), 3007173), - // - LINEA => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 24522097), - // - PLASMA => (address!("0x04501b9b1d52e67f6862d157e00d13419d2d6e95"), 3521855), - } -); -crate::bindings!(CoWSwapOnchainOrders); -crate::bindings!(ERC1271SignatureValidator); - -// Used in the gnosis/solvers repo for the balancer solver -crate::bindings!( - BalancerQueries, - crate::deployments! { - // - MAINNET => (address!("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5"), 15188261), - // - ARBITRUM_ONE => (address!("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5"), 18238624), - // - OPTIMISM => (address!("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5"), 15288107), - // - BASE => (address!("0x300Ab2038EAc391f26D9F895dc61F8F66a548833"), 1205869), - // - GNOSIS => (address!("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e"), 24821845), - // - POLYGON => (address!("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5"), 30988035), - // - AVALANCHE => (address!("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD"), 26387068), - // Not available on Lens - } -); - -crate::bindings!( - LiquoriceSettlement, - crate::deployments! { - // - MAINNET => address!("0x0448633eb8B0A42EfED924C42069E0DcF08fb552"), - ARBITRUM_ONE => address!("0x0448633eb8B0A42EfED924C42069E0DcF08fb552"), - } -); - -crate::bindings!( - FlashLoanRouter, - crate::deployments! { - MAINNET => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - GNOSIS => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - SEPOLIA => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - ARBITRUM_ONE => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - BASE => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - POLYGON => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - AVALANCHE => address!("0x9da8b48441583a2b93e2ef8213aad0ec0b392c69"), - } -); - -crate::bindings!(ICowWrapper); - -// Only used in -crate::bindings!( - Permit2, - crate::deployments! { - // - MAINNET => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 15986406), - // - GNOSIS => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 27338672), - // - SEPOLIA => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 2356287), - // - ARBITRUM_ONE => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 38692735), - // - BASE => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 1425180), - // - AVALANCHE => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 28844415), - // - BNB => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 25343783), - // - OPTIMISM => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 38854427), - // - POLYGON => (address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"), 35701901), - } -); - -crate::bindings!( - GPv2AllowListAuthentication, - crate::deployments! { - // - MAINNET => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 12593263), - // - GNOSIS => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 16465099), - // - SEPOLIA => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 4717469), - // - ARBITRUM_ONE => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 204702129), - // - BASE => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 21407137), - // - AVALANCHE => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 59891351), - // - BNB => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 48173639), - // - OPTIMISM => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 134254466), - // - POLYGON => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 45854728), - // - LENS => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 2612937), - // - LINEA => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 24333100), - // - PLASMA => (address!("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE"), 3439709), - } -); - -crate::bindings!( - GPv2Settlement, - crate::deployments! { - // - MAINNET => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 12593265), - // - GNOSIS => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 16465100), - // - SEPOLIA => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 4717488), - // - ARBITRUM_ONE => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 204704802), - // - BASE => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 21407238), - // - AVALANCHE => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 59891356), - // - BNB => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 48173641), - // - OPTIMISM => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 134254624), - // - POLYGON => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 45859743), - // - LENS => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 2621745), - // - LINEA => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 24333100), - // - PLASMA => (address!("0x9008D19f58AAbD9eD0D60971565AA8510560ab41"), 3439711), - } -); - -crate::bindings!( - WETH9, - crate::deployments! { - // Note: the WETH address must be consistent with the one used by the ETH-flow - // contract - MAINNET => address!("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), - GNOSIS => address!("0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"), - SEPOLIA => address!("0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"), - ARBITRUM_ONE => address!("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"), - BASE => address!("0x4200000000000000000000000000000000000006"), - AVALANCHE => address!("0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"), - BNB => address!("0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"), - OPTIMISM => address!("0x4200000000000000000000000000000000000006"), - POLYGON => address!("0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"), - LENS => address!("0x6bDc36E20D267Ff0dd6097799f82e78907105e2F"), - LINEA => address!("0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f"), - PLASMA => address!("0x6100E367285b01F48D07953803A2d8dCA5D19873"), - } -); - -crate::bindings!(ERC20); - -pub mod cow_amm { - crate::bindings!(CowAmm); - crate::bindings!( - CowAmmConstantProductFactory, - crate::deployments! { - // - MAINNET => (address!("0x40664207e3375FB4b733d4743CE9b159331fd034"), 19861952), - // - GNOSIS => (address!("0xdb1cba3a87f2db53b6e1e6af48e28ed877592ec0"), 33874317), - // - SEPOLIA => (address!("0xb808e8183e3a72d196457d127c7fd4befa0d7fd3"), 5874562), - } - ); - crate::bindings!( - CowAmmLegacyHelper, - crate::deployments! { - // - MAINNET => (address!("0x3705ceee5eaa561e3157cf92641ce28c45a3999c"), 20332745), - // - GNOSIS => (address!("0xd9ec06b001957498ab1bc716145515d1d0e30ffb"), 35026999), - } - ); - crate::bindings!(CowAmmUniswapV2PriceOracle); - crate::bindings!(CowAmmFactoryGetter); -} - -pub mod support { - // Support contracts used for trade and token simulations. - crate::bindings!(AnyoneAuthenticator); - crate::bindings!(Solver); - crate::bindings!(Spardose); - crate::bindings!(Trader); - // Support contract used for solver fee simulations in the gnosis/solvers repo. - crate::bindings!(Swapper); - crate::bindings!( - Signatures, - crate::deployments! { - MAINNET => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - ARBITRUM_ONE => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - BASE => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - AVALANCHE => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - BNB => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - OPTIMISM => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - POLYGON => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - LENS => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - GNOSIS => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - SEPOLIA => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - // built with evm=London, because deployment reverts on Linea otherwise - LINEA => address!("0xf6E57e72F7dB3D9A51a8B4c149C00475b94A37e4"), - PLASMA => address!("0x8262d639c38470F38d2eff15926F7071c28057Af"), - } - ); - // Support contracts used for various order simulations. - crate::bindings!( - Balances, - crate::deployments! { - MAINNET => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - ARBITRUM_ONE => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - BASE => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - AVALANCHE => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - BNB => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - OPTIMISM => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - POLYGON => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - LENS => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - GNOSIS => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - SEPOLIA => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - PLASMA => address!("0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b"), - // built with evm=London, because deployment reverts on Linea otherwise - LINEA => address!("0x361350f708f7c0c63c8a505226592c3e5d1faa29"), - } - ); -} - -pub mod test { - // Test Contract for using up a specified amount of gas. - crate::bindings!(GasHog); - // Test Contract for incrementing arbitrary counters. - crate::bindings!(Counter); - // Token with support for `permit` (for pre-interaction tests) - crate::bindings!( - CowProtocolToken, - crate::deployments! { - MAINNET => address!("0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB"), - GNOSIS => address!("0x177127622c4A00F3d409B75571e12cB3c8973d3c"), - SEPOLIA => address!("0x0625aFB445C3B6B7B929342a04A22599fd5dBB59"), - ARBITRUM_ONE => address!("0xcb8b5CD20BdCaea9a010aC1F8d835824F5C87A04"), - BASE => address!("0xc694a91e6b071bF030A18BD3053A7fE09B6DaE69"), - } - ); -} - -pub use alloy::providers::DynProvider as Provider; - -/// Extension trait to attach some useful functions to the contract instance. -pub trait InstanceExt: Sized { - /// Crates a contract instance at the expected address for the current - /// network. - fn deployed( - provider: &Provider, - ) -> impl std::future::Future> + Send; -} - -/// Build a `HashMap)>` from entries like: -/// `CHAIN_ID => address!("0x…")` // block = None -/// `CHAIN_ID => (address!("0x…"), 12_345_678)` // block = Some(…) -#[macro_export] -macro_rules! deployments { - (@acc $m:ident; ) => {}; - - // Tuple form with trailing comma: CHAIN => (addr, block), - (@acc $m:ident; $chain:expr => ( $addr:expr, $block:expr ), $($rest:tt)* ) => { - $m.insert($chain, ($addr, Some($block))); - $crate::deployments!(@acc $m; $($rest)*); - }; - - // Address-only form with trailing comma: CHAIN => addr, - (@acc $m:ident; $chain:expr => $addr:expr, $($rest:tt)* ) => { - $m.insert($chain, ($addr, None::)); - $crate::deployments!(@acc $m; $($rest)*); - }; - - // Tuple form without trailing comma (last entry). - (@acc $m:ident; $chain:expr => ( $addr:expr, $block:expr ) ) => { - $m.insert($chain, ($addr, Some($block))); - }; - - // Address-only form without trailing comma (last entry). - (@acc $m:ident; $chain:expr => $addr:expr ) => { - $m.insert($chain, ($addr, None::)); - }; - - ( $($rest:tt)* ) => {{ - let mut m = ::std::collections::HashMap::new(); - $crate::deployments!(@acc m; $($rest)*); - m - }}; -} - -#[macro_export] -macro_rules! bindings { - ($contract:ident $(, $deployment_info:expr)?) => { - paste::paste! { - // Generate the main bindings in a private module. That allows - // us to re-export all items in our own module while also adding - // some items ourselves. - #[expect(non_snake_case)] - mod [<$contract Private>] { - alloy::sol!( - #[allow(missing_docs, clippy::too_many_arguments)] - #[sol(rpc, all_derives)] - $contract, - concat!("./artifacts/", stringify!($contract), ".json"), - ); - } - - #[expect(non_snake_case)] - pub mod $contract { - use alloy::providers::DynProvider; - - pub use super::[<$contract Private>]::*; - pub type Instance = $contract::[<$contract Instance>]; - - $( - use { - std::sync::LazyLock, - anyhow::Result, - std::collections::HashMap, - alloy::{ - providers::Provider, - primitives::{address, Address}, - }, - anyhow::Context, - $crate::alloy::networks::*, - }; - - static DEPLOYMENT_INFO: LazyLock)>> = LazyLock::new(|| { - $deployment_info - }); - - /// Returns the contract's deployment block (if one exists) for the given chain. - pub fn deployment_block(chain_id: &u64) -> Option { - DEPLOYMENT_INFO.get(chain_id).map(|(_, block)| *block).flatten() - } - - /// Returns the contract's deployment address (if one exists) for the given chain. - pub fn deployment_address(chain_id: &u64) -> Option { - DEPLOYMENT_INFO.get(chain_id).map(|(addr, _)| *addr) - } - - impl $crate::alloy::InstanceExt for Instance { - fn deployed(provider: &DynProvider) -> impl Future> + Send { - async move { - let chain_id = provider - .get_chain_id() - .await - .context("could not fetch current chain id")?; - - let (address, _deployed_block) = *DEPLOYMENT_INFO - .get(&chain_id) - .with_context(|| format!("no deployment info for chain {chain_id:?}"))?; - - Ok(Instance::new( - address, - provider.clone(), - )) - } - } - } - )* - } - } - }; -} - -#[cfg(test)] -mod tests { - use super::networks::*; - use super::*; - - #[test] - fn test_has_address() { - assert!(BaoswapRouter::deployment_address(&GNOSIS).is_some()); - assert!(HoneyswapRouter::deployment_address(&GNOSIS).is_some()); - - for chain_id in &[MAINNET, ARBITRUM_ONE, BASE, BNB] { - assert!(PancakeRouter::deployment_address(chain_id).is_some()); - } - - for chain_id in &[ - MAINNET, - GNOSIS, - ARBITRUM_ONE, - BASE, - AVALANCHE, - BNB, - OPTIMISM, - POLYGON, - ] { - assert!(SushiSwapRouter::deployment_address(chain_id).is_some()); - } - - for chain_id in &[MAINNET, GNOSIS, ARBITRUM_ONE] { - assert!(SwaprRouter::deployment_address(chain_id).is_some()); - } - - assert!(TestnetUniswapV2Router02::deployment_address(&SEPOLIA).is_some()); - - for chain_id in &[ - MAINNET, - GNOSIS, - ARBITRUM_ONE, - BASE, - SEPOLIA, - AVALANCHE, - BNB, - OPTIMISM, - POLYGON, - ] { - assert!(UniswapV2Factory::deployment_address(chain_id).is_some()); - assert!(UniswapV2Router02::deployment_address(chain_id).is_some()); - } - } -} diff --git a/crates/contracts/src/lib.rs b/crates/contracts/src/lib.rs index b39baad16f..1384ddc024 100644 --- a/crates/contracts/src/lib.rs +++ b/crates/contracts/src/lib.rs @@ -1,88 +1,11 @@ #![allow(clippy::let_unit_value)] -pub use ethcontract; +// This module get's auto-generated by the contracts build.rs +#[rustfmt::skip] pub mod alloy; -pub mod errors; -use { - anyhow::{Result, anyhow, bail}, - ethcontract::{ - Contract, - common::{DeploymentInformation, contract::Network}, - }, -}; - -pub fn deployment(contract: &Contract, chain_id: u64) -> Result<&Network> { - contract - .networks - .get(&chain_id.to_string()) - // Note that we are conflating network IDs with chain IDs. In general - // they cannot be considered the same, but for the networks that we - // support (xDAI, Görli and Mainnet) they are. - .ok_or_else(|| anyhow!("missing {} deployment for {}", contract.name, chain_id)) -} - -pub fn deployment_block(contract: &Contract, chain_id: u64) -> Result { - let deployment_info = deployment(contract, chain_id)? - .deployment_information - .ok_or_else(|| anyhow!("missing deployment information for {}", contract.name))?; - match deployment_info { - DeploymentInformation::BlockNumber(block) => Ok(block), - DeploymentInformation::TransactionHash(tx) => { - bail!("missing deployment block number for {}", tx) - } - } -} - -#[macro_use] -mod macros; +pub mod errors; #[cfg(feature = "bin")] pub mod paths; pub mod vault; -pub mod web3; - -#[cfg(test)] -mod tests { - use { - super::*, - crate::alloy::networks::{ARBITRUM_ONE, GNOSIS, MAINNET, SEPOLIA}, - }; - - #[test] - fn deployment_addresses() { - for network in &[MAINNET, GNOSIS, SEPOLIA, ARBITRUM_ONE] { - assert!( - alloy::BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory::deployment_address(network).is_some() - ) - } - for network in &[MAINNET, ARBITRUM_ONE] { - assert!( - alloy::BalancerV2WeightedPool2TokensFactory::deployment_address(network).is_some() - ); - assert!( - alloy::BalancerV2LiquidityBootstrappingPoolFactory::deployment_address(network) - .is_some() - ); - } - - assert!(alloy::BalancerV2WeightedPoolFactory::deployment_address(&MAINNET).is_some()); - - for network in &[MAINNET, GNOSIS, ARBITRUM_ONE] { - assert!(alloy::BalancerV2StablePoolFactoryV2::deployment_address(network).is_some()); - } - } - - #[test] - fn deployment_information() { - assert!(alloy::BalancerV2WeightedPoolFactory::deployment_address(&MAINNET).is_some()); - for network in &[MAINNET, ARBITRUM_ONE] { - assert!( - alloy::BalancerV2WeightedPool2TokensFactory::deployment_address(network).is_some() - ); - } - for network in &[MAINNET, GNOSIS, ARBITRUM_ONE] { - assert!(alloy::BalancerV2StablePoolFactoryV2::deployment_address(network).is_some()); - } - } -} diff --git a/crates/contracts/src/macros.rs b/crates/contracts/src/macros.rs deleted file mode 100644 index 1fcf2ec4cf..0000000000 --- a/crates/contracts/src/macros.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[macro_export] -macro_rules! dummy_contract { - ($contract:ty, $addr:expr_2021) => { - <$contract>::at(&$crate::web3::dummy(), $addr.into()) - }; -} diff --git a/crates/contracts/src/web3.rs b/crates/contracts/src/web3.rs deleted file mode 100644 index e73ab5ed69..0000000000 --- a/crates/contracts/src/web3.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! This module provides a "dummy" implementation of a [`web3::Transport`]. The -//! reason is that [`ethcontract`] generated bindings require a `web3` instance -//! in order to construct contract instances. This is annoying when trying to -//! use the generated bindings for just encoding contract function calls, where -//! connection to a node is not needed at all. - -use ethcontract::{ - futures, - json::Value, - jsonrpc::Call as RpcCall, - web3::{self, BatchTransport, RequestId, Transport, Web3}, -}; - -/// A dummy [`web3::Transport`] implementation that always panics. -#[derive(Clone, Debug)] -pub struct DummyTransport; - -impl Transport for DummyTransport { - type Out = futures::future::Pending>; - - fn prepare(&self, _method: &str, _params: Vec) -> (web3::RequestId, RpcCall) { - unimplemented!() - } - - fn send(&self, _id: web3::RequestId, _request: RpcCall) -> Self::Out { - unimplemented!() - } -} - -impl BatchTransport for DummyTransport { - type Batch = futures::future::Pending>>>; - - fn send_batch(&self, _requests: T) -> Self::Batch - where - T: IntoIterator, - { - unimplemented!() - } -} - -/// Creates a [`web3::Web3`] instance with a [`DummyTransport`]. -pub fn dummy() -> Web3 { - Web3::new(DummyTransport) -} diff --git a/crates/driver/src/boundary/liquidity/zeroex.rs b/crates/driver/src/boundary/liquidity/zeroex.rs index fdd128885d..0376d4a60f 100644 --- a/crates/driver/src/boundary/liquidity/zeroex.rs +++ b/crates/driver/src/boundary/liquidity/zeroex.rs @@ -7,7 +7,6 @@ use { infra::{self, Ethereum}, }, anyhow::anyhow, - contracts::alloy::InstanceExt, ethrpc::block_stream::CurrentBlockWatcher, shared::{ http_client::HttpClientFactory, diff --git a/crates/e2e/src/setup/deploy.rs b/crates/e2e/src/setup/deploy.rs index c5765e2e7c..85cb82dfb7 100644 --- a/crates/e2e/src/setup/deploy.rs +++ b/crates/e2e/src/setup/deploy.rs @@ -7,7 +7,6 @@ use { GPv2AllowListAuthentication, GPv2Settlement, HooksTrampoline, - InstanceExt, UniswapV2Factory, UniswapV2Router02, WETH9, diff --git a/crates/e2e/src/setup/onchain_components/safe.rs b/crates/e2e/src/setup/onchain_components/safe.rs index fd92cc71a9..5ac9f76343 100644 --- a/crates/e2e/src/setup/onchain_components/safe.rs +++ b/crates/e2e/src/setup/onchain_components/safe.rs @@ -182,8 +182,10 @@ impl Safe { to: alloy::primitives::Address, data: Vec, nonce: alloy::primitives::U256, - ) -> alloy::contract::CallBuilder<&contracts::alloy::Provider, PhantomData> - { + ) -> alloy::contract::CallBuilder< + &alloy::providers::DynProvider, + PhantomData, + > { let signature = self.sign({ // `SafeTx` struct hash computation ported from the Safe Solidity code: // diff --git a/crates/e2e/tests/e2e/liquidity.rs b/crates/e2e/tests/e2e/liquidity.rs index 1598e095f4..31942b586d 100644 --- a/crates/e2e/tests/e2e/liquidity.rs +++ b/crates/e2e/tests/e2e/liquidity.rs @@ -4,7 +4,7 @@ use { providers::ext::{AnvilApi, ImpersonateConfig}, }, chrono::{NaiveDateTime, Utc}, - contracts::alloy::{ERC20, IZeroex, InstanceExt}, + contracts::alloy::{ERC20, IZeroex}, driver::domain::eth::H160, e2e::{ api::zeroex::{Eip712TypedZeroExOrder, ZeroExApi}, diff --git a/crates/e2e/tests/e2e/liquidity_source_notification.rs b/crates/e2e/tests/e2e/liquidity_source_notification.rs index 500210efa9..5575a180b4 100644 --- a/crates/e2e/tests/e2e/liquidity_source_notification.rs +++ b/crates/e2e/tests/e2e/liquidity_source_notification.rs @@ -5,7 +5,7 @@ use { signers::{SignerSync, local::PrivateKeySigner}, }, chrono::Utc, - contracts::alloy::{ERC20, InstanceExt, LiquoriceSettlement}, + contracts::alloy::{ERC20, LiquoriceSettlement}, driver::infra, e2e::{ api, diff --git a/crates/orderbook/src/run.rs b/crates/orderbook/src/run.rs index 43bea7eec5..272a24c12d 100644 --- a/crates/orderbook/src/run.rs +++ b/crates/orderbook/src/run.rs @@ -19,7 +19,6 @@ use { GPv2Settlement, HooksTrampoline, IUniswapV3Factory, - InstanceExt, WETH9, support::Balances, }, diff --git a/crates/shared/src/bad_token/trace_call.rs b/crates/shared/src/bad_token/trace_call.rs index ae8ad73018..7d92ec9df5 100644 --- a/crates/shared/src/bad_token/trace_call.rs +++ b/crates/shared/src/bad_token/trace_call.rs @@ -399,7 +399,7 @@ mod tests { }, alloy::primitives::address, chain::Chain, - contracts::alloy::{BalancerV2Vault, GPv2Settlement, IUniswapV3Factory, InstanceExt}, + contracts::alloy::{BalancerV2Vault, GPv2Settlement, IUniswapV3Factory}, ethrpc::{Web3, alloy::conversions::IntoLegacy}, std::{env, time::Duration}, web3::types::{ diff --git a/crates/shared/src/event_handling.rs b/crates/shared/src/event_handling.rs index 90b36fd622..63e3280215 100644 --- a/crates/shared/src/event_handling.rs +++ b/crates/shared/src/event_handling.rs @@ -773,7 +773,7 @@ mod tests { use { super::*, alloy::eips::BlockNumberOrTag, - contracts::alloy::{GPv2Settlement, InstanceExt}, + contracts::alloy::GPv2Settlement, ethcontract::{BlockNumber, H256}, ethrpc::{Web3, block_stream::block_number_to_block_number_hash}, std::str::FromStr, @@ -786,7 +786,7 @@ mod tests { Filter::new().address(*self.address()) } - fn provider(&self) -> &contracts::alloy::Provider { + fn provider(&self) -> &alloy::providers::DynProvider { self.provider() } } diff --git a/crates/shared/src/sources/balancer_v2/pool_fetching/mod.rs b/crates/shared/src/sources/balancer_v2/pool_fetching/mod.rs index f245fa28c4..dc743db799 100644 --- a/crates/shared/src/sources/balancer_v2/pool_fetching/mod.rs +++ b/crates/shared/src/sources/balancer_v2/pool_fetching/mod.rs @@ -47,7 +47,6 @@ use { BalancerV2WeightedPoolFactory, BalancerV2WeightedPoolFactoryV3, BalancerV2WeightedPoolFactoryV4, - InstanceExt, }, ethcontract::{BlockId, H160, H256}, ethrpc::block_stream::{BlockRetrieving, CurrentBlockWatcher}, diff --git a/crates/solvers/src/boundary/liquidity/concentrated.rs b/crates/solvers/src/boundary/liquidity/concentrated.rs index 51227e3148..b00fef96cc 100644 --- a/crates/solvers/src/boundary/liquidity/concentrated.rs +++ b/crates/solvers/src/boundary/liquidity/concentrated.rs @@ -1,12 +1,10 @@ use { alloy::primitives::aliases::U24, - contracts::{ - alloy::UniswapV3QuoterV2::IQuoterV2::{ - QuoteExactInputSingleParams, - QuoteExactOutputSingleParams, - }, - ethcontract::{H160, U256}, + contracts::alloy::UniswapV3QuoterV2::IQuoterV2::{ + QuoteExactInputSingleParams, + QuoteExactOutputSingleParams, }, + ethcontract::{H160, U256}, ethrpc::alloy::conversions::{IntoAlloy, IntoLegacy}, model::TokenPair, shared::baseline_solver::BaselineSolvable, diff --git a/crates/solvers/src/boundary/liquidity/limit_order.rs b/crates/solvers/src/boundary/liquidity/limit_order.rs index 892729859f..8e5858c1d5 100644 --- a/crates/solvers/src/boundary/liquidity/limit_order.rs +++ b/crates/solvers/src/boundary/liquidity/limit_order.rs @@ -1,6 +1,6 @@ use { crate::domain::liquidity::limit_order::LimitOrder, - contracts::ethcontract::{H160, U256}, + ethcontract::{H160, U256}, shared::{baseline_solver::BaselineSolvable, price_estimation::gas::GAS_PER_ZEROEX_ORDER}, }; @@ -50,7 +50,7 @@ mod tests { use { super::*, crate::domain::{eth, liquidity::limit_order::TakerAmount}, - contracts::ethcontract::U256, + ethcontract::U256, shared::addr, }; diff --git a/crates/solvers/src/domain/solver.rs b/crates/solvers/src/domain/solver.rs index 1c612b3cec..1946b9c6e4 100644 --- a/crates/solvers/src/domain/solver.rs +++ b/crates/solvers/src/domain/solver.rs @@ -18,7 +18,6 @@ use { }, infra::metrics, }, - contracts::alloy::InstanceExt, ethereum_types::U256, reqwest::Url, std::{cmp, collections::HashSet, sync::Arc},