Skip to content

Commit

Permalink
pr
Browse files Browse the repository at this point in the history
  • Loading branch information
ebatsell committed Nov 13, 2024
1 parent cd8e91d commit 734fc4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion core/src/tracked_mints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ use crate::{discriminators::Discriminators, error::TipRouterError};
pub struct MintEntry {
st_mint: Pubkey,
vault_index: PodU64,
reserved: [u8; 32],
}

impl MintEntry {
pub fn new(mint: Pubkey, vault_index: u64) -> Self {
Self {
st_mint: mint,
vault_index: PodU64::from(vault_index),
reserved: [0; 32],
}
}

Expand All @@ -38,7 +40,7 @@ impl Default for MintEntry {
pub struct TrackedMints {
pub ncn: Pubkey,
pub bump: u8,
pub reserved: [u8; 7],
pub reserved: [u8; 7], // TODO extend to 127; figure out serde issue
pub st_mint_list: [MintEntry; 16], // TODO extend to 64; figure out serde issue
}

Expand Down
12 changes: 8 additions & 4 deletions program/src/register_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ pub fn process_register_mint(program_id: &Pubkey, accounts: &[AccountInfo]) -> P
// Once tracked_mints.mint_count() == ncn.vault_count, the weight table can be initialized
// Once the weight table is initialized, you can't add any more mints
if weight_table.owner.eq(&system_program::ID) {
let expected_pubkey = WeightTable::find_program_address(program_id, ncn.key, ncn_epoch).0;
if weight_table.key.ne(&expected_pubkey) {
msg!("Weight table incorrect PDA");
return Err(ProgramError::InvalidAccountData);
}
load_system_account(weight_table, false)?;
} else if weight_table.owner.eq(program_id) {
}

if weight_table.owner.eq(program_id) {
WeightTable::load(program_id, weight_table, ncn, ncn_epoch, false)?;
return Err(TipRouterError::TrackedMintsLocked.into());
} else {
msg!("Weight table account is not owned by this program or the system program");
return Err(ProgramError::InvalidAccountOwner);
}

// Verify tickets are active
Expand Down

0 comments on commit 734fc4a

Please sign in to comment.