alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
763 stars 137 forks source link

[Feature] Expose ABI bytes from sol macro generated code #620

Closed erikreppel closed 4 months ago

erikreppel commented 4 months ago

Component

contract

Describe the feature you would like

When using the sol! macro with an ABI, the generated code actually already contains the abi bytes but its included using const _ = .... It would be useful to be able to access ABIs at runtime for things like dynamically generating table schemas.

const _: &'static [u8] = ::core::include_bytes!("/Users/erikreppel/dev/zora-core/crates/zora-contracts/src/abis/ZoraERC721Drop.json");

Additional context

image
DaniPopes commented 4 months ago

The file is included for it to be caught by the build system (cargo) so that the file recompiles if any changes are made to the source file.

You can just include the file yourself separately.