diff --git a/mango_v4.json b/mango_v4.json index 9c9a7bde6..948ecd217 100644 --- a/mango_v4.json +++ b/mango_v4.json @@ -10580,6 +10580,9 @@ }, { "name": "Swap" + }, + { + "name": "SwapWithoutFee" } ] } diff --git a/programs/mango-v4/src/accounts_ix/flash_loan.rs b/programs/mango-v4/src/accounts_ix/flash_loan.rs index a60a6b202..424af18d0 100644 --- a/programs/mango-v4/src/accounts_ix/flash_loan.rs +++ b/programs/mango-v4/src/accounts_ix/flash_loan.rs @@ -92,6 +92,12 @@ pub struct FlashLoanEnd<'info> { #[derive(PartialEq, Copy, Clone, Debug, AnchorSerialize, AnchorDeserialize)] #[repr(u8)] pub enum FlashLoanType { + /// An arbitrary flash loan Unknown, + /// A flash loan used for a swap where one token is exchanged for another. + /// + /// Deposits in this type get charged the flash_loan_swap_fee_rate Swap, + /// Like Swap, but without the flash_loan_swap_fee_rate + SwapWithoutFee, } diff --git a/programs/mango-v4/src/instructions/flash_loan.rs b/programs/mango-v4/src/instructions/flash_loan.rs index cdd3a59cd..5b2ecfc18 100644 --- a/programs/mango-v4/src/instructions/flash_loan.rs +++ b/programs/mango-v4/src/instructions/flash_loan.rs @@ -378,10 +378,10 @@ pub fn flash_loan_end<'key, 'accounts, 'remaining, 'info>( match flash_loan_type { FlashLoanType::Unknown => {} - FlashLoanType::Swap => { + FlashLoanType::Swap | FlashLoanType::SwapWithoutFee => { require_msg!( changes.len() == 2, - "when flash_loan_type is Swap there must be exactly 2 token vault changes" + "when flash_loan_type is Swap or SwapWithoutFee there must be exactly 2 token vault changes" ) } } diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index 33e07c805..bb18e1f3a 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -10580,6 +10580,9 @@ export type MangoV4 = { }, { "name": "Swap" + }, + { + "name": "SwapWithoutFee" } ] } @@ -24755,6 +24758,9 @@ export const IDL: MangoV4 = { }, { "name": "Swap" + }, + { + "name": "SwapWithoutFee" } ] } diff --git a/ts/client/src/types.ts b/ts/client/src/types.ts index 09d1b97f5..47d378477 100644 --- a/ts/client/src/types.ts +++ b/ts/client/src/types.ts @@ -9,11 +9,13 @@ export class FlashLoanWithdraw { export type FlashLoanType = | { unknown: Record } - | { swap: Record }; + | { swap: Record } + | { swapWithoutFee: Record }; // eslint-disable-next-line @typescript-eslint/no-namespace export namespace FlashLoanType { export const unknown = { unknown: {} }; export const swap = { swap: {} }; + export const swapWithoutFee = { swapWithoutFee: {} }; } export class InterestRateParams {