diff --git a/mango_v4.json b/mango_v4.json index f73a43984..d798015ea 100644 --- a/mango_v4.json +++ b/mango_v4.json @@ -725,6 +725,10 @@ { "name": "collateralFeePerDay", "type": "f32" + }, + { + "name": "tier", + "type": "string" } ] }, @@ -1153,6 +1157,12 @@ "type": { "option": "bool" } + }, + { + "name": "tierOpt", + "type": { + "option": "string" + } } ] }, @@ -7664,7 +7674,7 @@ "type": "u8" }, { - "name": "padding", + "name": "tier", "type": { "array": [ "u8", @@ -10143,9 +10153,13 @@ "type": { "array": [ "u8", - 119 + 111 ] } + }, + { + "name": "forceAlign", + "type": "u64" } ] } diff --git a/programs/mango-v4/src/instructions/token_edit.rs b/programs/mango-v4/src/instructions/token_edit.rs index 87afd6622..a493d6037 100644 --- a/programs/mango-v4/src/instructions/token_edit.rs +++ b/programs/mango-v4/src/instructions/token_edit.rs @@ -56,6 +56,7 @@ pub fn token_edit( disable_asset_liquidation_opt: Option, collateral_fee_per_day: Option, force_withdraw_opt: Option, + tier_opt: Option, ) -> Result<()> { let group = ctx.accounts.group.load()?; @@ -323,6 +324,12 @@ pub fn token_edit( require_group_admin = true; }; + if let Some(tier) = tier_opt.as_ref() { + msg!("Tier: old - {:?}, new - {:?}", bank.tier, tier); + bank.tier = fill_from_str(&tier)?; + require_group_admin = true; + }; + if let Some(force_close) = force_close_opt { if force_close { require!(bank.reduce_only > 0, MangoError::SomeError); diff --git a/programs/mango-v4/src/instructions/token_register.rs b/programs/mango-v4/src/instructions/token_register.rs index 4d648ca8e..8ce21eb47 100644 --- a/programs/mango-v4/src/instructions/token_register.rs +++ b/programs/mango-v4/src/instructions/token_register.rs @@ -46,6 +46,7 @@ pub fn token_register( platform_liquidation_fee: f32, disable_asset_liquidation: bool, collateral_fee_per_day: f32, + tier: String, ) -> Result<()> { require_neq!(token_index, TokenIndex::MAX); @@ -106,7 +107,6 @@ pub fn token_register( force_close: 0, disable_asset_liquidation: u8::from(disable_asset_liquidation), force_withdraw: 0, - padding: Default::default(), fees_withdrawn: 0, token_conditional_swap_taker_fee_rate, token_conditional_swap_maker_fee_rate, @@ -126,6 +126,7 @@ pub fn token_register( collected_liquidation_fees: I80F48::ZERO, collected_collateral_fees: I80F48::ZERO, collateral_fee_per_day, + tier: fill_from_str(&tier)?, reserved: [0; 1900], }; diff --git a/programs/mango-v4/src/instructions/token_register_trustless.rs b/programs/mango-v4/src/instructions/token_register_trustless.rs index 6b6284228..913d66486 100644 --- a/programs/mango-v4/src/instructions/token_register_trustless.rs +++ b/programs/mango-v4/src/instructions/token_register_trustless.rs @@ -92,7 +92,6 @@ pub fn token_register_trustless( force_close: 0, disable_asset_liquidation: 1, force_withdraw: 0, - padding: Default::default(), fees_withdrawn: 0, token_conditional_swap_taker_fee_rate: 0.0, token_conditional_swap_maker_fee_rate: 0.0, @@ -111,6 +110,7 @@ pub fn token_register_trustless( collected_liquidation_fees: I80F48::ZERO, collected_collateral_fees: I80F48::ZERO, collateral_fee_per_day: 0.0, // TODO + tier: fill_from_str("C")?, reserved: [0; 1900], }; let oracle_ref = &AccountInfoRef::borrow(ctx.accounts.oracle.as_ref())?; diff --git a/programs/mango-v4/src/lib.rs b/programs/mango-v4/src/lib.rs index afb3b892e..32fec2077 100644 --- a/programs/mango-v4/src/lib.rs +++ b/programs/mango-v4/src/lib.rs @@ -167,6 +167,7 @@ pub mod mango_v4 { platform_liquidation_fee: f32, disable_asset_liquidation: bool, collateral_fee_per_day: f32, + tier: String, ) -> Result<()> { #[cfg(feature = "enable-gpl")] instructions::token_register( @@ -202,6 +203,7 @@ pub mod mango_v4 { platform_liquidation_fee, disable_asset_liquidation, collateral_fee_per_day, + tier, )?; Ok(()) } @@ -260,6 +262,7 @@ pub mod mango_v4 { disable_asset_liquidation_opt: Option, collateral_fee_per_day_opt: Option, force_withdraw_opt: Option, + tier_opt: Option, ) -> Result<()> { #[cfg(feature = "enable-gpl")] instructions::token_edit( @@ -305,6 +308,7 @@ pub mod mango_v4 { disable_asset_liquidation_opt, collateral_fee_per_day_opt, force_withdraw_opt, + tier_opt, )?; Ok(()) } diff --git a/programs/mango-v4/src/state/bank.rs b/programs/mango-v4/src/state/bank.rs index 40d889bbb..827f8ca01 100644 --- a/programs/mango-v4/src/state/bank.rs +++ b/programs/mango-v4/src/state/bank.rs @@ -164,8 +164,8 @@ pub struct Bank { pub force_withdraw: u8, - #[derivative(Debug = "ignore")] - pub padding: [u8; 4], + #[derivative(Debug(format_with = "util::format_zero_terminated_utf8_bytes"))] + pub tier: [u8; 4], // Do separate bookkeping for how many tokens were withdrawn // This ensures that collected_fees_native is strictly increasing for stats gathering purposes @@ -364,7 +364,7 @@ impl Bank { force_close: existing_bank.force_close, disable_asset_liquidation: existing_bank.disable_asset_liquidation, force_withdraw: existing_bank.force_withdraw, - padding: [0; 4], + tier: existing_bank.tier, token_conditional_swap_taker_fee_rate: existing_bank .token_conditional_swap_taker_fee_rate, token_conditional_swap_maker_fee_rate: existing_bank @@ -440,6 +440,12 @@ impl Bank { .trim_matches(char::from(0)) } + pub fn tier(&self) -> &str { + std::str::from_utf8(&self.tier) + .unwrap() + .trim_matches(char::from(0)) + } + pub fn are_deposits_reduce_only(&self) -> bool { self.reduce_only == 1 } diff --git a/programs/mango-v4/tests/program_test/mango_client.rs b/programs/mango-v4/tests/program_test/mango_client.rs index 0888f73bc..4ccd1119d 100644 --- a/programs/mango-v4/tests/program_test/mango_client.rs +++ b/programs/mango-v4/tests/program_test/mango_client.rs @@ -1074,6 +1074,7 @@ impl ClientInstruction for TokenRegisterInstruction { platform_liquidation_fee: self.platform_liquidation_fee, disable_asset_liquidation: false, collateral_fee_per_day: 0.0, + tier: "A".to_string(), }; let bank = Pubkey::find_program_address( @@ -1324,6 +1325,7 @@ pub fn token_edit_instruction_default() -> mango_v4::instruction::TokenEdit { disable_asset_liquidation_opt: None, collateral_fee_per_day_opt: None, force_withdraw_opt: None, + tier_opt: None, } } diff --git a/ts/client/src/accounts/bank.ts b/ts/client/src/accounts/bank.ts index d4c8c4437..13da794e2 100644 --- a/ts/client/src/accounts/bank.ts +++ b/ts/client/src/accounts/bank.ts @@ -83,6 +83,7 @@ export class Bank implements BankForHealth { public platformLiquidationFee: I80F48; public collectedLiquidationFees: I80F48; public collectedCollateralFees: I80F48; + public tier: string; static from( publicKey: PublicKey, @@ -151,6 +152,7 @@ export class Bank implements BankForHealth { collectedLiquidationFees: I80F48Dto; collectedCollateralFees: I80F48Dto; collateralFeePerDay: number; + tier: number[]; }, ): Bank { return new Bank( @@ -218,6 +220,7 @@ export class Bank implements BankForHealth { obj.disableAssetLiquidation == 0, obj.collectedCollateralFees, obj.collateralFeePerDay, + obj.tier, obj.forceWithdraw == 1, ); } @@ -287,6 +290,7 @@ export class Bank implements BankForHealth { public allowAssetLiquidation: boolean, collectedCollateralFees: I80F48Dto, public collateralFeePerDay: number, + tier: number[], public forceWithdraw: boolean, ) { this.name = utf8.decode(new Uint8Array(name)).split('\x00')[0]; @@ -325,6 +329,7 @@ export class Bank implements BankForHealth { this._uiPrice = undefined; this._oracleLastUpdatedSlot = undefined; this._oracleProvider = undefined; + this.tier = utf8.decode(new Uint8Array(tier)).split('\x00')[0]; } toString(): string { diff --git a/ts/client/src/accounts/group.ts b/ts/client/src/accounts/group.ts index 7e9447118..3786de7c7 100644 --- a/ts/client/src/accounts/group.ts +++ b/ts/client/src/accounts/group.ts @@ -359,7 +359,7 @@ export class Group { Array.from(this.serum3MarketsMapByExternal.values()).map( (serum3Market) => Market.load( - client.program.provider.connection, + client.program.provider.connection as any, serum3Market.serumMarketExternal, { commitment: client.program.provider.connection.commitment }, OPENBOOK_PROGRAM_ID[client.cluster], diff --git a/ts/client/src/accounts/serum3.ts b/ts/client/src/accounts/serum3.ts index 0101fffc0..2ec24e681 100644 --- a/ts/client/src/accounts/serum3.ts +++ b/ts/client/src/accounts/serum3.ts @@ -133,7 +133,7 @@ export class Serum3Market { this.serumMarketExternal, ); return await serum3MarketExternal.loadBids( - client.program.provider.connection, + client.program.provider.connection as any, ); } @@ -142,7 +142,7 @@ export class Serum3Market { this.serumMarketExternal, ); return await serum3MarketExternal.loadAsks( - client.program.provider.connection, + client.program.provider.connection as any, ); } diff --git a/ts/client/src/client.ts b/ts/client/src/client.ts index 5ecc63c28..8008be51f 100644 --- a/ts/client/src/client.ts +++ b/ts/client/src/client.ts @@ -520,6 +520,7 @@ export class MangoClient { params.platformLiquidationFee, params.disableAssetLiquidation, params.collateralFeePerDay, + params.tier, ) .accounts({ group: group.publicKey, @@ -610,6 +611,7 @@ export class MangoClient { params.disableAssetLiquidation, params.collateralFeePerDay, params.forceWithdraw, + params.tier, ) .accounts({ group: group.publicKey, @@ -1447,7 +1449,6 @@ export class MangoClient { for (const pp of clonedMangoAccount.perpActive()) { const perpMarketIndex = pp.marketIndex; - const perpMarket = group.getPerpMarketByMarketIndex(perpMarketIndex); const deactivatingPositionIx = await this.perpDeactivatePositionIx( group, clonedMangoAccount, diff --git a/ts/client/src/clientIxParamBuilder.ts b/ts/client/src/clientIxParamBuilder.ts index 63fd28056..17c7aff05 100644 --- a/ts/client/src/clientIxParamBuilder.ts +++ b/ts/client/src/clientIxParamBuilder.ts @@ -32,6 +32,7 @@ export interface TokenRegisterParams { platformLiquidationFee: number; disableAssetLiquidation: boolean; collateralFeePerDay: number; + tier: string; } export const DefaultTokenRegisterParams: TokenRegisterParams = { @@ -74,6 +75,7 @@ export const DefaultTokenRegisterParams: TokenRegisterParams = { platformLiquidationFee: 0.0, disableAssetLiquidation: false, collateralFeePerDay: 0.0, + tier: '', }; export interface TokenEditParams { @@ -117,6 +119,7 @@ export interface TokenEditParams { platformLiquidationFee: number | null; disableAssetLiquidation: boolean | null; collateralFeePerDay: number | null; + tier: string | null; forceWithdraw: boolean | null; } @@ -161,6 +164,7 @@ export const NullTokenEditParams: TokenEditParams = { platformLiquidationFee: null, disableAssetLiquidation: null, collateralFeePerDay: null, + tier: null, forceWithdraw: null, }; diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index b9deb4ec9..33e2b4bd2 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -1,5 +1,5 @@ export type MangoV4 = { - "version": "0.25.0", + "version": "0.24.2", "name": "mango_v4", "instructions": [ { @@ -725,6 +725,10 @@ export type MangoV4 = { { "name": "collateralFeePerDay", "type": "f32" + }, + { + "name": "tier", + "type": "string" } ] }, @@ -1153,6 +1157,12 @@ export type MangoV4 = { "type": { "option": "bool" } + }, + { + "name": "tierOpt", + "type": { + "option": "string" + } } ] }, @@ -1358,7 +1368,7 @@ export type MangoV4 = { "args": [] }, { - "name": "accountCreate", + "name": "tokenUpdateIndexAndRateResilient", "accounts": [ { "name": "group", @@ -1366,79 +1376,29 @@ export type MangoV4 = { "isSigner": false }, { - "name": "account", - "isMut": true, + "name": "mintInfo", + "isMut": false, "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "const", - "type": "string", - "value": "MangoAccount" - }, - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, - { - "kind": "account", - "type": "publicKey", - "path": "owner" - }, - { - "kind": "arg", - "type": "u32", - "path": "account_num" - } - ] - } + "relations": [ + "oracle", + "group" + ] }, { - "name": "owner", + "name": "oracle", "isMut": false, - "isSigner": true - }, - { - "name": "payer", - "isMut": true, - "isSigner": true + "isSigner": false }, { - "name": "systemProgram", + "name": "instructions", "isMut": false, "isSigner": false } ], - "args": [ - { - "name": "accountNum", - "type": "u32" - }, - { - "name": "tokenCount", - "type": "u8" - }, - { - "name": "serum3Count", - "type": "u8" - }, - { - "name": "perpCount", - "type": "u8" - }, - { - "name": "perpOoCount", - "type": "u8" - }, - { - "name": "name", - "type": "string" - } - ] + "args": [] }, { - "name": "accountCreateV2", + "name": "accountCreate", "accounts": [ { "name": "group", @@ -1511,10 +1471,6 @@ export type MangoV4 = { "name": "perpOoCount", "type": "u8" }, - { - "name": "tokenConditionalSwapCount", - "type": "u8" - }, { "name": "name", "type": "string" @@ -1522,7 +1478,7 @@ export type MangoV4 = { ] }, { - "name": "accountCreateV3", + "name": "accountCreateV2", "accounts": [ { "name": "group", @@ -1599,10 +1555,6 @@ export type MangoV4 = { "name": "tokenConditionalSwapCount", "type": "u8" }, - { - "name": "openbookV2Count", - "type": "u8" - }, { "name": "name", "type": "string" @@ -1717,66 +1669,6 @@ export type MangoV4 = { } ] }, - { - "name": "accountExpandV3", - "accounts": [ - { - "name": "group", - "isMut": false, - "isSigner": false - }, - { - "name": "account", - "isMut": true, - "isSigner": false, - "relations": [ - "group", - "owner" - ] - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "payer", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "tokenCount", - "type": "u8" - }, - { - "name": "serum3Count", - "type": "u8" - }, - { - "name": "perpCount", - "type": "u8" - }, - { - "name": "perpOoCount", - "type": "u8" - }, - { - "name": "tokenConditionalSwapCount", - "type": "u8" - }, - { - "name": "openbookV2Count", - "type": "u8" - } - ] - }, { "name": "accountSizeMigration", "accounts": [ @@ -6451,15 +6343,15 @@ export type MangoV4 = { { "name": "group", "isMut": true, - "isSigner": false + "isSigner": false, + "relations": [ + "admin" + ] }, { "name": "admin", "isMut": false, - "isSigner": true, - "docs": [ - "group admin or fast listing admin, checked at #1" - ] + "isSigner": true }, { "name": "openbookV2Program", @@ -6554,10 +6446,6 @@ export type MangoV4 = { { "name": "name", "type": "string" - }, - { - "name": "oraclePriceBand", - "type": "f32" } ] }, @@ -6567,10 +6455,7 @@ export type MangoV4 = { { "name": "group", "isMut": false, - "isSigner": false, - "relations": [ - "admin" - ] + "isSigner": false }, { "name": "admin", @@ -6598,18 +6483,6 @@ export type MangoV4 = { "type": { "option": "bool" } - }, - { - "name": "nameOpt", - "type": { - "option": "string" - } - }, - { - "name": "oraclePriceBandOpt", - "type": { - "option": "f32" - } } ] }, @@ -6674,6 +6547,11 @@ export type MangoV4 = { "group" ] }, + { + "name": "authority", + "isMut": false, + "isSigner": true + }, { "name": "openbookV2Market", "isMut": false, @@ -6695,19 +6573,38 @@ export type MangoV4 = { "isSigner": false }, { - "name": "openOrdersIndexer", - "isMut": true, - "isSigner": false - }, - { - "name": "openOrdersAccount", + "name": "openOrders", "isMut": true, - "isSigner": false - }, - { - "name": "authority", - "isMut": false, - "isSigner": true + "isSigner": false, + "pda": { + "seeds": [ + { + "kind": "const", + "type": "string", + "value": "OpenOrders" + }, + { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_market" + }, + { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_market_external" + }, + { + "kind": "arg", + "type": "u32", + "path": "account_num" + } + ], + "programId": { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_program" + } + } }, { "name": "payer", @@ -6725,7 +6622,12 @@ export type MangoV4 = { "isSigner": false } ], - "args": [] + "args": [ + { + "name": "accountNum", + "type": "u32" + } + ] }, { "name": "openbookV2CloseOpenOrders", @@ -6769,15 +6671,7 @@ export type MangoV4 = { "isSigner": false }, { - "name": "openOrdersIndexer", - "isMut": true, - "isSigner": false, - "docs": [ - "can't zerocopy this unfortunately" - ] - }, - { - "name": "openOrdersAccount", + "name": "openOrders", "isMut": true, "isSigner": false }, @@ -6785,17 +6679,20 @@ export type MangoV4 = { "name": "solDestination", "isMut": true, "isSigner": false - }, + } + ], + "args": [] + }, + { + "name": "openbookV2PlaceOrder", + "accounts": [ { - "name": "baseBank", - "isMut": true, - "isSigner": false, - "relations": [ - "group" - ] + "name": "group", + "isMut": false, + "isSigner": false }, { - "name": "quoteBank", + "name": "account", "isMut": true, "isSigner": false, "relations": [ @@ -6803,20 +6700,132 @@ export type MangoV4 = { ] }, { - "name": "systemProgram", + "name": "authority", "isMut": false, - "isSigner": false + "isSigner": true }, { - "name": "tokenProgram", + "name": "openOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "openbookV2Market", + "isMut": false, + "isSigner": false + }, + { + "name": "openbookV2Program", + "isMut": false, + "isSigner": false + }, + { + "name": "openbookV2MarketExternal", + "isMut": true, + "isSigner": false, + "relations": [ + "bids", + "asks", + "event_heap" + ] + }, + { + "name": "bids", + "isMut": true, + "isSigner": false + }, + { + "name": "asks", + "isMut": true, + "isSigner": false + }, + { + "name": "eventHeap", + "isMut": true, + "isSigner": false + }, + { + "name": "marketBaseVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketQuoteVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "payerBank", + "isMut": true, + "isSigner": false, + "docs": [ + "The bank that pays for the order, if necessary" + ], + "relations": [ + "group" + ] + }, + { + "name": "payerVault", + "isMut": true, + "isSigner": false, + "docs": [ + "The bank vault that pays for the order, if necessary" + ] + }, + { + "name": "payerOracle", + "isMut": false, + "isSigner": false + }, + { + "name": "tokenProgram", "isMut": false, "isSigner": false } ], - "args": [] + "args": [ + { + "name": "side", + "type": "u8" + }, + { + "name": "limitPrice", + "type": "u64" + }, + { + "name": "maxBaseQty", + "type": "u64" + }, + { + "name": "maxNativeQuoteQtyIncludingFees", + "type": "u64" + }, + { + "name": "selfTradeBehavior", + "type": "u8" + }, + { + "name": "orderType", + "type": "u8" + }, + { + "name": "clientOrderId", + "type": "u64" + }, + { + "name": "limit", + "type": "u16" + } + ] }, { - "name": "openbookV2PlaceOrder", + "name": "openbookV2PlaceTakerOrder", "accounts": [ { "name": "group", @@ -6836,19 +6845,14 @@ export type MangoV4 = { "isMut": false, "isSigner": true }, - { - "name": "openOrders", - "isMut": true, - "isSigner": false - }, { "name": "openbookV2Market", "isMut": false, "isSigner": false, "relations": [ "group", - "openbook_v2_market_external", - "openbook_v2_program" + "openbook_v2_program", + "openbook_v2_market_external" ] }, { @@ -6882,7 +6886,17 @@ export type MangoV4 = { "isSigner": false }, { - "name": "marketVault", + "name": "marketRequestQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "marketBaseVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketQuoteVault", "isMut": true, "isSigner": false }, @@ -6896,7 +6910,7 @@ export type MangoV4 = { "isMut": true, "isSigner": false, "docs": [ - "The bank that pays for the order. Bank oracle also expected in remaining_accounts" + "The bank that pays for the order, if necessary" ], "relations": [ "group" @@ -6907,19 +6921,13 @@ export type MangoV4 = { "isMut": true, "isSigner": false, "docs": [ - "The bank vault that pays for the order" + "The bank vault that pays for the order, if necessary" ] }, { - "name": "receiverBank", - "isMut": true, - "isSigner": false, - "docs": [ - "The bank that receives the funds upon settlement. Bank oracle also expected in remaining_accounts" - ], - "relations": [ - "group" - ] + "name": "payerOracle", + "isMut": false, + "isSigner": false }, { "name": "tokenProgram", @@ -6930,49 +6938,31 @@ export type MangoV4 = { "args": [ { "name": "side", - "type": { - "defined": "OpenbookV2Side" - } - }, - { - "name": "priceLots", - "type": "i64" - }, - { - "name": "maxBaseLots", - "type": "i64" + "type": "u8" }, { - "name": "maxQuoteLotsIncludingFees", - "type": "i64" + "name": "limitPrice", + "type": "u64" }, { - "name": "clientOrderId", + "name": "maxBaseQty", "type": "u64" }, { - "name": "orderType", - "type": { - "defined": "OpenbookV2PlaceOrderType" - } + "name": "maxNativeQuoteQtyIncludingFees", + "type": "u64" }, { "name": "selfTradeBehavior", - "type": { - "defined": "OpenbookV2SelfTradeBehavior" - } - }, - { - "name": "reduceOnly", - "type": "bool" + "type": "u8" }, { - "name": "expiryTimestamp", + "name": "clientOrderId", "type": "u64" }, { "name": "limit", - "type": "u8" + "type": "u16" } ] }, @@ -7040,9 +7030,7 @@ export type MangoV4 = { "args": [ { "name": "side", - "type": { - "defined": "OpenbookV2Side" - } + "type": "u8" }, { "name": "orderId", @@ -7068,7 +7056,7 @@ export type MangoV4 = { }, { "name": "authority", - "isMut": true, + "isMut": false, "isSigner": true }, { @@ -7094,11 +7082,7 @@ export type MangoV4 = { { "name": "openbookV2MarketExternal", "isMut": true, - "isSigner": false, - "relations": [ - "market_base_vault", - "market_quote_vault" - ] + "isSigner": false }, { "name": "marketBaseVault", @@ -7158,11 +7142,6 @@ export type MangoV4 = { "name": "tokenProgram", "isMut": false, "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false } ], "args": [ @@ -7188,11 +7167,6 @@ export type MangoV4 = { "group" ] }, - { - "name": "payer", - "isMut": true, - "isSigner": true - }, { "name": "openOrders", "isMut": true, @@ -7215,14 +7189,12 @@ export type MangoV4 = { }, { "name": "openbookV2MarketExternal", - "isMut": true, + "isMut": false, "isSigner": false, "relations": [ "bids", "asks", - "event_heap", - "market_base_vault", - "market_quote_vault" + "event_heap" ] }, { @@ -7285,11 +7257,6 @@ export type MangoV4 = { "name": "tokenProgram", "isMut": false, "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false } ], "args": [ @@ -7364,14 +7331,6 @@ export type MangoV4 = { { "name": "limit", "type": "u8" - }, - { - "name": "sideOpt", - "type": { - "option": { - "defined": "OpenbookV2Side" - } - } } ] }, @@ -7715,7 +7674,7 @@ export type MangoV4 = { "type": "u8" }, { - "name": "padding", + "name": "tier", "type": { "array": [ "u8", @@ -7762,7 +7721,7 @@ export type MangoV4 = { { "name": "potentialSerumTokens", "docs": [ - "Largest amount of tokens that might be added the bank based on", + "Largest amount of tokens that might be added the the bank based on", "serum open order execution." ], "type": "u64" @@ -7872,29 +7831,12 @@ export type MangoV4 = { ], "type": "f32" }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 4 - ] - } - }, - { - "name": "potentialOpenbookTokens", - "docs": [ - "Largest amount of tokens that might be added the bank based on", - "oenbook open order execution." - ], - "type": "u64" - }, { "name": "reserved", "type": { "array": [ "u8", - 1888 + 1900 ] } } @@ -8257,24 +8199,12 @@ export type MangoV4 = { } } }, - { - "name": "padding9", - "type": "u32" - }, - { - "name": "openbookV2", - "type": { - "vec": { - "defined": "OpenbookV2Orders" - } - } - }, { "name": "reservedDynamic", "type": { "array": [ "u8", - 56 + 64 ] } } @@ -8370,10 +8300,6 @@ export type MangoV4 = { "name": "quoteTokenIndex", "type": "u16" }, - { - "name": "marketIndex", - "type": "u16" - }, { "name": "reduceOnly", "type": "u8" @@ -8382,6 +8308,15 @@ export type MangoV4 = { "name": "forceClose", "type": "u8" }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 2 + ] + } + }, { "name": "name", "type": { @@ -8400,29 +8335,32 @@ export type MangoV4 = { "type": "publicKey" }, { - "name": "registrationTime", - "type": "u64" - }, - { - "name": "oraclePriceBand", - "docs": [ - "Limit orders must be <= oracle * (1+band) and >= oracle / (1+band)", - "", - "Zero value is the default due to migration and disables the limit,", - "same as f32::MAX." - ], - "type": "f32" + "name": "marketIndex", + "type": "u16" }, { "name": "bump", "type": "u8" }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "registrationTime", + "type": "u64" + }, { "name": "reserved", "type": { "array": [ "u8", - 1027 + 512 ] } } @@ -9565,121 +9503,6 @@ export type MangoV4 = { ] } }, - { - "name": "OpenbookV2Orders", - "type": { - "kind": "struct", - "fields": [ - { - "name": "openOrders", - "type": "publicKey" - }, - { - "name": "baseBorrowsWithoutFee", - "docs": [ - "Tracks the amount of borrows that have flowed into the open orders account.", - "These borrows did not have the loan origination fee applied, and that may happen", - "later (in openbook_v2_settle_funds) if we can guarantee that the funds were used.", - "In particular a place-on-book, cancel, settle should not cost fees." - ], - "type": "u64" - }, - { - "name": "quoteBorrowsWithoutFee", - "type": "u64" - }, - { - "name": "highestPlacedBidInv", - "docs": [ - "Track something like the highest open bid / lowest open ask, in native/native units.", - "", - "Tracking it exactly isn't possible since we don't see fills. So instead track", - "the min/max of the _placed_ bids and asks.", - "", - "The value is reset in openbook_v2_place_order when a new order is placed without an", - "existing one on the book.", - "", - "0 is a special \"unset\" state." - ], - "type": "f64" - }, - { - "name": "lowestPlacedAsk", - "type": "f64" - }, - { - "name": "potentialBaseTokens", - "docs": [ - "An overestimate of the amount of tokens that might flow out of the open orders account.", - "", - "The bank still considers these amounts user deposits (see Bank::potential_openbook_tokens)", - "and that value needs to be updated in conjunction with these numbers.", - "", - "This estimation is based on the amount of tokens in the open orders account", - "(see update_bank_potential_tokens() in openbook_v2_place_order and settle)" - ], - "type": "u64" - }, - { - "name": "potentialQuoteTokens", - "type": "u64" - }, - { - "name": "lowestPlacedBidInv", - "docs": [ - "Track lowest bid/highest ask, same way as for highest bid/lowest ask.", - "", - "0 is a special \"unset\" state." - ], - "type": "f64" - }, - { - "name": "highestPlacedAsk", - "type": "f64" - }, - { - "name": "quoteLotSize", - "docs": [ - "Stores the market's lot sizes", - "", - "Needed because the obv2 open orders account tells us about reserved amounts in lots and", - "we want to be able to compute health without also loading the obv2 market." - ], - "type": "i64" - }, - { - "name": "baseLotSize", - "type": "i64" - }, - { - "name": "marketIndex", - "type": "u16" - }, - { - "name": "baseTokenIndex", - "docs": [ - "Store the base/quote token index, so health computations don't need", - "to get passed the static SerumMarket to find which tokens a market", - "uses and look up the correct oracles." - ], - "type": "u16" - }, - { - "name": "quoteTokenIndex", - "type": "u16" - }, - { - "name": "reserved", - "type": { - "array": [ - "u8", - 162 - ] - } - } - ] - } - }, { "name": "PerpPosition", "type": { @@ -10330,9 +10153,13 @@ export type MangoV4 = { "type": { "array": [ "u8", - 119 + 111 ] } + }, + { + "name": "forceAlign", + "type": "u64" } ] } @@ -11027,77 +10854,6 @@ export type MangoV4 = { ] } }, - { - "name": "OpenbookV2PlaceOrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" - }, - { - "name": "ImmediateOrCancel" - }, - { - "name": "PostOnly" - }, - { - "name": "Market" - }, - { - "name": "PostOnlySlide" - } - ] - } - }, - { - "name": "OpenbookV2PostOrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" - }, - { - "name": "PostOnly" - }, - { - "name": "PostOnlySlide" - } - ] - } - }, - { - "name": "OpenbookV2SelfTradeBehavior", - "type": { - "kind": "enum", - "variants": [ - { - "name": "DecrementTake" - }, - { - "name": "CancelProvide" - }, - { - "name": "AbortTransaction" - } - ] - } - }, - { - "name": "OpenbookV2Side", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Bid" - }, - { - "name": "Ask" - } - ] - } - }, { "name": "Serum3SelfTradeBehavior", "docs": [ @@ -11182,26 +10938,6 @@ export type MangoV4 = { ] } }, - { - "name": "SpotMarketIndex", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Serum3", - "fields": [ - "u16" - ] - }, - { - "name": "OpenbookV2", - "fields": [ - "u16" - ] - } - ] - } - }, { "name": "LoanOriginationFeeInstruction", "type": { @@ -11230,15 +10966,6 @@ export type MangoV4 = { }, { "name": "TokenConditionalSwapTrigger" - }, - { - "name": "OpenbookV2LiqForceCancelOrders" - }, - { - "name": "OpenbookV2PlaceOrder" - }, - { - "name": "OpenbookV2SettleFunds" } ] } @@ -11533,6 +11260,12 @@ export type MangoV4 = { }, { "name": "RaydiumCLMM" + }, + { + "name": "SwitchboardOnDemand" + }, + { + "name": "PythV2" } ] } @@ -12881,7 +12614,7 @@ export type MangoV4 = { ] }, { - "name": "OpenbookV2OpenOrdersBalanceLog", + "name": "WithdrawLoanOriginationFeeLog", "fields": [ { "name": "mangoGroup", @@ -12894,90 +12627,35 @@ export type MangoV4 = { "index": false }, { - "name": "marketIndex", + "name": "tokenIndex", "type": "u16", "index": false }, { - "name": "baseTokenIndex", - "type": "u16", + "name": "loanOriginationFee", + "type": "i128", "index": false }, { - "name": "quoteTokenIndex", - "type": "u16", + "name": "instruction", + "type": { + "defined": "LoanOriginationFeeInstruction" + }, "index": false - }, + } + ] + }, + { + "name": "WithdrawLoanLog", + "fields": [ { - "name": "baseTotal", - "type": "u64", + "name": "mangoGroup", + "type": "publicKey", "index": false }, { - "name": "baseFree", - "type": "u64", - "index": false - }, - { - "name": "quoteTotal", - "type": "u64", - "index": false - }, - { - "name": "quoteFree", - "type": "u64", - "index": false - }, - { - "name": "referrerRebatesAccrued", - "type": "u64", - "index": false - } - ] - }, - { - "name": "WithdrawLoanOriginationFeeLog", - "fields": [ - { - "name": "mangoGroup", - "type": "publicKey", - "index": false - }, - { - "name": "mangoAccount", - "type": "publicKey", - "index": false - }, - { - "name": "tokenIndex", - "type": "u16", - "index": false - }, - { - "name": "loanOriginationFee", - "type": "i128", - "index": false - }, - { - "name": "instruction", - "type": { - "defined": "LoanOriginationFeeInstruction" - }, - "index": false - } - ] - }, - { - "name": "WithdrawLoanLog", - "fields": [ - { - "name": "mangoGroup", - "type": "publicKey", - "index": false - }, - { - "name": "mangoAccount", - "type": "publicKey", + "name": "mangoAccount", + "type": "publicKey", "index": false }, { @@ -13301,46 +12979,6 @@ export type MangoV4 = { } ] }, - { - "name": "OpenbookV2RegisterMarketLog", - "fields": [ - { - "name": "mangoGroup", - "type": "publicKey", - "index": false - }, - { - "name": "openbookMarket", - "type": "publicKey", - "index": false - }, - { - "name": "marketIndex", - "type": "u16", - "index": false - }, - { - "name": "baseTokenIndex", - "type": "u16", - "index": false - }, - { - "name": "quoteTokenIndex", - "type": "u16", - "index": false - }, - { - "name": "openbookProgram", - "type": "publicKey", - "index": false - }, - { - "name": "openbookMarketExternal", - "type": "publicKey", - "index": false - } - ] - }, { "name": "PerpLiqBaseOrPositivePnlLog", "fields": [ @@ -14750,8 +14388,8 @@ export type MangoV4 = { }, { "code": 6034, - "name": "HasOpenOrUnsettledSpotOrders", - "msg": "there are open or unsettled spot orders" + "name": "HasOpenOrUnsettledSerum3Orders", + "msg": "there are open or unsettled serum3 orders" }, { "code": 6035, @@ -14885,7 +14523,7 @@ export type MangoV4 = { }, { "code": 6061, - "name": "SpotPriceBandExceeded", + "name": "Serum3PriceBandExceeded", "msg": "the market does not allow limit orders too far from the current oracle value" }, { @@ -14942,22 +14580,12 @@ export type MangoV4 = { "code": 6072, "name": "InvalidHealth", "msg": "invalid health" - }, - { - "code": 6073, - "name": "NoFreeOpenbookV2OpenOrdersIndex", - "msg": "no free openbook v2 open orders index" - }, - { - "code": 6074, - "name": "OpenbookV2OpenOrdersExistAlready", - "msg": "openbook v2 open orders exist already" } ] }; export const IDL: MangoV4 = { - "version": "0.25.0", + "version": "0.24.2", "name": "mango_v4", "instructions": [ { @@ -15683,6 +15311,10 @@ export const IDL: MangoV4 = { { "name": "collateralFeePerDay", "type": "f32" + }, + { + "name": "tier", + "type": "string" } ] }, @@ -16111,6 +15743,12 @@ export const IDL: MangoV4 = { "type": { "option": "bool" } + }, + { + "name": "tierOpt", + "type": { + "option": "string" + } } ] }, @@ -16316,7 +15954,7 @@ export const IDL: MangoV4 = { "args": [] }, { - "name": "accountCreate", + "name": "tokenUpdateIndexAndRateResilient", "accounts": [ { "name": "group", @@ -16324,79 +15962,29 @@ export const IDL: MangoV4 = { "isSigner": false }, { - "name": "account", - "isMut": true, + "name": "mintInfo", + "isMut": false, "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "const", - "type": "string", - "value": "MangoAccount" - }, - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, - { - "kind": "account", - "type": "publicKey", - "path": "owner" - }, - { - "kind": "arg", - "type": "u32", - "path": "account_num" - } - ] - } + "relations": [ + "oracle", + "group" + ] }, { - "name": "owner", + "name": "oracle", "isMut": false, - "isSigner": true - }, - { - "name": "payer", - "isMut": true, - "isSigner": true + "isSigner": false }, { - "name": "systemProgram", + "name": "instructions", "isMut": false, "isSigner": false } ], - "args": [ - { - "name": "accountNum", - "type": "u32" - }, - { - "name": "tokenCount", - "type": "u8" - }, - { - "name": "serum3Count", - "type": "u8" - }, - { - "name": "perpCount", - "type": "u8" - }, - { - "name": "perpOoCount", - "type": "u8" - }, - { - "name": "name", - "type": "string" - } - ] + "args": [] }, { - "name": "accountCreateV2", + "name": "accountCreate", "accounts": [ { "name": "group", @@ -16469,10 +16057,6 @@ export const IDL: MangoV4 = { "name": "perpOoCount", "type": "u8" }, - { - "name": "tokenConditionalSwapCount", - "type": "u8" - }, { "name": "name", "type": "string" @@ -16480,7 +16064,7 @@ export const IDL: MangoV4 = { ] }, { - "name": "accountCreateV3", + "name": "accountCreateV2", "accounts": [ { "name": "group", @@ -16557,10 +16141,6 @@ export const IDL: MangoV4 = { "name": "tokenConditionalSwapCount", "type": "u8" }, - { - "name": "openbookV2Count", - "type": "u8" - }, { "name": "name", "type": "string" @@ -16675,66 +16255,6 @@ export const IDL: MangoV4 = { } ] }, - { - "name": "accountExpandV3", - "accounts": [ - { - "name": "group", - "isMut": false, - "isSigner": false - }, - { - "name": "account", - "isMut": true, - "isSigner": false, - "relations": [ - "group", - "owner" - ] - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "payer", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "tokenCount", - "type": "u8" - }, - { - "name": "serum3Count", - "type": "u8" - }, - { - "name": "perpCount", - "type": "u8" - }, - { - "name": "perpOoCount", - "type": "u8" - }, - { - "name": "tokenConditionalSwapCount", - "type": "u8" - }, - { - "name": "openbookV2Count", - "type": "u8" - } - ] - }, { "name": "accountSizeMigration", "accounts": [ @@ -21409,15 +20929,15 @@ export const IDL: MangoV4 = { { "name": "group", "isMut": true, - "isSigner": false + "isSigner": false, + "relations": [ + "admin" + ] }, { "name": "admin", "isMut": false, - "isSigner": true, - "docs": [ - "group admin or fast listing admin, checked at #1" - ] + "isSigner": true }, { "name": "openbookV2Program", @@ -21512,10 +21032,6 @@ export const IDL: MangoV4 = { { "name": "name", "type": "string" - }, - { - "name": "oraclePriceBand", - "type": "f32" } ] }, @@ -21525,10 +21041,7 @@ export const IDL: MangoV4 = { { "name": "group", "isMut": false, - "isSigner": false, - "relations": [ - "admin" - ] + "isSigner": false }, { "name": "admin", @@ -21556,18 +21069,6 @@ export const IDL: MangoV4 = { "type": { "option": "bool" } - }, - { - "name": "nameOpt", - "type": { - "option": "string" - } - }, - { - "name": "oraclePriceBandOpt", - "type": { - "option": "f32" - } } ] }, @@ -21632,6 +21133,11 @@ export const IDL: MangoV4 = { "group" ] }, + { + "name": "authority", + "isMut": false, + "isSigner": true + }, { "name": "openbookV2Market", "isMut": false, @@ -21653,19 +21159,38 @@ export const IDL: MangoV4 = { "isSigner": false }, { - "name": "openOrdersIndexer", - "isMut": true, - "isSigner": false - }, - { - "name": "openOrdersAccount", + "name": "openOrders", "isMut": true, - "isSigner": false - }, - { - "name": "authority", - "isMut": false, - "isSigner": true + "isSigner": false, + "pda": { + "seeds": [ + { + "kind": "const", + "type": "string", + "value": "OpenOrders" + }, + { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_market" + }, + { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_market_external" + }, + { + "kind": "arg", + "type": "u32", + "path": "account_num" + } + ], + "programId": { + "kind": "account", + "type": "publicKey", + "path": "openbook_v2_program" + } + } }, { "name": "payer", @@ -21683,7 +21208,12 @@ export const IDL: MangoV4 = { "isSigner": false } ], - "args": [] + "args": [ + { + "name": "accountNum", + "type": "u32" + } + ] }, { "name": "openbookV2CloseOpenOrders", @@ -21727,41 +21257,115 @@ export const IDL: MangoV4 = { "isSigner": false }, { - "name": "openOrdersIndexer", + "name": "openOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "solDestination", + "isMut": true, + "isSigner": false + } + ], + "args": [] + }, + { + "name": "openbookV2PlaceOrder", + "accounts": [ + { + "name": "group", + "isMut": false, + "isSigner": false + }, + { + "name": "account", "isMut": true, "isSigner": false, - "docs": [ - "can't zerocopy this unfortunately" + "relations": [ + "group" ] }, { - "name": "openOrdersAccount", + "name": "authority", + "isMut": false, + "isSigner": true + }, + { + "name": "openOrders", "isMut": true, "isSigner": false }, { - "name": "solDestination", - "isMut": true, + "name": "openbookV2Market", + "isMut": false, "isSigner": false }, { - "name": "baseBank", + "name": "openbookV2Program", + "isMut": false, + "isSigner": false + }, + { + "name": "openbookV2MarketExternal", "isMut": true, "isSigner": false, "relations": [ - "group" + "bids", + "asks", + "event_heap" ] }, { - "name": "quoteBank", + "name": "bids", + "isMut": true, + "isSigner": false + }, + { + "name": "asks", + "isMut": true, + "isSigner": false + }, + { + "name": "eventHeap", + "isMut": true, + "isSigner": false + }, + { + "name": "marketBaseVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketQuoteVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "payerBank", "isMut": true, "isSigner": false, + "docs": [ + "The bank that pays for the order, if necessary" + ], "relations": [ "group" ] }, { - "name": "systemProgram", + "name": "payerVault", + "isMut": true, + "isSigner": false, + "docs": [ + "The bank vault that pays for the order, if necessary" + ] + }, + { + "name": "payerOracle", "isMut": false, "isSigner": false }, @@ -21771,10 +21375,43 @@ export const IDL: MangoV4 = { "isSigner": false } ], - "args": [] + "args": [ + { + "name": "side", + "type": "u8" + }, + { + "name": "limitPrice", + "type": "u64" + }, + { + "name": "maxBaseQty", + "type": "u64" + }, + { + "name": "maxNativeQuoteQtyIncludingFees", + "type": "u64" + }, + { + "name": "selfTradeBehavior", + "type": "u8" + }, + { + "name": "orderType", + "type": "u8" + }, + { + "name": "clientOrderId", + "type": "u64" + }, + { + "name": "limit", + "type": "u16" + } + ] }, { - "name": "openbookV2PlaceOrder", + "name": "openbookV2PlaceTakerOrder", "accounts": [ { "name": "group", @@ -21794,19 +21431,14 @@ export const IDL: MangoV4 = { "isMut": false, "isSigner": true }, - { - "name": "openOrders", - "isMut": true, - "isSigner": false - }, { "name": "openbookV2Market", "isMut": false, "isSigner": false, "relations": [ "group", - "openbook_v2_market_external", - "openbook_v2_program" + "openbook_v2_program", + "openbook_v2_market_external" ] }, { @@ -21840,7 +21472,17 @@ export const IDL: MangoV4 = { "isSigner": false }, { - "name": "marketVault", + "name": "marketRequestQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "marketBaseVault", + "isMut": true, + "isSigner": false + }, + { + "name": "marketQuoteVault", "isMut": true, "isSigner": false }, @@ -21854,7 +21496,7 @@ export const IDL: MangoV4 = { "isMut": true, "isSigner": false, "docs": [ - "The bank that pays for the order. Bank oracle also expected in remaining_accounts" + "The bank that pays for the order, if necessary" ], "relations": [ "group" @@ -21865,19 +21507,13 @@ export const IDL: MangoV4 = { "isMut": true, "isSigner": false, "docs": [ - "The bank vault that pays for the order" + "The bank vault that pays for the order, if necessary" ] }, { - "name": "receiverBank", - "isMut": true, - "isSigner": false, - "docs": [ - "The bank that receives the funds upon settlement. Bank oracle also expected in remaining_accounts" - ], - "relations": [ - "group" - ] + "name": "payerOracle", + "isMut": false, + "isSigner": false }, { "name": "tokenProgram", @@ -21888,49 +21524,31 @@ export const IDL: MangoV4 = { "args": [ { "name": "side", - "type": { - "defined": "OpenbookV2Side" - } - }, - { - "name": "priceLots", - "type": "i64" - }, - { - "name": "maxBaseLots", - "type": "i64" + "type": "u8" }, { - "name": "maxQuoteLotsIncludingFees", - "type": "i64" + "name": "limitPrice", + "type": "u64" }, { - "name": "clientOrderId", + "name": "maxBaseQty", "type": "u64" }, { - "name": "orderType", - "type": { - "defined": "OpenbookV2PlaceOrderType" - } + "name": "maxNativeQuoteQtyIncludingFees", + "type": "u64" }, { "name": "selfTradeBehavior", - "type": { - "defined": "OpenbookV2SelfTradeBehavior" - } - }, - { - "name": "reduceOnly", - "type": "bool" + "type": "u8" }, { - "name": "expiryTimestamp", + "name": "clientOrderId", "type": "u64" }, { "name": "limit", - "type": "u8" + "type": "u16" } ] }, @@ -21998,9 +21616,7 @@ export const IDL: MangoV4 = { "args": [ { "name": "side", - "type": { - "defined": "OpenbookV2Side" - } + "type": "u8" }, { "name": "orderId", @@ -22026,7 +21642,7 @@ export const IDL: MangoV4 = { }, { "name": "authority", - "isMut": true, + "isMut": false, "isSigner": true }, { @@ -22052,11 +21668,7 @@ export const IDL: MangoV4 = { { "name": "openbookV2MarketExternal", "isMut": true, - "isSigner": false, - "relations": [ - "market_base_vault", - "market_quote_vault" - ] + "isSigner": false }, { "name": "marketBaseVault", @@ -22116,11 +21728,6 @@ export const IDL: MangoV4 = { "name": "tokenProgram", "isMut": false, "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false } ], "args": [ @@ -22146,11 +21753,6 @@ export const IDL: MangoV4 = { "group" ] }, - { - "name": "payer", - "isMut": true, - "isSigner": true - }, { "name": "openOrders", "isMut": true, @@ -22173,14 +21775,12 @@ export const IDL: MangoV4 = { }, { "name": "openbookV2MarketExternal", - "isMut": true, + "isMut": false, "isSigner": false, "relations": [ "bids", "asks", - "event_heap", - "market_base_vault", - "market_quote_vault" + "event_heap" ] }, { @@ -22243,11 +21843,6 @@ export const IDL: MangoV4 = { "name": "tokenProgram", "isMut": false, "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false } ], "args": [ @@ -22322,14 +21917,6 @@ export const IDL: MangoV4 = { { "name": "limit", "type": "u8" - }, - { - "name": "sideOpt", - "type": { - "option": { - "defined": "OpenbookV2Side" - } - } } ] }, @@ -22673,7 +22260,7 @@ export const IDL: MangoV4 = { "type": "u8" }, { - "name": "padding", + "name": "tier", "type": { "array": [ "u8", @@ -22720,7 +22307,7 @@ export const IDL: MangoV4 = { { "name": "potentialSerumTokens", "docs": [ - "Largest amount of tokens that might be added the bank based on", + "Largest amount of tokens that might be added the the bank based on", "serum open order execution." ], "type": "u64" @@ -22828,31 +22415,14 @@ export const IDL: MangoV4 = { "docs": [ "The daily collateral fees rate for fully utilized collateral." ], - "type": "f32" - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 4 - ] - } - }, - { - "name": "potentialOpenbookTokens", - "docs": [ - "Largest amount of tokens that might be added the bank based on", - "oenbook open order execution." - ], - "type": "u64" + "type": "f32" }, { "name": "reserved", "type": { "array": [ "u8", - 1888 + 1900 ] } } @@ -23215,24 +22785,12 @@ export const IDL: MangoV4 = { } } }, - { - "name": "padding9", - "type": "u32" - }, - { - "name": "openbookV2", - "type": { - "vec": { - "defined": "OpenbookV2Orders" - } - } - }, { "name": "reservedDynamic", "type": { "array": [ "u8", - 56 + 64 ] } } @@ -23328,10 +22886,6 @@ export const IDL: MangoV4 = { "name": "quoteTokenIndex", "type": "u16" }, - { - "name": "marketIndex", - "type": "u16" - }, { "name": "reduceOnly", "type": "u8" @@ -23340,6 +22894,15 @@ export const IDL: MangoV4 = { "name": "forceClose", "type": "u8" }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 2 + ] + } + }, { "name": "name", "type": { @@ -23358,29 +22921,32 @@ export const IDL: MangoV4 = { "type": "publicKey" }, { - "name": "registrationTime", - "type": "u64" - }, - { - "name": "oraclePriceBand", - "docs": [ - "Limit orders must be <= oracle * (1+band) and >= oracle / (1+band)", - "", - "Zero value is the default due to migration and disables the limit,", - "same as f32::MAX." - ], - "type": "f32" + "name": "marketIndex", + "type": "u16" }, { "name": "bump", "type": "u8" }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "registrationTime", + "type": "u64" + }, { "name": "reserved", "type": { "array": [ "u8", - 1027 + 512 ] } } @@ -24523,121 +24089,6 @@ export const IDL: MangoV4 = { ] } }, - { - "name": "OpenbookV2Orders", - "type": { - "kind": "struct", - "fields": [ - { - "name": "openOrders", - "type": "publicKey" - }, - { - "name": "baseBorrowsWithoutFee", - "docs": [ - "Tracks the amount of borrows that have flowed into the open orders account.", - "These borrows did not have the loan origination fee applied, and that may happen", - "later (in openbook_v2_settle_funds) if we can guarantee that the funds were used.", - "In particular a place-on-book, cancel, settle should not cost fees." - ], - "type": "u64" - }, - { - "name": "quoteBorrowsWithoutFee", - "type": "u64" - }, - { - "name": "highestPlacedBidInv", - "docs": [ - "Track something like the highest open bid / lowest open ask, in native/native units.", - "", - "Tracking it exactly isn't possible since we don't see fills. So instead track", - "the min/max of the _placed_ bids and asks.", - "", - "The value is reset in openbook_v2_place_order when a new order is placed without an", - "existing one on the book.", - "", - "0 is a special \"unset\" state." - ], - "type": "f64" - }, - { - "name": "lowestPlacedAsk", - "type": "f64" - }, - { - "name": "potentialBaseTokens", - "docs": [ - "An overestimate of the amount of tokens that might flow out of the open orders account.", - "", - "The bank still considers these amounts user deposits (see Bank::potential_openbook_tokens)", - "and that value needs to be updated in conjunction with these numbers.", - "", - "This estimation is based on the amount of tokens in the open orders account", - "(see update_bank_potential_tokens() in openbook_v2_place_order and settle)" - ], - "type": "u64" - }, - { - "name": "potentialQuoteTokens", - "type": "u64" - }, - { - "name": "lowestPlacedBidInv", - "docs": [ - "Track lowest bid/highest ask, same way as for highest bid/lowest ask.", - "", - "0 is a special \"unset\" state." - ], - "type": "f64" - }, - { - "name": "highestPlacedAsk", - "type": "f64" - }, - { - "name": "quoteLotSize", - "docs": [ - "Stores the market's lot sizes", - "", - "Needed because the obv2 open orders account tells us about reserved amounts in lots and", - "we want to be able to compute health without also loading the obv2 market." - ], - "type": "i64" - }, - { - "name": "baseLotSize", - "type": "i64" - }, - { - "name": "marketIndex", - "type": "u16" - }, - { - "name": "baseTokenIndex", - "docs": [ - "Store the base/quote token index, so health computations don't need", - "to get passed the static SerumMarket to find which tokens a market", - "uses and look up the correct oracles." - ], - "type": "u16" - }, - { - "name": "quoteTokenIndex", - "type": "u16" - }, - { - "name": "reserved", - "type": { - "array": [ - "u8", - 162 - ] - } - } - ] - } - }, { "name": "PerpPosition", "type": { @@ -25288,9 +24739,13 @@ export const IDL: MangoV4 = { "type": { "array": [ "u8", - 119 + 111 ] } + }, + { + "name": "forceAlign", + "type": "u64" } ] } @@ -25985,77 +25440,6 @@ export const IDL: MangoV4 = { ] } }, - { - "name": "OpenbookV2PlaceOrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" - }, - { - "name": "ImmediateOrCancel" - }, - { - "name": "PostOnly" - }, - { - "name": "Market" - }, - { - "name": "PostOnlySlide" - } - ] - } - }, - { - "name": "OpenbookV2PostOrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" - }, - { - "name": "PostOnly" - }, - { - "name": "PostOnlySlide" - } - ] - } - }, - { - "name": "OpenbookV2SelfTradeBehavior", - "type": { - "kind": "enum", - "variants": [ - { - "name": "DecrementTake" - }, - { - "name": "CancelProvide" - }, - { - "name": "AbortTransaction" - } - ] - } - }, - { - "name": "OpenbookV2Side", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Bid" - }, - { - "name": "Ask" - } - ] - } - }, { "name": "Serum3SelfTradeBehavior", "docs": [ @@ -26140,26 +25524,6 @@ export const IDL: MangoV4 = { ] } }, - { - "name": "SpotMarketIndex", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Serum3", - "fields": [ - "u16" - ] - }, - { - "name": "OpenbookV2", - "fields": [ - "u16" - ] - } - ] - } - }, { "name": "LoanOriginationFeeInstruction", "type": { @@ -26188,15 +25552,6 @@ export const IDL: MangoV4 = { }, { "name": "TokenConditionalSwapTrigger" - }, - { - "name": "OpenbookV2LiqForceCancelOrders" - }, - { - "name": "OpenbookV2PlaceOrder" - }, - { - "name": "OpenbookV2SettleFunds" } ] } @@ -29811,16 +29166,6 @@ export const IDL: MangoV4 = { "code": 6072, "name": "InvalidHealth", "msg": "invalid health" - }, - { - "code": 6073, - "name": "NoFreeOpenbookV2OpenOrdersIndex", - "msg": "no free openbook v2 open orders index" - }, - { - "code": 6074, - "name": "OpenbookV2OpenOrdersExistAlready", - "msg": "openbook v2 open orders exist already" } ] };