Closed benluelo closed 1 month ago
@DaniPopes I struggled with the same issue on abigen as well...
I think we can solve this by
It
to make them truly uniqueA.B.C
D.B.C
, so this only works if we concat all parents...however this does not solve naming entirely, because when we print params we now also now need to know the name of the type we just renamed
we also don't want to do this if there aren't any conflicts
so I guess we need some filtering when we do:
Component
json-abi, sol! macro
What version of Alloy are you on?
v0.7.6
Operating System
Linux
Describe the bug
If a struct is in a library, the library path is lost when generating code from the json abi.
Take the following solidity code:
this generates the following (abridged) rust code:
*/ pub mod Contract { use ::alloy_sol_types as alloy_sol_types; /**```solidity struct Struct { uint64 field64; }
LibA.Struct
has "overwritten"LibB.Struct
, and as such bothconstructor
andfn
have invalid signatures.The contract qualifier is dropped here https://github.com/alloy-rs/core/blob/3b973ccdf9100f685fba6b9794bf8cb6b86e4651/crates/json-abi/src/to_sol.rs#L179-L181, this information should be passed through somehow.