diff --git a/crates/sol-macro/src/expand/contract.rs b/crates/sol-macro/src/expand/contract.rs index 2f1e16794..1e8923573 100644 --- a/crates/sol-macro/src/expand/contract.rs +++ b/crates/sol-macro/src/expand/contract.rs @@ -280,25 +280,25 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, contract: &ItemContract) -> Result(provider: P, #params) - -> impl ::core::future::Future>> + pub fn deploy>(provider: P, #params) + -> impl ::core::future::Future>> { - #name::

::deploy(provider, #args) + #name::::deploy(provider, #args) } #deploy_builder_doc #[inline] - pub fn deploy_builder(provider: P, #params) - -> alloy_contract::RawCallBuilder

+ pub fn deploy_builder>(provider: P, #params) + -> alloy_contract::RawCallBuilder { - #name::

::deploy_builder(provider, #args) + #name::::deploy_builder(provider, #args) } }, quote! { #deploy_doc #[inline] pub async fn deploy(provider: P, #params) - -> alloy_contract::Result<#name

> + -> alloy_contract::Result<#name> { let call_builder = Self::deploy_builder(provider, #args); let contract_address = call_builder.deploy().await?; @@ -308,7 +308,7 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, contract: &ItemContract) -> Result alloy_contract::RawCallBuilder

+ -> alloy_contract::RawCallBuilder { alloy_contract::RawCallBuilder::new_raw(provider, #deploy_builder_data) } @@ -323,24 +323,25 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, contract: &ItemContract) -> Result( + pub const fn new>( address: alloy_sol_types::private::Address, provider: P, - ) -> #name

{ - #name::

::new(address, provider) + ) -> #name { + #name::::new(address, provider) } #deploy_fn #[doc = #struct_doc] #[derive(Clone)] - pub struct #name

{ + pub struct #name { address: alloy_sol_types::private::Address, provider: P, + _network_transport: ::core::marker::PhantomData<(N, T)>, } #[automatically_derived] - impl

::core::fmt::Debug for #name

{ + impl ::core::fmt::Debug for #name { #[inline] fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple(#name_s).field(&self.address).finish() @@ -349,11 +350,11 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, contract: &ItemContract) -> Result #name

{ + impl> #name { #[doc = #new_fn_doc] #[inline] pub const fn new(address: alloy_sol_types::private::Address, provider: P) -> Self { - Self { address, provider } + Self { address, provider, _network_transport: ::core::marker::PhantomData } } #deploy_method @@ -383,23 +384,23 @@ pub(super) fn expand(cx: &ExpCtxt<'_>, contract: &ItemContract) -> Result #name<&P> { + impl #name { /// Clones the provider and returns a new instance with the cloned provider. #[inline] - pub fn with_cloned_provider(self) -> #name

{ - #name { address: self.address, provider: ::core::clone::Clone::clone(&self.provider) } + pub fn with_cloned_provider(self) -> #name { + #name { address: self.address, provider: ::core::clone::Clone::clone(&self.provider), _network_transport: ::core::marker::PhantomData } } } /// Function calls. #[automatically_derived] - impl #name

{ + impl> #name { /// Creates a new call builder using this contract instance's provider and address. - /// + /// /// Note that the call can be any function call, not just those defined in this /// contract. Prefer using the other methods for building type-safe contract calls. pub fn call_builder(&self, call: &C) - -> alloy_contract::SolCallBuilder<&P, C> + -> alloy_contract::SolCallBuilder { alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call) } @@ -886,7 +887,7 @@ fn call_builder_method(f: &ItemFunction, cx: &ExpCtxt<'_>) -> TokenStream { let doc = format!("Creates a new call builder for the [`{name}`] function."); quote! { #[doc = #doc] - pub fn #name(&self, #(#param_names1: #param_tys),*) -> alloy_contract::SolCallBuilder<&P, #call_name> { + pub fn #name(&self, #(#param_names1: #param_tys),*) -> alloy_contract::SolCallBuilder { self.call_builder(&#call_name { #(#param_names2),* }) } }