Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Clock from lockup #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions programs/lockup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ pub mod lockup {

/// Convenience function for UI's to calculate the withdrawable amount.
pub fn available_for_withdrawal(ctx: Context<AvailableForWithdrawal>) -> 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(())
Expand Down Expand Up @@ -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
Expand Down