Skip to content

Commit

Permalink
fix: cargo fmt (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
wei3erHase authored Oct 4, 2024
1 parent 175303f commit 8dbf3fc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,20 @@ impl Processor {
return Err(ProgramError::InvalidAccountData);
}
state_header.pack_into_slice(&mut data);

let clock = Clock::from_account_info(&clock_sysvar_account)?;
let mut total_amount: u64 = 0;

// NOTE: validate time delta to be 0 (unlocked), or a set of predefined values (1 month, 3 months, ...)
let release_time;
match schedule.time_delta {
/* Valid time_delta values:
* 0: unlocked (with 7 day withdrawal period)
* 12 months = 12 * 30 * 86400 = 31_104_000
* 18 months = 18 * 30 * 86400 = 46_656_000
* 24 months = 24 * 30 * 86400 = 62_208_000
* 36 months = 36 * 30 * 86400 = 93_312_000
*/
* 0: unlocked (with 7 day withdrawal period)
* 12 months = 12 * 30 * 86400 = 31_104_000
* 18 months = 18 * 30 * 86400 = 46_656_000
* 24 months = 24 * 30 * 86400 = 62_208_000
* 36 months = 36 * 30 * 86400 = 93_312_000
*/
0 => {
release_time = 0;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ impl Processor {
// Unlock the schedules that have reached maturity
let clock = Clock::from_account_info(&clock_sysvar_account)?;
let mut schedule = unpack_schedule(&packed_state.borrow()[VestingScheduleHeader::LEN..])?;

let mut total_amount_to_transfer = 0;

if schedule.release_time == 0 {
Expand Down Expand Up @@ -343,7 +343,7 @@ impl Processor {
msg!("Shouldn't initialize withdrawal for already initialized schedule");
return Err(ProgramError::InvalidArgument);
}

// Withdrawal period is 7 days = 7 * 86400 = 604_800
schedule.release_time = clock.unix_timestamp as u64 + 604_800;

Expand Down

0 comments on commit 8dbf3fc

Please sign in to comment.