1pub use ierc20::*;
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 ierc20 {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Approval\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Transfer\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15 pub static IERC20_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 IERC20<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for IERC20<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for IERC20<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 IERC20<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for IERC20<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(IERC20)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> IERC20<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 IERC20_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn allowance(
57 &self,
58 owner: ::ethers_core::types::Address,
59 spender: ::ethers_core::types::Address,
60 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
61 self.0
62 .method_hash([221, 98, 237, 62], (owner, spender))
63 .expect("method not found (this should never happen)")
64 }
65 pub fn approve(
67 &self,
68 spender: ::ethers_core::types::Address,
69 amount: ::ethers_core::types::U256,
70 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
71 self.0
72 .method_hash([9, 94, 167, 179], (spender, amount))
73 .expect("method not found (this should never happen)")
74 }
75 pub fn balance_of(
77 &self,
78 account: ::ethers_core::types::Address,
79 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
80 self.0
81 .method_hash([112, 160, 130, 49], account)
82 .expect("method not found (this should never happen)")
83 }
84 pub fn total_supply(
86 &self,
87 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
88 self.0
89 .method_hash([24, 22, 13, 221], ())
90 .expect("method not found (this should never happen)")
91 }
92 pub fn transfer(
94 &self,
95 to: ::ethers_core::types::Address,
96 amount: ::ethers_core::types::U256,
97 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
98 self.0
99 .method_hash([169, 5, 156, 187], (to, amount))
100 .expect("method not found (this should never happen)")
101 }
102 pub fn transfer_from(
104 &self,
105 from: ::ethers_core::types::Address,
106 to: ::ethers_core::types::Address,
107 amount: ::ethers_core::types::U256,
108 ) -> ::ethers_contract::builders::ContractCall<M, bool> {
109 self.0
110 .method_hash([35, 184, 114, 221], (from, to, amount))
111 .expect("method not found (this should never happen)")
112 }
113 pub fn approval_filter(
115 &self,
116 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, ApprovalFilter> {
117 self.0.event()
118 }
119 pub fn transfer_filter(
121 &self,
122 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, TransferFilter> {
123 self.0.event()
124 }
125 pub fn events(
127 &self,
128 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, IERC20Events> {
129 self.0.event_with_filter(::core::default::Default::default())
130 }
131 }
132 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
133 for IERC20<M> {
134 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
135 Self::new(contract.address(), contract.client())
136 }
137 }
138 #[derive(
139 Clone,
140 ::ethers_contract::EthEvent,
141 ::ethers_contract::EthDisplay,
142 Default,
143 Debug,
144 PartialEq,
145 Eq,
146 Hash
147 )]
148 #[ethevent(name = "Approval", abi = "Approval(address,address,uint256)")]
149 pub struct ApprovalFilter {
150 #[ethevent(indexed)]
151 pub owner: ::ethers_core::types::Address,
152 #[ethevent(indexed)]
153 pub spender: ::ethers_core::types::Address,
154 pub value: ::ethers_core::types::U256,
155 }
156 #[derive(
157 Clone,
158 ::ethers_contract::EthEvent,
159 ::ethers_contract::EthDisplay,
160 Default,
161 Debug,
162 PartialEq,
163 Eq,
164 Hash
165 )]
166 #[ethevent(name = "Transfer", abi = "Transfer(address,address,uint256)")]
167 pub struct TransferFilter {
168 #[ethevent(indexed)]
169 pub from: ::ethers_core::types::Address,
170 #[ethevent(indexed)]
171 pub to: ::ethers_core::types::Address,
172 pub value: ::ethers_core::types::U256,
173 }
174 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
176 pub enum IERC20Events {
177 ApprovalFilter(ApprovalFilter),
178 TransferFilter(TransferFilter),
179 }
180 impl ::ethers_contract::EthLogDecode for IERC20Events {
181 fn decode_log(
182 log: &::ethers_core::abi::RawLog,
183 ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
184 if let Ok(decoded) = ApprovalFilter::decode_log(log) {
185 return Ok(IERC20Events::ApprovalFilter(decoded));
186 }
187 if let Ok(decoded) = TransferFilter::decode_log(log) {
188 return Ok(IERC20Events::TransferFilter(decoded));
189 }
190 Err(::ethers_core::abi::Error::InvalidData)
191 }
192 }
193 impl ::core::fmt::Display for IERC20Events {
194 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
195 match self {
196 Self::ApprovalFilter(element) => ::core::fmt::Display::fmt(element, f),
197 Self::TransferFilter(element) => ::core::fmt::Display::fmt(element, f),
198 }
199 }
200 }
201 impl ::core::convert::From<ApprovalFilter> for IERC20Events {
202 fn from(value: ApprovalFilter) -> Self {
203 Self::ApprovalFilter(value)
204 }
205 }
206 impl ::core::convert::From<TransferFilter> for IERC20Events {
207 fn from(value: TransferFilter) -> Self {
208 Self::TransferFilter(value)
209 }
210 }
211 #[derive(
213 Clone,
214 ::ethers_contract::EthCall,
215 ::ethers_contract::EthDisplay,
216 Default,
217 Debug,
218 PartialEq,
219 Eq,
220 Hash
221 )]
222 #[ethcall(name = "allowance", abi = "allowance(address,address)")]
223 pub struct AllowanceCall {
224 pub owner: ::ethers_core::types::Address,
225 pub spender: ::ethers_core::types::Address,
226 }
227 #[derive(
229 Clone,
230 ::ethers_contract::EthCall,
231 ::ethers_contract::EthDisplay,
232 Default,
233 Debug,
234 PartialEq,
235 Eq,
236 Hash
237 )]
238 #[ethcall(name = "approve", abi = "approve(address,uint256)")]
239 pub struct ApproveCall {
240 pub spender: ::ethers_core::types::Address,
241 pub amount: ::ethers_core::types::U256,
242 }
243 #[derive(
245 Clone,
246 ::ethers_contract::EthCall,
247 ::ethers_contract::EthDisplay,
248 Default,
249 Debug,
250 PartialEq,
251 Eq,
252 Hash
253 )]
254 #[ethcall(name = "balanceOf", abi = "balanceOf(address)")]
255 pub struct BalanceOfCall {
256 pub account: ::ethers_core::types::Address,
257 }
258 #[derive(
260 Clone,
261 ::ethers_contract::EthCall,
262 ::ethers_contract::EthDisplay,
263 Default,
264 Debug,
265 PartialEq,
266 Eq,
267 Hash
268 )]
269 #[ethcall(name = "totalSupply", abi = "totalSupply()")]
270 pub struct TotalSupplyCall;
271 #[derive(
273 Clone,
274 ::ethers_contract::EthCall,
275 ::ethers_contract::EthDisplay,
276 Default,
277 Debug,
278 PartialEq,
279 Eq,
280 Hash
281 )]
282 #[ethcall(name = "transfer", abi = "transfer(address,uint256)")]
283 pub struct TransferCall {
284 pub to: ::ethers_core::types::Address,
285 pub amount: ::ethers_core::types::U256,
286 }
287 #[derive(
289 Clone,
290 ::ethers_contract::EthCall,
291 ::ethers_contract::EthDisplay,
292 Default,
293 Debug,
294 PartialEq,
295 Eq,
296 Hash
297 )]
298 #[ethcall(name = "transferFrom", abi = "transferFrom(address,address,uint256)")]
299 pub struct TransferFromCall {
300 pub from: ::ethers_core::types::Address,
301 pub to: ::ethers_core::types::Address,
302 pub amount: ::ethers_core::types::U256,
303 }
304 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
306 pub enum IERC20Calls {
307 Allowance(AllowanceCall),
308 Approve(ApproveCall),
309 BalanceOf(BalanceOfCall),
310 TotalSupply(TotalSupplyCall),
311 Transfer(TransferCall),
312 TransferFrom(TransferFromCall),
313 }
314 impl ::ethers_core::abi::AbiDecode for IERC20Calls {
315 fn decode(
316 data: impl AsRef<[u8]>,
317 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
318 let data = data.as_ref();
319 if let Ok(decoded)
320 = <AllowanceCall as ::ethers_core::abi::AbiDecode>::decode(data) {
321 return Ok(Self::Allowance(decoded));
322 }
323 if let Ok(decoded)
324 = <ApproveCall as ::ethers_core::abi::AbiDecode>::decode(data) {
325 return Ok(Self::Approve(decoded));
326 }
327 if let Ok(decoded)
328 = <BalanceOfCall as ::ethers_core::abi::AbiDecode>::decode(data) {
329 return Ok(Self::BalanceOf(decoded));
330 }
331 if let Ok(decoded)
332 = <TotalSupplyCall as ::ethers_core::abi::AbiDecode>::decode(data) {
333 return Ok(Self::TotalSupply(decoded));
334 }
335 if let Ok(decoded)
336 = <TransferCall as ::ethers_core::abi::AbiDecode>::decode(data) {
337 return Ok(Self::Transfer(decoded));
338 }
339 if let Ok(decoded)
340 = <TransferFromCall as ::ethers_core::abi::AbiDecode>::decode(data) {
341 return Ok(Self::TransferFrom(decoded));
342 }
343 Err(::ethers_core::abi::Error::InvalidData.into())
344 }
345 }
346 impl ::ethers_core::abi::AbiEncode for IERC20Calls {
347 fn encode(self) -> Vec<u8> {
348 match self {
349 Self::Allowance(element) => {
350 ::ethers_core::abi::AbiEncode::encode(element)
351 }
352 Self::Approve(element) => ::ethers_core::abi::AbiEncode::encode(element),
353 Self::BalanceOf(element) => {
354 ::ethers_core::abi::AbiEncode::encode(element)
355 }
356 Self::TotalSupply(element) => {
357 ::ethers_core::abi::AbiEncode::encode(element)
358 }
359 Self::Transfer(element) => ::ethers_core::abi::AbiEncode::encode(element),
360 Self::TransferFrom(element) => {
361 ::ethers_core::abi::AbiEncode::encode(element)
362 }
363 }
364 }
365 }
366 impl ::core::fmt::Display for IERC20Calls {
367 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
368 match self {
369 Self::Allowance(element) => ::core::fmt::Display::fmt(element, f),
370 Self::Approve(element) => ::core::fmt::Display::fmt(element, f),
371 Self::BalanceOf(element) => ::core::fmt::Display::fmt(element, f),
372 Self::TotalSupply(element) => ::core::fmt::Display::fmt(element, f),
373 Self::Transfer(element) => ::core::fmt::Display::fmt(element, f),
374 Self::TransferFrom(element) => ::core::fmt::Display::fmt(element, f),
375 }
376 }
377 }
378 impl ::core::convert::From<AllowanceCall> for IERC20Calls {
379 fn from(value: AllowanceCall) -> Self {
380 Self::Allowance(value)
381 }
382 }
383 impl ::core::convert::From<ApproveCall> for IERC20Calls {
384 fn from(value: ApproveCall) -> Self {
385 Self::Approve(value)
386 }
387 }
388 impl ::core::convert::From<BalanceOfCall> for IERC20Calls {
389 fn from(value: BalanceOfCall) -> Self {
390 Self::BalanceOf(value)
391 }
392 }
393 impl ::core::convert::From<TotalSupplyCall> for IERC20Calls {
394 fn from(value: TotalSupplyCall) -> Self {
395 Self::TotalSupply(value)
396 }
397 }
398 impl ::core::convert::From<TransferCall> for IERC20Calls {
399 fn from(value: TransferCall) -> Self {
400 Self::Transfer(value)
401 }
402 }
403 impl ::core::convert::From<TransferFromCall> for IERC20Calls {
404 fn from(value: TransferFromCall) -> Self {
405 Self::TransferFrom(value)
406 }
407 }
408 #[derive(
410 Clone,
411 ::ethers_contract::EthAbiType,
412 ::ethers_contract::EthAbiCodec,
413 Default,
414 Debug,
415 PartialEq,
416 Eq,
417 Hash
418 )]
419 pub struct AllowanceReturn(pub ::ethers_core::types::U256);
420 #[derive(
422 Clone,
423 ::ethers_contract::EthAbiType,
424 ::ethers_contract::EthAbiCodec,
425 Default,
426 Debug,
427 PartialEq,
428 Eq,
429 Hash
430 )]
431 pub struct ApproveReturn(pub bool);
432 #[derive(
434 Clone,
435 ::ethers_contract::EthAbiType,
436 ::ethers_contract::EthAbiCodec,
437 Default,
438 Debug,
439 PartialEq,
440 Eq,
441 Hash
442 )]
443 pub struct BalanceOfReturn(pub ::ethers_core::types::U256);
444 #[derive(
446 Clone,
447 ::ethers_contract::EthAbiType,
448 ::ethers_contract::EthAbiCodec,
449 Default,
450 Debug,
451 PartialEq,
452 Eq,
453 Hash
454 )]
455 pub struct TotalSupplyReturn(pub ::ethers_core::types::U256);
456 #[derive(
458 Clone,
459 ::ethers_contract::EthAbiType,
460 ::ethers_contract::EthAbiCodec,
461 Default,
462 Debug,
463 PartialEq,
464 Eq,
465 Hash
466 )]
467 pub struct TransferReturn(pub bool);
468 #[derive(
470 Clone,
471 ::ethers_contract::EthAbiType,
472 ::ethers_contract::EthAbiCodec,
473 Default,
474 Debug,
475 PartialEq,
476 Eq,
477 Hash
478 )]
479 pub struct TransferFromReturn(pub bool);
480}