openzeppelin_rs/contracts/
EIP712.rs

1pub use eip712::*;
2/// This module was auto-generated with ethers-rs Abigen.
3/// More information at: <https://github.com/gakonst/ethers-rs>
4#[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 eip712 {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[],\"type\":\"error\",\"name\":\"InvalidShortString\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\",\"components\":[]}],\"type\":\"error\",\"name\":\"StringTooLong\",\"outputs\":[]},{\"inputs\":[],\"type\":\"event\",\"name\":\"EIP712DomainChanged\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\",\"components\":[]},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\",\"components\":[]},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\",\"components\":[]}]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static EIP712_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 EIP712<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for EIP712<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for EIP712<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 EIP712<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for EIP712<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(EIP712)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> EIP712<M> {
41        /// Creates a new contract instance with the specified `ethers` client at
42        /// `address`. The contract derefs to a `ethers::Contract` object.
43        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                    EIP712_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `eip712Domain` (0x84b0196e) function
56        pub fn eip_712_domain(
57            &self,
58        ) -> ::ethers_contract::builders::ContractCall<
59            M,
60            (
61                [u8; 1],
62                ::std::string::String,
63                ::std::string::String,
64                ::ethers_core::types::U256,
65                ::ethers_core::types::Address,
66                [u8; 32],
67                ::std::vec::Vec<::ethers_core::types::U256>,
68            ),
69        > {
70            self.0
71                .method_hash([132, 176, 25, 110], ())
72                .expect("method not found (this should never happen)")
73        }
74        ///Gets the contract's `EIP712DomainChanged` event
75        pub fn eip712_domain_changed_filter(
76            &self,
77        ) -> ::ethers_contract::builders::Event<
78            ::std::sync::Arc<M>,
79            M,
80            Eip712DomainChangedFilter,
81        > {
82            self.0.event()
83        }
84        /// Returns an `Event` builder for all the events of this contract.
85        pub fn events(
86            &self,
87        ) -> ::ethers_contract::builders::Event<
88            ::std::sync::Arc<M>,
89            M,
90            Eip712DomainChangedFilter,
91        > {
92            self.0.event_with_filter(::core::default::Default::default())
93        }
94    }
95    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
96    for EIP712<M> {
97        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
98            Self::new(contract.address(), contract.client())
99        }
100    }
101    ///Custom Error type `InvalidShortString` with signature `InvalidShortString()` and selector `0xb3512b0c`
102    #[derive(
103        Clone,
104        ::ethers_contract::EthError,
105        ::ethers_contract::EthDisplay,
106        Default,
107        Debug,
108        PartialEq,
109        Eq,
110        Hash
111    )]
112    #[etherror(name = "InvalidShortString", abi = "InvalidShortString()")]
113    pub struct InvalidShortString;
114    ///Custom Error type `StringTooLong` with signature `StringTooLong(string)` and selector `0x305a27a9`
115    #[derive(
116        Clone,
117        ::ethers_contract::EthError,
118        ::ethers_contract::EthDisplay,
119        Default,
120        Debug,
121        PartialEq,
122        Eq,
123        Hash
124    )]
125    #[etherror(name = "StringTooLong", abi = "StringTooLong(string)")]
126    pub struct StringTooLong {
127        pub str: ::std::string::String,
128    }
129    ///Container type for all of the contract's custom errors
130    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
131    pub enum EIP712Errors {
132        InvalidShortString(InvalidShortString),
133        StringTooLong(StringTooLong),
134        /// The standard solidity revert string, with selector
135        /// Error(string) -- 0x08c379a0
136        RevertString(::std::string::String),
137    }
138    impl ::ethers_core::abi::AbiDecode for EIP712Errors {
139        fn decode(
140            data: impl AsRef<[u8]>,
141        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
142            let data = data.as_ref();
143            if let Ok(decoded)
144                = <::std::string::String as ::ethers_core::abi::AbiDecode>::decode(
145                    data,
146                ) {
147                return Ok(Self::RevertString(decoded));
148            }
149            if let Ok(decoded)
150                = <InvalidShortString as ::ethers_core::abi::AbiDecode>::decode(data) {
151                return Ok(Self::InvalidShortString(decoded));
152            }
153            if let Ok(decoded)
154                = <StringTooLong as ::ethers_core::abi::AbiDecode>::decode(data) {
155                return Ok(Self::StringTooLong(decoded));
156            }
157            Err(::ethers_core::abi::Error::InvalidData.into())
158        }
159    }
160    impl ::ethers_core::abi::AbiEncode for EIP712Errors {
161        fn encode(self) -> ::std::vec::Vec<u8> {
162            match self {
163                Self::InvalidShortString(element) => {
164                    ::ethers_core::abi::AbiEncode::encode(element)
165                }
166                Self::StringTooLong(element) => {
167                    ::ethers_core::abi::AbiEncode::encode(element)
168                }
169                Self::RevertString(s) => ::ethers_core::abi::AbiEncode::encode(s),
170            }
171        }
172    }
173    impl ::ethers_contract::ContractRevert for EIP712Errors {
174        fn valid_selector(selector: [u8; 4]) -> bool {
175            match selector {
176                [0x08, 0xc3, 0x79, 0xa0] => true,
177                _ if selector
178                    == <InvalidShortString as ::ethers_contract::EthError>::selector() => {
179                    true
180                }
181                _ if selector
182                    == <StringTooLong as ::ethers_contract::EthError>::selector() => true,
183                _ => false,
184            }
185        }
186    }
187    impl ::core::fmt::Display for EIP712Errors {
188        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
189            match self {
190                Self::InvalidShortString(element) => {
191                    ::core::fmt::Display::fmt(element, f)
192                }
193                Self::StringTooLong(element) => ::core::fmt::Display::fmt(element, f),
194                Self::RevertString(s) => ::core::fmt::Display::fmt(s, f),
195            }
196        }
197    }
198    impl ::core::convert::From<::std::string::String> for EIP712Errors {
199        fn from(value: String) -> Self {
200            Self::RevertString(value)
201        }
202    }
203    impl ::core::convert::From<InvalidShortString> for EIP712Errors {
204        fn from(value: InvalidShortString) -> Self {
205            Self::InvalidShortString(value)
206        }
207    }
208    impl ::core::convert::From<StringTooLong> for EIP712Errors {
209        fn from(value: StringTooLong) -> Self {
210            Self::StringTooLong(value)
211        }
212    }
213    #[derive(
214        Clone,
215        ::ethers_contract::EthEvent,
216        ::ethers_contract::EthDisplay,
217        Default,
218        Debug,
219        PartialEq,
220        Eq,
221        Hash
222    )]
223    #[ethevent(name = "EIP712DomainChanged", abi = "EIP712DomainChanged()")]
224    pub struct Eip712DomainChangedFilter;
225    ///Container type for all input parameters for the `eip712Domain` function with signature `eip712Domain()` and selector `0x84b0196e`
226    #[derive(
227        Clone,
228        ::ethers_contract::EthCall,
229        ::ethers_contract::EthDisplay,
230        Default,
231        Debug,
232        PartialEq,
233        Eq,
234        Hash
235    )]
236    #[ethcall(name = "eip712Domain", abi = "eip712Domain()")]
237    pub struct Eip712DomainCall;
238    ///Container type for all return fields from the `eip712Domain` function with signature `eip712Domain()` and selector `0x84b0196e`
239    #[derive(
240        Clone,
241        ::ethers_contract::EthAbiType,
242        ::ethers_contract::EthAbiCodec,
243        Default,
244        Debug,
245        PartialEq,
246        Eq,
247        Hash
248    )]
249    pub struct Eip712DomainReturn {
250        pub fields: [u8; 1],
251        pub name: ::std::string::String,
252        pub version: ::std::string::String,
253        pub chain_id: ::ethers_core::types::U256,
254        pub verifying_contract: ::ethers_core::types::Address,
255        pub salt: [u8; 32],
256        pub extensions: ::std::vec::Vec<::ethers_core::types::U256>,
257    }
258}