openzeppelin_rs/contracts/
UUPSUpgradeable.rs

1pub use uups_upgradeable::*;
2/// This module was auto-generated with ethers-rs Abigen.
3/// More information at: <https://github.com/gakonst/ethers-rs>
4#[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 uups_upgradeable {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\",\"components\":[],\"indexed\":false},{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"AdminChanged\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"Upgraded\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"upgradeTo\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"payable\",\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"outputs\":[]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static UUPSUPGRADEABLE_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 UUPSUpgradeable<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for UUPSUpgradeable<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for UUPSUpgradeable<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 UUPSUpgradeable<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for UUPSUpgradeable<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(UUPSUpgradeable)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> UUPSUpgradeable<M> {
41        /// Creates a new contract instance with the specified `ethers` client at
42        /// `address`. The contract derefs to a `ethers::Contract` object.
43        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                    UUPSUPGRADEABLE_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `proxiableUUID` (0x52d1902d) function
56        pub fn proxiable_uuid(
57            &self,
58        ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
59            self.0
60                .method_hash([82, 209, 144, 45], ())
61                .expect("method not found (this should never happen)")
62        }
63        ///Calls the contract's `upgradeTo` (0x3659cfe6) function
64        pub fn upgrade_to(
65            &self,
66            new_implementation: ::ethers_core::types::Address,
67        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
68            self.0
69                .method_hash([54, 89, 207, 230], new_implementation)
70                .expect("method not found (this should never happen)")
71        }
72        ///Calls the contract's `upgradeToAndCall` (0x4f1ef286) function
73        pub fn upgrade_to_and_call(
74            &self,
75            new_implementation: ::ethers_core::types::Address,
76            data: ::ethers_core::types::Bytes,
77        ) -> ::ethers_contract::builders::ContractCall<M, ()> {
78            self.0
79                .method_hash([79, 30, 242, 134], (new_implementation, data))
80                .expect("method not found (this should never happen)")
81        }
82        ///Gets the contract's `AdminChanged` event
83        pub fn admin_changed_filter(
84            &self,
85        ) -> ::ethers_contract::builders::Event<
86            ::std::sync::Arc<M>,
87            M,
88            AdminChangedFilter,
89        > {
90            self.0.event()
91        }
92        ///Gets the contract's `BeaconUpgraded` event
93        pub fn beacon_upgraded_filter(
94            &self,
95        ) -> ::ethers_contract::builders::Event<
96            ::std::sync::Arc<M>,
97            M,
98            BeaconUpgradedFilter,
99        > {
100            self.0.event()
101        }
102        ///Gets the contract's `Upgraded` event
103        pub fn upgraded_filter(
104            &self,
105        ) -> ::ethers_contract::builders::Event<::std::sync::Arc<M>, M, UpgradedFilter> {
106            self.0.event()
107        }
108        /// Returns an `Event` builder for all the events of this contract.
109        pub fn events(
110            &self,
111        ) -> ::ethers_contract::builders::Event<
112            ::std::sync::Arc<M>,
113            M,
114            UUPSUpgradeableEvents,
115        > {
116            self.0.event_with_filter(::core::default::Default::default())
117        }
118    }
119    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
120    for UUPSUpgradeable<M> {
121        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
122            Self::new(contract.address(), contract.client())
123        }
124    }
125    #[derive(
126        Clone,
127        ::ethers_contract::EthEvent,
128        ::ethers_contract::EthDisplay,
129        Default,
130        Debug,
131        PartialEq,
132        Eq,
133        Hash
134    )]
135    #[ethevent(name = "AdminChanged", abi = "AdminChanged(address,address)")]
136    pub struct AdminChangedFilter {
137        pub previous_admin: ::ethers_core::types::Address,
138        pub new_admin: ::ethers_core::types::Address,
139    }
140    #[derive(
141        Clone,
142        ::ethers_contract::EthEvent,
143        ::ethers_contract::EthDisplay,
144        Default,
145        Debug,
146        PartialEq,
147        Eq,
148        Hash
149    )]
150    #[ethevent(name = "BeaconUpgraded", abi = "BeaconUpgraded(address)")]
151    pub struct BeaconUpgradedFilter {
152        #[ethevent(indexed)]
153        pub beacon: ::ethers_core::types::Address,
154    }
155    #[derive(
156        Clone,
157        ::ethers_contract::EthEvent,
158        ::ethers_contract::EthDisplay,
159        Default,
160        Debug,
161        PartialEq,
162        Eq,
163        Hash
164    )]
165    #[ethevent(name = "Upgraded", abi = "Upgraded(address)")]
166    pub struct UpgradedFilter {
167        #[ethevent(indexed)]
168        pub implementation: ::ethers_core::types::Address,
169    }
170    ///Container type for all of the contract's events
171    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
172    pub enum UUPSUpgradeableEvents {
173        AdminChangedFilter(AdminChangedFilter),
174        BeaconUpgradedFilter(BeaconUpgradedFilter),
175        UpgradedFilter(UpgradedFilter),
176    }
177    impl ::ethers_contract::EthLogDecode for UUPSUpgradeableEvents {
178        fn decode_log(
179            log: &::ethers_core::abi::RawLog,
180        ) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
181            if let Ok(decoded) = AdminChangedFilter::decode_log(log) {
182                return Ok(UUPSUpgradeableEvents::AdminChangedFilter(decoded));
183            }
184            if let Ok(decoded) = BeaconUpgradedFilter::decode_log(log) {
185                return Ok(UUPSUpgradeableEvents::BeaconUpgradedFilter(decoded));
186            }
187            if let Ok(decoded) = UpgradedFilter::decode_log(log) {
188                return Ok(UUPSUpgradeableEvents::UpgradedFilter(decoded));
189            }
190            Err(::ethers_core::abi::Error::InvalidData)
191        }
192    }
193    impl ::core::fmt::Display for UUPSUpgradeableEvents {
194        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
195            match self {
196                Self::AdminChangedFilter(element) => {
197                    ::core::fmt::Display::fmt(element, f)
198                }
199                Self::BeaconUpgradedFilter(element) => {
200                    ::core::fmt::Display::fmt(element, f)
201                }
202                Self::UpgradedFilter(element) => ::core::fmt::Display::fmt(element, f),
203            }
204        }
205    }
206    impl ::core::convert::From<AdminChangedFilter> for UUPSUpgradeableEvents {
207        fn from(value: AdminChangedFilter) -> Self {
208            Self::AdminChangedFilter(value)
209        }
210    }
211    impl ::core::convert::From<BeaconUpgradedFilter> for UUPSUpgradeableEvents {
212        fn from(value: BeaconUpgradedFilter) -> Self {
213            Self::BeaconUpgradedFilter(value)
214        }
215    }
216    impl ::core::convert::From<UpgradedFilter> for UUPSUpgradeableEvents {
217        fn from(value: UpgradedFilter) -> Self {
218            Self::UpgradedFilter(value)
219        }
220    }
221    ///Container type for all input parameters for the `proxiableUUID` function with signature `proxiableUUID()` and selector `0x52d1902d`
222    #[derive(
223        Clone,
224        ::ethers_contract::EthCall,
225        ::ethers_contract::EthDisplay,
226        Default,
227        Debug,
228        PartialEq,
229        Eq,
230        Hash
231    )]
232    #[ethcall(name = "proxiableUUID", abi = "proxiableUUID()")]
233    pub struct ProxiableUUIDCall;
234    ///Container type for all input parameters for the `upgradeTo` function with signature `upgradeTo(address)` and selector `0x3659cfe6`
235    #[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 = "upgradeTo", abi = "upgradeTo(address)")]
246    pub struct UpgradeToCall {
247        pub new_implementation: ::ethers_core::types::Address,
248    }
249    ///Container type for all input parameters for the `upgradeToAndCall` function with signature `upgradeToAndCall(address,bytes)` and selector `0x4f1ef286`
250    #[derive(
251        Clone,
252        ::ethers_contract::EthCall,
253        ::ethers_contract::EthDisplay,
254        Default,
255        Debug,
256        PartialEq,
257        Eq,
258        Hash
259    )]
260    #[ethcall(name = "upgradeToAndCall", abi = "upgradeToAndCall(address,bytes)")]
261    pub struct UpgradeToAndCallCall {
262        pub new_implementation: ::ethers_core::types::Address,
263        pub data: ::ethers_core::types::Bytes,
264    }
265    ///Container type for all of the contract's call
266    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
267    pub enum UUPSUpgradeableCalls {
268        ProxiableUUID(ProxiableUUIDCall),
269        UpgradeTo(UpgradeToCall),
270        UpgradeToAndCall(UpgradeToAndCallCall),
271    }
272    impl ::ethers_core::abi::AbiDecode for UUPSUpgradeableCalls {
273        fn decode(
274            data: impl AsRef<[u8]>,
275        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
276            let data = data.as_ref();
277            if let Ok(decoded)
278                = <ProxiableUUIDCall as ::ethers_core::abi::AbiDecode>::decode(data) {
279                return Ok(Self::ProxiableUUID(decoded));
280            }
281            if let Ok(decoded)
282                = <UpgradeToCall as ::ethers_core::abi::AbiDecode>::decode(data) {
283                return Ok(Self::UpgradeTo(decoded));
284            }
285            if let Ok(decoded)
286                = <UpgradeToAndCallCall as ::ethers_core::abi::AbiDecode>::decode(data) {
287                return Ok(Self::UpgradeToAndCall(decoded));
288            }
289            Err(::ethers_core::abi::Error::InvalidData.into())
290        }
291    }
292    impl ::ethers_core::abi::AbiEncode for UUPSUpgradeableCalls {
293        fn encode(self) -> Vec<u8> {
294            match self {
295                Self::ProxiableUUID(element) => {
296                    ::ethers_core::abi::AbiEncode::encode(element)
297                }
298                Self::UpgradeTo(element) => {
299                    ::ethers_core::abi::AbiEncode::encode(element)
300                }
301                Self::UpgradeToAndCall(element) => {
302                    ::ethers_core::abi::AbiEncode::encode(element)
303                }
304            }
305        }
306    }
307    impl ::core::fmt::Display for UUPSUpgradeableCalls {
308        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
309            match self {
310                Self::ProxiableUUID(element) => ::core::fmt::Display::fmt(element, f),
311                Self::UpgradeTo(element) => ::core::fmt::Display::fmt(element, f),
312                Self::UpgradeToAndCall(element) => ::core::fmt::Display::fmt(element, f),
313            }
314        }
315    }
316    impl ::core::convert::From<ProxiableUUIDCall> for UUPSUpgradeableCalls {
317        fn from(value: ProxiableUUIDCall) -> Self {
318            Self::ProxiableUUID(value)
319        }
320    }
321    impl ::core::convert::From<UpgradeToCall> for UUPSUpgradeableCalls {
322        fn from(value: UpgradeToCall) -> Self {
323            Self::UpgradeTo(value)
324        }
325    }
326    impl ::core::convert::From<UpgradeToAndCallCall> for UUPSUpgradeableCalls {
327        fn from(value: UpgradeToAndCallCall) -> Self {
328            Self::UpgradeToAndCall(value)
329        }
330    }
331    ///Container type for all return fields from the `proxiableUUID` function with signature `proxiableUUID()` and selector `0x52d1902d`
332    #[derive(
333        Clone,
334        ::ethers_contract::EthAbiType,
335        ::ethers_contract::EthAbiCodec,
336        Default,
337        Debug,
338        PartialEq,
339        Eq,
340        Hash
341    )]
342    pub struct ProxiableUUIDReturn(pub [u8; 32]);
343}