1pub use ierc5805::*;
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 ierc5805 {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"fromDelegate\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"toDelegate\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"DelegateChanged\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"previousBalance\",\"type\":\"uint256\",\"components\":[],\"indexed\":false},{\"internalType\":\"uint256\",\"name\":\"newBalance\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"DelegateVotesChanged\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"CLOCK_MODE\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"clock\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"\",\"type\":\"uint48\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"delegate\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"delegatee\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"expiry\",\"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\":\"delegateBySig\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"delegates\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"timepoint\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"getPastTotalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"timepoint\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"getPastVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"getVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]}]";
15 pub static IERC5805_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 IERC5805<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for IERC5805<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for IERC5805<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 IERC5805<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for IERC5805<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(IERC5805)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> IERC5805<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 IERC5805_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn clock_mode(
57 &self,
58 ) -> ::ethers_contract::builders::ContractCall<M, ::std::string::String> {
59 self.0
60 .method_hash([75, 245, 215, 233], ())
61 .expect("method not found (this should never happen)")
62 }
63 pub fn clock(&self) -> ::ethers_contract::builders::ContractCall<M, u64> {
65 self.0
66 .method_hash([145, 221, 173, 244], ())
67 .expect("method not found (this should never happen)")
68 }
69 pub fn delegate(
71 &self,
72 delegatee: ::ethers_core::types::Address,
73 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
74 self.0
75 .method_hash([92, 25, 169, 92], delegatee)
76 .expect("method not found (this should never happen)")
77 }
78 pub fn delegate_by_sig(
80 &self,
81 delegatee: ::ethers_core::types::Address,
82 nonce: ::ethers_core::types::U256,
83 expiry: ::ethers_core::types::U256,
84 v: u8,
85 r: [u8; 32],
86 s: [u8; 32],
87 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
88 self.0
89 .method_hash([195, 205, 165, 32], (delegatee, nonce, expiry, v, r, s))
90 .expect("method not found (this should never happen)")
91 }
92 pub fn delegates(
94 &self,
95 account: ::ethers_core::types::Address,
96 ) -> ::ethers_contract::builders::ContractCall<
97 M,
98 ::ethers_core::types::Address,
99 > {
100 self.0
101 .method_hash([88, 124, 222, 30], account)
102 .expect("method not found (this should never happen)")
103 }
104 pub fn get_past_total_supply(
106 &self,
107 timepoint: ::ethers_core::types::U256,
108 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
109 self.0
110 .method_hash([142, 83, 158, 140], timepoint)
111 .expect("method not found (this should never happen)")
112 }
113 pub fn get_past_votes(
115 &self,
116 account: ::ethers_core::types::Address,
117 timepoint: ::ethers_core::types::U256,
118 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
119 self.0
120 .method_hash([58, 70, 177, 168], (account, timepoint))
121 .expect("method not found (this should never happen)")
122 }
123 pub fn get_votes(
125 &self,
126 account: ::ethers_core::types::Address,
127 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
128 self.0
129 .method_hash([154, 178, 78, 176], account)
130 .expect("method not found (this should never happen)")
131 }
132 pub fn delegate_changed_filter(
134 &self,
135 ) -> ::ethers_contract::builders::Event<
136 ::std::sync::Arc<M>,
137 M,
138 DelegateChangedFilter,
139 > {
140 self.0.event()
141 }
142 pub fn delegate_votes_changed_filter(
144 &self,
145 ) -> ::ethers_contract::builders::Event<
146 ::std::sync::Arc<M>,
147 M,
148 DelegateVotesChangedFilter,
149 > {
150 self.0.event()
151 }
152 pub fn events(
154 &self,
155 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, IERC5805Events> {
156 self.0.event_with_filter(::core::default::Default::default())
157 }
158 }
159 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
160 for IERC5805<M> {
161 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
162 Self::new(contract.address(), contract.client())
163 }
164 }
165 #[derive(
166 Clone,
167 ::ethers_contract::EthEvent,
168 ::ethers_contract::EthDisplay,
169 Default,
170 Debug,
171 PartialEq,
172 Eq,
173 Hash
174 )]
175 #[ethevent(
176 name = "DelegateChanged",
177 abi = "DelegateChanged(address,address,address)"
178 )]
179 pub struct DelegateChangedFilter {
180 #[ethevent(indexed)]
181 pub delegator: ::ethers_core::types::Address,
182 #[ethevent(indexed)]
183 pub from_delegate: ::ethers_core::types::Address,
184 #[ethevent(indexed)]
185 pub to_delegate: ::ethers_core::types::Address,
186 }
187 #[derive(
188 Clone,
189 ::ethers_contract::EthEvent,
190 ::ethers_contract::EthDisplay,
191 Default,
192 Debug,
193 PartialEq,
194 Eq,
195 Hash
196 )]
197 #[ethevent(
198 name = "DelegateVotesChanged",
199 abi = "DelegateVotesChanged(address,uint256,uint256)"
200 )]
201 pub struct DelegateVotesChangedFilter {
202 #[ethevent(indexed)]
203 pub delegate: ::ethers_core::types::Address,
204 pub previous_balance: ::ethers_core::types::U256,
205 pub new_balance: ::ethers_core::types::U256,
206 }
207 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
209 pub enum IERC5805Events {
210 DelegateChangedFilter(DelegateChangedFilter),
211 DelegateVotesChangedFilter(DelegateVotesChangedFilter),
212 }
213 impl ::ethers_contract::EthLogDecode for IERC5805Events {
214 fn decode_log(
215 log: &::ethers_core::abi::RawLog,
216 ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
217 if let Ok(decoded) = DelegateChangedFilter::decode_log(log) {
218 return Ok(IERC5805Events::DelegateChangedFilter(decoded));
219 }
220 if let Ok(decoded) = DelegateVotesChangedFilter::decode_log(log) {
221 return Ok(IERC5805Events::DelegateVotesChangedFilter(decoded));
222 }
223 Err(::ethers_core::abi::Error::InvalidData)
224 }
225 }
226 impl ::core::fmt::Display for IERC5805Events {
227 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
228 match self {
229 Self::DelegateChangedFilter(element) => {
230 ::core::fmt::Display::fmt(element, f)
231 }
232 Self::DelegateVotesChangedFilter(element) => {
233 ::core::fmt::Display::fmt(element, f)
234 }
235 }
236 }
237 }
238 impl ::core::convert::From<DelegateChangedFilter> for IERC5805Events {
239 fn from(value: DelegateChangedFilter) -> Self {
240 Self::DelegateChangedFilter(value)
241 }
242 }
243 impl ::core::convert::From<DelegateVotesChangedFilter> for IERC5805Events {
244 fn from(value: DelegateVotesChangedFilter) -> Self {
245 Self::DelegateVotesChangedFilter(value)
246 }
247 }
248 #[derive(
250 Clone,
251 ::ethers_contract::EthCall,
252 ::ethers_contract::EthDisplay,
253 Default,
254 Debug,
255 PartialEq,
256 Eq,
257 Hash
258 )]
259 #[ethcall(name = "CLOCK_MODE", abi = "CLOCK_MODE()")]
260 pub struct ClockModeCall;
261 #[derive(
263 Clone,
264 ::ethers_contract::EthCall,
265 ::ethers_contract::EthDisplay,
266 Default,
267 Debug,
268 PartialEq,
269 Eq,
270 Hash
271 )]
272 #[ethcall(name = "clock", abi = "clock()")]
273 pub struct ClockCall;
274 #[derive(
276 Clone,
277 ::ethers_contract::EthCall,
278 ::ethers_contract::EthDisplay,
279 Default,
280 Debug,
281 PartialEq,
282 Eq,
283 Hash
284 )]
285 #[ethcall(name = "delegate", abi = "delegate(address)")]
286 pub struct DelegateCall {
287 pub delegatee: ::ethers_core::types::Address,
288 }
289 #[derive(
291 Clone,
292 ::ethers_contract::EthCall,
293 ::ethers_contract::EthDisplay,
294 Default,
295 Debug,
296 PartialEq,
297 Eq,
298 Hash
299 )]
300 #[ethcall(
301 name = "delegateBySig",
302 abi = "delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)"
303 )]
304 pub struct DelegateBySigCall {
305 pub delegatee: ::ethers_core::types::Address,
306 pub nonce: ::ethers_core::types::U256,
307 pub expiry: ::ethers_core::types::U256,
308 pub v: u8,
309 pub r: [u8; 32],
310 pub s: [u8; 32],
311 }
312 #[derive(
314 Clone,
315 ::ethers_contract::EthCall,
316 ::ethers_contract::EthDisplay,
317 Default,
318 Debug,
319 PartialEq,
320 Eq,
321 Hash
322 )]
323 #[ethcall(name = "delegates", abi = "delegates(address)")]
324 pub struct DelegatesCall {
325 pub account: ::ethers_core::types::Address,
326 }
327 #[derive(
329 Clone,
330 ::ethers_contract::EthCall,
331 ::ethers_contract::EthDisplay,
332 Default,
333 Debug,
334 PartialEq,
335 Eq,
336 Hash
337 )]
338 #[ethcall(name = "getPastTotalSupply", abi = "getPastTotalSupply(uint256)")]
339 pub struct GetPastTotalSupplyCall {
340 pub timepoint: ::ethers_core::types::U256,
341 }
342 #[derive(
344 Clone,
345 ::ethers_contract::EthCall,
346 ::ethers_contract::EthDisplay,
347 Default,
348 Debug,
349 PartialEq,
350 Eq,
351 Hash
352 )]
353 #[ethcall(name = "getPastVotes", abi = "getPastVotes(address,uint256)")]
354 pub struct GetPastVotesCall {
355 pub account: ::ethers_core::types::Address,
356 pub timepoint: ::ethers_core::types::U256,
357 }
358 #[derive(
360 Clone,
361 ::ethers_contract::EthCall,
362 ::ethers_contract::EthDisplay,
363 Default,
364 Debug,
365 PartialEq,
366 Eq,
367 Hash
368 )]
369 #[ethcall(name = "getVotes", abi = "getVotes(address)")]
370 pub struct GetVotesCall {
371 pub account: ::ethers_core::types::Address,
372 }
373 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
375 pub enum IERC5805Calls {
376 ClockMode(ClockModeCall),
377 Clock(ClockCall),
378 Delegate(DelegateCall),
379 DelegateBySig(DelegateBySigCall),
380 Delegates(DelegatesCall),
381 GetPastTotalSupply(GetPastTotalSupplyCall),
382 GetPastVotes(GetPastVotesCall),
383 GetVotes(GetVotesCall),
384 }
385 impl ::ethers_core::abi::AbiDecode for IERC5805Calls {
386 fn decode(
387 data: impl AsRef<[u8]>,
388 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
389 let data = data.as_ref();
390 if let Ok(decoded)
391 = <ClockModeCall as ::ethers_core::abi::AbiDecode>::decode(data) {
392 return Ok(Self::ClockMode(decoded));
393 }
394 if let Ok(decoded)
395 = <ClockCall as ::ethers_core::abi::AbiDecode>::decode(data) {
396 return Ok(Self::Clock(decoded));
397 }
398 if let Ok(decoded)
399 = <DelegateCall as ::ethers_core::abi::AbiDecode>::decode(data) {
400 return Ok(Self::Delegate(decoded));
401 }
402 if let Ok(decoded)
403 = <DelegateBySigCall as ::ethers_core::abi::AbiDecode>::decode(data) {
404 return Ok(Self::DelegateBySig(decoded));
405 }
406 if let Ok(decoded)
407 = <DelegatesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
408 return Ok(Self::Delegates(decoded));
409 }
410 if let Ok(decoded)
411 = <GetPastTotalSupplyCall as ::ethers_core::abi::AbiDecode>::decode(
412 data,
413 ) {
414 return Ok(Self::GetPastTotalSupply(decoded));
415 }
416 if let Ok(decoded)
417 = <GetPastVotesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
418 return Ok(Self::GetPastVotes(decoded));
419 }
420 if let Ok(decoded)
421 = <GetVotesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
422 return Ok(Self::GetVotes(decoded));
423 }
424 Err(::ethers_core::abi::Error::InvalidData.into())
425 }
426 }
427 impl ::ethers_core::abi::AbiEncode for IERC5805Calls {
428 fn encode(self) -> Vec<u8> {
429 match self {
430 Self::ClockMode(element) => {
431 ::ethers_core::abi::AbiEncode::encode(element)
432 }
433 Self::Clock(element) => ::ethers_core::abi::AbiEncode::encode(element),
434 Self::Delegate(element) => ::ethers_core::abi::AbiEncode::encode(element),
435 Self::DelegateBySig(element) => {
436 ::ethers_core::abi::AbiEncode::encode(element)
437 }
438 Self::Delegates(element) => {
439 ::ethers_core::abi::AbiEncode::encode(element)
440 }
441 Self::GetPastTotalSupply(element) => {
442 ::ethers_core::abi::AbiEncode::encode(element)
443 }
444 Self::GetPastVotes(element) => {
445 ::ethers_core::abi::AbiEncode::encode(element)
446 }
447 Self::GetVotes(element) => ::ethers_core::abi::AbiEncode::encode(element),
448 }
449 }
450 }
451 impl ::core::fmt::Display for IERC5805Calls {
452 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
453 match self {
454 Self::ClockMode(element) => ::core::fmt::Display::fmt(element, f),
455 Self::Clock(element) => ::core::fmt::Display::fmt(element, f),
456 Self::Delegate(element) => ::core::fmt::Display::fmt(element, f),
457 Self::DelegateBySig(element) => ::core::fmt::Display::fmt(element, f),
458 Self::Delegates(element) => ::core::fmt::Display::fmt(element, f),
459 Self::GetPastTotalSupply(element) => {
460 ::core::fmt::Display::fmt(element, f)
461 }
462 Self::GetPastVotes(element) => ::core::fmt::Display::fmt(element, f),
463 Self::GetVotes(element) => ::core::fmt::Display::fmt(element, f),
464 }
465 }
466 }
467 impl ::core::convert::From<ClockModeCall> for IERC5805Calls {
468 fn from(value: ClockModeCall) -> Self {
469 Self::ClockMode(value)
470 }
471 }
472 impl ::core::convert::From<ClockCall> for IERC5805Calls {
473 fn from(value: ClockCall) -> Self {
474 Self::Clock(value)
475 }
476 }
477 impl ::core::convert::From<DelegateCall> for IERC5805Calls {
478 fn from(value: DelegateCall) -> Self {
479 Self::Delegate(value)
480 }
481 }
482 impl ::core::convert::From<DelegateBySigCall> for IERC5805Calls {
483 fn from(value: DelegateBySigCall) -> Self {
484 Self::DelegateBySig(value)
485 }
486 }
487 impl ::core::convert::From<DelegatesCall> for IERC5805Calls {
488 fn from(value: DelegatesCall) -> Self {
489 Self::Delegates(value)
490 }
491 }
492 impl ::core::convert::From<GetPastTotalSupplyCall> for IERC5805Calls {
493 fn from(value: GetPastTotalSupplyCall) -> Self {
494 Self::GetPastTotalSupply(value)
495 }
496 }
497 impl ::core::convert::From<GetPastVotesCall> for IERC5805Calls {
498 fn from(value: GetPastVotesCall) -> Self {
499 Self::GetPastVotes(value)
500 }
501 }
502 impl ::core::convert::From<GetVotesCall> for IERC5805Calls {
503 fn from(value: GetVotesCall) -> Self {
504 Self::GetVotes(value)
505 }
506 }
507 #[derive(
509 Clone,
510 ::ethers_contract::EthAbiType,
511 ::ethers_contract::EthAbiCodec,
512 Default,
513 Debug,
514 PartialEq,
515 Eq,
516 Hash
517 )]
518 pub struct ClockModeReturn(pub ::std::string::String);
519 #[derive(
521 Clone,
522 ::ethers_contract::EthAbiType,
523 ::ethers_contract::EthAbiCodec,
524 Default,
525 Debug,
526 PartialEq,
527 Eq,
528 Hash
529 )]
530 pub struct ClockReturn(pub u64);
531 #[derive(
533 Clone,
534 ::ethers_contract::EthAbiType,
535 ::ethers_contract::EthAbiCodec,
536 Default,
537 Debug,
538 PartialEq,
539 Eq,
540 Hash
541 )]
542 pub struct DelegatesReturn(pub ::ethers_core::types::Address);
543 #[derive(
545 Clone,
546 ::ethers_contract::EthAbiType,
547 ::ethers_contract::EthAbiCodec,
548 Default,
549 Debug,
550 PartialEq,
551 Eq,
552 Hash
553 )]
554 pub struct GetPastTotalSupplyReturn(pub ::ethers_core::types::U256);
555 #[derive(
557 Clone,
558 ::ethers_contract::EthAbiType,
559 ::ethers_contract::EthAbiCodec,
560 Default,
561 Debug,
562 PartialEq,
563 Eq,
564 Hash
565 )]
566 pub struct GetPastVotesReturn(pub ::ethers_core::types::U256);
567 #[derive(
569 Clone,
570 ::ethers_contract::EthAbiType,
571 ::ethers_contract::EthAbiCodec,
572 Default,
573 Debug,
574 PartialEq,
575 Eq,
576 Hash
577 )]
578 pub struct GetVotesReturn(pub ::ethers_core::types::U256);
579}