From 16e115d6ac99a845fd4d28818326d8cdf15e575b Mon Sep 17 00:00:00 2001 From: Ian Macalinao Date: Sun, 17 Apr 2022 02:56:45 -0500 Subject: [PATCH] Remove Clock from lockup --- programs/lockup/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/programs/lockup/src/lib.rs b/programs/lockup/src/lib.rs index 73fa00b..a3c1739 100644 --- a/programs/lockup/src/lib.rs +++ b/programs/lockup/src/lib.rs @@ -242,10 +242,8 @@ pub mod lockup { /// Convenience function for UI's to calculate the withdrawable amount. pub fn available_for_withdrawal(ctx: Context) -> Result<()> { - let available = calculator::available_for_withdrawal( - &ctx.accounts.release, - ctx.accounts.clock.unix_timestamp, - ); + let now = Clock::get()?.unix_timestamp; + let available = calculator::available_for_withdrawal(&ctx.accounts.release, now); // Log as string so that JS can read as a BN. msg!(&format!("{{ \"result\": \"{}\" }}", available)); Ok(()) @@ -396,8 +394,8 @@ impl<'info> Withdraw<'info> { #[derive(Accounts)] pub struct AvailableForWithdrawal<'info> { + /// [Release] to inspect. pub release: Account<'info, Release>, - pub clock: Sysvar<'info, Clock>, } /// Contains information about a beneficiary and the tokens it can claim