Skip to content

[Feature] Add create_eof to Address #924

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

Open
rakita opened this issue Apr 5, 2025 · 4 comments
Open

[Feature] Add create_eof to Address #924

rakita opened this issue Apr 5, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rakita
Copy link

rakita commented Apr 5, 2025

Component

primitives

Describe the feature you would like

Similar to how we have .create and .create2 address calculations we should add .create_eof that would create new address for eofcreate instruction. Salt is B256

Code for it is:

    let mut buffer = [0; 65];
    buffer[0] = 0xff;
    // 1..13 are padded zeroes
    buffer[13..33].copy_from_slice(address.as_ref());
    buffer[33..].copy_from_slice(salt.as_ref());
    Address::from_word(keccak256(buffer))

Additional context

No response

@rakita rakita added the enhancement New feature or request label Apr 5, 2025
@github-project-automation github-project-automation bot moved this to Todo in Alloy Apr 5, 2025
@nadtech-hub
Copy link

@DaniPopes DaniPopes added the good first issue Good for newcomers label Apr 16, 2025
@0xriazaka
Copy link

can i work on this?

@DaniPopes
Copy link
Member

sure go ahead!

@rakita
Copy link
Author

rakita commented Apr 17, 2025

@0xriazaka have bumped the snipped, had one bug there it should be buffer[13..33].copy_from_slice(address.as_ref()); and not buffer[13..].copy_from_slice(address.as_ref());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Todo
Development

No branches or pull requests

4 participants