From 4d928c48599835a1ff461f85d4d56b8f3b4ccce7 Mon Sep 17 00:00:00 2001 From: Acammm Date: Mon, 14 Feb 2022 11:26:35 +0800 Subject: [PATCH 1/4] Dependencies update to match mango - update to mango v3.3.5 - update solana to 1.9.1 (to do as mango, they use 1.9.1) - update anchor-lang to 0.20.1 (required by mango) - update anchor-spl to 0.20.1 (required by mango) --- Cargo.lock | 271 +++++++++------------------------------- programs/uxd/Cargo.toml | 8 +- 2 files changed, 66 insertions(+), 213 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fbb8cb65..6d35c9288 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,11 +25,11 @@ checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483" [[package]] name = "anchor-attribute-access-control" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e53fd8d0aa034bb2e647c39eec4e399095438dbc83526949ac6a072e3c4ce7" +checksum = "105c443a613f29212755fb6c5f946fa82dcf94a80528f643e0faa9d9faeb626b" dependencies = [ - "anchor-syn 0.18.2", + "anchor-syn", "anyhow", "proc-macro2", "quote", @@ -37,42 +37,13 @@ dependencies = [ "syn", ] -[[package]] -name = "anchor-attribute-access-control" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68df8fd24ebe6d594ec31fdc208e72cc322a2fba16e97f92e3cec1f5aebc69ed" -dependencies = [ - "anchor-syn 0.20.0", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362b1b119372b38cdd45949bd8f09a8f5c56a701d49a747fc43d7a59393b647f" -dependencies = [ - "anchor-syn 0.18.2", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - [[package]] name = "anchor-attribute-account" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6bbe076557127dcf2e7e0d82b74c55fec0a3299853ffa34729e21a743e0bd7" +checksum = "fdae15851aa41972e9c18c987613c50a916c48c88c97ea3316156a5c772e5faa" dependencies = [ - "anchor-syn 0.20.0", + "anchor-syn", "anyhow", "bs58 0.4.0", "proc-macro2", @@ -83,47 +54,22 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d254b1ac614b09af5f36662cfdd859b63280f515abffe591834b9b52ec9353cb" +checksum = "6356865217881d0bbea8aa70625937bec6d9952610f1ba2a2452a8e427000687" dependencies = [ - "anchor-syn 0.20.0", + "anchor-syn", "proc-macro2", "syn", ] [[package]] name = "anchor-attribute-error" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c8be43ca34309afcafb24274bba6733b6b5d59be47f1cc11ef3afe9584e5cd" +checksum = "ebe998ce4e6e0cb0e291d1a1626bd30791cdfdd9d05523111bdf4fd053f08636" dependencies = [ - "anchor-syn 0.18.2", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e8538fb17b3d568f0de94aa2d17ab73d2df3d29359b9ab32c7164c43b68796" -dependencies = [ - "anchor-syn 0.20.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899640f277f8296da82d6505312b03a4cd4901c3c6d6fe8eb3ca2db33f26ebb9" -dependencies = [ - "anchor-syn 0.18.2", - "anyhow", + "anchor-syn", "proc-macro2", "quote", "syn", @@ -131,11 +77,11 @@ dependencies = [ [[package]] name = "anchor-attribute-event" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1fe9dbc2ed92ce76bdd4864ae3e9cb3ca52b19a94e1643f4fe7be59a5e80d" +checksum = "c5810498a20554c20354f5648b6041172f2035e58d09ad40dc051dc0d1501f80" dependencies = [ - "anchor-syn 0.20.0", + "anchor-syn", "anyhow", "proc-macro2", "quote", @@ -144,11 +90,11 @@ dependencies = [ [[package]] name = "anchor-attribute-interface" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f514a6502a0ad56f321df492f1c699ee8ad3912c6354acd087f3d28431a0fac4" +checksum = "ac83f085b2be8b3a3412989cf96cf7f683561db7d357c5aa4aa11d48bbb22213" dependencies = [ - "anchor-syn 0.18.2", + "anchor-syn", "anyhow", "heck", "proc-macro2", @@ -156,53 +102,13 @@ dependencies = [ "syn", ] -[[package]] -name = "anchor-attribute-interface" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3899b44b15936a708e195906733885653e28c92b6612592e3a17993125d09be2" -dependencies = [ - "anchor-syn 0.20.0", - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadc2f9bcaeb3be4a8efb76c455bc772b5d257c01796b415eb3aa4bd93ed43fe" -dependencies = [ - "anchor-syn 0.18.2", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "anchor-attribute-program" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5cd304055c278025fd01f7d30d0abfefaafe1dc5d3d8d21bc6022b60fdc911" -dependencies = [ - "anchor-syn 0.20.0", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbff8f1a2b53a42ef547f3188e25f7e3d6933113ab0f94b11afb825eee80f47" +checksum = "73c56be575d89abcb192afa29deb87b2cdb3c39033abc02f2d16e6af999b23b7" dependencies = [ - "anchor-syn 0.18.2", + "anchor-syn", "anyhow", "proc-macro2", "quote", @@ -211,24 +117,11 @@ dependencies = [ [[package]] name = "anchor-attribute-state" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7e09348b07790cce92ed4b3b588dc8c701fe3c5af018f9a923abaf23423aca" -dependencies = [ - "anchor-syn 0.20.0", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458185d8bd23559f6ed35c4a7a7d0f83ac4d7837b2e790d90e50cafc9371503e" +checksum = "62ab002353b01fcb4f72cca256d5d62db39f9ff39b1d072280deee9798f1f524" dependencies = [ - "anchor-syn 0.18.2", + "anchor-syn", "anyhow", "proc-macro2", "quote", @@ -237,11 +130,11 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7558441b25962d5886366fffc77b15c0cc7443869f6021c1dfea9b80d5be50e1" +checksum = "e9e653cdb322078d95221384c4a527a403560e509ac7cb2b53d3bd664b23c4d6" dependencies = [ - "anchor-syn 0.20.0", + "anchor-syn", "anyhow", "proc-macro2", "quote", @@ -250,40 +143,19 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dd615c2eb55d88de8800c46fa7ed51ef045d76ed669222a798976d0a447f59" -dependencies = [ - "anchor-attribute-access-control 0.18.2", - "anchor-attribute-account 0.18.2", - "anchor-attribute-error 0.18.2", - "anchor-attribute-event 0.18.2", - "anchor-attribute-interface 0.18.2", - "anchor-attribute-program 0.18.2", - "anchor-attribute-state 0.18.2", - "anchor-derive-accounts 0.18.2", - "base64 0.13.0", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-lang" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff5bc19f5cced84abdf443bc663479be2f486e509b277bcfc0b82e6f46dbdba8" +checksum = "4815ad6334fd2f561f7ddcc3cfbeed87ed3003724171bd80ebe6383d5173ee8f" dependencies = [ - "anchor-attribute-access-control 0.20.0", - "anchor-attribute-account 0.20.0", + "anchor-attribute-access-control", + "anchor-attribute-account", "anchor-attribute-constant", - "anchor-attribute-error 0.20.0", - "anchor-attribute-event 0.20.0", - "anchor-attribute-interface 0.20.0", - "anchor-attribute-program 0.20.0", - "anchor-attribute-state 0.20.0", - "anchor-derive-accounts 0.20.0", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", "arrayref", "base64 0.13.0", "bincode", @@ -295,11 +167,11 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68ac42913103bddda27c674945a9d0e1ee96c181ea243ddca0ab1e2612b771" +checksum = "9ea94b04fc9a0aaae4d4473b0595fb5f55b6c9b38e0d6f596df8c8060f95f096" dependencies = [ - "anchor-lang 0.20.0", + "anchor-lang", "solana-program", "spl-associated-token-account", "spl-token", @@ -307,28 +179,9 @@ dependencies = [ [[package]] name = "anchor-syn" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77faec86e3bf8e15568d026bd586e381910610544aa0b2642b942b37698029e5" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4554ca55b45090c5bbddfe0dd6e41fadb335beb8d9ee825a3bd6c081d2462abc" +checksum = "3be7bfb6991d79cce3495fb6ce0892f58a5c75a74c8d1c2fc6f62926066eb9f4" dependencies = [ "anyhow", "bs58 0.3.1", @@ -951,10 +804,10 @@ dependencies = [ [[package]] name = "mango" -version = "3.2.13" -source = "git+https://github.com/blockworks-foundation/mango-v3#022caa5474446bb8a3ccdf850334b44691346011" +version = "3.3.5" +source = "git+https://github.com/blockworks-foundation/mango-v3?tag=v3.3.5#209db316a7f05df2f38da67160e4d28d9df4bb67" dependencies = [ - "anchor-lang 0.18.2", + "anchor-lang", "arrayref", "bincode", "bs58 0.4.0", @@ -979,7 +832,7 @@ dependencies = [ [[package]] name = "mango-common" version = "3.0.0" -source = "git+https://github.com/blockworks-foundation/mango-v3#022caa5474446bb8a3ccdf850334b44691346011" +source = "git+https://github.com/blockworks-foundation/mango-v3?tag=v3.3.5#209db316a7f05df2f38da67160e4d28d9df4bb67" dependencies = [ "bytemuck", "solana-program", @@ -988,15 +841,15 @@ dependencies = [ [[package]] name = "mango-logs" version = "0.1.0" -source = "git+https://github.com/blockworks-foundation/mango-v3#022caa5474446bb8a3ccdf850334b44691346011" +source = "git+https://github.com/blockworks-foundation/mango-v3?tag=v3.3.5#209db316a7f05df2f38da67160e4d28d9df4bb67" dependencies = [ - "anchor-lang 0.18.2", + "anchor-lang", ] [[package]] name = "mango-macro" version = "3.0.0" -source = "git+https://github.com/blockworks-foundation/mango-v3#022caa5474446bb8a3ccdf850334b44691346011" +source = "git+https://github.com/blockworks-foundation/mango-v3?tag=v3.3.5#209db316a7f05df2f38da67160e4d28d9df4bb67" dependencies = [ "bytemuck", "mango-common", @@ -1456,9 +1309,9 @@ checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "solana-frozen-abi" -version = "1.9.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8631644816f197a57b18c44938ae6b3a13bbb988ef48f02743cc94ef8f48ee" +checksum = "bd0c18abe9d7b525215f3de16db3fca6057affdd73464ca027786b42455257b9" dependencies = [ "bs58 0.4.0", "bv", @@ -1476,9 +1329,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.9.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd7e3e4ebdd61858faaac1724145cecf7cb1c8002b2e729bd46a4470edef6b2" +checksum = "4221e1b9cfad821fa097a61c1827f8214c2ef97057c270d5f68a52d90929ae2a" dependencies = [ "proc-macro2", "quote", @@ -1488,9 +1341,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.9.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1ce341c8ea0d4e2cb404aa11d42754d79b3fabfd6c2051c01414cc1a07665bb" +checksum = "e0a5b4d8fe05eab74ca3c7afd79e6143bed4028997bf36de06b7f503b55b125c" dependencies = [ "env_logger", "lazy_static", @@ -1499,9 +1352,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.9.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8fdf06617233f224c040c05c99394ec000e811d08723dfea5c4f9ab7160522" +checksum = "32d577959f537ba4435db97588fe2ea5520c98483ef5fcf6a0fb8ca096f82213" dependencies = [ "base64 0.13.0", "bincode", @@ -1542,9 +1395,9 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.9.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "293928d6d468a4c9d0ea04930dd5377be3bbf7cd9936e174ef0e1b7c0bc00b21" +checksum = "0664789b09d768bfab1fc34c532d8cd1abfc63b2ec8174c7b65e6b17f08e7841" dependencies = [ "bs58 0.4.0", "proc-macro2", @@ -1636,9 +1489,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.74" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" dependencies = [ "proc-macro2", "quote", @@ -1723,7 +1576,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" name = "uxd" version = "2.0.0" dependencies = [ - "anchor-lang 0.20.0", + "anchor-lang", "anchor-spl", "fixed", "mango", diff --git a/programs/uxd/Cargo.toml b/programs/uxd/Cargo.toml index cf1255744..628fff360 100644 --- a/programs/uxd/Cargo.toml +++ b/programs/uxd/Cargo.toml @@ -20,11 +20,11 @@ production = [] development = [] [dependencies] -anchor-lang = "0.20.0" -anchor-spl = "0.20.0" -solana-program = "1.8.11" +anchor-lang = "0.20.1" +anchor-spl = "0.20.1" +solana-program = "=1.9.1" spl-token = "3.2.0" fixed = "1.9.0" thiserror = "1.0.30" num_enum = "^0.5.1" -mango = { git = "https://github.com/blockworks-foundation/mango-v3", features = ["no-entrypoint"] } \ No newline at end of file +mango = { tag = "v3.3.5", git = "https://github.com/blockworks-foundation/mango-v3", features = ["no-entrypoint"] } \ No newline at end of file From ce2415552a1ac83f8997da7d35634d38d2351d21 Mon Sep 17 00:00:00 2001 From: Acammm Date: Mon, 14 Feb 2022 11:28:29 +0800 Subject: [PATCH 2/4] Owner now passed as signer always. Remove the additional owner passed twice. This was done to support multisig in a previous version of their code IIRC It's not deprecated and breaking since their last update as they have a new optional account that takes the first spot. --- programs/uxd/src/mango_program/deposit.rs | 12 ++---------- programs/uxd/src/mango_program/init_mango_account.rs | 7 +------ programs/uxd/src/mango_program/place_perp_order.rs | 9 +-------- programs/uxd/src/mango_program/withdraw.rs | 11 +---------- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/programs/uxd/src/mango_program/deposit.rs b/programs/uxd/src/mango_program/deposit.rs index cf730a85d..5187dba89 100644 --- a/programs/uxd/src/mango_program/deposit.rs +++ b/programs/uxd/src/mango_program/deposit.rs @@ -47,28 +47,21 @@ fn deposit_instruction( mango_vault_pubkey: &Pubkey, token_program_id: &Pubkey, owner_token_account_pubkey: &Pubkey, - signer_pubkeys: &[&Pubkey], quantity: u64, ) -> Result { check_program_account(mango_program_id)?; let data = mango::instruction::MangoInstruction::Deposit { quantity }.pack(); - let mut accounts = Vec::with_capacity(8 + MAX_PAIRS + signer_pubkeys.len()); + let mut accounts = Vec::with_capacity(8 + MAX_PAIRS); accounts.push(AccountMeta::new_readonly(*mango_group_pubkey, false)); accounts.push(AccountMeta::new(*mango_account_pubkey, false)); - accounts.push(AccountMeta::new_readonly( - *owner_pubkey, - signer_pubkeys.is_empty(), - )); + accounts.push(AccountMeta::new_readonly(*owner_pubkey, true)); accounts.push(AccountMeta::new_readonly(*mango_cache_pubkey, false)); accounts.push(AccountMeta::new_readonly(*mango_root_bank_pubkey, false)); accounts.push(AccountMeta::new(*mango_node_bank_pubkey, false)); accounts.push(AccountMeta::new(*mango_vault_pubkey, false)); accounts.push(AccountMeta::new_readonly(*token_program_id, false)); accounts.push(AccountMeta::new(*owner_token_account_pubkey, false)); - for signer_pubkey in signer_pubkeys.iter() { - accounts.push(AccountMeta::new_readonly(**signer_pubkey, true)); - } Ok(Instruction { program_id: *mango_program_id, @@ -92,7 +85,6 @@ pub fn deposit<'info>( ctx.accounts.mango_vault.key, ctx.accounts.token_program.key, ctx.accounts.owner_token_account.key, - &[ctx.accounts.owner.key], quantity, )?; solana_program::program::invoke_signed( diff --git a/programs/uxd/src/mango_program/init_mango_account.rs b/programs/uxd/src/mango_program/init_mango_account.rs index 1cc833ddf..8a37c5379 100644 --- a/programs/uxd/src/mango_program/init_mango_account.rs +++ b/programs/uxd/src/mango_program/init_mango_account.rs @@ -32,19 +32,15 @@ fn initialize_mango_account_instruction( mango_account_pubkey: &Pubkey, owner_pubkey: &Pubkey, rent_sysvar: &Pubkey, - signer_pubkeys: &[&Pubkey], ) -> Result { check_program_account(mango_program_id)?; let data = mango::instruction::MangoInstruction::InitMangoAccount.pack(); - let mut accounts = Vec::with_capacity(8 + MAX_PAIRS + signer_pubkeys.len()); + let mut accounts = Vec::with_capacity(8 + MAX_PAIRS); accounts.push(AccountMeta::new_readonly(*mango_group_pubkey, false)); accounts.push(AccountMeta::new(*mango_account_pubkey, false)); accounts.push(AccountMeta::new_readonly(*owner_pubkey, true)); accounts.push(AccountMeta::new_readonly(*rent_sysvar, false)); - for signer_pubkey in signer_pubkeys.iter() { - accounts.push(AccountMeta::new_readonly(**signer_pubkey, true)); - } Ok(Instruction { program_id: *mango_program_id, accounts, @@ -61,7 +57,6 @@ pub fn initialize_mango_account<'info>( ctx.accounts.mango_account.key, ctx.accounts.owner.key, ctx.accounts.rent.key, - &[ctx.accounts.owner.key], )?; solana_program::program::invoke_signed( &ix, diff --git a/programs/uxd/src/mango_program/place_perp_order.rs b/programs/uxd/src/mango_program/place_perp_order.rs index 26e1461eb..48cd03f06 100644 --- a/programs/uxd/src/mango_program/place_perp_order.rs +++ b/programs/uxd/src/mango_program/place_perp_order.rs @@ -45,7 +45,6 @@ fn place_perp_order_instruction( mango_bids_pubkey: &Pubkey, mango_asks_pubkey: &Pubkey, mango_event_queue_pubkey: &Pubkey, - signer_pubkeys: &[&Pubkey], price: i64, quantity: i64, client_order_id: u64, @@ -69,18 +68,13 @@ fn place_perp_order_instruction( let mut accounts = vec![ AccountMeta::new_readonly(*mango_group_pubkey, false), AccountMeta::new(*mango_account_pubkey, false), - AccountMeta::new_readonly(*owner_pubkey, signer_pubkeys.is_empty()), + AccountMeta::new_readonly(*owner_pubkey, true), AccountMeta::new_readonly(*mango_cache_pubkey, false), AccountMeta::new(*mango_perp_market_pubkey, false), AccountMeta::new(*mango_bids_pubkey, false), AccountMeta::new(*mango_asks_pubkey, false), AccountMeta::new(*mango_event_queue_pubkey, false), ]; - accounts.extend( - signer_pubkeys - .iter() - .map(|signer_pubkey| AccountMeta::new_readonly(**signer_pubkey, true)), - ); accounts.extend( [Pubkey::default(); MAX_PAIRS] .iter() @@ -114,7 +108,6 @@ pub fn place_perp_order<'info>( ctx.accounts.mango_bids.key, ctx.accounts.mango_asks.key, ctx.accounts.mango_event_queue.key, - &[ctx.accounts.owner.key], price, quantity, client_order_id, diff --git a/programs/uxd/src/mango_program/withdraw.rs b/programs/uxd/src/mango_program/withdraw.rs index e383cca13..db1a6f3eb 100644 --- a/programs/uxd/src/mango_program/withdraw.rs +++ b/programs/uxd/src/mango_program/withdraw.rs @@ -51,7 +51,6 @@ fn withdraw_instruction( token_account_pubkey: &Pubkey, mango_signer_pubkey: &Pubkey, token_program_id: &Pubkey, - signer_pubkeys: &[&Pubkey], quantity: u64, allow_borrow: bool, ) -> Result { @@ -66,7 +65,7 @@ fn withdraw_instruction( let mut accounts = vec![ AccountMeta::new_readonly(*mango_group_pubkey, false), AccountMeta::new(*mango_account_pubkey, false), - AccountMeta::new_readonly(*owner_pubkey, false), + AccountMeta::new_readonly(*owner_pubkey, true), AccountMeta::new_readonly(*mango_cache_pubkey, false), AccountMeta::new_readonly(*mango_root_bank_pubkey, false), AccountMeta::new(*mango_node_bank_pubkey, false), @@ -75,12 +74,6 @@ fn withdraw_instruction( AccountMeta::new_readonly(*mango_signer_pubkey, false), AccountMeta::new_readonly(*token_program_id, false), ]; - // accounts.push(AccountMeta::new_readonly(*clock_sysvar_id, false)); - accounts.extend( - signer_pubkeys - .iter() - .map(|signer_pubkey| AccountMeta::new_readonly(**signer_pubkey, true)), - ); accounts.extend( [Pubkey::default(); MAX_PAIRS] .iter() @@ -113,8 +106,6 @@ pub fn withdraw<'info>( ctx.accounts.token_account.key, ctx.accounts.mango_signer.key, ctx.accounts.token_program.key, - // ctx.accounts.clock_sysvar.key, - &[ctx.accounts.owner.key], quantity, allow_borrow, )?; From 180455a319efdf8898d42148667191fb16a9a9ce Mon Sep 17 00:00:00 2001 From: Acammm Date: Mon, 14 Feb 2022 11:38:19 +0800 Subject: [PATCH 3/4] Upgrade version to 2.1.0 --- Cargo.lock | 2 +- programs/uxd/Cargo.toml | 2 +- target/idl/uxd.json | 2 +- target/types/uxd.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d35c9288..488a82b01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1574,7 +1574,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "uxd" -version = "2.0.0" +version = "2.1.0" dependencies = [ "anchor-lang", "anchor-spl", diff --git a/programs/uxd/Cargo.toml b/programs/uxd/Cargo.toml index 628fff360..409a83ae8 100644 --- a/programs/uxd/Cargo.toml +++ b/programs/uxd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uxd" -version = "2.0.0" +version = "2.1.0" authors = ["acammm "] description = "UXDProtocol Program, managing a redeemable mint backed by a delta neutral position." edition = "2021" diff --git a/target/idl/uxd.json b/target/idl/uxd.json index 19fe78636..8e15f83fb 100644 --- a/target/idl/uxd.json +++ b/target/idl/uxd.json @@ -1,5 +1,5 @@ { - "version": "2.0.0", + "version": "2.1.0", "name": "uxd", "instructions": [ { diff --git a/target/types/uxd.ts b/target/types/uxd.ts index 7939e6e44..14dad819c 100644 --- a/target/types/uxd.ts +++ b/target/types/uxd.ts @@ -1,5 +1,5 @@ export type Uxd = { - "version": "2.0.0", + "version": "2.1.0", "name": "uxd", "instructions": [ { @@ -1327,7 +1327,7 @@ export type Uxd = { }; export const IDL: Uxd = { - "version": "2.0.0", + "version": "2.1.0", "name": "uxd", "instructions": [ { From b9cfc517119abd9dcd057f42a52c31d1626348b0 Mon Sep 17 00:00:00 2001 From: Acammm Date: Mon, 14 Feb 2022 13:15:23 +0800 Subject: [PATCH 4/4] Add changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..a6c7b80e8 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# CHANGELOG + +## v2.1.0 (hotfix) + +Deployed: | Slot: + +1. Remove unnecessary account passed as input to mango instructions (mango 3.3.5) +2. Owner of the MangoAccount passed as parameter to MangoMarketV3 CPI is now always a signer + +## v2.0.0 (audited Brahma) + +Deployed: January 14, 2022 14:19:32 PM +UTC | Slot: 116,223,281 + +1. Initial deployment