Skip to content

Commit

Permalink
Simplify output for schedule in vesting-contract-cli #38
Browse files Browse the repository at this point in the history
  • Loading branch information
Semen Medvedev committed May 18, 2022
1 parent 8504ec6 commit 370515e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions addin-vesting/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -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::<u64>());
}

fn main() {
Expand Down

0 comments on commit 370515e

Please sign in to comment.