Skip to content

Commit

Permalink
More bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Jan 9, 2025
1 parent af1df36 commit 6238fa1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion programs/helium-sub-daos/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ pub struct SubDaoEpochInfoV0 {
}

impl SubDaoEpochInfoV0 {
pub const SIZE: usize = 60 + 8 + std::mem::size_of::<SubDaoEpochInfoV0>() - 8 - 8 - 8 - 4; // subtract 8 the extra u64 we added to vehnt, dc onboarding fees paid, hnt rewards issued, and prev percentage
pub const SIZE: usize = 60 + 8 + std::mem::size_of::<SubDaoEpochInfoV0>() - 8 - 8 - 8; // subtract 8 the extra u64 we added to vehnt, dc onboarding fees paid, hnt rewards issued, and prev percentage
}
impl SubDaoEpochInfoV0 {
pub fn start_ts(&self) -> i64 {
Expand Down
8 changes: 7 additions & 1 deletion programs/helium-sub-daos/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ pub fn caclulate_vhnt_info(
.unwrap(),
)
.unwrap()
} else if expiration_ts == 0 {
position.lockup.seconds_left(curr_ts)
} else {
min(
u64::try_from(expiration_ts.checked_sub(curr_ts).unwrap()).unwrap(),
Expand All @@ -328,7 +330,11 @@ pub fn caclulate_vhnt_info(
} else {
position.voting_power_precise(voting_mint_config, curr_ts)?
};
let delegation_end_ts = min(expiration_ts, position.lockup.end_ts);
let delegation_end_ts = if expiration_ts == 0 {
position.lockup.end_ts
} else {
min(expiration_ts, position.lockup.end_ts)
};
let vehnt_at_delegation_end =
position.voting_power_precise(voting_mint_config, delegation_end_ts)?;

Expand Down
1 change: 1 addition & 0 deletions utils/vehnt/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions utils/vehnt/src/cli/delegated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ impl Delegated {
epoch_infos_by_subdao_and_epoch
.insert(Pubkey::from_str(MOBILE_SUBDAO).unwrap(), HashMap::new());
for info in infos {
if info.1.sub_dao == Pubkey::from_str(IOT_SUBDAO).unwrap() || info.1.sub_dao == Pubkey::from_str(MOBILE_SUBDAO).unwrap() {
epoch_infos_by_subdao_and_epoch
.get_mut(&info.1.sub_dao)
.unwrap()
.insert(info.1.epoch, info);
.get_mut(&info.1.sub_dao)
.unwrap()
.insert(info.1.epoch, info);
}
}
let mut new_epoch_infos_by_subdao_and_epoch: HashMap<
Pubkey,
Expand Down

0 comments on commit 6238fa1

Please sign in to comment.