Closed alexfertel closed 3 months ago
when importing .sol
files, there's no need for a name, as the name will be picked up from the contract MyContract
definition in the solidity file. Given a file may contain multiple contract _____
definitions, renaming by adding a name there would also be pretty unreliable. So for those reasons, solidity files can only be imported without a name
The following should work for you:
sol!("../examples/erc20/src/test.sol");
Gotcha, makes sense. Maybe update the error message with a suggestion?
Also, I'm guessing if you wanted rpc calls you just do:
sol!(
#[sol(rpc)]
"../examples/erc20/src/test.sol"
);
Feel free to close 👍
yes, I think the invocation with #[sol(rpc)]
will work as exepcted
Component
sol! macro
What version of Alloy are you on?
v0.7.4
Operating System
macOS (Apple Silicon)
Describe the bug
From the docs, I understand that I should be able to use the sol! macro like this as well:
sol!(Erc20, "../examples/erc20/src/test.sol");
However, when I try to do that, I get a "names are not allowed outside of JSON ABI" error, which comes from https://github.com/alloy-rs/core/blob/f5e04aaf2e62799bba27c49942350ac2e3c8e45d/crates/sol-macro-input/src/input.rs#L128