Skip to content

Commit 6cad583

Browse files
committed
feat(processor): implement place_order with fund-locking + Order PDA (Ticket 2.2)
1 parent 86a5503 commit 6cad583

4 files changed

Lines changed: 847 additions & 29 deletions

File tree

src/instruction.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ pub struct PlaceOrderAccounts<'a> {
130130
pub trader_quote_ata: &'a AccountView,
131131
pub base_vault: &'a AccountView,
132132
pub quote_vault: &'a AccountView,
133+
pub base_mint: &'a AccountView,
134+
pub quote_mint: &'a AccountView,
133135
pub system_program: &'a AccountView,
134136
pub token_program: &'a AccountView,
135137
}
@@ -138,7 +140,10 @@ impl<'a> TryFrom<&'a [AccountView]> for PlaceOrderAccounts<'a> {
138140
type Error = FluxDexError;
139141

140142
fn try_from(accounts: &'a [AccountView]) -> Result<Self, Self::Error> {
141-
if accounts.len() != 9 {
143+
// The `base_mint`/`quote_mint` accounts are required (beyond TDD §5.3's
144+
// original list) so the token CPI can use `transfer_checked`, which
145+
// validates the mint and its decimals (TDD §6.1).
146+
if accounts.len() != 11 {
142147
return Err(FluxDexError::InvalidAccountCount);
143148
}
144149

@@ -150,6 +155,8 @@ impl<'a> TryFrom<&'a [AccountView]> for PlaceOrderAccounts<'a> {
150155
trader_quote_ata,
151156
base_vault,
152157
quote_vault,
158+
base_mint,
159+
quote_mint,
153160
system_program,
154161
token_program,
155162
] = accounts
@@ -192,6 +199,8 @@ impl<'a> TryFrom<&'a [AccountView]> for PlaceOrderAccounts<'a> {
192199
trader_quote_ata,
193200
base_vault,
194201
quote_vault,
202+
base_mint,
203+
quote_mint,
195204
system_program,
196205
token_program,
197206
})

0 commit comments

Comments
 (0)