1pub use i_votes::*;
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 i_votes {
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\":[{\"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 IVOTES_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 IVotes<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for IVotes<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for IVotes<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 IVotes<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for IVotes<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(IVotes)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> IVotes<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 IVOTES_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn delegate(
57 &self,
58 delegatee: ::ethers_core::types::Address,
59 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
60 self.0
61 .method_hash([92, 25, 169, 92], delegatee)
62 .expect("method not found (this should never happen)")
63 }
64 pub fn delegate_by_sig(
66 &self,
67 delegatee: ::ethers_core::types::Address,
68 nonce: ::ethers_core::types::U256,
69 expiry: ::ethers_core::types::U256,
70 v: u8,
71 r: [u8; 32],
72 s: [u8; 32],
73 ) -> ::ethers_contract::builders::ContractCall<M, ()> {
74 self.0
75 .method_hash([195, 205, 165, 32], (delegatee, nonce, expiry, v, r, s))
76 .expect("method not found (this should never happen)")
77 }
78 pub fn delegates(
80 &self,
81 account: ::ethers_core::types::Address,
82 ) -> ::ethers_contract::builders::ContractCall<
83 M,
84 ::ethers_core::types::Address,
85 > {
86 self.0
87 .method_hash([88, 124, 222, 30], account)
88 .expect("method not found (this should never happen)")
89 }
90 pub fn get_past_total_supply(
92 &self,
93 timepoint: ::ethers_core::types::U256,
94 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
95 self.0
96 .method_hash([142, 83, 158, 140], timepoint)
97 .expect("method not found (this should never happen)")
98 }
99 pub fn get_past_votes(
101 &self,
102 account: ::ethers_core::types::Address,
103 timepoint: ::ethers_core::types::U256,
104 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
105 self.0
106 .method_hash([58, 70, 177, 168], (account, timepoint))
107 .expect("method not found (this should never happen)")
108 }
109 pub fn get_votes(
111 &self,
112 account: ::ethers_core::types::Address,
113 ) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
114 self.0
115 .method_hash([154, 178, 78, 176], account)
116 .expect("method not found (this should never happen)")
117 }
118 pub fn delegate_changed_filter(
120 &self,
121 ) -> ::ethers_contract::builders::Event<
122 ::std::sync::Arc<M>,
123 M,
124 DelegateChangedFilter,
125 > {
126 self.0.event()
127 }
128 pub fn delegate_votes_changed_filter(
130 &self,
131 ) -> ::ethers_contract::builders::Event<
132 ::std::sync::Arc<M>,
133 M,
134 DelegateVotesChangedFilter,
135 > {
136 self.0.event()
137 }
138 pub fn events(
140 &self,
141 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, IVotesEvents> {
142 self.0.event_with_filter(::core::default::Default::default())
143 }
144 }
145 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
146 for IVotes<M> {
147 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
148 Self::new(contract.address(), contract.client())
149 }
150 }
151 #[derive(
152 Clone,
153 ::ethers_contract::EthEvent,
154 ::ethers_contract::EthDisplay,
155 Default,
156 Debug,
157 PartialEq,
158 Eq,
159 Hash
160 )]
161 #[ethevent(
162 name = "DelegateChanged",
163 abi = "DelegateChanged(address,address,address)"
164 )]
165 pub struct DelegateChangedFilter {
166 #[ethevent(indexed)]
167 pub delegator: ::ethers_core::types::Address,
168 #[ethevent(indexed)]
169 pub from_delegate: ::ethers_core::types::Address,
170 #[ethevent(indexed)]
171 pub to_delegate: ::ethers_core::types::Address,
172 }
173 #[derive(
174 Clone,
175 ::ethers_contract::EthEvent,
176 ::ethers_contract::EthDisplay,
177 Default,
178 Debug,
179 PartialEq,
180 Eq,
181 Hash
182 )]
183 #[ethevent(
184 name = "DelegateVotesChanged",
185 abi = "DelegateVotesChanged(address,uint256,uint256)"
186 )]
187 pub struct DelegateVotesChangedFilter {
188 #[ethevent(indexed)]
189 pub delegate: ::ethers_core::types::Address,
190 pub previous_balance: ::ethers_core::types::U256,
191 pub new_balance: ::ethers_core::types::U256,
192 }
193 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
195 pub enum IVotesEvents {
196 DelegateChangedFilter(DelegateChangedFilter),
197 DelegateVotesChangedFilter(DelegateVotesChangedFilter),
198 }
199 impl ::ethers_contract::EthLogDecode for IVotesEvents {
200 fn decode_log(
201 log: &::ethers_core::abi::RawLog,
202 ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
203 if let Ok(decoded) = DelegateChangedFilter::decode_log(log) {
204 return Ok(IVotesEvents::DelegateChangedFilter(decoded));
205 }
206 if let Ok(decoded) = DelegateVotesChangedFilter::decode_log(log) {
207 return Ok(IVotesEvents::DelegateVotesChangedFilter(decoded));
208 }
209 Err(::ethers_core::abi::Error::InvalidData)
210 }
211 }
212 impl ::core::fmt::Display for IVotesEvents {
213 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
214 match self {
215 Self::DelegateChangedFilter(element) => {
216 ::core::fmt::Display::fmt(element, f)
217 }
218 Self::DelegateVotesChangedFilter(element) => {
219 ::core::fmt::Display::fmt(element, f)
220 }
221 }
222 }
223 }
224 impl ::core::convert::From<DelegateChangedFilter> for IVotesEvents {
225 fn from(value: DelegateChangedFilter) -> Self {
226 Self::DelegateChangedFilter(value)
227 }
228 }
229 impl ::core::convert::From<DelegateVotesChangedFilter> for IVotesEvents {
230 fn from(value: DelegateVotesChangedFilter) -> Self {
231 Self::DelegateVotesChangedFilter(value)
232 }
233 }
234 #[derive(
236 Clone,
237 ::ethers_contract::EthCall,
238 ::ethers_contract::EthDisplay,
239 Default,
240 Debug,
241 PartialEq,
242 Eq,
243 Hash
244 )]
245 #[ethcall(name = "delegate", abi = "delegate(address)")]
246 pub struct DelegateCall {
247 pub delegatee: ::ethers_core::types::Address,
248 }
249 #[derive(
251 Clone,
252 ::ethers_contract::EthCall,
253 ::ethers_contract::EthDisplay,
254 Default,
255 Debug,
256 PartialEq,
257 Eq,
258 Hash
259 )]
260 #[ethcall(
261 name = "delegateBySig",
262 abi = "delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)"
263 )]
264 pub struct DelegateBySigCall {
265 pub delegatee: ::ethers_core::types::Address,
266 pub nonce: ::ethers_core::types::U256,
267 pub expiry: ::ethers_core::types::U256,
268 pub v: u8,
269 pub r: [u8; 32],
270 pub s: [u8; 32],
271 }
272 #[derive(
274 Clone,
275 ::ethers_contract::EthCall,
276 ::ethers_contract::EthDisplay,
277 Default,
278 Debug,
279 PartialEq,
280 Eq,
281 Hash
282 )]
283 #[ethcall(name = "delegates", abi = "delegates(address)")]
284 pub struct DelegatesCall {
285 pub account: ::ethers_core::types::Address,
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 = "getPastTotalSupply", abi = "getPastTotalSupply(uint256)")]
299 pub struct GetPastTotalSupplyCall {
300 pub timepoint: ::ethers_core::types::U256,
301 }
302 #[derive(
304 Clone,
305 ::ethers_contract::EthCall,
306 ::ethers_contract::EthDisplay,
307 Default,
308 Debug,
309 PartialEq,
310 Eq,
311 Hash
312 )]
313 #[ethcall(name = "getPastVotes", abi = "getPastVotes(address,uint256)")]
314 pub struct GetPastVotesCall {
315 pub account: ::ethers_core::types::Address,
316 pub timepoint: ::ethers_core::types::U256,
317 }
318 #[derive(
320 Clone,
321 ::ethers_contract::EthCall,
322 ::ethers_contract::EthDisplay,
323 Default,
324 Debug,
325 PartialEq,
326 Eq,
327 Hash
328 )]
329 #[ethcall(name = "getVotes", abi = "getVotes(address)")]
330 pub struct GetVotesCall {
331 pub account: ::ethers_core::types::Address,
332 }
333 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
335 pub enum IVotesCalls {
336 Delegate(DelegateCall),
337 DelegateBySig(DelegateBySigCall),
338 Delegates(DelegatesCall),
339 GetPastTotalSupply(GetPastTotalSupplyCall),
340 GetPastVotes(GetPastVotesCall),
341 GetVotes(GetVotesCall),
342 }
343 impl ::ethers_core::abi::AbiDecode for IVotesCalls {
344 fn decode(
345 data: impl AsRef<[u8]>,
346 ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
347 let data = data.as_ref();
348 if let Ok(decoded)
349 = <DelegateCall as ::ethers_core::abi::AbiDecode>::decode(data) {
350 return Ok(Self::Delegate(decoded));
351 }
352 if let Ok(decoded)
353 = <DelegateBySigCall as ::ethers_core::abi::AbiDecode>::decode(data) {
354 return Ok(Self::DelegateBySig(decoded));
355 }
356 if let Ok(decoded)
357 = <DelegatesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
358 return Ok(Self::Delegates(decoded));
359 }
360 if let Ok(decoded)
361 = <GetPastTotalSupplyCall as ::ethers_core::abi::AbiDecode>::decode(
362 data,
363 ) {
364 return Ok(Self::GetPastTotalSupply(decoded));
365 }
366 if let Ok(decoded)
367 = <GetPastVotesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
368 return Ok(Self::GetPastVotes(decoded));
369 }
370 if let Ok(decoded)
371 = <GetVotesCall as ::ethers_core::abi::AbiDecode>::decode(data) {
372 return Ok(Self::GetVotes(decoded));
373 }
374 Err(::ethers_core::abi::Error::InvalidData.into())
375 }
376 }
377 impl ::ethers_core::abi::AbiEncode for IVotesCalls {
378 fn encode(self) -> Vec<u8> {
379 match self {
380 Self::Delegate(element) => ::ethers_core::abi::AbiEncode::encode(element),
381 Self::DelegateBySig(element) => {
382 ::ethers_core::abi::AbiEncode::encode(element)
383 }
384 Self::Delegates(element) => {
385 ::ethers_core::abi::AbiEncode::encode(element)
386 }
387 Self::GetPastTotalSupply(element) => {
388 ::ethers_core::abi::AbiEncode::encode(element)
389 }
390 Self::GetPastVotes(element) => {
391 ::ethers_core::abi::AbiEncode::encode(element)
392 }
393 Self::GetVotes(element) => ::ethers_core::abi::AbiEncode::encode(element),
394 }
395 }
396 }
397 impl ::core::fmt::Display for IVotesCalls {
398 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
399 match self {
400 Self::Delegate(element) => ::core::fmt::Display::fmt(element, f),
401 Self::DelegateBySig(element) => ::core::fmt::Display::fmt(element, f),
402 Self::Delegates(element) => ::core::fmt::Display::fmt(element, f),
403 Self::GetPastTotalSupply(element) => {
404 ::core::fmt::Display::fmt(element, f)
405 }
406 Self::GetPastVotes(element) => ::core::fmt::Display::fmt(element, f),
407 Self::GetVotes(element) => ::core::fmt::Display::fmt(element, f),
408 }
409 }
410 }
411 impl ::core::convert::From<DelegateCall> for IVotesCalls {
412 fn from(value: DelegateCall) -> Self {
413 Self::Delegate(value)
414 }
415 }
416 impl ::core::convert::From<DelegateBySigCall> for IVotesCalls {
417 fn from(value: DelegateBySigCall) -> Self {
418 Self::DelegateBySig(value)
419 }
420 }
421 impl ::core::convert::From<DelegatesCall> for IVotesCalls {
422 fn from(value: DelegatesCall) -> Self {
423 Self::Delegates(value)
424 }
425 }
426 impl ::core::convert::From<GetPastTotalSupplyCall> for IVotesCalls {
427 fn from(value: GetPastTotalSupplyCall) -> Self {
428 Self::GetPastTotalSupply(value)
429 }
430 }
431 impl ::core::convert::From<GetPastVotesCall> for IVotesCalls {
432 fn from(value: GetPastVotesCall) -> Self {
433 Self::GetPastVotes(value)
434 }
435 }
436 impl ::core::convert::From<GetVotesCall> for IVotesCalls {
437 fn from(value: GetVotesCall) -> Self {
438 Self::GetVotes(value)
439 }
440 }
441 #[derive(
443 Clone,
444 ::ethers_contract::EthAbiType,
445 ::ethers_contract::EthAbiCodec,
446 Default,
447 Debug,
448 PartialEq,
449 Eq,
450 Hash
451 )]
452 pub struct DelegatesReturn(pub ::ethers_core::types::Address);
453 #[derive(
455 Clone,
456 ::ethers_contract::EthAbiType,
457 ::ethers_contract::EthAbiCodec,
458 Default,
459 Debug,
460 PartialEq,
461 Eq,
462 Hash
463 )]
464 pub struct GetPastTotalSupplyReturn(pub ::ethers_core::types::U256);
465 #[derive(
467 Clone,
468 ::ethers_contract::EthAbiType,
469 ::ethers_contract::EthAbiCodec,
470 Default,
471 Debug,
472 PartialEq,
473 Eq,
474 Hash
475 )]
476 pub struct GetPastVotesReturn(pub ::ethers_core::types::U256);
477 #[derive(
479 Clone,
480 ::ethers_contract::EthAbiType,
481 ::ethers_contract::EthAbiCodec,
482 Default,
483 Debug,
484 PartialEq,
485 Eq,
486 Hash
487 )]
488 pub struct GetVotesReturn(pub ::ethers_core::types::U256);
489}