openzeppelin_rs/contracts/
IERC2612.rs

1pub use ierc2612::*;
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 ierc2612 {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\",\"components\":[]},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\",\"components\":[]},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"permit\",\"outputs\":[]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static IERC2612_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 IERC2612<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for IERC2612<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for IERC2612<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 IERC2612<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for IERC2612<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(IERC2612)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> IERC2612<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                    IERC2612_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `DOMAIN_SEPARATOR` (0x3644e515) function
56        pub fn domain_separator(
57            &self,
58        ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
59            self.0
60                .method_hash([54, 68, 229, 21], ())
61                .expect("method not found (this should never happen)")
62        }
63        ///Calls the contract's `nonces` (0x7ecebe00) function
64        pub fn nonces(
65            &self,
66            owner: ::ethers_core::types::Address,
67        ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
68            self.0
69                .method_hash([126, 206, 190, 0], owner)
70                .expect("method not found (this should never happen)")
71        }
72        ///Calls the contract's `permit` (0xd505accf) function
73        pub fn permit(
74            &self,
75            owner: ::ethers_core::types::Address,
76            spender: ::ethers_core::types::Address,
77            value: ::ethers_core::types::U256,
78            deadline: ::ethers_core::types::U256,
79            v: u8,
80            r: [u8; 32],
81            s: [u8; 32],
82        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
83            self.0
84                .method_hash(
85                    [213, 5, 172, 207],
86                    (owner, spender, value, deadline, v, r, s),
87                )
88                .expect("method not found (this should never happen)")
89        }
90    }
91    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
92    for IERC2612<M> {
93        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
94            Self::new(contract.address(), contract.client())
95        }
96    }
97    ///Container type for all input parameters for the `DOMAIN_SEPARATOR` function with signature `DOMAIN_SEPARATOR()` and selector `0x3644e515`
98    #[derive(
99        Clone,
100        ::ethers_contract::EthCall,
101        ::ethers_contract::EthDisplay,
102        Default,
103        Debug,
104        PartialEq,
105        Eq,
106        Hash
107    )]
108    #[ethcall(name = "DOMAIN_SEPARATOR", abi = "DOMAIN_SEPARATOR()")]
109    pub struct DomainSeparatorCall;
110    ///Container type for all input parameters for the `nonces` function with signature `nonces(address)` and selector `0x7ecebe00`
111    #[derive(
112        Clone,
113        ::ethers_contract::EthCall,
114        ::ethers_contract::EthDisplay,
115        Default,
116        Debug,
117        PartialEq,
118        Eq,
119        Hash
120    )]
121    #[ethcall(name = "nonces", abi = "nonces(address)")]
122    pub struct NoncesCall {
123        pub owner: ::ethers_core::types::Address,
124    }
125    ///Container type for all input parameters for the `permit` function with signature `permit(address,address,uint256,uint256,uint8,bytes32,bytes32)` and selector `0xd505accf`
126    #[derive(
127        Clone,
128        ::ethers_contract::EthCall,
129        ::ethers_contract::EthDisplay,
130        Default,
131        Debug,
132        PartialEq,
133        Eq,
134        Hash
135    )]
136    #[ethcall(
137        name = "permit",
138        abi = "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)"
139    )]
140    pub struct PermitCall {
141        pub owner: ::ethers_core::types::Address,
142        pub spender: ::ethers_core::types::Address,
143        pub value: ::ethers_core::types::U256,
144        pub deadline: ::ethers_core::types::U256,
145        pub v: u8,
146        pub r: [u8; 32],
147        pub s: [u8; 32],
148    }
149    ///Container type for all of the contract's call
150    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
151    pub enum IERC2612Calls {
152        DomainSeparator(DomainSeparatorCall),
153        Nonces(NoncesCall),
154        Permit(PermitCall),
155    }
156    impl ::ethers_core::abi::AbiDecode for IERC2612Calls {
157        fn decode(
158            data: impl AsRef<[u8]>,
159        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
160            let data = data.as_ref();
161            if let Ok(decoded)
162                = <DomainSeparatorCall as ::ethers_core::abi::AbiDecode>::decode(data) {
163                return Ok(Self::DomainSeparator(decoded));
164            }
165            if let Ok(decoded)
166                = <NoncesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
167                return Ok(Self::Nonces(decoded));
168            }
169            if let Ok(decoded)
170                = <PermitCall as ::ethers_core::abi::AbiDecode>::decode(data) {
171                return Ok(Self::Permit(decoded));
172            }
173            Err(::ethers_core::abi::Error::InvalidData.into())
174        }
175    }
176    impl ::ethers_core::abi::AbiEncode for IERC2612Calls {
177        fn encode(self) -> Vec<u8> {
178            match self {
179                Self::DomainSeparator(element) => {
180                    ::ethers_core::abi::AbiEncode::encode(element)
181                }
182                Self::Nonces(element) => ::ethers_core::abi::AbiEncode::encode(element),
183                Self::Permit(element) => ::ethers_core::abi::AbiEncode::encode(element),
184            }
185        }
186    }
187    impl ::core::fmt::Display for IERC2612Calls {
188        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
189            match self {
190                Self::DomainSeparator(element) => ::core::fmt::Display::fmt(element, f),
191                Self::Nonces(element) => ::core::fmt::Display::fmt(element, f),
192                Self::Permit(element) => ::core::fmt::Display::fmt(element, f),
193            }
194        }
195    }
196    impl ::core::convert::From<DomainSeparatorCall> for IERC2612Calls {
197        fn from(value: DomainSeparatorCall) -> Self {
198            Self::DomainSeparator(value)
199        }
200    }
201    impl ::core::convert::From<NoncesCall> for IERC2612Calls {
202        fn from(value: NoncesCall) -> Self {
203            Self::Nonces(value)
204        }
205    }
206    impl ::core::convert::From<PermitCall> for IERC2612Calls {
207        fn from(value: PermitCall) -> Self {
208            Self::Permit(value)
209        }
210    }
211    ///Container type for all return fields from the `DOMAIN_SEPARATOR` function with signature `DOMAIN_SEPARATOR()` and selector `0x3644e515`
212    #[derive(
213        Clone,
214        ::ethers_contract::EthAbiType,
215        ::ethers_contract::EthAbiCodec,
216        Default,
217        Debug,
218        PartialEq,
219        Eq,
220        Hash
221    )]
222    pub struct DomainSeparatorReturn(pub [u8; 32]);
223    ///Container type for all return fields from the `nonces` function with signature `nonces(address)` and selector `0x7ecebe00`
224    #[derive(
225        Clone,
226        ::ethers_contract::EthAbiType,
227        ::ethers_contract::EthAbiCodec,
228        Default,
229        Debug,
230        PartialEq,
231        Eq,
232        Hash
233    )]
234    pub struct NoncesReturn(pub ::ethers_core::types::U256);
235}