ve_orn_bindings/
context.rs1pub use context::*;
2#[allow(
3 clippy::too_many_arguments,
4 non_camel_case_types,
5 clippy::upper_case_acronyms
6)]
7pub mod context {
8 #![allow(clippy::enum_variant_names)]
9 #![allow(dead_code)]
10 #![allow(clippy::type_complexity)]
11 #![allow(unused_imports)]
12 use ::ethers::contract::{
14 builders::{ContractCall, Event},
15 Contract, Lazy,
16 };
17 use ::ethers::core::{
18 abi::{Abi, Detokenize, InvalidOutputType, Token, Tokenizable},
19 types::*,
20 };
21 use ::ethers::providers::Middleware;
22 use std::sync::Arc;
23 #[rustfmt::skip]
24 const __ABI: &str = "[]";
25 pub static CONTEXT_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
27 ::ethers::contract::Lazy::new(|| {
28 ::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")
29 });
30 pub struct Context<M>(::ethers::contract::Contract<M>);
31 impl<M> Clone for Context<M> {
32 fn clone(&self) -> Self {
33 Context(self.0.clone())
34 }
35 }
36 impl<M> std::ops::Deref for Context<M> {
37 type Target = ::ethers::contract::Contract<M>;
38 fn deref(&self) -> &Self::Target {
39 &self.0
40 }
41 }
42 impl<M> std::fmt::Debug for Context<M> {
43 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
44 f.debug_tuple(stringify!(Context))
45 .field(&self.address())
46 .finish()
47 }
48 }
49 impl<M: ::ethers::providers::Middleware> Context<M> {
50 pub fn new<T: Into<::ethers::core::types::Address>>(
54 address: T,
55 client: ::std::sync::Arc<M>,
56 ) -> Self {
57 Self(::ethers::contract::Contract::new(
58 address.into(),
59 CONTEXT_ABI.clone(),
60 client,
61 ))
62 }
63 }
64 impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>> for Context<M> {
65 fn from(contract: ::ethers::contract::Contract<M>) -> Self {
66 Self::new(contract.address(), contract.client())
67 }
68 }
69}