Skip to content

[Feature] selector! macro #937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
antazoey opened this issue Apr 22, 2025 · 1 comment
Closed

[Feature] selector! macro #937

antazoey opened this issue Apr 22, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@antazoey
Copy link

Component

Other (please provide more details)

Describe the feature you would like

I want to be able to easily create selector bytes at compile time using a macro like selector!("getMaker()")

pub const GET_MAKER: [u8; 4] = selector!("getMaker()");

Additional context

I am not sure which component this should/would live in.

@antazoey antazoey added the enhancement New feature or request label Apr 22, 2025
@github-project-automation github-project-automation bot moved this to Todo in Alloy Apr 22, 2025
@DaniPopes
Copy link
Member

You can already achieve this with the sol! macro:

sol! {
    function getMaker();
}

getMakerCall::SELECTOR;

If you really want just keccak256 at compile time, then use keccak-const.

@DaniPopes DaniPopes closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Alloy Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants