Skip to content

Commit

Permalink
add checks for creating and locking pool
Browse files Browse the repository at this point in the history
  • Loading branch information
husreo committed Dec 11, 2024
1 parent 941d025 commit 8d21ab1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions programs/pump-science/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,7 @@ pub enum ContractError {

#[msg("Invalid Fee Receiver")]
InvalidFeeReceiver,

#[msg("Invalid Migration Authority")]
InvalidMigrationAuthority,
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ pub struct InitializePoolWithConfig<'info> {
/// CHECK: Protocol fee token b accounts
pub protocol_token_b_fee: UncheckedAccount<'info>,

#[account(mut)]
/// CHECK: Admin account
#[account(mut, constraint = payer.key() == global.migration_authority @ ContractError::InvalidMigrationAuthority)]
pub payer: Signer<'info>,

#[account(mut)]
Expand Down
15 changes: 11 additions & 4 deletions programs/pump-science/src/instructions/migration/lock_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ use anchor_lang::prelude::*;
use anchor_lang::solana_program::{instruction::Instruction, program::invoke_signed};
use anchor_spl::associated_token;
use crate::constants::{VAULT_SEED, METEORA_PROGRAM_KEY};
use crate::errors::ContractError;
use crate::Global;
use std::str::FromStr;
use crate::state::meteora::{get_function_hash, get_lock_lp_ix_data};


#[derive(Accounts)]
pub struct LockPool<'info> {

#[account(
mut,
seeds = [Global::SEED_PREFIX.as_bytes()],
constraint = global.initialized == true @ ContractError::NotInitialized,
bump,
)]
global: Box<Account<'info, Global>>,

#[account(
seeds = [VAULT_SEED],
bump
Expand Down Expand Up @@ -55,8 +63,7 @@ pub struct LockPool<'info> {
/// CHECK: Accounts to bootstrap the pool with initial liquidity
pub payer_pool_lp: UncheckedAccount<'info>,

#[account(mut)]
/// CHECK: Admin account
#[account(mut, constraint = payer.key() == global.migration_authority @ ContractError::InvalidMigrationAuthority)]
pub payer: Signer<'info>,

/// CHECK: Token program account
Expand Down

0 comments on commit 8d21ab1

Please sign in to comment.