From bdc3bda04a727465cf42e18b42eba8b4ec8ffb94 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 18 Sep 2024 00:57:10 -0400 Subject: [PATCH] Remove ethereum-serai/serai-processor-ethereum-contracts contracts was smashed out of ethereum-serai. Both have now been smashed into individual crates. Creates a TODO directory with left-over test code yet to be moved. --- .github/workflows/tests.yml | 2 - Cargo.lock | 93 +- Cargo.toml | 2 - deny.toml | 2 - .../contracts/tests/ERC20.sol | 0 .../{src/lib.rs => TODO/old_processor.rs} | 0 .../src => TODO}/tests/crypto.rs | 0 .../{ethereum-serai/src => TODO}/tests/mod.rs | 0 .../src => TODO}/tests/router.rs | 0 processor/ethereum/contracts/Cargo.toml | 32 - processor/ethereum/contracts/LICENSE | 15 - processor/ethereum/contracts/README.md | 7 - processor/ethereum/contracts/build.rs | 69 - .../ethereum/contracts/src/abigen/deployer.rs | 584 ---- .../ethereum/contracts/src/abigen/erc20.rs | 1838 ---------- .../ethereum/contracts/src/abigen/mod.rs | 3 - .../ethereum/contracts/src/abigen/router.rs | 2958 ----------------- processor/ethereum/contracts/src/lib.rs | 16 - processor/ethereum/ethereum-serai/Cargo.toml | 52 - processor/ethereum/ethereum-serai/LICENSE | 15 - processor/ethereum/ethereum-serai/README.md | 15 - .../ethereum/ethereum-serai/src/crypto.rs | 32 - processor/ethereum/ethereum-serai/src/lib.rs | 41 - .../ethereum/ethereum-serai/src/machine.rs | 427 --- .../ethereum/src/primitives/transaction.rs | 24 +- tests/processor/Cargo.toml | 1 - 26 files changed, 35 insertions(+), 6193 deletions(-) rename processor/ethereum/{contracts => TODO}/contracts/tests/ERC20.sol (100%) rename processor/ethereum/{src/lib.rs => TODO/old_processor.rs} (100%) rename processor/ethereum/{ethereum-serai/src => TODO}/tests/crypto.rs (100%) rename processor/ethereum/{ethereum-serai/src => TODO}/tests/mod.rs (100%) rename processor/ethereum/{ethereum-serai/src => TODO}/tests/router.rs (100%) delete mode 100644 processor/ethereum/contracts/Cargo.toml delete mode 100644 processor/ethereum/contracts/LICENSE delete mode 100644 processor/ethereum/contracts/README.md delete mode 100644 processor/ethereum/contracts/build.rs delete mode 100644 processor/ethereum/contracts/src/abigen/deployer.rs delete mode 100644 processor/ethereum/contracts/src/abigen/erc20.rs delete mode 100644 processor/ethereum/contracts/src/abigen/mod.rs delete mode 100644 processor/ethereum/contracts/src/abigen/router.rs delete mode 100644 processor/ethereum/contracts/src/lib.rs delete mode 100644 processor/ethereum/ethereum-serai/Cargo.toml delete mode 100644 processor/ethereum/ethereum-serai/LICENSE delete mode 100644 processor/ethereum/ethereum-serai/README.md delete mode 100644 processor/ethereum/ethereum-serai/src/crypto.rs delete mode 100644 processor/ethereum/ethereum-serai/src/lib.rs delete mode 100644 processor/ethereum/ethereum-serai/src/machine.rs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e374d4f1..d207e9cd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,12 +52,10 @@ jobs: -p serai-processor-signers \ -p serai-processor-bin \ -p serai-bitcoin-processor \ - -p serai-processor-ethereum-contracts \ -p serai-processor-ethereum-primitives \ -p serai-processor-ethereum-deployer \ -p serai-processor-ethereum-router \ -p serai-processor-ethereum-erc20 \ - -p ethereum-serai \ -p serai-ethereum-processor \ -p serai-monero-processor \ -p tendermint-machine \ diff --git a/Cargo.lock b/Cargo.lock index f928e57e..a7f3792a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,17 +184,6 @@ dependencies = [ "serde", ] -[[package]] -name = "alloy-json-abi" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299d2a937b6c60968df3dad2a988b0f0e03277b344639a4f7a31bd68e6285e59" -dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", - "serde", -] - [[package]] name = "alloy-json-rpc" version = "0.3.1" @@ -426,7 +415,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71c4d842beb7a6686d04125603bc57614d5ed78bf95e4753274db3db4ba95214" dependencies = [ - "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", @@ -445,33 +433,21 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1306e8d3c9e6e6ecf7a39ffaf7291e73a5f655a2defd366ee92c2efebcdf7fee" dependencies = [ - "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "serde_json", "syn 2.0.77", "syn-solidity", ] -[[package]] -name = "alloy-sol-type-parser" -version = "0.8.0" -source = "git+https://github.com/alloy-rs/core?rev=446b9d2fbce12b88456152170709a3eaac929af0#446b9d2fbce12b88456152170709a3eaac929af0" -dependencies = [ - "serde", - "winnow 0.6.18", -] - [[package]] name = "alloy-sol-types" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "577e262966e92112edbd15b1b2c0947cc434d6e8311df96d3329793fe8047da9" dependencies = [ - "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", @@ -2503,30 +2479,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "ethereum-serai" -version = "0.1.0" -dependencies = [ - "alloy-consensus", - "alloy-core", - "alloy-network", - "alloy-node-bindings", - "alloy-provider", - "alloy-rpc-client", - "alloy-rpc-types-eth", - "alloy-simple-request-transport", - "alloy-sol-types", - "ethereum-schnorr-contract", - "flexible-transcript", - "group", - "k256", - "modular-frost", - "rand_core", - "serai-processor-ethereum-contracts", - "thiserror", - "tokio", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -6127,16 +6079,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prettyplease" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" -dependencies = [ - "proc-macro2", - "syn 2.0.77", -] - [[package]] name = "primeorder" version = "0.13.6" @@ -6302,7 +6244,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prettyplease 0.1.25", + "prettyplease", "prost", "prost-types", "regex", @@ -8385,11 +8327,18 @@ version = "0.1.0" name = "serai-ethereum-processor" version = "0.1.0" dependencies = [ + "alloy-consensus", + "alloy-core", + "alloy-provider", + "alloy-rlp", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-simple-request-transport", "borsh", "ciphersuite", "const-hex", "dkg", - "ethereum-serai", + "ethereum-schnorr-contract", "hex", "k256", "log", @@ -8400,6 +8349,9 @@ dependencies = [ "serai-db", "serai-env", "serai-processor-bin", + "serai-processor-ethereum-erc20", + "serai-processor-ethereum-primitives", + "serai-processor-ethereum-router", "serai-processor-key-gen", "serai-processor-primitives", "serai-processor-scanner", @@ -8707,20 +8659,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "serai-processor-ethereum-contracts" -version = "0.1.0" -dependencies = [ - "alloy-sol-macro-expander", - "alloy-sol-macro-input", - "alloy-sol-types", - "build-solidity-contracts", - "prettyplease 0.2.22", - "serde_json", - "syn 2.0.77", - "syn-solidity", -] - [[package]] name = "serai-processor-ethereum-deployer" version = "0.1.0" @@ -8770,7 +8708,6 @@ dependencies = [ "alloy-provider", "alloy-rpc-types-eth", "alloy-simple-request-transport", - "alloy-sol-macro", "alloy-sol-macro-expander", "alloy-sol-macro-input", "alloy-sol-types", @@ -8924,7 +8861,6 @@ dependencies = [ "curve25519-dalek", "dkg", "dockertest", - "ethereum-serai", "hex", "k256", "monero-simple-request-rpc", @@ -11954,3 +11890,8 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "alloy-sol-type-parser" +version = "0.8.0" +source = "git+https://github.com/alloy-rs/core?rev=446b9d2fbce12b88456152170709a3eaac929af0#446b9d2fbce12b88456152170709a3eaac929af0" diff --git a/Cargo.toml b/Cargo.toml index 3c203ced..99a10be0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,12 +87,10 @@ members = [ "processor/bin", "processor/bitcoin", - "processor/ethereum/contracts", "processor/ethereum/primitives", "processor/ethereum/deployer", "processor/ethereum/router", "processor/ethereum/erc20", - "processor/ethereum/ethereum-serai", "processor/ethereum", "processor/monero", diff --git a/deny.toml b/deny.toml index 9ee16043..d09fc8eb 100644 --- a/deny.toml +++ b/deny.toml @@ -59,12 +59,10 @@ exceptions = [ { allow = ["AGPL-3.0"], name = "serai-processor-signers" }, { allow = ["AGPL-3.0"], name = "serai-bitcoin-processor" }, - { allow = ["AGPL-3.0"], name = "serai-processor-ethereum-contracts" }, { allow = ["AGPL-3.0"], name = "serai-processor-ethereum-primitives" }, { allow = ["AGPL-3.0"], name = "serai-processor-ethereum-deployer" }, { allow = ["AGPL-3.0"], name = "serai-processor-ethereum-router" }, { allow = ["AGPL-3.0"], name = "serai-processor-ethereum-erc20" }, - { allow = ["AGPL-3.0"], name = "ethereum-serai" }, { allow = ["AGPL-3.0"], name = "serai-ethereum-processor" }, { allow = ["AGPL-3.0"], name = "serai-monero-processor" }, diff --git a/processor/ethereum/contracts/contracts/tests/ERC20.sol b/processor/ethereum/TODO/contracts/tests/ERC20.sol similarity index 100% rename from processor/ethereum/contracts/contracts/tests/ERC20.sol rename to processor/ethereum/TODO/contracts/tests/ERC20.sol diff --git a/processor/ethereum/src/lib.rs b/processor/ethereum/TODO/old_processor.rs similarity index 100% rename from processor/ethereum/src/lib.rs rename to processor/ethereum/TODO/old_processor.rs diff --git a/processor/ethereum/ethereum-serai/src/tests/crypto.rs b/processor/ethereum/TODO/tests/crypto.rs similarity index 100% rename from processor/ethereum/ethereum-serai/src/tests/crypto.rs rename to processor/ethereum/TODO/tests/crypto.rs diff --git a/processor/ethereum/ethereum-serai/src/tests/mod.rs b/processor/ethereum/TODO/tests/mod.rs similarity index 100% rename from processor/ethereum/ethereum-serai/src/tests/mod.rs rename to processor/ethereum/TODO/tests/mod.rs diff --git a/processor/ethereum/ethereum-serai/src/tests/router.rs b/processor/ethereum/TODO/tests/router.rs similarity index 100% rename from processor/ethereum/ethereum-serai/src/tests/router.rs rename to processor/ethereum/TODO/tests/router.rs diff --git a/processor/ethereum/contracts/Cargo.toml b/processor/ethereum/contracts/Cargo.toml deleted file mode 100644 index 5ed540b6..00000000 --- a/processor/ethereum/contracts/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "serai-processor-ethereum-contracts" -version = "0.1.0" -description = "Ethereum contracts for the Serai processor" -license = "AGPL-3.0-only" -repository = "https://github.com/serai-dex/serai/tree/develop/processor/ethereum/contracts" -authors = ["Luke Parker ", "Elizabeth Binks "] -edition = "2021" -publish = false -rust-version = "1.79" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[lints] -workspace = true - -[dependencies] -alloy-sol-types = { version = "0.8", default-features = false, features = ["json"] } - -[build-dependencies] -build-solidity-contracts = { path = "../../../networks/ethereum/build-contracts" } - -syn = { version = "2", default-features = false, features = ["proc-macro"] } - -serde_json = { version = "1", default-features = false, features = ["std"] } - -syn-solidity = { version = "0.8", default-features = false } -alloy-sol-macro-input = { version = "0.8", default-features = false } -alloy-sol-macro-expander = { version = "0.8", default-features = false } -prettyplease = { version = "0.2", default-features = false } diff --git a/processor/ethereum/contracts/LICENSE b/processor/ethereum/contracts/LICENSE deleted file mode 100644 index 41d5a261..00000000 --- a/processor/ethereum/contracts/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -AGPL-3.0-only license - -Copyright (c) 2022-2024 Luke Parker - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . diff --git a/processor/ethereum/contracts/README.md b/processor/ethereum/contracts/README.md deleted file mode 100644 index fcd8f3c7..00000000 --- a/processor/ethereum/contracts/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Serai Processor Ethereum Contracts - -The Ethereum contracts used for (and for testing) the Serai processor. This is -its own crate for organizational and build-time reasons. It is not intended to -be publicly used. - -This crate will fail to build if `solc` is not installed and available. diff --git a/processor/ethereum/contracts/build.rs b/processor/ethereum/contracts/build.rs deleted file mode 100644 index 23d1e907..00000000 --- a/processor/ethereum/contracts/build.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::{env, fs}; - -use alloy_sol_macro_input::{SolInputKind, SolInput}; - -fn write(sol: syn_solidity::File, file: &str) { - let sol = alloy_sol_macro_expander::expand::expand(sol).unwrap(); - fs::write( - file, - // TODO: Replace `prettyplease::unparse` with `to_string` - prettyplease::unparse(&syn::File { - attrs: vec![], - items: vec![syn::parse2(sol).unwrap()], - shebang: None, - }) - .as_bytes(), - ) - .unwrap(); -} - -fn sol(sol: &str, file: &str) { - let alloy_sol_macro_input::SolInputKind::Sol(sol) = - syn::parse_str(&std::fs::read_to_string(sol).unwrap()).unwrap() - else { - panic!("parsed .sol file wasn't SolInputKind::Sol"); - }; - write(sol, file); -} - -fn abi(ident: &str, abi: &str, file: &str) { - let SolInputKind::Sol(sol) = (SolInput { - attrs: vec![], - path: None, - kind: SolInputKind::Json( - syn::parse_str(ident).unwrap(), - serde_json::from_str(&fs::read_to_string(abi).unwrap()).unwrap(), - ), - }) - .normalize_json() - .unwrap() - .kind - else { - panic!("normalized JSON wasn't SolInputKind::Sol"); - }; - write(sol, file); -} - -fn main() { - let artifacts_path = - env::var("OUT_DIR").unwrap().to_string() + "/serai-processor-ethereum-contracts"; - build_solidity_contracts::build( - &["../../../networks/ethereum/schnorr/contracts"], - "contracts", - &artifacts_path, - ) - .unwrap(); - - // TODO: Use OUT_DIR for the generated code - if !fs::exists("src/abigen").unwrap() { - fs::create_dir("src/abigen").unwrap(); - } - - // These can be handled with the sol! macro - sol("contracts/IERC20.sol", "src/abigen/erc20.rs"); - sol("contracts/Deployer.sol", "src/abigen/deployer.rs"); - // This cannot be handled with the sol! macro. The Solidity requires an import, the ABI is built - // to OUT_DIR and the macro doesn't support non-static paths: - // https://github.com/alloy-rs/core/issues/738 - abi("Router", &(artifacts_path.clone() + "/Router.abi"), "src/abigen/router.rs"); -} diff --git a/processor/ethereum/contracts/src/abigen/deployer.rs b/processor/ethereum/contracts/src/abigen/deployer.rs deleted file mode 100644 index f4bcb3a6..00000000 --- a/processor/ethereum/contracts/src/abigen/deployer.rs +++ /dev/null @@ -1,584 +0,0 @@ -///Module containing a contract's types and functions. -/** - -```solidity -contract Deployer { - event Deployment(bytes32 indexed init_code_hash, address created); - error DeploymentFailed(); - function deploy(bytes memory init_code) external { } -} -```*/ -#[allow(non_camel_case_types, non_snake_case, clippy::style)] -pub mod Deployer { - use super::*; - use ::alloy_sol_types as alloy_sol_types; - /**Event with signature `Deployment(bytes32,address)` and selector `0x60b877a3bae7bf0f0bd5e1c40ebf44ea158201397f6b72d7c05360157b1ec0fc`. -```solidity -event Deployment(bytes32 indexed init_code_hash, address created); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct Deployment { - #[allow(missing_docs)] - pub init_code_hash: ::alloy_sol_types::private::FixedBytes<32>, - #[allow(missing_docs)] - pub created: ::alloy_sol_types::private::Address, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for Deployment { - type DataTuple<'a> = (::alloy_sol_types::sol_data::Address,); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::FixedBytes<32>, - ); - const SIGNATURE: &'static str = "Deployment(bytes32,address)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 96u8, - 184u8, - 119u8, - 163u8, - 186u8, - 231u8, - 191u8, - 15u8, - 11u8, - 213u8, - 225u8, - 196u8, - 14u8, - 191u8, - 68u8, - 234u8, - 21u8, - 130u8, - 1u8, - 57u8, - 127u8, - 107u8, - 114u8, - 215u8, - 192u8, - 83u8, - 96u8, - 21u8, - 123u8, - 30u8, - 192u8, - 252u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - init_code_hash: topics.1, - created: data.0, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.created, - ), - ) - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.init_code_hash.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::encode_topic(&self.init_code_hash); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for Deployment { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&Deployment> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &Deployment) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Custom error with signature `DeploymentFailed()` and selector `0x30116425`. -```solidity -error DeploymentFailed(); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct DeploymentFailed {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: DeploymentFailed) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for DeploymentFailed { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - #[automatically_derived] - impl alloy_sol_types::SolError for DeploymentFailed { - type Parameters<'a> = UnderlyingSolTuple<'a>; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "DeploymentFailed()"; - const SELECTOR: [u8; 4] = [48u8, 17u8, 100u8, 37u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - } - }; - /**Function with signature `deploy(bytes)` and selector `0x00774360`. -```solidity -function deploy(bytes memory init_code) external { } -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct deployCall { - pub init_code: ::alloy_sol_types::private::Bytes, - } - ///Container type for the return parameters of the [`deploy(bytes)`](deployCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct deployReturn {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Bytes,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::Bytes,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: deployCall) -> Self { - (value.init_code,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for deployCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { init_code: tuple.0 } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: deployReturn) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for deployReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for deployCall { - type Parameters<'a> = (::alloy_sol_types::sol_data::Bytes,); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = deployReturn; - type ReturnTuple<'a> = (); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "deploy(bytes)"; - const SELECTOR: [u8; 4] = [0u8, 119u8, 67u8, 96u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::tokenize( - &self.init_code, - ), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - ///Container for all the [`Deployer`](self) function calls. - pub enum DeployerCalls { - deploy(deployCall), - } - #[automatically_derived] - impl DeployerCalls { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 4usize]] = &[[0u8, 119u8, 67u8, 96u8]]; - } - #[automatically_derived] - impl alloy_sol_types::SolInterface for DeployerCalls { - const NAME: &'static str = "DeployerCalls"; - const MIN_DATA_LENGTH: usize = 64usize; - const COUNT: usize = 1usize; - #[inline] - fn selector(&self) -> [u8; 4] { - match self { - Self::deploy(_) => ::SELECTOR, - } - } - #[inline] - fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { - Self::SELECTORS.get(i).copied() - } - #[inline] - fn valid_selector(selector: [u8; 4]) -> bool { - Self::SELECTORS.binary_search(&selector).is_ok() - } - #[inline] - #[allow(unsafe_code, non_snake_case)] - fn abi_decode_raw( - selector: [u8; 4], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - static DECODE_SHIMS: &[fn( - &[u8], - bool, - ) -> alloy_sol_types::Result] = &[ - { - fn deploy( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(DeployerCalls::deploy) - } - deploy - }, - ]; - let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { - return Err( - alloy_sol_types::Error::unknown_selector( - ::NAME, - selector, - ), - ); - }; - (unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate) - } - #[inline] - fn abi_encoded_size(&self) -> usize { - match self { - Self::deploy(inner) => { - ::abi_encoded_size(inner) - } - } - } - #[inline] - fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { - match self { - Self::deploy(inner) => { - ::abi_encode_raw(inner, out) - } - } - } - } - ///Container for all the [`Deployer`](self) custom errors. - pub enum DeployerErrors { - DeploymentFailed(DeploymentFailed), - } - #[automatically_derived] - impl DeployerErrors { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 4usize]] = &[[48u8, 17u8, 100u8, 37u8]]; - } - #[automatically_derived] - impl alloy_sol_types::SolInterface for DeployerErrors { - const NAME: &'static str = "DeployerErrors"; - const MIN_DATA_LENGTH: usize = 0usize; - const COUNT: usize = 1usize; - #[inline] - fn selector(&self) -> [u8; 4] { - match self { - Self::DeploymentFailed(_) => { - ::SELECTOR - } - } - } - #[inline] - fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { - Self::SELECTORS.get(i).copied() - } - #[inline] - fn valid_selector(selector: [u8; 4]) -> bool { - Self::SELECTORS.binary_search(&selector).is_ok() - } - #[inline] - #[allow(unsafe_code, non_snake_case)] - fn abi_decode_raw( - selector: [u8; 4], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - static DECODE_SHIMS: &[fn( - &[u8], - bool, - ) -> alloy_sol_types::Result] = &[ - { - fn DeploymentFailed( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(DeployerErrors::DeploymentFailed) - } - DeploymentFailed - }, - ]; - let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { - return Err( - alloy_sol_types::Error::unknown_selector( - ::NAME, - selector, - ), - ); - }; - (unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate) - } - #[inline] - fn abi_encoded_size(&self) -> usize { - match self { - Self::DeploymentFailed(inner) => { - ::abi_encoded_size( - inner, - ) - } - } - } - #[inline] - fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { - match self { - Self::DeploymentFailed(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - } - } - } - ///Container for all the [`Deployer`](self) events. - pub enum DeployerEvents { - Deployment(Deployment), - } - #[automatically_derived] - impl DeployerEvents { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 32usize]] = &[ - [ - 96u8, - 184u8, - 119u8, - 163u8, - 186u8, - 231u8, - 191u8, - 15u8, - 11u8, - 213u8, - 225u8, - 196u8, - 14u8, - 191u8, - 68u8, - 234u8, - 21u8, - 130u8, - 1u8, - 57u8, - 127u8, - 107u8, - 114u8, - 215u8, - 192u8, - 83u8, - 96u8, - 21u8, - 123u8, - 30u8, - 192u8, - 252u8, - ], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolEventInterface for DeployerEvents { - const NAME: &'static str = "DeployerEvents"; - const COUNT: usize = 1usize; - fn decode_raw_log( - topics: &[alloy_sol_types::Word], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - match topics.first().copied() { - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::Deployment) - } - _ => { - alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { - name: ::NAME, - log: alloy_sol_types::private::Box::new( - alloy_sol_types::private::LogData::new_unchecked( - topics.to_vec(), - data.to_vec().into(), - ), - ), - }) - } - } - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for DeployerEvents { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - match self { - Self::Deployment(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - } - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - match self { - Self::Deployment(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - } - } - } -} diff --git a/processor/ethereum/contracts/src/abigen/erc20.rs b/processor/ethereum/contracts/src/abigen/erc20.rs deleted file mode 100644 index d9c0dd6e..00000000 --- a/processor/ethereum/contracts/src/abigen/erc20.rs +++ /dev/null @@ -1,1838 +0,0 @@ -///Module containing a contract's types and functions. -/** - -```solidity -interface IERC20 { - event Transfer(address indexed from, address indexed to, uint256 value); - event Approval(address indexed owner, address indexed spender, uint256 value); - function name() external view returns (string memory); - function symbol() external view returns (string memory); - function decimals() external view returns (uint8); - function totalSupply() external view returns (uint256); - function balanceOf(address owner) external view returns (uint256); - function transfer(address to, uint256 value) external returns (bool); - function transferFrom(address from, address to, uint256 value) external returns (bool); - function approve(address spender, uint256 value) external returns (bool); - function allowance(address owner, address spender) external view returns (uint256); -} -```*/ -#[allow(non_camel_case_types, non_snake_case, clippy::style)] -pub mod IERC20 { - use super::*; - use ::alloy_sol_types as alloy_sol_types; - /**Event with signature `Transfer(address,address,uint256)` and selector `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`. -```solidity -event Transfer(address indexed from, address indexed to, uint256 value); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct Transfer { - #[allow(missing_docs)] - pub from: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub to: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for Transfer { - type DataTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ); - const SIGNATURE: &'static str = "Transfer(address,address,uint256)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 221u8, - 242u8, - 82u8, - 173u8, - 27u8, - 226u8, - 200u8, - 155u8, - 105u8, - 194u8, - 176u8, - 104u8, - 252u8, - 55u8, - 141u8, - 170u8, - 149u8, - 43u8, - 167u8, - 241u8, - 99u8, - 196u8, - 161u8, - 22u8, - 40u8, - 245u8, - 90u8, - 77u8, - 245u8, - 35u8, - 179u8, - 239u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - from: topics.1, - to: topics.2, - value: data.0, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - ( - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.from.clone(), self.to.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.from, - ); - out[2usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.to, - ); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for Transfer { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&Transfer> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &Transfer) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Event with signature `Approval(address,address,uint256)` and selector `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925`. -```solidity -event Approval(address indexed owner, address indexed spender, uint256 value); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct Approval { - #[allow(missing_docs)] - pub owner: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub spender: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for Approval { - type DataTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ); - const SIGNATURE: &'static str = "Approval(address,address,uint256)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 140u8, - 91u8, - 225u8, - 229u8, - 235u8, - 236u8, - 125u8, - 91u8, - 209u8, - 79u8, - 113u8, - 66u8, - 125u8, - 30u8, - 132u8, - 243u8, - 221u8, - 3u8, - 20u8, - 192u8, - 247u8, - 178u8, - 41u8, - 30u8, - 91u8, - 32u8, - 10u8, - 200u8, - 199u8, - 195u8, - 185u8, - 37u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - owner: topics.1, - spender: topics.2, - value: data.0, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - ( - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.owner.clone(), self.spender.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.owner, - ); - out[2usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.spender, - ); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for Approval { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&Approval> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &Approval) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Function with signature `name()` and selector `0x06fdde03`. -```solidity -function name() external view returns (string memory); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct nameCall {} - ///Container type for the return parameters of the [`name()`](nameCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct nameReturn { - pub _0: ::alloy_sol_types::private::String, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: nameCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for nameCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::String,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::String,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: nameReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for nameReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for nameCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = nameReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::String,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "name()"; - const SELECTOR: [u8; 4] = [6u8, 253u8, 222u8, 3u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `symbol()` and selector `0x95d89b41`. -```solidity -function symbol() external view returns (string memory); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct symbolCall {} - ///Container type for the return parameters of the [`symbol()`](symbolCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct symbolReturn { - pub _0: ::alloy_sol_types::private::String, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: symbolCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for symbolCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::String,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::String,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: symbolReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for symbolReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for symbolCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = symbolReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::String,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "symbol()"; - const SELECTOR: [u8; 4] = [149u8, 216u8, 155u8, 65u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `decimals()` and selector `0x313ce567`. -```solidity -function decimals() external view returns (uint8); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct decimalsCall {} - ///Container type for the return parameters of the [`decimals()`](decimalsCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct decimalsReturn { - pub _0: u8, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: decimalsCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for decimalsCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<8>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (u8,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: decimalsReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for decimalsReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for decimalsCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = decimalsReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<8>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "decimals()"; - const SELECTOR: [u8; 4] = [49u8, 60u8, 229u8, 103u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `totalSupply()` and selector `0x18160ddd`. -```solidity -function totalSupply() external view returns (uint256); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct totalSupplyCall {} - ///Container type for the return parameters of the [`totalSupply()`](totalSupplyCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct totalSupplyReturn { - pub _0: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: totalSupplyCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for totalSupplyCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: totalSupplyReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for totalSupplyReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for totalSupplyCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = totalSupplyReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "totalSupply()"; - const SELECTOR: [u8; 4] = [24u8, 22u8, 13u8, 221u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `balanceOf(address)` and selector `0x70a08231`. -```solidity -function balanceOf(address owner) external view returns (uint256); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct balanceOfCall { - pub owner: ::alloy_sol_types::private::Address, - } - ///Container type for the return parameters of the [`balanceOf(address)`](balanceOfCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct balanceOfReturn { - pub _0: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Address,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::Address,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: balanceOfCall) -> Self { - (value.owner,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for balanceOfCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { owner: tuple.0 } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: balanceOfReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for balanceOfReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for balanceOfCall { - type Parameters<'a> = (::alloy_sol_types::sol_data::Address,); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = balanceOfReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "balanceOf(address)"; - const SELECTOR: [u8; 4] = [112u8, 160u8, 130u8, 49u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.owner, - ), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `transfer(address,uint256)` and selector `0xa9059cbb`. -```solidity -function transfer(address to, uint256 value) external returns (bool); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct transferCall { - pub to: ::alloy_sol_types::private::Address, - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - ///Container type for the return parameters of the [`transfer(address,uint256)`](transferCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct transferReturn { - pub _0: bool, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: transferCall) -> Self { - (value.to, value.value) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for transferCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - to: tuple.0, - value: tuple.1, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (bool,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: transferReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for transferReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for transferCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = transferReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "transfer(address,uint256)"; - const SELECTOR: [u8; 4] = [169u8, 5u8, 156u8, 187u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.to, - ), - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `transferFrom(address,address,uint256)` and selector `0x23b872dd`. -```solidity -function transferFrom(address from, address to, uint256 value) external returns (bool); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct transferFromCall { - pub from: ::alloy_sol_types::private::Address, - pub to: ::alloy_sol_types::private::Address, - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - ///Container type for the return parameters of the [`transferFrom(address,address,uint256)`](transferFromCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct transferFromReturn { - pub _0: bool, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: transferFromCall) -> Self { - (value.from, value.to, value.value) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for transferFromCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - from: tuple.0, - to: tuple.1, - value: tuple.2, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (bool,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: transferFromReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for transferFromReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for transferFromCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = transferFromReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "transferFrom(address,address,uint256)"; - const SELECTOR: [u8; 4] = [35u8, 184u8, 114u8, 221u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.from, - ), - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.to, - ), - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `approve(address,uint256)` and selector `0x095ea7b3`. -```solidity -function approve(address spender, uint256 value) external returns (bool); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct approveCall { - pub spender: ::alloy_sol_types::private::Address, - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - ///Container type for the return parameters of the [`approve(address,uint256)`](approveCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct approveReturn { - pub _0: bool, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: approveCall) -> Self { - (value.spender, value.value) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for approveCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - spender: tuple.0, - value: tuple.1, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (bool,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: approveReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for approveReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for approveCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = approveReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Bool,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "approve(address,uint256)"; - const SELECTOR: [u8; 4] = [9u8, 94u8, 167u8, 179u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.spender, - ), - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `allowance(address,address)` and selector `0xdd62ed3e`. -```solidity -function allowance(address owner, address spender) external view returns (uint256); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct allowanceCall { - pub owner: ::alloy_sol_types::private::Address, - pub spender: ::alloy_sol_types::private::Address, - } - ///Container type for the return parameters of the [`allowance(address,address)`](allowanceCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct allowanceReturn { - pub _0: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::Address, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: allowanceCall) -> Self { - (value.owner, value.spender) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for allowanceCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - owner: tuple.0, - spender: tuple.1, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: allowanceReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for allowanceReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for allowanceCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = allowanceReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "allowance(address,address)"; - const SELECTOR: [u8; 4] = [221u8, 98u8, 237u8, 62u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.owner, - ), - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.spender, - ), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - ///Container for all the [`IERC20`](self) function calls. - pub enum IERC20Calls { - name(nameCall), - symbol(symbolCall), - decimals(decimalsCall), - totalSupply(totalSupplyCall), - balanceOf(balanceOfCall), - transfer(transferCall), - transferFrom(transferFromCall), - approve(approveCall), - allowance(allowanceCall), - } - #[automatically_derived] - impl IERC20Calls { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 4usize]] = &[ - [6u8, 253u8, 222u8, 3u8], - [9u8, 94u8, 167u8, 179u8], - [24u8, 22u8, 13u8, 221u8], - [35u8, 184u8, 114u8, 221u8], - [49u8, 60u8, 229u8, 103u8], - [112u8, 160u8, 130u8, 49u8], - [149u8, 216u8, 155u8, 65u8], - [169u8, 5u8, 156u8, 187u8], - [221u8, 98u8, 237u8, 62u8], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolInterface for IERC20Calls { - const NAME: &'static str = "IERC20Calls"; - const MIN_DATA_LENGTH: usize = 0usize; - const COUNT: usize = 9usize; - #[inline] - fn selector(&self) -> [u8; 4] { - match self { - Self::name(_) => ::SELECTOR, - Self::symbol(_) => ::SELECTOR, - Self::decimals(_) => ::SELECTOR, - Self::totalSupply(_) => { - ::SELECTOR - } - Self::balanceOf(_) => { - ::SELECTOR - } - Self::transfer(_) => ::SELECTOR, - Self::transferFrom(_) => { - ::SELECTOR - } - Self::approve(_) => ::SELECTOR, - Self::allowance(_) => { - ::SELECTOR - } - } - } - #[inline] - fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { - Self::SELECTORS.get(i).copied() - } - #[inline] - fn valid_selector(selector: [u8; 4]) -> bool { - Self::SELECTORS.binary_search(&selector).is_ok() - } - #[inline] - #[allow(unsafe_code, non_snake_case)] - fn abi_decode_raw( - selector: [u8; 4], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - static DECODE_SHIMS: &[fn( - &[u8], - bool, - ) -> alloy_sol_types::Result] = &[ - { - fn name( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::name) - } - name - }, - { - fn approve( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::approve) - } - approve - }, - { - fn totalSupply( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::totalSupply) - } - totalSupply - }, - { - fn transferFrom( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::transferFrom) - } - transferFrom - }, - { - fn decimals( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::decimals) - } - decimals - }, - { - fn balanceOf( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::balanceOf) - } - balanceOf - }, - { - fn symbol( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::symbol) - } - symbol - }, - { - fn transfer( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::transfer) - } - transfer - }, - { - fn allowance( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(IERC20Calls::allowance) - } - allowance - }, - ]; - let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { - return Err( - alloy_sol_types::Error::unknown_selector( - ::NAME, - selector, - ), - ); - }; - (unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate) - } - #[inline] - fn abi_encoded_size(&self) -> usize { - match self { - Self::name(inner) => { - ::abi_encoded_size(inner) - } - Self::symbol(inner) => { - ::abi_encoded_size(inner) - } - Self::decimals(inner) => { - ::abi_encoded_size(inner) - } - Self::totalSupply(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::balanceOf(inner) => { - ::abi_encoded_size(inner) - } - Self::transfer(inner) => { - ::abi_encoded_size(inner) - } - Self::transferFrom(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::approve(inner) => { - ::abi_encoded_size(inner) - } - Self::allowance(inner) => { - ::abi_encoded_size(inner) - } - } - } - #[inline] - fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { - match self { - Self::name(inner) => { - ::abi_encode_raw(inner, out) - } - Self::symbol(inner) => { - ::abi_encode_raw(inner, out) - } - Self::decimals(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::totalSupply(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::balanceOf(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::transfer(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::transferFrom(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::approve(inner) => { - ::abi_encode_raw(inner, out) - } - Self::allowance(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - } - } - } - ///Container for all the [`IERC20`](self) events. - pub enum IERC20Events { - Transfer(Transfer), - Approval(Approval), - } - #[automatically_derived] - impl IERC20Events { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 32usize]] = &[ - [ - 140u8, - 91u8, - 225u8, - 229u8, - 235u8, - 236u8, - 125u8, - 91u8, - 209u8, - 79u8, - 113u8, - 66u8, - 125u8, - 30u8, - 132u8, - 243u8, - 221u8, - 3u8, - 20u8, - 192u8, - 247u8, - 178u8, - 41u8, - 30u8, - 91u8, - 32u8, - 10u8, - 200u8, - 199u8, - 195u8, - 185u8, - 37u8, - ], - [ - 221u8, - 242u8, - 82u8, - 173u8, - 27u8, - 226u8, - 200u8, - 155u8, - 105u8, - 194u8, - 176u8, - 104u8, - 252u8, - 55u8, - 141u8, - 170u8, - 149u8, - 43u8, - 167u8, - 241u8, - 99u8, - 196u8, - 161u8, - 22u8, - 40u8, - 245u8, - 90u8, - 77u8, - 245u8, - 35u8, - 179u8, - 239u8, - ], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolEventInterface for IERC20Events { - const NAME: &'static str = "IERC20Events"; - const COUNT: usize = 2usize; - fn decode_raw_log( - topics: &[alloy_sol_types::Word], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - match topics.first().copied() { - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::Transfer) - } - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::Approval) - } - _ => { - alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { - name: ::NAME, - log: alloy_sol_types::private::Box::new( - alloy_sol_types::private::LogData::new_unchecked( - topics.to_vec(), - data.to_vec().into(), - ), - ), - }) - } - } - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for IERC20Events { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - match self { - Self::Transfer(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - Self::Approval(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - } - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - match self { - Self::Transfer(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - Self::Approval(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - } - } - } -} diff --git a/processor/ethereum/contracts/src/abigen/mod.rs b/processor/ethereum/contracts/src/abigen/mod.rs deleted file mode 100644 index 541c2980..00000000 --- a/processor/ethereum/contracts/src/abigen/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod erc20; -pub mod deployer; -pub mod router; diff --git a/processor/ethereum/contracts/src/abigen/router.rs b/processor/ethereum/contracts/src/abigen/router.rs deleted file mode 100644 index cea1858f..00000000 --- a/processor/ethereum/contracts/src/abigen/router.rs +++ /dev/null @@ -1,2958 +0,0 @@ -/** - -Generated by the following Solidity interface... -```solidity -interface Router { - type DestinationType is uint8; - struct OutInstruction { - DestinationType destinationType; - bytes destination; - address coin; - uint256 value; - } - struct Signature { - bytes32 c; - bytes32 s; - } - - error FailedTransfer(); - error InvalidAmount(); - error InvalidSignature(); - - event Executed(uint256 indexed nonce, bytes32 indexed batch); - event InInstruction(address indexed from, address indexed coin, uint256 amount, bytes instruction); - event SeraiKeyUpdated(uint256 indexed nonce, bytes32 indexed key); - - constructor(bytes32 initialSeraiKey); - - function arbitaryCallOut(bytes memory code) external; - function execute(OutInstruction[] memory transactions, Signature memory signature) external; - function inInstruction(address coin, uint256 amount, bytes memory instruction) external payable; - function nonce() external view returns (uint256); - function seraiKey() external view returns (bytes32); - function smartContractNonce() external view returns (uint256); - function updateSeraiKey(bytes32 newSeraiKey, Signature memory signature) external; -} -``` - -...which was generated by the following JSON ABI: -```json -[ - { - "type": "constructor", - "inputs": [ - { - "name": "initialSeraiKey", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "arbitaryCallOut", - "inputs": [ - { - "name": "code", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "execute", - "inputs": [ - { - "name": "transactions", - "type": "tuple[]", - "internalType": "struct Router.OutInstruction[]", - "components": [ - { - "name": "destinationType", - "type": "uint8", - "internalType": "enum Router.DestinationType" - }, - { - "name": "destination", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "coin", - "type": "address", - "internalType": "address" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "name": "signature", - "type": "tuple", - "internalType": "struct Router.Signature", - "components": [ - { - "name": "c", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "s", - "type": "bytes32", - "internalType": "bytes32" - } - ] - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "inInstruction", - "inputs": [ - { - "name": "coin", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "instruction", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "nonce", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "seraiKey", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "smartContractNonce", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "updateSeraiKey", - "inputs": [ - { - "name": "newSeraiKey", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "signature", - "type": "tuple", - "internalType": "struct Router.Signature", - "components": [ - { - "name": "c", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "s", - "type": "bytes32", - "internalType": "bytes32" - } - ] - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "Executed", - "inputs": [ - { - "name": "nonce", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "batch", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "InInstruction", - "inputs": [ - { - "name": "from", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "coin", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "instruction", - "type": "bytes", - "indexed": false, - "internalType": "bytes" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "SeraiKeyUpdated", - "inputs": [ - { - "name": "nonce", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "key", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "FailedTransfer", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidAmount", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidSignature", - "inputs": [] - } -] -```*/ -#[allow(non_camel_case_types, non_snake_case, clippy::style)] -pub mod Router { - use super::*; - use ::alloy_sol_types as alloy_sol_types; - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct DestinationType(u8); - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::private::SolTypeValue for u8 { - #[inline] - fn stv_to_tokens( - &self, - ) -> <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::Token<'_> { - alloy_sol_types::private::SolTypeValue::< - ::alloy_sol_types::sol_data::Uint<8>, - >::stv_to_tokens(self) - } - #[inline] - fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::tokenize(self) - .0 - } - #[inline] - fn stv_abi_encode_packed_to( - &self, - out: &mut alloy_sol_types::private::Vec, - ) { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::abi_encode_packed_to(self, out) - } - #[inline] - fn stv_abi_packed_encoded_size(&self) -> usize { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::abi_encoded_size(self) - } - } - #[automatically_derived] - impl DestinationType { - /// The Solidity type name. - pub const NAME: &'static str = stringify!(@ name); - /// Convert from the underlying value type. - #[inline] - pub const fn from(value: u8) -> Self { - Self(value) - } - /// Return the underlying value. - #[inline] - pub const fn into(self) -> u8 { - self.0 - } - /// Return the single encoding of this value, delegating to the - /// underlying type. - #[inline] - pub fn abi_encode(&self) -> alloy_sol_types::private::Vec { - ::abi_encode(&self.0) - } - /// Return the packed encoding of this value, delegating to the - /// underlying type. - #[inline] - pub fn abi_encode_packed(&self) -> alloy_sol_types::private::Vec { - ::abi_encode_packed(&self.0) - } - } - #[automatically_derived] - impl alloy_sol_types::SolType for DestinationType { - type RustType = u8; - type Token<'a> = <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::Token<'a>; - const SOL_NAME: &'static str = Self::NAME; - const ENCODED_SIZE: Option = <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::ENCODED_SIZE; - const PACKED_ENCODED_SIZE: Option = <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; - #[inline] - fn valid_token(token: &Self::Token<'_>) -> bool { - Self::type_check(token).is_ok() - } - #[inline] - fn type_check(token: &Self::Token<'_>) -> alloy_sol_types::Result<()> { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::type_check(token) - } - #[inline] - fn detokenize(token: Self::Token<'_>) -> Self::RustType { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::SolType>::detokenize(token) - } - } - #[automatically_derived] - impl alloy_sol_types::EventTopic for DestinationType { - #[inline] - fn topic_preimage_length(rust: &Self::RustType) -> usize { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::EventTopic>::topic_preimage_length(rust) - } - #[inline] - fn encode_topic_preimage( - rust: &Self::RustType, - out: &mut alloy_sol_types::private::Vec, - ) { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::EventTopic>::encode_topic_preimage(rust, out) - } - #[inline] - fn encode_topic( - rust: &Self::RustType, - ) -> alloy_sol_types::abi::token::WordToken { - <::alloy_sol_types::sol_data::Uint< - 8, - > as alloy_sol_types::EventTopic>::encode_topic(rust) - } - } - }; - /**```solidity -struct OutInstruction { DestinationType destinationType; bytes destination; address coin; uint256 value; } -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct OutInstruction { - pub destinationType: ::RustType, - pub destination: ::alloy_sol_types::private::Bytes, - pub coin: ::alloy_sol_types::private::Address, - pub value: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - DestinationType, - ::alloy_sol_types::sol_data::Bytes, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::RustType, - ::alloy_sol_types::private::Bytes, - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: OutInstruction) -> Self { - (value.destinationType, value.destination, value.coin, value.value) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for OutInstruction { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - destinationType: tuple.0, - destination: tuple.1, - coin: tuple.2, - value: tuple.3, - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolValue for OutInstruction { - type SolType = Self; - } - #[automatically_derived] - impl alloy_sol_types::private::SolTypeValue for OutInstruction { - #[inline] - fn stv_to_tokens(&self) -> ::Token<'_> { - ( - ::tokenize( - &self.destinationType, - ), - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::tokenize( - &self.destination, - ), - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.coin, - ), - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.value), - ) - } - #[inline] - fn stv_abi_encoded_size(&self) -> usize { - if let Some(size) = ::ENCODED_SIZE { - return size; - } - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_encoded_size(&tuple) - } - #[inline] - fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { - ::eip712_hash_struct(self) - } - #[inline] - fn stv_abi_encode_packed_to( - &self, - out: &mut alloy_sol_types::private::Vec, - ) { - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_encode_packed_to(&tuple, out) - } - #[inline] - fn stv_abi_packed_encoded_size(&self) -> usize { - if let Some(size) = ::PACKED_ENCODED_SIZE { - return size; - } - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_packed_encoded_size(&tuple) - } - } - #[automatically_derived] - impl alloy_sol_types::SolType for OutInstruction { - type RustType = Self; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SOL_NAME: &'static str = ::NAME; - const ENCODED_SIZE: Option = as alloy_sol_types::SolType>::ENCODED_SIZE; - const PACKED_ENCODED_SIZE: Option = as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; - #[inline] - fn valid_token(token: &Self::Token<'_>) -> bool { - as alloy_sol_types::SolType>::valid_token(token) - } - #[inline] - fn detokenize(token: Self::Token<'_>) -> Self::RustType { - let tuple = as alloy_sol_types::SolType>::detokenize(token); - >>::from(tuple) - } - } - #[automatically_derived] - impl alloy_sol_types::SolStruct for OutInstruction { - const NAME: &'static str = "OutInstruction"; - #[inline] - fn eip712_root_type() -> alloy_sol_types::private::Cow<'static, str> { - alloy_sol_types::private::Cow::Borrowed( - "OutInstruction(uint8 destinationType,bytes destination,address coin,uint256 value)", - ) - } - #[inline] - fn eip712_components() -> alloy_sol_types::private::Vec< - alloy_sol_types::private::Cow<'static, str>, - > { - alloy_sol_types::private::Vec::new() - } - #[inline] - fn eip712_encode_type() -> alloy_sol_types::private::Cow<'static, str> { - ::eip712_root_type() - } - #[inline] - fn eip712_encode_data(&self) -> alloy_sol_types::private::Vec { - [ - ::eip712_data_word( - &self.destinationType, - ) - .0, - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::eip712_data_word( - &self.destination, - ) - .0, - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::eip712_data_word( - &self.coin, - ) - .0, - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::eip712_data_word(&self.value) - .0, - ] - .concat() - } - } - #[automatically_derived] - impl alloy_sol_types::EventTopic for OutInstruction { - #[inline] - fn topic_preimage_length(rust: &Self::RustType) -> usize { - 0usize - + ::topic_preimage_length( - &rust.destinationType, - ) - + <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::EventTopic>::topic_preimage_length( - &rust.destination, - ) - + <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::topic_preimage_length( - &rust.coin, - ) - + <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::EventTopic>::topic_preimage_length(&rust.value) - } - #[inline] - fn encode_topic_preimage( - rust: &Self::RustType, - out: &mut alloy_sol_types::private::Vec, - ) { - out.reserve( - ::topic_preimage_length(rust), - ); - ::encode_topic_preimage( - &rust.destinationType, - out, - ); - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::EventTopic>::encode_topic_preimage( - &rust.destination, - out, - ); - <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic_preimage( - &rust.coin, - out, - ); - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::EventTopic>::encode_topic_preimage( - &rust.value, - out, - ); - } - #[inline] - fn encode_topic( - rust: &Self::RustType, - ) -> alloy_sol_types::abi::token::WordToken { - let mut out = alloy_sol_types::private::Vec::new(); - ::encode_topic_preimage( - rust, - &mut out, - ); - alloy_sol_types::abi::token::WordToken( - alloy_sol_types::private::keccak256(out), - ) - } - } - }; - /**```solidity -struct Signature { bytes32 c; bytes32 s; } -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct Signature { - pub c: ::alloy_sol_types::private::FixedBytes<32>, - pub s: ::alloy_sol_types::private::FixedBytes<32>, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::FixedBytes<32>, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::FixedBytes<32>, - ::alloy_sol_types::private::FixedBytes<32>, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: Signature) -> Self { - (value.c, value.s) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for Signature { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { c: tuple.0, s: tuple.1 } - } - } - #[automatically_derived] - impl alloy_sol_types::SolValue for Signature { - type SolType = Self; - } - #[automatically_derived] - impl alloy_sol_types::private::SolTypeValue for Signature { - #[inline] - fn stv_to_tokens(&self) -> ::Token<'_> { - ( - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::tokenize(&self.c), - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::tokenize(&self.s), - ) - } - #[inline] - fn stv_abi_encoded_size(&self) -> usize { - if let Some(size) = ::ENCODED_SIZE { - return size; - } - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_encoded_size(&tuple) - } - #[inline] - fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { - ::eip712_hash_struct(self) - } - #[inline] - fn stv_abi_encode_packed_to( - &self, - out: &mut alloy_sol_types::private::Vec, - ) { - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_encode_packed_to(&tuple, out) - } - #[inline] - fn stv_abi_packed_encoded_size(&self) -> usize { - if let Some(size) = ::PACKED_ENCODED_SIZE { - return size; - } - let tuple = as ::core::convert::From>::from(self.clone()); - as alloy_sol_types::SolType>::abi_packed_encoded_size(&tuple) - } - } - #[automatically_derived] - impl alloy_sol_types::SolType for Signature { - type RustType = Self; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SOL_NAME: &'static str = ::NAME; - const ENCODED_SIZE: Option = as alloy_sol_types::SolType>::ENCODED_SIZE; - const PACKED_ENCODED_SIZE: Option = as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; - #[inline] - fn valid_token(token: &Self::Token<'_>) -> bool { - as alloy_sol_types::SolType>::valid_token(token) - } - #[inline] - fn detokenize(token: Self::Token<'_>) -> Self::RustType { - let tuple = as alloy_sol_types::SolType>::detokenize(token); - >>::from(tuple) - } - } - #[automatically_derived] - impl alloy_sol_types::SolStruct for Signature { - const NAME: &'static str = "Signature"; - #[inline] - fn eip712_root_type() -> alloy_sol_types::private::Cow<'static, str> { - alloy_sol_types::private::Cow::Borrowed("Signature(bytes32 c,bytes32 s)") - } - #[inline] - fn eip712_components() -> alloy_sol_types::private::Vec< - alloy_sol_types::private::Cow<'static, str>, - > { - alloy_sol_types::private::Vec::new() - } - #[inline] - fn eip712_encode_type() -> alloy_sol_types::private::Cow<'static, str> { - ::eip712_root_type() - } - #[inline] - fn eip712_encode_data(&self) -> alloy_sol_types::private::Vec { - [ - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::eip712_data_word(&self.c) - .0, - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::eip712_data_word(&self.s) - .0, - ] - .concat() - } - } - #[automatically_derived] - impl alloy_sol_types::EventTopic for Signature { - #[inline] - fn topic_preimage_length(rust: &Self::RustType) -> usize { - 0usize - + <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::topic_preimage_length(&rust.c) - + <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::topic_preimage_length(&rust.s) - } - #[inline] - fn encode_topic_preimage( - rust: &Self::RustType, - out: &mut alloy_sol_types::private::Vec, - ) { - out.reserve( - ::topic_preimage_length(rust), - ); - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::encode_topic_preimage(&rust.c, out); - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::encode_topic_preimage(&rust.s, out); - } - #[inline] - fn encode_topic( - rust: &Self::RustType, - ) -> alloy_sol_types::abi::token::WordToken { - let mut out = alloy_sol_types::private::Vec::new(); - ::encode_topic_preimage( - rust, - &mut out, - ); - alloy_sol_types::abi::token::WordToken( - alloy_sol_types::private::keccak256(out), - ) - } - } - }; - /**Custom error with signature `FailedTransfer()` and selector `0xbfa871c5`. -```solidity -error FailedTransfer(); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct FailedTransfer {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: FailedTransfer) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for FailedTransfer { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - #[automatically_derived] - impl alloy_sol_types::SolError for FailedTransfer { - type Parameters<'a> = UnderlyingSolTuple<'a>; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "FailedTransfer()"; - const SELECTOR: [u8; 4] = [191u8, 168u8, 113u8, 197u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - } - }; - /**Custom error with signature `InvalidAmount()` and selector `0x2c5211c6`. -```solidity -error InvalidAmount(); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct InvalidAmount {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: InvalidAmount) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for InvalidAmount { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - #[automatically_derived] - impl alloy_sol_types::SolError for InvalidAmount { - type Parameters<'a> = UnderlyingSolTuple<'a>; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "InvalidAmount()"; - const SELECTOR: [u8; 4] = [44u8, 82u8, 17u8, 198u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - } - }; - /**Custom error with signature `InvalidSignature()` and selector `0x8baa579f`. -```solidity -error InvalidSignature(); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct InvalidSignature {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: InvalidSignature) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for InvalidSignature { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - #[automatically_derived] - impl alloy_sol_types::SolError for InvalidSignature { - type Parameters<'a> = UnderlyingSolTuple<'a>; - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "InvalidSignature()"; - const SELECTOR: [u8; 4] = [139u8, 170u8, 87u8, 159u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - } - }; - /**Event with signature `Executed(uint256,bytes32)` and selector `0xc218c77e54cac1162571e52b65bb27aa0cdfcc70b7c7296ad83933914b132091`. -```solidity -event Executed(uint256 indexed nonce, bytes32 indexed batch); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct Executed { - #[allow(missing_docs)] - pub nonce: ::alloy_sol_types::private::primitives::aliases::U256, - #[allow(missing_docs)] - pub batch: ::alloy_sol_types::private::FixedBytes<32>, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for Executed { - type DataTuple<'a> = (); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::Uint<256>, - ::alloy_sol_types::sol_data::FixedBytes<32>, - ); - const SIGNATURE: &'static str = "Executed(uint256,bytes32)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 194u8, - 24u8, - 199u8, - 126u8, - 84u8, - 202u8, - 193u8, - 22u8, - 37u8, - 113u8, - 229u8, - 43u8, - 101u8, - 187u8, - 39u8, - 170u8, - 12u8, - 223u8, - 204u8, - 112u8, - 183u8, - 199u8, - 41u8, - 106u8, - 216u8, - 57u8, - 51u8, - 145u8, - 75u8, - 19u8, - 32u8, - 145u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - nonce: topics.1, - batch: topics.2, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - () - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.nonce.clone(), self.batch.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::EventTopic>::encode_topic(&self.nonce); - out[2usize] = <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::encode_topic(&self.batch); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for Executed { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&Executed> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &Executed) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Event with signature `InInstruction(address,address,uint256,bytes)` and selector `0x346fd5cd6d19d26d3afd222f43033ecd0d5614ca64bec0aed101482cd87e922f`. -```solidity -event InInstruction(address indexed from, address indexed coin, uint256 amount, bytes instruction); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct InInstruction { - #[allow(missing_docs)] - pub from: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub coin: ::alloy_sol_types::private::Address, - #[allow(missing_docs)] - pub amount: ::alloy_sol_types::private::primitives::aliases::U256, - #[allow(missing_docs)] - pub instruction: ::alloy_sol_types::private::Bytes, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for InInstruction { - type DataTuple<'a> = ( - ::alloy_sol_types::sol_data::Uint<256>, - ::alloy_sol_types::sol_data::Bytes, - ); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Address, - ); - const SIGNATURE: &'static str = "InInstruction(address,address,uint256,bytes)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 52u8, - 111u8, - 213u8, - 205u8, - 109u8, - 25u8, - 210u8, - 109u8, - 58u8, - 253u8, - 34u8, - 47u8, - 67u8, - 3u8, - 62u8, - 205u8, - 13u8, - 86u8, - 20u8, - 202u8, - 100u8, - 190u8, - 192u8, - 174u8, - 209u8, - 1u8, - 72u8, - 44u8, - 216u8, - 126u8, - 146u8, - 47u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - from: topics.1, - coin: topics.2, - amount: data.0, - instruction: data.1, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - ( - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.amount), - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::tokenize( - &self.instruction, - ), - ) - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.from.clone(), self.coin.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.from, - ); - out[2usize] = <::alloy_sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic( - &self.coin, - ); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for InInstruction { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&InInstruction> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &InInstruction) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Event with signature `SeraiKeyUpdated(uint256,bytes32)` and selector `0x1b9ff0164e811045a617ae783e807501a8e27762a7cb8f2fbd027851752570b5`. -```solidity -event SeraiKeyUpdated(uint256 indexed nonce, bytes32 indexed key); -```*/ - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - #[derive(Clone)] - pub struct SeraiKeyUpdated { - #[allow(missing_docs)] - pub nonce: ::alloy_sol_types::private::primitives::aliases::U256, - #[allow(missing_docs)] - pub key: ::alloy_sol_types::private::FixedBytes<32>, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - #[automatically_derived] - impl alloy_sol_types::SolEvent for SeraiKeyUpdated { - type DataTuple<'a> = (); - type DataToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - type TopicList = ( - alloy_sol_types::sol_data::FixedBytes<32>, - ::alloy_sol_types::sol_data::Uint<256>, - ::alloy_sol_types::sol_data::FixedBytes<32>, - ); - const SIGNATURE: &'static str = "SeraiKeyUpdated(uint256,bytes32)"; - const SIGNATURE_HASH: alloy_sol_types::private::B256 = alloy_sol_types::private::B256::new([ - 27u8, - 159u8, - 240u8, - 22u8, - 78u8, - 129u8, - 16u8, - 69u8, - 166u8, - 23u8, - 174u8, - 120u8, - 62u8, - 128u8, - 117u8, - 1u8, - 168u8, - 226u8, - 119u8, - 98u8, - 167u8, - 203u8, - 143u8, - 47u8, - 189u8, - 2u8, - 120u8, - 81u8, - 117u8, - 37u8, - 112u8, - 181u8, - ]); - const ANONYMOUS: bool = false; - #[allow(unused_variables)] - #[inline] - fn new( - topics: ::RustType, - data: as alloy_sol_types::SolType>::RustType, - ) -> Self { - Self { - nonce: topics.1, - key: topics.2, - } - } - #[inline] - fn tokenize_body(&self) -> Self::DataToken<'_> { - () - } - #[inline] - fn topics(&self) -> ::RustType { - (Self::SIGNATURE_HASH.into(), self.nonce.clone(), self.key.clone()) - } - #[inline] - fn encode_topics_raw( - &self, - out: &mut [alloy_sol_types::abi::token::WordToken], - ) -> alloy_sol_types::Result<()> { - if out.len() < ::COUNT { - return Err(alloy_sol_types::Error::Overrun); - } - out[0usize] = alloy_sol_types::abi::token::WordToken( - Self::SIGNATURE_HASH, - ); - out[1usize] = <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::EventTopic>::encode_topic(&self.nonce); - out[2usize] = <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::EventTopic>::encode_topic(&self.key); - Ok(()) - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for SeraiKeyUpdated { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - From::from(self) - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - From::from(&self) - } - } - #[automatically_derived] - impl From<&SeraiKeyUpdated> for alloy_sol_types::private::LogData { - #[inline] - fn from(this: &SeraiKeyUpdated) -> alloy_sol_types::private::LogData { - alloy_sol_types::SolEvent::encode_log_data(this) - } - } - }; - /**Constructor`. -```solidity -constructor(bytes32 initialSeraiKey); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct constructorCall { - pub initialSeraiKey: ::alloy_sol_types::private::FixedBytes<32>, - } - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::FixedBytes<32>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::FixedBytes<32>,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: constructorCall) -> Self { - (value.initialSeraiKey,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for constructorCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { initialSeraiKey: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolConstructor for constructorCall { - type Parameters<'a> = (::alloy_sol_types::sol_data::FixedBytes<32>,); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::tokenize(&self.initialSeraiKey), - ) - } - } - }; - /**Function with signature `arbitaryCallOut(bytes)` and selector `0x3cbd2bf6`. -```solidity -function arbitaryCallOut(bytes memory code) external; -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct arbitaryCallOutCall { - pub code: ::alloy_sol_types::private::Bytes, - } - ///Container type for the return parameters of the [`arbitaryCallOut(bytes)`](arbitaryCallOutCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct arbitaryCallOutReturn {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Bytes,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::Bytes,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: arbitaryCallOutCall) -> Self { - (value.code,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for arbitaryCallOutCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { code: tuple.0 } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From - for UnderlyingRustTuple<'_> { - fn from(value: arbitaryCallOutReturn) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> - for arbitaryCallOutReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for arbitaryCallOutCall { - type Parameters<'a> = (::alloy_sol_types::sol_data::Bytes,); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = arbitaryCallOutReturn; - type ReturnTuple<'a> = (); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "arbitaryCallOut(bytes)"; - const SELECTOR: [u8; 4] = [60u8, 189u8, 43u8, 246u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::tokenize( - &self.code, - ), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `execute((uint8,bytes,address,uint256)[],(bytes32,bytes32))` and selector `0xd5f22182`. -```solidity -function execute(OutInstruction[] memory transactions, Signature memory signature) external; -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct executeCall { - pub transactions: ::alloy_sol_types::private::Vec< - ::RustType, - >, - pub signature: ::RustType, - } - ///Container type for the return parameters of the [`execute((uint8,bytes,address,uint256)[],(bytes32,bytes32))`](executeCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct executeReturn {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Array, - Signature, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Vec< - ::RustType, - >, - ::RustType, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: executeCall) -> Self { - (value.transactions, value.signature) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for executeCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - transactions: tuple.0, - signature: tuple.1, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: executeReturn) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for executeReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for executeCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Array, - Signature, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = executeReturn; - type ReturnTuple<'a> = (); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "execute((uint8,bytes,address,uint256)[],(bytes32,bytes32))"; - const SELECTOR: [u8; 4] = [213u8, 242u8, 33u8, 130u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Array< - OutInstruction, - > as alloy_sol_types::SolType>::tokenize(&self.transactions), - ::tokenize(&self.signature), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `inInstruction(address,uint256,bytes)` and selector `0x0759a1a4`. -```solidity -function inInstruction(address coin, uint256 amount, bytes memory instruction) external payable; -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct inInstructionCall { - pub coin: ::alloy_sol_types::private::Address, - pub amount: ::alloy_sol_types::private::primitives::aliases::U256, - pub instruction: ::alloy_sol_types::private::Bytes, - } - ///Container type for the return parameters of the [`inInstruction(address,uint256,bytes)`](inInstructionCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct inInstructionReturn {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ::alloy_sol_types::sol_data::Bytes, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::Address, - ::alloy_sol_types::private::primitives::aliases::U256, - ::alloy_sol_types::private::Bytes, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: inInstructionCall) -> Self { - (value.coin, value.amount, value.instruction) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for inInstructionCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - coin: tuple.0, - amount: tuple.1, - instruction: tuple.2, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: inInstructionReturn) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for inInstructionReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for inInstructionCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::Address, - ::alloy_sol_types::sol_data::Uint<256>, - ::alloy_sol_types::sol_data::Bytes, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = inInstructionReturn; - type ReturnTuple<'a> = (); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "inInstruction(address,uint256,bytes)"; - const SELECTOR: [u8; 4] = [7u8, 89u8, 161u8, 164u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize( - &self.coin, - ), - <::alloy_sol_types::sol_data::Uint< - 256, - > as alloy_sol_types::SolType>::tokenize(&self.amount), - <::alloy_sol_types::sol_data::Bytes as alloy_sol_types::SolType>::tokenize( - &self.instruction, - ), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `nonce()` and selector `0xaffed0e0`. -```solidity -function nonce() external view returns (uint256); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct nonceCall {} - ///Container type for the return parameters of the [`nonce()`](nonceCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct nonceReturn { - pub _0: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: nonceCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for nonceCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: nonceReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for nonceReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for nonceCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = nonceReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "nonce()"; - const SELECTOR: [u8; 4] = [175u8, 254u8, 208u8, 224u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `seraiKey()` and selector `0x9d6eea0a`. -```solidity -function seraiKey() external view returns (bytes32); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct seraiKeyCall {} - ///Container type for the return parameters of the [`seraiKey()`](seraiKeyCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct seraiKeyReturn { - pub _0: ::alloy_sol_types::private::FixedBytes<32>, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: seraiKeyCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for seraiKeyCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::FixedBytes<32>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (::alloy_sol_types::private::FixedBytes<32>,); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: seraiKeyReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for seraiKeyReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for seraiKeyCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = seraiKeyReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::FixedBytes<32>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "seraiKey()"; - const SELECTOR: [u8; 4] = [157u8, 110u8, 234u8, 10u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `smartContractNonce()` and selector `0xc3727534`. -```solidity -function smartContractNonce() external view returns (uint256); -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct smartContractNonceCall {} - ///Container type for the return parameters of the [`smartContractNonce()`](smartContractNonceCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct smartContractNonceReturn { - pub _0: ::alloy_sol_types::private::primitives::aliases::U256, - } - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From - for UnderlyingRustTuple<'_> { - fn from(value: smartContractNonceCall) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> - for smartContractNonceCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::primitives::aliases::U256, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From - for UnderlyingRustTuple<'_> { - fn from(value: smartContractNonceReturn) -> Self { - (value._0,) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> - for smartContractNonceReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { _0: tuple.0 } - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for smartContractNonceCall { - type Parameters<'a> = (); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = smartContractNonceReturn; - type ReturnTuple<'a> = (::alloy_sol_types::sol_data::Uint<256>,); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "smartContractNonce()"; - const SELECTOR: [u8; 4] = [195u8, 114u8, 117u8, 52u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - () - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - /**Function with signature `updateSeraiKey(bytes32,(bytes32,bytes32))` and selector `0xb5071c6a`. -```solidity -function updateSeraiKey(bytes32 newSeraiKey, Signature memory signature) external; -```*/ - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct updateSeraiKeyCall { - pub newSeraiKey: ::alloy_sol_types::private::FixedBytes<32>, - pub signature: ::RustType, - } - ///Container type for the return parameters of the [`updateSeraiKey(bytes32,(bytes32,bytes32))`](updateSeraiKeyCall) function. - #[allow(non_camel_case_types, non_snake_case)] - #[derive(Clone)] - pub struct updateSeraiKeyReturn {} - #[allow(non_camel_case_types, non_snake_case, clippy::style)] - const _: () = { - use ::alloy_sol_types as alloy_sol_types; - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = ( - ::alloy_sol_types::sol_data::FixedBytes<32>, - Signature, - ); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = ( - ::alloy_sol_types::private::FixedBytes<32>, - ::RustType, - ); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From for UnderlyingRustTuple<'_> { - fn from(value: updateSeraiKeyCall) -> Self { - (value.newSeraiKey, value.signature) - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> for updateSeraiKeyCall { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self { - newSeraiKey: tuple.0, - signature: tuple.1, - } - } - } - } - { - #[doc(hidden)] - type UnderlyingSolTuple<'a> = (); - #[doc(hidden)] - type UnderlyingRustTuple<'a> = (); - #[cfg(test)] - #[allow(dead_code, unreachable_patterns)] - fn _type_assertion( - _t: alloy_sol_types::private::AssertTypeEq, - ) { - match _t { - alloy_sol_types::private::AssertTypeEq::< - ::RustType, - >(_) => {} - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From - for UnderlyingRustTuple<'_> { - fn from(value: updateSeraiKeyReturn) -> Self { - () - } - } - #[automatically_derived] - #[doc(hidden)] - impl ::core::convert::From> - for updateSeraiKeyReturn { - fn from(tuple: UnderlyingRustTuple<'_>) -> Self { - Self {} - } - } - } - #[automatically_derived] - impl alloy_sol_types::SolCall for updateSeraiKeyCall { - type Parameters<'a> = ( - ::alloy_sol_types::sol_data::FixedBytes<32>, - Signature, - ); - type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; - type Return = updateSeraiKeyReturn; - type ReturnTuple<'a> = (); - type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; - const SIGNATURE: &'static str = "updateSeraiKey(bytes32,(bytes32,bytes32))"; - const SELECTOR: [u8; 4] = [181u8, 7u8, 28u8, 106u8]; - #[inline] - fn new<'a>( - tuple: as alloy_sol_types::SolType>::RustType, - ) -> Self { - tuple.into() - } - #[inline] - fn tokenize(&self) -> Self::Token<'_> { - ( - <::alloy_sol_types::sol_data::FixedBytes< - 32, - > as alloy_sol_types::SolType>::tokenize(&self.newSeraiKey), - ::tokenize(&self.signature), - ) - } - #[inline] - fn abi_decode_returns( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - as alloy_sol_types::SolType>::abi_decode_sequence(data, validate) - .map(Into::into) - } - } - }; - ///Container for all the [`Router`](self) function calls. - pub enum RouterCalls { - arbitaryCallOut(arbitaryCallOutCall), - execute(executeCall), - inInstruction(inInstructionCall), - nonce(nonceCall), - seraiKey(seraiKeyCall), - smartContractNonce(smartContractNonceCall), - updateSeraiKey(updateSeraiKeyCall), - } - #[automatically_derived] - impl RouterCalls { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 4usize]] = &[ - [7u8, 89u8, 161u8, 164u8], - [60u8, 189u8, 43u8, 246u8], - [157u8, 110u8, 234u8, 10u8], - [175u8, 254u8, 208u8, 224u8], - [181u8, 7u8, 28u8, 106u8], - [195u8, 114u8, 117u8, 52u8], - [213u8, 242u8, 33u8, 130u8], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolInterface for RouterCalls { - const NAME: &'static str = "RouterCalls"; - const MIN_DATA_LENGTH: usize = 0usize; - const COUNT: usize = 7usize; - #[inline] - fn selector(&self) -> [u8; 4] { - match self { - Self::arbitaryCallOut(_) => { - ::SELECTOR - } - Self::execute(_) => ::SELECTOR, - Self::inInstruction(_) => { - ::SELECTOR - } - Self::nonce(_) => ::SELECTOR, - Self::seraiKey(_) => ::SELECTOR, - Self::smartContractNonce(_) => { - ::SELECTOR - } - Self::updateSeraiKey(_) => { - ::SELECTOR - } - } - } - #[inline] - fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { - Self::SELECTORS.get(i).copied() - } - #[inline] - fn valid_selector(selector: [u8; 4]) -> bool { - Self::SELECTORS.binary_search(&selector).is_ok() - } - #[inline] - #[allow(unsafe_code, non_snake_case)] - fn abi_decode_raw( - selector: [u8; 4], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - static DECODE_SHIMS: &[fn( - &[u8], - bool, - ) -> alloy_sol_types::Result] = &[ - { - fn inInstruction( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::inInstruction) - } - inInstruction - }, - { - fn arbitaryCallOut( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::arbitaryCallOut) - } - arbitaryCallOut - }, - { - fn seraiKey( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::seraiKey) - } - seraiKey - }, - { - fn nonce( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::nonce) - } - nonce - }, - { - fn updateSeraiKey( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::updateSeraiKey) - } - updateSeraiKey - }, - { - fn smartContractNonce( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::smartContractNonce) - } - smartContractNonce - }, - { - fn execute( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterCalls::execute) - } - execute - }, - ]; - let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { - return Err( - alloy_sol_types::Error::unknown_selector( - ::NAME, - selector, - ), - ); - }; - (unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate) - } - #[inline] - fn abi_encoded_size(&self) -> usize { - match self { - Self::arbitaryCallOut(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::execute(inner) => { - ::abi_encoded_size(inner) - } - Self::inInstruction(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::nonce(inner) => { - ::abi_encoded_size(inner) - } - Self::seraiKey(inner) => { - ::abi_encoded_size(inner) - } - Self::smartContractNonce(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::updateSeraiKey(inner) => { - ::abi_encoded_size( - inner, - ) - } - } - } - #[inline] - fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { - match self { - Self::arbitaryCallOut(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::execute(inner) => { - ::abi_encode_raw(inner, out) - } - Self::inInstruction(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::nonce(inner) => { - ::abi_encode_raw(inner, out) - } - Self::seraiKey(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::smartContractNonce(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::updateSeraiKey(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - } - } - } - ///Container for all the [`Router`](self) custom errors. - pub enum RouterErrors { - FailedTransfer(FailedTransfer), - InvalidAmount(InvalidAmount), - InvalidSignature(InvalidSignature), - } - #[automatically_derived] - impl RouterErrors { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 4usize]] = &[ - [44u8, 82u8, 17u8, 198u8], - [139u8, 170u8, 87u8, 159u8], - [191u8, 168u8, 113u8, 197u8], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolInterface for RouterErrors { - const NAME: &'static str = "RouterErrors"; - const MIN_DATA_LENGTH: usize = 0usize; - const COUNT: usize = 3usize; - #[inline] - fn selector(&self) -> [u8; 4] { - match self { - Self::FailedTransfer(_) => { - ::SELECTOR - } - Self::InvalidAmount(_) => { - ::SELECTOR - } - Self::InvalidSignature(_) => { - ::SELECTOR - } - } - } - #[inline] - fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { - Self::SELECTORS.get(i).copied() - } - #[inline] - fn valid_selector(selector: [u8; 4]) -> bool { - Self::SELECTORS.binary_search(&selector).is_ok() - } - #[inline] - #[allow(unsafe_code, non_snake_case)] - fn abi_decode_raw( - selector: [u8; 4], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - static DECODE_SHIMS: &[fn( - &[u8], - bool, - ) -> alloy_sol_types::Result] = &[ - { - fn InvalidAmount( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterErrors::InvalidAmount) - } - InvalidAmount - }, - { - fn InvalidSignature( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterErrors::InvalidSignature) - } - InvalidSignature - }, - { - fn FailedTransfer( - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - ::abi_decode_raw( - data, - validate, - ) - .map(RouterErrors::FailedTransfer) - } - FailedTransfer - }, - ]; - let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { - return Err( - alloy_sol_types::Error::unknown_selector( - ::NAME, - selector, - ), - ); - }; - (unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate) - } - #[inline] - fn abi_encoded_size(&self) -> usize { - match self { - Self::FailedTransfer(inner) => { - ::abi_encoded_size( - inner, - ) - } - Self::InvalidAmount(inner) => { - ::abi_encoded_size(inner) - } - Self::InvalidSignature(inner) => { - ::abi_encoded_size( - inner, - ) - } - } - } - #[inline] - fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { - match self { - Self::FailedTransfer(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::InvalidAmount(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - Self::InvalidSignature(inner) => { - ::abi_encode_raw( - inner, - out, - ) - } - } - } - } - ///Container for all the [`Router`](self) events. - pub enum RouterEvents { - Executed(Executed), - InInstruction(InInstruction), - SeraiKeyUpdated(SeraiKeyUpdated), - } - #[automatically_derived] - impl RouterEvents { - /// All the selectors of this enum. - /// - /// Note that the selectors might not be in the same order as the variants. - /// No guarantees are made about the order of the selectors. - /// - /// Prefer using `SolInterface` methods instead. - pub const SELECTORS: &'static [[u8; 32usize]] = &[ - [ - 27u8, - 159u8, - 240u8, - 22u8, - 78u8, - 129u8, - 16u8, - 69u8, - 166u8, - 23u8, - 174u8, - 120u8, - 62u8, - 128u8, - 117u8, - 1u8, - 168u8, - 226u8, - 119u8, - 98u8, - 167u8, - 203u8, - 143u8, - 47u8, - 189u8, - 2u8, - 120u8, - 81u8, - 117u8, - 37u8, - 112u8, - 181u8, - ], - [ - 52u8, - 111u8, - 213u8, - 205u8, - 109u8, - 25u8, - 210u8, - 109u8, - 58u8, - 253u8, - 34u8, - 47u8, - 67u8, - 3u8, - 62u8, - 205u8, - 13u8, - 86u8, - 20u8, - 202u8, - 100u8, - 190u8, - 192u8, - 174u8, - 209u8, - 1u8, - 72u8, - 44u8, - 216u8, - 126u8, - 146u8, - 47u8, - ], - [ - 194u8, - 24u8, - 199u8, - 126u8, - 84u8, - 202u8, - 193u8, - 22u8, - 37u8, - 113u8, - 229u8, - 43u8, - 101u8, - 187u8, - 39u8, - 170u8, - 12u8, - 223u8, - 204u8, - 112u8, - 183u8, - 199u8, - 41u8, - 106u8, - 216u8, - 57u8, - 51u8, - 145u8, - 75u8, - 19u8, - 32u8, - 145u8, - ], - ]; - } - #[automatically_derived] - impl alloy_sol_types::SolEventInterface for RouterEvents { - const NAME: &'static str = "RouterEvents"; - const COUNT: usize = 3usize; - fn decode_raw_log( - topics: &[alloy_sol_types::Word], - data: &[u8], - validate: bool, - ) -> alloy_sol_types::Result { - match topics.first().copied() { - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::Executed) - } - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::InInstruction) - } - Some(::SIGNATURE_HASH) => { - ::decode_raw_log( - topics, - data, - validate, - ) - .map(Self::SeraiKeyUpdated) - } - _ => { - alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog { - name: ::NAME, - log: alloy_sol_types::private::Box::new( - alloy_sol_types::private::LogData::new_unchecked( - topics.to_vec(), - data.to_vec().into(), - ), - ), - }) - } - } - } - } - #[automatically_derived] - impl alloy_sol_types::private::IntoLogData for RouterEvents { - fn to_log_data(&self) -> alloy_sol_types::private::LogData { - match self { - Self::Executed(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - Self::InInstruction(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - Self::SeraiKeyUpdated(inner) => { - alloy_sol_types::private::IntoLogData::to_log_data(inner) - } - } - } - fn into_log_data(self) -> alloy_sol_types::private::LogData { - match self { - Self::Executed(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - Self::InInstruction(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - Self::SeraiKeyUpdated(inner) => { - alloy_sol_types::private::IntoLogData::into_log_data(inner) - } - } - } - } -} diff --git a/processor/ethereum/contracts/src/lib.rs b/processor/ethereum/contracts/src/lib.rs deleted file mode 100644 index 9087eaed..00000000 --- a/processor/ethereum/contracts/src/lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[rustfmt::skip] -#[expect(warnings)] -#[expect(needless_pass_by_value)] -#[expect(clippy::all)] -#[expect(clippy::ignored_unit_patterns)] -#[expect(clippy::redundant_closure_for_method_calls)] -mod abigen; - -pub mod erc20 { - pub use super::abigen::erc20::IERC20::*; -} -pub mod router { - pub const BYTECODE: &[u8] = - include_bytes!(concat!(env!("OUT_DIR"), "/serai-processor-ethereum-contracts/Router.bin")); - pub use super::abigen::router::Router::*; -} diff --git a/processor/ethereum/ethereum-serai/Cargo.toml b/processor/ethereum/ethereum-serai/Cargo.toml deleted file mode 100644 index 73c5b267..00000000 --- a/processor/ethereum/ethereum-serai/Cargo.toml +++ /dev/null @@ -1,52 +0,0 @@ -[package] -name = "ethereum-serai" -version = "0.1.0" -description = "An Ethereum library supporting Schnorr signing and on-chain verification" -license = "AGPL-3.0-only" -repository = "https://github.com/serai-dex/serai/tree/develop/processor/ethereum/ethereum-serai" -authors = ["Luke Parker ", "Elizabeth Binks "] -edition = "2021" -publish = false -rust-version = "1.79" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[lints] -workspace = true - -[dependencies] -thiserror = { version = "1", default-features = false } - -rand_core = { version = "0.6", default-features = false, features = ["std"] } - -transcript = { package = "flexible-transcript", path = "../../../crypto/transcript", default-features = false, features = ["recommended"] } - -group = { version = "0.13", default-features = false } -k256 = { version = "^0.13.1", default-features = false, features = ["std", "ecdsa", "arithmetic"] } -frost = { package = "modular-frost", path = "../../../crypto/frost", default-features = false, features = ["secp256k1"] } - -alloy-core = { version = "0.8", default-features = false } -alloy-sol-types = { version = "0.8", default-features = false, features = ["json"] } -alloy-consensus = { version = "0.3", default-features = false, features = ["k256"] } -alloy-network = { version = "0.3", default-features = false } -alloy-rpc-types-eth = { version = "0.3", default-features = false } -alloy-rpc-client = { version = "0.3", default-features = false } -alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false } -alloy-provider = { version = "0.3", default-features = false } - -alloy-node-bindings = { version = "0.3", default-features = false, optional = true } - -ethereum-schnorr-contract = { path = "../../../networks/ethereum/schnorr", default-features = false } -contracts = { package = "serai-processor-ethereum-contracts", path = "../contracts" } - -[dev-dependencies] -frost = { package = "modular-frost", path = "../../../crypto/frost", default-features = false, features = ["tests"] } - -tokio = { version = "1", features = ["macros"] } - -alloy-node-bindings = { version = "0.3", default-features = false } - -[features] -tests = ["alloy-node-bindings", "frost/tests"] diff --git a/processor/ethereum/ethereum-serai/LICENSE b/processor/ethereum/ethereum-serai/LICENSE deleted file mode 100644 index c425427c..00000000 --- a/processor/ethereum/ethereum-serai/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -AGPL-3.0-only license - -Copyright (c) 2022-2023 Luke Parker - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License Version 3 as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . diff --git a/processor/ethereum/ethereum-serai/README.md b/processor/ethereum/ethereum-serai/README.md deleted file mode 100644 index 0090b26b..00000000 --- a/processor/ethereum/ethereum-serai/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Ethereum - -This package contains Ethereum-related functionality, specifically deploying and -interacting with Serai contracts. - -While `monero-serai` and `bitcoin-serai` are general purpose libraries, -`ethereum-serai` is Serai specific. If any of the utilities are generally -desired, please fork and maintain your own copy to ensure the desired -functionality is preserved, or open an issue to request we make this library -general purpose. - -### Dependencies - -- solc -- [Foundry](https://github.com/foundry-rs/foundry) diff --git a/processor/ethereum/ethereum-serai/src/crypto.rs b/processor/ethereum/ethereum-serai/src/crypto.rs deleted file mode 100644 index 3b9dc58a..00000000 --- a/processor/ethereum/ethereum-serai/src/crypto.rs +++ /dev/null @@ -1,32 +0,0 @@ -use group::ff::PrimeField; -use k256::{ - elliptic_curve::{ - ops::Reduce, - point::{AffineCoordinates, DecompressPoint}, - sec1::ToEncodedPoint, - }, - AffinePoint, ProjectivePoint, Scalar, U256 as KU256, -}; - -use frost::{ - algorithm::{Hram, SchnorrSignature}, - curve::{Ciphersuite, Secp256k1}, -}; - -pub use ethereum_schnorr_contract::*; - -use alloy_core::primitives::{Parity, Signature as AlloySignature, Address}; -use alloy_consensus::{SignableTransaction, Signed, TxLegacy}; - -/// The HRAm to use for the Schnorr Solidity library. -/// -/// This will panic if the public key being signed for is not representable within the Schnorr -/// Solidity library. -#[derive(Clone, Default)] -pub struct EthereumHram {} -impl Hram for EthereumHram { - #[allow(non_snake_case)] - fn hram(R: &ProjectivePoint, A: &ProjectivePoint, m: &[u8]) -> Scalar { - Signature::challenge(*R, &PublicKey::new(*A).unwrap(), m) - } -} diff --git a/processor/ethereum/ethereum-serai/src/lib.rs b/processor/ethereum/ethereum-serai/src/lib.rs deleted file mode 100644 index 1a013ddf..00000000 --- a/processor/ethereum/ethereum-serai/src/lib.rs +++ /dev/null @@ -1,41 +0,0 @@ -use thiserror::Error; - -pub mod alloy { - pub use alloy_core::primitives; - pub use alloy_core as core; - pub use alloy_sol_types as sol_types; - - pub use alloy_consensus as consensus; - pub use alloy_network as network; - pub use alloy_rpc_types_eth as rpc_types; - pub use alloy_simple_request_transport as simple_request_transport; - pub use alloy_rpc_client as rpc_client; - pub use alloy_provider as provider; -} - -pub mod crypto; - -/* -pub(crate) mod abi { - pub use contracts::erc20; - pub use contracts::deployer; - pub use contracts::router; -} - -pub mod erc20; -pub mod deployer; -pub mod router; - -pub mod machine; - -#[cfg(any(test, feature = "tests"))] -pub mod tests; - -#[derive(Clone, Copy, PartialEq, Eq, Debug, Error)] -pub enum Error { - #[error("failed to verify Schnorr signature")] - InvalidSignature, - #[error("couldn't make call/send TX")] - ConnectionError, -} -*/ diff --git a/processor/ethereum/ethereum-serai/src/machine.rs b/processor/ethereum/ethereum-serai/src/machine.rs deleted file mode 100644 index 404922f5..00000000 --- a/processor/ethereum/ethereum-serai/src/machine.rs +++ /dev/null @@ -1,427 +0,0 @@ -use std::{ - io::{self, Read}, - collections::HashMap, -}; - -use rand_core::{RngCore, CryptoRng}; - -use transcript::{Transcript, RecommendedTranscript}; - -use group::GroupEncoding; -use frost::{ - curve::{Ciphersuite, Secp256k1}, - Participant, ThresholdKeys, FrostError, - algorithm::Schnorr, - sign::*, -}; - -use alloy_core::primitives::U256; - -use crate::{ - crypto::{PublicKey, EthereumHram, Signature}, - router::{ - abi::{Call as AbiCall, OutInstruction as AbiOutInstruction}, - Router, - }, -}; - -/// The HRAm to use for the Schnorr Solidity library. -/// -/// This will panic if the public key being signed for is not representable within the Schnorr -/// Solidity library. -#[derive(Clone, Default)] -pub struct EthereumHram {} -impl Hram for EthereumHram { - #[allow(non_snake_case)] - fn hram(R: &ProjectivePoint, A: &ProjectivePoint, m: &[u8]) -> Scalar { - Signature::challenge(*R, &PublicKey::new(*A).unwrap(), m) - } -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub struct Call { - pub to: [u8; 20], - pub value: U256, - pub data: Vec, -} -impl Call { - pub fn read(reader: &mut R) -> io::Result { - let mut to = [0; 20]; - reader.read_exact(&mut to)?; - - let value = { - let mut value_bytes = [0; 32]; - reader.read_exact(&mut value_bytes)?; - U256::from_le_slice(&value_bytes) - }; - - let mut data_len = { - let mut data_len = [0; 4]; - reader.read_exact(&mut data_len)?; - usize::try_from(u32::from_le_bytes(data_len)).expect("u32 couldn't fit within a usize") - }; - - // A valid DoS would be to claim a 4 GB data is present for only 4 bytes - // We read this in 1 KB chunks to only read data actually present (with a max DoS of 1 KB) - let mut data = vec![]; - while data_len > 0 { - let chunk_len = data_len.min(1024); - let mut chunk = vec![0; chunk_len]; - reader.read_exact(&mut chunk)?; - data.extend(&chunk); - data_len -= chunk_len; - } - - Ok(Call { to, value, data }) - } - - fn write(&self, writer: &mut W) -> io::Result<()> { - writer.write_all(&self.to)?; - writer.write_all(&self.value.as_le_bytes())?; - - let data_len = u32::try_from(self.data.len()) - .map_err(|_| io::Error::other("call data length exceeded 2**32"))?; - writer.write_all(&data_len.to_le_bytes())?; - writer.write_all(&self.data) - } -} -impl From for AbiCall { - fn from(call: Call) -> AbiCall { - AbiCall { to: call.to.into(), value: call.value, data: call.data.into() } - } -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub enum OutInstructionTarget { - Direct([u8; 20]), - Calls(Vec), -} -impl OutInstructionTarget { - fn read(reader: &mut R) -> io::Result { - let mut kind = [0xff]; - reader.read_exact(&mut kind)?; - - match kind[0] { - 0 => { - let mut addr = [0; 20]; - reader.read_exact(&mut addr)?; - Ok(OutInstructionTarget::Direct(addr)) - } - 1 => { - let mut calls_len = [0; 4]; - reader.read_exact(&mut calls_len)?; - let calls_len = u32::from_le_bytes(calls_len); - - let mut calls = vec![]; - for _ in 0 .. calls_len { - calls.push(Call::read(reader)?); - } - Ok(OutInstructionTarget::Calls(calls)) - } - _ => Err(io::Error::other("unrecognized OutInstructionTarget"))?, - } - } - - fn write(&self, writer: &mut W) -> io::Result<()> { - match self { - OutInstructionTarget::Direct(addr) => { - writer.write_all(&[0])?; - writer.write_all(addr)?; - } - OutInstructionTarget::Calls(calls) => { - writer.write_all(&[1])?; - let call_len = u32::try_from(calls.len()) - .map_err(|_| io::Error::other("amount of calls exceeded 2**32"))?; - writer.write_all(&call_len.to_le_bytes())?; - for call in calls { - call.write(writer)?; - } - } - } - Ok(()) - } -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub struct OutInstruction { - pub target: OutInstructionTarget, - pub value: U256, -} -impl OutInstruction { - fn read(reader: &mut R) -> io::Result { - let target = OutInstructionTarget::read(reader)?; - - let value = { - let mut value_bytes = [0; 32]; - reader.read_exact(&mut value_bytes)?; - U256::from_le_slice(&value_bytes) - }; - - Ok(OutInstruction { target, value }) - } - fn write(&self, writer: &mut W) -> io::Result<()> { - self.target.write(writer)?; - writer.write_all(&self.value.as_le_bytes()) - } -} -impl From for AbiOutInstruction { - fn from(instruction: OutInstruction) -> AbiOutInstruction { - match instruction.target { - OutInstructionTarget::Direct(addr) => { - AbiOutInstruction { to: addr.into(), calls: vec![], value: instruction.value } - } - OutInstructionTarget::Calls(calls) => AbiOutInstruction { - to: [0; 20].into(), - calls: calls.into_iter().map(Into::into).collect(), - value: instruction.value, - }, - } - } -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub enum RouterCommand { - UpdateSeraiKey { chain_id: U256, nonce: U256, key: PublicKey }, - Execute { chain_id: U256, nonce: U256, outs: Vec }, -} - -impl RouterCommand { - pub fn msg(&self) -> Vec { - match self { - RouterCommand::UpdateSeraiKey { chain_id, nonce, key } => { - Router::update_serai_key_message(*chain_id, *nonce, key) - } - RouterCommand::Execute { chain_id, nonce, outs } => Router::execute_message( - *chain_id, - *nonce, - outs.iter().map(|out| out.clone().into()).collect(), - ), - } - } - - pub fn read(reader: &mut R) -> io::Result { - let mut kind = [0xff]; - reader.read_exact(&mut kind)?; - - match kind[0] { - 0 => { - let mut chain_id = [0; 32]; - reader.read_exact(&mut chain_id)?; - - let mut nonce = [0; 32]; - reader.read_exact(&mut nonce)?; - - let key = PublicKey::new(Secp256k1::read_G(reader)?) - .ok_or(io::Error::other("key for RouterCommand doesn't have an eth representation"))?; - Ok(RouterCommand::UpdateSeraiKey { - chain_id: U256::from_le_slice(&chain_id), - nonce: U256::from_le_slice(&nonce), - key, - }) - } - 1 => { - let mut chain_id = [0; 32]; - reader.read_exact(&mut chain_id)?; - let chain_id = U256::from_le_slice(&chain_id); - - let mut nonce = [0; 32]; - reader.read_exact(&mut nonce)?; - let nonce = U256::from_le_slice(&nonce); - - let mut outs_len = [0; 4]; - reader.read_exact(&mut outs_len)?; - let outs_len = u32::from_le_bytes(outs_len); - - let mut outs = vec![]; - for _ in 0 .. outs_len { - outs.push(OutInstruction::read(reader)?); - } - - Ok(RouterCommand::Execute { chain_id, nonce, outs }) - } - _ => Err(io::Error::other("reading unknown type of RouterCommand"))?, - } - } - - pub fn write(&self, writer: &mut W) -> io::Result<()> { - match self { - RouterCommand::UpdateSeraiKey { chain_id, nonce, key } => { - writer.write_all(&[0])?; - writer.write_all(&chain_id.as_le_bytes())?; - writer.write_all(&nonce.as_le_bytes())?; - writer.write_all(&key.point().to_bytes()) - } - RouterCommand::Execute { chain_id, nonce, outs } => { - writer.write_all(&[1])?; - writer.write_all(&chain_id.as_le_bytes())?; - writer.write_all(&nonce.as_le_bytes())?; - writer.write_all(&u32::try_from(outs.len()).unwrap().to_le_bytes())?; - for out in outs { - out.write(writer)?; - } - Ok(()) - } - } - } - - pub fn serialize(&self) -> Vec { - let mut res = vec![]; - self.write(&mut res).unwrap(); - res - } -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub struct SignedRouterCommand { - command: RouterCommand, - signature: Signature, -} - -impl SignedRouterCommand { - pub fn new(key: &PublicKey, command: RouterCommand, signature: &[u8; 64]) -> Option { - let c = Secp256k1::read_F(&mut &signature[.. 32]).ok()?; - let s = Secp256k1::read_F(&mut &signature[32 ..]).ok()?; - let signature = Signature { c, s }; - - if !signature.verify(key, &command.msg()) { - None? - } - Some(SignedRouterCommand { command, signature }) - } - - pub fn command(&self) -> &RouterCommand { - &self.command - } - - pub fn signature(&self) -> &Signature { - &self.signature - } - - pub fn read(reader: &mut R) -> io::Result { - let command = RouterCommand::read(reader)?; - - let mut sig = [0; 64]; - reader.read_exact(&mut sig)?; - let signature = Signature::from_bytes(sig)?; - - Ok(SignedRouterCommand { command, signature }) - } - - pub fn write(&self, writer: &mut W) -> io::Result<()> { - self.command.write(writer)?; - writer.write_all(&self.signature.to_bytes()) - } -} - -pub struct RouterCommandMachine { - key: PublicKey, - command: RouterCommand, - machine: AlgorithmMachine>, -} - -impl RouterCommandMachine { - pub fn new(keys: ThresholdKeys, command: RouterCommand) -> Option { - // The Schnorr algorithm should be fine without this, even when using the IETF variant - // If this is better and more comprehensive, we should do it, even if not necessary - let mut transcript = RecommendedTranscript::new(b"ethereum-serai RouterCommandMachine v0.1"); - let key = keys.group_key(); - transcript.append_message(b"key", key.to_bytes()); - transcript.append_message(b"command", command.serialize()); - - Some(Self { - key: PublicKey::new(key)?, - command, - machine: AlgorithmMachine::new(Schnorr::new(transcript), keys), - }) - } -} - -impl PreprocessMachine for RouterCommandMachine { - type Preprocess = Preprocess; - type Signature = SignedRouterCommand; - type SignMachine = RouterCommandSignMachine; - - fn preprocess( - self, - rng: &mut R, - ) -> (Self::SignMachine, Self::Preprocess) { - let (machine, preprocess) = self.machine.preprocess(rng); - - (RouterCommandSignMachine { key: self.key, command: self.command, machine }, preprocess) - } -} - -pub struct RouterCommandSignMachine { - key: PublicKey, - command: RouterCommand, - machine: AlgorithmSignMachine>, -} - -impl SignMachine for RouterCommandSignMachine { - type Params = (); - type Keys = ThresholdKeys; - type Preprocess = Preprocess; - type SignatureShare = SignatureShare; - type SignatureMachine = RouterCommandSignatureMachine; - - fn cache(self) -> CachedPreprocess { - unimplemented!( - "RouterCommand machines don't support caching their preprocesses due to {}", - "being already bound to a specific command" - ); - } - - fn from_cache( - (): (), - _: ThresholdKeys, - _: CachedPreprocess, - ) -> (Self, Self::Preprocess) { - unimplemented!( - "RouterCommand machines don't support caching their preprocesses due to {}", - "being already bound to a specific command" - ); - } - - fn read_preprocess(&self, reader: &mut R) -> io::Result { - self.machine.read_preprocess(reader) - } - - fn sign( - self, - commitments: HashMap, - msg: &[u8], - ) -> Result<(RouterCommandSignatureMachine, Self::SignatureShare), FrostError> { - if !msg.is_empty() { - panic!("message was passed to a RouterCommand machine when it generates its own"); - } - - let (machine, share) = self.machine.sign(commitments, &self.command.msg())?; - - Ok((RouterCommandSignatureMachine { key: self.key, command: self.command, machine }, share)) - } -} - -pub struct RouterCommandSignatureMachine { - key: PublicKey, - command: RouterCommand, - machine: - AlgorithmSignatureMachine>, -} - -impl SignatureMachine for RouterCommandSignatureMachine { - type SignatureShare = SignatureShare; - - fn read_share(&self, reader: &mut R) -> io::Result { - self.machine.read_share(reader) - } - - fn complete( - self, - shares: HashMap, - ) -> Result { - let signature = self.machine.complete(shares)?; - let signature = Signature::new(signature).expect("machine produced an invalid signature"); - assert!(signature.verify(&self.key, &self.command.msg())); - Ok(SignedRouterCommand { command: self.command, signature }) - } -} diff --git a/processor/ethereum/src/primitives/transaction.rs b/processor/ethereum/src/primitives/transaction.rs index f77153ff..eeba3180 100644 --- a/processor/ethereum/src/primitives/transaction.rs +++ b/processor/ethereum/src/primitives/transaction.rs @@ -40,8 +40,12 @@ impl Action { fn message(&self) -> Vec { match self { - Action::SetKey { chain_id, nonce, key } => Router::update_serai_key_message(*chain_id, *nonce, key), - Action::Batch { chain_id, nonce, outs } => Router::execute_message(*chain_id, *nonce, OutInstructions::from(outs.as_ref())), + Action::SetKey { chain_id, nonce, key } => { + Router::update_serai_key_message(*chain_id, *nonce, key) + } + Action::Batch { chain_id, nonce, outs } => { + Router::execute_message(*chain_id, *nonce, OutInstructions::from(outs.as_ref())) + } } } @@ -129,9 +133,17 @@ impl PreprocessMachine for ClonableTransctionMachine { self, rng: &mut R, ) -> (Self::SignMachine, Self::Preprocess) { - let (machine, preprocess) = AlgorithmMachine::new(IetfSchnorr::::ietf(), self.0.clone()) - .preprocess(rng); - (ActionSignMachine(PublicKey::new(self.0.group_key()).expect("signing with non-representable key"), self.1, machine), preprocess) + let (machine, preprocess) = + AlgorithmMachine::new(IetfSchnorr::::ietf(), self.0.clone()) + .preprocess(rng); + ( + ActionSignMachine( + PublicKey::new(self.0.group_key()).expect("signing with non-representable key"), + self.1, + machine, + ), + preprocess, + ) } } @@ -157,7 +169,7 @@ impl SignMachine for ActionSignMachine { params: Self::Params, keys: Self::Keys, cache: CachedPreprocess, -) -> (Self, Self::Preprocess) { + ) -> (Self, Self::Preprocess) { unimplemented!() } diff --git a/tests/processor/Cargo.toml b/tests/processor/Cargo.toml index e37dc2a9..c7267b55 100644 --- a/tests/processor/Cargo.toml +++ b/tests/processor/Cargo.toml @@ -29,7 +29,6 @@ dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] bitcoin-serai = { path = "../../networks/bitcoin" } k256 = "0.13" -ethereum-serai = { path = "../../processor/ethereum/ethereum-serai" } monero-simple-request-rpc = { path = "../../networks/monero/rpc/simple-request" } monero-wallet = { path = "../../networks/monero/wallet" }