alloy-rs / book

Book on all things Alloy
Apache License 2.0
27 stars 5 forks source link

docs: loading contract from sol file fixed #57

Closed Aviksaikat closed 3 weeks ago

Aviksaikat commented 3 weeks ago

Summary

This is not the proper way to load solidity files per alloy=0.5.4.

sol!(
    Counter,
    "artifacts/Counter.sol"
);

Problem

names are not allowed outside of JSON ABI

It should be

sol!(
    "artifacts/Counter.sol"
);

Example

The following snippet worked perfectly

sol!(
    // IUniswapV2Factory,
    "contracts/IUniswapV2Factory.sol"
);
zerosnacks commented 3 weeks ago

Thanks @Aviksaikat!

Related: https://github.com/alloy-rs/core/issues/636#issuecomment-2134698618 / https://github.com/alloy-rs/core/pull/647/files