Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repository.workspace = true
# foundry dep
foundry-config.workspace = true

# ethers
ethers-core.workspace = true
# alloy
alloy-primitives.workspace = true

# parser
solang-parser.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
visit::{Visitable, Visitor},
FormatterConfig, InlineConfig, IntTypes, NumberUnderscore,
};
use ethers_core::{types::H160, utils::to_checksum};
use alloy_primitives::Address;
use foundry_config::fmt::{MultilineFuncHeaderStyle, SingleLineBlockStyle};
use itertools::{Either, Itertools};
use solang_parser::pt::ImportPath;
Expand Down Expand Up @@ -2029,7 +2029,7 @@ impl<'a, W: Write> Visitor for Formatter<'a, W> {
Expression::HexNumberLiteral(loc, val, unit) => {
// ref: https://docs.soliditylang.org/en/latest/types.html?highlight=address%20literal#address-literals
let val = if val.len() == 42 {
to_checksum(&H160::from_str(val).expect(""), None)
Address::from_str(val).expect("").to_checksum(None)
} else {
val.to_owned()
};
Expand Down
6 changes: 3 additions & 3 deletions crates/fmt/src/solang_ext/ast_eq.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use ethers_core::types::{H160, I256, U256};
use alloy_primitives::{Address, I256, U256};
use solang_parser::pt::*;
use std::str::FromStr;

/// Helper to convert a string number into a comparable one
fn to_num(string: &str) -> I256 {
if string.is_empty() {
return I256::from(0)
return I256::ZERO
}
string.replace('_', "").trim().parse().unwrap()
}
Expand Down Expand Up @@ -147,7 +147,7 @@ where

impl AstEq for String {
fn ast_eq(&self, other: &Self) -> bool {
match (H160::from_str(self), H160::from_str(other)) {
match (Address::from_str(self), Address::from_str(other)) {
(Ok(left), Ok(right)) => left.eq(&right),
_ => self == other,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fmt/src/string.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Helpfers for dealing with quoted strings
//! Helpers for dealing with quoted strings

/// The state of a character in a string with quotable components
/// This is a simplified version of the
Expand Down