core icon indicating copy to clipboard operation
core copied to clipboard

[Feature] Add json path as const field of `sol!` generated mod

Open alexfertel opened this issue 6 months ago • 4 comments

Component

sol! macro

Describe the feature you would like

Say we have the following macro invocation:

alloy::sol!(
    #[sol(abi)]
    UniswapV2Reader,
    "src/abis/UniswapV2Reader.json"
);

There is no way to recover "src/abis/UniswapV2Reader.json" from UniswapV2Reader. It would be nice to be able to access the path to the json file that generated a given module.

Additional context

No response

alexfertel avatar Jun 10 '25 10:06 alexfertel

Will do

nadtech-hub avatar Jun 10 '25 14:06 nadtech-hub

@alexfertel can i take this up?

SWASTIC-7 avatar Sep 20 '25 13:09 SWASTIC-7

What is the motivation/use case for this issue?

onbjerg avatar Sep 20 '25 18:09 onbjerg

What is the motivation/use case for this issue?

We generate the sol! snippets corresponding to the compiler output of our contracts automatically during build time (build.rs). The project uses the types that sol! outputs without ever knowing about the actual path to the json.

It would be nice to get access to the actual path through the type that sol! gives us at compile-time, so we can use $mod::ABI_PATH the same way we can use $mod::DEPLOYED_BYTECODE.

alexfertel avatar Sep 27 '25 16:09 alexfertel