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

Color Improvements and Addr Checksum #9

Merged
merged 1 commit into from
Sep 13, 2023
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
22 changes: 8 additions & 14 deletions src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;

use ethers::types::{Eip1559TransactionRequest, H160, U256};
use ethers::utils::get_contract_address;
use ethers::utils::{get_contract_address, to_checksum};
use ethers::{
middleware::SignerMiddleware,
providers::{Http, Middleware, Provider},
Expand Down Expand Up @@ -61,11 +61,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<()> {

let addr = wallet.address();

println!(
"Deployer address: {}{}",
"0x".grey(),
hex::encode(addr).grey()
);
println!("Deployer address: {}", to_checksum(&addr, None).grey(),);

let nonce = client
.get_transaction_count(addr, None)
Expand Down Expand Up @@ -104,9 +100,9 @@ on the --mode flag under cargo stylus deploy --help"#
let balance = provider.get_balance(addr, None).await?;
if balance == U256::zero() {
bail!(
r#"address 0x{} has 0 balance onchain – please refer to our Quickstart guide for deploying
r#"address {} has 0 balance onchain – please refer to our Quickstart guide for deploying
programs to Stylus chains here https://docs.arbitrum.io/stylus/stylus-quickstart"#,
hex::encode(addr),
to_checksum(&addr, None),
);
}
}
Expand Down Expand Up @@ -134,9 +130,8 @@ programs to Stylus chains here https://docs.arbitrum.io/stylus/stylus-quickstart
println!("");
println!("{}", "====DEPLOYMENT====".grey());
println!(
"Deploying program to address {}{}",
"0x".mint(),
hex::encode(expected_program_addr).mint()
"Deploying program to address {}",
to_checksum(&expected_program_addr, None).mint(),
);
let deployment_calldata = program_deployment_calldata(&deploy_ready_code);

Expand Down Expand Up @@ -170,9 +165,8 @@ programs to Stylus chains here https://docs.arbitrum.io/stylus/stylus-quickstart
.unwrap_or(expected_program_addr);
println!("{}", "====ACTIVATION====".grey());
println!(
"Activating program at address {}{}",
"0x".mint(),
hex::encode(program_addr).mint()
"Activating program at address {}",
to_checksum(&program_addr, None).mint(),
);
let activate_calldata = activation_calldata(&program_addr);

Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async fn main() -> eyre::Result<()> {
if let Err(e) = new::new_stylus_project(&name, minimal) {
println!(
"Could not create new stylus project with name {name}: {}",
e.red()
e.pink()
);
};
}
Expand All @@ -178,21 +178,21 @@ async fn main() -> eyre::Result<()> {
if let Err(e) = export_abi::export_json_abi(release, output) {
println!(
"Could not export Stylus program Solidity ABI as JSON: {}",
e.red()
e.pink()
);
};
} else if let Err(e) = export_abi::export_solidity_abi(release, output) {
println!("Could not export Stylus program Solidity ABI: {}", e.red());
println!("Could not export Stylus program Solidity ABI: {}", e.pink());
}
}
StylusSubcommands::Check(cfg) => {
if let Err(e) = check::run_checks(cfg).await {
println!("Stylus checks failed: {}", e.red());
println!("Stylus checks failed: {}", e.pink());
};
}
StylusSubcommands::Deploy(cfg) => {
if let Err(e) = deploy::deploy(cfg).await {
println!("Deploy / activation command failed: {}", e.red());
println!("Deploy / activation command failed: {}", e.pink());
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ where
.map_err(|e| eyre!("could not format effective gas price: {e}"))?;
println!(
"Confirmed {tx_kind} tx {}{}",
"0x".pink(),
hex::encode(tx_hash.as_bytes()).pink(),
"0x".mint(),
hex::encode(tx_hash.as_bytes()).mint(),
);
println!(
"Gas units used {}, effective gas price {} gwei",
Expand Down
Loading