diff --git a/programs/helium-sub-daos/src/instructions/delegation/claim_rewards_v1.rs b/programs/helium-sub-daos/src/instructions/delegation/claim_rewards_v1.rs index b2392324b..f067725cd 100644 --- a/programs/helium-sub-daos/src/instructions/delegation/claim_rewards_v1.rs +++ b/programs/helium-sub-daos/src/instructions/delegation/claim_rewards_v1.rs @@ -137,8 +137,12 @@ pub fn handler(ctx: Context, args: ClaimRewardsArgsV0) -> Result } } - let delegated_vehnt_at_epoch = - position.voting_power(voting_mint_config, ctx.accounts.dao_epoch_info.start_ts())?; + let epoch_start_ts = ctx.accounts.dao_epoch_info.start_ts(); + let delegated_vehnt_at_epoch = if delegated_position.expiration_ts > epoch_start_ts { + position.voting_power(voting_mint_config, epoch_start_ts)? + } else { + 0 + }; msg!("Staked {} veHNT at start of epoch with {} total veHNT delegated to dao and {} total rewards to dao", delegated_vehnt_at_epoch, diff --git a/programs/voter-stake-registry/src/instructions/withdraw_v0.rs b/programs/voter-stake-registry/src/instructions/withdraw_v0.rs index 68ebf9590..87149d192 100644 --- a/programs/voter-stake-registry/src/instructions/withdraw_v0.rs +++ b/programs/voter-stake-registry/src/instructions/withdraw_v0.rs @@ -1,12 +1,11 @@ -use crate::error::*; -use crate::position_seeds; -use crate::state::*; use anchor_lang::prelude::*; use anchor_spl::{ associated_token::AssociatedToken, token::{transfer, Mint, Token, TokenAccount, Transfer}, }; +use crate::{error::*, position_seeds, state::*}; + #[derive(AnchorSerialize, AnchorDeserialize, Clone, Default)] pub struct WithdrawArgsV0 { pub amount: u64, @@ -33,8 +32,8 @@ pub struct WithdrawV0<'info> { #[account( init_if_needed, payer = position_authority, - token::mint = mint, - token::authority = position_authority, + associated_token::mint = mint, + associated_token::authority = position_authority, constraint = position_token_account.amount > 0 )] pub position_token_account: Box>,