add whitelist to swap

This commit is contained in:
Hardhat Chad
2025-08-25 17:18:40 -07:00
parent 0a4f463c90
commit 386eb3cdbd
2 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
use ore_api::prelude::*;
use steel::*;
use crate::whitelist::AUTHORIZED_ACCOUNTS;
/// Swap in a hashpower market.
pub fn process_swap(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
// Parse args.
@@ -17,6 +19,11 @@ pub fn process_swap(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
return Err(ProgramError::NotEnoughAccountKeys);
};
signer_info.is_signer()?;
if !AUTHORIZED_ACCOUNTS.contains(signer_info.key) {
return Err(ProgramError::InvalidAccountData);
}
let block: &mut Block = block_info
.as_account_mut::<Block>(&ore_api::ID)?
.assert_mut(|b| b.start_slot <= clock.slot)? // Block has started

View File

@@ -1,7 +1,7 @@
use solana_program::pubkey;
use steel::*;
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 204] = [
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 203] = [
pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS"),
pubkey!("6B9PjpHfbhPcSakS5UQ7ZctgbPujfsryVRpDecskGLiz"),
pubkey!("J89R2jNKbfkFoJjvkjnwwepvJRE2M8VPQ67RhPeQfVY8"),
@@ -180,7 +180,7 @@ pub const AUTHORIZED_ACCOUNTS: [Pubkey; 204] = [
pubkey!("4DGxxu1fTbteKXm6USy3enW7S18iPFuJkqhKrSopGeBS"),
pubkey!("AkmZXNFjEL6LgxGi1eM81iTXfwNJgeFG7iXUiFfmHni8"),
pubkey!("297ogus15jvgePqXZCwT8nB1gvwgCJYdKcuXKiyH4TfS"),
pubkey!("3yKHWBKD5DeX7vG2ESJwWQWF4HgmgHumeXPhaZnqiore"),
// pubkey!("3yKHWBKD5DeX7vG2ESJwWQWF4HgmgHumeXPhaZnqiore"),
pubkey!("4AQBsVmECmSBPh4JicNhGaT9waHETNxeNkaz72tezgSR"),
pubkey!("6zWbGFC9WgPymyrTFM2MKAwLu8vKXwZJjFUcksikdabE"),
pubkey!("Xp7Swytm55aTD8onDegFAVm4gC7zdCCkYMobRg5oHfr"),