difftreelog
refactor(evm-coder)! manual macro parsing
in: master
We have plans to allow evm-coder to generate Callables for externally defined contracts, however our current attribute parsing was limiting code maintanability, rework was needed before starting to implement new features BREAKING CHANGE: solidity_interface definitions may now look slightly different, for example interface names now should be identifiers, not strings
8 files changed
crates/evm-coder-macros/Cargo.tomldiffbeforeafterboth--- a/crates/evm-coder-macros/Cargo.toml
+++ b/crates/evm-coder-macros/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "evm-coder-macros"
-version = "0.1.0"
+version = "0.2.0"
license = "GPLv3"
edition = "2021"
@@ -8,10 +8,9 @@
proc-macro = true
[dependencies]
-sha3 = "0.9.1"
+sha3 = "0.10.1"
quote = "1.0"
proc-macro2 = "1.0"
syn = { version = "1.0", features = ["full"] }
hex = "0.4.3"
Inflector = "0.11.4"
-darling = "0.13.0"
crates/evm-coder-macros/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/lib.rs
+++ b/crates/evm-coder-macros/src/lib.rs
@@ -16,14 +16,13 @@
#![allow(dead_code)]
-use darling::FromMeta;
use inflector::cases;
use proc_macro::TokenStream;
use quote::quote;
use sha3::{Digest, Keccak256};
use syn::{
- AttributeArgs, DeriveInput, GenericArgument, Ident, ItemImpl, Pat, Path, PathArguments,
- PathSegment, Type, parse_macro_input, spanned::Spanned,
+ DeriveInput, GenericArgument, Ident, ItemImpl, Pat, Path, PathArguments,
+ PathSegment, Type, parse_macro_input, spanned::Spanned, Attribute, parse::Parse,
};
mod solidity_interface;
@@ -254,8 +253,7 @@
/// ```
#[proc_macro_attribute]
pub fn solidity_interface(args: TokenStream, stream: TokenStream) -> TokenStream {
- let args = parse_macro_input!(args as AttributeArgs);
- let args = solidity_interface::InterfaceInfo::from_list(&args).unwrap();
+ let args = parse_macro_input!(args as solidity_interface::InterfaceInfo);
let input: ItemImpl = match syn::parse(stream) {
Ok(t) => t,
crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -16,14 +16,15 @@
#![allow(dead_code)]
-use quote::quote;
-use darling::{FromMeta, ToTokens};
+use quote::{quote, ToTokens};
use inflector::cases;
use std::fmt::Write;
use syn::{
Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,
- MetaNameValue, NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,
- parse_str,
+ MetaNameValue, PatType, PathArguments, ReturnType, Type,
+ spanned::Spanned,
+ parse::{Parse, ParseStream},
+ parenthesized, Token, LitInt, LitStr,
};
use crate::{
@@ -39,19 +40,6 @@
via: Option<(Type, Ident)>,
}
impl Is {
- fn new_via(path: &Path, via: Option<(Type, Ident)>) -> syn::Result<Self> {
- let name = parse_ident_from_path(path, false)?.clone();
- Ok(Self {
- pascal_call_name: pascal_ident_to_call(&name),
- snake_call_name: pascal_ident_to_snake_call(&name),
- name,
- via,
- })
- }
- fn new(path: &Path) -> syn::Result<Self> {
- Self::new_via(path, None)
- }
-
fn expand_call_def(&self, gen_ref: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let name = &self.name;
let pascal_call_name = &self.pascal_call_name;
@@ -137,73 +125,141 @@
#[derive(Default)]
struct IsList(Vec<Is>);
-impl FromMeta for IsList {
- fn from_list(items: &[NestedMeta]) -> darling::Result<Self> {
- let mut out = Vec::new();
- for item in items {
- match item {
- NestedMeta::Meta(Meta::Path(path)) => out.push(Is::new(path)?),
- // TODO: replace meta parsing with manual
- NestedMeta::Meta(Meta::List(list))
- if list.path.is_ident("via") && list.nested.len() == 3 =>
- {
- let mut data = list.nested.iter();
- let typ = match data.next().expect("len == 3") {
- NestedMeta::Lit(Lit::Str(s)) => {
- let v = s.value();
- let typ: Type = parse_str(&v)?;
- typ
- }
- _ => {
- return Err(syn::Error::new(
- item.span(),
- "via typ should be type in string",
- )
- .into())
- }
- };
- let via = match data.next().expect("len == 3") {
- NestedMeta::Meta(Meta::Path(path)) => path
- .get_ident()
- .ok_or_else(|| syn::Error::new(item.span(), "via should be ident"))?,
- _ => return Err(syn::Error::new(item.span(), "via should be ident").into()),
- };
- let path = match data.next().expect("len == 3") {
- NestedMeta::Meta(Meta::Path(path)) => path,
- _ => return Err(syn::Error::new(item.span(), "path should be path").into()),
- };
-
- out.push(Is::new_via(path, Some((typ, via.clone())))?)
- }
- _ => {
- return Err(syn::Error::new(
- item.span(),
- "expected either Name or via(\"Type\", getter, Name)",
- )
- .into())
- }
+impl Parse for IsList {
+ fn parse(input: ParseStream) -> syn::Result<Self> {
+ let mut out = vec![];
+ loop {
+ if input.is_empty() {
+ break;
+ }
+ let name = input.parse::<Ident>()?;
+ let lookahead = input.lookahead1();
+ let via = if lookahead.peek(syn::token::Paren) {
+ let contents;
+ parenthesized!(contents in input);
+ let method = contents.parse::<Ident>()?;
+ contents.parse::<Token![,]>()?;
+ let ty = contents.parse::<Type>()?;
+ Some((ty, method))
+ } else if lookahead.peek(Token![,]) {
+ None
+ } else if input.is_empty() {
+ None
+ } else {
+ return Err(lookahead.error());
+ };
+ out.push(Is {
+ pascal_call_name: pascal_ident_to_call(&name),
+ snake_call_name: pascal_ident_to_snake_call(&name),
+ name,
+ via,
+ });
+ if input.peek(Token![,]) {
+ input.parse::<Token![,]>()?;
+ continue;
+ } else {
+ break;
}
}
Ok(Self(out))
}
}
-#[derive(FromMeta)]
pub struct InterfaceInfo {
name: Ident,
- #[darling(default)]
is: IsList,
- #[darling(default)]
inline_is: IsList,
- #[darling(default)]
events: IsList,
+ expect_selector: Option<u32>,
}
+impl Parse for InterfaceInfo {
+ fn parse(input: ParseStream) -> syn::Result<Self> {
+ let mut name = None;
+ let mut is = None;
+ let mut inline_is = None;
+ let mut events = None;
+ let mut expect_selector = None;
+ // TODO: create proc-macro to optimize proc-macro boilerplate? :D
+ loop {
+ let lookahead = input.lookahead1();
+ if lookahead.peek(kw::name) {
+ let k = input.parse::<kw::name>()?;
+ input.parse::<Token![=]>()?;
+ if name.replace(input.parse::<Ident>()?).is_some() {
+ return Err(syn::Error::new(k.span(), "name is already set"));
+ }
+ } else if lookahead.peek(kw::is) {
+ let k = input.parse::<kw::is>()?;
+ let contents;
+ parenthesized!(contents in input);
+ if is.replace(contents.parse::<IsList>()?).is_some() {
+ return Err(syn::Error::new(k.span(), "is is already set"));
+ }
+ } else if lookahead.peek(kw::inline_is) {
+ let k = input.parse::<kw::inline_is>()?;
+ let contents;
+ parenthesized!(contents in input);
+ if inline_is.replace(contents.parse::<IsList>()?).is_some() {
+ return Err(syn::Error::new(k.span(), "inline_is is already set"));
+ }
+ } else if lookahead.peek(kw::events) {
+ let k = input.parse::<kw::events>()?;
+ let contents;
+ parenthesized!(contents in input);
+ if events.replace(contents.parse::<IsList>()?).is_some() {
+ return Err(syn::Error::new(k.span(), "events is already set"));
+ }
+ } else if lookahead.peek(kw::expect_selector) {
+ let k = input.parse::<kw::expect_selector>()?;
+ input.parse::<Token![=]>()?;
+ let value = input.parse::<LitInt>()?;
+ if expect_selector
+ .replace(value.base10_parse::<u32>()?)
+ .is_some()
+ {
+ return Err(syn::Error::new(k.span(), "expect_selector is already set"));
+ }
+ } else if input.is_empty() {
+ break;
+ } else {
+ return Err(lookahead.error());
+ }
+ if input.peek(Token![,]) {
+ input.parse::<Token![,]>()?;
+ } else {
+ break;
+ }
+ }
+ Ok(Self {
+ name: name.ok_or_else(|| syn::Error::new(input.span(), "missing name"))?,
+ is: is.unwrap_or_default(),
+ inline_is: inline_is.unwrap_or_default(),
+ events: events.unwrap_or_default(),
+ expect_selector,
+ })
+ }
+}
-#[derive(FromMeta)]
struct MethodInfo {
- #[darling(default)]
rename_selector: Option<String>,
}
+impl Parse for MethodInfo {
+ fn parse(input: ParseStream) -> syn::Result<Self> {
+ let mut rename_selector = None;
+ let lookahead = input.lookahead1();
+ if lookahead.peek(kw::rename_selector) {
+ let k = input.parse::<kw::rename_selector>()?;
+ input.parse::<Token![=]>()?;
+ if rename_selector
+ .replace(input.parse::<LitStr>()?.value())
+ .is_some()
+ {
+ return Err(syn::Error::new(k.span(), "rename_selector is already set"));
+ }
+ }
+ Ok(Self { rename_selector })
+ }
+}
enum AbiType {
// type
@@ -258,7 +314,7 @@
"expected only one generic for vec",
));
}
- let arg = args.first().unwrap();
+ let arg = args.first().expect("first arg");
let ty = match arg {
GenericArgument::Type(ty) => ty,
@@ -429,23 +485,17 @@
Pure,
}
-pub struct WeightAttr(syn::Expr);
-
-mod keyword {
+mod kw {
syn::custom_keyword!(weight);
-}
-impl syn::parse::Parse for WeightAttr {
- fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
- input.parse::<syn::Token![#]>()?;
- let content;
- syn::bracketed!(content in input);
- content.parse::<keyword::weight>()?;
+ syn::custom_keyword!(via);
+ syn::custom_keyword!(name);
+ syn::custom_keyword!(is);
+ syn::custom_keyword!(inline_is);
+ syn::custom_keyword!(events);
+ syn::custom_keyword!(expect_selector);
- let weight_content;
- syn::parenthesized!(weight_content in content);
- Ok(WeightAttr(weight_content.parse::<syn::Expr>()?))
- }
+ syn::custom_keyword!(rename_selector);
}
struct Method {
@@ -472,8 +522,7 @@
for attr in &value.attrs {
let ident = parse_ident_from_path(&attr.path, false)?;
if ident == "solidity" {
- let args = attr.parse_meta().unwrap();
- info = MethodInfo::from_meta(&args).unwrap();
+ info = attr.parse_args::<MethodInfo>()?;
} else if ident == "doc" {
let args = attr.parse_meta().unwrap();
let value = match args {
@@ -484,7 +533,7 @@
};
docs.push(value);
} else if ident == "weight" {
- weight = Some(syn::parse2::<WeightAttr>(attr.to_token_stream())?.0);
+ weight = Some(attr.parse_args::<Expr>()?);
}
}
let ident = &value.sig.ident;
@@ -869,6 +918,28 @@
.map(|is| Is::expand_generator(is, &gen_ref));
let solidity_event_generators = self.info.events.0.iter().map(Is::expand_event_generator);
+ if let Some(expect_selector) = &self.info.expect_selector {
+ if !self.info.inline_is.0.is_empty() {
+ return syn::Error::new(
+ name.span(),
+ "expect_selector is not compatible with inline_is",
+ )
+ .to_compile_error();
+ }
+ let selector = self
+ .methods
+ .iter()
+ .map(|m| m.selector)
+ .fold(0, |a, b| a ^ b);
+
+ if *expect_selector != selector {
+ let mut methods = String::new();
+ for meth in self.methods.iter() {
+ write!(methods, "\n- {}", meth.selector_str).expect("write to string");
+ }
+ return syn::Error::new(name.span(), format!("expected selector mismatch, expected {expect_selector:0>8x}, but implementation has {selector:0>8x}{methods}")).to_compile_error();
+ }
+ }
// let methods = self.methods.iter().map(Method::solidity_def);
quote! {
@@ -917,9 +988,9 @@
)*),
};
if is_impl {
- tc.collect("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\ncontract ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool) {\n\t\trequire(false, stub_error);\n\t\tinterfaceID;\n\t\treturn true;\n\t}\n}\n".into());
+ tc.collect("/// @dev common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\ncontract ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool) {\n\t\trequire(false, stub_error);\n\t\tinterfaceID;\n\t\treturn true;\n\t}\n}\n".into());
} else {
- tc.collect("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());
+ tc.collect("/// @dev common stubs holder\ninterface Dummy {\n}\ninterface ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n".into());
}
#(
#solidity_generators
@@ -930,9 +1001,9 @@
let mut out = string::new();
// In solidity interface usage (is) should be preceeded by interface definition
- // This comment helps to sort it in a set
+ // HACK: this comment helps to sort it in a set
if #solidity_name.starts_with("Inline") {
- out.push_str("// Inline\n");
+ out.push_str("/// @dev inlined interface\n");
}
let _ = interface.format(is_impl, &mut out, tc);
tc.collect(out);
crates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use inflector::cases;18use syn::{Data, DeriveInput, Field, Fields, Ident, Variant, spanned::Spanned};19use std::fmt::Write;20use quote::quote;2122use crate::{parse_ident_from_path, parse_ident_from_type, snake_ident_to_screaming};2324struct EventField {25 name: Ident,26 camel_name: String,27 ty: Ident,28 indexed: bool,29}3031impl EventField {32 fn try_from(field: &Field) -> syn::Result<Self> {33 let name = field.ident.as_ref().unwrap();34 let ty = parse_ident_from_type(&field.ty, false)?;35 let mut indexed = false;36 for attr in &field.attrs {37 if let Ok(ident) = parse_ident_from_path(&attr.path, false) {38 if ident == "indexed" {39 indexed = true;40 }41 }42 }43 Ok(Self {44 name: name.to_owned(),45 camel_name: cases::camelcase::to_camel_case(&name.to_string()),46 ty: ty.to_owned(),47 indexed,48 })49 }50 fn expand_solidity_argument(&self) -> proc_macro2::TokenStream {51 let camel_name = &self.camel_name;52 let ty = &self.ty;53 let indexed = self.indexed;54 quote! {55 <SolidityEventArgument<#ty>>::new(#indexed, #camel_name)56 }57 }58}5960struct Event {61 name: Ident,62 name_screaming: Ident,63 fields: Vec<EventField>,64 selector: [u8; 32],65 selector_str: String,66}6768impl Event {69 fn try_from(variant: &Variant) -> syn::Result<Self> {70 let name = &variant.ident;71 let name_screaming = snake_ident_to_screaming(name);7273 let named = match &variant.fields {74 Fields::Named(named) => named,75 _ => {76 return Err(syn::Error::new(77 variant.fields.span(),78 "expected named fields",79 ))80 }81 };82 let mut fields = Vec::new();83 for field in &named.named {84 fields.push(EventField::try_from(field)?);85 }86 if fields.iter().filter(|f| f.indexed).count() > 3 {87 return Err(syn::Error::new(88 variant.fields.span(),89 "events can have at most 4 indexed fields (1 indexed field is reserved for event signature)"90 ));91 }92 let mut selector_str = format!("{}(", name);93 for (i, arg) in fields.iter().enumerate() {94 if i != 0 {95 write!(selector_str, ",").unwrap();96 }97 write!(selector_str, "{}", arg.ty).unwrap();98 }99 selector_str.push(')');100 let selector = crate::event_selector_str(&selector_str);101102 Ok(Self {103 name: name.to_owned(),104 name_screaming,105 fields,106 selector,107 selector_str,108 })109 }110111 fn expand_serializers(&self) -> proc_macro2::TokenStream {112 let name = &self.name;113 let name_screaming = &self.name_screaming;114 let fields = self.fields.iter().map(|f| &f.name);115116 let indexed = self.fields.iter().filter(|f| f.indexed).map(|f| &f.name);117 let plain = self.fields.iter().filter(|f| !f.indexed).map(|f| &f.name);118119 quote! {120 Self::#name {#(121 #fields,122 )*} => {123 topics.push(topic::from(Self::#name_screaming));124 #(125 topics.push(#indexed.to_topic());126 )*127 #(128 #plain.abi_write(&mut writer);129 )*130 }131 }132 }133134 fn expand_consts(&self) -> proc_macro2::TokenStream {135 let name_screaming = &self.name_screaming;136 let selector_str = &self.selector_str;137 let selector = &self.selector;138139 quote! {140 #[doc = #selector_str]141 const #name_screaming: [u8; 32] = [#(142 #selector,143 )*];144 }145 }146147 fn expand_solidity_function(&self) -> proc_macro2::TokenStream {148 let name = self.name.to_string();149 let args = self.fields.iter().map(EventField::expand_solidity_argument);150 quote! {151 SolidityEvent {152 name: #name,153 args: (154 #(155 #args,156 )*157 ),158 }159 }160 }161}162163pub struct Events {164 name: Ident,165 events: Vec<Event>,166}167168impl Events {169 pub fn try_from(data: &DeriveInput) -> syn::Result<Self> {170 let name = &data.ident;171 let en = match &data.data {172 Data::Enum(en) => en,173 _ => return Err(syn::Error::new(data.span(), "expected enum")),174 };175 let mut events = Vec::new();176 for variant in &en.variants {177 events.push(Event::try_from(variant)?);178 }179 Ok(Self {180 name: name.to_owned(),181 events,182 })183 }184 pub fn expand(&self) -> proc_macro2::TokenStream {185 let name = &self.name;186187 let consts = self.events.iter().map(Event::expand_consts);188 let serializers = self.events.iter().map(Event::expand_serializers);189 let solidity_name = self.name.to_string();190 let solidity_functions = self.events.iter().map(Event::expand_solidity_function);191192 quote! {193 impl #name {194 #(195 #consts196 )*197198 pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) {199 use evm_coder::solidity::*;200 use core::fmt::Write;201 let interface = SolidityInterface {202 selector: [0; 4],203 name: #solidity_name,204 is: &[],205 functions: (#(206 #solidity_functions,207 )*),208 };209 let mut out = string::new();210 out.push_str("// Inline\n");211 let _ = interface.format(is_impl, &mut out, tc);212 tc.collect(out);213 }214 }215216 #[automatically_derived]217 impl ::evm_coder::events::ToLog for #name {218 fn to_log(&self, contract: address) -> ::ethereum::Log {219 use ::evm_coder::events::ToTopic;220 use ::evm_coder::abi::AbiWrite;221 let mut writer = ::evm_coder::abi::AbiWriter::new();222 let mut topics = Vec::new();223 match self {224 #(225 #serializers,226 )*227 }228 ::ethereum::Log {229 address: contract,230 topics,231 data: writer.finish(),232 }233 }234 }235 }236 }237}crates/evm-coder/src/solidity.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -56,7 +56,7 @@
}
let id = self.next_id();
let mut str = String::new();
- writeln!(str, "// Anonymous struct").unwrap();
+ writeln!(str, "/// @dev anonymous struct").unwrap();
writeln!(str, "struct Tuple{} {{", id).unwrap();
for (i, name) in names.iter().enumerate() {
writeln!(str, "\t{} field_{};", name, i).unwrap();
@@ -416,12 +416,12 @@
tc: &TypeCollector,
) -> fmt::Result {
for doc in self.docs {
- writeln!(writer, "\t//{}", doc)?;
+ writeln!(writer, "\t///{}", doc)?;
}
if !self.docs.is_empty() {
- writeln!(writer, "\t//")?;
+ writeln!(writer, "\t///")?;
}
- writeln!(writer, "\t// Selector: {}", self.selector)?;
+ writeln!(writer, "\t/// Selector: {}", self.selector)?;
write!(writer, "\tfunction {}(", self.name)?;
self.args.solidity_name(writer, tc)?;
write!(writer, ")")?;
@@ -498,7 +498,7 @@
if self.selector != ZERO_BYTES {
writeln!(
out,
- "// Selector: {:0>8x}",
+ "/// @dev the ERC-165 identifier for this interface is 0x{:0>8x}",
u32::from_be_bytes(self.selector)
)?;
}
crates/evm-coder/tests/generics.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/generics.rs
+++ b/crates/evm-coder/tests/generics.rs
@@ -19,14 +19,14 @@
struct Generic<T>(PhantomData<T>);
-#[solidity_interface(name = "GenericIs")]
+#[solidity_interface(name = GenericIs)]
impl<T> Generic<T> {
fn test_1(&self) -> Result<uint256> {
unreachable!()
}
}
-#[solidity_interface(name = "Generic", is(GenericIs))]
+#[solidity_interface(name = Generic, is(GenericIs))]
impl<T: Into<u32>> Generic<T> {
fn test_2(&self) -> Result<uint256> {
unreachable!()
@@ -35,7 +35,7 @@
generate_stubgen!(gen_iface, GenericCall<()>, false);
-#[solidity_interface(name = "GenericWhere")]
+#[solidity_interface(name = GenericWhere)]
impl<T> Generic<T>
where
T: core::fmt::Debug,
crates/evm-coder/tests/random.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/random.rs
+++ b/crates/evm-coder/tests/random.rs
@@ -21,14 +21,14 @@
struct Impls;
-#[solidity_interface(name = "OurInterface")]
+#[solidity_interface(name = OurInterface)]
impl Impls {
fn fn_a(&self, _input: uint256) -> Result<bool> {
unreachable!()
}
}
-#[solidity_interface(name = "OurInterface1")]
+#[solidity_interface(name = OurInterface1)]
impl Impls {
fn fn_b(&self, _input: uint128) -> Result<uint32> {
unreachable!()
@@ -48,7 +48,7 @@
}
#[solidity_interface(
- name = "OurInterface2",
+ name = OurInterface2,
is(OurInterface),
inline_is(OurInterface1),
events(OurEvents)
@@ -79,3 +79,9 @@
unreachable!()
}
}
+
+#[solidity_interface(
+ name = ValidSelector,
+ expect_selector = 0x00000000,
+)]
+impl Impls {}
crates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/solidity_generation.rs
+++ b/crates/evm-coder/tests/solidity_generation.rs
@@ -18,7 +18,7 @@
struct ERC20;
-#[solidity_interface(name = "ERC20")]
+#[solidity_interface(name = ERC20)]
impl ERC20 {
fn decimals(&self) -> Result<uint8> {
unreachable!()