openzeppelin_rs/contracts/
Pausable.rs1pub use pausable::*;
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 pausable {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Paused\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Unpaused\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15 pub static PAUSABLE_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 Pausable<M>(::ethers_contract::Contract<M>);
19 impl<M> ::core::clone::Clone for Pausable<M> {
20 fn clone(&self) -> Self {
21 Self(::core::clone::Clone::clone(&self.0))
22 }
23 }
24 impl<M> ::core::ops::Deref for Pausable<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 Pausable<M> {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35 impl<M> ::core::fmt::Debug for Pausable<M> {
36 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37 f.debug_tuple(stringify!(Pausable)).field(&self.address()).finish()
38 }
39 }
40 impl<M: ::ethers_providers::Middleware> Pausable<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 PAUSABLE_ABI.clone(),
51 client,
52 ),
53 )
54 }
55 pub fn paused(&self) -> ::ethers_contract::builders::ContractCall<M, bool> {
57 self.0
58 .method_hash([92, 151, 90, 187], ())
59 .expect("method not found (this should never happen)")
60 }
61 pub fn paused_filter(
63 &self,
64 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, PausedFilter> {
65 self.0.event()
66 }
67 pub fn unpaused_filter(
69 &self,
70 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, UnpausedFilter> {
71 self.0.event()
72 }
73 pub fn events(
75 &self,
76 ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, PausableEvents> {
77 self.0.event_with_filter(::core::default::Default::default())
78 }
79 }
80 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
81 for Pausable<M> {
82 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
83 Self::new(contract.address(), contract.client())
84 }
85 }
86 #[derive(
87 Clone,
88 ::ethers_contract::EthEvent,
89 ::ethers_contract::EthDisplay,
90 Default,
91 Debug,
92 PartialEq,
93 Eq,
94 Hash
95 )]
96 #[ethevent(name = "Paused", abi = "Paused(address)")]
97 pub struct PausedFilter {
98 pub account: ::ethers_core::types::Address,
99 }
100 #[derive(
101 Clone,
102 ::ethers_contract::EthEvent,
103 ::ethers_contract::EthDisplay,
104 Default,
105 Debug,
106 PartialEq,
107 Eq,
108 Hash
109 )]
110 #[ethevent(name = "Unpaused", abi = "Unpaused(address)")]
111 pub struct UnpausedFilter {
112 pub account: ::ethers_core::types::Address,
113 }
114 #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
116 pub enum PausableEvents {
117 PausedFilter(PausedFilter),
118 UnpausedFilter(UnpausedFilter),
119 }
120 impl ::ethers_contract::EthLogDecode for PausableEvents {
121 fn decode_log(
122 log: &::ethers_core::abi::RawLog,
123 ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
124 if let Ok(decoded) = PausedFilter::decode_log(log) {
125 return Ok(PausableEvents::PausedFilter(decoded));
126 }
127 if let Ok(decoded) = UnpausedFilter::decode_log(log) {
128 return Ok(PausableEvents::UnpausedFilter(decoded));
129 }
130 Err(::ethers_core::abi::Error::InvalidData)
131 }
132 }
133 impl ::core::fmt::Display for PausableEvents {
134 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
135 match self {
136 Self::PausedFilter(element) => ::core::fmt::Display::fmt(element, f),
137 Self::UnpausedFilter(element) => ::core::fmt::Display::fmt(element, f),
138 }
139 }
140 }
141 impl ::core::convert::From<PausedFilter> for PausableEvents {
142 fn from(value: PausedFilter) -> Self {
143 Self::PausedFilter(value)
144 }
145 }
146 impl ::core::convert::From<UnpausedFilter> for PausableEvents {
147 fn from(value: UnpausedFilter) -> Self {
148 Self::UnpausedFilter(value)
149 }
150 }
151 #[derive(
153 Clone,
154 ::ethers_contract::EthCall,
155 ::ethers_contract::EthDisplay,
156 Default,
157 Debug,
158 PartialEq,
159 Eq,
160 Hash
161 )]
162 #[ethcall(name = "paused", abi = "paused()")]
163 pub struct PausedCall;
164 #[derive(
166 Clone,
167 ::ethers_contract::EthAbiType,
168 ::ethers_contract::EthAbiCodec,
169 Default,
170 Debug,
171 PartialEq,
172 Eq,
173 Hash
174 )]
175 pub struct PausedReturn(pub bool);
176}