1pub use erc1155_receiver::*;
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 erc1155_receiver {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15 pub static ERC1155RECEIVER_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 ERC1155Receiver<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for ERC1155Receiver<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for ERC1155Receiver<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 ERC1155Receiver<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for ERC1155Receiver<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(ERC1155Receiver)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> ERC1155Receiver<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 ERC1155RECEIVER_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn on_erc1155_batch_received(
57 &self,
58 operator: ::ethers_core::types::Address,
59 from: ::ethers_core::types::Address,
60 ids: ::std::vec::Vec<::ethers_core::types::U256>,
61 values: ::std::vec::Vec<::ethers_core::types::U256>,
62 data: ::ethers_core::types::Bytes,
63 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 4]> {
64 self.0
65 .method_hash([188, 25, 124, 129], (operator, from, ids, values, data))
66 .expect("method not found (this should never happen)")
67 }
68 pub fn on_erc1155_received(
70 &self,
71 operator: ::ethers_core::types::Address,
72 from: ::ethers_core::types::Address,
73 id: ::ethers_core::types::U256,
74 value: ::ethers_core::types::U256,
75 data: ::ethers_core::types::Bytes,
76 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 4]> {
77 self.0
78 .method_hash([242, 58, 110, 97], (operator, from, id, value, data))
79 .expect("method not found (this should never happen)")
80 }
81 pub fn supports_interface(
83 &self,
84 interface_id: [u8; 4],
85 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
86 self.0
87 .method_hash([1, 255, 201, 167], interface_id)
88 .expect("method not found (this should never happen)")
89 }
90 }
91 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
92 for ERC1155Receiver<M> {
93 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
94 Self::new(contract.address(), contract.client())
95 }
96 }
97 #[derive(
99 Clone,
100 ::ethers_contract::EthCall,
101 ::ethers_contract::EthDisplay,
102 Default,
103 Debug,
104 PartialEq,
105 Eq,
106 Hash
107 )]
108 #[ethcall(
109 name = "onERC1155BatchReceived",
110 abi = "onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"
111 )]
112 pub struct OnERC1155BatchReceivedCall {
113 pub operator: ::ethers_core::types::Address,
114 pub from: ::ethers_core::types::Address,
115 pub ids: ::std::vec::Vec<::ethers_core::types::U256>,
116 pub values: ::std::vec::Vec<::ethers_core::types::U256>,
117 pub data: ::ethers_core::types::Bytes,
118 }
119 #[derive(
121 Clone,
122 ::ethers_contract::EthCall,
123 ::ethers_contract::EthDisplay,
124 Default,
125 Debug,
126 PartialEq,
127 Eq,
128 Hash
129 )]
130 #[ethcall(
131 name = "onERC1155Received",
132 abi = "onERC1155Received(address,address,uint256,uint256,bytes)"
133 )]
134 pub struct OnERC1155ReceivedCall {
135 pub operator: ::ethers_core::types::Address,
136 pub from: ::ethers_core::types::Address,
137 pub id: ::ethers_core::types::U256,
138 pub value: ::ethers_core::types::U256,
139 pub data: ::ethers_core::types::Bytes,
140 }
141 #[derive(
143 Clone,
144 ::ethers_contract::EthCall,
145 ::ethers_contract::EthDisplay,
146 Default,
147 Debug,
148 PartialEq,
149 Eq,
150 Hash
151 )]
152 #[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")]
153 pub struct SupportsInterfaceCall {
154 pub interface_id: [u8; 4],
155 }
156 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
158 pub enum ERC1155ReceiverCalls {
159 OnERC1155BatchReceived(OnERC1155BatchReceivedCall),
160 OnERC1155Received(OnERC1155ReceivedCall),
161 SupportsInterface(SupportsInterfaceCall),
162 }
163 impl ::ethers_core::abi::AbiDecode for ERC1155ReceiverCalls {
164 fn decode(
165 data: impl AsRef<[u8]>,
166 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
167 let data = data.as_ref();
168 if let Ok(decoded)
169 = <OnERC1155BatchReceivedCall as ::ethers_core::abi::AbiDecode>::decode(
170 data,
171 ) {
172 return Ok(Self::OnERC1155BatchReceived(decoded));
173 }
174 if let Ok(decoded)
175 = <OnERC1155ReceivedCall as ::ethers_core::abi::AbiDecode>::decode(
176 data,
177 ) {
178 return Ok(Self::OnERC1155Received(decoded));
179 }
180 if let Ok(decoded)
181 = <SupportsInterfaceCall as ::ethers_core::abi::AbiDecode>::decode(
182 data,
183 ) {
184 return Ok(Self::SupportsInterface(decoded));
185 }
186 Err(::ethers_core::abi::Error::InvalidData.into())
187 }
188 }
189 impl ::ethers_core::abi::AbiEncode for ERC1155ReceiverCalls {
190 fn encode(self) -> Vec<u8> {
191 match self {
192 Self::OnERC1155BatchReceived(element) => {
193 ::ethers_core::abi::AbiEncode::encode(element)
194 }
195 Self::OnERC1155Received(element) => {
196 ::ethers_core::abi::AbiEncode::encode(element)
197 }
198 Self::SupportsInterface(element) => {
199 ::ethers_core::abi::AbiEncode::encode(element)
200 }
201 }
202 }
203 }
204 impl ::core::fmt::Display for ERC1155ReceiverCalls {
205 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
206 match self {
207 Self::OnERC1155BatchReceived(element) => {
208 ::core::fmt::Display::fmt(element, f)
209 }
210 Self::OnERC1155Received(element) => ::core::fmt::Display::fmt(element, f),
211 Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f),
212 }
213 }
214 }
215 impl ::core::convert::From<OnERC1155BatchReceivedCall> for ERC1155ReceiverCalls {
216 fn from(value: OnERC1155BatchReceivedCall) -> Self {
217 Self::OnERC1155BatchReceived(value)
218 }
219 }
220 impl ::core::convert::From<OnERC1155ReceivedCall> for ERC1155ReceiverCalls {
221 fn from(value: OnERC1155ReceivedCall) -> Self {
222 Self::OnERC1155Received(value)
223 }
224 }
225 impl ::core::convert::From<SupportsInterfaceCall> for ERC1155ReceiverCalls {
226 fn from(value: SupportsInterfaceCall) -> Self {
227 Self::SupportsInterface(value)
228 }
229 }
230 #[derive(
232 Clone,
233 ::ethers_contract::EthAbiType,
234 ::ethers_contract::EthAbiCodec,
235 Default,
236 Debug,
237 PartialEq,
238 Eq,
239 Hash
240 )]
241 pub struct OnERC1155BatchReceivedReturn(pub [u8; 4]);
242 #[derive(
244 Clone,
245 ::ethers_contract::EthAbiType,
246 ::ethers_contract::EthAbiCodec,
247 Default,
248 Debug,
249 PartialEq,
250 Eq,
251 Hash
252 )]
253 pub struct OnERC1155ReceivedReturn(pub [u8; 4]);
254 #[derive(
256 Clone,
257 ::ethers_contract::EthAbiType,
258 ::ethers_contract::EthAbiCodec,
259 Default,
260 Debug,
261 PartialEq,
262 Eq,
263 Hash
264 )]
265 pub struct SupportsInterfaceReturn(pub bool);
266}