From 370515e0ee3c453a93439236af1c4f82495aab50 Mon Sep 17 00:00:00 2001 From: Semen Medvedev Date: Wed, 18 May 2022 16:17:54 +0700 Subject: [PATCH] Simplify output for schedule in vesting-contract-cli #38 --- addin-vesting/cli/src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addin-vesting/cli/src/main.rs b/addin-vesting/cli/src/main.rs index 838bfcd..83377c4 100644 --- a/addin-vesting/cli/src/main.rs +++ b/addin-vesting/cli/src/main.rs @@ -1,5 +1,5 @@ // use std::str::FromStr; -use chrono::{DateTime, Duration}; +use chrono::{NaiveDateTime, DateTime, Duration}; use clap::{ crate_description, crate_name, crate_version, value_t, App, AppSettings, Arg, SubCommand, }; @@ -425,11 +425,16 @@ fn report_vesting_record_info(vesting_record: &VestingRecord) { let schedules = &vesting_record.schedule; + msg!("Schedule:"); for i in 0..schedules.len() { - msg!("\nSCHEDULE {:?}", i); - msg!("Release Height: {:?}", &schedules[i].release_time); - msg!("Amount: {:?}", &schedules[i].amount); + msg!(" {:2}: amount {}, timestamp {} ({})", + i, + &schedules[i].amount, + &schedules[i].release_time, + NaiveDateTime::from_timestamp(schedules[i].release_time.try_into().unwrap(), 0u32), + ); } + msg!("Total amount: {}", schedules.iter().map(|v| v.amount).sum::()); } fn main() {