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.
This commit is contained in:
Noor 2025-07-17 19:41:41 +05:30
parent d753358795
commit 7126ca108d
Signed by: noormohammedb
GPG Key ID: D83EFB8B3B967146
2 changed files with 4 additions and 1 deletions

@ -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::<String>("wallet").unwrap().clone();
let tokens = *matches.get_one::<u64>("amount").unwrap();
let nano_tokens = *matches.get_one::<u64>("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:?}"),

@ -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