niftygate_bindings/openzeppelin/contracts_upgradeable/generated/
pausable_upgradeable.rs

1#[allow(dead_code)]
2pub mod pausable_upgradeable {
3  # [rustfmt :: skip] use ethcontract as ethcontract ;
4  #[doc = "Generated by `ethcontract`"]
5  #[derive(Clone)]
6  pub struct Contract {
7    methods: Methods,
8  }
9  impl Contract {
10    #[doc = r" Retrieves the raw contract instance used to generate the type safe"]
11    #[doc = r" API for this contract."]
12    pub fn raw_contract() -> &'static self::ethcontract::Contract {
13      use self::ethcontract::common::artifact::truffle::TruffleLoader;
14      use self::ethcontract::private::lazy_static;
15      use self::ethcontract::Contract;
16      lazy_static! {
17        pub static ref CONTRACT: Contract = {
18          # [allow (unused_mut)] let mut contract = TruffleLoader :: new () . load_contract_from_str ("{\"contractName\":\"PausableUpgradeable\",\"abi\":[{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"constant\":false,\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false}],\"anonymous\":false}],\"bytecode\":\"\",\"networks\":{},\"devdoc\":{\"details\":null,\"methods\":{}},\"userdoc\":{\"details\":null,\"methods\":{}}}") . expect ("valid contract JSON") ;
19          contract
20        };
21      }
22      &CONTRACT
23    }
24    #[doc = r" Creates a new contract instance with the specified `web3`"]
25    #[doc = r" provider at the given `Address`."]
26    #[doc = r""]
27    #[doc = r" Note that this does not verify that a contract with a matching"]
28    #[doc = r" `Abi` is actually deployed at the given address."]
29    pub fn at<F, B, T>(
30      web3: &self::ethcontract::web3::api::Web3<T>,
31      address: self::ethcontract::Address,
32    ) -> Self
33    where
34      F: std::future::Future<
35          Output = Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>,
36        > + Send
37        + 'static,
38      B: std::future::Future<
39          Output = Result<
40            Vec<Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>>,
41            self::ethcontract::web3::Error,
42          >,
43        > + Send
44        + 'static,
45      T: self::ethcontract::web3::Transport<Out = F>
46        + self::ethcontract::web3::BatchTransport<Batch = B>
47        + Send
48        + Sync
49        + 'static,
50    {
51      Contract::with_deployment_info(web3, address, None)
52    }
53    #[doc = r" Creates a new contract instance with the specified `web3` provider with"]
54    #[doc = r" the given `Abi` at the given `Address` and an optional transaction hash."]
55    #[doc = r" This hash is used to retrieve contract related information such as the"]
56    #[doc = r" creation block (which is useful for fetching all historic events)."]
57    #[doc = r""]
58    #[doc = r" Note that this does not verify that a contract with a matching `Abi` is"]
59    #[doc = r" actually deployed at the given address nor that the transaction hash,"]
60    #[doc = r" when provided, is actually for this contract deployment."]
61    pub fn with_deployment_info<F, B, T>(
62      web3: &self::ethcontract::web3::api::Web3<T>,
63      address: self::ethcontract::Address,
64      deployment_information: Option<ethcontract::common::DeploymentInformation>,
65    ) -> Self
66    where
67      F: std::future::Future<
68          Output = Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>,
69        > + Send
70        + 'static,
71      B: std::future::Future<
72          Output = Result<
73            Vec<Result<self::ethcontract::json::Value, self::ethcontract::web3::Error>>,
74            self::ethcontract::web3::Error,
75          >,
76        > + Send
77        + 'static,
78      T: self::ethcontract::web3::Transport<Out = F>
79        + self::ethcontract::web3::BatchTransport<Batch = B>
80        + Send
81        + Sync
82        + 'static,
83    {
84      use self::ethcontract::transport::DynTransport;
85      use self::ethcontract::web3::api::Web3;
86      use self::ethcontract::Instance;
87      let transport = DynTransport::new(web3.transport().clone());
88      let web3 = Web3::new(transport);
89      let abi = Self::raw_contract().abi.clone();
90      let instance = Instance::with_deployment_info(web3, abi, address, deployment_information);
91      Contract::from_raw(instance)
92    }
93    #[doc = r" Creates a contract from a raw instance."]
94    fn from_raw(instance: self::ethcontract::dyns::DynInstance) -> Self {
95      let methods = Methods { instance };
96      Contract { methods }
97    }
98    #[doc = r" Returns the contract address being used by this instance."]
99    pub fn address(&self) -> self::ethcontract::Address {
100      self.raw_instance().address()
101    }
102    #[doc = r" Returns the deployment information of the contract"]
103    #[doc = r" if it is known, `None` otherwise."]
104    pub fn deployment_information(&self) -> Option<ethcontract::common::DeploymentInformation> {
105      self.raw_instance().deployment_information()
106    }
107    #[doc = r" Returns a reference to the default method options used by this"]
108    #[doc = r" contract."]
109    pub fn defaults(&self) -> &self::ethcontract::contract::MethodDefaults {
110      &self.raw_instance().defaults
111    }
112    #[doc = r" Returns a mutable reference to the default method options used"]
113    #[doc = r" by this contract."]
114    pub fn defaults_mut(&mut self) -> &mut self::ethcontract::contract::MethodDefaults {
115      &mut self.raw_instance_mut().defaults
116    }
117    #[doc = r" Returns a reference to the raw runtime instance used by this"]
118    #[doc = r" contract."]
119    pub fn raw_instance(&self) -> &self::ethcontract::dyns::DynInstance {
120      &self.methods.instance
121    }
122    #[doc = r" Returns a mutable reference to the raw runtime instance used by"]
123    #[doc = r" this contract."]
124    fn raw_instance_mut(&mut self) -> &mut self::ethcontract::dyns::DynInstance {
125      &mut self.methods.instance
126    }
127  }
128  impl std::fmt::Debug for Contract {
129    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
130      f.debug_tuple(stringify!(PausableUpgradeable))
131        .field(&self.address())
132        .finish()
133    }
134  }
135  impl Contract {
136    #[doc = r" Returns an object that allows accessing typed method signatures."]
137    pub fn signatures() -> Signatures {
138      Signatures
139    }
140    #[doc = r" Retrieves a reference to type containing all the generated"]
141    #[doc = r" contract methods. This can be used for methods where the name"]
142    #[doc = r" would collide with a common method (like `at` or `deployed`)."]
143    pub fn methods(&self) -> &Methods {
144      &self.methods
145    }
146  }
147  #[doc = r" Type containing signatures for all methods for generated contract type."]
148  #[derive(Clone, Copy)]
149  pub struct Signatures;
150  impl Signatures {
151    #[doc = "Returns signature for method `paused():(bool)`."]
152    #[allow(clippy::type_complexity)]
153    pub fn paused(&self) -> self::ethcontract::contract::Signature<(), bool> {
154      self::ethcontract::contract::Signature::new([92, 151, 90, 187])
155    }
156  }
157  #[doc = r" Type containing all contract methods for generated contract type."]
158  #[derive(Clone)]
159  pub struct Methods {
160    instance: self::ethcontract::dyns::DynInstance,
161  }
162  #[allow(clippy::too_many_arguments, clippy::type_complexity)]
163  impl Methods {
164    #[doc = "Generated by `ethcontract`"]
165    pub fn paused(&self) -> self::ethcontract::dyns::DynViewMethodBuilder<bool> {
166      self
167        .instance
168        .view_method([92, 151, 90, 187], ())
169        .expect("generated call")
170    }
171  }
172  impl std::ops::Deref for Contract {
173    type Target = Methods;
174    fn deref(&self) -> &Self::Target {
175      &self.methods
176    }
177  }
178  #[doc = r" Module containing all generated data models for this contract's"]
179  #[doc = r" events."]
180  pub mod event_data {
181    use super::ethcontract;
182    #[derive(Clone, Debug, Default, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
183    pub struct Unpaused {
184      pub account: self::ethcontract::Address,
185    }
186    impl Unpaused {
187      #[doc = r" Retrieves the signature for the event this data corresponds to."]
188      #[doc = r" This signature is the Keccak-256 hash of the ABI signature of"]
189      #[doc = r" this event."]
190      pub fn signature() -> self::ethcontract::H256 {
191        self::ethcontract::H256([
192          93, 185, 238, 10, 73, 91, 242, 230, 255, 156, 145, 167, 131, 76, 27, 164, 253, 210, 68,
193          165, 232, 170, 78, 83, 123, 211, 138, 234, 228, 176, 115, 170,
194        ])
195      }
196      #[doc = r" Retrieves the ABI signature for the event this data corresponds"]
197      #[doc = r" to. For this event the value should always be:"]
198      #[doc = r""]
199      #[doc = "`Unpaused(address)`"]
200      pub fn abi_signature() -> &'static str {
201        "Unpaused(address)"
202      }
203    }
204    impl self::ethcontract::tokens::Tokenize for Unpaused {
205      fn from_token(
206        token: self::ethcontract::common::abi::Token,
207      ) -> Result<Self, self::ethcontract::tokens::Error> {
208        let (account,) = self::ethcontract::tokens::Tokenize::from_token(token)?;
209        Ok(Unpaused { account })
210      }
211      fn into_token(self) -> self::ethcontract::common::abi::Token {
212        unimplemented!("events are only decoded, not encoded")
213      }
214    }
215    #[derive(Clone, Debug, Default, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
216    pub struct Paused {
217      pub account: self::ethcontract::Address,
218    }
219    impl Paused {
220      #[doc = r" Retrieves the signature for the event this data corresponds to."]
221      #[doc = r" This signature is the Keccak-256 hash of the ABI signature of"]
222      #[doc = r" this event."]
223      pub fn signature() -> self::ethcontract::H256 {
224        self::ethcontract::H256([
225          98, 231, 140, 234, 1, 190, 227, 32, 205, 78, 66, 2, 112, 181, 234, 116, 0, 13, 17, 176,
226          201, 247, 71, 84, 235, 219, 252, 84, 75, 5, 162, 88,
227        ])
228      }
229      #[doc = r" Retrieves the ABI signature for the event this data corresponds"]
230      #[doc = r" to. For this event the value should always be:"]
231      #[doc = r""]
232      #[doc = "`Paused(address)`"]
233      pub fn abi_signature() -> &'static str {
234        "Paused(address)"
235      }
236    }
237    impl self::ethcontract::tokens::Tokenize for Paused {
238      fn from_token(
239        token: self::ethcontract::common::abi::Token,
240      ) -> Result<Self, self::ethcontract::tokens::Error> {
241        let (account,) = self::ethcontract::tokens::Tokenize::from_token(token)?;
242        Ok(Paused { account })
243      }
244      fn into_token(self) -> self::ethcontract::common::abi::Token {
245        unimplemented!("events are only decoded, not encoded")
246      }
247    }
248  }
249  impl Contract {
250    #[doc = r" Retrieves a handle to a type containing for creating event"]
251    #[doc = r" streams for all the contract events."]
252    pub fn events(&self) -> Events<'_> {
253      Events {
254        instance: self.raw_instance(),
255      }
256    }
257  }
258  pub struct Events<'a> {
259    instance: &'a self::ethcontract::dyns::DynInstance,
260  }
261  impl Events<'_> {
262    #[doc = r" Generated by `ethcontract`."]
263    pub fn unpaused(&self) -> self::event_builders::UnpausedBuilder {
264      self::event_builders::UnpausedBuilder(
265        self
266          .instance
267          .event(self::ethcontract::H256([
268            93, 185, 238, 10, 73, 91, 242, 230, 255, 156, 145, 167, 131, 76, 27, 164, 253, 210, 68,
269            165, 232, 170, 78, 83, 123, 211, 138, 234, 228, 176, 115, 170,
270          ]))
271          .expect("generated event filter"),
272      )
273    }
274    #[doc = r" Generated by `ethcontract`."]
275    pub fn paused(&self) -> self::event_builders::PausedBuilder {
276      self::event_builders::PausedBuilder(
277        self
278          .instance
279          .event(self::ethcontract::H256([
280            98, 231, 140, 234, 1, 190, 227, 32, 205, 78, 66, 2, 112, 181, 234, 116, 0, 13, 17, 176,
281            201, 247, 71, 84, 235, 219, 252, 84, 75, 5, 162, 88,
282          ]))
283          .expect("generated event filter"),
284      )
285    }
286  }
287  #[doc = r" Module containing the generated event stream builders with type safe"]
288  #[doc = r" filter methods for this contract's events."]
289  pub mod event_builders {
290    use super::ethcontract;
291    use super::event_data;
292    #[doc = "A builder for creating a filtered stream of `Unpaused` events."]
293    pub struct UnpausedBuilder(
294      #[doc = r" The inner event builder."]
295      pub  self::ethcontract::dyns::DynEventBuilder<self::event_data::Unpaused>,
296    );
297    impl UnpausedBuilder {
298      #[doc = r" Sets the starting block from which to stream logs for."]
299      #[doc = r""]
300      #[doc = r" If left unset defaults to the latest block."]
301      #[allow(clippy::wrong_self_convention)]
302      pub fn from_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
303        self.0 = (self.0).from_block(block);
304        self
305      }
306      #[doc = r" Sets the last block from which to stream logs for."]
307      #[doc = r""]
308      #[doc = r" If left unset defaults to the streaming until the end of days."]
309      #[allow(clippy::wrong_self_convention)]
310      pub fn to_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
311        self.0 = (self.0).to_block(block);
312        self
313      }
314      #[doc = r" Limits the number of events that can be retrieved by this filter."]
315      #[doc = r""]
316      #[doc = r" Note that this parameter is non-standard."]
317      pub fn limit(mut self, value: usize) -> Self {
318        self.0 = (self.0).limit(value);
319        self
320      }
321      #[doc = r" Sets the polling interval. This is used as the interval between"]
322      #[doc = r" consecutive `eth_getFilterChanges` calls to get filter updates."]
323      pub fn poll_interval(mut self, value: std::time::Duration) -> Self {
324        self.0 = (self.0).poll_interval(value);
325        self
326      }
327      #[doc = r" Returns a future that resolves with a collection of all existing"]
328      #[doc = r" logs matching the builder parameters."]
329      pub async fn query(
330        self,
331      ) -> std::result::Result<
332        std::vec::Vec<self::ethcontract::Event<self::event_data::Unpaused>>,
333        self::ethcontract::errors::EventError,
334      > {
335        (self.0).query().await
336      }
337      #[doc = r" Creates an event stream from the current event builder."]
338      pub fn stream(
339        self,
340      ) -> impl self::ethcontract::futures::stream::Stream<
341        Item = std::result::Result<
342          self::ethcontract::StreamEvent<self::event_data::Unpaused>,
343          self::ethcontract::errors::EventError,
344        >,
345      > {
346        (self.0).stream()
347      }
348    }
349    #[doc = "A builder for creating a filtered stream of `Paused` events."]
350    pub struct PausedBuilder(
351      #[doc = r" The inner event builder."]
352      pub  self::ethcontract::dyns::DynEventBuilder<self::event_data::Paused>,
353    );
354    impl PausedBuilder {
355      #[doc = r" Sets the starting block from which to stream logs for."]
356      #[doc = r""]
357      #[doc = r" If left unset defaults to the latest block."]
358      #[allow(clippy::wrong_self_convention)]
359      pub fn from_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
360        self.0 = (self.0).from_block(block);
361        self
362      }
363      #[doc = r" Sets the last block from which to stream logs for."]
364      #[doc = r""]
365      #[doc = r" If left unset defaults to the streaming until the end of days."]
366      #[allow(clippy::wrong_self_convention)]
367      pub fn to_block(mut self, block: self::ethcontract::BlockNumber) -> Self {
368        self.0 = (self.0).to_block(block);
369        self
370      }
371      #[doc = r" Limits the number of events that can be retrieved by this filter."]
372      #[doc = r""]
373      #[doc = r" Note that this parameter is non-standard."]
374      pub fn limit(mut self, value: usize) -> Self {
375        self.0 = (self.0).limit(value);
376        self
377      }
378      #[doc = r" Sets the polling interval. This is used as the interval between"]
379      #[doc = r" consecutive `eth_getFilterChanges` calls to get filter updates."]
380      pub fn poll_interval(mut self, value: std::time::Duration) -> Self {
381        self.0 = (self.0).poll_interval(value);
382        self
383      }
384      #[doc = r" Returns a future that resolves with a collection of all existing"]
385      #[doc = r" logs matching the builder parameters."]
386      pub async fn query(
387        self,
388      ) -> std::result::Result<
389        std::vec::Vec<self::ethcontract::Event<self::event_data::Paused>>,
390        self::ethcontract::errors::EventError,
391      > {
392        (self.0).query().await
393      }
394      #[doc = r" Creates an event stream from the current event builder."]
395      pub fn stream(
396        self,
397      ) -> impl self::ethcontract::futures::stream::Stream<
398        Item = std::result::Result<
399          self::ethcontract::StreamEvent<self::event_data::Paused>,
400          self::ethcontract::errors::EventError,
401        >,
402      > {
403        (self.0).stream()
404      }
405    }
406  }
407  impl Contract {
408    #[doc = r" Returns a log stream with all events."]
409    pub fn all_events(&self) -> self::ethcontract::dyns::DynAllEventsBuilder<Event> {
410      self::ethcontract::dyns::DynAllEventsBuilder::new(
411        self.raw_instance().web3(),
412        self.address(),
413        self.deployment_information(),
414      )
415    }
416  }
417  #[doc = r" A contract event."]
418  #[derive(Clone, Debug, Eq, PartialEq, serde :: Deserialize, serde :: Serialize)]
419  pub enum Event {
420    Paused(self::event_data::Paused),
421    Unpaused(self::event_data::Unpaused),
422  }
423  impl self::ethcontract::contract::ParseLog for Event {
424    fn parse_log(
425      log: self::ethcontract::RawLog,
426    ) -> Result<Self, self::ethcontract::errors::ExecutionError> {
427      let standard_event = log . topics . get (0) . copied () . map (| topic | match topic { self :: ethcontract :: H256 ([98 , 231 , 140 , 234 , 1 , 190 , 227 , 32 , 205 , 78 , 66 , 2 , 112 , 181 , 234 , 116 , 0 , 13 , 17 , 176 , 201 , 247 , 71 , 84 , 235 , 219 , 252 , 84 , 75 , 5 , 162 , 88]) => Ok (Event :: Paused (log . clone () . decode (Contract :: raw_contract () . abi . event ("Paused") . expect ("generated event decode")) ?)) , self :: ethcontract :: H256 ([93 , 185 , 238 , 10 , 73 , 91 , 242 , 230 , 255 , 156 , 145 , 167 , 131 , 76 , 27 , 164 , 253 , 210 , 68 , 165 , 232 , 170 , 78 , 83 , 123 , 211 , 138 , 234 , 228 , 176 , 115 , 170]) => Ok (Event :: Unpaused (log . clone () . decode (Contract :: raw_contract () . abi . event ("Unpaused") . expect ("generated event decode")) ?)) , _ => Err (self :: ethcontract :: errors :: ExecutionError :: from (self :: ethcontract :: common :: abi :: Error :: InvalidData)) , }) ;
428      if let Some(Ok(data)) = standard_event {
429        return Ok(data);
430      }
431      Err(self::ethcontract::errors::ExecutionError::from(
432        self::ethcontract::common::abi::Error::InvalidData,
433      ))
434    }
435  }
436}
437pub use self::pausable_upgradeable::Contract as PausableUpgradeable;