diff --git a/Cargo.lock b/Cargo.lock index 1338ae26..d6224093 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2516,6 +2516,7 @@ dependencies = [ "alloy-rpc-types-eth", "alloy-simple-request-transport", "alloy-sol-types", + "ethereum-schnorr-contract", "flexible-transcript", "group", "k256", @@ -6126,6 +6127,16 @@ 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" @@ -6291,7 +6302,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prettyplease", + "prettyplease 0.1.25", "prost", "prost-types", "regex", @@ -8700,8 +8711,14 @@ dependencies = [ 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]] diff --git a/networks/ethereum/build-contracts/src/lib.rs b/networks/ethereum/build-contracts/src/lib.rs index 5213059e..b1c9c87f 100644 --- a/networks/ethereum/build-contracts/src/lib.rs +++ b/networks/ethereum/build-contracts/src/lib.rs @@ -12,6 +12,13 @@ pub fn build( contracts_path: &str, artifacts_path: &str, ) -> Result<(), String> { + if !fs::exists(artifacts_path) + .map_err(|e| format!("couldn't check if artifacts directory already exists: {e:?}"))? + { + fs::create_dir(artifacts_path) + .map_err(|e| format!("couldn't create the non-existent artifacts directory: {e:?}"))?; + } + println!("cargo:rerun-if-changed={contracts_path}/*"); println!("cargo:rerun-if-changed={artifacts_path}/*"); diff --git a/networks/ethereum/schnorr/build.rs b/networks/ethereum/schnorr/build.rs index 7b7c30fd..cf12f948 100644 --- a/networks/ethereum/schnorr/build.rs +++ b/networks/ethereum/schnorr/build.rs @@ -1,9 +1,4 @@ -use std::{env, fs}; - fn main() { - let artifacts_path = env::var("OUT_DIR").unwrap().to_string() + "/ethereum-schnorr-contract"; - if !fs::exists(&artifacts_path).unwrap() { - fs::create_dir(&artifacts_path).unwrap(); - } + let artifacts_path = std::env::var("OUT_DIR").unwrap().to_string() + "/ethereum-schnorr-contract"; build_solidity_contracts::build(&[], "contracts", &artifacts_path).unwrap(); } diff --git a/processor/ethereum/contracts/.gitignore b/processor/ethereum/contracts/.gitignore deleted file mode 100644 index de153db3..00000000 --- a/processor/ethereum/contracts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -artifacts diff --git a/processor/ethereum/contracts/Cargo.toml b/processor/ethereum/contracts/Cargo.toml index 64fbccad..5ed540b6 100644 --- a/processor/ethereum/contracts/Cargo.toml +++ b/processor/ethereum/contracts/Cargo.toml @@ -21,3 +21,12 @@ 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/build.rs b/processor/ethereum/contracts/build.rs index 0af41608..23d1e907 100644 --- a/processor/ethereum/contracts/build.rs +++ b/processor/ethereum/contracts/build.rs @@ -1,8 +1,69 @@ -fn main() { - build_solidity_contracts::build( - &["../../../networks/ethereum/schnorr/contracts"], - "contracts", - "artifacts", +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 new file mode 100644 index 00000000..f4bcb3a6 --- /dev/null +++ b/processor/ethereum/contracts/src/abigen/deployer.rs @@ -0,0 +1,584 @@ +///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 new file mode 100644 index 00000000..d9c0dd6e --- /dev/null +++ b/processor/ethereum/contracts/src/abigen/erc20.rs @@ -0,0 +1,1838 @@ +///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 new file mode 100644 index 00000000..541c2980 --- /dev/null +++ b/processor/ethereum/contracts/src/abigen/mod.rs @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..cea1858f --- /dev/null +++ b/processor/ethereum/contracts/src/abigen/router.rs @@ -0,0 +1,2958 @@ +/** + +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 index d8de29b3..45176067 100644 --- a/processor/ethereum/contracts/src/lib.rs +++ b/processor/ethereum/contracts/src/lib.rs @@ -1,46 +1,21 @@ -use alloy_sol_types::sol; - #[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 erc20_container { - use super::*; - sol!("contracts/IERC20.sol"); -} +mod abigen; + pub mod erc20 { - pub const BYTECODE: &str = include_str!("../artifacts/Deployer.bin"); - pub use super::erc20_container::IERC20::*; -} - -#[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 deployer_container { - use super::*; - sol!("contracts/Deployer.sol"); + pub use super::abigen::erc20::IERC20::*; } pub mod deployer { - pub const BYTECODE: &str = include_str!("../artifacts/Deployer.bin"); - pub use super::deployer_container::Deployer::*; -} - -#[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 router_container { - use super::*; - sol!(Router, "artifacts/Router.abi"); + pub const BYTECODE: &str = + include_str!(concat!(env!("OUT_DIR"), "/serai-processor-ethereum-contracts/Deployer.bin")); + pub use super::abigen::deployer::Deployer::*; } pub mod router { - pub const BYTECODE: &str = include_str!("../artifacts/Router.bin"); - pub use super::router_container::Router::*; + pub const BYTECODE: &str = + include_str!(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 index f0ea323f..a2bec481 100644 --- a/processor/ethereum/ethereum-serai/Cargo.toml +++ b/processor/ethereum/ethereum-serai/Cargo.toml @@ -38,6 +38,7 @@ 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] diff --git a/processor/ethereum/ethereum-serai/src/crypto.rs b/processor/ethereum/ethereum-serai/src/crypto.rs index 3366b744..d013eeff 100644 --- a/processor/ethereum/ethereum-serai/src/crypto.rs +++ b/processor/ethereum/ethereum-serai/src/crypto.rs @@ -13,6 +13,8 @@ use frost::{ curve::{Ciphersuite, Secp256k1}, }; +pub use ethereum_schnorr_contract::*; + use alloy_core::primitives::{Parity, Signature as AlloySignature}; use alloy_consensus::{SignableTransaction, Signed, TxLegacy}; @@ -77,11 +79,3 @@ impl Hram for EthereumHram { >::reduce_bytes(&keccak256(&data).into()) } } - -impl From<&Signature> for AbiSignature { - fn from(sig: &Signature) -> AbiSignature { - let c: [u8; 32] = sig.c.to_repr().into(); - let s: [u8; 32] = sig.s.to_repr().into(); - AbiSignature { c: c.into(), s: s.into() } - } -} diff --git a/processor/ethereum/ethereum-serai/src/machine.rs b/processor/ethereum/ethereum-serai/src/machine.rs index 0d5dc7a5..b9a0628e 100644 --- a/processor/ethereum/ethereum-serai/src/machine.rs +++ b/processor/ethereum/ethereum-serai/src/machine.rs @@ -236,7 +236,7 @@ impl RouterCommand { writer.write_all(&[0])?; writer.write_all(&chain_id.as_le_bytes())?; writer.write_all(&nonce.as_le_bytes())?; - writer.write_all(&key.A.to_bytes()) + writer.write_all(&key.point().to_bytes()) } RouterCommand::Execute { chain_id, nonce, outs } => { writer.write_all(&[1])?; @@ -406,9 +406,9 @@ impl SignatureMachine for RouterCommandSignatureMachine { self, shares: HashMap, ) -> Result { - let sig = self.machine.complete(shares)?; - let signature = Signature::new(&self.key, &self.command.msg(), sig) - .expect("machine produced an invalid signature"); + 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/ethereum-serai/src/router.rs b/processor/ethereum/ethereum-serai/src/router.rs index 95866e67..3dbd8fa8 100644 --- a/processor/ethereum/ethereum-serai/src/router.rs +++ b/processor/ethereum/ethereum-serai/src/router.rs @@ -127,7 +127,6 @@ impl InInstruction { pub struct Executed { pub tx_id: [u8; 32], pub nonce: u64, - pub signature: [u8; 64], } /// The contract Serai uses to manage its state. @@ -142,7 +141,7 @@ impl Router { pub(crate) fn init_code(key: &PublicKey) -> Vec { let mut bytecode = Self::code(); // Append the constructor arguments - bytecode.extend((abi::constructorCall { _seraiKey: key.eth_repr().into() }).abi_encode()); + bytecode.extend((abi::constructorCall { initialSeraiKey: key.eth_repr().into() }).abi_encode()); bytecode } @@ -392,13 +391,9 @@ impl Router { let log = log.log_decode::().map_err(|_| Error::ConnectionError)?.inner.data; - let mut signature = [0; 64]; - signature[.. 32].copy_from_slice(log.signature.c.as_ref()); - signature[32 ..].copy_from_slice(log.signature.s.as_ref()); res.push(Executed { tx_id, nonce: log.nonce.try_into().map_err(|_| Error::ConnectionError)?, - signature, }); } } @@ -418,13 +413,9 @@ impl Router { let log = log.log_decode::().map_err(|_| Error::ConnectionError)?.inner.data; - let mut signature = [0; 64]; - signature[.. 32].copy_from_slice(log.signature.c.as_ref()); - signature[32 ..].copy_from_slice(log.signature.s.as_ref()); res.push(Executed { tx_id, nonce: log.nonce.try_into().map_err(|_| Error::ConnectionError)?, - signature, }); } }