Skip to content

Commit

Permalink
update faucet tracing & default amount (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
wow-sven committed May 21, 2024
1 parent bcc61f2 commit 9310ea8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/rooch-faucet/src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serenity::model::gateway::Ready;
use serenity::prelude::*;
use std::str::FromStr;

#[derive(Parser, Clone)]
#[derive(Parser, Debug, Clone)]
#[clap(rename_all = "kebab-case")]
pub struct DiscordConfig {
#[arg(long, env = "ROOCH_FAUCET_DISCORD_TOKEN")]
Expand Down
12 changes: 9 additions & 3 deletions crates/rooch-faucet/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use tokio::sync::{mpsc::Receiver, RwLock, RwLockWriteGuard};
use rooch_rpc_api::jsonrpc_types::KeptVMStatusView;
use rooch_types::error::RoochError;

pub const DEFAULT_AMOUNT: u64 = 1_000 * 8;
pub const DEFAULT_AMOUNT: u64 = 5_000_000_000;

#[derive(Parser, Debug, Clone)]
pub struct FaucetConfig {
Expand Down Expand Up @@ -97,14 +97,20 @@ impl Faucet {
while let Some(request) = self.faucet_receiver.write().await.recv().await {
match request {
FaucetRequest::FixedBTCAddressRequest(req) => {
let recipient_str = req.recipient.to_string();
let mul_addr = MultiChainAddress::from(req.recipient);
if let Err(e) = self.transfer_gases_with_multi_addr(mul_addr).await {
tracing::error!("Transfer gases failed {}", e)
tracing::error!("Transfer gases to {} failed {}", recipient_str, e)
} else {
tracing::error!("Transfer gases success {}", recipient_str)
}
}
FaucetRequest::FixedRoochAddressRequest(req) => {
let recipient_str = req.recipient.to_string();
if let Err(e) = self.transfer_gases(req.recipient).await {
tracing::error!("Transfer gases failed {}", e)
tracing::error!("Transfer gases to {} failed {}", recipient_str, e)
} else {
tracing::error!("Transfer gases to {} success", recipient_str)
}
}
_ => {}
Expand Down
4 changes: 2 additions & 2 deletions crates/rooch-faucet/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const CONCURRENCY_LIMIT: usize = 10;

// const PROM_PORT_ADDR: &str = "0.0.0.0:9184";

#[derive(Parser, Clone)]
#[derive(Parser, Debug, Clone)]
#[clap(rename_all = "kebab-case")]
pub struct AppConfig {
#[clap(long, default_value_t = 50052)]
Expand Down Expand Up @@ -154,7 +154,7 @@ async fn request_gas(

match result {
Ok(()) => {
tracing::info!("request gas success: {}", recipient);
tracing::info!("request gas success add queue: {}", recipient);
(
StatusCode::CREATED,
Json(FaucetResponse::from("Success".to_string())),
Expand Down

0 comments on commit 9310ea8

Please sign in to comment.