update mango branch

This commit is contained in:
Lou-Kamades 2023-10-05 01:38:08 -05:00
parent 9820cb4d66
commit e90960a479
3 changed files with 231 additions and 203 deletions

392
Cargo.lock generated
View File

@ -119,7 +119,7 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faa5be5b72abea167f87c868379ba3c2be356bfca9e6f474fd055fa0f7eeb4f2"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"anyhow",
"proc-macro2 1.0.67",
"quote 1.0.33",
@ -127,24 +127,13 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-access-control"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-account"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f468970344c7c9f9d03b4da854fd7c54f21305059f53789d0045c1dd803f0018"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"anyhow",
"bs58 0.5.0",
"proc-macro2 1.0.67",
@ -153,115 +142,62 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-account"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"bs58 0.5.0",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-constant"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59948e7f9ef8144c2aefb3f32a40c5fce2798baeec765ba038389e82301017ef"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"proc-macro2 1.0.67",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-constant"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-error"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc753c9d1c7981cb8948cf7e162fb0f64558999c0413058e2d43df1df5448086"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-error"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-event"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38b4e172ba1b52078f53fdc9f11e3dc0668ad27997838a0aad2d148afac8c97"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"anyhow",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-event"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-program"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eebd21543606ab61e2d83d9da37d24d3886a49f390f9c43a1964735e8c0f0d5"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"anyhow",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-attribute-program"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-client"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8434a6bf33efba0c93157f7fa2fafac658cb26ab75396886dcedd87c2a8ad445"
dependencies = [
"anchor-lang 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-lang",
"anyhow",
"futures 0.3.28",
"regex",
@ -280,35 +216,13 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec4720d899b3686396cced9508f23dab420f1308344456ec78ef76f98fda42af"
dependencies = [
"anchor-syn 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-syn",
"anyhow",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-derive-accounts"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-derive-serde"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-syn 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"borsh-derive-internal 0.10.3",
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-derive-space"
version = "0.28.0"
@ -320,54 +234,20 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "anchor-derive-space"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"proc-macro2 1.0.67",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "anchor-lang"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d2d4b20100f1310a774aba3471ef268e5c4ba4d5c28c0bbe663c2658acbc414"
dependencies = [
"anchor-attribute-access-control 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-attribute-account 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-attribute-constant 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-attribute-error 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-attribute-event 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-attribute-program 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-derive-accounts 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-derive-space 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayref",
"base64 0.13.1",
"bincode",
"borsh 0.10.3",
"bytemuck",
"getrandom 0.2.10",
"solana-program",
"thiserror",
]
[[package]]
name = "anchor-lang"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-attribute-access-control 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-account 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-constant 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-error 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-event 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-program 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-derive-accounts 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-derive-serde",
"anchor-derive-space 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-attribute-access-control",
"anchor-attribute-account",
"anchor-attribute-constant",
"anchor-attribute-error",
"anchor-attribute-event",
"anchor-attribute-program",
"anchor-derive-accounts",
"anchor-derive-space",
"arrayref",
"base64 0.13.1",
"bincode",
@ -384,19 +264,7 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78f860599da1c2354e7234c768783049eb42e2f54509ecfc942d2e0076a2da7b"
dependencies = [
"anchor-lang 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-program",
"spl-associated-token-account",
"spl-token",
"spl-token-2022",
]
[[package]]
name = "anchor-spl"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anchor-lang 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-lang",
"solana-program",
"spl-associated-token-account",
"spl-token",
@ -421,23 +289,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "anchor-syn"
version = "0.28.0"
source = "git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669#2af9cc669b734ca4b3a1ef4f590eec2a2dc097e5"
dependencies = [
"anyhow",
"bs58 0.5.0",
"heck 0.3.3",
"proc-macro2 1.0.67",
"quote 1.0.33",
"serde",
"serde_json",
"sha2 0.10.7",
"syn 1.0.109",
"thiserror",
]
[[package]]
name = "android-tzdata"
version = "0.1.1"
@ -2613,9 +2464,7 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
name = "jito-points-mango"
version = "0.1.0"
dependencies = [
"anchor-client",
"anchor-lang 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-spl 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-lang",
"anyhow",
"bytemuck",
"fixed",
@ -2625,9 +2474,6 @@ dependencies = [
"solana-logger",
"solana-rpc",
"solana-sdk",
"switchboard-common",
"switchboard-program",
"switchboard-solana",
"tokio",
]
@ -2944,11 +2790,11 @@ dependencies = [
[[package]]
name = "mango-v4"
version = "0.18.0"
source = "git+https://github.com/blockworks-foundation/mango-v4.git?branch=update-solana-1-16-anchor-28#659944e1f3e8f97b30e05026f925d5127a039845"
version = "0.19.0"
source = "git+https://github.com/blockworks-foundation/mango-v4.git?branch=update-solana-1-16-anchor-28-mango-0.19#164dadb0de5bc67294c5a2b380c72d2e4794526e"
dependencies = [
"anchor-lang 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-spl 0.28.0 (git+https://github.com/coral-xyz/anchor.git?rev=2af9cc669)",
"anchor-lang",
"anchor-spl",
"arrayref",
"bincode",
"borsh 0.10.3",
@ -2957,6 +2803,7 @@ dependencies = [
"derivative",
"fixed",
"num_enum 0.5.11",
"openbook-v2",
"pyth-sdk-solana",
"serde",
"serum_dex",
@ -3090,6 +2937,76 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "mpl-token-auth-rules"
version = "1.4.3-beta.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81a34d740606a10a9dac7507d0c9025d72e0ce311c68ae85b6634982cf69a9c6"
dependencies = [
"borsh 0.9.3",
"bytemuck",
"mpl-token-metadata-context-derive 0.2.1",
"num-derive",
"num-traits",
"rmp-serde",
"serde",
"shank",
"solana-program",
"solana-zk-token-sdk",
"thiserror",
]
[[package]]
name = "mpl-token-metadata"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "654976568c99887549e1291e7b7e55ae31a70732e56ebb25cb1cdfc08c018333"
dependencies = [
"arrayref",
"borsh 0.9.3",
"mpl-token-auth-rules",
"mpl-token-metadata-context-derive 0.3.0",
"mpl-utils",
"num-derive",
"num-traits",
"shank",
"solana-program",
"spl-associated-token-account",
"spl-token",
"thiserror",
]
[[package]]
name = "mpl-token-metadata-context-derive"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12989bc45715b0ee91944855130131479f9c772e198a910c3eb0ea327d5bffc3"
dependencies = [
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "mpl-token-metadata-context-derive"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a739019e11d93661a64ef5fe108ab17c79b35961e944442ff6efdd460ad01a"
dependencies = [
"quote 1.0.33",
"syn 1.0.109",
]
[[package]]
name = "mpl-utils"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2e4f92aec317d5853c0cc4c03c55f5178511c45bb3dbb441aea63117bf3dc9"
dependencies = [
"arrayref",
"solana-program",
"spl-token-2022",
]
[[package]]
name = "multimap"
version = "0.8.3"
@ -3346,6 +3263,27 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openbook-v2"
version = "0.1.0"
source = "git+https://github.com/openbook-dex/openbook-v2.git#44f464774ee75ed2239341a517879119bdbd39c6"
dependencies = [
"anchor-lang",
"anchor-spl",
"arrayref",
"bytemuck",
"derivative",
"fixed",
"itertools",
"num_enum 0.5.11",
"pyth-sdk-solana",
"raydium-amm-v3",
"solana-program",
"static_assertions",
"switchboard-program",
"switchboard-v2",
]
[[package]]
name = "openssl"
version = "0.10.57"
@ -3967,6 +3905,20 @@ dependencies = [
"rand_core 0.6.4",
]
[[package]]
name = "raydium-amm-v3"
version = "0.1.0"
source = "git+https://github.com/raydium-io/raydium-clmm.git#6e4639f7133a8852068d2d473c263f907b69cd4a"
dependencies = [
"anchor-lang",
"anchor-spl",
"arrayref",
"bytemuck",
"mpl-token-metadata",
"solana-program",
"uint",
]
[[package]]
name = "rayon"
version = "1.7.0"
@ -4133,6 +4085,28 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "rmp"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [
"byteorder",
"num-traits",
"paste",
]
[[package]]
name = "rmp-serde"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [
"byteorder",
"rmp",
"serde",
]
[[package]]
name = "rocksdb"
version = "0.21.0"
@ -4489,7 +4463,7 @@ name = "serum_dex"
version = "0.5.10"
source = "git+https://github.com/openbook-dex/program.git#c85e56deeaead43abbc33b7301058838b9c5136d"
dependencies = [
"anchor-lang 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-lang",
"arrayref",
"bincode",
"bytemuck",
@ -4600,6 +4574,40 @@ dependencies = [
"keccak",
]
[[package]]
name = "shank"
version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63e565b5e95ad88ab38f312e89444c749360641c509ef2de0093b49f55974a5"
dependencies = [
"shank_macro",
]
[[package]]
name = "shank_macro"
version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63927d22a1e8b74bda98cc6e151fcdf178b7abb0dc6c4f81e0bbf5ffe2fc4ec8"
dependencies = [
"proc-macro2 1.0.67",
"quote 1.0.33",
"shank_macro_impl",
"syn 1.0.109",
]
[[package]]
name = "shank_macro_impl"
version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ce03403df682f80f4dc1efafa87a4d0cb89b03726d0565e6364bdca5b9a441"
dependencies = [
"anyhow",
"proc-macro2 1.0.67",
"quote 1.0.33",
"serde",
"syn 1.0.109",
]
[[package]]
name = "shell-words"
version = "1.1.0"
@ -6165,8 +6173,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a978513e0d3f54444698efb1737c8bcf366e2131e03ccfdf24c22210b8d755c"
dependencies = [
"anchor-client",
"anchor-lang 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-spl 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"anchor-lang",
"anchor-spl",
"bincode",
"bytemuck",
"chrono",
@ -6200,6 +6208,20 @@ dependencies = [
"switchboard-protos",
]
[[package]]
name = "switchboard-v2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b81886169f446e22edc18ead7addd9ebd141c39bf2286cb37943c92cd3af724"
dependencies = [
"anchor-lang",
"anchor-spl",
"bytemuck",
"rust_decimal",
"solana-program",
"superslice",
]
[[package]]
name = "symlink"
version = "0.1.0"
@ -6692,6 +6714,18 @@ version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "uint"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52"
dependencies = [
"byteorder",
"crunchy",
"hex",
"static_assertions",
]
[[package]]
name = "unicase"
version = "2.7.0"

View File

@ -17,14 +17,7 @@ solana-account-decoder = "~1.16.7"
solana-sdk = "~1.16.7"
solana-logger = "~1.16.7"
anchor-spl = "0.28.0"
anchor-lang = "0.28.0"
anchor-client = "0.28.0"
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4.git", branch = "update-solana-1-16-anchor-28", features = ["client"] }
mango-v4 = { git = "https://github.com/blockworks-foundation/mango-v4.git", branch = "update-solana-1-16-anchor-28-mango-0.19", features = ["client"] }
fixed = { git = "https://github.com/blockworks-foundation/fixed.git", branch = "v1.11.0-borsh0_10-mango" }
switchboard-program = "0.2.0"
# note: 0.8.19 seems broken
switchboard-common = "=0.8.18"
switchboard-v2 = { package = "switchboard-solana", version = "0.28" }

View File

@ -13,6 +13,23 @@ use solana_sdk::pubkey;
const JITOSOL_TOKEN_INDEX: u16 = 501;
const GROUP: Pubkey = pubkey!("78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX");
#[tokio::main]
async fn main() {
let program = mango_v4::ID;
let wallet_pk = pubkey!("WALLET PUBKEY HERE");
let rpc =
RpcClientAsync::new("RPC HERE".to_string());
let jito_bank = fetch_jitosol_bank(&rpc, program, GROUP).await.unwrap();
let jitosol_exposure = fetch_jitosol_exposure(&rpc, program, GROUP, wallet_pk, jito_bank)
.await
.unwrap();
println!(
"Mango accounts owned by {:?} have {:?} of JitoSol exposure",
wallet_pk, jitosol_exposure
);
}
pub async fn fetch_mango_accounts_by_owner(
rpc: &RpcClientAsync,
program: Pubkey,
@ -108,19 +125,3 @@ pub async fn fetch_jitosol_exposure(
Ok(jitosol_amount)
}
#[tokio::main]
async fn main() {
let program = mango_v4::ID;
let owner_pk = pubkey!("Wallet Private Key Here");
let rpc =
RpcClientAsync::new("RPC HERE".to_string());
let jito_bank = fetch_jitosol_bank(&rpc, program, GROUP).await.unwrap();
let jitosol_exposure = fetch_jitosol_exposure(&rpc, program, GROUP, owner_pk, jito_bank)
.await
.unwrap();
println!(
"Mango accounts owned by {:?} have {:?} of JitoSol exposure",
owner_pk, jitosol_exposure
);
}