-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(forge fmt
): add --fix-checksum
flag to automatically fix invalid checksum addresses in contracts
#10245
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
Comments
can i get assigned to this one? |
fmt checksum
to automatically fix invalid checksum addresses in contractsforge fmt
): add --fix-checksum
flag to automatically fix invalid checksum addresses in contracts
@Mouzayan assigned! |
I’m currently working on this issue, to track my progress see here. |
Great! Tip: you can use Alloy Core's |
It can be useful to look at the You can also have a look at foundry/crates/fmt/src/formatter.rs Lines 2363 to 2364 in 7825a06
foundry/crates/fmt/src/formatter.rs Lines 2433 to 2442 in 7825a06
|
As you can see above, addresses are already checksummed in the foundry/crates/fmt/src/formatter.rs Lines 2433 to 2442 in 7825a06
You can try it out for yourself: function f() {
address a = 0x7a250d5630B4cf539739df2c5dacb4c659f2488d;
} $ forge build
Error (9429): This looks like an address but has an invalid checksum. ...
$ forge fmt
$ forge build
# OK |
Component
Forge
Describe the feature you would like
fmt checksum
would automatically fix checksum issues:Motivating Case
Existing Error
Additional context
When
fmt checksum
fixes any issue it SHOULD alert user that it fixed checksum issue and thatused as an address, please prepend '00'.
in case otherwiseThe text was updated successfully, but these errors were encountered: