From 21815612ae6d377e21075a91de3830941ce9ad19 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 13 Aug 2022 19:30:35 +0200 Subject: [PATCH] Let all PDA seeds start with a unique prefix (#166) This is mostly paranoia. Now it's guaranteed that different PDA types have unique seeds. --- .../src/instructions/account_create.rs | 2 +- .../mango-v4/src/instructions/group_create.rs | 2 +- .../src/instructions/perp_create_market.rs | 2 +- .../instructions/serum3_create_open_orders.rs | 2 +- .../instructions/serum3_register_market.rs | 2 +- .../src/instructions/stub_oracle_create.rs | 2 +- .../src/instructions/token_add_bank.rs | 6 +- .../src/instructions/token_register.rs | 6 +- .../instructions/token_register_trustless.rs | 6 +- programs/mango-v4/src/state/bank.rs | 2 +- .../src/state/mango_account_components.rs | 2 +- programs/mango-v4/src/state/serum3_market.rs | 2 +- .../tests/program_test/mango_client.rs | 56 +-- ts/client/src/mango_v4.ts | 320 +++++++++--------- 14 files changed, 202 insertions(+), 210 deletions(-) diff --git a/programs/mango-v4/src/instructions/account_create.rs b/programs/mango-v4/src/instructions/account_create.rs index 8eb8a1919..3da39f06f 100644 --- a/programs/mango-v4/src/instructions/account_create.rs +++ b/programs/mango-v4/src/instructions/account_create.rs @@ -11,7 +11,7 @@ pub struct AccountCreate<'info> { #[account( init, - seeds = [group.key().as_ref(), b"MangoAccount".as_ref(), owner.key().as_ref(), &account_num.to_le_bytes()], + seeds = [b"MangoAccount".as_ref(), group.key().as_ref(), owner.key().as_ref(), &account_num.to_le_bytes()], bump, payer = payer, space = MangoAccount::space(token_count, serum3_count, perp_count, perp_oo_count)?, diff --git a/programs/mango-v4/src/instructions/group_create.rs b/programs/mango-v4/src/instructions/group_create.rs index bdb1a6f80..981db35a8 100644 --- a/programs/mango-v4/src/instructions/group_create.rs +++ b/programs/mango-v4/src/instructions/group_create.rs @@ -22,7 +22,7 @@ pub struct GroupCreate<'info> { #[account( init, - seeds = [group.key().as_ref(), b"InsuranceVault".as_ref()], + seeds = [b"InsuranceVault".as_ref(), group.key().as_ref()], bump, token::authority = group, token::mint = insurance_mint, diff --git a/programs/mango-v4/src/instructions/perp_create_market.rs b/programs/mango-v4/src/instructions/perp_create_market.rs index df88c99ff..d5c76fb16 100644 --- a/programs/mango-v4/src/instructions/perp_create_market.rs +++ b/programs/mango-v4/src/instructions/perp_create_market.rs @@ -21,7 +21,7 @@ pub struct PerpCreateMarket<'info> { #[account( init, - seeds = [group.key().as_ref(), b"PerpMarket".as_ref(), perp_market_index.to_le_bytes().as_ref()], + seeds = [b"PerpMarket".as_ref(), group.key().as_ref(), perp_market_index.to_le_bytes().as_ref()], bump, payer = payer, space = 8 + std::mem::size_of::(), diff --git a/programs/mango-v4/src/instructions/serum3_create_open_orders.rs b/programs/mango-v4/src/instructions/serum3_create_open_orders.rs index b0c4889ef..58473f26c 100644 --- a/programs/mango-v4/src/instructions/serum3_create_open_orders.rs +++ b/programs/mango-v4/src/instructions/serum3_create_open_orders.rs @@ -25,7 +25,7 @@ pub struct Serum3CreateOpenOrders<'info> { // initialized by this instruction via cpi to serum #[account( init, - seeds = [account.key().as_ref(), b"Serum3OO".as_ref(), serum_market.key().as_ref()], + seeds = [b"Serum3OO".as_ref(), account.key().as_ref(), serum_market.key().as_ref()], bump, payer = payer, owner = serum_program.key(), diff --git a/programs/mango-v4/src/instructions/serum3_register_market.rs b/programs/mango-v4/src/instructions/serum3_register_market.rs index 9ad1dfaa6..a2d07b5d1 100644 --- a/programs/mango-v4/src/instructions/serum3_register_market.rs +++ b/programs/mango-v4/src/instructions/serum3_register_market.rs @@ -24,7 +24,7 @@ pub struct Serum3RegisterMarket<'info> { #[account( init, // using the serum_market_external in the seed guards against registering the same market twice - seeds = [group.key().as_ref(), b"Serum3Market".as_ref(), serum_market_external.key().as_ref()], + seeds = [b"Serum3Market".as_ref(), group.key().as_ref(), serum_market_external.key().as_ref()], bump, payer = payer, space = 8 + std::mem::size_of::(), diff --git a/programs/mango-v4/src/instructions/stub_oracle_create.rs b/programs/mango-v4/src/instructions/stub_oracle_create.rs index b05d65a2d..25b928ce4 100644 --- a/programs/mango-v4/src/instructions/stub_oracle_create.rs +++ b/programs/mango-v4/src/instructions/stub_oracle_create.rs @@ -13,7 +13,7 @@ pub struct StubOracleCreate<'info> { #[account( init, - seeds = [group.key().as_ref(), b"StubOracle".as_ref(), mint.key().as_ref()], + seeds = [b"StubOracle".as_ref(), group.key().as_ref(), mint.key().as_ref()], bump, payer = payer, space = 8 + std::mem::size_of::(), diff --git a/programs/mango-v4/src/instructions/token_add_bank.rs b/programs/mango-v4/src/instructions/token_add_bank.rs index 81f3835fe..719a9c554 100644 --- a/programs/mango-v4/src/instructions/token_add_bank.rs +++ b/programs/mango-v4/src/instructions/token_add_bank.rs @@ -25,7 +25,7 @@ pub struct TokenAddBank<'info> { #[account( init, // using the token_index in this seed guards against reusing it - seeds = [group.key().as_ref(), b"Bank".as_ref(), &token_index.to_le_bytes(), &bank_num.to_le_bytes()], + seeds = [b"Bank".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &bank_num.to_le_bytes()], bump, payer = payer, space = 8 + std::mem::size_of::(), @@ -34,7 +34,7 @@ pub struct TokenAddBank<'info> { #[account( init, - seeds = [group.key().as_ref(), b"Vault".as_ref(), &token_index.to_le_bytes(), &bank_num.to_le_bytes()], + seeds = [b"Vault".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &bank_num.to_le_bytes()], bump, token::authority = group, token::mint = mint, @@ -44,7 +44,7 @@ pub struct TokenAddBank<'info> { #[account( mut, - seeds = [group.key().as_ref(), b"MintInfo".as_ref(), mint.key().as_ref()], + seeds = [b"MintInfo".as_ref(), group.key().as_ref(), mint.key().as_ref()], bump )] pub mint_info: AccountLoader<'info, MintInfo>, diff --git a/programs/mango-v4/src/instructions/token_register.rs b/programs/mango-v4/src/instructions/token_register.rs index 0ea0dc03b..453d37f86 100644 --- a/programs/mango-v4/src/instructions/token_register.rs +++ b/programs/mango-v4/src/instructions/token_register.rs @@ -25,7 +25,7 @@ pub struct TokenRegister<'info> { #[account( init, // using the token_index in this seed guards against reusing it - seeds = [group.key().as_ref(), b"Bank".as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], + seeds = [b"Bank".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], bump, payer = payer, space = 8 + std::mem::size_of::(), @@ -34,7 +34,7 @@ pub struct TokenRegister<'info> { #[account( init, - seeds = [group.key().as_ref(), b"Vault".as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], + seeds = [b"Vault".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], bump, token::authority = group, token::mint = mint, @@ -45,7 +45,7 @@ pub struct TokenRegister<'info> { #[account( init, // using the mint in this seed guards against registering the same mint twice - seeds = [group.key().as_ref(), b"MintInfo".as_ref(), mint.key().as_ref()], + seeds = [b"MintInfo".as_ref(), group.key().as_ref(), mint.key().as_ref()], bump, payer = payer, space = 8 + std::mem::size_of::(), diff --git a/programs/mango-v4/src/instructions/token_register_trustless.rs b/programs/mango-v4/src/instructions/token_register_trustless.rs index 9996ba519..3853226f5 100644 --- a/programs/mango-v4/src/instructions/token_register_trustless.rs +++ b/programs/mango-v4/src/instructions/token_register_trustless.rs @@ -23,7 +23,7 @@ pub struct TokenRegisterTrustless<'info> { #[account( init, // using the token_index in this seed guards against reusing it - seeds = [group.key().as_ref(), b"Bank".as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], + seeds = [b"Bank".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], bump, payer = payer, space = 8 + std::mem::size_of::(), @@ -32,7 +32,7 @@ pub struct TokenRegisterTrustless<'info> { #[account( init, - seeds = [group.key().as_ref(), b"Vault".as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], + seeds = [b"Vault".as_ref(), group.key().as_ref(), &token_index.to_le_bytes(), &FIRST_BANK_NUM.to_le_bytes()], bump, token::authority = group, token::mint = mint, @@ -43,7 +43,7 @@ pub struct TokenRegisterTrustless<'info> { #[account( init, // using the mint in this seed guards against registering the same mint twice - seeds = [group.key().as_ref(), b"MintInfo".as_ref(), mint.key().as_ref()], + seeds = [b"MintInfo".as_ref(), group.key().as_ref(), mint.key().as_ref()], bump, payer = payer, space = 8 + std::mem::size_of::(), diff --git a/programs/mango-v4/src/state/bank.rs b/programs/mango-v4/src/state/bank.rs index 08433ae20..cb8b9ddb1 100644 --- a/programs/mango-v4/src/state/bank.rs +++ b/programs/mango-v4/src/state/bank.rs @@ -489,8 +489,8 @@ impl Bank { macro_rules! bank_seeds { ( $bank:expr ) => { &[ - $bank.group.as_ref(), b"Bank".as_ref(), + $bank.group.as_ref(), $bank.token_index.to_le_bytes(), &bank.bank_num.to_le_bytes(), &[$bank.bump], diff --git a/programs/mango-v4/src/state/mango_account_components.rs b/programs/mango-v4/src/state/mango_account_components.rs index b1247a0b8..56fefb304 100644 --- a/programs/mango-v4/src/state/mango_account_components.rs +++ b/programs/mango-v4/src/state/mango_account_components.rs @@ -354,8 +354,8 @@ const_assert_eq!(size_of::() % 8, 0); macro_rules! account_seeds { ( $account:expr ) => { &[ - $account.group.as_ref(), b"MangoAccount".as_ref(), + $account.group.as_ref(), $account.owner.as_ref(), &$account.account_num.to_le_bytes(), &[$account.bump], diff --git a/programs/mango-v4/src/state/serum3_market.rs b/programs/mango-v4/src/state/serum3_market.rs index 8d066fb61..1f97aaf4f 100644 --- a/programs/mango-v4/src/state/serum3_market.rs +++ b/programs/mango-v4/src/state/serum3_market.rs @@ -48,8 +48,8 @@ impl Serum3Market { macro_rules! serum_market_seeds { ( $acc:expr ) => { &[ - $acc.group.as_ref(), b"Serum3Market".as_ref(), + $acc.group.as_ref(), $acc.serum_market_external.as_ref(), &[$acc.bump], ] diff --git a/programs/mango-v4/tests/program_test/mango_client.rs b/programs/mango-v4/tests/program_test/mango_client.rs index 367d470b1..949499b43 100644 --- a/programs/mango-v4/tests/program_test/mango_client.rs +++ b/programs/mango-v4/tests/program_test/mango_client.rs @@ -128,8 +128,8 @@ async fn get_mint_info_by_mint( ) -> MintInfo { let mint_info_pk = Pubkey::find_program_address( &[ - account.fixed.group.as_ref(), b"MintInfo".as_ref(), + account.fixed.group.as_ref(), mint.as_ref(), ], &mango_v4::id(), @@ -145,8 +145,8 @@ async fn get_mint_info_by_token_index( ) -> MintInfo { let bank_pk = Pubkey::find_program_address( &[ - account.fixed.group.as_ref(), b"Bank".as_ref(), + account.fixed.group.as_ref(), &token_index.to_le_bytes(), &0u32.to_le_bytes(), ], @@ -160,8 +160,8 @@ async fn get_mint_info_by_token_index( fn get_perp_market_address_by_index(group: Pubkey, perp_market_index: PerpMarketIndex) -> Pubkey { Pubkey::find_program_address( &[ - group.as_ref(), b"PerpMarket".as_ref(), + group.as_ref(), &perp_market_index.to_le_bytes(), ], &mango_v4::id(), @@ -466,8 +466,8 @@ impl<'keypair> ClientInstruction for TokenWithdrawInstruction<'keypair> { .unwrap(); let mint_info = Pubkey::find_program_address( &[ - account.fixed.group.as_ref(), b"MintInfo".as_ref(), + account.fixed.group.as_ref(), token_account.mint.as_ref(), ], &program_id, @@ -534,8 +534,8 @@ impl ClientInstruction for TokenDepositInstruction { .unwrap(); let mint_info = Pubkey::find_program_address( &[ - account.fixed.group.as_ref(), b"MintInfo".as_ref(), + account.fixed.group.as_ref(), token_account.mint.as_ref(), ], &program_id, @@ -633,8 +633,8 @@ impl<'keypair> ClientInstruction for TokenRegisterInstruction<'keypair> { let bank = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Bank".as_ref(), + self.group.as_ref(), &self.token_index.to_le_bytes(), &0u32.to_le_bytes(), ], @@ -643,8 +643,8 @@ impl<'keypair> ClientInstruction for TokenRegisterInstruction<'keypair> { .0; let vault = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Vault".as_ref(), + self.group.as_ref(), &self.token_index.to_le_bytes(), &0u32.to_le_bytes(), ], @@ -653,8 +653,8 @@ impl<'keypair> ClientInstruction for TokenRegisterInstruction<'keypair> { .0; let mint_info = Pubkey::find_program_address( &[ - self.group.as_ref(), b"MintInfo".as_ref(), + self.group.as_ref(), self.mint.as_ref(), ], &program_id, @@ -663,8 +663,8 @@ impl<'keypair> ClientInstruction for TokenRegisterInstruction<'keypair> { // TODO: remove copy pasta of pda derivation, use reference let oracle = Pubkey::find_program_address( &[ - self.group.as_ref(), b"StubOracle".as_ref(), + self.group.as_ref(), self.mint.as_ref(), ], &program_id, @@ -718,8 +718,8 @@ impl<'keypair> ClientInstruction for TokenAddBankInstruction<'keypair> { let existing_bank = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Bank".as_ref(), + self.group.as_ref(), &self.token_index.to_le_bytes(), &0u32.to_le_bytes(), ], @@ -728,8 +728,8 @@ impl<'keypair> ClientInstruction for TokenAddBankInstruction<'keypair> { .0; let bank = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Bank".as_ref(), + self.group.as_ref(), &self.token_index.to_le_bytes(), &self.bank_num.to_le_bytes(), ], @@ -738,8 +738,8 @@ impl<'keypair> ClientInstruction for TokenAddBankInstruction<'keypair> { .0; let vault = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Vault".as_ref(), + self.group.as_ref(), &self.token_index.to_le_bytes(), &self.bank_num.to_le_bytes(), ], @@ -751,7 +751,7 @@ impl<'keypair> ClientInstruction for TokenAddBankInstruction<'keypair> { let mint = existing_bank_data.mint; let mint_info = Pubkey::find_program_address( - &[self.group.as_ref(), b"MintInfo".as_ref(), mint.as_ref()], + &[b"MintInfo".as_ref(), self.group.as_ref(), mint.as_ref()], &program_id, ) .0; @@ -869,8 +869,8 @@ impl<'keypair> ClientInstruction for StubOracleSetInstruction<'keypair> { // TODO: remove copy pasta of pda derivation, use reference let oracle = Pubkey::find_program_address( &[ - self.group.as_ref(), b"StubOracle".as_ref(), + self.group.as_ref(), self.mint.as_ref(), ], &program_id, @@ -915,8 +915,8 @@ impl<'keypair> ClientInstruction for StubOracleCreate<'keypair> { let oracle = Pubkey::find_program_address( &[ - self.group.as_ref(), b"StubOracle".as_ref(), + self.group.as_ref(), self.mint.as_ref(), ], &program_id, @@ -961,8 +961,8 @@ impl<'keypair> ClientInstruction for StubOracleCloseInstruction<'keypair> { let oracle = Pubkey::find_program_address( &[ - self.group.as_ref(), b"StubOracle".as_ref(), + self.group.as_ref(), self.mint.as_ref(), ], &program_id, @@ -1017,7 +1017,7 @@ impl<'keypair> ClientInstruction for GroupCreateInstruction<'keypair> { .0; let insurance_vault = Pubkey::find_program_address( - &[group.as_ref(), b"InsuranceVault".as_ref()], + &[b"InsuranceVault".as_ref(), group.as_ref()], &program_id, ) .0; @@ -1059,7 +1059,7 @@ impl<'keypair> ClientInstruction for GroupCloseInstruction<'keypair> { let instruction = Self::Instruction {}; let insurance_vault = Pubkey::find_program_address( - &[self.group.as_ref(), b"InsuranceVault".as_ref()], + &[b"InsuranceVault".as_ref(), self.group.as_ref()], &program_id, ) .0; @@ -1111,8 +1111,8 @@ impl<'keypair> ClientInstruction for AccountCreateInstruction<'keypair> { let account = Pubkey::find_program_address( &[ - self.group.as_ref(), b"MangoAccount".as_ref(), + self.group.as_ref(), self.owner.pubkey().as_ref(), &self.account_num.to_le_bytes(), ], @@ -1165,8 +1165,8 @@ impl<'keypair> ClientInstruction for AccountExpandInstruction<'keypair> { let account = Pubkey::find_program_address( &[ - self.group.as_ref(), b"MangoAccount".as_ref(), + self.group.as_ref(), self.owner.pubkey().as_ref(), &self.account_num.to_le_bytes(), ], @@ -1214,8 +1214,8 @@ impl<'keypair> ClientInstruction for AccountEditInstruction<'keypair> { let account = Pubkey::find_program_address( &[ - self.group.as_ref(), b"MangoAccount".as_ref(), + self.group.as_ref(), self.owner.pubkey().as_ref(), &self.account_num.to_le_bytes(), ], @@ -1301,8 +1301,8 @@ impl<'keypair> ClientInstruction for Serum3RegisterMarketInstruction<'keypair> { let serum_market = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Serum3Market".as_ref(), + self.group.as_ref(), self.serum_market_external.as_ref(), ], &program_id, @@ -1349,8 +1349,8 @@ impl<'keypair> ClientInstruction for Serum3DeregisterMarketInstruction<'keypair> let serum_market = Pubkey::find_program_address( &[ - self.group.as_ref(), b"Serum3Market".as_ref(), + self.group.as_ref(), self.serum_market_external.as_ref(), ], &program_id, @@ -1395,8 +1395,8 @@ impl<'keypair> ClientInstruction for Serum3CreateOpenOrdersInstruction<'keypair> let serum_market: Serum3Market = account_loader.load(&self.serum_market).await.unwrap(); let open_orders = Pubkey::find_program_address( &[ - self.account.as_ref(), b"Serum3OO".as_ref(), + self.account.as_ref(), self.serum_market.as_ref(), ], &program_id, @@ -1446,8 +1446,8 @@ impl<'keypair> ClientInstruction for Serum3CloseOpenOrdersInstruction<'keypair> let serum_market: Serum3Market = account_loader.load(&self.serum_market).await.unwrap(); let open_orders = Pubkey::find_program_address( &[ - self.account.as_ref(), b"Serum3OO".as_ref(), + self.account.as_ref(), self.serum_market.as_ref(), ], &program_id, @@ -1996,8 +1996,8 @@ impl<'keypair> ClientInstruction for LiqTokenBankruptcyInstruction<'keypair> { let quote_mint_info = Pubkey::find_program_address( &[ - liqee.fixed.group.as_ref(), b"MintInfo".as_ref(), + liqee.fixed.group.as_ref(), group.insurance_mint.as_ref(), ], &program_id, @@ -2006,7 +2006,7 @@ impl<'keypair> ClientInstruction for LiqTokenBankruptcyInstruction<'keypair> { let quote_mint_info: MintInfo = account_loader.load("e_mint_info).await.unwrap(); let insurance_vault = Pubkey::find_program_address( - &[group_key.as_ref(), b"InsuranceVault".as_ref()], + &[b"InsuranceVault".as_ref(), group_key.as_ref()], &program_id, ) .0; @@ -2097,8 +2097,8 @@ impl<'keypair> ClientInstruction for PerpCreateMarketInstruction<'keypair> { let perp_market = Pubkey::find_program_address( &[ - self.group.as_ref(), b"PerpMarket".as_ref(), + self.group.as_ref(), self.perp_market_index.to_le_bytes().as_ref(), ], &program_id, diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index 145f24cad..d048e276a 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -45,15 +45,15 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "InsuranceVault" + }, + { + "kind": "account", + "type": "publicKey", + "path": "group" } ] } @@ -174,16 +174,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -203,16 +203,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -232,16 +232,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -352,16 +352,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -381,16 +381,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -410,16 +410,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -591,16 +591,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -620,16 +620,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -649,16 +649,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -781,16 +781,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MangoAccount" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -974,16 +974,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "StubOracle" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -1269,16 +1269,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Serum3Market" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -1389,16 +1389,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "account" - }, { "kind": "const", "type": "string", "value": "Serum3OO" }, + { + "kind": "account", + "type": "publicKey", + "path": "account" + }, { "kind": "account", "type": "publicKey", @@ -2049,16 +2049,16 @@ export type MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "PerpMarket" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -4011,18 +4011,14 @@ export type MangoV4 = { } }, { - "name": "baseEntryLots", + "name": "quoteEntryNative", "docs": [ - "Tracks what the position is to calculate average entry & break even price" + "Tracks what the position is to calculate average entry & break even price" ], "type": "i64" }, { - "name": "quoteEntryNative", - "type": "i64" - }, - { - "name": "quoteExitNative", + "name": "quoteRunningNative", "type": "i64" }, { @@ -5089,15 +5085,15 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "InsuranceVault" + }, + { + "kind": "account", + "type": "publicKey", + "path": "group" } ] } @@ -5218,16 +5214,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5247,16 +5243,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5276,16 +5272,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -5396,16 +5392,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5425,16 +5421,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5454,16 +5450,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -5635,16 +5631,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Bank" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5664,16 +5660,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Vault" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -5693,16 +5689,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MintInfo" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -5825,16 +5821,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "MangoAccount" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -6018,16 +6014,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "StubOracle" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -6313,16 +6309,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "Serum3Market" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "account", "type": "publicKey", @@ -6433,16 +6429,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "account" - }, { "kind": "const", "type": "string", "value": "Serum3OO" }, + { + "kind": "account", + "type": "publicKey", + "path": "account" + }, { "kind": "account", "type": "publicKey", @@ -7093,16 +7089,16 @@ export const IDL: MangoV4 = { "isSigner": false, "pda": { "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, { "kind": "const", "type": "string", "value": "PerpMarket" }, + { + "kind": "account", + "type": "publicKey", + "path": "group" + }, { "kind": "arg", "type": "u16", @@ -9055,18 +9051,14 @@ export const IDL: MangoV4 = { } }, { - "name": "baseEntryLots", + "name": "quoteEntryNative", "docs": [ - "Tracks what the position is to calculate average entry & break even price" + "Tracks what the position is to calculate average entry & break even price" ], "type": "i64" }, { - "name": "quoteEntryNative", - "type": "i64" - }, - { - "name": "quoteExitNative", + "name": "quoteRunningNative", "type": "i64" }, {