openzeppelin_rs/contracts/
IERC1271.rs1pub use ierc1271::*;
2#[allow(
5 clippy::enum_variant_names,
6 clippy::too_many_arguments,
7 clippy::upper_case_acronyms,
8 clippy::type_complexity,
9 dead_code,
10 non_camel_case_types,
11)]
12pub mod ierc1271 {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"isValidSignature\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"magicValue\",\"type\":\"bytes4\",\"components\":[]}]}]";
15 pub static IERC1271_ABI: ::ethers_contract::Lazy<::ethers_core::abi::Abi> = ::ethers_contract::Lazy::new(||
17 ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
18 pub struct IERC1271<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for IERC1271<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for IERC1271<M> {
25 type Target = ::ethers_contract::Contract<M>;
26 fn deref(&self) -> &Self::Target {
27 &self.0
28 }
29 }
30 impl<M> ::core::ops::DerefMut for IERC1271<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for IERC1271<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(IERC1271)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> IERC1271<M> {
41 pub fn new<T: Into<::ethers_core::types::Address>>(
44 address: T,
45 client: ::std::sync::Arc<M>,
46 ) -> Self {
47 Self(
48 ::ethers_contract::Contract::new(
49 address.into(),
50 IERC1271_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn is_valid_signature(
57 &self,
58 hash: [u8; 32],
59 signature: ::ethers_core::types::Bytes,
60 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 4]> {
61 self.0
62 .method_hash([22, 38, 186, 126], (hash, signature))
63 .expect("method not found (this should never happen)")
64 }
65 }
66 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
67 for IERC1271<M> {
68 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
69 Self::new(contract.address(), contract.client())
70 }
71 }
72 #[derive(
74 Clone,
75 ::ethers_contract::EthCall,
76 ::ethers_contract::EthDisplay,
77 Default,
78 Debug,
79 PartialEq,
80 Eq,
81 Hash
82 )]
83 #[ethcall(name = "isValidSignature", abi = "isValidSignature(bytes32,bytes)")]
84 pub struct IsValidSignatureCall {
85 pub hash: [u8; 32],
86 pub signature: ::ethers_core::types::Bytes,
87 }
88 #[derive(
90 Clone,
91 ::ethers_contract::EthAbiType,
92 ::ethers_contract::EthAbiCodec,
93 Default,
94 Debug,
95 PartialEq,
96 Eq,
97 Hash
98 )]
99 pub struct IsValidSignatureReturn {
100 pub magic_value: [u8; 4],
101 }
102}