diff --git a/programs/manifest/src/lib.rs b/programs/manifest/src/lib.rs index 6bc850d4f..be997b920 100644 --- a/programs/manifest/src/lib.rs +++ b/programs/manifest/src/lib.rs @@ -10,10 +10,11 @@ pub mod validation; use program::{ batch_update::process_batch_update, claim_seat::process_claim_seat, - create_market::process_create_market, deposit::process_deposit, expand::process_expand, - global_add_trader::process_global_add_trader, global_claim_seat::process_global_claim_seat, - global_create::process_global_create, global_deposit::process_global_deposit, process_swap, - withdraw::process_withdraw, ManifestInstruction, + create_market::process_create_market, deposit::process_deposit, + expand_market::process_expand_market, global_add_trader::process_global_add_trader, + global_claim_seat::process_global_claim_seat, global_create::process_global_create, + global_deposit::process_global_deposit, process_swap, withdraw::process_withdraw, + ManifestInstruction, }; use solana_program::{ account_info::AccountInfo, declare_id, entrypoint::ProgramResult, program_error::ProgramError, @@ -71,7 +72,7 @@ pub fn process_instruction( process_swap(program_id, accounts, data)?; } ManifestInstruction::Expand => { - process_expand(program_id, accounts, data)?; + process_expand_market(program_id, accounts, data)?; } ManifestInstruction::BatchUpdate => { process_batch_update(program_id, accounts, data)?; diff --git a/programs/manifest/src/program/instruction_builders/expand_instruction.rs b/programs/manifest/src/program/instruction_builders/expand_market_instruction.rs similarity index 84% rename from programs/manifest/src/program/instruction_builders/expand_instruction.rs rename to programs/manifest/src/program/instruction_builders/expand_market_instruction.rs index 03326f7f0..e8faef6e9 100644 --- a/programs/manifest/src/program/instruction_builders/expand_instruction.rs +++ b/programs/manifest/src/program/instruction_builders/expand_market_instruction.rs @@ -5,7 +5,7 @@ use solana_program::{ system_program, }; -pub fn expand_instruction(market: &Pubkey, payer: &Pubkey) -> Instruction { +pub fn expand_market_instruction(market: &Pubkey, payer: &Pubkey) -> Instruction { Instruction { program_id: crate::id(), accounts: vec![ diff --git a/programs/manifest/src/program/instruction_builders/mod.rs b/programs/manifest/src/program/instruction_builders/mod.rs index 1be603a13..8133284eb 100644 --- a/programs/manifest/src/program/instruction_builders/mod.rs +++ b/programs/manifest/src/program/instruction_builders/mod.rs @@ -2,7 +2,7 @@ pub mod batch_update_instruction; pub mod claim_seat_instruction; pub mod create_market_instructions; pub mod deposit_instruction; -pub mod expand_instruction; +pub mod expand_market_instruction; pub mod global_add_trader_instruction; pub mod global_claim_seat_instruction; pub mod global_create_instruction; @@ -14,7 +14,7 @@ pub use batch_update_instruction::*; pub use claim_seat_instruction::*; pub use create_market_instructions::*; pub use deposit_instruction::*; -pub use expand_instruction::*; +pub use expand_market_instruction::*; pub use global_add_trader_instruction::*; pub use global_claim_seat_instruction::*; pub use global_create_instruction::*; diff --git a/programs/manifest/src/program/processor/expand.rs b/programs/manifest/src/program/processor/expand_market.rs similarity index 60% rename from programs/manifest/src/program/processor/expand.rs rename to programs/manifest/src/program/processor/expand_market.rs index 4d9ba4b18..aabffd591 100644 --- a/programs/manifest/src/program/processor/expand.rs +++ b/programs/manifest/src/program/processor/expand_market.rs @@ -1,20 +1,20 @@ use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey}; -use crate::validation::loaders::ExpandContext; +use crate::validation::loaders::ExpandMarketContext; use super::shared::expand_market_if_needed; -pub(crate) fn process_expand( +pub(crate) fn process_expand_market( _program_id: &Pubkey, accounts: &[AccountInfo], _data: &[u8], ) -> ProgramResult { - let expand_context: ExpandContext = ExpandContext::load(accounts)?; - let ExpandContext { + let expand_market_context: ExpandMarketContext = ExpandMarketContext::load(accounts)?; + let ExpandMarketContext { market, payer, system_program, - } = expand_context; + } = expand_market_context; expand_market_if_needed(&payer, &market, &system_program)?; diff --git a/programs/manifest/src/program/processor/mod.rs b/programs/manifest/src/program/processor/mod.rs index fafc389ac..b4f7e1225 100644 --- a/programs/manifest/src/program/processor/mod.rs +++ b/programs/manifest/src/program/processor/mod.rs @@ -2,7 +2,7 @@ pub mod batch_update; pub mod claim_seat; pub mod create_market; pub mod deposit; -pub mod expand; +pub mod expand_market; pub mod global_add_trader; pub mod global_claim_seat; pub mod global_create; diff --git a/programs/manifest/src/validation/loaders.rs b/programs/manifest/src/validation/loaders.rs index 27a902db7..31874de86 100644 --- a/programs/manifest/src/validation/loaders.rs +++ b/programs/manifest/src/validation/loaders.rs @@ -98,16 +98,14 @@ impl<'a, 'info> ClaimSeatContext<'a, 'info> { } } -// TODO: rename to ExpandMarketContext to be clear that this only expands -// market, does not work for expanding global. -/// ExpandContext account infos -pub(crate) struct ExpandContext<'a, 'info> { +/// ExpandMarketContext account infos +pub(crate) struct ExpandMarketContext<'a, 'info> { pub payer: Signer<'a, 'info>, pub market: ManifestAccountInfo<'a, 'info, MarketFixed>, pub system_program: Program<'a, 'info>, } -impl<'a, 'info> ExpandContext<'a, 'info> { +impl<'a, 'info> ExpandMarketContext<'a, 'info> { pub fn load(accounts: &'a [AccountInfo<'info>]) -> Result { let account_iter: &mut Iter> = &mut accounts.iter(); diff --git a/programs/wrapper/src/processors/claim_seat.rs b/programs/wrapper/src/processors/claim_seat.rs index 5b5f2488f..f21b435d1 100644 --- a/programs/wrapper/src/processors/claim_seat.rs +++ b/programs/wrapper/src/processors/claim_seat.rs @@ -2,7 +2,7 @@ use std::{cell::RefMut, mem::size_of}; use hypertree::{get_mut_helper, DataIndex, FreeList, TreeReadOperations, NIL}; use manifest::{ - program::{claim_seat_instruction, expand_instruction, get_mut_dynamic_account}, + program::{claim_seat_instruction, expand_market_instruction, get_mut_dynamic_account}, state::{MarketFixed, MarketRefMut}, validation::ManifestAccountInfo, }; @@ -42,7 +42,7 @@ pub(crate) fn process_claim_seat( // Call the Expand CPI invoke( - &expand_instruction(market.key, payer.key), + &expand_market_instruction(market.key, payer.key), &[ manifest_program.info.clone(), owner.info.clone(),