Scales airdrop amount by token decimal #12

Open
noormohammedb wants to merge 1 commits from fix_airdrop_token_decimal into main
2 changed files with 4 additions and 1 deletions

@ -3,6 +3,7 @@
use clap::{Arg, ArgMatches, Command}; use clap::{Arg, ArgMatches, Command};
use clap_complete::{generate, Shell}; use clap_complete::{generate, Shell};
use detee_cli::config::Config; use detee_cli::config::Config;
use detee_cli::constants::TOKEN_DECIMAL;
use detee_cli::*; use detee_cli::*;
use std::io; use std::io;
use utils::block_on; use utils::block_on;
@ -143,7 +144,8 @@ fn handle_contracts(_matches: &ArgMatches) {
fn handle_airdrop(matches: &ArgMatches) { fn handle_airdrop(matches: &ArgMatches) {
let wallet: String = matches.get_one::<String>("wallet").unwrap().clone(); 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)) { match block_on(general::grpc::admin_airdrop(wallet, tokens)) {
Ok(()) => println!("Success."), Ok(()) => println!("Success."),
Err(e) => println!("Could not give airdrop due to error: {e:?}"), 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 HRATLS_APP_PORT: u32 = 34500;
pub const MAX_REDIRECTS: u16 = 3; pub const MAX_REDIRECTS: u16 = 3;
pub const CONFIG_OVERRIDE_PATH_ENV: &str = "DETEE_API_USER_PATH"; 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] = [ pub const STAGING_BRAIN_URLS: [&str; 3] = [
"https://156.146.63.216:31337", // staging brain 1 "https://156.146.63.216:31337", // staging brain 1