From 09b74a349176f740d571f44bbedbbbff1edbda91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Mon, 27 Oct 2025 14:28:03 +0000 Subject: [PATCH 01/36] Implement build.rs bindings generation --- Cargo.lock | 2032 +++++++++++++++-- Cargo.toml | 17 +- .../src/infra/blockchain/contracts.rs | 9 +- crates/contracts-generate/Cargo.toml | 22 + crates/contracts-generate/src/lib.rs | 235 ++ crates/contracts/.gitignore | 1 + crates/contracts/Cargo.toml | 2 + crates/contracts/build.rs | 60 + crates/contracts/src/alloy.rs | 13 - crates/contracts/src/lib.rs | 2 + crates/order-validation/src/banned.rs | 2 +- crates/orderbook/src/run.rs | 2 +- 12 files changed, 2229 insertions(+), 168 deletions(-) create mode 100644 crates/contracts-generate/Cargo.toml create mode 100644 crates/contracts-generate/src/lib.rs create mode 100644 crates/contracts/.gitignore diff --git a/Cargo.lock b/Cargo.lock index e16ebed404..9a66f61da3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "ahash" version = "0.7.8" @@ -48,7 +54,7 @@ dependencies = [ "getrandom 0.2.15", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.34", ] [[package]] @@ -121,6 +127,7 @@ checksum = "5674914c2cfdb866c21cb0c09d82374ee39a1395cf512e7515f4c014083b3fff" dependencies = [ "alloy-primitives", "num_enum", + "serde", "strum", ] @@ -200,15 +207,18 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6c2905bafc2df7ccd32ca3af13f0b0d82f2e2ff9dfbeb12196c0d978d5c0deb" +checksum = "3fdff496dd4e98a81f4861e66f7eaf5f2488971848bb42d9c892f871730245c8" dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-type-parser", "alloy-sol-types", + "arbitrary", + "derive_more 2.0.1", "itoa", + "proptest", "serde", "serde_json", "winnow 0.7.11", @@ -246,6 +256,7 @@ checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" dependencies = [ "alloy-primitives", "alloy-rlp", + "k256", "serde", "thiserror 2.0.12", ] @@ -274,9 +285,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2acb6637a9c0e1cdf8971e0ced8f3fa34c04c5e9dccf6bb184f6a64fe0e37d8" +checksum = "5513d5e6bd1cba6bdcf5373470f559f320c05c8c59493b6e98912fbe6733943f" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -340,16 +351,18 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b77f7d5e60ad8ae6bd2200b8097919712a07a6db622a4b201e7ead6166f02e5" +checksum = "355bf68a433e0fd7f7d33d5a9fc2583fde70bf5c530f63b80845f8da5505cf28" dependencies = [ "alloy-rlp", + "arbitrary", "bytes", "cfg-if", "const-hex", "derive_more 2.0.1", "foldhash 0.2.0", + "getrandom 0.3.3", "hashbrown 0.16.0", "indexmap 2.10.0", "itoa", @@ -357,6 +370,7 @@ dependencies = [ "keccak-asm", "paste", "proptest", + "proptest-derive", "rand 0.9.1", "ruint", "rustc-hash", @@ -404,6 +418,28 @@ dependencies = [ "wasmtimer", ] +[[package]] +name = "alloy-pubsub" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06e45a68423e732900a0c824b8e22237db461b79d2e472dd68b7547c16104427" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "auto_impl", + "bimap", + "futures", + "parking_lot", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower 0.5.2", + "tracing", + "wasmtimer", +] + [[package]] name = "alloy-rlp" version = "0.3.12" @@ -423,7 +459,7 @@ checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -456,6 +492,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339af7336571dd39ae3a15bde08ae6a647e62f75350bd415832640268af92c06" dependencies = [ "alloy-primitives", + "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -472,6 +509,24 @@ dependencies = [ "alloy-serde", ] +[[package]] +name = "alloy-rpc-types-engine" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "605ec375d91073851f566a3082548af69a28dca831b27a8be7c1b4c49f5c6ca2" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "derive_more 2.0.1", + "jsonwebtoken", + "rand 0.8.5", + "serde", + "strum", +] + [[package]] name = "alloy-rpc-types-eth" version = "1.0.41" @@ -559,23 +614,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c84c3637bee9b5c4a4d2b93360ee16553d299c3b932712353caf1cea76d0e6" +checksum = "f3ce480400051b5217f19d6e9a82d9010cdde20f1ae9c00d53591e4a1afbb312" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] name = "alloy-sol-macro-expander" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a882aa4e1790063362434b9b40d358942b188477ac1c44cfb8a52816ffc0cc17" +checksum = "6d792e205ed3b72f795a8044c52877d2e6b6e9b1d13f431478121d8d4eaa9028" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -585,16 +640,16 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5772107f9bb265d8d8c86e0733937bb20d0857ea5425b1b6ddf51a9804042" +checksum = "0bd1247a8f90b465ef3f1207627547ec16940c35597875cdc09c49d58b19693c" dependencies = [ "alloy-json-abi", "const-hex", @@ -604,15 +659,15 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.104", + "syn 2.0.108", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e188b939aa4793edfaaa099cb1be4e620036a775b4bdf24fdc56f1cd6fd45890" +checksum = "954d1b2533b9b2c7959652df3076954ecb1122a28cc740aa84e7b0a49f6ac0a9" dependencies = [ "serde", "winnow 0.7.11", @@ -620,9 +675,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c8a9a909872097caffc05df134e5ef2253a1cdb56d3a9cf0052a042ac763f9" +checksum = "70319350969a3af119da6fb3e9bddb1bce66c9ea933600cb297c8b1850ad2a3c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -669,6 +724,44 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport-ipc" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d47962f3f1d9276646485458dc842b4e35675f42111c9d814ae4711c664c8300" +dependencies = [ + "alloy-json-rpc", + "alloy-pubsub", + "alloy-transport", + "bytes", + "futures", + "interprocess", + "pin-project", + "serde", + "serde_json", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "alloy-transport-ws" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9476a36a34e2fb51b6746d009c53d309a186a825aa95435407f0e07149f4ad2d" +dependencies = [ + "alloy-pubsub", + "alloy-transport", + "futures", + "http 1.1.0", + "rustls 0.23.34", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "ws_stream_wasm", +] + [[package]] name = "alloy-trie" version = "0.9.0" @@ -695,7 +788,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -713,11 +806,22 @@ dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47224528f74de27d1d06aad6a5dda4f865b6ebe2e56c538943d746a7270cb67e" +dependencies = [ + "anstyle", + "memchr", + "unicode-width 0.2.2", +] + [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -754,12 +858,13 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell_polyfill", + "windows-sys 0.60.2", ] [[package]] @@ -785,12 +890,65 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "arc-swap" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +[[package]] +name = "ark-bls12-381" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df4dcc01ff89867cd86b0da835f23c3f02738353aaee7dde7495af71363b8d5" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash 0.8.11", + "ark-ff 0.5.0", + "ark-poly", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.4", + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -876,7 +1034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -914,7 +1072,22 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash 0.8.11", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.4", ] [[package]] @@ -944,12 +1117,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ + "ark-serialize-derive", "ark-std 0.5.0", "arrayvec", "digest 0.10.7", "num-bigint", ] +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -980,6 +1165,12 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.4" @@ -1032,7 +1223,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1043,7 +1234,18 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version 0.4.0", ] [[package]] @@ -1072,6 +1274,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "aurora-engine-modexp" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "518bc5745a6264b5fd7b09dffb9667e400ee9e2bbe18555fac75e1fe9afa0df9" +dependencies = [ + "hex", + "num", +] + [[package]] name = "auto_impl" version = "1.3.0" @@ -1080,7 +1292,7 @@ checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -1459,11 +1671,11 @@ dependencies = [ "http-body 0.4.6", "http-body 1.0.0", "hyper 0.14.29", - "hyper-rustls", + "hyper-rustls 0.24.2", "once_cell", "pin-project-lite", "pin-utils", - "rustls", + "rustls 0.21.12", "tokio", "tracing", ] @@ -1594,7 +1806,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.3", "object", "rustc-demangle", ] @@ -1657,6 +1869,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bimap" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" + [[package]] name = "bit-set" version = "0.8.0" @@ -1696,11 +1914,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -1756,10 +1974,16 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "syn_derive", ] +[[package]] +name = "boxcar" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f64beae40a84da1b4b26ff2761a5b895c12adc41dc25aaee1c4f2bbfe97a6e" + [[package]] name = "bs58" version = "0.5.1" @@ -1907,7 +2131,34 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", ] [[package]] @@ -1930,6 +2181,9 @@ dependencies = [ "anstyle", "clap_lex", "strsim", + "terminal_size", + "unicase", + "unicode-width 0.1.14", ] [[package]] @@ -1941,7 +2195,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2007,6 +2261,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +[[package]] +name = "comfy-table" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03b7db8e0b4b2fdad6c551e634134e99ec000e5c8c3b6856c65e8bbaded7a3b" +dependencies = [ + "crossterm", + "unicode-segmentation", + "unicode-width 0.2.2", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -2098,12 +2363,31 @@ version = "0.1.0" dependencies = [ "alloy", "anyhow", + "contracts-generate", "ethcontract", "ethcontract-generate", "paste", "serde_json", "tracing", "tracing-subscriber", + "walkdir", +] + +[[package]] +name = "contracts-generate" +version = "0.1.0" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "eyre", + "forge-sol-macro-gen", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.108", + "walkdir", ] [[package]] @@ -2121,6 +2405,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie" version = "0.17.0" @@ -2240,6 +2533,16 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + [[package]] name = "crossbeam-epoch" version = "0.9.18" @@ -2264,6 +2567,29 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags 2.10.0", + "crossterm_winapi", + "document-features", + "parking_lot", + "rustix 1.1.2", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -2353,7 +2679,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2368,7 +2694,7 @@ dependencies = [ "quote", "serde", "strsim", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2379,7 +2705,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core 0.20.9", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2390,7 +2716,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2483,21 +2809,43 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "derive-where" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" dependencies = [ - "convert_case 0.4.0", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn 1.0.109", + "syn 2.0.108", ] [[package]] -name = "derive_more" -version = "1.0.0" +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ @@ -2522,7 +2870,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "unicode-xid", ] @@ -2532,9 +2880,10 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ + "convert_case 0.7.1", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "unicode-xid", ] @@ -2565,6 +2914,42 @@ dependencies = [ "subtle", ] +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.60.2", +] + +[[package]] +name = "doctest-file" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + [[package]] name = "dotenvy" version = "0.15.7" @@ -2644,6 +3029,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "e2e" version = "1.0.0" @@ -2709,7 +3100,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2767,7 +3158,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2778,12 +3169,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -2878,7 +3269,7 @@ dependencies = [ "ethcontract-generate", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -2892,7 +3283,7 @@ dependencies = [ "ethcontract-common", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "url", ] @@ -2981,6 +3372,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fastrand" version = "2.1.0" @@ -3033,12 +3434,13 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", - "miniz_oxide", + "libz-rs-sys", + "miniz_oxide 0.8.9", ] [[package]] @@ -3094,6 +3496,22 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "forge-sol-macro-gen" +version = "1.4.4" +source = "git+https://github.com/foundry-rs/foundry#a446ab30700b5c9384a42b5e53b1c72c43013799" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "eyre", + "foundry-common", + "heck 0.5.0", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -3103,6 +3521,195 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "foundry-block-explorers" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff814624bb21bfe43b70fb736ab39527b405d04cdc94d90b7e182fba28b25ec7" +dependencies = [ + "alloy-chains", + "alloy-json-abi", + "alloy-primitives", + "foundry-compilers", + "reqwest 0.12.12", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror 2.0.12", + "tracing", +] + +[[package]] +name = "foundry-common" +version = "1.4.4" +source = "git+https://github.com/foundry-rs/foundry#a446ab30700b5c9384a42b5e53b1c72c43013799" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-dyn-abi", + "alloy-eips", + "alloy-json-abi", + "alloy-json-rpc", + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-serde", + "alloy-sol-types", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ipc", + "alloy-transport-ws", + "anstream", + "anstyle", + "chrono", + "ciborium", + "clap", + "comfy-table", + "dunce", + "eyre", + "flate2", + "foundry-block-explorers", + "foundry-common-fmt", + "foundry-compilers", + "itertools 0.14.0", + "jiff", + "num-format", + "path-slash", + "regex", + "reqwest 0.12.12", + "revm", + "semver 1.0.23", + "serde", + "serde_json", + "solar-compiler", + "thiserror 2.0.12", + "tokio", + "tower 0.5.2", + "tracing", + "url", + "vergen", + "walkdir", + "yansi", +] + +[[package]] +name = "foundry-common-fmt" +version = "1.4.4" +source = "git+https://github.com/foundry-rs/foundry#a446ab30700b5c9384a42b5e53b1c72c43013799" +dependencies = [ + "alloy-consensus", + "alloy-dyn-abi", + "alloy-network", + "alloy-primitives", + "alloy-rpc-types", + "alloy-serde", + "chrono", + "eyre", + "revm", + "serde", + "serde_json", + "yansi", +] + +[[package]] +name = "foundry-compilers" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5767bfd01a240b57e6eb540e233b248d2ecb554d60b7936574cd077c0bd4c15e" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "auto_impl", + "derive_more 2.0.1", + "dyn-clone", + "foundry-compilers-artifacts", + "foundry-compilers-core", + "itertools 0.14.0", + "path-slash", + "rayon", + "semver 1.0.23", + "serde", + "serde_json", + "sha2", + "solar-compiler", + "svm-rs", + "svm-rs-builds", + "thiserror 2.0.12", + "tracing", + "winnow 0.7.11", + "yansi", +] + +[[package]] +name = "foundry-compilers-artifacts" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b35da40bb333baff6f4533431c050a94857a4d1a379365085da403938fc9edf" +dependencies = [ + "foundry-compilers-artifacts-solc", + "foundry-compilers-artifacts-vyper", +] + +[[package]] +name = "foundry-compilers-artifacts-solc" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff50fa9f518e96f80c77d1596122bb41c6fb9f1ec8d93e3127e2cf7a4726faa" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "foundry-compilers-core", + "memchr", + "path-slash", + "rayon", + "regex", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror 2.0.12", + "tracing", + "yansi", +] + +[[package]] +name = "foundry-compilers-artifacts-vyper" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34764d842fcf3aee77dc892beba3f12d7d5cebe196caf2050302caa986de8914" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "foundry-compilers-artifacts-solc", + "foundry-compilers-core", + "path-slash", + "semver 1.0.23", + "serde", +] + +[[package]] +name = "foundry-compilers-core" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48bcd9ff6881e2f5acd8544d490cc91d2c1d47c59c1e9337ea2ade66ce7e1800" +dependencies = [ + "alloy-primitives", + "cfg-if", + "dunce", + "path-slash", + "regex", + "semver 1.0.23", + "serde", + "serde_json", + "svm-rs", + "thiserror 2.0.12", + "tokio", + "walkdir", + "xxhash-rust", +] + [[package]] name = "fragile" version = "2.0.0" @@ -3182,7 +3789,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -3277,8 +3884,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -3354,6 +3963,17 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy 0.8.27", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -3470,6 +4090,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "hex" version = "0.4.3" @@ -3662,10 +4288,28 @@ dependencies = [ "http 0.2.12", "hyper 0.14.29", "log", - "rustls", - "rustls-native-certs", + "rustls 0.21.12", + "rustls-native-certs 0.6.3", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http 1.1.0", + "hyper 1.6.0", + "hyper-util", + "rustls 0.23.34", + "rustls-native-certs 0.8.0", + "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.26.4", + "tower-service", + "webpki-roots 1.0.3", ] [[package]] @@ -3840,6 +4484,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indenter" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" + +[[package]] +name = "index_vec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44faf5bb8861a9c72e20d3fb0fdbd59233e43056e2b80475ab0aacdc2e781355" + [[package]] name = "indexmap" version = "1.9.3" @@ -3857,6 +4513,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ + "arbitrary", "equivalent", "hashbrown 0.15.4", "serde", @@ -3871,13 +4528,41 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "interprocess" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d941b405bd2322993887859a8ee6ac9134945a24ec5ec763a8a962fc64dfec2d" +dependencies = [ + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", +] + +[[package]] +name = "inturn" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2efbe120e37f17bb33fcdc82bc1c65087242608be37ace3cf7ebf49f3164e37" +dependencies = [ + "boxcar", + "bumpalo", + "dashmap", + "hashbrown 0.14.5", + "thread_local", +] + [[package]] name = "io-uring" version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", "cfg-if", "libc", ] @@ -3888,6 +4573,17 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is-terminal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +dependencies = [ + "hermit-abi 0.5.2", + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.0" @@ -3937,12 +4633,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "js-sys" -version = "0.3.69" +name = "jiff" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" dependencies = [ - "wasm-bindgen", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", ] [[package]] @@ -3960,6 +4680,21 @@ dependencies = [ "serde_json", ] +[[package]] +name = "jsonwebtoken" +version = "9.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a87cc7a48537badeae96744432de36f4be2b4a34a05a5ef32e9dd8a1c169dde" +dependencies = [ + "base64 0.22.1", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "k256" version = "0.13.4" @@ -4025,6 +4760,16 @@ dependencies = [ "libc", ] +[[package]] +name = "libredox" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags 2.10.0", + "libc", +] + [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -4036,6 +4781,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libz-rs-sys" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840db8cf39d9ec4dd794376f38acc40d0fc65eec2a8f484f7fd375b84602becd" +dependencies = [ + "zlib-rs", +] + [[package]] name = "libz-sys" version = "1.1.18" @@ -4054,6 +4808,18 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.12" @@ -4064,6 +4830,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.21" @@ -4109,7 +4881,7 @@ checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4145,9 +4917,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "mimalloc" @@ -4189,6 +4961,16 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "mio" version = "1.0.4" @@ -4251,7 +5033,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4345,6 +5127,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "normalize-path" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5438dd2b2ff4c6df6e1ce22d825ed2fa93ee2922235cc45186991717f0a892d" + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -4411,6 +5199,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec", + "itoa", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -4480,7 +5278,7 @@ checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4562,13 +5360,31 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "once_map" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29eefd5038c9eee9e788d90966d6b5578dd3f88363a91edaec117a7ae0adc2d5" +dependencies = [ + "ahash 0.8.11", + "hashbrown 0.16.0", + "parking_lot", + "stable_deref_trait", +] + [[package]] name = "openssl" version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", "cfg-if", "foreign-types", "libc", @@ -4585,7 +5401,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4680,6 +5496,12 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "order-validation" version = "0.1.0" @@ -4753,6 +5575,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -4814,6 +5648,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + [[package]] name = "pbkdf2" version = "0.12.2" @@ -4824,6 +5664,16 @@ dependencies = [ "hmac", ] +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -4850,6 +5700,16 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -4867,7 +5727,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -4915,6 +5775,15 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -4971,6 +5840,25 @@ 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 = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -5035,14 +5923,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", ] @@ -5092,18 +5980,29 @@ checksum = "6fcdab19deb5195a31cf7726a210015ff1496ba1464fd42cb4f537b8b01b471f" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.9.1", + "bitflags 2.10.0", "lazy_static", "num-traits", "rand 0.9.1", "rand_chacha 0.9.0", "rand_xorshift", - "regex-syntax 0.8.3", + "regex-syntax 0.8.8", "rusty-fork", "tempfile", "unarray", ] +[[package]] +name = "proptest-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "095a99f75c69734802359b682be8daaf8980296731f6470434ea2c652af1dd30" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + [[package]] name = "prost" version = "0.12.6" @@ -5134,7 +6033,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -5147,7 +6046,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -5207,11 +6106,63 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.34", + "socket2 0.5.10", + "thiserror 2.0.12", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom 0.2.15", + "rand 0.8.5", + "ring", + "rustc-hash", + "rustls 0.23.34", + "rustls-pki-types", + "slab", + "thiserror 2.0.12", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.0", + "tracing", + "windows-sys 0.60.2", +] + [[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", ] @@ -5315,6 +6266,32 @@ dependencies = [ "tracing", ] +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redox_syscall" version = "0.4.1" @@ -5330,7 +6307,18 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror 2.0.12", ] [[package]] @@ -5363,14 +6351,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.13", + "regex-syntax 0.8.8", ] [[package]] @@ -5384,13 +6372,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.8", ] [[package]] @@ -5407,9 +6395,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rend" @@ -5479,6 +6467,7 @@ dependencies = [ "http-body 1.0.0", "http-body-util", "hyper 1.6.0", + "hyper-rustls 0.27.7", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -5489,22 +6478,202 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "quinn", + "rustls 0.23.34", + "rustls-native-certs 0.8.0", "rustls-pemfile 2.2.0", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 1.0.2", "tokio", "tokio-native-tls", + "tokio-rustls 0.26.4", + "tokio-socks", "tower 0.5.2", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots 0.26.11", "windows-registry", ] +[[package]] +name = "revm" +version = "30.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76df793c6ef3bef8f88f05b3873ebebce1494385a3ce8f58ad2e2e111aa0de11" +dependencies = [ + "revm-bytecode", + "revm-context", + "revm-context-interface", + "revm-database", + "revm-database-interface", + "revm-handler", + "revm-inspector", + "revm-interpreter", + "revm-precompile", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-bytecode" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451748b17ac78bd2b0748ec472a5392cd78fc0f7d19d528be44770fda28fd6f7" +dependencies = [ + "bitvec", + "revm-primitives", +] + +[[package]] +name = "revm-context" +version = "10.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7adcce0c14cf59b7128de34185a0fbf8f63309539b9263b35ead870d73584114" +dependencies = [ + "bitvec", + "cfg-if", + "derive-where", + "revm-bytecode", + "revm-context-interface", + "revm-database-interface", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-context-interface" +version = "11.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d620a9725e443c171fb195a074331fa4a745fa5cbb0018b4bbf42619e64b563" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "auto_impl", + "either", + "revm-database-interface", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-database" +version = "9.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdefd7f40835e992bab40a245124cb1243e6c7a1c4659798827c809a59b0fea9" +dependencies = [ + "revm-bytecode", + "revm-database-interface", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-database-interface" +version = "8.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa488a73ac2738f11478650cdf1a0f263864c09d5f0e9bf6309e891a05323c60" +dependencies = [ + "auto_impl", + "either", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-handler" +version = "11.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d8049b2fbff6636150f4740c95369aa174e41b0383034e0e256cfdffcfcd23" +dependencies = [ + "auto_impl", + "derive-where", + "revm-bytecode", + "revm-context", + "revm-context-interface", + "revm-database-interface", + "revm-interpreter", + "revm-precompile", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-inspector" +version = "11.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2a21dd773b654ec7e080025eecef4ac84c711150d1bd36acadf0546f471329a" +dependencies = [ + "auto_impl", + "either", + "revm-context", + "revm-database-interface", + "revm-handler", + "revm-interpreter", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-interpreter" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1de5c790122f8ded67992312af8acd41ccfcee629b25b819e10c5b1f69caf57" +dependencies = [ + "revm-bytecode", + "revm-context-interface", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-precompile" +version = "28.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57aadd7a2087705f653b5aaacc8ad4f8e851f5d330661e3f4c43b5475bbceae" +dependencies = [ + "ark-bls12-381", + "ark-bn254", + "ark-ec", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "arrayref", + "aurora-engine-modexp", + "cfg-if", + "k256", + "p256", + "revm-primitives", + "ripemd", + "sha2", +] + +[[package]] +name = "revm-primitives" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "536f30e24c3c2bf0d3d7d20fa9cf99b93040ed0f021fd9301c78cddb0dacda13" +dependencies = [ + "alloy-primitives", + "num_enum", + "once_cell", +] + +[[package]] +name = "revm-state" +version = "8.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6bd5e669b02007872a8ca2643a14e308fe1739ee4475d74122587c3388a06a" +dependencies = [ + "bitflags 2.10.0", + "revm-bytecode", + "revm-primitives", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -5604,6 +6773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a68df0380e5c9d20ce49534f292a36a7514ae21350726efe1865bdb1fa91d278" dependencies = [ "alloy-rlp", + "arbitrary", "ark-ff 0.3.0", "ark-ff 0.4.2", "ark-ff 0.5.0", @@ -5658,6 +6828,9 @@ name = "rustc-hash" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +dependencies = [ + "rand 0.8.5", +] [[package]] name = "rustc-hex" @@ -5689,13 +6862,26 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.60.2", +] + [[package]] name = "rustls" version = "0.21.12" @@ -5704,10 +6890,24 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki 0.103.7", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -5720,6 +6920,19 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.2.0", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -5744,6 +6957,7 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ + "web-time", "zeroize", ] @@ -5757,6 +6971,17 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.103.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -5795,6 +7020,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" @@ -5892,7 +7126,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", "core-foundation", "core-foundation-sys", "libc", @@ -5923,6 +7157,9 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] [[package]] name = "semver-parser" @@ -5933,6 +7170,12 @@ dependencies = [ "pest", ] +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" version = "1.0.228" @@ -5960,7 +7203,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6032,7 +7275,7 @@ dependencies = [ "darling 0.20.9", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6058,9 +7301,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -6180,12 +7423,30 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "simdutf8" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +[[package]] +name = "simple_asn1" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.12", + "time", +] + [[package]] name = "slab" version = "0.4.9" @@ -6205,23 +7466,169 @@ dependencies = [ ] [[package]] -name = "socket2" -version = "0.5.10" +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "solar-ast" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6aaf98d032ba3be85dca5f969895ade113a9137bb5956f80c5faf14689de59" +dependencies = [ + "alloy-primitives", + "bumpalo", + "either", + "num-rational", + "semver 1.0.23", + "solar-data-structures", + "solar-interface", + "solar-macros", + "strum", +] + +[[package]] +name = "solar-compiler" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e792060bcbb007a6b9b060292945fb34ff854c7d93a9628f81b6c809eb4360" +dependencies = [ + "alloy-primitives", + "solar-ast", + "solar-config", + "solar-data-structures", + "solar-interface", + "solar-macros", + "solar-parse", + "solar-sema", +] + +[[package]] +name = "solar-config" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff16d692734c757edd339f5db142ba91b42772f8cbe1db1ce3c747f1e777185f" +dependencies = [ + "colorchoice", + "strum", +] + +[[package]] +name = "solar-data-structures" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dea34e58332c7d6a8cde1f1740186d31682b7be46e098b8cc16fcb7ffd98bf5" +dependencies = [ + "bumpalo", + "index_vec", + "indexmap 2.10.0", + "parking_lot", + "rayon", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "solar-interface" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6163af2e773f4d455212fa9ba2c0664506029dd26232eb406f5046092ac311" +dependencies = [ + "annotate-snippets", + "anstream", + "anstyle", + "derive_more 2.0.1", + "dunce", + "inturn", + "itertools 0.14.0", + "itoa", + "normalize-path", + "once_map", + "rayon", + "scoped-tls", + "serde", + "serde_json", + "solar-config", + "solar-data-structures", + "solar-macros", + "thiserror 2.0.12", + "tracing", + "unicode-width 0.2.2", +] + +[[package]] +name = "solar-macros" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44a98045888d75d17f52e7b76f6098844b76078b5742a450c3ebcdbdb02da124" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", +] + +[[package]] +name = "solar-parse" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +checksum = "19b77a9cbb07948e4586cdcf64f0a483424197308816ebd57a4cf06130b68562" dependencies = [ - "libc", - "windows-sys 0.52.0", + "alloy-primitives", + "bitflags 2.10.0", + "bumpalo", + "itertools 0.14.0", + "memchr", + "num-bigint", + "num-rational", + "num-traits", + "ruint", + "smallvec", + "solar-ast", + "solar-data-structures", + "solar-interface", + "tracing", ] [[package]] -name = "socket2" -version = "0.6.0" +name = "solar-sema" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "cd033af43a38da316a04b25bbd20b121ce5d728b61e6988fd8fd6e2f1e68d0a1" dependencies = [ - "libc", - "windows-sys 0.59.0", + "alloy-json-abi", + "alloy-primitives", + "bitflags 2.10.0", + "bumpalo", + "derive_more 2.0.1", + "either", + "once_map", + "paste", + "rayon", + "serde", + "serde_json", + "solar-ast", + "solar-data-structures", + "solar-interface", + "solar-macros", + "solar-parse", + "strum", + "thread_local", + "tracing", ] [[package]] @@ -6455,7 +7862,7 @@ dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.9.1", + "bitflags 2.10.0", "byteorder", "bytes", "chrono", @@ -6499,7 +7906,7 @@ dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.9.1", + "bitflags 2.10.0", "byteorder", "chrono", "crc", @@ -6555,6 +7962,12 @@ dependencies = [ "urlencoding", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + [[package]] name = "static_assertions" version = "1.1.0" @@ -6596,7 +8009,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6605,6 +8018,37 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "svm-rs" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f15cc0fb280301739995e3b9f0f0dde3aecb876814f4768689f9138570cd3b" +dependencies = [ + "const-hex", + "dirs", + "reqwest 0.12.12", + "semver 1.0.23", + "serde", + "serde_json", + "sha2", + "tempfile", + "thiserror 2.0.12", + "url", + "zip", +] + +[[package]] +name = "svm-rs-builds" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31affc47068aeef445accc5c3d5f7fd24f9072cae0a651cef564239003c94ff8" +dependencies = [ + "const-hex", + "semver 1.0.23", + "serde_json", + "svm-rs", +] + [[package]] name = "syn" version = "1.0.109" @@ -6618,9 +8062,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", @@ -6629,14 +8073,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2375c17f6067adc651d8c2c51658019cef32edfff4a982adaf1d7fd1c039f08b" +checksum = "ff790eb176cc81bb8936aed0f7b9f14fc4670069a2d371b3e3b0ecce908b2cb3" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6648,7 +8092,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6707,10 +8151,20 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "rustix", + "rustix 0.38.34", "windows-sys 0.52.0", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.34", + "windows-sys 0.48.0", +] + [[package]] name = "termtree" version = "0.4.1" @@ -6755,7 +8209,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6766,7 +8220,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6883,7 +8337,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -6902,7 +8356,29 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls 0.23.34", + "tokio", +] + +[[package]] +name = "tokio-socks" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" +dependencies = [ + "either", + "futures-util", + "thiserror 1.0.61", "tokio", ] @@ -6918,6 +8394,22 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "tokio-tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" +dependencies = [ + "futures-util", + "log", + "rustls 0.23.34", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.4", + "tungstenite", + "webpki-roots 0.26.11", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -7074,7 +8566,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", "bytes", "futures-core", "futures-util", @@ -7119,7 +8611,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7199,6 +8691,25 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" +dependencies = [ + "bytes", + "data-encoding", + "http 1.1.0", + "httparse", + "log", + "rand 0.9.1", + "rustls 0.23.34", + "rustls-pki-types", + "sha1", + "thiserror 2.0.12", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" @@ -7271,6 +8782,18 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -7307,11 +8830,17 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" @@ -7367,6 +8896,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" @@ -7444,7 +8983,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -7478,7 +9017,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7554,6 +9093,24 @@ dependencies = [ "url", ] +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.3", +] + +[[package]] +name = "webpki-roots" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "whoami" version = "1.5.1" @@ -7564,6 +9121,12 @@ dependencies = [ "wasite", ] +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi" version = "0.3.9" @@ -7580,6 +9143,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.60.2", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -7626,7 +9198,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7637,7 +9209,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", ] [[package]] @@ -7646,6 +9218,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-registry" version = "0.2.0" @@ -7703,6 +9281,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -7727,13 +9314,30 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7746,6 +9350,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7758,6 +9368,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7770,12 +9386,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7788,6 +9416,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7800,6 +9434,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7812,6 +9452,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7824,6 +9470,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winnow" version = "0.5.40" @@ -7867,7 +9519,26 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.10.0", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c173014acad22e83f16403ee360115b38846fe754e735c5d9d3803fe70c6abc" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper", + "thiserror 2.0.12", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] @@ -7885,13 +9556,37 @@ version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" +[[package]] +name = "xxhash-rust" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +dependencies = [ + "is-terminal", +] + [[package]] name = "zerocopy" version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.34", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive 0.8.27", ] [[package]] @@ -7902,7 +9597,18 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.108", ] [[package]] @@ -7922,5 +9628,39 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.108", +] + +[[package]] +name = "zip" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1" +dependencies = [ + "arbitrary", + "crc32fast", + "flate2", + "indexmap 2.10.0", + "memchr", + "zopfli", +] + +[[package]] +name = "zlib-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f06ae92f42f5e5c42443fd094f245eb656abf56dd7cce9b8b263236565e00f2" + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", ] diff --git a/Cargo.toml b/Cargo.toml index 9c71dbd5de..5954153c37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "3" -members = ["crates/*"] +members = [ "crates/*"] [workspace.dependencies] alloy = { version = "1.0.41", default-features = false } @@ -100,5 +100,20 @@ tracing-opentelemetry = "0.31" tracing-serde = "0.2" vergen = "8" +foundry-compilers = "0.19.5" +walkdir = "2.5.0" + +forge-sol-macro-gen = {git = "https://github.com/foundry-rs/foundry", version = "1.4.1"} +alloy-json-abi = "1.4.1" +alloy-dyn-abi = "1.4.1" +quote = "1.0.41" +syn = "2.0.108" +prettyplease = "0.2.37" +contracts-generate = {path = "crates/contracts-generate"} +eyre = "0.6.12" +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/infra/blockchain/contracts.rs b/crates/autopilot/src/infra/blockchain/contracts.rs index 427437de80..bfee192fc4 100644 --- a/crates/autopilot/src/infra/blockchain/contracts.rs +++ b/crates/autopilot/src/infra/blockchain/contracts.rs @@ -1,12 +1,9 @@ use { crate::domain, chain::Chain, - contracts::alloy::{ - ChainalysisOracle, - GPv2AllowListAuthentication, - HooksTrampoline, - InstanceExt, - support::Balances, + contracts::{ + alloy::{GPv2AllowListAuthentication, HooksTrampoline, InstanceExt, support::Balances}, + bindings::ChainalysisOracle, }, ethrpc::{Web3, alloy::conversions::IntoAlloy}, primitive_types::H160, diff --git a/crates/contracts-generate/Cargo.toml b/crates/contracts-generate/Cargo.toml new file mode 100644 index 0000000000..8761d1b212 --- /dev/null +++ b/crates/contracts-generate/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "contracts-generate" +version = "0.1.0" +edition = "2024" + +[dependencies] +walkdir = {workspace = true} +forge-sol-macro-gen = {workspace = true} + +alloy-json-abi = {workspace = true} +alloy-dyn-abi = {workspace = true} +# alloy = {workspace = true} +quote = {workspace = true} +syn = {workspace = true} +prettyplease = {workspace = true} +eyre = {workspace = true} +proc-macro2 = {workspace = true} +alloy-sol-macro-input = {workspace = true} +alloy-sol-macro-expander = {workspace = true} + +[lints] +workspace = true diff --git a/crates/contracts-generate/src/lib.rs b/crates/contracts-generate/src/lib.rs new file mode 100644 index 0000000000..c00d4dbda2 --- /dev/null +++ b/crates/contracts-generate/src/lib.rs @@ -0,0 +1,235 @@ +use { + alloy_sol_macro_expander::expand::expand, + alloy_sol_macro_input::{SolInput, SolInputKind}, + forge_sol_macro_gen::SolMacroGen, + quote::format_ident, + std::{ + collections::HashMap, + fmt::Write, + path::{Path, PathBuf}, + }, +}; + +const MOD_HEADER: &'static 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. + "#; + +pub struct Contracts { + pub contracts: Vec, +} + +impl Contracts { + pub fn new() -> Self { + Self { contracts: vec![] } + } + + pub fn add_contract(mut self, contract: Contract) -> Self { + self.contracts.push(contract); + self + } + + pub fn write_formatted( + self, + bindings_folder: &Path, + all_derives: bool, + output_folder: &Path, + ) -> eyre::Result<()> { + let mut mod_file = String::from(MOD_HEADER); + + for contract in self.contracts { + let name = contract.name.clone(); + contract.write_formatted(bindings_folder, 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_network>( + mut self, + id: u64, + (address, block_number): (S, Option), + ) -> Self { + 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, + ) -> eyre::Result { + let bindings_path = self.bindings_path(bindings_folder.as_ref()); + let mut instance = SolMacroGen::new(bindings_path, self.name.clone()); + generate_binding(&mut instance, all_derives)?; + + let module_name_ident = format_ident!("{}", self.name); + let instance_name_ident = format_ident!("{}Instance", self.name); + + let network_entries = self.networks.iter().map(|(id, (address, block_number))| { + let block_expr = match block_number { + Some(block) => quote::quote! { Some(#block) }, + None => quote::quote! { None }, + }; + quote::quote! { + (#id, (::alloy::primitives::address!(#address), #block_expr)) + } + }); + + let extensions = quote::quote! { + use { + std::{ + sync::LazyLock, + collections::HashMap + }, + anyhow::{Result, Context}, + alloy::{ + providers::{Provider, DynProvider}, + primitives::{address, Address}, + }, + }; + + pub type Instance = #module_name_ident :: #instance_name_ident; + static DEPLOYMENT_INFO: LazyLock)>> = LazyLock::new(|| { + ::std::collections::HashMap::from([ + #(#network_entries),* + ]) + }); + + + /// 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(), + )) + } + } + + fn deployed_block(&self) -> impl Future>> + Send { + async move { + let chain_id = self + .provider() + .get_chain_id() + .await + .context("could not fetch current chain id")?; + if let Some((_address, deployed_block)) = DEPLOYMENT_INFO.get(&chain_id) { + return Ok(*deployed_block); + } + Ok(None) + } + } + } + }; + + let mut expansion = instance + .expansion + .expect("if the expansion failed, it should have errored earlier"); + expansion.extend(extensions); + + Ok(expansion) + } + + pub fn write_formatted( + self, + bindings_folder: P1, + all_derives: bool, + output_folder: P2, + ) -> eyre::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.to_string())?; + 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) -> eyre::Result<()> { + let input = instance.get_sol_input()?.normalize_json()?; + 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) -> eyre::Result<()> { + if syn::parse_str::(&format!("pub mod {name};")).is_ok() { + write!(contents, "pub mod {name};")?; + } else { + write!(contents, "pub mod r#{name};")?; + } + Ok(()) +} diff --git a/crates/contracts/.gitignore b/crates/contracts/.gitignore new file mode 100644 index 0000000000..b69411a661 --- /dev/null +++ b/crates/contracts/.gitignore @@ -0,0 +1 @@ +src/bindings diff --git a/crates/contracts/Cargo.toml b/crates/contracts/Cargo.toml index dbd069dbe8..ef9c4bfe92 100644 --- a/crates/contracts/Cargo.toml +++ b/crates/contracts/Cargo.toml @@ -35,6 +35,8 @@ tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"], optio [build-dependencies] ethcontract = { workspace = true } ethcontract-generate = { workspace = true } +walkdir = {workspace = true} +contracts-generate = {workspace = true} [lints] workspace = true diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index eb6192a8e2..89acdd18c6 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -1,3 +1,5 @@ +use contracts_generate::{Contract, Contracts}; + use { ethcontract::{ Address, @@ -22,6 +24,28 @@ const BNB: &str = "56"; const OPTIMISM: &str = "10"; const LENS: &str = "232"; +macro_rules! info { + ($addr:expr) => { + ($addr, None) + }; + ($addr:expr, $block:expr) => { + ($addr, Some($block)) + }; +} + +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; +} + 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 @@ -32,6 +56,42 @@ fn main() { // - https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpath println!("cargo:rerun-if-changed=build.rs"); + std::fs::create_dir_all("src/bindings").unwrap(); + Contracts::new() + .add_contract( + Contract::new("ChainalysisOracle") + .with_network( + networks::MAINNET, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ) + .with_network( + networks::ARBITRUM_ONE, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ) + .with_network( + networks::BASE, + info!("0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B"), + ) + .with_network( + networks::AVALANCHE, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ) + .with_network( + networks::BNB, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ) + .with_network( + networks::OPTIMISM, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ) + .with_network( + networks::POLYGON, + info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), + ), + ) + .write_formatted(Path::new("artifacts"), false, Path::new("src/bindings")) + .unwrap(); + generate_contract("ERC20"); generate_contract_with_config("GPv2Settlement", |builder| { builder diff --git a/crates/contracts/src/alloy.rs b/crates/contracts/src/alloy.rs index de9503cf61..2c919300e0 100644 --- a/crates/contracts/src/alloy.rs +++ b/crates/contracts/src/alloy.rs @@ -11,19 +11,6 @@ pub mod networks { pub const LENS: u64 = 232; } -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! { diff --git a/crates/contracts/src/lib.rs b/crates/contracts/src/lib.rs index 15e4f3059c..cb8ba383d5 100644 --- a/crates/contracts/src/lib.rs +++ b/crates/contracts/src/lib.rs @@ -42,6 +42,8 @@ pub mod paths; pub mod vault; pub mod web3; +pub mod bindings; + macro_rules! include_contracts { ($($name:ident;)*) => {$( include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); diff --git a/crates/order-validation/src/banned.rs b/crates/order-validation/src/banned.rs index f7c27eb8d7..8b2e5b5d37 100644 --- a/crates/order-validation/src/banned.rs +++ b/crates/order-validation/src/banned.rs @@ -6,7 +6,7 @@ use { alloy::primitives::Address, - contracts::alloy::ChainalysisOracle, + contracts::bindings::ChainalysisOracle, futures::future::join_all, moka::sync::Cache, std::{ diff --git a/crates/orderbook/src/run.rs b/crates/orderbook/src/run.rs index 4d5818d055..d67a0f5487 100644 --- a/crates/orderbook/src/run.rs +++ b/crates/orderbook/src/run.rs @@ -17,12 +17,12 @@ use { WETH9, alloy::{ BalancerV2Vault, - ChainalysisOracle, HooksTrampoline, IUniswapV3Factory, InstanceExt, support::Balances, }, + bindings::ChainalysisOracle, }, ethrpc::alloy::conversions::{IntoAlloy, IntoLegacy}, futures::{FutureExt, StreamExt}, From b879cfa5dbdd4358466f8cdec77395eaad81caa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Mon, 27 Oct 2025 17:03:26 +0000 Subject: [PATCH 02/36] wip --- .../src/infra/blockchain/contracts.rs | 2 +- crates/contracts-generate/src/lib.rs | 151 +++++++++++------- crates/contracts/build.rs | 51 ++---- crates/contracts/src/lib.rs | 1 + 4 files changed, 103 insertions(+), 102 deletions(-) diff --git a/crates/autopilot/src/infra/blockchain/contracts.rs b/crates/autopilot/src/infra/blockchain/contracts.rs index bfee192fc4..b2d28567eb 100644 --- a/crates/autopilot/src/infra/blockchain/contracts.rs +++ b/crates/autopilot/src/infra/blockchain/contracts.rs @@ -2,7 +2,7 @@ use { crate::domain, chain::Chain, contracts::{ - alloy::{GPv2AllowListAuthentication, HooksTrampoline, InstanceExt, support::Balances}, + alloy::{GPv2AllowListAuthentication, HooksTrampoline, support::Balances}, bindings::ChainalysisOracle, }, ethrpc::{Web3, alloy::conversions::IntoAlloy}, diff --git a/crates/contracts-generate/src/lib.rs b/crates/contracts-generate/src/lib.rs index c00d4dbda2..07f7be499c 100644 --- a/crates/contracts-generate/src/lib.rs +++ b/crates/contracts-generate/src/lib.rs @@ -66,13 +66,15 @@ impl Contract { } } - pub fn with_network>( - mut self, - id: u64, - (address, block_number): (S, Option), - ) -> Self { - self.networks - .insert(id, (address.as_ref().to_string(), block_number)); + 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 } @@ -86,8 +88,8 @@ impl Contract { all_derives: bool, ) -> eyre::Result { let bindings_path = self.bindings_path(bindings_folder.as_ref()); - let mut instance = SolMacroGen::new(bindings_path, self.name.clone()); - generate_binding(&mut instance, all_derives)?; + let mut macrogen = SolMacroGen::new(bindings_path, self.name.clone()); + generate_binding(&mut macrogen, all_derives)?; let module_name_ident = format_ident!("{}", self.name); let instance_name_ident = format_ident!("{}Instance", self.name); @@ -102,71 +104,78 @@ impl Contract { } }); - let extensions = quote::quote! { - use { - std::{ - sync::LazyLock, - collections::HashMap - }, - anyhow::{Result, Context}, - alloy::{ - providers::{Provider, DynProvider}, - primitives::{address, Address}, - }, - }; + let instance = quote::quote! { + pub type Instance = #module_name_ident :: #instance_name_ident<::alloy::providers::DynProvider>; + }; - pub type Instance = #module_name_ident :: #instance_name_ident; - static DEPLOYMENT_INFO: LazyLock)>> = LazyLock::new(|| { - ::std::collections::HashMap::from([ - #(#network_entries),* - ]) - }); + let deployment_info = if self.networks.is_empty() { + proc_macro2::TokenStream::new() + } else { + quote::quote! { + use { + std::{ + sync::LazyLock, + collections::HashMap + }, + anyhow::{Result, Context}, + alloy::{ + providers::{Provider, DynProvider}, + primitives::{address, Address}, + }, + }; + static DEPLOYMENT_INFO: LazyLock)>> = LazyLock::new(|| { + ::std::collections::HashMap::from([ + #(#network_entries),* + ]) + }); - /// 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) - } + /// 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 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 + .get(&chain_id) + .with_context(|| format!("no deployment info for chain {chain_id:?}"))?; - 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(), - )) + Ok(Instance::new( + address, + provider.clone(), + )) + } } - } - fn deployed_block(&self) -> impl Future>> + Send { - async move { - let chain_id = self - .provider() - .get_chain_id() - .await - .context("could not fetch current chain id")?; - if let Some((_address, deployed_block)) = DEPLOYMENT_INFO.get(&chain_id) { - return Ok(*deployed_block); + pub fn deployed_block(&self) -> impl Future>> + Send { + async move { + let chain_id = self + .provider() + .get_chain_id() + .await + .context("could not fetch current chain id")?; + if let Some((_address, deployed_block)) = DEPLOYMENT_INFO.get(&chain_id) { + return Ok(*deployed_block); + } + Ok(None) } - Ok(None) } } } }; - let mut expansion = instance + let mut expansion = macrogen .expansion .expect("if the expansion failed, it should have errored earlier"); - expansion.extend(extensions); + expansion.extend(instance); + expansion.extend(deployment_info); Ok(expansion) } @@ -233,3 +242,25 @@ fn write_mod_name(contents: &mut String, name: &str) -> eyre::Result<()> { } Ok(()) } + +#[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)) + }; +} diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index 89acdd18c6..1be350a03d 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -1,4 +1,4 @@ -use contracts_generate::{Contract, Contracts}; +use contracts_generate::{Contract, Contracts, networks}; use { ethcontract::{ @@ -24,15 +24,6 @@ const BNB: &str = "56"; const OPTIMISM: &str = "10"; const LENS: &str = "232"; -macro_rules! info { - ($addr:expr) => { - ($addr, None) - }; - ($addr:expr, $block:expr) => { - ($addr, Some($block)) - }; -} - pub mod networks { pub const MAINNET: u64 = 1; pub const GNOSIS: u64 = 100; @@ -58,37 +49,15 @@ fn main() { std::fs::create_dir_all("src/bindings").unwrap(); Contracts::new() - .add_contract( - Contract::new("ChainalysisOracle") - .with_network( - networks::MAINNET, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ) - .with_network( - networks::ARBITRUM_ONE, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ) - .with_network( - networks::BASE, - info!("0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B"), - ) - .with_network( - networks::AVALANCHE, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ) - .with_network( - networks::BNB, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ) - .with_network( - networks::OPTIMISM, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ) - .with_network( - networks::POLYGON, - info!("0x40C57923924B5c5c5455c48D93317139ADDaC8fb"), - ), - ) + .add_contract(Contract::new("ChainalysisOracle").with_networks(networks![ + networks::MAINNET => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + networks::ARBITRUM_ONE => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + networks::BASE => "0x3A91A31cB3dC49b4db9Ce721F50a9D076c8D739B", + networks::AVALANCHE => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + networks::BNB => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + networks::OPTIMISM => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + networks::POLYGON => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", + ])) .write_formatted(Path::new("artifacts"), false, Path::new("src/bindings")) .unwrap(); diff --git a/crates/contracts/src/lib.rs b/crates/contracts/src/lib.rs index cb8ba383d5..0e54ba4ff5 100644 --- a/crates/contracts/src/lib.rs +++ b/crates/contracts/src/lib.rs @@ -42,6 +42,7 @@ pub mod paths; pub mod vault; pub mod web3; +#[rustfmt::skip] pub mod bindings; macro_rules! include_contracts { From df03e933d850510181313b503f203ea2567bdeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Mon, 27 Oct 2025 17:29:25 +0000 Subject: [PATCH 03/36] wip --- crates/contracts/build.rs | 235 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index 1be350a03d..cb9ac0abe9 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -49,6 +49,241 @@ fn main() { std::fs::create_dir_all("src/bindings").unwrap(); Contracts::new() + .add_contract(Contract::new("IZeroex").with_networks(networks![ + networks::MAINNET => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::SEPOLIA => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::ARBITRUM_ONE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::BASE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::AVALANCHE => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::BNB => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + networks::OPTIMISM => "0xdef1abe32c034e558cdd535791643c58a13acc10", + networks::POLYGON => "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + ])) + .add_contract(Contract::new("ERC20Mintable")) + .add_contract(Contract::new("GnosisSafe")) + .add_contract(Contract::new("GnosisSafeCompatibilityFallbackHandler")) + .add_contract(Contract::new("GnosisSafeProxy")) + .add_contract(Contract::new("GnosisSafeProxyFactory")) + .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![ + // + // + networks::MAINNET => ("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9", 12272147), + ])) + .add_contract(Contract::new("BalancerV2WeightedPoolFactoryV3").with_networks(networks![ + // + // + networks::MAINNET => ("0x5Dd94Da3644DDD055fcf6B3E1aa310Bb7801EB8b", 16520627), + // + networks::GNOSIS => ("0xC128a9954e6c874eA3d62ce62B468bA073093F25", 26226256), + // + networks::AVALANCHE => ("0x94f68b54191F62f781Fe8298A8A5Fa3ed772d227", 26389236), + // + networks::OPTIMISM => ("0xA0DAbEBAAd1b243BBb243f933013d560819eB66f", 72832703), + // + networks::POLYGON => ("0x82e4cFaef85b1B6299935340c964C942280327f4", 39036828), + // + networks::BNB => ("0x6e4cF292C5349c79cCd66349c3Ed56357dD11B46", 25474982), + ])) + .add_contract(Contract::new("BalancerV2WeightedPoolFactoryV4").with_networks(networks![ + // + networks::MAINNET => ("0x897888115Ada5773E02aA29F775430BFB5F34c51", 16878323), + // + networks::GNOSIS => ("0x6CaD2ea22BFA7F4C14Aae92E47F510Cd5C509bc7", 27055829), + // + // + networks::SEPOLIA => ("0x7920BFa1b2041911b354747CA7A6cDD2dfC50Cfd", 3424893), + // + networks::ARBITRUM_ONE => ("0xc7E5ED1054A24Ef31D827E6F86caA58B3Bc168d7", 72222060), + // + networks::BASE => ("0x4C32a8a8fDa4E24139B51b456B42290f51d6A1c4", 1204869), + // + networks::AVALANCHE => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 27739006), + // + networks::OPTIMISM => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 82737545), + // + networks::POLYGON => ("0xFc8a407Bba312ac761D8BFe04CE1201904842B76", 40611103), + // + networks::BNB => ("0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a", 26665331), + ])) + .add_contract(Contract::new("BalancerV2WeightedPool2TokensFactory").with_networks(networks![ + // + // + networks::MAINNET => ("0xa5bf2ddf098bb0ef6d120c98217dd6b141c74ee0", 12349891), + networks::ARBITRUM_ONE => ("0xCF0a32Bbef8F064969F21f7e02328FB577382018", 222864), + // + networks::OPTIMISM => ("0xdAE7e32ADc5d490a43cCba1f0c736033F2b4eFca", 7005512), + // + networks::POLYGON => ("0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9", 15832998), + ])) + .add_contract(Contract::new("BalancerV2LiquidityBootstrappingPoolFactory").with_networks(networks![ + // + // + networks::MAINNET => ("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE", 12871780), + networks::ARBITRUM_ONE => ("0x142B9666a0a3A30477b052962ddA81547E7029ab", 222870), + // + networks::POLYGON => ("0x751A0bC0e3f75b38e01Cf25bFCE7fF36DE1C87DE", 17116402), + ])) + .add_contract(Contract::new("BalancerV2NoProtocolFeeLiquidityBootstrappingPoolFactory").with_networks(networks![ + // + // + networks::MAINNET => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 13730248), + // + // + networks::GNOSIS => ("0x85a80afee867aDf27B50BdB7b76DA70f1E853062", 25415236), + // + // + networks::SEPOLIA => ("0x45fFd460cC6642B8D8Fb12373DFd77Ceb0f4932B", 25415236), + networks::ARBITRUM_ONE => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 4859669), + // + networks::BASE => ("0x0c6052254551EAe3ECac77B01DFcf1025418828f", 1206531), + // + networks::AVALANCHE => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 26386552), + // + networks::BNB => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 22691243), + // + networks::OPTIMISM => ("0xf302f9F50958c5593770FDf4d4812309fF77414f", 7005915), + // + networks::POLYGON => ("0x41B953164995c11C81DA73D212ED8Af25741b7Ac", 22067480), + ])) + .add_contract(Contract::new("BalancerV2StablePoolFactoryV2").with_networks(networks![ + // + // + networks::MAINNET => ("0x8df6efec5547e31b0eb7d1291b511ff8a2bf987c", 14934936), + // + networks::GNOSIS => ("0xf23b4DB826DbA14c0e857029dfF076b1c0264843", 25415344), + networks::ARBITRUM_ONE => ("0xEF44D6786b2b4d544b7850Fe67CE6381626Bf2D6", 14244664), + // + networks::OPTIMISM => ("0xeb151668006CD04DAdD098AFd0a82e78F77076c3", 11088891), + // + networks::POLYGON => ("0xcA96C4f198d343E251b1a01F3EBA061ef3DA73C1", 29371951), + ])) + .add_contract(Contract::new("BalancerV2ComposableStablePoolFactory").with_networks(networks![ + // + networks::MAINNET => ("0xf9ac7B9dF2b3454E841110CcE5550bD5AC6f875F", 15485885), + networks::ARBITRUM_ONE => ("0xaEb406b0E430BF5Ea2Dc0B9Fe62E4E53f74B3a33", 23227044), + // + networks::BNB => ("0xf302f9F50958c5593770FDf4d4812309fF77414f", 22691193), + // + networks::OPTIMISM => ("0xf145caFB67081895EE80eB7c04A30Cf87f07b745", 22182522), + // + networks::POLYGON => ("0x136FD06Fa01eCF624C7F2B3CB15742c1339dC2c4", 32774224), + ])) + .add_contract(Contract::new("BalancerV2ComposableStablePoolFactoryV3").with_networks(networks![ + // + networks::MAINNET => ("0xdba127fBc23fb20F5929C546af220A991b5C6e01", 16580899), + // + networks::GNOSIS => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 26365805), + networks::ARBITRUM_ONE => ("0x1c99324EDC771c82A0DCCB780CC7DDA0045E50e7", 58948370), + // + networks::BNB => ("0xacAaC3e6D6Df918Bf3c809DFC7d42de0e4a72d4C", 25475700), + // + networks::OPTIMISM => ("0xe2E901AB09f37884BA31622dF3Ca7FC19AA443Be", 72832821), + // + networks::POLYGON => ("0x7bc6C0E73EDAa66eF3F6E2f27b0EE8661834c6C9", 39037615), + ])) + .add_contract(Contract::new("BalancerV2ComposableStablePoolFactoryV4").with_networks(networks![ + // + networks::MAINNET => ("0xfADa0f4547AB2de89D1304A668C39B3E09Aa7c76", 16878679), + // + networks::GNOSIS => ("0xD87F44Df0159DC78029AB9CA7D7e57E7249F5ACD", 27056416), + // + // + networks::SEPOLIA => ("0xA3fd20E29358c056B727657E83DFd139abBC9924", 3425277), + networks::ARBITRUM_ONE => ("0x2498A2B0d6462d2260EAC50aE1C3e03F4829BA95", 72235860), + // + networks::AVALANCHE => ("0x3B1eb8EB7b43882b385aB30533D9A2BeF9052a98", 29221425), + // + networks::BNB => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 26666380), + // + networks::OPTIMISM => ("0x1802953277FD955f9a254B80Aa0582f193cF1d77", 82748180), + // + networks::POLYGON => ("0x6Ab5549bBd766A43aFb687776ad8466F8b42f777", 40613553), + ])) + .add_contract(Contract::new("BalancerV2ComposableStablePoolFactoryV5").with_networks(networks![ + // + networks::MAINNET => ("0xDB8d758BCb971e482B2C45f7F8a7740283A1bd3A", 17672478), + // + networks::GNOSIS => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 28900564), + // + // + networks::SEPOLIA => ("0xa523f47A933D5020b23629dDf689695AA94612Dc", 3872211), + networks::ARBITRUM_ONE => ("0xA8920455934Da4D853faac1f94Fe7bEf72943eF1", 110212282), + // + networks::BASE => ("0x8df317a729fcaA260306d7de28888932cb579b88", 1204710), + // + networks::AVALANCHE => ("0xE42FFA682A26EF8F25891db4882932711D42e467", 32478827), + // + networks::BNB => ("0x4fb47126Fa83A8734991E41B942Ac29A3266C968", 29877945), + // + networks::OPTIMISM => ("0x043A2daD730d585C44FB79D2614F295D2d625412", 106752707), + // + networks::POLYGON => ("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b", 44961548), + ])) + .add_contract(Contract::new("BalancerV2ComposableStablePoolFactoryV6").with_networks(networks![ + // + networks::MAINNET => ("0x5B42eC6D40f7B7965BE5308c70e2603c0281C1E9", 19314764), + // + networks::GNOSIS => ("0x47B489bf5836f83ABD928C316F8e39bC0587B020", 32650879), + // + networks::SEPOLIA => ("0x05503B3aDE04aCA81c8D6F88eCB73Ba156982D2B", 5369821), + // + networks::ARBITRUM_ONE => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 184805448), + // + networks::BASE => ("0x956CCab09898C0AF2aCa5e6C229c3aD4E93d9288", 11099703), + // + networks::AVALANCHE => ("0xb9F8AB3ED3F3aCBa64Bc6cd2DcA74B7F38fD7B88", 42186350), + // + networks::BNB => ("0x6B5dA774890Db7B7b96C6f44e6a4b0F657399E2e", 36485719), + // + networks::OPTIMISM => ("0x4bdCc2fb18AEb9e2d281b0278D946445070EAda7", 116694338), + // + networks::POLYGON => ("0xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E", 53996258), + ])) + .add_contract(Contract::new("BalancerV2Vault").with_networks(networks![ + // Balancer addresses can be obtained from: + // + // + networks::MAINNET => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 12272146), + // + networks::GNOSIS => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 24821598), + // + networks::SEPOLIA => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 3418831), + // + networks::ARBITRUM_ONE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 222832), + // + networks::BASE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 1196036), + // + networks::AVALANCHE => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 26386141), + // + networks::BNB => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 22691002), + // + networks::OPTIMISM => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 7003431), + // + networks::POLYGON => ("0xBA12222222228d8Ba445958a75a0704d566BF2C8", 15832990), + ])) + .add_contract(Contract::new("BalancerV3BatchRouter").with_networks(networks![ + // + networks::MAINNET => ("0x136f1EFcC3f8f88516B9E94110D56FDBfB1778d1", 21339510), + // + networks::GNOSIS => ("0xe2fa4e1d17725e72dcdAfe943Ecf45dF4B9E285b", 37377506), + // + networks::SEPOLIA => ("0xC85b652685567C1B074e8c0D4389f83a2E458b1C", 7219301), + // + networks::ARBITRUM_ONE => ("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E", 297828544), + // + networks::BASE => ("0x85a80afee867aDf27B50BdB7b76DA70f1E853062", 25347205), + // + networks::AVALANCHE => ("0xc9b36096f5201ea332Db35d6D195774ea0D5988f", 59965747), + // + networks::OPTIMISM => ("0xaD89051bEd8d96f045E8912aE1672c6C0bF8a85E", 133969588), + ])) .add_contract(Contract::new("ChainalysisOracle").with_networks(networks![ networks::MAINNET => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", networks::ARBITRUM_ONE => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", From 63f914af35432a2f7e743e984d687a03f2147289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Tue, 28 Oct 2025 09:34:31 +0000 Subject: [PATCH 04/36] wip --- .../ethflow_events/event_retriever.rs | 2 +- crates/autopilot/src/run.rs | 2 +- crates/contracts/build.rs | 286 ++++++++++++++++++ crates/orderbook/src/run.rs | 7 +- .../bad_token/token_owner_finder/liquidity.rs | 2 +- .../src/bad_token/token_owner_finder/mod.rs | 2 +- 6 files changed, 293 insertions(+), 8 deletions(-) diff --git a/crates/autopilot/src/database/ethflow_events/event_retriever.rs b/crates/autopilot/src/database/ethflow_events/event_retriever.rs index f4bcd5e4df..41ad7a25e1 100644 --- a/crates/autopilot/src/database/ethflow_events/event_retriever.rs +++ b/crates/autopilot/src/database/ethflow_events/event_retriever.rs @@ -7,7 +7,7 @@ use { rpc::types::{Filter, FilterSet}, sol_types::SolEvent, }, - contracts::alloy::CoWSwapEthFlow::CoWSwapEthFlow, + contracts::bindings::CoWSwapEthFlow::CoWSwapEthFlow, shared::{ethrpc::Web3, event_handling::AlloyEventRetrieving}, }; diff --git a/crates/autopilot/src/run.rs b/crates/autopilot/src/run.rs index b591fc4bf8..0a63c559a2 100644 --- a/crates/autopilot/src/run.rs +++ b/crates/autopilot/src/run.rs @@ -26,7 +26,7 @@ use { }, chain::Chain, clap::Parser, - contracts::alloy::{BalancerV2Vault, IUniswapV3Factory, InstanceExt}, + contracts::bindings::{BalancerV2Vault, IUniswapV3Factory}, ethcontract::{BlockNumber, H160, common::DeploymentInformation}, ethrpc::{ Web3, diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index cb9ac0abe9..5cb6fd9d1e 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -293,6 +293,292 @@ fn main() { networks::OPTIMISM => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", networks::POLYGON => "0x40C57923924B5c5c5455c48D93317139ADDaC8fb", ])) + // UniV2 Routers + .add_contract(Contract::new("BaoswapRouter").with_networks(networks![ + networks::GNOSIS => "0x6093AeBAC87d62b1A5a4cEec91204e35020E38bE" + ])) + .add_contract(Contract::new("HoneyswapRouter").with_networks(networks![ + networks::GNOSIS => "0x1C232F01118CB8B424793ae03F870aa7D0ac7f77" + ])) + .add_contract(Contract::new("PancakeRouter").with_networks(networks![ + // + networks::MAINNET => "0xEfF92A263d31888d860bD50809A8D171709b7b1c", + // + networks::ARBITRUM_ONE => "0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb", + // + networks::BASE => "0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb", + // + networks::BNB => "0x10ED43C718714eb63d5aA57B78B54704E256024E" + ])) + .add_contract(Contract::new("SushiSwapRouter").with_networks(networks![ + // + // + networks::MAINNET => "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", + // + networks::GNOSIS => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + networks::ARBITRUM_ONE => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + networks::BASE => "0x6bded42c6da8fbf0d2ba55b2fa120c5e0c8d7891", + // + networks::AVALANCHE => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + networks::BNB => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + // + networks::OPTIMISM => "0x2abf469074dc0b54d793850807e6eb5faf2625b1", + // + networks::POLYGON => "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", + ])) + .add_contract(Contract::new("SwaprRouter").with_networks(networks![ + // + // + networks::MAINNET => "0xb9960d9bca016e9748be75dd52f02188b9d0829f", + // + networks::GNOSIS => "0xE43e60736b1cb4a75ad25240E2f9a62Bff65c0C0", + // + networks::ARBITRUM_ONE => "0x530476d5583724A89c8841eB6Da76E7Af4C0F17E", + ])) + .add_contract(Contract::new("ISwaprPair")) + .add_contract(Contract::new("TestnetUniswapV2Router02").with_networks(networks![ + // + networks::SEPOLIA => "0x86dcd3293C53Cf8EFd7303B57beb2a3F671dDE98", + ])) + .add_contract(Contract::new("UniswapV2Factory").with_networks(networks![ + // + // + networks::MAINNET => "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", + // + networks::GNOSIS => "0xA818b4F111Ccac7AA31D0BCc0806d64F2E0737D7", + // + networks::ARBITRUM_ONE => "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9", + // + networks::BASE => "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + // + networks::SEPOLIA => "0xF62c03E08ada871A0bEb309762E260a7a6a880E6", + // + networks::AVALANCHE => "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", + // + networks::BNB => "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + // + networks::OPTIMISM => "0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf", + // + networks::POLYGON => "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", + ])) + .add_contract(Contract::new("UniswapV2Router02").with_networks(networks![ + // + // + networks::MAINNET => "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", + // + networks::GNOSIS => "0x1C232F01118CB8B424793ae03F870aa7D0ac7f77", + // + networks::ARBITRUM_ONE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + networks::BASE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + networks::SEPOLIA => "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3", + // + networks::AVALANCHE => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + networks::BNB => "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", + // + networks::OPTIMISM => "0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2", + // + networks::POLYGON => "0xedf6066a2b290C185783862C7F4776A2C8077AD1", + ])) + .add_contract(Contract::new("IUniswapLikeRouter")) + .add_contract(Contract::new("IUniswapLikePair")) + // UniV3 + .add_contract(Contract::new("UniswapV3Pool")) + .add_contract(Contract::new("UniswapV3QuoterV2").with_networks(networks![ + // + networks::MAINNET => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + networks::ARBITRUM_ONE => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + networks::BASE => "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a", + networks::AVALANCHE => "0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F", + networks::BNB => "0x78D78E420Da98ad378D7799bE8f4AF69033EB077", + networks::OPTIMISM => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + networks::POLYGON => "0x61fFE014bA17989E743c5F6cB21bF9697530B21e", + networks::LENS => "0x1eEA2B790Dc527c5a4cd3d4f3ae8A2DDB65B2af1", + ])) + .add_contract(Contract::new("UniswapV3SwapRouterV2").with_networks(networks![ + // + networks::ARBITRUM_ONE => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + networks::MAINNET => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + networks::POLYGON => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + networks::OPTIMISM => "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45", + networks::BASE => "0x2626664c2603336E57B271c5C0b26F421741e481", + networks::AVALANCHE => "0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE", + networks::BNB => "0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2", + networks::LENS => "0x6ddD32cd941041D8b61df213B9f515A7D288Dc13", + ])) + .add_contract(Contract::new("IUniswapV3Factory").with_networks(networks![ + // + networks::MAINNET => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + networks::SEPOLIA => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + networks::ARBITRUM_ONE => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + networks::BASE => "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", + networks::AVALANCHE => "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", + networks::BNB => "0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7", + networks::OPTIMISM => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + networks::POLYGON => "0x1F98431c8aD98523631AE4a59f267346ea31F984", + networks::LENS => "0xc3A5b857Ba82a2586A45a8B59ECc3AA50Bc3D0e3", + ])) + // CoW Protocol + .add_contract(Contract::new("HooksTrampoline").with_networks(networks![ + // + networks::MAINNET => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + // Gnosis is using the old instance of the hook trampoline since it's hardcoded in gnosis pay rebalance integration. + networks::GNOSIS => "0x01DcB88678aedD0C4cC9552B20F4718550250574", + networks::SEPOLIA => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::ARBITRUM_ONE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::BASE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::AVALANCHE => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::BNB => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::OPTIMISM => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::POLYGON => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + networks::LENS => "0x60Bf78233f48eC42eE3F101b9a05eC7878728006", + ])) + .add_contract(Contract::new("CoWSwapEthFlow").with_networks(networks![ + // + networks::MAINNET => ("0x40a50cf069e992aa4536211b23f286ef88752187", 16169866), + // + networks::GNOSIS => ("0x40a50cf069e992aa4536211b23f286ef88752187", 25414331), + // + // + networks::SEPOLIA => ("0x0b7795E18767259CC253a2dF471db34c72B49516", 4718739), + // + networks::ARBITRUM_ONE => ("0x6DFE75B5ddce1ADE279D4fa6BD6AeF3cBb6f49dB", 204747458), + // + networks::BASE => ("0x3C3eA1829891BC9bEC3d06A81d5d169e52a415e3", 21490258), + // + networks::AVALANCHE => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 60496408), + // + networks::BNB => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 48411237), + // + networks::OPTIMISM => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 134607215), + // + networks::POLYGON => ("0x04501b9b1d52e67f6862d157e00d13419d2d6e95", 71296258), + // + networks::LENS => ("0xFb337f8a725A142f65fb9ff4902d41cc901de222", 3007173), + ])) + .add_contract(Contract::new("CoWSwapOnchainOrders")) + .add_contract(Contract::new("ERC1271SignatureValidator")) + .add_contract(Contract::new("GPv2AllowListAuthentication").with_networks(networks![ + // + networks::MAINNET => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 12593263), + // + networks::GNOSIS => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 16465099), + // + networks::SEPOLIA => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 4717469), + // + networks::ARBITRUM_ONE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 204702129), + // + networks::BASE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 21407137), + // + networks::AVALANCHE => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 59891351), + // + networks::BNB => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 48173639), + // + networks::OPTIMISM => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 134254466), + // + networks::POLYGON => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 45854728), + // + networks::LENS => ("0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE", 2612937), + ])) + // DeFi Infrastructure + .add_contract(Contract::new("BalancerQueries").with_networks(networks![ + // Used in the gnosis/solvers repo for the balancer solver + // + networks::MAINNET => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 15188261), + // + networks::ARBITRUM_ONE => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 18238624), + // + networks::OPTIMISM => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 15288107), + // + networks::BASE => ("0x300Ab2038EAc391f26D9F895dc61F8F66a548833", 1205869), + // + networks::GNOSIS => ("0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", 24821845), + // + networks::POLYGON => ("0xE39B5e3B6D74016b2F6A9673D7d7493B6DF549d5", 30988035), + // + networks::AVALANCHE => ("0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", 26387068), + ])) + .add_contract(Contract::new("ILiquoriceSettlement").with_networks(networks![ + // + networks::MAINNET => "0x0448633eb8B0A42EfED924C42069E0DcF08fb552", + networks::ARBITRUM_ONE => "0x0448633eb8B0A42EfED924C42069E0DcF08fb552", + ])) + .add_contract(Contract::new("FlashLoanRouter").with_networks(networks![ + networks::MAINNET => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::GNOSIS => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::SEPOLIA => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::ARBITRUM_ONE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::BASE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::POLYGON => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + networks::AVALANCHE => "0x9da8b48441583a2b93e2ef8213aad0ec0b392c69", + ])) + .add_contract(Contract::new("Permit2").with_networks(networks![ + // Only used in + // + networks::MAINNET => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 15986406), + // + networks::GNOSIS => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 27338672), + // + networks::SEPOLIA => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 2356287), + // + networks::ARBITRUM_ONE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 38692735), + // + networks::BASE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 1425180), + // + networks::AVALANCHE => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 28844415), + // + networks::BNB => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 25343783), + // + networks::OPTIMISM => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 38854427), + // + networks::POLYGON => ("0x000000000022D473030F116dDEE9F6B43aC78BA3", 35701901), + ])) + // Support contracts + .add_contract(Contract::new("CowAmmFactoryGetter")) + .add_contract(Contract::new("AnyoneAuthenticator")) + .add_contract(Contract::new("Solver")) + .add_contract(Contract::new("Spardose")) + .add_contract(Contract::new("Trader")) + .add_contract(Contract::new("Swapper")) + .add_contract(Contract::new("Signatures").with_networks(networks![ + networks::MAINNET => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::ARBITRUM_ONE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::BASE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::AVALANCHE => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::BNB => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::OPTIMISM => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::POLYGON => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::LENS => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::GNOSIS => "0x8262d639c38470F38d2eff15926F7071c28057Af", + networks::SEPOLIA => "0x8262d639c38470F38d2eff15926F7071c28057Af", + ])) + .add_contract(Contract::new("Balances").with_networks(networks![ + networks::MAINNET => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::ARBITRUM_ONE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::BASE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::AVALANCHE => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::BNB => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::OPTIMISM => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::POLYGON => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::LENS => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::GNOSIS => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + networks::SEPOLIA => "0x3e8C6De9510e7ECad902D005DE3Ab52f35cF4f1b", + ])) + // Test contracts + .add_contract(Contract::new("GasHog")) + .add_contract(Contract::new("Counter")) + .add_contract(Contract::new("CowProtocolToken").with_networks(networks![ + networks::MAINNET => "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB", + networks::GNOSIS => "0x177127622c4A00F3d409B75571e12cB3c8973d3c", + networks::SEPOLIA => "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59", + networks::ARBITRUM_ONE => "0xcb8b5CD20BdCaea9a010aC1F8d835824F5C87A04", + networks::BASE => "0xc694a91e6b071bF030A18BD3053A7fE09B6DaE69", + ])) .write_formatted(Path::new("artifacts"), false, Path::new("src/bindings")) .unwrap(); diff --git a/crates/orderbook/src/run.rs b/crates/orderbook/src/run.rs index d67a0f5487..1a027679d0 100644 --- a/crates/orderbook/src/run.rs +++ b/crates/orderbook/src/run.rs @@ -15,14 +15,13 @@ use { contracts::{ GPv2Settlement, WETH9, - alloy::{ + bindings::{ BalancerV2Vault, + Balances, + ChainalysisOracle, HooksTrampoline, IUniswapV3Factory, - InstanceExt, - support::Balances, }, - bindings::ChainalysisOracle, }, ethrpc::alloy::conversions::{IntoAlloy, IntoLegacy}, futures::{FutureExt, StreamExt}, diff --git a/crates/shared/src/bad_token/token_owner_finder/liquidity.rs b/crates/shared/src/bad_token/token_owner_finder/liquidity.rs index 85ba7220f8..a70cfc5c05 100644 --- a/crates/shared/src/bad_token/token_owner_finder/liquidity.rs +++ b/crates/shared/src/bad_token/token_owner_finder/liquidity.rs @@ -5,7 +5,7 @@ use { crate::sources::{uniswap_v2::pair_provider::PairProvider, uniswap_v3_pair_provider}, alloy::eips::BlockNumberOrTag, anyhow::Result, - contracts::alloy::{BalancerV2Vault, IUniswapV3Factory}, + contracts::bindings::{BalancerV2Vault, IUniswapV3Factory}, ethcontract::H160, ethrpc::alloy::conversions::IntoLegacy, model::TokenPair, diff --git a/crates/shared/src/bad_token/token_owner_finder/mod.rs b/crates/shared/src/bad_token/token_owner_finder/mod.rs index 21cc299313..28e0991e9e 100644 --- a/crates/shared/src/bad_token/token_owner_finder/mod.rs +++ b/crates/shared/src/bad_token/token_owner_finder/mod.rs @@ -33,7 +33,7 @@ use { chain::Chain, contracts::{ ERC20, - alloy::{BalancerV2Vault, IUniswapV3Factory}, + bindings::{BalancerV2Vault, IUniswapV3Factory}, errors::EthcontractErrorType, }, ethcontract::U256, From 319f708c2f30d11174a5e47ed4e6a63c49ce10f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Wed, 29 Oct 2025 18:22:19 +0000 Subject: [PATCH 05/36] Migrate the remaining ERC20 --- crates/contracts/build.rs | 46 ----- crates/contracts/src/lib.rs | 10 -- crates/cow-amm/src/maintainers.rs | 8 +- .../driver/src/infra/blockchain/contracts.rs | 13 +- crates/driver/src/infra/blockchain/mod.rs | 6 - crates/driver/src/infra/blockchain/token.rs | 41 ++--- crates/e2e/src/setup/mod.rs | 10 +- crates/e2e/tests/e2e/buffers.rs | 2 +- crates/e2e/tests/e2e/liquidity.rs | 168 +++++++++++------- .../e2e/liquidity_source_notification.rs | 158 ++++++++++------ crates/e2e/tests/e2e/protocol_fee.rs | 14 +- crates/ethrpc/Cargo.toml | 2 +- crates/ethrpc/src/alloy/errors.rs | 44 +++++ crates/ethrpc/src/alloy/mod.rs | 2 +- .../shared/src/account_balances/simulation.rs | 72 ++++---- .../src/bad_token/token_owner_finder/mod.rs | 26 +-- .../balance_overrides/detector.rs | 16 +- crates/shared/src/sources/swapr.rs | 9 +- .../src/sources/uniswap_v2/pool_fetching.rs | 68 +++---- crates/shared/src/token_info.rs | 35 ++-- crates/solver/src/interactions/allowances.rs | 37 ++-- 21 files changed, 412 insertions(+), 375 deletions(-) delete mode 100644 crates/contracts/build.rs create mode 100644 crates/ethrpc/src/alloy/errors.rs diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs deleted file mode 100644 index 805b62a231..0000000000 --- a/crates/contracts/build.rs +++ /dev/null @@ -1,46 +0,0 @@ -use { - ethcontract_generate::{ContractBuilder, loaders::TruffleLoader}, - std::{env, path::Path}, -}; - -#[path = "src/paths.rs"] -mod paths; - -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"); - - generate_contract("ERC20"); -} - -fn generate_contract(name: &str) { - generate_contract_with_config(name, |builder| builder) -} - -fn generate_contract_with_config( - name: &str, - config: impl FnOnce(ContractBuilder) -> ContractBuilder, -) { - let path = paths::contract_artifacts_dir() - .join(name) - .with_extension("json"); - let contract = TruffleLoader::new() - .name(name) - .load_contract_from_file(&path) - .unwrap(); - let dest = env::var("OUT_DIR").unwrap(); - - println!("cargo:rerun-if-changed={}", path.display()); - - config(ContractBuilder::new().visibility_modifier("pub")) - .generate(&contract) - .unwrap() - .write_to_file(Path::new(&dest).join(format!("{name}.rs"))) - .unwrap(); -} diff --git a/crates/contracts/src/lib.rs b/crates/contracts/src/lib.rs index 91fc45b6ef..b39baad16f 100644 --- a/crates/contracts/src/lib.rs +++ b/crates/contracts/src/lib.rs @@ -42,16 +42,6 @@ pub mod paths; pub mod vault; pub mod web3; -macro_rules! include_contracts { - ($($name:ident;)*) => {$( - include!(concat!(env!("OUT_DIR"), "/", stringify!($name), ".rs")); - )*}; -} - -include_contracts! { - ERC20; -} - #[cfg(test)] mod tests { use { diff --git a/crates/cow-amm/src/maintainers.rs b/crates/cow-amm/src/maintainers.rs index 3522c71eb9..bb93ea3438 100644 --- a/crates/cow-amm/src/maintainers.rs +++ b/crates/cow-amm/src/maintainers.rs @@ -1,8 +1,8 @@ use { crate::{Amm, cache::Storage}, - contracts::ERC20, + contracts::alloy::ERC20, ethcontract::futures::future::{join_all, select_ok}, - ethrpc::{Web3, alloy::conversions::IntoLegacy}, + ethrpc::Web3, shared::maintenance::Maintaining, std::sync::Arc, tokio::sync::RwLock, @@ -25,8 +25,8 @@ impl EmptyPoolRemoval { .traded_tokens() .iter() .map(move |token| async move { - ERC20::at(&self.web3, token.into_legacy()) - .balance_of(amm_address.into_legacy()) + ERC20::Instance::new(*token, self.web3.alloy.clone()) + .balanceOf(*amm_address) .call() .await .map_err(|err| { diff --git a/crates/driver/src/infra/blockchain/contracts.rs b/crates/driver/src/infra/blockchain/contracts.rs index ec03aa7627..ae374376ee 100644 --- a/crates/driver/src/infra/blockchain/contracts.rs +++ b/crates/driver/src/infra/blockchain/contracts.rs @@ -1,5 +1,5 @@ use { - crate::{domain::eth, infra::blockchain::Ethereum}, + crate::domain::eth, chain::Chain, contracts::alloy::{ BalancerV2Vault, @@ -183,17 +183,6 @@ pub fn deployment_address( ) } -/// A trait for initializing contract instances with dynamic addresses. -pub trait ContractAt { - fn at(eth: &Ethereum, address: eth::ContractAddress) -> Self; -} - -impl ContractAt for contracts::ERC20 { - fn at(eth: &Ethereum, address: eth::ContractAddress) -> Self { - Self::at(ð.web3, address.into()) - } -} - #[derive(Debug, Error)] pub enum Error { #[error("method error: {0:?}")] diff --git a/crates/driver/src/infra/blockchain/mod.rs b/crates/driver/src/infra/blockchain/mod.rs index de79a07084..d286d5f5d8 100644 --- a/crates/driver/src/infra/blockchain/mod.rs +++ b/crates/driver/src/infra/blockchain/mod.rs @@ -1,5 +1,4 @@ use { - self::contracts::ContractAt, crate::{boundary, domain::eth}, chain::Chain, ethcontract::{U256, errors::ExecutionError}, @@ -159,11 +158,6 @@ impl Ethereum { &self.inner.contracts } - /// Create a contract instance at the specified address. - pub fn contract_at(&self, address: eth::ContractAddress) -> T { - T::at(self, address) - } - /// Check if a smart contract is deployed to the given address. pub async fn is_contract(&self, address: eth::Address) -> Result { let code = self.web3.eth().code(address.into(), None).await?; diff --git a/crates/driver/src/infra/blockchain/token.rs b/crates/driver/src/infra/blockchain/token.rs index 6e930c5840..8ece066b4e 100644 --- a/crates/driver/src/infra/blockchain/token.rs +++ b/crates/driver/src/infra/blockchain/token.rs @@ -1,25 +1,32 @@ use { super::{Error, Ethereum}, crate::domain::eth, + ethrpc::alloy::{ + conversions::{IntoAlloy, IntoLegacy}, + errors::ContractErrorExt, + }, }; /// An ERC-20 token. /// /// https://eips.ethereum.org/EIPS/eip-20 pub struct Erc20 { - token: contracts::ERC20, + token: contracts::alloy::ERC20::Instance, } impl Erc20 { pub(super) fn new(eth: &Ethereum, address: eth::TokenAddress) -> Self { Self { - token: eth.contract_at(address.into()), + token: contracts::alloy::ERC20::Instance::new( + address.0.0.into_alloy(), + eth.web3.alloy.clone(), + ), } } /// Returns the [`eth::TokenAddress`] of the ERC20. pub fn address(&self) -> eth::TokenAddress { - self.token.address().into() + self.token.address().into_legacy().into() } /// Fetch the ERC20 allowance for the spender. See the allowance method in @@ -31,11 +38,15 @@ impl Erc20 { owner: eth::Address, spender: eth::Address, ) -> Result { - let amount = self.token.allowance(owner.0, spender.0).call().await?; + let amount = self + .token + .allowance(owner.0.into_alloy(), spender.0.into_alloy()) + .call() + .await?; Ok(eth::Allowance { - token: self.token.address().into(), + token: self.token.address().into_legacy().into(), spender, - amount, + amount: amount.into_legacy(), } .into()) } @@ -47,7 +58,7 @@ impl Erc20 { pub async fn decimals(&self) -> Result, Error> { match self.token.decimals().call().await { Ok(decimals) => Ok(Some(decimals)), - Err(err) if is_contract_error(&err) => Ok(None), + Err(err) if err.is_contract_err() => Ok(None), Err(err) => Err(err.into()), } } @@ -59,7 +70,7 @@ impl Erc20 { pub async fn symbol(&self) -> Result, Error> { match self.token.symbol().call().await { Ok(symbol) => Ok(Some(symbol)), - Err(err) if is_contract_error(&err) => Ok(None), + Err(err) if err.is_contract_err() => Ok(None), Err(err) => Err(err.into()), } } @@ -70,21 +81,11 @@ impl Erc20 { /// https://eips.ethereum.org/EIPS/eip-20#balanceof pub async fn balance(&self, holder: eth::Address) -> Result { self.token - .balance_of(holder.0) + .balanceOf(holder.0.into_alloy()) .call() .await + .map(IntoLegacy::into_legacy) .map(Into::into) .map_err(Into::into) } } - -/// Returns `true` if a [`ethcontract::errors::MethodError`] is the result of -/// some on-chain computation error. -fn is_contract_error(err: ðcontract::errors::MethodError) -> bool { - // Assume that any error that isn't a `Web3` error is a "contract error", - // this can mean things like: - // - The contract call reverted - // - The returndata cannot be decoded - // - etc. - !matches!(&err.inner, ethcontract::errors::ExecutionError::Web3(_)) -} diff --git a/crates/e2e/src/setup/mod.rs b/crates/e2e/src/setup/mod.rs index 40423f647b..454d3b149a 100644 --- a/crates/e2e/src/setup/mod.rs +++ b/crates/e2e/src/setup/mod.rs @@ -250,12 +250,14 @@ async fn run( #[macro_export] macro_rules! assert_approximately_eq { ($executed_value:expr_2021, $expected_value:expr_2021) => {{ - let lower = $expected_value * U256::from(99999999999u128) / U256::from(100000000000u128); - let upper = - ($expected_value * U256::from(100000000001u128) / U256::from(100000000000u128)) + 1; + let lower = $expected_value * ::alloy::primitives::U256::from(99999999999u128) + / ::alloy::primitives::U256::from(100000000000u128); + let upper = ($expected_value * ::alloy::primitives::U256::from(100000000001u128) + / ::alloy::primitives::U256::from(100000000000u128)) + + ::alloy::primitives::U256::ONE; assert!( $executed_value >= lower && $executed_value <= upper, - "Expected: ~{}, got: {}", + "Expected: ~{}, got: {}, ({lower}, {upper})", $expected_value, $executed_value ); diff --git a/crates/e2e/tests/e2e/buffers.rs b/crates/e2e/tests/e2e/buffers.rs index 56237ac9bd..62901d7ff6 100644 --- a/crates/e2e/tests/e2e/buffers.rs +++ b/crates/e2e/tests/e2e/buffers.rs @@ -128,7 +128,7 @@ async fn onchain_settlement_without_liquidity(web3: Web3) { .await .unwrap(); // Check that internal buffers were used - assert!(settlement_contract_balance == U256::ZERO); + assert!(settlement_contract_balance.is_zero(), "{}", settlement_contract_balance); // Same order can trade again with external liquidity let order = OrderCreation { diff --git a/crates/e2e/tests/e2e/liquidity.rs b/crates/e2e/tests/e2e/liquidity.rs index 0a5e547850..1598e095f4 100644 --- a/crates/e2e/tests/e2e/liquidity.rs +++ b/crates/e2e/tests/e2e/liquidity.rs @@ -1,14 +1,14 @@ use { - chrono::{NaiveDateTime, Utc}, - contracts::{ - ERC20, - alloy::{IZeroex, InstanceExt}, + alloy::{ + primitives::{Address, address}, + providers::ext::{AnvilApi, ImpersonateConfig}, }, + chrono::{NaiveDateTime, Utc}, + contracts::alloy::{ERC20, IZeroex, InstanceExt}, driver::domain::eth::H160, e2e::{ api::zeroex::{Eip712TypedZeroExOrder, ZeroExApi}, assert_approximately_eq, - nodes::forked_node::ForkedNodeApi, setup::{ OnchainComponents, Services, @@ -20,17 +20,16 @@ use { to_wei_with_exp, wait_for_condition, }, - tx, }, ethcontract::{Account, H256, prelude::U256}, ethrpc::{ Web3, alloy::{ + CallBuilderExt, ProviderSignerExt, conversions::{IntoAlloy, IntoLegacy, TryIntoAlloyAsync}, }, }, - hex_literal::hex, model::{ order::{OrderCreation, OrderKind}, signature::EcdsaSigningScheme, @@ -41,8 +40,8 @@ use { /// The block number from which we will fetch state for the forked tests. pub const FORK_BLOCK: u64 = 23112197; -pub const USDT_WHALE: H160 = H160(hex!("F977814e90dA44bFA03b6295A0616a897441aceC")); -pub const USDC_WHALE: H160 = H160(hex!("28c6c06298d514db089934071355e5743bf21d60")); +pub const USDT_WHALE: Address = address!("F977814e90dA44bFA03b6295A0616a897441aceC"); +pub const USDC_WHALE: Address = address!("28c6c06298d514db089934071355e5743bf21d60"); #[tokio::test] #[ignore] @@ -58,23 +57,18 @@ async fn forked_node_zero_ex_liquidity_mainnet() { async fn zero_ex_liquidity(web3: Web3) { let mut onchain = OnchainComponents::deployed(web3.clone()).await; - let forked_node_api = web3.api::>(); let [solver] = onchain.make_solvers_forked(to_wei(1)).await; let [trader, zeroex_maker] = onchain.make_accounts(to_wei(1)).await; - let token_usdc = ERC20::at( - &web3, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - .parse() - .unwrap(), + let token_usdc = ERC20::Instance::new( + address!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), + web3.alloy.clone(), ); - let token_usdt = ERC20::at( - &web3, - "0xdac17f958d2ee523a2206206994597c13d831ec7" - .parse() - .unwrap(), + let token_usdt = ERC20::Instance::new( + address!("dac17f958d2ee523a2206206994597c13d831ec7"), + web3.alloy.clone(), ); let zeroex_provider = { @@ -83,41 +77,90 @@ async fn zero_ex_liquidity(web3: Web3) { }; let zeroex = IZeroex::Instance::deployed(&zeroex_provider).await.unwrap(); - let amount = to_wei_with_exp(5, 8); + let amount = to_wei_with_exp(5, 8).into_alloy(); // Give trader some USDC - let usdc_whale = forked_node_api.impersonate(&USDC_WHALE).await.unwrap(); - tx!(usdc_whale, token_usdc.transfer(trader.address(), amount)); + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdc + .transfer(trader.address().into_alloy(), amount) + .from(USDC_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); // Give 0x maker a bit more USDT - let usdt_whale = forked_node_api.impersonate(&USDT_WHALE).await.unwrap(); - tx!( - usdt_whale, - // With a lower amount 0x contract shows much lower fillable amount - token_usdt.transfer(zeroex_maker.address(), amount * 4) - ); + // With a lower amount 0x contract shows much lower fillable amount + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdt + .transfer( + zeroex_maker.address().into_alloy(), + amount * alloy::primitives::U256::from(4), + ) + .from(USDT_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); // Required for the remaining fillable taker amount - tx!(usdc_whale, token_usdc.transfer(solver.address(), amount)); + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdc + .transfer(solver.address().into_alloy(), amount) + .from(USDC_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); - tx!( - trader.account(), - token_usdc.approve(onchain.contracts().allowance, amount) - ); - tx!( - zeroex_maker.account(), - // With a lower amount 0x contract shows much lower fillable amount - token_usdt.approve(zeroex.address().into_legacy(), amount * 4) - ); - tx!( - solver.account(), - token_usdc.approve(zeroex.address().into_legacy(), amount) - ); + token_usdc + .approve(onchain.contracts().allowance.into_alloy(), amount) + .from(trader.address().into_alloy()) + .send_and_watch() + .await + .unwrap(); + // With a lower amount 0x contract shows much lower fillable amount + token_usdt + .approve(*zeroex.address(), amount * alloy::primitives::U256::from(4)) + .from(zeroex_maker.address().into_alloy()) + .send_and_watch() + .await + .unwrap(); + token_usdc + .approve(*zeroex.address(), amount) + .from(solver.address().into_alloy()) + .send_and_watch() + .await + .unwrap(); let order = OrderCreation { - sell_token: token_usdc.address(), - sell_amount: amount, - buy_token: token_usdt.address(), - buy_amount: amount, + sell_token: token_usdc.address().into_legacy(), + sell_amount: amount.into_legacy(), + buy_token: token_usdt.address().into_legacy(), + buy_amount: amount.into_legacy(), valid_to: model::time::now_in_epoch_seconds() + 300, kind: OrderKind::Sell, ..Default::default() @@ -179,12 +222,12 @@ async fn zero_ex_liquidity(web3: Web3) { // Drive solution let sell_token_balance_before = token_usdc - .balance_of(trader.address()) + .balanceOf(trader.address().into_alloy()) .call() .await .unwrap(); let buy_token_balance_before = token_usdt - .balance_of(trader.address()) + .balanceOf(trader.address().into_alloy()) .call() .await .unwrap(); @@ -195,7 +238,7 @@ async fn zero_ex_liquidity(web3: Web3) { tracing::info!("Waiting for trade."); wait_for_condition(TIMEOUT, || async { token_usdc - .balance_of(trader.address()) + .balanceOf(trader.address().into_alloy()) .call() .await .is_ok_and(|balance| balance < sell_token_balance_before) @@ -204,7 +247,7 @@ async fn zero_ex_liquidity(web3: Web3) { .unwrap(); wait_for_condition(TIMEOUT, || async { token_usdt - .balance_of(trader.address()) + .balanceOf(trader.address().into_alloy()) .call() .await .is_ok_and(|balance| balance >= buy_token_balance_before + amount) @@ -218,21 +261,21 @@ async fn zero_ex_liquidity(web3: Web3) { // [`relative-slippage`] config value is set to 0.1 // crates/e2e/src/setup/colocation.rs:110 which is then applied to the // original filled amount crates/solver/src/liquidity/slippage.rs:110 - let expected_filled_amount = amount.as_u128() + amount.as_u128() / 10u128; + let expected_filled_amount = amount + amount / alloy::primitives::U256::from(10); assert_approximately_eq!( - U256::from(zeroex_order_amounts.filled), - U256::from(expected_filled_amount) + alloy::primitives::U256::from(zeroex_order_amounts.filled), + expected_filled_amount ); assert!(zeroex_order_amounts.fillable > 0u128); assert_approximately_eq!( - U256::from(zeroex_order_amounts.fillable), - U256::from(amount.as_u128() * 2 - expected_filled_amount) + alloy::primitives::U256::from(zeroex_order_amounts.fillable), + (amount * alloy::primitives::U256::from(2)) - expected_filled_amount ); // Fill the remaining part of the 0x order let zeroex_order = Eip712TypedZeroExOrder { - maker_token: token_usdt.address(), - taker_token: token_usdc.address(), + maker_token: token_usdt.address().into_legacy(), + taker_token: token_usdc.address().into_legacy(), maker_amount: zeroex_order_amounts.fillable, taker_amount: zeroex_order_amounts.fillable, // doesn't participate in the hash calculation @@ -254,10 +297,13 @@ async fn zero_ex_liquidity(web3: Web3) { .await .unwrap(); assert_approximately_eq!( - U256::from(zeroex_order_amounts.filled), - U256::from(amount.as_u128() * 2 - expected_filled_amount) + alloy::primitives::U256::from(zeroex_order_amounts.filled), + (amount * alloy::primitives::U256::from(2)) - expected_filled_amount + ); + assert_approximately_eq!( + alloy::primitives::U256::from(zeroex_order_amounts.fillable), + alloy::primitives::U256::ZERO ); - assert_approximately_eq!(U256::from(zeroex_order_amounts.fillable), U256::zero()); } fn create_zeroex_liquidity_orders( diff --git a/crates/e2e/tests/e2e/liquidity_source_notification.rs b/crates/e2e/tests/e2e/liquidity_source_notification.rs index bf02e1ee12..e74754bdc9 100644 --- a/crates/e2e/tests/e2e/liquidity_source_notification.rs +++ b/crates/e2e/tests/e2e/liquidity_source_notification.rs @@ -1,14 +1,13 @@ use { - alloy::primitives::Bytes, - chrono::Utc, - contracts::{ - ERC20, - alloy::{ILiquoriceSettlement, InstanceExt}, + alloy::{ + primitives::{Bytes, address}, + providers::ext::{AnvilApi, ImpersonateConfig}, }, - driver::{domain::eth::H160, infra}, + chrono::Utc, + contracts::alloy::{ERC20, ILiquoriceSettlement, InstanceExt}, + driver::infra, e2e::{ api, - nodes::forked_node::ForkedNodeApi, setup::{ OnchainComponents, Services, @@ -20,14 +19,15 @@ use { to_wei_with_exp, wait_for_condition, }, - tx, }, ethcontract::prelude::U256, ethrpc::{ Web3, - alloy::conversions::{IntoAlloy, IntoLegacy}, + alloy::{ + CallBuilderExt, + conversions::{IntoAlloy, IntoLegacy}, + }, }, - hex_literal::hex, model::{ order::{OrderCreation, OrderKind}, signature::EcdsaSigningScheme, @@ -40,8 +40,10 @@ use { /// The block number from which we will fetch state for the forked tests. pub const FORK_BLOCK: u64 = 23326100; -pub const USDT_WHALE: H160 = H160(hex!("6AC38D1b2f0c0c3b9E816342b1CA14d91D5Ff60B")); -pub const USDC_WHALE: H160 = H160(hex!("01b8697695eab322a339c4bf75740db75dc9375e")); +pub const USDT_WHALE: alloy::primitives::Address = + address!("6AC38D1b2f0c0c3b9E816342b1CA14d91D5Ff60B"); +pub const USDC_WHALE: alloy::primitives::Address = + address!("01b8697695eab322a339c4bf75740db75dc9375e"); #[tokio::test] #[ignore] @@ -58,7 +60,6 @@ async fn forked_node_liquidity_source_notification_mainnet() { async fn liquidity_source_notification(web3: Web3) { // Start onchain components let mut onchain = OnchainComponents::deployed(web3.clone()).await; - let forked_node_api = web3.api::>(); // Define trade params let trade_amount = to_wei_with_exp(5, 8); @@ -73,41 +74,63 @@ async fn liquidity_source_notification(web3: Web3) { let [trader, liquorice_maker] = onchain.make_accounts(to_wei(1)).await; // Access trade tokens contracts - let token_usdc = ERC20::at( - &web3, - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - .parse() - .unwrap(), + let token_usdc = ERC20::Instance::new( + address!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), + web3.alloy.clone(), ); - let token_usdt = ERC20::at( - &web3, - "0xdac17f958d2ee523a2206206994597c13d831ec7" - .parse() - .unwrap(), + let token_usdt = ERC20::Instance::new( + address!("dac17f958d2ee523a2206206994597c13d831ec7"), + web3.alloy.clone(), ); // CoW onchain setup - { - // Fund trader - let usdc_whale = forked_node_api.impersonate(&USDC_WHALE).await.unwrap(); - tx!( - usdc_whale, - token_usdc.transfer(trader.address(), trade_amount) - ); + // Fund trader + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdc + .transfer(trader.address().into_alloy(), trade_amount.into_alloy()) + .from(USDC_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); - // Fund solver - tx!( - usdc_whale, - token_usdc.transfer(solver.address(), trade_amount) - ); + // Fund solver + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdc + .transfer(solver.address().into_alloy(), trade_amount.into_alloy()) + .from(USDC_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); - // Trader gives approval to the CoW allowance contract - tx!( - trader.account(), - token_usdc.approve(onchain.contracts().allowance, U256::MAX) - ); - } + // Trader gives approval to the CoW allowance contract + token_usdc + .approve( + onchain.contracts().allowance.into_alloy(), + alloy::primitives::U256::MAX, + ) + .from(trader.address().into_alloy()) + .send_and_watch() + .await + .unwrap(); // Liquorice onchain setup @@ -124,19 +147,36 @@ async fn liquidity_source_notification(web3: Web3) { .into_legacy(); // Fund `liquorice_maker` - { - let usdt_whale = forked_node_api.impersonate(&USDT_WHALE).await.unwrap(); - tx!( - usdt_whale, - token_usdt.transfer(liquorice_maker.address(), trade_amount) - ); - } + web3.alloy + .anvil_send_impersonated_transaction_with_config( + token_usdt + .transfer( + liquorice_maker.address().into_alloy(), + trade_amount.into_alloy(), + ) + .from(USDT_WHALE) + .into_transaction_request(), + ImpersonateConfig { + fund_amount: None, + stop_impersonate: true, + }, + ) + .await + .unwrap() + .watch() + .await + .unwrap(); // Maker gives approval to the Liquorice balance manager contract - tx!( - liquorice_maker.account(), - token_usdt.approve(liquorice_balance_manager_address, U256::MAX) - ); + token_usdt + .approve( + liquorice_balance_manager_address.into_alloy(), + alloy::primitives::U256::MAX, + ) + .from(liquorice_maker.address().into_alloy()) + .send_and_watch() + .await + .unwrap(); // Liquorice API setup let liquorice_api = api::liquorice::server::LiquoriceApi::start().await; @@ -200,9 +240,9 @@ http-timeout = "10s" // Create CoW order let order_id = { let order = OrderCreation { - sell_token: token_usdc.address(), + sell_token: token_usdc.address().into_legacy(), sell_amount: trade_amount, - buy_token: token_usdt.address(), + buy_token: token_usdt.address().into_legacy(), buy_amount: trade_amount, valid_to: model::time::now_in_epoch_seconds() + 300, kind: OrderKind::Sell, @@ -224,8 +264,8 @@ http-timeout = "10s" nonce: U256::from(0), trader: onchain.contracts().gp_settlement.address().into_legacy(), effective_trader: onchain.contracts().gp_settlement.address().into_legacy(), - base_token: token_usdc.address(), - quote_token: token_usdt.address(), + base_token: token_usdc.address().into_legacy(), + quote_token: token_usdt.address().into_legacy(), base_token_amount: trade_amount, quote_token_amount: trade_amount, min_fill_amount: U256::from(1), @@ -283,8 +323,8 @@ http-timeout = "10s" liquorice_solver_api_mock.configure_solution(Some(Solution { id: 1, prices: HashMap::from([ - (token_usdc.address(), to_wei(11)), - (token_usdt.address(), to_wei(10)), + (token_usdc.address().into_legacy(), to_wei(11)), + (token_usdt.address().into_legacy(), to_wei(10)), ]), trades: vec![solvers_dto::solution::Trade::Fulfillment( solvers_dto::solution::Fulfillment { @@ -300,7 +340,7 @@ http-timeout = "10s" calldata: liquorice_solution_calldata, value: 0.into(), allowances: vec![solvers_dto::solution::Allowance { - token: token_usdc.address(), + token: token_usdc.address().into_legacy(), spender: liquorice_balance_manager_address, amount: trade_amount, }], diff --git a/crates/e2e/tests/e2e/protocol_fee.rs b/crates/e2e/tests/e2e/protocol_fee.rs index 133f94dd6b..f0e657f562 100644 --- a/crates/e2e/tests/e2e/protocol_fee.rs +++ b/crates/e2e/tests/e2e/protocol_fee.rs @@ -372,11 +372,17 @@ async fn combined_protocol_fees(web3: Web3) { .unwrap() .try_into() .expect("Expected exactly four elements"); - assert_approximately_eq!(market_executed_fee_in_buy_token, market_order_token_balance); - assert_approximately_eq!(limit_executed_fee_in_buy_token, limit_order_token_balance); assert_approximately_eq!( - partner_fee_executed_fee_in_buy_token, - partner_fee_order_token_balance + market_executed_fee_in_buy_token.into_alloy(), + market_order_token_balance.into_alloy() + ); + assert_approximately_eq!( + limit_executed_fee_in_buy_token.into_alloy(), + limit_order_token_balance.into_alloy() + ); + assert_approximately_eq!( + partner_fee_executed_fee_in_buy_token.into_alloy(), + partner_fee_order_token_balance.into_alloy() ); } diff --git a/crates/ethrpc/Cargo.toml b/crates/ethrpc/Cargo.toml index 36d43c02c5..b85f18c342 100644 --- a/crates/ethrpc/Cargo.toml +++ b/crates/ethrpc/Cargo.toml @@ -11,7 +11,7 @@ name = "ethrpc" path = "src/lib.rs" [dependencies] -alloy = { workspace = true, default-features = false, features = ["json-rpc", "providers", "rpc-client", "rpc-types", "transports", "reqwest", "signers", "signer-aws", "signer-local", "eips", "reqwest-default-tls"] } +alloy = { workspace = true, default-features = false, features = ["json-rpc", "providers", "rpc-client", "rpc-types", "transports", "reqwest", "signers", "signer-aws", "signer-local", "eips", "reqwest-default-tls", "contract"] } anyhow = { workspace = true } async-trait = { workspace = true } ethcontract = { workspace = true } diff --git a/crates/ethrpc/src/alloy/errors.rs b/crates/ethrpc/src/alloy/errors.rs new file mode 100644 index 0000000000..5475de5789 --- /dev/null +++ b/crates/ethrpc/src/alloy/errors.rs @@ -0,0 +1,44 @@ +use alloy::{contract::Error as ContractError, sol_types::GenericContractError}; + +/// Bubbles up node errors, ignoring all other errors. +// This function can be made to return only the RPC error that wasn't decode +pub fn handle_alloy_contract_error( + result: Result, +) -> anyhow::Result> { + match result { + Ok(result) => Ok(Some(result)), + // Alloy "hides" the contract execution errors under the transport error + Err(err @ alloy::contract::Error::TransportError(_)) => { + // So we need to try to decode the error as a generic contract error, + // we return in case it isn't a contract error + match err.try_decode_into_interface_error::() { + Ok(_) => Ok(None), // contract error + Err(err) => Err(err)?, + } + } + Err(_) => Ok(None), + } +} + +pub trait ContractErrorExt { + /// Returns if a given error is a contract error, this is considered to be + /// all errors except the transport error. + fn is_contract_err(&self) -> bool; + + /// Returns if a given error is a transport error. + fn is_transport_error(&self) -> bool; +} + +impl ContractErrorExt for ContractError { + fn is_contract_err(&self) -> bool { + !self.is_transport_error() + } + + fn is_transport_error(&self) -> bool { + if let ContractError::TransportError(rpc_error) = self { + rpc_error.is_transport_error() + } else { + false + } + } +} diff --git a/crates/ethrpc/src/alloy/mod.rs b/crates/ethrpc/src/alloy/mod.rs index 8161d559a9..14661482bd 100644 --- a/crates/ethrpc/src/alloy/mod.rs +++ b/crates/ethrpc/src/alloy/mod.rs @@ -1,7 +1,7 @@ mod buffering; pub mod conversions; +pub mod errors; mod instrumentation; - mod wallet; use { diff --git a/crates/shared/src/account_balances/simulation.rs b/crates/shared/src/account_balances/simulation.rs index cdeb96230b..e0319989cc 100644 --- a/crates/shared/src/account_balances/simulation.rs +++ b/crates/shared/src/account_balances/simulation.rs @@ -6,13 +6,13 @@ use { super::{BalanceFetching, Query, TransferSimulationError}, crate::account_balances::BalanceSimulator, anyhow::Result, - contracts::{alloy::BalancerV2Vault::BalancerV2Vault, erc20::Contract}, + contracts::alloy::{BalancerV2Vault::BalancerV2Vault, ERC20}, ethcontract::{H160, U256}, ethrpc::{ Web3, alloy::conversions::{IntoAlloy, IntoLegacy}, }, - futures::{TryFutureExt, future}, + futures::future, model::order::SellTokenSource, tracing::instrument, }; @@ -66,58 +66,59 @@ impl Balances { }) } - async fn tradable_balance_simple(&self, query: &Query, token: &Contract) -> Result { + async fn tradable_balance_simple( + &self, + query: &Query, + token: &ERC20::Instance, + ) -> Result { let usable_balance = match query.source { SellTokenSource::Erc20 => { - let balance = token.balance_of(query.owner).call(); - let allowance = token.allowance(query.owner, self.vault_relayer()).call(); - let (balance, allowance) = futures::try_join!(balance, allowance)?; - std::cmp::min(balance, allowance) + let balance = token.balanceOf(query.owner.into_alloy()); + let allowance = + token.allowance(query.owner.into_alloy(), self.vault_relayer().into_alloy()); + let (balance, allowance) = futures::try_join!( + balance.call().into_future(), + allowance.call().into_future() + )?; + std::cmp::min(balance, allowance).into_legacy() } SellTokenSource::External => { let vault = BalancerV2Vault::new(self.vault().into_alloy(), &self.web3.alloy); - // NOTE: the anyhow error conversion can be removed after migrating the token to - // alloy - let balance = token - .balance_of(query.owner) - .call() - .map_err(anyhow::Error::from); - let has_approved_relayer = vault.hasApprovedRelayer( + let balance = token.balanceOf(query.owner.into_alloy()); + let approved = vault.hasApprovedRelayer( query.owner.into_alloy(), self.vault_relayer().into_alloy(), ); - let approved = has_approved_relayer - .call() - .into_future() - .map_err(anyhow::Error::from); - let allowance = token - .allowance(query.owner, self.vault()) - .call() - .map_err(anyhow::Error::from); - let (balance, approved, allowance) = - futures::try_join!(balance, approved, allowance)?; + let allowance = + token.allowance(query.owner.into_alloy(), self.vault().into_alloy()); + let (balance, approved, allowance) = futures::try_join!( + balance.call().into_future(), + approved.call().into_future(), + allowance.call().into_future() + )?; match approved { true => std::cmp::min(balance, allowance), - false => 0.into(), + false => alloy::primitives::U256::ZERO, } + .into_legacy() } SellTokenSource::Internal => { let vault = BalancerV2Vault::new(self.vault().into_alloy(), &self.web3.alloy); - - let get_internal_balance = vault + let balance = vault .getInternalBalance(query.owner.into_alloy(), vec![query.token.into_alloy()]); - let balance = get_internal_balance.call().into_future(); - - let has_approved_relayer = vault.hasApprovedRelayer( + let approved = vault.hasApprovedRelayer( query.owner.into_alloy(), self.vault_relayer().into_alloy(), ); - let approved = has_approved_relayer.call().into_future(); - let (balance, approved) = futures::try_join!(balance, approved)?; + let (balance, approved) = futures::try_join!( + balance.call().into_future(), + approved.call().into_future() + )?; match approved { - true => balance[0].into_legacy(), // internal approvals are always U256::MAX - false => 0.into(), + true => balance[0], // internal approvals are always U256::MAX + false => alloy::primitives::U256::ZERO, } + .into_legacy() } }; Ok(usable_balance) @@ -133,7 +134,8 @@ impl BalanceFetching for Balances { .iter() .map(|query| async { if query.interactions.is_empty() { - let token = contracts::ERC20::at(&self.web3, query.token); + let token = + ERC20::Instance::new(query.token.into_alloy(), self.web3.alloy.clone()); self.tradable_balance_simple(query, &token).await } else { self.tradable_balance_simulated(query).await diff --git a/crates/shared/src/bad_token/token_owner_finder/mod.rs b/crates/shared/src/bad_token/token_owner_finder/mod.rs index 550ab09b4d..9818504d49 100644 --- a/crates/shared/src/bad_token/token_owner_finder/mod.rs +++ b/crates/shared/src/bad_token/token_owner_finder/mod.rs @@ -31,12 +31,12 @@ use { }, anyhow::{Context, Result}, chain::Chain, - contracts::{ - ERC20, - alloy::{BalancerV2Vault, IUniswapV3Factory}, - errors::EthcontractErrorType, - }, + contracts::alloy::{BalancerV2Vault, ERC20, IUniswapV3Factory}, ethcontract::U256, + ethrpc::alloy::{ + conversions::{IntoAlloy, IntoLegacy}, + errors::ContractErrorExt, + }, futures::{Stream, StreamExt as _}, primitive_types::H160, rate_limit::Strategy, @@ -420,7 +420,7 @@ impl TokenOwnerFinder { #[async_trait::async_trait] impl TokenOwnerFinding for TokenOwnerFinder { async fn find_owner(&self, token: H160, min_balance: U256) -> Result> { - let instance = ERC20::at(&self.web3, token); + let instance = ERC20::Instance::new(token.into_alloy(), self.web3.alloy.clone()); // We use a stream with ready_chunks so that we can start with the addresses of // fast TokenOwnerFinding implementations first without having to wait @@ -435,12 +435,12 @@ impl TokenOwnerFinding for TokenOwnerFinder { // owner is not the settlement contract. .filter(|owner| *owner != self.settlement_contract) .map(|owner| { - let call = instance.balance_of(owner).call(); + let balance = instance.balanceOf(owner.into_alloy()); async move { - match call.await { + match balance.call().await { Ok(balance) => Ok((owner, balance)), - Err(err) if EthcontractErrorType::is_contract_err(&err) => { - Ok((owner, 0.into())) + Err(err) if err.is_contract_err() => { + Ok((owner, alloy::primitives::U256::ZERO)) } Err(err) => Err(err), } @@ -448,11 +448,11 @@ impl TokenOwnerFinding for TokenOwnerFinder { }); let balances = futures::future::try_join_all(futures).await?; - if let Some(holder) = balances + if let Some((addr, balance)) = balances .into_iter() - .find(|(_, balance)| *balance >= min_balance) + .find(|(_, balance)| *balance >= min_balance.into_alloy()) { - return Ok(Some(holder)); + return Ok(Some((addr, balance.into_legacy()))); } } diff --git a/crates/shared/src/price_estimation/trade_verifier/balance_overrides/detector.rs b/crates/shared/src/price_estimation/trade_verifier/balance_overrides/detector.rs index acbbc392a0..94ad5a0712 100644 --- a/crates/shared/src/price_estimation/trade_verifier/balance_overrides/detector.rs +++ b/crates/shared/src/price_estimation/trade_verifier/balance_overrides/detector.rs @@ -2,8 +2,9 @@ use { super::Strategy, crate::tenderly_api::SimulationError, anyhow::Context, - contracts::ERC20, + contracts::alloy::ERC20, ethcontract::{Address, H256, U256, state_overrides::StateOverride}, + ethrpc::alloy::conversions::{IntoAlloy, IntoLegacy}, maplit::hashmap, std::{ collections::HashMap, @@ -100,23 +101,26 @@ impl Detector { /// Returns an `Err` if it cannot detect the strategy or an internal /// simulation fails. pub async fn detect(&self, token: Address) -> Result { - let token = ERC20::at(&self.web3, token); + let token = ERC20::Instance::new(token.into_alloy(), self.web3.alloy.clone()); let overrides = hashmap! { - token.address() => StateOverride { + token.address().into_legacy() => StateOverride { state_diff: Some(self.state_overrides.clone()), ..Default::default() }, }; let balance = token - .balance_of(self.holder) - .call_with_state_overrides(&overrides) + .balanceOf(self.holder.into_alloy()) + .state(overrides.into_alloy()) + .call() .await .context("eth_call with state overrides failed") .map_err(|e| DetectionError::Simulation(SimulationError::Other(e)))?; self.strategies .iter() - .find_map(|helper| (helper.balance == balance).then_some(helper.strategy.clone())) + .find_map(|helper| { + (helper.balance.into_alloy() == balance).then_some(helper.strategy.clone()) + }) .ok_or(DetectionError::NotFound) } } diff --git a/crates/shared/src/sources/swapr.rs b/crates/shared/src/sources/swapr.rs index 2896817333..877201f899 100644 --- a/crates/shared/src/sources/swapr.rs +++ b/crates/shared/src/sources/swapr.rs @@ -1,16 +1,11 @@ //! A pool state reading implementation specific to Swapr. use { - crate::sources::uniswap_v2::pool_fetching::{ - DefaultPoolReader, - Pool, - PoolReading, - handle_alloy_contract_error, - }, + crate::sources::uniswap_v2::pool_fetching::{DefaultPoolReader, Pool, PoolReading}, anyhow::Result, contracts::alloy::ISwaprPair, ethcontract::BlockId, - ethrpc::alloy::conversions::IntoAlloy, + ethrpc::alloy::{conversions::IntoAlloy, errors::handle_alloy_contract_error}, futures::{FutureExt as _, future::BoxFuture}, model::TokenPair, num::rational::Ratio, diff --git a/crates/shared/src/sources/uniswap_v2/pool_fetching.rs b/crates/shared/src/sources/uniswap_v2/pool_fetching.rs index e2801e2ea9..a50b88ac6f 100644 --- a/crates/shared/src/sources/uniswap_v2/pool_fetching.rs +++ b/crates/shared/src/sources/uniswap_v2/pool_fetching.rs @@ -1,16 +1,17 @@ use { super::pair_provider::PairProvider, crate::{baseline_solver::BaselineSolvable, ethrpc::Web3, recent_block_cache::Block}, - alloy::sol_types::GenericContractError, anyhow::Result, cached::{Cached, TimedCache}, contracts::{ - ERC20, - alloy::IUniswapLikePair::{self, IUniswapLikePair::getReservesReturn}, + alloy::{ + ERC20, + IUniswapLikePair::{self, IUniswapLikePair::getReservesReturn}, + }, errors::EthcontractErrorType, }, ethcontract::{BlockId, H160, U256, errors::MethodError}, - ethrpc::alloy::conversions::IntoAlloy, + ethrpc::alloy::{conversions::IntoAlloy, errors::handle_alloy_contract_error}, futures::{ FutureExt as _, future::{self, BoxFuture}, @@ -274,21 +275,25 @@ impl PoolReading for DefaultPoolReader { let pair_address = self.pair_provider.pair_address(&pair); // Fetch ERC20 token balances of the pools to sanity check with reserves - let token0 = ERC20::at(&self.web3, pair.get().0); - let token1 = ERC20::at(&self.web3, pair.get().1); - - let fetch_token0_balance = token0.balance_of(pair_address).block(block).call(); - let fetch_token1_balance = token1.balance_of(pair_address).block(block).call(); + let token0 = ERC20::Instance::new(pair.get().0.into_alloy(), self.web3.alloy.clone()); + let token1 = ERC20::Instance::new(pair.get().1.into_alloy(), self.web3.alloy.clone()); async move { + let fetch_token0_balance = token0 + .balanceOf(pair_address.into_alloy()) + .block(block.into_alloy()); + let fetch_token1_balance = token1 + .balanceOf(pair_address.into_alloy()) + .block(block.into_alloy()); + let pair_contract = IUniswapLikePair::Instance::new(pair_address.into_alloy(), self.web3.alloy.clone()); let fetch_reserves = pair_contract.getReserves().block(block.into_alloy()); let (reserves, token0_balance, token1_balance) = futures::join!( fetch_reserves.call().into_future(), - fetch_token0_balance, - fetch_token1_balance + fetch_token0_balance.call().into_future(), + fetch_token1_balance.call().into_future() ); handle_results( @@ -308,8 +313,8 @@ impl PoolReading for DefaultPoolReader { struct FetchedPool { pair: TokenPair, reserves: Result, - token0_balance: Result, - token1_balance: Result, + token0_balance: Result, + token1_balance: Result, } // Node errors should be bubbled up but contract errors should lead to the pool @@ -324,31 +329,10 @@ pub fn handle_contract_error(result: Result) -> Result