Skip to content
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

Replace pub type Int = ethereum_types::U256 with an I256 #294

Open
Autoparallel opened this issue May 10, 2023 · 2 comments
Open

Replace pub type Int = ethereum_types::U256 with an I256 #294

Autoparallel opened this issue May 10, 2023 · 2 comments

Comments

@Autoparallel
Copy link

pub type Int = ethereum_types::U256;

Can this be replaced with something like an ethereum_types::I256?

It seems like that is valid. In ethers-rs there is a I256 type that this would be handy to interface with directly. Upon parsing some events in revm, the fact that Int is really a U256 under the hood is not optimal.

@cliff0412
Copy link

you can use I256 and convert to bytes; then use U256::from(bytes).
the raw slot is 256 bits, which can be represented by U256 actually; just ensure that the raw bytes are correct

@Akagi201
Copy link

I found the solution: Token::Int(I256::from_dec_str(&a_string_type).unwrap().into_raw())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants