From dfdad2e44e447d236a89f66cc417b8efa2fdfaf3 Mon Sep 17 00:00:00 2001 From: Tomasz Kulik Date: Mon, 22 Apr 2024 15:56:56 +0200 Subject: [PATCH] chore: Update after rebase --- sylvia-derive/src/multitest.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sylvia-derive/src/multitest.rs b/sylvia-derive/src/multitest.rs index be62347a..00541604 100644 --- a/sylvia-derive/src/multitest.rs +++ b/sylvia-derive/src/multitest.rs @@ -140,6 +140,14 @@ impl<'a> ContractMtHelpers<'a> { }; let api = quote! { < #contract_name as #sylvia ::types::ContractApi> }; + let contract_ident = get_ident_from_type(contract_name); + let contract: Type = if !generic_params.is_empty() { + parse_quote! { #contract_ident ::< #(#generic_params,)* > } + } else { + parse_quote! { #contract_ident } + }; + let trait_name = Ident::new(&format!("{}Proxy", contract_ident), contract_ident.span()); + let exec_methods = exec_variants.variants().map(|variant| { variant.emit_mt_method_definition(&custom_msg, &mt_app, error_type, &api) }); @@ -172,10 +180,7 @@ impl<'a> ContractMtHelpers<'a> { let impl_contract = self.emit_impl_contract(); let code_id = self.emit_code_id(); - let instantiate_proxy = self.emit_instantiate_proxy(); - - let contract = get_ident_from_type(contract_name); - let trait_name = Ident::new(&format!("{}Proxy", contract), contract.span()); + let instantiate_proxy = self.emit_instantiate_proxy(&contract); quote! { pub mod mt { @@ -349,7 +354,7 @@ impl<'a> ContractMtHelpers<'a> { } } - fn emit_instantiate_proxy(&self) -> TokenStream { + fn emit_instantiate_proxy(&self, contract: &Type) -> TokenStream { let sylvia = crate_module(); let Self { error_type,