diff --git a/Cargo.lock b/Cargo.lock index 6f170e39..c8afdc77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,31 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aead" version = "0.4.3" @@ -100,110 +75,43 @@ dependencies = [ "memchr", ] -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5e1a413b311b039d29b61d0dbb401c9dbf04f792497ceca87593454bf6d7dd" -dependencies = [ - "anchor-syn 0.27.0", - "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "regex", - "syn 1.0.99", -] - [[package]] name = "anchor-attribute-access-control" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faa5be5b72abea167f87c868379ba3c2be356bfca9e6f474fd055fa0f7eeb4f2" dependencies = [ - "anchor-syn 0.28.0", + "anchor-syn", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "regex", "syn 1.0.99", ] -[[package]] -name = "anchor-attribute-account" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca9aeaf633c6e2365fed0525dcac68610be58eee5dc69d3b86fe0b1d4b320b9" -dependencies = [ - "anchor-syn 0.27.0", - "anyhow", - "bs58 0.4.0", - "proc-macro2 1.0.66", - "quote 1.0.31", - "rustversion", - "syn 1.0.99", -] - [[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", + "anchor-syn", "anyhow", "bs58 0.5.0", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "rustversion", "syn 1.0.99", ] -[[package]] -name = "anchor-attribute-constant" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "788e44f9e8501dabeb6f9229da0f3268fb2ae3208912608ffaa056a72031296f" -dependencies = [ - "anchor-syn 0.27.0", - "proc-macro2 1.0.66", - "syn 1.0.99", -] - [[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", - "proc-macro2 1.0.66", - "syn 1.0.99", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c4d8c7e4a2605ede6fcdced9690288b2f74e24768619a85229d57e597bc97" -dependencies = [ - "anchor-syn 0.27.0", - "proc-macro2 1.0.66", - "quote 1.0.31", + "anchor-syn", + "proc-macro2", "syn 1.0.99", ] @@ -213,22 +121,9 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc753c9d1c7981cb8948cf7e162fb0f64558999c0413058e2d43df1df5448086" dependencies = [ - "anchor-syn 0.28.0", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3b07d5c5d87b5edc72428b447b8e9ee1143b83dd1afc6a6b1d352c6a6164d8" -dependencies = [ - "anchor-syn 0.27.0", - "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", + "anchor-syn", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -238,23 +133,10 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38b4e172ba1b52078f53fdc9f11e3dc0668ad27997838a0aad2d148afac8c97" dependencies = [ - "anchor-syn 0.28.0", - "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22ad0445115dbea5869b1d062da49ae125abed9132fc20c33227f25e42dfa6b" -dependencies = [ - "anchor-syn 0.27.0", + "anchor-syn", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -264,40 +146,10 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eebd21543606ab61e2d83d9da37d24d3886a49f390f9c43a1964735e8c0f0d5" dependencies = [ - "anchor-syn 0.28.0", - "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "anchor-client" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c06e06497b5b4f392845e0d04dde8374fd244fa2832dd0e5c27bfd99cb0342" -dependencies = [ - "anchor-lang 0.27.0", + "anchor-syn", "anyhow", - "regex", - "serde", - "solana-account-decoder", - "solana-client", - "solana-sdk", - "thiserror", - "url", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48daeff6781ba2f02961b0ad211feb9a2de75af345d42c62b1a252fd4dfb0724" -dependencies = [ - "anchor-syn 0.27.0", - "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -307,21 +159,10 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec4720d899b3686396cced9508f23dab420f1308344456ec78ef76f98fda42af" dependencies = [ - "anchor-syn 0.28.0", + "anchor-syn", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "anchor-derive-space" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe2886f92c4f33ec1b2b8b2b43ca1b9070cf4929e63c7eaaa09a9f2c0d5123" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -331,48 +172,25 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f495e85480bd96ddeb77b71d499247c7d4e8b501e75ecb234e9ef7ae7bd6552a" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] -[[package]] -name = "anchor-lang" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbe5d1c7c057c6d63b4f2f538a320e4a22111126c9966340c3d9490e2f15ed1" -dependencies = [ - "anchor-attribute-access-control 0.27.0", - "anchor-attribute-account 0.27.0", - "anchor-attribute-constant 0.27.0", - "anchor-attribute-error 0.27.0", - "anchor-attribute-event 0.27.0", - "anchor-attribute-program 0.27.0", - "anchor-derive-accounts 0.27.0", - "anchor-derive-space 0.27.0", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - [[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", - "anchor-attribute-account 0.28.0", - "anchor-attribute-constant 0.28.0", - "anchor-attribute-error 0.28.0", - "anchor-attribute-event 0.28.0", - "anchor-attribute-program 0.28.0", - "anchor-derive-accounts 0.28.0", - "anchor-derive-space 0.28.0", + "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.0", "bincode", @@ -383,50 +201,19 @@ dependencies = [ "thiserror", ] -[[package]] -name = "anchor-spl" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cc8066fbd45e0e03edf48342c79265aa34ca76cefeace48ef6c402b6946665" -dependencies = [ - "anchor-lang 0.27.0", - "solana-program", - "spl-associated-token-account", - "spl-token", - "spl-token-2022 0.5.0", -] - [[package]] name = "anchor-spl" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78f860599da1c2354e7234c768783049eb42e2f54509ecfc942d2e0076a2da7b" dependencies = [ - "anchor-lang 0.28.0", + "anchor-lang", "solana-program", "spl-associated-token-account", "spl-token", "spl-token-2022 0.6.1", ] -[[package]] -name = "anchor-syn" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11cb31fe143aedb36fc41409ea072aa0b840cbea727e62eb2ff6e7b6cea036ff" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2 1.0.66", - "quote 1.0.31", - "serde", - "serde_json", - "sha2 0.9.9", - "syn 1.0.99", - "thiserror", -] - [[package]] name = "anchor-syn" version = "0.28.0" @@ -436,8 +223,8 @@ dependencies = [ "anyhow", "bs58 0.5.0", "heck", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "serde", "serde_json", "sha2 0.10.7", @@ -451,24 +238,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.64" @@ -481,97 +250,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "asn1-rs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" -dependencies = [ - "asn1-rs-derive", - "asn1-rs-impl", - "displaydoc", - "nom 7.1.3", - "num-traits", - "rusticata-macros", - "thiserror", - "time 0.3.23", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", - "synstructure", -] - -[[package]] -name = "asn1-rs-impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - [[package]] name = "assert_matches" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" -[[package]] -name = "async-compression" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" -dependencies = [ - "brotli", - "flate2", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-trait" -version = "0.1.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", -] - [[package]] name = "atty" version = "0.2.14" @@ -589,21 +279,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backtrace" -version = "0.3.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.12.3" @@ -616,18 +291,6 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - [[package]] name = "bincode" version = "1.3.3" @@ -643,12 +306,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - [[package]] name = "bitmaps" version = "2.1.0" @@ -665,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec", "cc", "cfg-if", "constant_time_eq", @@ -703,8 +360,8 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10c56a4a679222368b66b5d31cc31dfbfd94144190a50412f55b9663c051290e" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "solana-program", "spl-name-service", "syn 1.0.99", @@ -719,7 +376,7 @@ dependencies = [ "bonfida-macros", "borsh", "bytemuck", - "pyth-sdk-solana 0.4.2", + "pyth-sdk-solana", "solana-program", "spl-token", ] @@ -743,7 +400,7 @@ dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.66", + "proc-macro2", "syn 1.0.99", ] @@ -753,8 +410,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -764,38 +421,11 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] -[[package]] -name = "brotli" -version = "3.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - [[package]] name = "bs58" version = "0.4.0" @@ -842,8 +472,8 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -853,22 +483,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "caps" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" -dependencies = [ - "libc", - "thiserror", -] - [[package]] name = "cc" version = "1.0.79" @@ -891,13 +505,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ "android-tzdata", - "iana-time-zone", - "js-sys", "num-traits", - "serde", - "time 0.1.45", - "wasm-bindgen", - "winapi", ] [[package]] @@ -920,106 +528,31 @@ dependencies = [ ] [[package]] -name = "clap" -version = "2.34.0" +name = "console_error_panic_hook" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", - "vec_map", + "cfg-if", + "wasm-bindgen", ] [[package]] -name = "clap" -version = "3.2.25" +name = "console_log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex", - "indexmap", - "once_cell", - "strsim 0.10.0", - "termcolor", - "textwrap 0.16.0", + "log", + "web-sys", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "console" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.45.0", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" version = "0.2.5" @@ -1029,26 +562,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cron" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff76b51e4c068c52bfd2866e1567bee7c567ae8f24ada09fd4307019e25eab7" -dependencies = [ - "chrono", - "nom 7.1.3", - "once_cell", -] - [[package]] name = "crossbeam-channel" version = "0.5.6" @@ -1141,35 +654,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "data-encoding" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" - -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - -[[package]] -name = "der-parser" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" -dependencies = [ - "asn1-rs", - "displaydoc", - "nom 7.1.3", - "num-bigint 0.4.3", - "num-traits", - "rusticata-macros", -] - [[package]] name = "derivation-path" version = "0.2.0" @@ -1181,15 +665,15 @@ name = "dex" version = "0.1.0" dependencies = [ "agnostic-orderbook", - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", + "anchor-lang", + "anchor-spl", "arrayref", "base64 0.13.0", "bonfida-utils", "borsh", "bytemuck", "itertools", - "num 0.4.1", + "num", "num-derive", "num-traits", "pyth-client 0.3.0", @@ -1200,18 +684,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "dialoguer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" -dependencies = [ - "console", - "shell-words", - "tempfile", - "zeroize", -] - [[package]] name = "digest" version = "0.9.0" @@ -1232,73 +704,12 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", -] - -[[package]] -name = "dlopen" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937" -dependencies = [ - "dlopen_derive", - "lazy_static", - "libc", - "winapi", -] - -[[package]] -name = "dlopen_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581" -dependencies = [ - "libc", - "quote 0.6.13", - "syn 0.15.44", -] - [[package]] name = "dyn-clone" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" -[[package]] -name = "eager" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe71d579d1812060163dff96056261deb5bf6729b100fa2e36a68b9649ba3d3" - [[package]] name = "ed25519" version = "1.5.3" @@ -1316,7 +727,7 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", - "rand 0.7.3", + "rand", "serde", "sha2 0.9.9", "zeroize", @@ -1340,53 +751,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-iterator" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2953d1df47ac0eb70086ccabf0275aa8da8591a28bd358ee2b52bd9f9e3ff9e9" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8958699f9359f0b04e691a13850d48b7de329138023876d07cbd024c2c820598" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "enum_dispatch" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" -dependencies = [ - "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", -] - [[package]] name = "enumflags2" version = "0.7.7" @@ -1402,8 +766,8 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 2.0.27", ] @@ -1420,177 +784,18 @@ dependencies = [ "termcolor", ] -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - [[package]] name = "feature-probe" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" -[[package]] -name = "flate2" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" -dependencies = [ - "num-traits", -] - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.6" @@ -1602,16 +807,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -1638,31 +833,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - -[[package]] -name = "h2" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.11.2" @@ -1708,12 +878,6 @@ dependencies = [ "serde", ] -[[package]] -name = "histogram" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669" - [[package]] name = "hmac" version = "0.8.1" @@ -1745,42 +909,8 @@ dependencies = [ ] [[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "humantime" -version = "2.1.0" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" @@ -1789,84 +919,13 @@ name = "hxro-print-trade-provider" version = "0.1.0" dependencies = [ "agnostic-orderbook", - "anchor-lang 0.28.0", + "anchor-lang", "dex", "instruments", "rfq", "risk-engine", ] -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls 0.21.5", - "tokio", - "tokio-rustls 0.24.1", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "im" version = "15.1.0" @@ -1883,28 +942,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indicatif" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" -dependencies = [ - "console", - "lazy_static", - "number_prefix", - "regex", -] - [[package]] name = "inout" version = "0.1.3" @@ -1918,7 +955,7 @@ dependencies = [ name = "instruments" version = "0.1.0" dependencies = [ - "anchor-lang 0.28.0", + "anchor-lang", "arrayref", "bincode", "borsh", @@ -1933,12 +970,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "ipnet" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - [[package]] name = "itertools" version = "0.10.5" @@ -1972,21 +1003,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "keccak" version = "0.1.2" @@ -1999,35 +1015,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec 0.5.2", - "bitflags 1.3.2", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "libsecp256k1" version = "0.6.0" @@ -2041,7 +1034,7 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand 0.7.3", + "rand", "serde", "sha2 0.9.9", "typenum", @@ -2076,18 +1069,6 @@ dependencies = [ "libsecp256k1-core", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "linux-raw-sys" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" - [[package]] name = "lock_api" version = "0.4.8" @@ -2143,107 +1124,17 @@ dependencies = [ "zeroize", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "5.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" -dependencies = [ - "lexical-core", - "memchr", - "version_check", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" -dependencies = [ - "num-bigint 0.2.6", - "num-complex 0.2.4", - "num-integer", - "num-iter", - "num-rational 0.2.4", - "num-traits", -] - [[package]] name = "num" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ - "num-bigint 0.4.3", - "num-complex 0.4.3", + "num-bigint", + "num-complex", "num-integer", "num-iter", - "num-rational 0.4.1", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", + "num-rational", "num-traits", ] @@ -2258,16 +1149,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-complex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.3" @@ -2283,8 +1164,8 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -2309,18 +1190,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint 0.2.6", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -2328,7 +1197,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint 0.4.3", + "num-bigint", "num-integer", "num-traits", ] @@ -2368,35 +1237,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate 1.2.1", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "object" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" -dependencies = [ - "memchr", -] - -[[package]] -name = "oid-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" -dependencies = [ - "asn1-rs", -] - [[package]] name = "once_cell" version = "1.14.0" @@ -2409,18 +1254,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "os_str_bytes" -version = "6.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" - [[package]] name = "parking_lot" version = "0.12.1" @@ -2439,9 +1272,9 @@ checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -2462,59 +1295,12 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.0", -] - [[package]] name = "percent-encoding" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "percentage" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd23b938276f14057220b707937bcb42fa76dda7560e57a2da30cb52d557937" -dependencies = [ - "num 0.2.1", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der", - "spki", - "zeroize", -] - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - [[package]] name = "polyval" version = "0.5.3" @@ -2553,15 +1339,6 @@ dependencies = [ "toml", ] -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] - [[package]] name = "proc-macro2" version = "1.0.66" @@ -2575,8 +1352,8 @@ dependencies = [ name = "psyoptions-american-instrument" version = "0.1.0" dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", + "anchor-lang", + "anchor-spl", "rfq", "risk-engine", ] @@ -2585,8 +1362,8 @@ dependencies = [ name = "psyoptions-european-instrument" version = "0.1.0" dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", + "anchor-lang", + "anchor-spl", "rfq", "risk-engine", ] @@ -2624,19 +1401,6 @@ dependencies = [ "serde", ] -[[package]] -name = "pyth-sdk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bf2540203ca3c7a5712fdb8b5897534b7f6a0b6e7b0923ff00466c5f9efcb3" -dependencies = [ - "borsh", - "borsh-derive", - "hex", - "schemars", - "serde", -] - [[package]] name = "pyth-sdk-solana" version = "0.4.2" @@ -2648,107 +1412,28 @@ dependencies = [ "bytemuck", "num-derive", "num-traits", - "pyth-sdk 0.4.2", + "pyth-sdk", "serde", "solana-program", "thiserror", ] [[package]] -name = "pyth-sdk-solana" +name = "qstring" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fcd2dcd063ea85004667cf5cb07f30de7387f17249df988a295e764a47b9f5" -dependencies = [ - "borsh", - "borsh-derive", - "bytemuck", - "num-derive", - "num-traits", - "pyth-sdk 0.7.0", - "serde", - "solana-program", - "thiserror", -] - -[[package]] -name = "qstring" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" dependencies = [ "percent-encoding", ] -[[package]] -name = "quinn" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b435e71d9bfa0d8889927231970c51fb89c58fa63bffcab117c9c7a41e5ef8f" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "fxhash", - "quinn-proto", - "quinn-udp", - "rustls 0.20.8", - "thiserror", - "tokio", - "tracing", - "webpki", -] - -[[package]] -name = "quinn-proto" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fce546b9688f767a57530652488420d419a8b1f44a478b451c3d1ab6d992a55" -dependencies = [ - "bytes", - "fxhash", - "rand 0.8.5", - "ring", - "rustls 0.20.8", - "rustls-native-certs", - "rustls-pemfile 0.2.1", - "slab", - "thiserror", - "tinyvec", - "tracing", - "webpki", -] - -[[package]] -name = "quinn-udp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07946277141531aea269befd949ed16b2c85a780ba1043244eda0969e538e54" -dependencies = [ - "futures-util", - "libc", - "quinn-proto", - "socket2", - "tokio", - "tracing", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - [[package]] name = "quote" version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ - "proc-macro2 1.0.66", + "proc-macro2", ] [[package]] @@ -2759,22 +1444,11 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha 0.2.2", + "rand_chacha", "rand_core 0.5.1", "rand_hc", ] -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -2785,16 +1459,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - [[package]] name = "rand_core" version = "0.5.1" @@ -2855,45 +1519,13 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rcgen" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" -dependencies = [ - "pem", - "ring", - "time 0.3.23", - "yasna", -] - [[package]] name = "redox_syscall" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", - "thiserror", + "bitflags", ] [[package]] @@ -2913,116 +1545,26 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" -[[package]] -name = "reqwest" -version = "0.11.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" -dependencies = [ - "async-compression", - "base64 0.21.2", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls 0.21.5", - "rustls-pemfile 1.0.3", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls 0.24.1", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - [[package]] name = "rfq" version = "2.2.0" dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", + "anchor-lang", + "anchor-spl", "borsh", "solana-program", "solana-security-txt", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "risk-engine" version = "0.1.0" dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", - "borsh", - "bytemuck", - "float-cmp", - "pyth-sdk-solana 0.7.2", + "anchor-lang", + "anchor-spl", "rfq", - "switchboard-solana", -] - -[[package]] -name = "rpassword" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956" -dependencies = [ - "libc", - "serde", - "serde_json", - "winapi", -] - -[[package]] -name = "rust_decimal" -version = "1.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee9164faf726e4f3ece4978b25ca877ddc6802fa77f38cdccb32c7f805ecd70c" -dependencies = [ - "arrayvec 0.7.2", - "num-traits", - "serde", ] -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc-hash" version = "1.1.0" @@ -3038,92 +1580,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rusticata-macros" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" -dependencies = [ - "nom 7.1.3", -] - -[[package]] -name = "rustix" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" -dependencies = [ - "log", - "ring", - "rustls-webpki", - "sct", -] - -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.3", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pemfile" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" -dependencies = [ - "base64 0.21.2", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustversion" version = "1.0.9" @@ -3136,15 +1592,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "schemars" version = "0.8.12" @@ -3163,8 +1610,8 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "serde_derive_internals", "syn 1.0.99", ] @@ -3175,39 +1622,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "security-framework" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.13" @@ -3247,8 +1661,8 @@ version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -3258,8 +1672,8 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", ] @@ -3274,50 +1688,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap", - "ryu", - "serde", - "yaml-rust", -] - -[[package]] -name = "sgx-quote" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1640577af7b81d10db340c4b31006b77972e3918f351eec4e65c389c8b58e21" -dependencies = [ - "nom 5.1.3", -] - -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.9.9" @@ -3364,21 +1734,6 @@ dependencies = [ "keccak", ] -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - [[package]] name = "signature" version = "1.6.4" @@ -3395,15 +1750,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - [[package]] name = "smallvec" version = "1.9.0" @@ -3411,205 +1757,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "solana-account-decoder" +name = "solana-frozen-abi" version = "1.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec36d5c2ec5469dacc4fd2bdfcaaf4b253a4814d86d88686d50fd407cf7b3330" +checksum = "23b4953578272ac0fadec245e85e83ae86454611f0c0a7fff7d906835124bdcf" dependencies = [ - "Inflector", - "base64 0.13.0", - "bincode", + "ahash", + "blake3", + "block-buffer 0.9.0", "bs58 0.4.0", "bv", - "lazy_static", - "serde", - "serde_derive", - "serde_json", - "solana-address-lookup-table-program", - "solana-config-program", - "solana-sdk", - "solana-vote-program", - "spl-token", - "spl-token-2022 0.5.0", - "thiserror", - "zstd", -] - -[[package]] -name = "solana-address-lookup-table-program" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf23fb5a4ff0e902bf94fbc63ba51b10b1f86c6bca18574b583ec3baf6383a0b" -dependencies = [ - "bincode", - "bytemuck", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-program", - "solana-program-runtime", - "solana-sdk", - "thiserror", -] - -[[package]] -name = "solana-clap-utils" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e6537858df8634c4cf7e9e8a84a9f1967b8983bcb4e4833cad3ae200b7170d" -dependencies = [ - "chrono", - "clap 2.34.0", - "rpassword", - "solana-perf", - "solana-remote-wallet", - "solana-sdk", - "thiserror", - "tiny-bip39", - "uriparse", - "url", -] - -[[package]] -name = "solana-cli-config" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2234deff9765c25fc6189322689d1b702490f4389680dfdef0af582856041844" -dependencies = [ - "dirs-next", - "lazy_static", - "serde", - "serde_derive", - "serde_yaml", - "solana-clap-utils", - "solana-sdk", - "url", -] - -[[package]] -name = "solana-client" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e706f894fe68d518c125e27a7186d07a56f5b179d67c8fb2cf719cef8e1ee7cd" -dependencies = [ - "async-mutex", - "async-trait", - "base64 0.13.0", - "bincode", - "bs58 0.4.0", - "bytes", - "clap 2.34.0", - "crossbeam-channel", - "enum_dispatch", - "futures", - "futures-util", - "indexmap", - "indicatif", - "itertools", - "jsonrpc-core", - "lazy_static", - "log", - "quinn", - "quinn-proto", - "rand 0.7.3", - "rand_chacha 0.2.2", - "rayon", - "reqwest", - "rustls 0.20.8", - "semver", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder", - "solana-clap-utils", - "solana-faucet", - "solana-measure", - "solana-metrics", - "solana-net-utils", - "solana-sdk", - "solana-streamer", - "solana-transaction-status", - "solana-version", - "solana-vote-program", - "spl-token-2022 0.5.0", - "thiserror", - "tokio", - "tokio-stream", - "tokio-tungstenite", - "tungstenite", - "url", -] - -[[package]] -name = "solana-config-program" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c2d438fdfa4f5774c70fb0eeb2325caa073c838a229ef6a876c65c8703294" -dependencies = [ - "bincode", - "chrono", - "serde", - "serde_derive", - "solana-program-runtime", - "solana-sdk", -] - -[[package]] -name = "solana-faucet" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba3e5e2acc09b2fcb54957d05c0943b194d48f825f879fc2cf5d255e2608b05" -dependencies = [ - "bincode", - "byteorder", - "clap 2.34.0", - "crossbeam-channel", - "log", - "serde", - "serde_derive", - "solana-clap-utils", - "solana-cli-config", - "solana-logger", - "solana-metrics", - "solana-sdk", - "solana-version", - "spl-memo", - "thiserror", - "tokio", -] - -[[package]] -name = "solana-frozen-abi" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b4953578272ac0fadec245e85e83ae86454611f0c0a7fff7d906835124bdcf" -dependencies = [ - "ahash", - "blake3", - "block-buffer 0.9.0", - "bs58 0.4.0", - "bv", - "byteorder", - "cc", - "either", - "generic-array", - "getrandom 0.1.16", - "hashbrown 0.12.3", - "im", + "byteorder", + "cc", + "either", + "generic-array", + "getrandom 0.1.16", + "hashbrown 0.12.3", + "im", "lazy_static", "log", "memmap2", @@ -3632,8 +1796,8 @@ version = "1.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57892538250428ad3dc3cbe05f6cd75ad14f4f16734fcb91bc7cd5fbb63d6315" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "rustc_version", "syn 1.0.99", ] @@ -3649,79 +1813,6 @@ dependencies = [ "log", ] -[[package]] -name = "solana-measure" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7300180957635b33c88bd6844a5dff4f1f5c6352d0861ee7845eab84185aa6a" -dependencies = [ - "log", - "solana-sdk", -] - -[[package]] -name = "solana-metrics" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2960981c4bbe9177dafe986542ba11a10afcae320f4201aa809cd5b650e202e1" -dependencies = [ - "crossbeam-channel", - "gethostname", - "lazy_static", - "log", - "reqwest", - "solana-sdk", -] - -[[package]] -name = "solana-net-utils" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31062ce5ddceb92bdb78df2eaf33e9889c1519e8a8d89baa783e2d08a76cfc62" -dependencies = [ - "bincode", - "clap 3.2.25", - "crossbeam-channel", - "log", - "nix", - "rand 0.7.3", - "serde", - "serde_derive", - "socket2", - "solana-logger", - "solana-sdk", - "solana-version", - "tokio", - "url", -] - -[[package]] -name = "solana-perf" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b2b84a3d7a24523b9117c0ae4608f1e561ae492638acea2bb2960a0c0c8eb6" -dependencies = [ - "ahash", - "bincode", - "bv", - "caps", - "curve25519-dalek", - "dlopen", - "dlopen_derive", - "fnv", - "lazy_static", - "libc", - "log", - "nix", - "rand 0.7.3", - "rayon", - "serde", - "solana-metrics", - "solana-rayon-threadlimit", - "solana-sdk", - "solana-vote-program", -] - [[package]] name = "solana-program" version = "1.14.16" @@ -3730,7 +1821,7 @@ checksum = "3f99052873619df68913cb8e92e28ff251a5483828925e87fa97ba15a9cbad51" dependencies = [ "base64 0.13.0", "bincode", - "bitflags 1.3.2", + "bitflags", "blake3", "borsh", "borsh-derive", @@ -3752,8 +1843,8 @@ dependencies = [ "num-derive", "num-traits", "parking_lot", - "rand 0.7.3", - "rand_chacha 0.2.2", + "rand", + "rand_chacha", "rustc_version", "rustversion", "serde", @@ -3771,62 +1862,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "solana-program-runtime" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d57d0b6ef85b50f9ad6b9a75fc9d5051dc26f8b1a4ddf03656e3d603e139eb3" -dependencies = [ - "base64 0.13.0", - "bincode", - "eager", - "enum-iterator", - "itertools", - "libc", - "libloading", - "log", - "num-derive", - "num-traits", - "rand 0.7.3", - "rustc_version", - "serde", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-measure", - "solana-metrics", - "solana-sdk", - "thiserror", -] - -[[package]] -name = "solana-rayon-threadlimit" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10e1d068ba8080ca1e41703c600cc9b263ff7ce26b6811cd83221723ae0d10ae" -dependencies = [ - "lazy_static", - "num_cpus", -] - -[[package]] -name = "solana-remote-wallet" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "661cd486da7419134663f1c3684d71d3fd6d13b8e557da23070f4c920b1d2baa" -dependencies = [ - "console", - "dialoguer", - "log", - "num-derive", - "num-traits", - "parking_lot", - "qstring", - "semver", - "solana-sdk", - "thiserror", - "uriparse", -] - [[package]] name = "solana-sdk" version = "1.14.16" @@ -3836,7 +1871,7 @@ dependencies = [ "assert_matches", "base64 0.13.0", "bincode", - "bitflags 1.3.2", + "bitflags", "borsh", "bs58 0.4.0", "bytemuck", @@ -3858,8 +1893,8 @@ dependencies = [ "num-traits", "pbkdf2 0.11.0", "qstring", - "rand 0.7.3", - "rand_chacha 0.2.2", + "rand", + "rand_chacha", "rustc_version", "rustversion", "serde", @@ -3885,8 +1920,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d41a09b9cecd0a4df63c78a192adee99ebf2d3757c19713a68246e1d9789c7c" dependencies = [ "bs58 0.4.0", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "rustversion", "syn 1.0.99", ] @@ -3897,101 +1932,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" -[[package]] -name = "solana-streamer" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ffb2c6918eda6aa8b18219790b7a4e4d74914aeae97cb1a0e09fdb943b18cc" -dependencies = [ - "crossbeam-channel", - "futures-util", - "histogram", - "indexmap", - "itertools", - "libc", - "log", - "nix", - "pem", - "percentage", - "pkcs8", - "quinn", - "rand 0.7.3", - "rcgen", - "rustls 0.20.8", - "solana-metrics", - "solana-perf", - "solana-sdk", - "thiserror", - "tokio", - "x509-parser", -] - -[[package]] -name = "solana-transaction-status" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1a6ee396d436ae4ee36350043c3cb34ad66b7515f045c1e5006695559d88ac" -dependencies = [ - "Inflector", - "base64 0.13.0", - "bincode", - "borsh", - "bs58 0.4.0", - "lazy_static", - "log", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder", - "solana-address-lookup-table-program", - "solana-measure", - "solana-metrics", - "solana-sdk", - "solana-vote-program", - "spl-associated-token-account", - "spl-memo", - "spl-token", - "spl-token-2022 0.5.0", - "thiserror", -] - -[[package]] -name = "solana-version" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d177dc97f7facd8fbc3148f3d44a9ff5bbbc72c1db7e2889dc4911ae641cea8a" -dependencies = [ - "log", - "rustc_version", - "semver", - "serde", - "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk", -] - -[[package]] -name = "solana-vote-program" -version = "1.14.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6280815d28c90ea8f51c8eb2026258e8693cab5a8456ee7b207a791b20f9c576" -dependencies = [ - "bincode", - "log", - "num-derive", - "num-traits", - "rustc_version", - "serde", - "serde_derive", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-metrics", - "solana-program-runtime", - "solana-sdk", - "thiserror", -] - [[package]] name = "solana-zk-token-sdk" version = "1.14.16" @@ -4012,7 +1952,7 @@ dependencies = [ "merlin", "num-derive", "num-traits", - "rand 0.7.3", + "rand", "serde", "serde_json", "sha3 0.9.1", @@ -4023,22 +1963,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spki" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "spl-associated-token-account" version = "1.1.2" @@ -4093,458 +2017,160 @@ dependencies = [ ] [[package]] -name = "spl-token-2022" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edb869dbe159b018f17fb9bfa67118c30f232d7f54a73742bc96794dff77ed8" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "solana-zk-token-sdk", - "spl-memo", - "spl-token", - "thiserror", -] - -[[package]] -name = "spl-token-2022" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0043b590232c400bad5ee9eb983ced003d15163c4c5d56b090ac6d9a57457b47" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "solana-zk-token-sdk", - "spl-memo", - "spl-token", - "thiserror", -] - -[[package]] -name = "spot-instrument" -version = "0.1.0" -dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", - "rfq", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "superslice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" - -[[package]] -name = "switchboard-common" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a03303674fb73b1dbe6cfc83aa8faa0e99264472a47177a1803f7475b318d1" -dependencies = [ - "getrandom 0.2.10", - "hex", - "serde", - "serde_json", - "sgx-quote", - "sha2 0.10.7", -] - -[[package]] -name = "switchboard-solana" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e014b8b2896ab29db572e6768dff7d8f4dbfa3ca4d8b0e8b0dc5c6dd669cc786" -dependencies = [ - "anchor-client", - "anchor-lang 0.27.0", - "anchor-spl 0.27.0", - "bincode", - "bytemuck", - "chrono", - "cron", - "hex", - "rust_decimal", - "sgx-quote", - "solana-address-lookup-table-program", - "solana-client", - "solana-program", - "superslice", - "switchboard-common", - "tokio", -] - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", - "unicode-xid 0.2.4", -] - -[[package]] -name = "tempfile" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - -[[package]] -name = "thiserror" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" -dependencies = [ - "itoa", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" -dependencies = [ - "time-core", -] - -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" -dependencies = [ - "autocfg", - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" +name = "spl-token-2022" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "0edb869dbe159b018f17fb9bfa67118c30f232d7f54a73742bc96794dff77ed8" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token", + "thiserror", ] [[package]] -name = "tokio-rustls" -version = "0.23.4" +name = "spl-token-2022" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "0043b590232c400bad5ee9eb983ced003d15163c4c5d56b090ac6d9a57457b47" dependencies = [ - "rustls 0.20.8", - "tokio", - "webpki", + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token", + "thiserror", ] [[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +name = "spot-instrument" +version = "0.1.0" dependencies = [ - "rustls 0.21.5", - "tokio", + "anchor-lang", + "anchor-spl", + "rfq", ] [[package]] -name = "tokio-stream" -version = "0.1.14" +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "tokio-tungstenite" -version = "0.17.2" +name = "syn" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ - "futures-util", - "log", - "rustls 0.20.8", - "tokio", - "tokio-rustls 0.23.4", - "tungstenite", - "webpki", - "webpki-roots", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "tokio-util" -version = "0.7.8" +name = "synstructure" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", + "proc-macro2", + "quote", + "syn 1.0.99", + "unicode-xid", ] [[package]] -name = "toml" -version = "0.5.9" +name = "termcolor" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ - "serde", + "winapi-util", ] [[package]] -name = "tower-service" -version = "0.3.2" +name = "thiserror" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] [[package]] -name = "tracing" -version = "0.1.37" +name = "thiserror-impl" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", + "proc-macro2", + "quote", + "syn 1.0.99", ] [[package]] -name = "tracing-attributes" -version = "0.1.26" +name = "tiny-bip39" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.27", + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", ] [[package]] -name = "tracing-core" -version = "0.1.31" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "once_cell", + "tinyvec_macros", ] [[package]] -name = "try-lock" -version = "0.2.4" +name = "tinyvec_macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "tungstenite" -version = "0.17.3" +name = "toml" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ - "base64 0.13.0", - "byteorder", - "bytes", - "http", - "httparse", - "log", - "rand 0.8.5", - "rustls 0.20.8", - "sha-1", - "thiserror", - "url", - "utf-8", - "webpki", - "webpki-roots", + "serde", ] [[package]] @@ -4553,12 +2179,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-ident" version = "1.0.3" @@ -4580,18 +2200,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -4608,12 +2216,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "uriparse" version = "0.6.4" @@ -4624,66 +2226,28 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "url" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "vault-operator" version = "0.1.0" dependencies = [ - "anchor-lang 0.28.0", - "anchor-spl 0.28.0", + "anchor-lang", + "anchor-spl", "rfq", "spot-instrument", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4709,31 +2273,19 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ - "quote 1.0.31", + "quote", "wasm-bindgen-macro-support", ] @@ -4743,8 +2295,8 @@ version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -4766,25 +2318,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4816,76 +2349,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.1", -] - [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.1", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -4894,129 +2370,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "x509-parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" -dependencies = [ - "asn1-rs", - "base64 0.13.0", - "data-encoding", - "der-parser", - "lazy_static", - "nom 7.1.3", - "oid-registry", - "rusticata-macros", - "thiserror", - "time 0.3.23", -] - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "yasna" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" -dependencies = [ - "time 0.3.23", -] - [[package]] name = "zeroize" version = "1.3.0" @@ -5032,38 +2421,8 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2", + "quote", "syn 1.0.99", "synstructure", ] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" -dependencies = [ - "cc", - "libc", - "pkg-config", -] diff --git a/hxro-print-trade-provider/agnostic-orderbook/src/critbit.rs b/hxro-print-trade-provider/agnostic-orderbook/src/critbit.rs index d6e2b119..3c93fcb4 100644 --- a/hxro-print-trade-provider/agnostic-orderbook/src/critbit.rs +++ b/hxro-print-trade-provider/agnostic-orderbook/src/critbit.rs @@ -3,7 +3,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; use bytemuck::{Pod, Zeroable}; use num_derive::FromPrimitive; use solana_program::pubkey::Pubkey; -use std::cell::Ref; use std::{cell::RefCell, rc::Rc}; // A Slab contains the data for a slab header and an array of nodes of a critbit tree // whose leafs contain the data referencing an order of the orderbook. @@ -16,14 +15,6 @@ pub type NodeHandle = u32; #[doc(hidden)] pub type IoError = std::io::Error; -#[doc(hidden)] -#[derive(BorshDeserialize, BorshSerialize, Debug, PartialEq, Clone, Copy, Pod, Zeroable)] -#[repr(C)] -pub struct InnerNode { - prefix_len: u64, - key: u128, - pub children: [u32; 2], -} /// A critibit leaf node #[derive(Debug, PartialEq, PartialOrd, Clone, Copy, Pod, Zeroable)] @@ -72,25 +63,6 @@ pub(crate) enum NodeTag { LastFree, } -#[doc(hidden)] -#[derive(Clone, Debug, PartialEq)] -pub enum Node { - Uninitialized, - Inner(InnerNode), - Leaf(LeafNode), - Free(FreeNode), - LastFree(FreeNode), -} - -#[doc(hidden)] -pub enum NodeRef<'a> { - Uninitialized, - Inner(Ref<'a, InnerNode>), - Leaf(Ref<'a, LeafNode>), - Free(Ref<'a, FreeNode>), - LastFree(Ref<'a, FreeNode>), -} - //////////////////////////////////// // Slabs diff --git a/hxro-print-trade-provider/js/package.json b/hxro-print-trade-provider/js/package.json index 3c3fa47a..17e46f0b 100644 --- a/hxro-print-trade-provider/js/package.json +++ b/hxro-print-trade-provider/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/hxro-print-trade-provider", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/psyoptions-american-instrument/js/package.json b/psyoptions-american-instrument/js/package.json index 34d92723..324a96e9 100644 --- a/psyoptions-american-instrument/js/package.json +++ b/psyoptions-american-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/psyoptions-american-instrument", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/psyoptions-european-instrument/js/package.json b/psyoptions-european-instrument/js/package.json index 9a9d0698..3a2f4a9a 100644 --- a/psyoptions-european-instrument/js/package.json +++ b/psyoptions-european-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/psyoptions-european-instrument", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/rfq/js/package.json b/rfq/js/package.json index cb3cf21e..5909b54b 100644 --- a/rfq/js/package.json +++ b/rfq/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/rfq", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/rfq/program/src/instructions/rfq/add_legs_to_rfq.rs b/rfq/program/src/instructions/rfq/add_legs_to_rfq.rs index 3d0da840..1690590b 100644 --- a/rfq/program/src/instructions/rfq/add_legs_to_rfq.rs +++ b/rfq/program/src/instructions/rfq/add_legs_to_rfq.rs @@ -19,7 +19,7 @@ pub struct AddLegsToRfqAccounts<'info> { fn validate<'info>( ctx: &Context<'_, '_, '_, 'info, AddLegsToRfqAccounts<'info>>, - legs: &Vec, + legs: &[ApiLeg], ) -> Result<()> { let AddLegsToRfqAccounts { protocol, rfq, .. } = &ctx.accounts; let mut remaining_accounts = ctx.remaining_accounts.iter(); diff --git a/rfq/program/src/instructions/rfq/respond_to_rfq.rs b/rfq/program/src/instructions/rfq/respond_to_rfq.rs index 50445086..39c27cae 100644 --- a/rfq/program/src/instructions/rfq/respond_to_rfq.rs +++ b/rfq/program/src/instructions/rfq/respond_to_rfq.rs @@ -64,7 +64,7 @@ fn validate( bid: Option, ask: Option, expiration_timestamp: i64, - additional_data: &Vec, + additional_data: &[u8], ) -> Result<()> { let RespondToRfqAccounts { maker, diff --git a/rfq/program/src/lib.rs b/rfq/program/src/lib.rs index 48d86e50..f6e55a42 100644 --- a/rfq/program/src/lib.rs +++ b/rfq/program/src/lib.rs @@ -2,6 +2,7 @@ //! //! Provides an abstraction and implements the RFQ mechanism. #![allow(clippy::result_large_err)] +#![allow(clippy::too_many_arguments)] use anchor_lang::prelude::*; use solana_security_txt::security_txt; @@ -113,7 +114,6 @@ pub mod rfq { ) } - #[allow(clippy::too_many_arguments)] pub fn add_base_asset( ctx: Context, index: BaseAssetIndex, @@ -191,7 +191,6 @@ pub mod rfq { withdraw_collateral_instruction(ctx, amount) } - #[allow(clippy::too_many_arguments)] pub fn create_rfq<'info>( ctx: Context<'_, '_, '_, 'info, CreateRfqAccounts<'info>>, expected_legs_size: u16, diff --git a/rfq/program/src/state/response.rs b/rfq/program/src/state/response.rs index 8378a480..1cb544df 100644 --- a/rfq/program/src/state/response.rs +++ b/rfq/program/src/state/response.rs @@ -346,7 +346,7 @@ impl Response { .escrow_leg_preparations_initialized_by .get(leg_index as usize) .cloned(), - AssetIdentifier::Quote => self.escrow_leg_preparations_initialized_by.get(0).cloned(), + AssetIdentifier::Quote => self.escrow_leg_preparations_initialized_by.first().cloned(), } } } diff --git a/risk-engine/js/package.json b/risk-engine/js/package.json index 113da7e3..27be7ef1 100644 --- a/risk-engine/js/package.json +++ b/risk-engine/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/risk-engine", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/risk-engine/program/Cargo.toml b/risk-engine/program/Cargo.toml index 62648afe..810a93f7 100644 --- a/risk-engine/program/Cargo.toml +++ b/risk-engine/program/Cargo.toml @@ -15,10 +15,3 @@ no-entrypoint = [] anchor-lang = { version = "0.28.0", features = ["init-if-needed"] } anchor-spl = "0.28.0" rfq = { path = "../../rfq/program", features = ["no-entrypoint"] } -switchboard-solana = "0.27.0" -pyth-sdk-solana = "0.7.2" -borsh = { version = "0.9.1", features = ["const-generics"] } -bytemuck = { version = "1.4.0", features = ["derive", "min_const_generics"] } - -[dev-dependencies] -float-cmp = "0.9.0" diff --git a/risk-engine/program/src/base_asset_extractor.rs b/risk-engine/program/src/base_asset_extractor.rs deleted file mode 100644 index 1c03978b..00000000 --- a/risk-engine/program/src/base_asset_extractor.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::collections::HashSet; - -use crate::errors::Error; -use anchor_lang::prelude::*; -use rfq::state::{BaseAssetIndex, BaseAssetInfo, Leg}; - -pub fn extract_base_assets( - legs: &[Leg], - remaining_accounts: &mut &[AccountInfo], -) -> Result> { - let mut base_assets: HashSet = - legs.iter().map(|leg| leg.base_asset_index).collect(); - - let mut result = vec![]; - - for _ in 0..base_assets.len() { - let base_asset_info = extract_base_asset_info(remaining_accounts)?; - require!( - base_assets.contains(&base_asset_info.index), - Error::NotEnoughAccounts - ); - base_assets.remove(&base_asset_info.index); - result.push(base_asset_info); - } - - Ok(result) -} - -fn extract_base_asset_info(accounts: &mut &[AccountInfo]) -> Result { - require!(!accounts.is_empty(), Error::NotEnoughAccounts); - let account = &accounts[0]; - *accounts = &accounts[1..]; - let parsed_account = Account::::try_from(account)?; - Ok(parsed_account.into_inner()) -} diff --git a/risk-engine/program/src/black_scholes.rs b/risk-engine/program/src/black_scholes.rs deleted file mode 100644 index 9e033a99..00000000 --- a/risk-engine/program/src/black_scholes.rs +++ /dev/null @@ -1,632 +0,0 @@ -#![allow(clippy::excessive_precision)] - -use std::f64::consts::SQRT_2; - -use crate::state::OptionType; - -// call and put calculations taken from `black_scholes` crate up to erf calculations, which is taken from `statrs` crate - -const SECONDS_IN_THE_YEAR: f64 = 365.0 * 24.0 * 60.0 * 60.0; - -pub fn calculate_option_value( - option_type: OptionType, - underlying_price: f64, - underlying_amount_per_contract: f64, - strike_price: f64, - interest_rate: f64, - volatility: f64, - seconds_till_expiration: i64, -) -> f64 { - let maturity = seconds_till_expiration as f64 / SECONDS_IN_THE_YEAR; - - let value_per_underlying_asset = match option_type { - OptionType::Call => calculate_call( - underlying_price, - strike_price, - interest_rate, - volatility, - maturity, - ), - OptionType::Put => calculate_put( - underlying_price, - strike_price, - interest_rate, - volatility, - maturity, - ), - }; - - value_per_underlying_asset * underlying_amount_per_contract -} - -fn calculate_call( - underlying_price: f64, - strike_price: f64, - interest_rate: f64, - volatility: f64, - maturity: f64, -) -> f64 { - call_discount( - underlying_price, - strike_price, - (-interest_rate * maturity).exp(), - maturity.sqrt() * volatility, - ) -} - -fn calculate_put( - underlying_price: f64, - strike_price: f64, - interest_rate: f64, - volatility: f64, - maturity: f64, -) -> f64 { - put_discount( - underlying_price, - strike_price, - (-interest_rate * maturity).exp(), - maturity.sqrt() * volatility, - ) -} - -fn call_discount(s: f64, k: f64, discount: f64, sqrt_maturity_sigma: f64) -> f64 { - if sqrt_maturity_sigma > 0.0 { - let d1 = d1(s, k, discount, sqrt_maturity_sigma); - s * cum_norm(d1) - k * discount * cum_norm(d1 - sqrt_maturity_sigma) - } else { - max_or_zero(s - k) - } -} - -fn put_discount(s: f64, k: f64, discount: f64, sqrt_maturity_sigma: f64) -> f64 { - if sqrt_maturity_sigma > 0.0 { - let d1 = d1(s, k, discount, sqrt_maturity_sigma); - k * discount * cum_norm(sqrt_maturity_sigma - d1) - s * cum_norm(-d1) - } else { - max_or_zero(k - s) - } -} - -fn d1(s: f64, k: f64, discount: f64, sqrt_maturity_sigma: f64) -> f64 { - (s / (k * discount)).ln() / sqrt_maturity_sigma + 0.5 * sqrt_maturity_sigma -} - -fn cum_norm(x: f64) -> f64 { - erf(x / SQRT_2) * 0.5 + 0.5 -} - -fn max_or_zero(v: f64) -> f64 { - if v > 0.0 { - v - } else { - 0.0 - } -} - -pub fn erf(x: f64) -> f64 { - if x.is_nan() { - f64::NAN - } else if x >= 0.0 && x.is_infinite() { - 1.0 - } else if x <= 0.0 && x.is_infinite() { - -1.0 - } else if x == 0.0 { - 0.0 - } else { - erf_impl(x, false) - } -} - -// ********************************************************** -// ********** Coefficients for erf_impl polynomial ********** -// ********************************************************** - -/// Polynomial coefficients for a numerator of `erf_impl` -/// in the interval [1e-10, 0.5]. -const ERF_IMPL_AN: &[f64] = &[ - 0.00337916709551257388990745, - -0.00073695653048167948530905, - -0.374732337392919607868241, - 0.0817442448733587196071743, - -0.0421089319936548595203468, - 0.0070165709512095756344528, - -0.00495091255982435110337458, - 0.000871646599037922480317225, -]; - -/// Polynomial coefficients for a denominator of `erf_impl` -/// in the interval [1e-10, 0.5] -const ERF_IMPL_AD: &[f64] = &[ - 1.0, - -0.218088218087924645390535, - 0.412542972725442099083918, - -0.0841891147873106755410271, - 0.0655338856400241519690695, - -0.0120019604454941768171266, - 0.00408165558926174048329689, - -0.000615900721557769691924509, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [0.5, 0.75]. -const ERF_IMPL_BN: &[f64] = &[ - -0.0361790390718262471360258, - 0.292251883444882683221149, - 0.281447041797604512774415, - 0.125610208862766947294894, - 0.0274135028268930549240776, - 0.00250839672168065762786937, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [0.5, 0.75]. -const ERF_IMPL_BD: &[f64] = &[ - 1.0, - 1.8545005897903486499845, - 1.43575803037831418074962, - 0.582827658753036572454135, - 0.124810476932949746447682, - 0.0113724176546353285778481, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [0.75, 1.25]. -const ERF_IMPL_CN: &[f64] = &[ - -0.0397876892611136856954425, - 0.153165212467878293257683, - 0.191260295600936245503129, - 0.10276327061989304213645, - 0.029637090615738836726027, - 0.0046093486780275489468812, - 0.000307607820348680180548455, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [0.75, 1.25]. -const ERF_IMPL_CD: &[f64] = &[ - 1.0, - 1.95520072987627704987886, - 1.64762317199384860109595, - 0.768238607022126250082483, - 0.209793185936509782784315, - 0.0319569316899913392596356, - 0.00213363160895785378615014, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [1.25, 2.25]. -const ERF_IMPL_DN: &[f64] = &[ - -0.0300838560557949717328341, - 0.0538578829844454508530552, - 0.0726211541651914182692959, - 0.0367628469888049348429018, - 0.00964629015572527529605267, - 0.00133453480075291076745275, - 0.778087599782504251917881e-4, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [1.25, 2.25]. -const ERF_IMPL_DD: &[f64] = &[ - 1.0, - 1.75967098147167528287343, - 1.32883571437961120556307, - 0.552528596508757581287907, - 0.133793056941332861912279, - 0.0179509645176280768640766, - 0.00104712440019937356634038, - -0.106640381820357337177643e-7, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [2.25, 3.5]. -const ERF_IMPL_EN: &[f64] = &[ - -0.0117907570137227847827732, - 0.014262132090538809896674, - 0.0202234435902960820020765, - 0.00930668299990432009042239, - 0.00213357802422065994322516, - 0.00025022987386460102395382, - 0.120534912219588189822126e-4, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [2.25, 3.5]. -const ERF_IMPL_ED: &[f64] = &[ - 1.0, - 1.50376225203620482047419, - 0.965397786204462896346934, - 0.339265230476796681555511, - 0.0689740649541569716897427, - 0.00771060262491768307365526, - 0.000371421101531069302990367, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [3.5, 5.25]. -const ERF_IMPL_FN: &[f64] = &[ - -0.00546954795538729307482955, - 0.00404190278731707110245394, - 0.0054963369553161170521356, - 0.00212616472603945399437862, - 0.000394984014495083900689956, - 0.365565477064442377259271e-4, - 0.135485897109932323253786e-5, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [3.5, 5.25]. -const ERF_IMPL_FD: &[f64] = &[ - 1.0, - 1.21019697773630784832251, - 0.620914668221143886601045, - 0.173038430661142762569515, - 0.0276550813773432047594539, - 0.00240625974424309709745382, - 0.891811817251336577241006e-4, - -0.465528836283382684461025e-11, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [5.25, 8]. -const ERF_IMPL_GN: &[f64] = &[ - -0.00270722535905778347999196, - 0.0013187563425029400461378, - 0.00119925933261002333923989, - 0.00027849619811344664248235, - 0.267822988218331849989363e-4, - 0.923043672315028197865066e-6, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [5.25, 8]. -const ERF_IMPL_GD: &[f64] = &[ - 1.0, - 0.814632808543141591118279, - 0.268901665856299542168425, - 0.0449877216103041118694989, - 0.00381759663320248459168994, - 0.000131571897888596914350697, - 0.404815359675764138445257e-11, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [8, 11.5]. -const ERF_IMPL_HN: &[f64] = &[ - -0.00109946720691742196814323, - 0.000406425442750422675169153, - 0.000274499489416900707787024, - 0.465293770646659383436343e-4, - 0.320955425395767463401993e-5, - 0.778286018145020892261936e-7, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [8, 11.5]. -const ERF_IMPL_HD: &[f64] = &[ - 1.0, - 0.588173710611846046373373, - 0.139363331289409746077541, - 0.0166329340417083678763028, - 0.00100023921310234908642639, - 0.24254837521587225125068e-4, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [11.5, 17]. -const ERF_IMPL_IN: &[f64] = &[ - -0.00056907993601094962855594, - 0.000169498540373762264416984, - 0.518472354581100890120501e-4, - 0.382819312231928859704678e-5, - 0.824989931281894431781794e-7, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [11.5, 17]. -const ERF_IMPL_ID: &[f64] = &[ - 1.0, - 0.339637250051139347430323, - 0.043472647870310663055044, - 0.00248549335224637114641629, - 0.535633305337152900549536e-4, - -0.117490944405459578783846e-12, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [17, 24]. -const ERF_IMPL_JN: &[f64] = &[ - -0.000241313599483991337479091, - 0.574224975202501512365975e-4, - 0.115998962927383778460557e-4, - 0.581762134402593739370875e-6, - 0.853971555085673614607418e-8, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [17, 24]. -const ERF_IMPL_JD: &[f64] = &[ - 1.0, - 0.233044138299687841018015, - 0.0204186940546440312625597, - 0.000797185647564398289151125, - 0.117019281670172327758019e-4, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [24, 38]. -const ERF_IMPL_KN: &[f64] = &[ - -0.000146674699277760365803642, - 0.162666552112280519955647e-4, - 0.269116248509165239294897e-5, - 0.979584479468091935086972e-7, - 0.101994647625723465722285e-8, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [24, 38]. -const ERF_IMPL_KD: &[f64] = &[ - 1.0, - 0.165907812944847226546036, - 0.0103361716191505884359634, - 0.000286593026373868366935721, - 0.298401570840900340874568e-5, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [38, 60]. -const ERF_IMPL_LN: &[f64] = &[ - -0.583905797629771786720406e-4, - 0.412510325105496173512992e-5, - 0.431790922420250949096906e-6, - 0.993365155590013193345569e-8, - 0.653480510020104699270084e-10, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [38, 60]. -const ERF_IMPL_LD: &[f64] = &[ - 1.0, - 0.105077086072039915406159, - 0.00414278428675475620830226, - 0.726338754644523769144108e-4, - 0.477818471047398785369849e-6, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [60, 85]. -const ERF_IMPL_MN: &[f64] = &[ - -0.196457797609229579459841e-4, - 0.157243887666800692441195e-5, - 0.543902511192700878690335e-7, - 0.317472492369117710852685e-9, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [60, 85]. -const ERF_IMPL_MD: &[f64] = &[ - 1.0, - 0.052803989240957632204885, - 0.000926876069151753290378112, - 0.541011723226630257077328e-5, - 0.535093845803642394908747e-15, -]; - -/// Polynomial coefficients for a numerator in `erf_impl` -/// in the interval [85, 110]. -const ERF_IMPL_NN: &[f64] = &[ - -0.789224703978722689089794e-5, - 0.622088451660986955124162e-6, - 0.145728445676882396797184e-7, - 0.603715505542715364529243e-10, -]; - -/// Polynomial coefficients for a denominator in `erf_impl` -/// in the interval [85, 110]. -const ERF_IMPL_ND: &[f64] = &[ - 1.0, - 0.0375328846356293715248719, - 0.000467919535974625308126054, - 0.193847039275845656900547e-5, -]; - -/// `erf_impl` computes the error function at `z`. -/// If `inv` is true, `1 - erf` is calculated as opposed to `erf` -fn erf_impl(z: f64, inv: bool) -> f64 { - if z < 0.0 { - if !inv { - return -erf_impl(-z, false); - } - if z < -0.5 { - return 2.0 - erf_impl(-z, true); - } - return 1.0 + erf_impl(-z, false); - } - - let result = if z < 0.5 { - if z < 1e-10 { - z * 1.125 + z * 0.003379167095512573896158903121545171688 - } else { - z * 1.125 + z * polynomial(z, ERF_IMPL_AN) / polynomial(z, ERF_IMPL_AD) - } - } else if z < 110.0 { - let (r, b) = if z < 0.75 { - ( - polynomial(z - 0.5, ERF_IMPL_BN) / polynomial(z - 0.5, ERF_IMPL_BD), - 0.3440242112, - ) - } else if z < 1.25 { - ( - polynomial(z - 0.75, ERF_IMPL_CN) / polynomial(z - 0.75, ERF_IMPL_CD), - 0.419990927, - ) - } else if z < 2.25 { - ( - polynomial(z - 1.25, ERF_IMPL_DN) / polynomial(z - 1.25, ERF_IMPL_DD), - 0.4898625016, - ) - } else if z < 3.5 { - ( - polynomial(z - 2.25, ERF_IMPL_EN) / polynomial(z - 2.25, ERF_IMPL_ED), - 0.5317370892, - ) - } else if z < 5.25 { - ( - polynomial(z - 3.5, ERF_IMPL_FN) / polynomial(z - 3.5, ERF_IMPL_FD), - 0.5489973426, - ) - } else if z < 8.0 { - ( - polynomial(z - 5.25, ERF_IMPL_GN) / polynomial(z - 5.25, ERF_IMPL_GD), - 0.5571740866, - ) - } else if z < 11.5 { - ( - polynomial(z - 8.0, ERF_IMPL_HN) / polynomial(z - 8.0, ERF_IMPL_HD), - 0.5609807968, - ) - } else if z < 17.0 { - ( - polynomial(z - 11.5, ERF_IMPL_IN) / polynomial(z - 11.5, ERF_IMPL_ID), - 0.5626493692, - ) - } else if z < 24.0 { - ( - polynomial(z - 17.0, ERF_IMPL_JN) / polynomial(z - 17.0, ERF_IMPL_JD), - 0.5634598136, - ) - } else if z < 38.0 { - ( - polynomial(z - 24.0, ERF_IMPL_KN) / polynomial(z - 24.0, ERF_IMPL_KD), - 0.5638477802, - ) - } else if z < 60.0 { - ( - polynomial(z - 38.0, ERF_IMPL_LN) / polynomial(z - 38.0, ERF_IMPL_LD), - 0.5640528202, - ) - } else if z < 85.0 { - ( - polynomial(z - 60.0, ERF_IMPL_MN) / polynomial(z - 60.0, ERF_IMPL_MD), - 0.5641309023, - ) - } else { - ( - polynomial(z - 85.0, ERF_IMPL_NN) / polynomial(z - 85.0, ERF_IMPL_ND), - 0.5641584396, - ) - }; - let g = (-z * z).exp() / z; - g * b + g * r - } else { - 0.0 - }; - - if inv && z >= 0.5 { - result - } else if z >= 0.5 || inv { - 1.0 - result - } else { - result - } -} - -pub fn polynomial(z: f64, coeff: &[f64]) -> f64 { - let n = coeff.len(); - if n == 0 { - return 0.0; - } - - let mut sum = *coeff.last().unwrap(); - for c in coeff[0..n - 1].iter().rev() { - sum = *c + z * sum; - } - sum -} - -#[cfg(test)] -mod tests { - use super::{calculate_call, calculate_put}; - use float_cmp::assert_approx_eq; - - fn test_call_and_put( - underlying_price: f64, - strike_price: f64, - interest_rate: f64, - volatility: f64, - maturity: f64, - expected_call: f64, - expected_put: f64, - ) { - let call_price = calculate_call( - underlying_price, - strike_price, - interest_rate, - volatility, - maturity, - ); - assert_approx_eq!(f64, call_price, expected_call, epsilon = 0.0001); - let put_price = calculate_put( - underlying_price, - strike_price, - interest_rate, - volatility, - maturity, - ); - assert_approx_eq!(f64, put_price, expected_put, epsilon = 0.0001); - } - - #[test] - fn test_with_long_expiration_and_no_interest() { - test_call_and_put(22000.0, 20000.0, 0.0, 0.3, 1.0, 3628.2024, 1628.2024); - } - - #[test] - fn test_with_short_expiration_and_no_interest() { - test_call_and_put( - 22000.0, - 20000.0, - 0.0, - 0.3, - 30.0 / 365.0, - 2121.7379, - 121.7379, - ); - } - - #[test] - fn test_with_interest() { - test_call_and_put( - 20000.0, - 25000.0, - 0.05, - 0.5, - 30.0 / 365.0, - 87.7541, - 4985.2252, - ); - } - - #[test] - fn test_with_much_lower_price() { - test_call_and_put(30.0, 1000.0, 0.05, 1.0, 60.0 / 365.0, 0.0, 961.8145); - } - - #[test] - fn test_with_much_higher_price() { - test_call_and_put(2000.0, 50.0, 0.05, 1.0, 60.0 / 365.0, 1950.4093, 0.0); - } - - #[test] - fn test_with_high_volatility() { - test_call_and_put( - 20000.0, - 22000.0, - 0.05, - 10.0, - 60.0 / 365.0, - 19109.3831, - 20929.3022, - ); - } -} diff --git a/risk-engine/program/src/errors.rs b/risk-engine/program/src/errors.rs index d2a125a5..9f68f0cd 100644 --- a/risk-engine/program/src/errors.rs +++ b/risk-engine/program/src/errors.rs @@ -2,30 +2,6 @@ use anchor_lang::prelude::*; #[error_code] pub enum Error { - #[msg("Overflow occured during calculations")] - MathOverflow, - #[msg("Can't convert value because it causes an overflow")] - MathInvalidConversion, - #[msg("Not enough accounts for collateral calculations")] - NotEnoughAccounts, - #[msg("Can't extract price because an oracle is stale")] - StaleOracle, - #[msg("Invalid oracle data")] - InvalidOracleData, - #[msg("Can't extract price because oracle confidence is out of bounds")] - OracleConfidenceOutOfRange, - #[msg("Base asset info account mismatch with rfq legs")] - InvalidBaseAssetInfo, - #[msg("Oracle account mismatch with rfq legs")] - InvalidOracle, - #[msg("Price for a base asset is missing")] - MissingPriceForABaseAsset, - #[msg("Require protocol authority")] - NotAProtocolAuthority, - #[msg("Instrument is not added to the risk engine")] - MissingInstrument, - #[msg("Missing instrument index")] - MissingInstrumentIndex, #[msg("Failed to extract instrument type")] FailedToExtractInstrumentType, } diff --git a/risk-engine/program/src/lib.rs b/risk-engine/program/src/lib.rs index 58488e07..c3b23bca 100644 --- a/risk-engine/program/src/lib.rs +++ b/risk-engine/program/src/lib.rs @@ -1,25 +1,9 @@ #![allow(clippy::result_large_err)] use anchor_lang::prelude::*; -use rfq::state::{ - AuthoritySide, FixedSize, Leg, OrderType, ProtocolState, Quote, QuoteSide, Response, Rfq, - SettlementTypeMetadata, -}; +use rfq::state::{Response, Rfq}; -use base_asset_extractor::extract_base_assets; -use errors::Error; -use price_extractor::extract_prices; -use risk_calculator::{CalculationCase, RiskCalculator}; -use scenarios::ScenarioSelector; -use state::{Config, InstrumentType, RiskCategoryInfo}; -use utils::{convert_fixed_point_to_f64, get_leg_amount_f64}; - -pub mod base_asset_extractor; -pub mod black_scholes; pub mod errors; -pub mod price_extractor; -pub mod risk_calculator; -pub mod scenarios; pub mod state; pub mod utils; @@ -31,400 +15,38 @@ pub const CONFIG_SEED: &str = "config"; pub mod risk_engine { use super::*; - #[allow(clippy::too_many_arguments)] - pub fn initialize_config( - ctx: Context, - min_collateral_requirement: u64, - collateral_for_fixed_quote_amount_rfq_creation: u64, - collateral_mint_decimals: u8, - safety_price_shift_factor: f64, - overall_safety_factor: f64, - accepted_oracle_staleness: u64, - accepted_oracle_confidence_interval_portion: f64, - ) -> Result<()> { - let mut config = ctx.accounts.config.load_init()?; - - config.min_collateral_requirement = min_collateral_requirement; - config.collateral_for_fixed_quote_amount_rfq_creation = - collateral_for_fixed_quote_amount_rfq_creation; - config.collateral_mint_decimals = collateral_mint_decimals as u64; - config.safety_price_shift_factor = safety_price_shift_factor; - config.overall_safety_factor = overall_safety_factor; - config.accepted_oracle_staleness = accepted_oracle_staleness; - config.accepted_oracle_confidence_interval_portion = - accepted_oracle_confidence_interval_portion; - - Ok(()) - } - - pub fn close_config(_ctx: Context) -> Result<()> { - Ok(()) - } - - // used only for passing data in the set_risk_category_info instruction - #[derive(AnchorSerialize, AnchorDeserialize)] - pub struct RiskCategoryChange { - risk_category_index: u8, - new_value: RiskCategoryInfo, - } - - // risk categories size is too large to fully fit in one transaction, so this instruction is used to set them partially - pub fn set_risk_categories_info( - ctx: Context, - changes: Vec, - ) -> Result<()> { - let mut config = ctx.accounts.config.load_mut()?; - - for change in changes.into_iter() { - config.risk_categories_info[change.risk_category_index as usize] = change.new_value; - } - - Ok(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn update_config( - ctx: Context, - min_collateral_requirement: Option, - collateral_for_fixed_quote_amount_rfq_creation: Option, - collateral_mint_decimals: Option, - safety_price_shift_factor: Option, - overall_safety_factor: Option, - accepted_oracle_staleness: Option, - accepted_oracle_confidence_interval_portion: Option, - ) -> Result<()> { - let mut config = ctx.accounts.config.load_mut()?; - - if let Some(value) = min_collateral_requirement { - config.min_collateral_requirement = value; - } - - if let Some(value) = collateral_for_fixed_quote_amount_rfq_creation { - config.collateral_for_fixed_quote_amount_rfq_creation = value; - } - - if let Some(value) = collateral_mint_decimals { - config.collateral_mint_decimals = value as u64; - } - - if let Some(value) = safety_price_shift_factor { - config.safety_price_shift_factor = value; - } - - if let Some(value) = overall_safety_factor { - config.overall_safety_factor = value; - } - - if let Some(value) = accepted_oracle_staleness { - config.accepted_oracle_staleness = value; - } - - if let Some(value) = accepted_oracle_confidence_interval_portion { - config.accepted_oracle_confidence_interval_portion = value; - } - - Ok(()) - } - - pub fn set_instrument_type( - ctx: Context, - instrument_index: u8, - instrument_type: InstrumentType, - ) -> Result<()> { - let SetInstrumentTypeAccounts { - protocol, config, .. - } = ctx.accounts; - let mut config = config.load_mut()?; - - require!( - (instrument_index as usize) < protocol.instruments.len(), - Error::MissingInstrumentIndex - ); - - config.instrument_types[instrument_index as usize] = instrument_type.into(); - - Ok(()) - } - pub fn calculate_collateral_for_rfq( - mut ctx: Context, + _ctx: Context, ) -> Result { - let CalculateRequiredCollateralForRfq { rfq, config } = &ctx.accounts; - let config = config.load()?; - - let required_collateral = match rfq.fixed_size { - FixedSize::None { padding: _ } => config.min_collateral_requirement, - FixedSize::BaseAsset { - legs_multiplier_bps, - } => { - let risk_calculator = construct_risk_calculator( - &ctx.accounts.rfq, - &config, - &mut ctx.remaining_accounts, - )?; - let leg_multiplier = convert_fixed_point_to_f64( - legs_multiplier_bps, - Quote::LEG_MULTIPLIER_DECIMALS as u8, - ); - - let side_to_case = |side| CalculationCase { - leg_multiplier, - authority_side: AuthoritySide::Taker, - quote_side: side, - }; - - match rfq.order_type { - OrderType::Buy => { - risk_calculator.calculate_risk(side_to_case(QuoteSide::Ask))? - } - OrderType::Sell => { - risk_calculator.calculate_risk(side_to_case(QuoteSide::Bid))? - } - OrderType::TwoWay => risk_calculator - .calculate_risk_for_several_cases([ - side_to_case(QuoteSide::Bid), - side_to_case(QuoteSide::Ask), - ])? - .into_iter() - .max() - .unwrap(), - } - } - FixedSize::QuoteAsset { quote_amount: _ } => { - config.collateral_for_fixed_quote_amount_rfq_creation - } - }; - - msg!( - "Required collateral: {} with {} decimals", - required_collateral, - config.collateral_mint_decimals - ); - - Ok(required_collateral) + Ok(0) } pub fn calculate_collateral_for_response( - mut ctx: Context, + _ctx: Context, ) -> Result { - let CalculateRequiredCollateralForResponse { - rfq, - response, - config, - } = ctx.accounts; - let config = config.load()?; - - let risk_calculator = construct_risk_calculator(rfq, &config, &mut ctx.remaining_accounts)?; - - let get_case = |quote, side| { - let legs_multiplier_bps = response.calculate_legs_multiplier_bps_for_quote(rfq, quote); - let leg_multiplier = convert_fixed_point_to_f64( - legs_multiplier_bps, - Quote::LEG_MULTIPLIER_DECIMALS as u8, - ); - CalculationCase { - leg_multiplier, - authority_side: AuthoritySide::Maker, - quote_side: side, - } - }; - - let collateral = match (response.bid, response.ask) { - (Some(bid_quote), Some(ask_quote)) => risk_calculator - .calculate_risk_for_several_cases([ - get_case(bid_quote, QuoteSide::Bid), - get_case(ask_quote, QuoteSide::Ask), - ])? - .into_iter() - .max() - .unwrap(), - (Some(quote), None) => { - risk_calculator.calculate_risk(get_case(quote, QuoteSide::Bid))? - } - (None, Some(quote)) => { - risk_calculator.calculate_risk(get_case(quote, QuoteSide::Ask))? - } - _ => unreachable!(), - }; - - msg!( - "Required collateral: {} with {} decimals", - collateral, - config.collateral_mint_decimals - ); - - Ok(collateral) + Ok(0) } pub fn calculate_collateral_for_confirmation( - mut ctx: Context, + _ctx: Context, ) -> Result<(u64, u64)> { - let CalculateRequiredCollateralForConfirmation { - rfq, - response, - config, - } = ctx.accounts; - let config = config.load()?; - - let risk_calculator = construct_risk_calculator(rfq, &config, &mut ctx.remaining_accounts)?; - - let legs_multiplier_bps = response.calculate_confirmed_legs_multiplier_bps(rfq); - let leg_multiplier = - convert_fixed_point_to_f64(legs_multiplier_bps, Quote::LEG_MULTIPLIER_DECIMALS as u8); - let confirmed_side = response.confirmed.unwrap().side; - - let side_to_case = |side| CalculationCase { - leg_multiplier, - authority_side: side, - quote_side: confirmed_side, - }; - - let [taker_collateral, maker_collateral] = risk_calculator - .calculate_risk_for_several_cases([ - side_to_case(AuthoritySide::Taker), - side_to_case(AuthoritySide::Maker), - ])?; - msg!( - "Required collateral, taker: {}, maker: {}. With {} decimals", - taker_collateral, - maker_collateral, - config.collateral_mint_decimals - ); - - Ok((taker_collateral, maker_collateral)) + Ok((0, 0)) } } -#[derive(Clone)] -pub struct LegWithMetadata<'a> { - leg: &'a Leg, - leg_amount_fraction: f64, - instrument_type: InstrumentType, -} - -fn construct_risk_calculator<'a>( - rfq: &'a Rfq, - config: &'a Config, - remaining_accounts: &mut &[AccountInfo], -) -> Result> { - let base_assets = extract_base_assets(&rfq.legs, remaining_accounts)?; - let prices = extract_prices(&base_assets, remaining_accounts, config)?; - - let current_timestamp = Clock::get()?.unix_timestamp; - let scenarios_selector = ScenarioSelector { - config, - settlement_period: rfq.settling_window, - }; - let legs_with_meta = rfq - .legs - .iter() - .map(|leg| -> Result { - let instrument_type = match leg.settlement_type_metadata { - SettlementTypeMetadata::Instrument { instrument_index } => { - config.instrument_types[instrument_index as usize].try_into()? - } - SettlementTypeMetadata::PrintTrade { instrument_type } => { - instrument_type.try_into()? - } - }; - - Ok(LegWithMetadata { - leg, - leg_amount_fraction: get_leg_amount_f64(leg), - instrument_type, - }) - }) - .collect::>>()?; - - Ok(RiskCalculator { - legs_with_meta, - config, - base_assets, - prices, - scenarios_selector: Box::new(move |legs, risk_category| { - scenarios_selector.select_scenarious(legs, risk_category) - }), - current_timestamp, - }) -} - -#[derive(Accounts)] -pub struct InitializeConfigAccounts<'info> { - #[account(mut, constraint = protocol.authority == authority.key() @ Error::NotAProtocolAuthority)] - pub authority: Signer<'info>, - pub protocol: Box>, - #[account( - init, - payer = authority, - seeds = [CONFIG_SEED.as_bytes()], - space = Config::get_allocated_size(), - bump - )] - pub config: AccountLoader<'info, Config>, - - pub system_program: Program<'info, System>, -} - -#[derive(Accounts)] -pub struct CloseConfigAccounts<'info> { - #[account(mut, constraint = protocol.authority == authority.key() @ Error::NotAProtocolAuthority)] - pub authority: Signer<'info>, - pub protocol: Box>, - #[account( - mut, - close = authority, - seeds = [CONFIG_SEED.as_bytes()], - bump - )] - pub config: AccountLoader<'info, Config>, -} - -#[derive(Accounts)] -pub struct SetRiskCategoryInfo<'info> { - #[account(constraint = protocol.authority == authority.key() @ Error::NotAProtocolAuthority)] - pub authority: Signer<'info>, - pub protocol: Box>, - #[account(mut, seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, -} - -#[derive(Accounts)] -pub struct UpdateConfigAccounts<'info> { - #[account(constraint = protocol.authority == authority.key() @ Error::NotAProtocolAuthority)] - pub authority: Signer<'info>, - pub protocol: Box>, - #[account(mut, seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, -} - -#[derive(Accounts)] -pub struct SetInstrumentTypeAccounts<'info> { - #[account(constraint = protocol.authority == authority.key() @ Error::NotAProtocolAuthority)] - pub authority: Signer<'info>, - pub protocol: Box>, - #[account(mut, seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, -} - #[derive(Accounts)] pub struct CalculateRequiredCollateralForRfq<'info> { pub rfq: Box>, - #[account(seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, } #[derive(Accounts)] pub struct CalculateRequiredCollateralForResponse<'info> { pub rfq: Box>, pub response: Account<'info, Response>, - #[account(seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, } #[derive(Accounts)] pub struct CalculateRequiredCollateralForConfirmation<'info> { pub rfq: Box>, pub response: Account<'info, Response>, - #[account(seeds = [CONFIG_SEED.as_bytes()], bump)] - pub config: AccountLoader<'info, Config>, } diff --git a/risk-engine/program/src/price_extractor.rs b/risk-engine/program/src/price_extractor.rs deleted file mode 100644 index e51a9fab..00000000 --- a/risk-engine/program/src/price_extractor.rs +++ /dev/null @@ -1,150 +0,0 @@ -use std::{cell::Ref, collections::HashMap}; - -use anchor_lang::prelude::*; -use pyth_sdk_solana::{load_price_feed_from_account_info, Price, PriceFeed}; -use rfq::state::{BaseAssetIndex, BaseAssetInfo, OracleSource}; -use switchboard_solana::{AggregatorAccountData, SwitchboardDecimal, SWITCHBOARD_PROGRAM_ID}; - -use crate::{errors::Error, state::Config, utils::convert_fixed_point_to_f64}; - -pub fn extract_prices( - base_assets: &Vec, - accounts: &mut &[AccountInfo], - config: &Config, -) -> Result> { - let mut result = HashMap::default(); - - extract_in_place_prices(base_assets, &mut result); - extract_oracle_prices(base_assets, accounts, config, &mut result)?; - - Ok(result) -} - -fn extract_in_place_prices( - base_assets: &[BaseAssetInfo], - result: &mut HashMap, -) { - for in_place_base_asset in base_assets - .iter() - .filter(|x| matches!(x.oracle_source, OracleSource::InPlace)) - { - let price = in_place_base_asset.get_in_place_price().unwrap(); - result.insert(in_place_base_asset.index, price); - } -} - -fn extract_oracle_prices( - base_assets: &Vec, - accounts: &mut &[AccountInfo], - config: &Config, - result: &mut HashMap, -) -> Result<()> { - // extract oracles while we won't have price for each base asset - while result.len() < base_assets.len() { - require!(!accounts.is_empty(), Error::NotEnoughAccounts); - let account = &accounts[0]; - *accounts = &accounts[1..]; - - // multiple base assets could reference the same oracle - let mut matched_assets = base_assets - .iter() - .filter(|x| does_oracle_match(x, account.key())); - - let first_matched_asset = matched_assets - .next() - .ok_or_else(|| error!(Error::InvalidOracle))?; - let price = extract_oracle_price(first_matched_asset.oracle_source, account, config)?; - result.insert(first_matched_asset.index, price); - - for base_asset in matched_assets { - result.insert(base_asset.index, price); - } - } - - Ok(()) -} - -fn does_oracle_match(base_asset: &BaseAssetInfo, address: Pubkey) -> bool { - match base_asset.oracle_source { - OracleSource::Switchboard => base_asset.get_switchboard_oracle() == Some(address), - OracleSource::Pyth => base_asset.get_pyth_oracle() == Some(address), - OracleSource::InPlace => false, - } -} - -fn extract_oracle_price( - oracle_source: OracleSource, - account: &AccountInfo, - config: &Config, -) -> Result { - match oracle_source { - OracleSource::Switchboard => extract_switchboard_price(account, config), - OracleSource::Pyth => extract_pyth_price(account, config), - OracleSource::InPlace => unreachable!(), - } -} - -// some of the code in this method is copied from AggregatorAccountData::new() as it has incompatible lifetime requirements -fn extract_switchboard_price(account: &AccountInfo, config: &Config) -> Result { - use switchboard_solana::prelude::Discriminator; - let owner = *account.owner; - if owner != SWITCHBOARD_PROGRAM_ID { - return Err(ProgramError::IncorrectProgramId.into()); - } - - let data = account.try_borrow_data()?; - if data.len() < AggregatorAccountData::discriminator().len() { - return Err(ErrorCode::AccountDiscriminatorNotFound.into()); - } - - let mut disc_bytes = [0u8; 8]; - disc_bytes.copy_from_slice(&data[..8]); - if disc_bytes != AggregatorAccountData::discriminator() { - return Err(ErrorCode::AccountDiscriminatorMismatch.into()); - } - - let feed: Ref = Ref::map(data, |data| { - bytemuck::from_bytes(&data[8..std::mem::size_of::() + 8]) - }); - feed.check_staleness( - Clock::get()?.unix_timestamp, - config.accepted_oracle_staleness as i64, - ) - .map_err(|_| error!(Error::StaleOracle))?; - - let price = feed - .get_result() - .map_err(|_| error!(Error::InvalidOracleData))? - .try_into() - .map_err(|_| error!(Error::InvalidOracleData))?; - - let confidence_interval = price * config.accepted_oracle_confidence_interval_portion; - feed.check_confidence_interval(SwitchboardDecimal::from_f64(confidence_interval)) - .map_err(|_| error!(Error::OracleConfidenceOutOfRange))?; - - Ok(price) -} - -fn extract_pyth_price(account: &AccountInfo, config: &Config) -> Result { - let price_feed: PriceFeed = - load_price_feed_from_account_info(account).map_err(|_| error!(Error::InvalidOracle))?; - let current_timestamp = Clock::get()?.unix_timestamp; - let current_data: Price = price_feed - .get_price_no_older_than(current_timestamp, config.accepted_oracle_staleness) - .ok_or_else(|| error!(Error::StaleOracle))?; - let decimals = - u8::try_from(-current_data.expo).map_err(|_| error!(Error::InvalidOracleData))?; - let price = convert_fixed_point_to_f64( - u64::try_from(current_data.price).map_err(|_| error!(Error::InvalidOracleData))?, - decimals, - ); - - let confidence = convert_fixed_point_to_f64(current_data.conf, decimals); - let confidence_interval = price * config.accepted_oracle_confidence_interval_portion; - require!( - confidence <= confidence_interval, - Error::OracleConfidenceOutOfRange - ); - - Ok(price) -} diff --git a/risk-engine/program/src/risk_calculator.rs b/risk-engine/program/src/risk_calculator.rs deleted file mode 100644 index 86f53907..00000000 --- a/risk-engine/program/src/risk_calculator.rs +++ /dev/null @@ -1,631 +0,0 @@ -use anchor_lang::prelude::*; -use rfq::state::{AuthoritySide, BaseAssetIndex, BaseAssetInfo, QuoteSide, RiskCategory}; -use std::collections::HashMap; - -use crate::{ - black_scholes::calculate_option_value, - errors::Error, - state::{ - Config, FutureCommonData, InstrumentType, OptionCommonData, RiskCategoryInfo, Scenario, - }, - utils::strict_f64_to_u64, - LegWithMetadata, -}; - -type ScenariosSelector<'a> = - Box>, RiskCategory) -> Vec + 'a>; - -pub struct RiskCalculator<'a> { - pub legs_with_meta: Vec>, - pub config: &'a Config, - pub base_assets: Vec, - pub prices: HashMap, - pub scenarios_selector: ScenariosSelector<'a>, - pub current_timestamp: i64, -} - -pub struct CalculationCase { - pub leg_multiplier: f64, - pub authority_side: AuthoritySide, - pub quote_side: QuoteSide, -} - -struct PortfolioStatistics { - max_loss: f64, - max_profit: f64, -} - -struct BaseAssetStatistics { - biggest_loss: f64, - biggest_profit: f64, - absolute_value_of_legs: f64, -} - -impl<'a> RiskCalculator<'a> { - pub fn calculate_risk_for_several_cases( - &self, - cases: [CalculationCase; N], - ) -> Result<[u64; N]> { - let statistics = self.calculate_portfolio_statistics()?; - - let mut result = [0; N]; - for (i, case) in cases.into_iter().enumerate() { - result[i] = self.calculate_risk_inner(&statistics, case)?; - } - - Ok(result) - } - - pub fn calculate_risk(&self, case: CalculationCase) -> Result { - let statistics = self.calculate_portfolio_statistics()?; - - self.calculate_risk_inner(&statistics, case) - } - - fn calculate_risk_inner( - &self, - statistics: &PortfolioStatistics, - case: CalculationCase, - ) -> Result { - let mut portfolio_inverted = false; - - if let QuoteSide::Bid = case.quote_side { - portfolio_inverted = !portfolio_inverted; - } - - if let AuthoritySide::Taker = case.authority_side { - portfolio_inverted = !portfolio_inverted; - } - - let portfolio_risk = if portfolio_inverted { - statistics.max_profit - } else { - statistics.max_loss - }; - - let total_risk = portfolio_risk * case.leg_multiplier; - - let token_amount = self.risk_to_token_amount(total_risk)?; - Ok(token_amount.max(self.config.min_collateral_requirement)) - } - - fn risk_to_token_amount(&self, total_risk: f64) -> Result { - // If there are no risk just return 0 - if total_risk <= 0.0 { - return Ok(0); - } - - let total_risk_with_decimals = - total_risk * (10_u64.pow(self.config.collateral_mint_decimals as u32)) as f64; - strict_f64_to_u64(total_risk_with_decimals) - .ok_or_else(|| error!(Error::MathInvalidConversion)) - } - - fn calculate_portfolio_statistics(&self) -> Result { - let mut all_profits = 0.0; - let mut all_losses = 0.0; - let mut total_leg_values = 0.0; - - for base_asset in self.base_assets.iter() { - let BaseAssetStatistics { - biggest_loss, - biggest_profit, - absolute_value_of_legs, - } = self.calculate_statistics_for_base_asset(base_asset)?; - - all_profits += biggest_profit; - all_losses -= biggest_loss; - total_leg_values += absolute_value_of_legs; - - msg!( - "Statistics for {}, profit:{:.2}, loss:{:.2}, legs value:{:.2}", - base_asset.ticker, - all_profits, - all_losses, - total_leg_values - ); - } - - let price_shift = self.apply_safety_price_shift_factor(total_leg_values); - - all_profits += price_shift; - all_losses += price_shift; - all_profits = self.apply_overall_risk_factor(all_profits); - all_losses = self.apply_overall_risk_factor(all_losses); - - Ok(PortfolioStatistics { - max_loss: all_losses, - max_profit: all_profits, - }) - } - - fn calculate_statistics_for_base_asset( - &self, - base_asset: &BaseAssetInfo, - ) -> Result { - let legs: Vec<_> = self - .legs_with_meta - .iter() - .filter(|x| x.leg.base_asset_index == base_asset.index) - .cloned() - .collect(); - let price = self.prices.get(&base_asset.index).unwrap(); - let risk_category_info = self.config.get_risk_info(base_asset.risk_category); - - let leg_values = legs - .iter() - .map(|leg| self.calculate_current_value(leg, *price, risk_category_info)) - .collect::>>()?; - let scenarios = (self.scenarios_selector)(&legs, base_asset.risk_category); - - let mut biggest_profit = f64::MIN; - let mut biggest_loss = f64::MAX; - for scenario in scenarios.iter() { - let scenario_calculator = ScenarioRiskCalculator { - legs_with_meta: &legs, - leg_values: &leg_values, - risk_category_info, - scenario, - price: *price, - current_timestamp: self.current_timestamp, - }; - - let pnl = scenario_calculator.calculate()?; - biggest_profit = biggest_profit.max(pnl); - biggest_loss = biggest_loss.min(pnl); - } - - let absolute_value_of_legs = leg_values.into_iter().map(|value| value.abs()).sum(); - - Ok(BaseAssetStatistics { - biggest_profit, - biggest_loss, - absolute_value_of_legs, - }) - } - - fn apply_overall_risk_factor(&self, value: f64) -> f64 { - value * (self.config.overall_safety_factor + 1.0) - } - - fn apply_safety_price_shift_factor(&self, value: f64) -> f64 { - value * self.config.safety_price_shift_factor - } - - fn calculate_current_value( - &self, - leg_with_meta: &LegWithMetadata, - price: f64, - risk_category_info: RiskCategoryInfo, - ) -> Result { - calculate_asset_value( - leg_with_meta, - price, - risk_category_info.annualized_30_day_volatility, - risk_category_info.interest_rate, - self.current_timestamp, - ) - } -} - -struct ScenarioRiskCalculator<'a> { - legs_with_meta: &'a Vec>, - leg_values: &'a Vec, - risk_category_info: RiskCategoryInfo, - scenario: &'a Scenario, - price: f64, - current_timestamp: i64, -} - -impl ScenarioRiskCalculator<'_> { - fn calculate(self) -> Result { - let mut total_pnl = 0.0; - - for (leg_with_meta, leg_value) in self.legs_with_meta.iter().zip(self.leg_values.iter()) { - let pnl = self.calculate_leg_pnl(leg_with_meta, *leg_value)?; - total_pnl += pnl; - } - - Ok(total_pnl) - } - - fn calculate_leg_pnl(&self, leg_with_meta: &LegWithMetadata, leg_value: f64) -> Result { - let shocked_value = self.calculate_shocked_value(leg_with_meta)?; - Ok(shocked_value - leg_value) - } - - fn calculate_shocked_value(&self, leg_with_meta: &LegWithMetadata) -> Result { - let shocked_price = self.price * (self.scenario.base_asset_price_change + 1.0); - let mut shocked_volatility = self.risk_category_info.annualized_30_day_volatility; - - if self.scenario.volatility_change != 0.0 { - shocked_volatility *= self.scenario.volatility_change + 1.0; - } - - calculate_asset_value( - leg_with_meta, - shocked_price, - shocked_volatility, - self.risk_category_info.interest_rate, - self.current_timestamp, - ) - } -} - -fn calculate_asset_value( - leg_with_meta: &LegWithMetadata, - price: f64, - annualized_30_day_volatility: f64, - interest_rate: f64, - current_timestamp: i64, -) -> Result { - let unit_value = calculate_asset_unit_value( - leg_with_meta, - price, - annualized_30_day_volatility, - interest_rate, - current_timestamp, - )?; - - Ok(unit_value * leg_with_meta.leg_amount_fraction) -} - -fn calculate_asset_unit_value( - leg_with_meta: &LegWithMetadata, - price: f64, - annualized_30_day_volatility: f64, - interest_rate: f64, - current_timestamp: i64, -) -> Result { - match leg_with_meta.instrument_type { - InstrumentType::Spot => Ok(price), - InstrumentType::Option => { - let option_data: OptionCommonData = AnchorDeserialize::try_from_slice( - &leg_with_meta.leg.data[..OptionCommonData::SERIALIZED_SIZE], - )?; - - let seconds_till_expiration = - i64::max(0, option_data.expiration_timestamp - current_timestamp); - - Ok(calculate_option_value( - option_data.option_type, - price, - option_data.get_underlying_amount_per_contract(), - option_data.get_strike_price(), - interest_rate, - annualized_30_day_volatility, - seconds_till_expiration, - )) - } - InstrumentType::TermFuture | InstrumentType::PerpFuture => { - let future_data: FutureCommonData = AnchorDeserialize::try_from_slice( - &leg_with_meta.leg.data[..FutureCommonData::SERIALIZED_SIZE], - )?; - - Ok(price * future_data.get_underlying_amount_per_contract()) - } - } -} - -#[cfg(test)] -mod tests { - use float_cmp::assert_approx_eq; - use rfq::state::{Leg, LegSide, OracleSource, ProtocolState, SettlementTypeMetadata}; - - use crate::state::{OptionType, RiskCategoryInfo}; - use crate::utils::{convert_fixed_point_to_f64, get_leg_amount_f64}; - - use super::*; - - const BTC_INDEX: BaseAssetIndex = BaseAssetIndex::new(0); - const SOL_INDEX: BaseAssetIndex = BaseAssetIndex::new(1); - - fn get_config() -> Config { - Config { - min_collateral_requirement: 0, - collateral_for_fixed_quote_amount_rfq_creation: 0, - collateral_mint_decimals: 9, - safety_price_shift_factor: 0.01, - overall_safety_factor: 0.1, - accepted_oracle_staleness: 300, - accepted_oracle_confidence_interval_portion: 0.01, - reserved: [0; 256], - risk_categories_info: [RiskCategoryInfo { - interest_rate: 0.05, - annualized_30_day_volatility: 0.5, - scenario_per_settlement_period: Default::default(), - }; 8], - instrument_types: [Default::default(); ProtocolState::MAX_INSTRUMENTS], - padding: [0; 6], - } - } - - fn construct_base_asset(index: BaseAssetIndex, risk_category: RiskCategory) -> BaseAssetInfo { - BaseAssetInfo::new( - Default::default(), - index, - risk_category, - OracleSource::Switchboard, - Default::default(), - ) - } - - #[test] - fn one_spot_bitcoin_leg() { - let config = get_config(); - - let leg = Leg { - amount: 2 * 10_u64.pow(6), - amount_decimals: 6, - side: LegSide::Long, - base_asset_index: BTC_INDEX, - data: Default::default(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }; - let legs_with_meta = vec![LegWithMetadata { - leg: &leg, - instrument_type: InstrumentType::Spot, - leg_amount_fraction: get_leg_amount_f64(&leg), - }]; - - let base_assets = vec![construct_base_asset(BTC_INDEX, RiskCategory::VeryLow)]; - - let prices = HashMap::from([(BTC_INDEX, 20_000.0)]); - - fn scenarios_selector( - _legs: &Vec, - _risk_category: RiskCategory, - ) -> Vec { - vec![Scenario::new(0.1, 0.0), Scenario::new(-0.1, 0.0)] - } - - let risk_calculator = RiskCalculator { - legs_with_meta, - config: &config, - base_assets, - prices, - scenarios_selector: Box::new(scenarios_selector), - current_timestamp: 0, - }; - - let required_collateral = risk_calculator - .calculate_risk(CalculationCase { - leg_multiplier: 3.0, - authority_side: AuthoritySide::Taker, - quote_side: QuoteSide::Ask, - }) - .unwrap(); - assert_eq!( - required_collateral, - 14520 * 10_u64.pow(config.collateral_mint_decimals as u32) - ); - } - - #[test] - fn basis_bitcoin_rfq() { - let config = get_config(); - - let legs = vec![ - Leg { - amount: 2 * 10_u64.pow(6), - amount_decimals: 6, - side: LegSide::Long, - base_asset_index: BTC_INDEX, - data: Default::default(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }, - Leg { - amount: 2 * 10_u64.pow(6), - amount_decimals: 6, - side: LegSide::Short, - base_asset_index: BTC_INDEX, - data: Default::default(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }, - ]; - let legs_with_meta = vec![ - LegWithMetadata { - leg: &legs[0], - instrument_type: InstrumentType::Spot, - leg_amount_fraction: get_leg_amount_f64(&legs[0]), - }, - LegWithMetadata { - leg: &legs[1], - instrument_type: InstrumentType::Spot, - leg_amount_fraction: get_leg_amount_f64(&legs[1]), - }, - ]; - - let base_assets = vec![construct_base_asset(BTC_INDEX, RiskCategory::VeryLow)]; - - let prices = HashMap::from([(BTC_INDEX, 20_000.0)]); - - fn scenarios_selector( - _legs: &Vec, - _risk_category: RiskCategory, - ) -> Vec { - vec![Scenario::new(0.1, 0.0), Scenario::new(-0.1, 0.0)] - } - - let risk_calculator = RiskCalculator { - legs_with_meta, - config: &config, - base_assets, - prices, - scenarios_selector: Box::new(scenarios_selector), - current_timestamp: 0, - }; - - let required_collateral = risk_calculator - .calculate_risk(CalculationCase { - leg_multiplier: 3.0, - authority_side: AuthoritySide::Taker, - quote_side: QuoteSide::Ask, - }) - .unwrap(); - assert_eq!( - required_collateral, - 2640 * 10_u64.pow(config.collateral_mint_decimals as u32) - ); - } - - #[test] - fn buy_bitcoin_sell_solana_rfq() { - let config = get_config(); - - let legs = vec![ - Leg { - amount: 1 * 10_u64.pow(6), - amount_decimals: 6, - side: LegSide::Long, - base_asset_index: BTC_INDEX, - data: Default::default(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }, - Leg { - amount: 100 * 10_u64.pow(9), - amount_decimals: 9, - side: LegSide::Short, - base_asset_index: SOL_INDEX, - data: Default::default(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }, - ]; - let legs_with_meta = vec![ - LegWithMetadata { - leg: &legs[0], - instrument_type: InstrumentType::Spot, - leg_amount_fraction: get_leg_amount_f64(&legs[0]), - }, - LegWithMetadata { - leg: &legs[1], - instrument_type: InstrumentType::Spot, - leg_amount_fraction: get_leg_amount_f64(&legs[1]), - }, - ]; - - let base_assets = vec![ - construct_base_asset(BTC_INDEX, RiskCategory::VeryLow), - construct_base_asset(SOL_INDEX, RiskCategory::Medium), - ]; - - let prices = HashMap::from([(BTC_INDEX, 20_000.0), (SOL_INDEX, 30.0)]); - - fn scenarios_selector( - _legs: &Vec, - risk_category: RiskCategory, - ) -> Vec { - if risk_category == RiskCategory::VeryLow { - vec![Scenario::new(0.1, 0.0), Scenario::new(-0.1, 0.0)] - } else { - vec![Scenario::new(0.2, 0.0), Scenario::new(-0.2, 0.0)] - } - } - - let risk_calculator = RiskCalculator { - legs_with_meta, - config: &config, - base_assets, - prices, - scenarios_selector: Box::new(scenarios_selector), - current_timestamp: 0, - }; - - let required_collateral = risk_calculator - .calculate_risk(CalculationCase { - leg_multiplier: 3.0, - authority_side: AuthoritySide::Taker, - quote_side: QuoteSide::Ask, - }) - .unwrap(); - assert_eq!( - required_collateral, - 9339 * 10_u64.pow(config.collateral_mint_decimals as u32) - ); - } - - #[test] - fn one_option_call() { - let config = get_config(); - - let option_data = OptionCommonData { - option_type: OptionType::Call, - underlying_amount_per_contract: 1 * 10_u64.pow(8), - underlying_amount_per_contract_decimals: 9, - strike_price: 22000 * 10_u64.pow(9), - strike_price_decimals: 9, - expiration_timestamp: 90 * 24 * 60 * 60, - }; - - let leg = Leg { - amount: 1 * 10_u64.pow(6), - amount_decimals: 6, - side: LegSide::Long, - base_asset_index: BTC_INDEX, - data: option_data.try_to_vec().unwrap(), - settlement_type_metadata: SettlementTypeMetadata::Instrument { - instrument_index: Default::default(), - }, - reserved: [0; 64], - }; - let legs_with_meta = vec![LegWithMetadata { - leg: &leg, - instrument_type: InstrumentType::Option, - leg_amount_fraction: get_leg_amount_f64(&leg), - }]; - - let base_assets = vec![construct_base_asset(BTC_INDEX, RiskCategory::VeryLow)]; - - let prices = HashMap::from([(BTC_INDEX, 20_000.0)]); - - fn scenarios_selector( - _legs: &Vec, - _risk_category: RiskCategory, - ) -> Vec { - vec![ - Scenario::new(0.1, 0.2), - Scenario::new(0.1, -0.2), - Scenario::new(-0.1, 0.2), - Scenario::new(-0.1, -0.2), - ] - } - - let risk_calculator = RiskCalculator { - legs_with_meta, - config: &config, - base_assets, - prices, - scenarios_selector: Box::new(scenarios_selector), - current_timestamp: 0, - }; - - let required_collateral = risk_calculator - .calculate_risk(CalculationCase { - leg_multiplier: 3.0, - authority_side: AuthoritySide::Taker, - quote_side: QuoteSide::Bid, - }) - .unwrap(); - assert_approx_eq!( - f64, - convert_fixed_point_to_f64(required_collateral, config.collateral_mint_decimals as u8), - 471.9, - epsilon = 0.1 - ); - } -} diff --git a/risk-engine/program/src/scenarios.rs b/risk-engine/program/src/scenarios.rs deleted file mode 100644 index e0a18a02..00000000 --- a/risk-engine/program/src/scenarios.rs +++ /dev/null @@ -1,51 +0,0 @@ -use rfq::state::RiskCategory; - -use crate::{ - state::{Config, InstrumentType, Scenario}, - LegWithMetadata, -}; - -pub struct ScenarioSelector<'a> { - pub config: &'a Config, - pub settlement_period: u32, -} - -impl ScenarioSelector<'_> { - pub fn select_scenarious( - &self, - legs_with_meta: &[LegWithMetadata], - risk_category: RiskCategory, - ) -> Vec { - let have_option_legs = legs_with_meta - .iter() - .any(|x| matches!(x.instrument_type, InstrumentType::Option)); - - let base_scenario = self - .config - .get_risk_info(risk_category) - .get_base_scenario(self.settlement_period); - - if have_option_legs { - vec![ - base_scenario, - Scenario::new( - base_scenario.base_asset_price_change, - -base_scenario.volatility_change, - ), - Scenario::new( - -base_scenario.base_asset_price_change, - base_scenario.volatility_change, - ), - Scenario::new( - -base_scenario.base_asset_price_change, - -base_scenario.volatility_change, - ), - ] - } else { - vec![ - Scenario::new(base_scenario.base_asset_price_change, 0.0), - Scenario::new(-base_scenario.base_asset_price_change, 0.0), - ] - } - } -} diff --git a/risk-engine/program/src/state.rs b/risk-engine/program/src/state.rs index bf498457..15192dfc 100644 --- a/risk-engine/program/src/state.rs +++ b/risk-engine/program/src/state.rs @@ -1,102 +1,8 @@ -use std::mem; - use anchor_lang::prelude::*; -use bytemuck::{Pod, Zeroable}; -use rfq::state::RiskCategory; use crate::errors::Error; use crate::utils::convert_fixed_point_to_f64; -#[account(zero_copy)] -pub struct Config { - pub min_collateral_requirement: u64, - pub collateral_for_fixed_quote_amount_rfq_creation: u64, - pub collateral_mint_decimals: u64, // is used as u8, but represented as u64 to avoid memory padding - pub safety_price_shift_factor: f64, - pub overall_safety_factor: f64, - pub accepted_oracle_staleness: u64, - pub accepted_oracle_confidence_interval_portion: f64, - pub reserved: [u8; 256], - pub risk_categories_info: [RiskCategoryInfo; 8], // 8 - mem::variant_count:: - pub instrument_types: [StoredInstrumentType; 50], // Embed ProtocolState::MAX_INSTRUMENTS to work around anchor idl generation issue - pub padding: [u8; 6], -} - -impl Config { - pub fn get_allocated_size() -> usize { - 8 + mem::size_of::() - } - - pub fn get_risk_info(&self, risk_category: RiskCategory) -> RiskCategoryInfo { - self.risk_categories_info[risk_category as usize] - } -} - -const SETTLEMENT_WINDOW_PEDIODS: usize = 6; -const SETTLEMENT_WINDOW_BREAKPOINS: [u32; SETTLEMENT_WINDOW_PEDIODS - 1] = [ - 60 * 60, - 4 * 60 * 60, - 12 * 60 * 60, - 24 * 60 * 60, - 48 * 60 * 60, -]; - -#[zero_copy] -#[derive(AnchorSerialize, AnchorDeserialize, Default)] -pub struct RiskCategoryInfo { - pub interest_rate: f64, - pub annualized_30_day_volatility: f64, - pub scenario_per_settlement_period: [Scenario; SETTLEMENT_WINDOW_PEDIODS], -} - -impl RiskCategoryInfo { - pub fn get_base_scenario(&self, settlement_duration: u32) -> Scenario { - let mut index = SETTLEMENT_WINDOW_PEDIODS - 1; - for (i, breakpoint) in SETTLEMENT_WINDOW_BREAKPOINS.into_iter().enumerate() { - if settlement_duration < breakpoint { - index = i; - break; - } - } - - self.scenario_per_settlement_period[index] - } -} - -#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Default, Zeroable, Pod)] -#[repr(C)] -pub struct Scenario { - pub base_asset_price_change: f64, - pub volatility_change: f64, -} - -impl Scenario { - pub fn new(base_asset_price_change: f64, volatility_change: f64) -> Self { - Self { - base_asset_price_change, - volatility_change, - } - } -} - -#[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug)] -pub enum StoredInstrumentType { - Missing = 0, - Spot = 1, - Option = 2, - TermFuture = 3, - PerpFuture = 4, -} - -impl Default for StoredInstrumentType { - fn default() -> Self { - Self::Missing - } -} - -unsafe impl Zeroable for StoredInstrumentType {} // Allows 0 value, so it's okay -unsafe impl Pod for StoredInstrumentType {} // Does not allow for all bit patterns, but it is okay in our case as only the program can set this byte - #[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone, Debug)] pub enum InstrumentType { Spot = 1, @@ -119,24 +25,6 @@ impl TryFrom for InstrumentType { } } -impl TryFrom for InstrumentType { - type Error = Error; - - fn try_from(value: StoredInstrumentType) -> std::result::Result { - InstrumentType::try_from(value as u8) - } -} - -impl From for StoredInstrumentType { - fn from(value: InstrumentType) -> Self { - match value { - InstrumentType::Spot => StoredInstrumentType::Spot, - InstrumentType::Option => StoredInstrumentType::Option, - InstrumentType::TermFuture => StoredInstrumentType::TermFuture, - InstrumentType::PerpFuture => StoredInstrumentType::PerpFuture, - } - } -} #[derive(AnchorSerialize, AnchorDeserialize, Copy, Clone)] pub struct OptionCommonData { pub option_type: OptionType, diff --git a/spot-instrument/js/package.json b/spot-instrument/js/package.json index 422b997e..51c8c92c 100644 --- a/spot-instrument/js/package.json +++ b/spot-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/spot-instrument", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/tests/fixtures/accounts/risk-engine-config.json b/tests/fixtures/accounts/risk-engine-config.json deleted file mode 100644 index 43d8a2ca..00000000 --- a/tests/fixtures/accounts/risk-engine-config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "pubkey": "63zhouVc9DsAWsvp9CaJ7EY12CDK984Yt7heVbTsJxcN", - "account": { - "lamports": 9744000, - "data": [ - "mwyq4B76zIIAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPMEgAAAAB7FK5H4XqEPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAECAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "base64" - ], - "owner": "CtfTi4TstqJaxEh8giQ7kK8CKXsJyF9CuwdcVoqGrEi1", - "executable": false, - "rentEpoch": 0 - } -} \ No newline at end of file diff --git a/tests/fixtures/pubkey-naming.json b/tests/fixtures/pubkey-naming.json index c9966218..b500e659 100644 --- a/tests/fixtures/pubkey-naming.json +++ b/tests/fixtures/pubkey-naming.json @@ -27,7 +27,6 @@ "5Atpbyw3tBjjc8EYrbjE1a4FNqyLUszFGsNo3R5bR3y8": "rfq-mint-info-usd-quote", "AinWDnZWiEkWrNGH9jbvS2JXaBFZwnRE5ssNGyop882L": "rfq-protocol", "CtfTi4TstqJaxEh8giQ7kK8CKXsJyF9CuwdcVoqGrEi1": "risk-engine", - "63zhouVc9DsAWsvp9CaJ7EY12CDK984Yt7heVbTsJxcN": "risk-engine-config", "BMXWVaYPVJ4G8g2MMJt51CDgjHHuoirPMvsTUadv3s3v": "spot-instrument", "7J21igTMpQa18YueGJGNmp54m1VxsBHz4LEjiV6P28DJ": "spot-instrument-config", "CBVMytnrNLSMZR4kRBwpp87iNeuexMehJFMTcizW86Yy": "token-account-btc-dao", diff --git a/tests/integration/vaultOperator.spec.ts b/tests/integration/vaultOperator.spec.ts index 339e8046..6285d6ec 100644 --- a/tests/integration/vaultOperator.spec.ts +++ b/tests/integration/vaultOperator.spec.ts @@ -10,7 +10,7 @@ import { withoutSpotQuoteFees, } from "../utilities/helpers"; import { Context, getContext } from "../utilities/wrappers"; -import { AuthoritySide, FixedSize, OrderType, Quote } from "../utilities/types"; +import { AuthoritySide, OrderType, Quote } from "../utilities/types"; describe("Vault operator", () => { let context: Context; @@ -32,7 +32,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 48_000, activeWindow: 1, }); @@ -53,7 +53,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 48_000, }); @@ -80,7 +80,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Buy, - fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(50_000)), + size: withTokenDecimals(50_000), acceptableLimitPrice: 40_000, }); @@ -107,7 +107,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Buy, - fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(50_000)), + size: withTokenDecimals(50_000), acceptableLimitPrice: 42_000, activeWindow: 2, settlingWindow: 1, @@ -139,7 +139,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 46_000, activeWindow: 2, settlingWindow: 1, @@ -171,7 +171,7 @@ describe("Vault operator", () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Buy, - fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(50_000)), + size: withTokenDecimals(50_000), acceptableLimitPrice: 42_000, activeWindow: 2, settlingWindow: 1, diff --git a/tests/scripts/fixturesGenerator.ts b/tests/scripts/fixturesGenerator.ts index 02494cba..301988c6 100644 --- a/tests/scripts/fixturesGenerator.ts +++ b/tests/scripts/fixturesGenerator.ts @@ -113,9 +113,6 @@ async function main() { const configAddress = SpotInstrument.getConfigAddress(); await saveAccountAsFixture(context, configAddress, "spot-instrument-config"); }, - async () => { - await context.riskEngine.initializeDefaultConfig(); - }, async () => { await HxroPrintTradeProvider.addPrintTradeProvider(context); @@ -196,10 +193,7 @@ async function main() { // postpone saving protocol and risk engine config after all initialization // to capture all internal changes in those accounts - await executeInParallel( - () => saveAccountAsFixture(context, context.protocolPda, "rfq-protocol"), - () => saveAccountAsFixture(context, context.riskEngine.configAddress, "risk-engine-config") - ); + await executeInParallel(() => saveAccountAsFixture(context, context.protocolPda, "rfq-protocol")); await savePubkeyNaming(); process.exit(); diff --git a/tests/unit/closeRiskEngineConfig.ts b/tests/unit/closeRiskEngineConfig.ts deleted file mode 100644 index 4e1e63d3..00000000 --- a/tests/unit/closeRiskEngineConfig.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { expect } from "chai"; -import { expectError } from "../utilities/helpers"; -import { Context, getContext } from "../utilities/wrappers"; - -describe("Close risk engine config", () => { - let context: Context; - - before(async () => { - context = await getContext(); - }); - - it("Can close risk engine config", async () => { - await context.riskEngine.closeConfig(); - - const configData = await context.riskEngine.getConfig(); - expect(configData).to.be.null; - - await context.riskEngine.initializeDefaultConfig(); - }); - - it("Can't close if not a protocol authority", async () => { - await expectError(context.riskEngine.closeConfig({ signer: context.taker }), "NotAProtocolAuthority"); - }); -}); diff --git a/tests/unit/requiredCollateralCalculations.ts b/tests/unit/requiredCollateralCalculations.ts index 61e8d1c7..15c41520 100644 --- a/tests/unit/requiredCollateralCalculations.ts +++ b/tests/unit/requiredCollateralCalculations.ts @@ -1,11 +1,7 @@ import { BN } from "@coral-xyz/anchor"; import { PublicKey } from "@solana/web3.js"; import { OptionType } from "@mithraic-labs/tokenized-euros"; -import { - DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ, - DEFAULT_MIN_COLLATERAL_REQUIREMENT, - SOLANA_BASE_ASSET_INDEX, -} from "../utilities/constants"; +import { SOLANA_BASE_ASSET_INDEX } from "../utilities/constants"; import { attachImprovedLogDisplay, toAbsolutePrice, @@ -45,9 +41,7 @@ describe("Required collateral calculation and lock", () => { await context.createEscrowRfq({ fixedSize: FixedSize.None }); - await measurer.expectChange([ - { token: "unlockedCollateral", user: taker, delta: DEFAULT_MIN_COLLATERAL_REQUIREMENT.neg() }, - ]); + await measurer.expectChange([{ token: "unlockedCollateral", user: taker, delta: new BN(0) }]); }); it("Correct collateral locked for fixed quote asset size rfq creation", async () => { @@ -55,9 +49,7 @@ describe("Required collateral calculation and lock", () => { await context.createEscrowRfq({ fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(5)) }); - await measurer.expectChange([ - { token: "unlockedCollateral", user: taker, delta: DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ.neg() }, - ]); + await measurer.expectChange([{ token: "unlockedCollateral", user: taker, delta: new BN(0) }]); }); it("Correct collateral locked for fixed leg structure size spot rfq creation", async () => { diff --git a/tests/unit/updateRiskEngineConfig.ts b/tests/unit/updateRiskEngineConfig.ts deleted file mode 100644 index 8918324d..00000000 --- a/tests/unit/updateRiskEngineConfig.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { BN } from "@coral-xyz/anchor"; -import { expect } from "chai"; -import { attachImprovedLogDisplay } from "../utilities/helpers"; -import { - DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ, - DEFAULT_MIN_COLLATERAL_REQUIREMENT, - DEFAULT_MINT_DECIMALS, -} from "../utilities/constants"; -import { Context, getContext, RiskEngine } from "../utilities/wrappers"; - -describe("Update Risk Engine config", () => { - let context: Context; - let riskEngine: RiskEngine; - - beforeEach(function () { - attachImprovedLogDisplay(this, context); - }); - - before(async () => { - context = await getContext(); - riskEngine = context.riskEngine; - }); - - it("Successfully partially update risk engine config", async () => { - await riskEngine.updateConfig({ - minCollateralRequirement: new BN(100_000_000), - collateralMintDecimals: 3, - }); - - const config = await riskEngine.getConfig(); - if (config === null) { - throw Error("Config is expected to exist"); - } - expect(config.minCollateralRequirement).to.be.bignumber.equal(new BN(100_000_000)); - expect(config.collateralMintDecimals).to.be.bignumber.equal(new BN(3)); - expect(config.collateralForFixedQuoteAmountRfqCreation).to.be.bignumber.equal( - DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ - ); - - // reset config - await riskEngine.updateConfig({ - minCollateralRequirement: DEFAULT_MIN_COLLATERAL_REQUIREMENT, - collateralMintDecimals: DEFAULT_MINT_DECIMALS, - }); - }); -}); diff --git a/tests/unit/vaultOperator.ts b/tests/unit/vaultOperator.ts index f5e2c191..cc174532 100644 --- a/tests/unit/vaultOperator.ts +++ b/tests/unit/vaultOperator.ts @@ -6,7 +6,7 @@ import { withTokenDecimals, } from "../utilities/helpers"; import { Context, getContext } from "../utilities/wrappers"; -import { AuthoritySide, FixedSize, OrderType, Quote } from "../utilities/types"; +import { AuthoritySide, OrderType, Quote } from "../utilities/types"; import { expect } from "chai"; describe("Vault operator", () => { @@ -24,7 +24,7 @@ describe("Vault operator", () => { await expectError( context.createVaultOperatorRfq({ orderType: OrderType.TwoWay, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 46_000, }), "UnsupportedRfqType" @@ -34,7 +34,7 @@ describe("Vault operator", () => { it("Can't confirm two responses", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 46_000, }); @@ -52,7 +52,7 @@ describe("Vault operator", () => { it("Can't accept worse sell price", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(withTokenDecimals(2)), + size: withTokenDecimals(2), acceptableLimitPrice: 40_000, }); @@ -63,7 +63,7 @@ describe("Vault operator", () => { it("Can't accept worse buy price", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Buy, - fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(50_000)), + size: withTokenDecimals(50_000), acceptableLimitPrice: 40_000, }); @@ -74,7 +74,7 @@ describe("Vault operator", () => { it("Can't withdraw to a different user", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Buy, - fixedSize: FixedSize.getQuoteAsset(withTokenDecimals(50_000)), + size: withTokenDecimals(50_000), acceptableLimitPrice: 40_000, }); @@ -85,7 +85,7 @@ describe("Vault operator", () => { it("Can't withdraw to a different address", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 48_000, }); @@ -103,7 +103,7 @@ describe("Vault operator", () => { it("Tokens withdrawn field works as expected", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 48_000, }); @@ -126,7 +126,7 @@ describe("Vault operator", () => { it("Can't withdraw tokens without confirmation while rfq is active", async () => { const vault = await context.createVaultOperatorRfq({ orderType: OrderType.Sell, - fixedSize: FixedSize.getBaseAsset(toLegMultiplier(2)), + size: toLegMultiplier(2), acceptableLimitPrice: 48_000, }); diff --git a/tests/utilities/constants.ts b/tests/utilities/constants.ts index ca0378a2..881745f7 100644 --- a/tests/utilities/constants.ts +++ b/tests/utilities/constants.ts @@ -1,6 +1,6 @@ import { BN } from "@coral-xyz/anchor"; import { PublicKey } from "@solana/web3.js"; -import { LegSide, OrderType, toRiskCategoryInfo, toScenario } from "./types"; +import { LegSide, OrderType } from "./types"; export const PROTOCOL_SEED = "protocol"; export const COLLATERAL_SEED = "collateral_info"; @@ -43,79 +43,3 @@ export const PYTH_SOL_ORACLE = new PublicKey("H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN export const ETH_IN_PLACE_PRICE = 2_000; export const SPOT_QUOTE_FEE_BPS = new BN(1).mul(new BN(10).pow(new BN(FEE_BPS_DECIMALS - 2))); // 1% - -export const RISK_ENGINE_CONFIG_SEED = "config"; - -export const DEFAULT_MIN_COLLATERAL_REQUIREMENT = new BN(0); -export const DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ = new BN(0); -export const DEFAULT_SAFETY_PRICE_SHIFT_FACTOR = 0; -export const DEFAULT_OVERALL_SAFETY_FACTOR = 0; -export const DEFAULT_ACCEPTED_ORACLE_STALENESS = new BN(60 * 60 * 24 * 365 * 10); // 10 years, very long because fixtures would become stale otherwise -export const DEFAULT_ACCEPTED_ORACLE_CONFIDENCE_INTERVAL_PORTION = 0.01; - -export const DEFAULT_RISK_CATEGORIES_INFO = [ - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // very low - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // low - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // medium - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // high - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // very high - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // custom 1 - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // custom 2 - toRiskCategoryInfo(0, 0, [ - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - toScenario(0, 0), - ]), // custom 3 -]; diff --git a/tests/utilities/instruments/psyoptionsAmericanInstrument.ts b/tests/utilities/instruments/psyoptionsAmericanInstrument.ts index 2d96e1e9..133636eb 100644 --- a/tests/utilities/instruments/psyoptionsAmericanInstrument.ts +++ b/tests/utilities/instruments/psyoptionsAmericanInstrument.ts @@ -5,7 +5,7 @@ import { instructions, createProgram, getOptionByKey, OptionMarketWithKey } from import { DEFAULT_LEG_AMOUNT, DEFAULT_LEG_SIDE } from "../constants"; import { Instrument, InstrumentController } from "../instrument"; import { getInstrumentEscrowPda } from "../pdas"; -import { AuthoritySide, AssetIdentifier, InstrumentType, LegSide } from "../types"; +import { AuthoritySide, AssetIdentifier, LegSide } from "../types"; import { Context, Mint, Response, Rfq } from "../wrappers"; import { executeInParallel, withTokenDecimals } from "../helpers"; import * as anchor from "@coral-xyz/anchor"; @@ -74,10 +74,6 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { await context.addInstrument(getAmericanOptionsInstrumentProgram().programId, false, 3, 7, 3, 3, 4); } - static async setRiskEngineInstrumentType(context: Context) { - await context.riskEngine.setInstrumentType(this.instrumentIndex, InstrumentType.Option); - } - serializeInstrumentData(): Buffer { const op = this.OptionMarket.OptionInfo; const mint = this.OptionMarket.optionMint.publicKey.toBytes(); diff --git a/tests/utilities/instruments/psyoptionsEuropeanInstrument.ts b/tests/utilities/instruments/psyoptionsEuropeanInstrument.ts index d2d87be3..a64e5e45 100644 --- a/tests/utilities/instruments/psyoptionsEuropeanInstrument.ts +++ b/tests/utilities/instruments/psyoptionsEuropeanInstrument.ts @@ -4,7 +4,7 @@ import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, Signer } from "@solana/we import { DEFAULT_LEG_AMOUNT, DEFAULT_LEG_SIDE } from "../constants"; import { Instrument, InstrumentController } from "../instrument"; import { getInstrumentEscrowPda } from "../pdas"; -import { AssetIdentifier, AuthoritySide, InstrumentType, LegSide } from "../types"; +import { AssetIdentifier, AuthoritySide, LegSide } from "../types"; import { Context, Mint, Response, Rfq } from "../wrappers"; import { PsyoptionsEuropeanInstrument as PsyoptionsEuropeanInstrumentIdl } from "../../../target/types/psyoptions_european_instrument"; import { executeInParallel, withTokenDecimals } from "../helpers"; @@ -62,10 +62,6 @@ export class PsyoptionsEuropeanInstrument implements Instrument { await context.addInstrument(getEuroOptionsInstrumentProgram().programId, false, 2, 7, 3, 3, 4); } - static async setRiskEngineInstrumentType(context: Context) { - await context.riskEngine.setInstrumentType(this.instrumentIndex, InstrumentType.Option); - } - serializeInstrumentData(): Buffer { const mint = this.getOptionMint().publicKey.toBytes(); const meta = this.optionFacade.metaKey.toBytes(); diff --git a/tests/utilities/instruments/spotInstrument.ts b/tests/utilities/instruments/spotInstrument.ts index 42f8824d..654bf60f 100644 --- a/tests/utilities/instruments/spotInstrument.ts +++ b/tests/utilities/instruments/spotInstrument.ts @@ -4,7 +4,7 @@ import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY } from "@solana/web3.js"; import { DEFAULT_LEG_AMOUNT, DEFAULT_LEG_SIDE } from "../constants"; import { Instrument, InstrumentController } from "../instrument"; import { getInstrumentEscrowPda } from "../pdas"; -import { AssetIdentifier, InstrumentType, LegSide } from "../types"; +import { AssetIdentifier, LegSide } from "../types"; import { Context, Mint, Response, Rfq } from "../wrappers"; import { SpotInstrument as SpotInstrumentIdl } from "../../../target/types/spot_instrument"; @@ -66,10 +66,6 @@ export class SpotInstrument implements Instrument { .rpc(); } - static async setRiskEngineInstrumentType(context: Context) { - await context.riskEngine.setInstrumentType(this.instrumentIndex, InstrumentType.Spot); - } - static getConfigAddress() { const program = getSpotInstrumentProgram(); const [address] = PublicKey.findProgramAddressSync([Buffer.from("config")], program.programId); diff --git a/tests/utilities/pdas.ts b/tests/utilities/pdas.ts index c702cbdc..e10cf1a3 100644 --- a/tests/utilities/pdas.ts +++ b/tests/utilities/pdas.ts @@ -11,7 +11,6 @@ import { QUOTE_ESCROW_SEED, RESPONSE_SEED, RFQ_SEED, - RISK_ENGINE_CONFIG_SEED, } from "./constants"; import { toLittleEndian } from "./helpers"; import { AssetIdentifier, assetIdentifierToSeedBytes, FixedSize, OrderType, QuoteData } from "./types"; @@ -122,11 +121,6 @@ export function getPsyoptionsAmericanEscrowPda(response: PublicKey, legIndex: nu return pda; } -export function getRiskEngineConfig(programId: PublicKey) { - const [pda] = PublicKey.findProgramAddressSync([Buffer.from(RISK_ENGINE_CONFIG_SEED)], programId); - return pda; -} - export function getVaultOperatorPda(vaultParams: PublicKey, programId: PublicKey) { const [pda] = PublicKey.findProgramAddressSync([Buffer.from("operator"), vaultParams.toBuffer()], programId); return pda; diff --git a/tests/utilities/wrappers/context.ts b/tests/utilities/wrappers/context.ts index 97c98f1c..fa39069c 100644 --- a/tests/utilities/wrappers/context.ts +++ b/tests/utilities/wrappers/context.ts @@ -3,6 +3,7 @@ import { PublicKey, Keypair, SystemProgram, SYSVAR_RENT_PUBKEY, AccountMeta } fr import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { Rfq as RfqIdl } from "../../../target/types/rfq"; import { VaultOperator as VaultOperatorIdl } from "../../../target/types/vault_operator"; +import { RiskEngine as RiskEngineIdl } from "../../../target/types/risk_engine"; import { getBaseAssetPda, getCollateralInfoPda, @@ -18,10 +19,8 @@ import { DEFAULT_SETTLING_WINDOW, DEFAULT_SETTLE_FEES, DEFAULT_DEFAULT_FEES, - SWITCHBOARD_BTC_ORACLE, BITCOIN_BASE_ASSET_INDEX, SOLANA_BASE_ASSET_INDEX, - PYTH_SOL_ORACLE, ETH_BASE_ASSET_INDEX, } from "../constants"; import { FixedSize, RiskCategory, OrderType, FeeParams, OracleSource, LegData, QuoteData } from "../types"; @@ -41,17 +40,15 @@ import { import { loadPubkeyNaming, readKeypair } from "../fixtures"; import { HxroPrintTradeProvider } from "../printTradeProviders/hxroPrintTradeProvider"; import { CollateralMint, Mint } from "./mints"; -import { RiskEngine } from "./riskEngine"; import { RfqContent, Whitelist, Rfq } from "./rfq"; import { VaultOperator } from "./vaultOperator"; export class Context { public program: Program; public vaultOperatorProgram: Program; + public riskEngineProgram: Program; public provider: AnchorProvider; - public baseAssets: { [baseAssetIndex: number]: { oracleAddress: PublicKey | null } }; - public riskEngine!: RiskEngine; public protocolPda!: PublicKey; public dao!: Keypair; @@ -72,14 +69,13 @@ export class Context { setProvider(this.provider); this.program = workspace.Rfq as Program; this.vaultOperatorProgram = workspace.VaultOperator as Program; - this.baseAssets = {}; + this.riskEngineProgram = workspace.RiskEngine as Program; this.pubkeyToName = {}; this.nameToPubkey = {}; } async basicInitialize() { - this.riskEngine = await RiskEngine.create(this); this.protocolPda = getProtocolPda(this.program.programId); } @@ -107,14 +103,6 @@ export class Context { async () => (this.collateralToken = await CollateralMint.loadExisting(this, this.nameToPubkey["mint-usd-collateral"])) ); - - this.baseAssets[BITCOIN_BASE_ASSET_INDEX] = { - oracleAddress: SWITCHBOARD_BTC_ORACLE, - }; - this.baseAssets[SOLANA_BASE_ASSET_INDEX] = { - oracleAddress: PYTH_SOL_ORACLE, - }; - this.baseAssets[ETH_BASE_ASSET_INDEX] = { oracleAddress: null }; } async initializeProtocol({ settleFees = DEFAULT_SETTLE_FEES, defaultFees = DEFAULT_DEFAULT_FEES } = {}) { @@ -123,7 +111,7 @@ export class Context { .accounts({ signer: this.dao.publicKey, protocol: this.protocolPda, - riskEngine: this.riskEngine.programId, + riskEngine: this.riskEngineProgram.programId, collateralMint: this.collateralToken.publicKey, systemProgram: SystemProgram.programId, }) @@ -204,16 +192,6 @@ export class Context { .signers([this.dao]) .rpc(); - const oracleAddress = - oracleSource == OracleSource.Switchboard - ? switchboardOracle - : oracleSource == OracleSource.Pyth - ? pythOracle - : null; - this.baseAssets[baseAssetIndex] = { - oracleAddress, - }; - return { baseAssetPda }; } @@ -410,7 +388,7 @@ export class Context { leg = SpotInstrument.createForLeg(this), quote = SpotInstrument.createForQuote(this, this.quoteToken), orderType = OrderType.Sell, - fixedSize = FixedSize.getBaseAsset(toLegMultiplier(2)), + size = toLegMultiplier(2), activeWindow = DEFAULT_ACTIVE_WINDOW, settlingWindow = DEFAULT_SETTLING_WINDOW, whitelistPubkeyList = [], @@ -419,7 +397,7 @@ export class Context { leg?: InstrumentController; quote?: InstrumentController; orderType?: OrderType; - fixedSize?: FixedSize; + size?: BN; activeWindow?: number; settlingWindow?: number; finalize?: boolean; @@ -441,6 +419,7 @@ export class Context { const vaultOperator = getVaultOperatorPda(vaultParams.publicKey, this.vaultOperatorProgram.programId); const currentTimestamp = new BN(Math.floor(Date.now() / 1000)); + const fixedSize = orderType === OrderType.Sell ? FixedSize.getBaseAsset(size) : FixedSize.getQuoteAsset(size); const rfqAddress = await getRfqPda( vaultOperator, serializedLegData.hash, @@ -478,13 +457,9 @@ export class Context { await this.vaultOperatorProgram.methods .createRfq( toAbsolutePrice(withTokenDecimals(acceptableLimitPrice)), - remainingAccounts.length, - serializedLegData.data.length, - Array.from(serializedLegData.hash), leg.getBaseAssetIndex(), - legData.amount, serializer.encode("OrderType", orderType)[0], - Array.from(serializer.encode("FixedSize", fixedSize)), + size, activeWindow, settlingWindow, currentTimestamp @@ -503,7 +478,7 @@ export class Context { collateralInfo: getCollateralInfoPda(vaultOperator, this.program.programId), collateralToken: getCollateralTokenPda(vaultOperator, this.program.programId), collateralMint: this.collateralToken.publicKey, - riskEngine: this.riskEngine.programId, + riskEngine: this.riskEngineProgram.programId, rfqProgram: this.program.programId, systemProgram: SystemProgram.programId, }) diff --git a/tests/utilities/wrappers/index.ts b/tests/utilities/wrappers/index.ts index bd5d10aa..aea28de0 100644 --- a/tests/utilities/wrappers/index.ts +++ b/tests/utilities/wrappers/index.ts @@ -2,4 +2,3 @@ export * from "./context"; export * from "./mints"; export * from "./response"; export * from "./rfq"; -export * from "./riskEngine"; diff --git a/tests/utilities/wrappers/response.ts b/tests/utilities/wrappers/response.ts index fc094317..21865ea1 100644 --- a/tests/utilities/wrappers/response.ts +++ b/tests/utilities/wrappers/response.ts @@ -32,7 +32,7 @@ export class Response { collateralInfo: await getCollateralInfoPda(this.context.taker.publicKey, this.context.program.programId), makerCollateralInfo: await getCollateralInfoPda(this.context.maker.publicKey, this.context.program.programId), collateralToken: await getCollateralTokenPda(this.context.taker.publicKey, this.context.program.programId), - riskEngine: this.context.riskEngine.programId, + riskEngine: this.context.riskEngineProgram.programId, }) .remainingAccounts(await this.rfq.getRiskEngineAccounts()) .preInstructions([expandComputeUnits]) diff --git a/tests/utilities/wrappers/rfq.ts b/tests/utilities/wrappers/rfq.ts index 77541c51..64b1725d 100644 --- a/tests/utilities/wrappers/rfq.ts +++ b/tests/utilities/wrappers/rfq.ts @@ -75,7 +75,7 @@ export class Rfq { whitelist: whitelistToPass, collateralInfo: getCollateralInfoPda(this.context.maker.publicKey, this.context.program.programId), collateralToken: getCollateralTokenPda(this.context.maker.publicKey, this.context.program.programId), - riskEngine: this.context.riskEngine.programId, + riskEngine: this.context.riskEngineProgram.programId, systemProgram: SystemProgram.programId, }) .remainingAccounts([...responseValidateAccounts, ...riskEngineAccounts]) @@ -168,7 +168,7 @@ export class Rfq { rfq: this.account, collateralInfo: getCollateralInfoPda(this.context.taker.publicKey, this.context.program.programId), collateralToken: getCollateralTokenPda(this.context.taker.publicKey, this.context.program.programId), - riskEngine: this.context.riskEngine.programId, + riskEngine: this.context.riskEngineProgram.programId, }) .remainingAccounts(this.getRiskEngineAccounts()) .instruction(); @@ -195,27 +195,7 @@ export class Rfq { } getRiskEngineAccounts(): AccountMeta[] { - const config = { pubkey: this.context.riskEngine.configAddress, isSigner: false, isWritable: false }; - - const allIndecies = - this.content.type == "instrument" - ? this.content.legs.map((leg) => leg.getBaseAssetIndex()) - : this.content.provider.getBaseAssetIndexes(); - let uniqueIndecies = Array.from(new Set(allIndecies)); - const baseAssets = uniqueIndecies.map((index) => toBaseAssetAccount(index, this.context.program)); - - const oracles = uniqueIndecies - .map((index) => this.context.baseAssets[index].oracleAddress) - .filter((address) => address !== null) - .map((address) => { - return { - pubkey: address as PublicKey, - isSigner: false, - isWritable: false, - }; - }); - - return [config, ...baseAssets, ...oracles]; + return []; } } diff --git a/tests/utilities/wrappers/riskEngine.ts b/tests/utilities/wrappers/riskEngine.ts deleted file mode 100644 index 20e86264..00000000 --- a/tests/utilities/wrappers/riskEngine.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { Program, workspace } from "@coral-xyz/anchor"; -import { PublicKey, SystemProgram } from "@solana/web3.js"; -import { RiskEngine as RiskEngineIdl } from "../../../target/types/risk_engine"; -import { getRiskEngineConfig } from "../pdas"; -import { - DEFAULT_MINT_DECIMALS, - DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ, - DEFAULT_MIN_COLLATERAL_REQUIREMENT, - DEFAULT_SAFETY_PRICE_SHIFT_FACTOR, - DEFAULT_OVERALL_SAFETY_FACTOR, - DEFAULT_RISK_CATEGORIES_INFO, - DEFAULT_ACCEPTED_ORACLE_STALENESS, - DEFAULT_ACCEPTED_ORACLE_CONFIDENCE_INTERVAL_PORTION, -} from "../constants"; -import { RiskCategory, InstrumentType, RiskCategoryInfo } from "../types"; -import { SpotInstrument } from "../instruments/spotInstrument"; -import { executeInParallel } from "../helpers"; -import { PsyoptionsEuropeanInstrument } from "../instruments/psyoptionsEuropeanInstrument"; -import { PsyoptionsAmericanInstrumentClass } from "../instruments/psyoptionsAmericanInstrument"; -import { Context } from "./context"; - -export class RiskEngine { - private constructor( - private context: Context, - public program: Program, - public programId: PublicKey, - public configAddress: PublicKey - ) {} - - static async create(context: Context) { - const program = workspace.RiskEngine as Program; - const programId = program.programId; - const configAddress = await getRiskEngineConfig(programId); - - return new RiskEngine(context, program, programId, configAddress); - } - - async initializeDefaultConfig() { - this.configAddress = await getRiskEngineConfig(this.programId); - - await this.program.methods - .initializeConfig( - DEFAULT_MIN_COLLATERAL_REQUIREMENT, - DEFAULT_COLLATERAL_FOR_FIXED_QUOTE_AMOUNT_RFQ, - DEFAULT_MINT_DECIMALS, - DEFAULT_SAFETY_PRICE_SHIFT_FACTOR, - DEFAULT_OVERALL_SAFETY_FACTOR, - DEFAULT_ACCEPTED_ORACLE_STALENESS, - DEFAULT_ACCEPTED_ORACLE_CONFIDENCE_INTERVAL_PORTION - ) - .accounts({ - authority: this.context.dao.publicKey, - protocol: this.context.protocolPda, - config: this.configAddress, - systemProgram: SystemProgram.programId, - }) - .signers([this.context.dao]) - .rpc(); - - await executeInParallel( - async () => { - await this.setRiskCategoriesInfo([ - { - riskCategory: RiskCategory.VeryLow, - newValue: DEFAULT_RISK_CATEGORIES_INFO[0], - }, - { - riskCategory: RiskCategory.Low, - newValue: DEFAULT_RISK_CATEGORIES_INFO[1], - }, - { - riskCategory: RiskCategory.Medium, - newValue: DEFAULT_RISK_CATEGORIES_INFO[2], - }, - ]); - }, - async () => { - await this.setRiskCategoriesInfo([ - { - riskCategory: RiskCategory.High, - newValue: DEFAULT_RISK_CATEGORIES_INFO[3], - }, - { - riskCategory: RiskCategory.VeryHigh, - newValue: DEFAULT_RISK_CATEGORIES_INFO[4], - }, - { - riskCategory: RiskCategory.Custom1, - newValue: DEFAULT_RISK_CATEGORIES_INFO[5], - }, - ]); - }, - async () => { - await this.setRiskCategoriesInfo([ - { - riskCategory: RiskCategory.Custom2, - newValue: DEFAULT_RISK_CATEGORIES_INFO[6], - }, - { - riskCategory: RiskCategory.Custom3, - newValue: DEFAULT_RISK_CATEGORIES_INFO[7], - }, - ]); - }, - async () => { - await SpotInstrument.setRiskEngineInstrumentType(this.context); - }, - async () => { - await PsyoptionsEuropeanInstrument.setRiskEngineInstrumentType(this.context); - }, - async () => { - await PsyoptionsAmericanInstrumentClass.setRiskEngineInstrumentType(this.context); - } - ); - } - - async closeConfig({ signer = this.context.dao } = {}) { - this.configAddress = await getRiskEngineConfig(this.programId); - - await this.program.methods - .closeConfig() - .accounts({ - authority: signer.publicKey, - protocol: this.context.protocolPda, - config: this.configAddress, - }) - .signers([signer]) - .rpc(); - } - - async updateConfig({ - minCollateralRequirement = null, - collateralForFixedQuoteAmountRfq = null, - collateralMintDecimals = null, - safetyPriceShiftFactor = null, - overallSafetyFactor = null, - defaultAcceptedOracleStaleness = null, - defaultAcceptedOracleConfidenceIntervalPortion = null, - }: { - minCollateralRequirement?: number | null; - collateralForFixedQuoteAmountRfq?: number | null; - collateralMintDecimals?: number | null; - safetyPriceShiftFactor?: number | null; - overallSafetyFactor?: number | null; - defaultAcceptedOracleStaleness?: number | null; - defaultAcceptedOracleConfidenceIntervalPortion?: number | null; - } = {}) { - await this.program.methods - .updateConfig( - minCollateralRequirement, - collateralForFixedQuoteAmountRfq, - collateralMintDecimals, - safetyPriceShiftFactor, - overallSafetyFactor, - defaultAcceptedOracleStaleness, - defaultAcceptedOracleConfidenceIntervalPortion - ) - .accounts({ - authority: this.context.dao.publicKey, - protocol: this.context.protocolPda, - config: this.configAddress, - }) - .signers([this.context.dao]) - .rpc(); - } - - async setInstrumentType(instrumentIndex: number, instrumentType: InstrumentType) { - await this.program.methods - .setInstrumentType(instrumentIndex, instrumentType) - .accounts({ - authority: this.context.dao.publicKey, - protocol: this.context.protocolPda, - config: this.configAddress, - }) - .signers([this.context.dao]) - .rpc(); - } - - async setRiskCategoriesInfo( - changes: { - riskCategory: RiskCategory; - newValue: RiskCategoryInfo; - }[] - ) { - let changesForInstruction = changes.map((x) => { - return { - riskCategoryIndex: x.riskCategory.index, - newValue: x.newValue, - }; - }); - - await this.program.methods - .setRiskCategoriesInfo(changesForInstruction) - .accounts({ - authority: this.context.dao.publicKey, - protocol: this.context.protocolPda, - config: this.configAddress, - }) - .signers([this.context.dao]) - .rpc(); - } - - async getConfig() { - return this.program.account.config.fetchNullable(this.configAddress); - } -} diff --git a/tests/utilities/wrappers/vaultOperator.ts b/tests/utilities/wrappers/vaultOperator.ts index 4b6689d8..341cf337 100644 --- a/tests/utilities/wrappers/vaultOperator.ts +++ b/tests/utilities/wrappers/vaultOperator.ts @@ -26,7 +26,7 @@ export class VaultOperator { collateralInfo: await getCollateralInfoPda(this.operator, this.context.program.programId), makerCollateralInfo: await getCollateralInfoPda(this.context.maker.publicKey, this.context.program.programId), collateralToken: await getCollateralTokenPda(this.operator, this.context.program.programId), - riskEngine: this.context.riskEngine.programId, + riskEngine: this.context.riskEngineProgram.programId, rfqProgram: this.context.program.programId, }) .remainingAccounts(await this.rfq.getRiskEngineAccounts()) diff --git a/vault-operator/js/package.json b/vault-operator/js/package.json index 7fae26b1..76f52d1f 100644 --- a/vault-operator/js/package.json +++ b/vault-operator/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/vault-operator", - "version": "3.9.0", + "version": "3.10.0", "license": "MIT", "publishConfig": { "access": "public", diff --git a/vault-operator/program/src/lib.rs b/vault-operator/program/src/lib.rs index c2038baa..01476363 100644 --- a/vault-operator/program/src/lib.rs +++ b/vault-operator/program/src/lib.rs @@ -1,6 +1,7 @@ #![allow(clippy::result_large_err)] use anchor_lang::prelude::*; +use anchor_lang::solana_program; use anchor_spl::associated_token::get_associated_token_address; use anchor_spl::token::{ close_account, transfer, CloseAccount, Mint, Token, TokenAccount, Transfer, @@ -17,7 +18,7 @@ use rfq::cpi::{ use rfq::program::Rfq as RfqProgram; use rfq::state::whitelist::Whitelist; use rfq::state::{ - ApiLeg, AuthoritySide, BaseAssetIndex, FixedSize, LegSide, OrderType, ProtocolState, + ApiLeg, AuthoritySide, BaseAssetIndex, FixedSize, Leg, LegSide, OrderType, ProtocolState, QuoteAsset, QuoteSide, Response, Rfq, SettlementTypeMetadata, }; use seeds::OPERATOR_SEED; @@ -40,13 +41,9 @@ pub mod vault_operator { pub fn create_rfq<'info>( ctx: Context<'_, '_, '_, 'info, CreateVaultAccounts<'info>>, acceptable_price_limit: u128, - create_rfq_remaining_accounts_count: u8, - expected_legs_size: u16, - expected_legs_hash: [u8; 32], leg_base_asset_index: u16, - leg_amount: u64, order_type: u8, - fixed_size: [u8; 9], + size: u64, active_window: u32, settling_window: u32, recent_timestamp: u64, @@ -87,10 +84,6 @@ pub mod vault_operator { confirmed_response: Pubkey::default(), }); - let (create_remaining_accounts, finalize_remaining_accounts) = ctx - .remaining_accounts - .split_at(create_rfq_remaining_accounts_count as usize); - let spot_index = protocol .instruments .iter() @@ -98,25 +91,23 @@ pub mod vault_operator { .ok_or(VaultError::SpotInstrumentNotFound)? as u8; let order_type = AnchorDeserialize::try_from_slice(&[order_type])?; - let fixed_size = AnchorDeserialize::try_from_slice(&fixed_size)?; - - let (leg_mint, quote_mint, vault_amount) = match (order_type, fixed_size) { - ( - OrderType::Sell, - FixedSize::BaseAsset { - legs_multiplier_bps, - }, - ) => { + + let (leg_mint, quote_mint, vault_amount, fixed_size) = match order_type { + OrderType::Sell => { let leg_tokens_to_transfer = Response::get_leg_amount_to_transfer_inner( - leg_amount, - legs_multiplier_bps, + 10_u64.pow(send_mint.decimals as u32), + size, AuthoritySide::Maker, ); + let fixed_size = FixedSize::BaseAsset { + legs_multiplier_bps: size, + }; - (send_mint, receive_mint, leg_tokens_to_transfer) + (send_mint, receive_mint, leg_tokens_to_transfer, fixed_size) } - (OrderType::Buy, FixedSize::QuoteAsset { quote_amount }) => { - (receive_mint, send_mint, quote_amount) + OrderType::Buy => { + let fixed_size = FixedSize::QuoteAsset { quote_amount: size }; + (receive_mint, send_mint, size, fixed_size) } _ => return err!(VaultError::UnsupportedRfqType), }; @@ -135,7 +126,7 @@ pub mod vault_operator { }, base_asset_index: BaseAssetIndex::new(leg_base_asset_index), data: leg_mint.key().to_bytes().to_vec(), - amount: leg_amount, + amount: 10_u64.pow(leg_mint.decimals as u32), amount_decimals: leg_mint.decimals, side: LegSide::Long, }; @@ -160,12 +151,16 @@ pub mod vault_operator { create_accounts, operator_seeds, ) - .with_remaining_accounts(create_remaining_accounts.to_vec()); + .with_remaining_accounts(ctx.remaining_accounts.to_vec()); + + let full_legs: Vec = vec![api_leg.clone().into()]; + let serialized_legs = full_legs.try_to_vec()?; + let legs_hash = solana_program::hash::hash(&serialized_legs); create_rfq_cpi( create_cpi_context, - expected_legs_size, - expected_legs_hash, + serialized_legs.len() as u16, + legs_hash.to_bytes(), vec![api_leg], None, order_type, @@ -205,8 +200,7 @@ pub mod vault_operator { rfq_program.to_account_info(), finalize_accounts, operator_seeds, - ) - .with_remaining_accounts(finalize_remaining_accounts.to_vec()); + ); finalize_rfq_construction(finalize_cpi_context)?; let transfer_accounts = Transfer {