From 7126ca108ddd9cc7c43d659a11f08140041bc629 Mon Sep 17 00:00:00 2001 From: Noor Date: Thu, 17 Jul 2025 19:41:41 +0530 Subject: [PATCH] Scales airdrop amount by token decimal Ensures the airdrop amount is correctly scaled by the token decimal value. This prevents issues with incorrect token amounts being airdropped. --- src/bin/super-detee-cli.rs | 4 +++- src/constants.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/super-detee-cli.rs b/src/bin/super-detee-cli.rs index f0e9c18..a5881b3 100644 --- a/src/bin/super-detee-cli.rs +++ b/src/bin/super-detee-cli.rs @@ -3,6 +3,7 @@ use clap::{Arg, ArgMatches, Command}; use clap_complete::{generate, Shell}; use detee_cli::config::Config; +use detee_cli::constants::TOKEN_DECIMAL; use detee_cli::*; use std::io; use utils::block_on; @@ -143,7 +144,8 @@ fn handle_contracts(_matches: &ArgMatches) { fn handle_airdrop(matches: &ArgMatches) { let wallet: String = matches.get_one::("wallet").unwrap().clone(); - let tokens = *matches.get_one::("amount").unwrap(); + let nano_tokens = *matches.get_one::("amount").unwrap(); + let tokens = nano_tokens * TOKEN_DECIMAL; match block_on(general::grpc::admin_airdrop(wallet, tokens)) { Ok(()) => println!("Success."), Err(e) => println!("Could not give airdrop due to error: {e:?}"), diff --git a/src/constants.rs b/src/constants.rs index e7ceb52..eeb28be 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; pub const HRATLS_APP_PORT: u32 = 34500; pub const MAX_REDIRECTS: u16 = 3; pub const CONFIG_OVERRIDE_PATH_ENV: &str = "DETEE_API_USER_PATH"; +pub const TOKEN_DECIMAL: u64 = 1_000_000_000; pub const STAGING_BRAIN_URLS: [&str; 3] = [ "https://156.146.63.216:31337", // staging brain 1