diff --git a/.github/workflows/ci-cargo-audit.yml b/.github/workflows/ci-cargo-audit.yml index b282f369b..2dc6c93f7 100644 --- a/.github/workflows/ci-cargo-audit.yml +++ b/.github/workflows/ci-cargo-audit.yml @@ -35,10 +35,10 @@ jobs: # - RUSTSEC-2020-0071 -> No fixes available, ignored by solana-labs: https://github.com/solana-labs/solana/blob/master/ci/do-audit.sh # - RUSTSEC-2022-0093 -> No fixes available, ignored by solana-labs: https://github.com/solana-labs/solana/blob/master/ci/do-audit.sh # - RUSTSEC-2023-0001 -> No fixes available, ignored by solana-labs: https://github.com/solana-labs/solana/blob/master/ci/do-audit.sh - # - RUSTSEC-2023-0052 -> Fixed in master solana-lab on 29/08/2023, not deployed yet: https://github.com/solana-labs/solana/issues/32933 + # - RUSTSEC-2023-0063 -> Fixed by upgrading to v1.16 solana, ignored by solana-labs before v1.16: https://github.com/solana-labs/solana/pull/33355 run: > cargo audit -c always --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2022-0093 --ignore RUSTSEC-2023-0001 - --ignore RUSTSEC-2023-0052 + --ignore RUSTSEC-2023-0063 diff --git a/Anchor.toml b/Anchor.toml index 479b2a05d..b95cfff15 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -6,7 +6,7 @@ wallet = "~/.config/solana/id.json" uxd = "UXD8m9cvwk4RcSxnX2HZ9VudQCEeDH6fRnB4CAP57Dr" [programs.devnet] -uxd = "EqMrasrCXsbE6mpXaopUH1qip7auwX4AF5UWWpXaLr6u" +uxd = "CW5VzSk7WC4NPyuNt19VFev9FUHhyk5xxHTj2DUWBexu" [registry] url = "https://anchor.projectserum.com" diff --git a/Cargo.lock b/Cargo.lock index 85164474d..dc8b8535f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,16 +60,27 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -103,10 +114,10 @@ checksum = "cf7d535e1381be3de2c0716c0a1c1e32ad9df1042cddcf7bc18d743569e53319" dependencies = [ "anchor-syn 0.26.0", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "regex", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -118,10 +129,10 @@ dependencies = [ "anchor-syn 0.26.0", "anyhow", "bs58 0.4.0", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustversion", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -131,8 +142,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1be64a48e395fe00b8217287f226078be2cf32dae42fdf8a885b997945c3d28" dependencies = [ "anchor-syn 0.26.0", - "proc-macro2 1.0.66", - "syn 1.0.99", + "proc-macro2 1.0.67", + "syn 1.0.109", ] [[package]] @@ -142,9 +153,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38ea6713d1938c0da03656ff8a693b17dc0396da66d1ba320557f07e86eca0d4" dependencies = [ "anchor-syn 0.26.0", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -155,9 +166,9 @@ checksum = "d401f11efb3644285685f8339829a9786d43ed7490bb1699f33c478d04d5a582" dependencies = [ "anchor-syn 0.26.0", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -169,9 +180,9 @@ dependencies = [ "anchor-syn 0.26.0", "anyhow", "heck 0.3.3", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -182,9 +193,9 @@ checksum = "6ad769993b5266714e8939e47fbdede90e5c030333c7522d99a4d4748cf26712" dependencies = [ "anchor-syn 0.26.0", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -195,9 +206,9 @@ checksum = "4e677fae4a016a554acdd0e3b7f178d3acafaa7e7ffac6b8690cf4e171f1c116" dependencies = [ "anchor-syn 0.26.0", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -208,9 +219,9 @@ checksum = "340beef6809d1c3fcc7ae219153d981e95a8a277ff31985bd7050e32645dc9a8" dependencies = [ "anchor-syn 0.26.0", "anyhow", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -230,7 +241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03e8733d55b8492bde0d6f219c25769786758ff9e5e90a16e6a348f91284af50" dependencies = [ "anchor-idl", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -241,7 +252,7 @@ checksum = "7092a50cf959ebf53460162cb07e88d4cc8ea7fa8c45292e80503a3186033daf" dependencies = [ "anchor-idl", "darling", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -253,10 +264,10 @@ dependencies = [ "anchor-syn 0.24.2", "darling", "heck 0.4.1", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "serde_json", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -275,7 +286,7 @@ dependencies = [ "anchor-attribute-state", "anchor-derive-accounts", "arrayref", - "base64 0.13.0", + "base64 0.13.1", "bincode", "borsh 0.9.3", "bytemuck", @@ -304,13 +315,13 @@ dependencies = [ "anyhow", "bs58 0.3.1", "heck 0.3.3", - "proc-macro2 1.0.66", + "proc-macro2 1.0.67", "proc-macro2-diagnostics", - "quote 1.0.31", + "quote 1.0.33", "serde", "serde_json", "sha2 0.9.9", - "syn 1.0.99", + "syn 1.0.109", "thiserror", ] @@ -323,13 +334,13 @@ dependencies = [ "anyhow", "bs58 0.3.1", "heck 0.3.3", - "proc-macro2 1.0.66", + "proc-macro2 1.0.67", "proc-macro2-diagnostics", - "quote 1.0.31", + "quote 1.0.33", "serde", "serde_json", "sha2 0.9.9", - "syn 1.0.99", + "syn 1.0.109", "thiserror", ] @@ -359,21 +370,21 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.62" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ascii" @@ -394,7 +405,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.23", + "time", ] [[package]] @@ -403,9 +414,9 @@ 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", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", "synstructure", ] @@ -415,9 +426,9 @@ 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", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -451,13 +462,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -485,15 +496,15 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -533,9 +544,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitmaps" @@ -584,9 +595,9 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -614,7 +625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" dependencies = [ "borsh-derive 0.10.3", - "hashbrown 0.12.3", + "hashbrown 0.13.2", ] [[package]] @@ -626,8 +637,8 @@ dependencies = [ "borsh-derive-internal 0.9.3", "borsh-schema-derive-internal 0.9.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.66", - "syn 1.0.99", + "proc-macro2 1.0.67", + "syn 1.0.109", ] [[package]] @@ -639,8 +650,8 @@ dependencies = [ "borsh-derive-internal 0.10.3", "borsh-schema-derive-internal 0.10.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.66", - "syn 1.0.99", + "proc-macro2 1.0.67", + "syn 1.0.109", ] [[package]] @@ -649,9 +660,9 @@ 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", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -660,9 +671,9 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -671,9 +682,9 @@ 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", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -682,9 +693,9 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -722,9 +733,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bv" @@ -753,29 +764,29 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" +checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -786,9 +797,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bzip2" @@ -823,11 +834,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -838,25 +850,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] name = "chrono-humanize" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32dce1ea1988dbdf9f9815ff11425828523bd2a134ec0805d2ac8af26ee6096e" +checksum = "799627e6b4d27827a814e837b9d8a504832086081806d45b1afa34dc982b023b" dependencies = [ "chrono", ] @@ -920,16 +931,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "combine" version = "3.8.1" @@ -968,9 +969,9 @@ dependencies = [ [[package]] name = "console_log" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" dependencies = [ "log", "web-sys", @@ -1006,9 +1007,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc948ebb96241bb40ab73effeb80d9f93afaad49359d159a5e61be51619fe813" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1024,9 +1025,9 @@ dependencies = [ [[package]] name = "credix_client" -version = "0.7.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf5e6e889e67a801774577ace6a711e4e79c50d88264578ca557d2bf39a471a" +checksum = "7bfcae67c8c1c89979d09b036dad0fa52747fdd5da125a34bb890a94ed96a09a" dependencies = [ "anchor-gen", "anchor-lang", @@ -1125,50 +1126,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "cxx" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88abab2f5abbe4c56e8f1fb431b784d710b709888f35755a160e62e33fe38e8" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0c11acd0e63bae27dcd2afced407063312771212b7a823b4fd72d633be30fb" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.31", - "scratch", - "syn 2.0.26", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3816ed957c008ccd4728485511e3d9aaf7db419aa321e3d2c5a2f3411e36c8" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", -] - [[package]] name = "darling" version = "0.14.4" @@ -1187,10 +1144,10 @@ checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "strsim 0.10.0", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -1200,8 +1157,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ "darling_core", - "quote 1.0.31", - "syn 1.0.99", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -1239,7 +1196,7 @@ dependencies = [ "asn1-rs", "displaydoc", "nom", - "num-bigint 0.4.3", + "num-bigint 0.4.4", "num-traits", "rusticata-macros", ] @@ -1277,7 +1234,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.2", + "block-buffer 0.10.4", "crypto-common", "subtle", ] @@ -1318,9 +1275,9 @@ 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.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -1389,21 +1346,21 @@ dependencies = [ [[package]] name = "educe" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "079044df30bb07de7d846d41a184c4b00e66ebdac93ee459253474f3a47e50ae" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" dependencies = [ "enum-ordinalize", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] name = "either" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encode_unicode" @@ -1413,9 +1370,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -1435,9 +1392,9 @@ 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", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -1446,11 +1403,11 @@ version = "3.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1" dependencies = [ - "num-bigint 0.4.3", + "num-bigint 0.4.4", "num-traits", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -1460,16 +1417,16 @@ 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.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -1480,9 +1437,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -1519,21 +1476,21 @@ checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -1614,9 +1571,9 @@ 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.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -1660,9 +1617,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "serde", "typenum", @@ -1694,9 +1651,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1718,9 +1675,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1750,7 +1707,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] @@ -1759,7 +1716,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", ] [[package]] @@ -1788,9 +1754,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "histogram" @@ -1858,9 +1824,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -1921,12 +1887,11 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1952,7 +1917,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" dependencies = [ "bitmaps", - "rand_core 0.6.3", + "rand_core 0.6.4", "rand_xoshiro", "rayon", "serde", @@ -2015,18 +1980,18 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -2039,9 +2004,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.59" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -2063,9 +2028,12 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] [[package]] name = "lazy_static" @@ -2075,9 +2043,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libloading" @@ -2089,6 +2057,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + [[package]] name = "libsecp256k1" version = "0.6.0" @@ -2137,15 +2111,6 @@ dependencies = [ "libsecp256k1-core", ] -[[package]] -name = "link-cplusplus" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2154,15 +2119,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -2170,12 +2135,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lru" @@ -2208,15 +2170,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] @@ -2258,7 +2220,7 @@ checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" dependencies = [ "byteorder", "keccak", - "rand_core 0.6.3", + "rand_core 0.6.4", "zeroize", ] @@ -2321,9 +2283,9 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -2377,8 +2339,8 @@ 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 0.4.4", + "num-complex 0.4.4", "num-integer", "num-iter", "num-rational 0.4.1", @@ -2398,9 +2360,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -2419,9 +2381,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -2432,9 +2394,9 @@ 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", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -2477,18 +2439,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint 0.4.3", + "num-bigint 0.4.4", "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2497,7 +2460,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "libc", ] @@ -2516,10 +2479,10 @@ version = "0.5.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", - "syn 1.0.99", + "proc-macro-crate 1.3.1", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -2539,9 +2502,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2598,9 +2561,9 @@ checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -2611,7 +2574,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -2626,9 +2589,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", @@ -2648,7 +2611,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -2675,7 +2638,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", ] [[package]] @@ -2695,29 +2658,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2762,9 +2725,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-crate" @@ -2777,13 +2740,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2793,9 +2755,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", "version_check", ] @@ -2805,8 +2767,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "version_check", ] @@ -2821,9 +2783,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] @@ -2834,31 +2796,31 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", "version_check", "yansi", ] [[package]] name = "proptest" -version = "1.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.6.29", "rusty-fork", "tempfile", + "unarray", ] [[package]] @@ -2876,9 +2838,9 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -2896,12 +2858,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quinn" version = "0.8.5" @@ -2966,11 +2922,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2 1.0.66", + "proc-macro2 1.0.67", ] [[package]] @@ -3000,7 +2956,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -3020,7 +2976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -3034,11 +2990,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.10", ] [[package]] @@ -3056,7 +3012,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -3065,14 +3021,14 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -3080,14 +3036,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -3098,7 +3052,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.23", + "time", "yasna", ] @@ -3126,33 +3080,51 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata", + "regex-syntax 0.7.5", ] +[[package]] +name = "regex-automata" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rend" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] @@ -3164,7 +3136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" dependencies = [ "async-compression", - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -3236,9 +3208,9 @@ version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -3255,14 +3227,12 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.30.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0446843641c69436765a35a5a77088e28c2e6a12da93e84aa3ab1cd4aa5a042" +checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ "arrayvec", "borsh 0.10.3", - "bytecheck", - "byteorder", "bytes", "num-traits", "rand 0.8.5", @@ -3303,11 +3273,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", "linux-raw-sys", @@ -3316,9 +3286,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", "ring", @@ -3344,7 +3314,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", ] [[package]] @@ -3353,14 +3323,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rusty-fork" @@ -3369,16 +3339,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ "fnv", - "quick-error 1.2.3", + "quick-error", "tempfile", "wait-timeout", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -3400,15 +3370,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.7" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scroll" @@ -3425,9 +3389,9 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -3448,9 +3412,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -3461,9 +3425,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -3471,44 +3435,44 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.13" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.7" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -3588,9 +3552,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ "digest 0.10.7", "keccak", @@ -3644,18 +3608,18 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -3674,7 +3638,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c42e1192dfabdf54bdcbb2ecf24f2937751f69eec8e2a2ec7ee6ba59e3784d6c" dependencies = [ "Inflector", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bs58 0.4.0", "bv", @@ -3837,7 +3801,7 @@ checksum = "0b6330cf467acac5fe26021f2c2f8ceaccdb41c14124aa349c7e5838d6778c6c" dependencies = [ "async-mutex", "async-trait", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bs58 0.4.0", "bytes", @@ -3937,7 +3901,7 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "351019a83ce0f3c4e3be94d77478ab05fc63173054008bf7d94c879a2fbecabd" dependencies = [ - "ahash", + "ahash 0.7.6", "blake3", "block-buffer 0.9.0", "bs58 0.4.0", @@ -3953,7 +3917,7 @@ dependencies = [ "log", "memmap2", "once_cell", - "rand_core 0.6.3", + "rand_core 0.6.4", "rustc_version", "serde", "serde_bytes", @@ -3971,10 +3935,10 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbce93c3e02ed81ce0fee3fda2ebd27ff83b2c29e539ac834cef18e6c506b7a" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustc_version", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -4040,7 +4004,7 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c52ab8bd2da5ff24f2be54730dce2052c517bd115f8b51f31d69def1a55110e3" dependencies = [ - "ahash", + "ahash 0.7.6", "bincode", "bv", "caps", @@ -4067,7 +4031,7 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad7bf19fac9aa34717ff346c4588b4cae07f17b6caeca2bca6012101e8214415" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bincode", "bitflags 1.3.2", "blake3", @@ -4080,7 +4044,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "curve25519-dalek", - "getrandom 0.2.7", + "getrandom 0.2.10", "itertools", "js-sys", "lazy_static", @@ -4100,7 +4064,7 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.10.7", - "sha3 0.10.6", + "sha3 0.10.8", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-sdk-macro", @@ -4116,7 +4080,7 @@ version = "1.14.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70b025618e10766f1f8811911441bdace29c3408055898b6fdf145537ee57dbb" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bincode", "eager", "enum-iterator", @@ -4145,7 +4109,7 @@ checksum = "aea4e93389d49aeec046bcbf3c7a8945eb0e825f2e15d55eb820e1f6f1920c68" dependencies = [ "assert_matches", "async-trait", - "base64 0.13.0", + "base64 0.13.1", "bincode", "chrono-humanize", "log", @@ -4259,7 +4223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57788649d5e83cf68188ecc731cf6432a47558e2c85ab919e21e4dcb023fed5b" dependencies = [ "assert_matches", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bitflags 1.3.2", "borsh 0.9.3", @@ -4292,7 +4256,7 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.10.7", - "sha3 0.10.6", + "sha3 0.10.8", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", @@ -4310,10 +4274,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19aa23da3d994c1ede69ff48a0f34f6c7600ae6ea7309344dc357349c463695c" dependencies = [ "bs58 0.4.0", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustversion", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -4390,7 +4354,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bec5cc51e5d23dcbb7648ef4bcdc7a1fcd57683fc9a3c8bfaa5dddf9e8afb86" dependencies = [ "Inflector", - "base64 0.13.0", + "base64 0.13.1", "bincode", "borsh 0.9.3", "bs58 0.4.0", @@ -4472,7 +4436,7 @@ checksum = "616b4b714c1facfc2265c5254ecb270cda5504dd6a9328b584cc94ebb2dd062e" dependencies = [ "aes-gcm-siv", "arrayref", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bytemuck", "byteorder", @@ -4621,10 +4585,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "rustversion", - "syn 1.0.99", + "syn 1.0.109", ] [[package]] @@ -4652,23 +4616,23 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.99" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.26" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", + "proc-macro2 1.0.67", + "quote 1.0.33", "unicode-ident", ] @@ -4678,9 +4642,9 @@ 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", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", "unicode-xid 0.2.4", ] @@ -4692,9 +4656,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -4731,16 +4695,16 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee42b4e559f17bce0385ebf511a7beb67d5cc33c12c96b7f4e9789919d9c10f" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] name = "tempfile" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", @@ -4751,9 +4715,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -4775,22 +4739,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.32" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.32" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -4803,17 +4767,6 @@ dependencies = [ "once_cell", ] -[[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" @@ -4901,9 +4854,9 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 1.0.109", ] [[package]] @@ -4991,9 +4944,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] @@ -5004,6 +4957,17 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -5029,9 +4993,9 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] @@ -5080,7 +5044,7 @@ version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "byteorder", "bytes", "http", @@ -5098,9 +5062,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unarray" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" @@ -5110,9 +5080,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -5125,15 +5095,15 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -5184,9 +5154,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -5207,20 +5177,22 @@ checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" [[package]] name = "uxd" -version = "8.1.4" +version = "8.2.0" dependencies = [ "anchor-lang", "anchor-spl", + "async-trait", "credix_client", "mercurial-vault", "num 0.4.1", "num-traits", "proptest", - "solana-program", + "solana-client", "solana-program-test", "solana-sdk", "spl-associated-token-account", "spl-token", + "time-macros", "toml_datetime", "uxd-cpi", "winnow", @@ -5228,9 +5200,9 @@ dependencies = [ [[package]] name = "uxd-cpi" -version = "8.1.4" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287f52df0ec25823413af8782539a474996c647ff98121d461e5636e901c3fc1" +checksum = "5e6d1988191fb42cd9d73b7a5de2b17ad746d3661718c483b7d33ba8c2e7708f" dependencies = [ "anchor-gen", "anchor-lang", @@ -5273,9 +5245,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -5296,12 +5268,6 @@ 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" @@ -5310,9 +5276,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5320,24 +5286,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.32" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -5347,38 +5313,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.31", + "quote 1.0.33", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 1.0.99", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.59" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -5386,9 +5352,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" dependencies = [ "ring", "untrusted", @@ -5421,9 +5387,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -5440,7 +5406,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -5458,7 +5424,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -5478,17 +5444,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 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 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -5499,9 +5465,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -5511,9 +5477,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -5523,9 +5489,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -5535,9 +5501,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -5547,9 +5513,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -5559,9 +5525,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -5571,9 +5537,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" @@ -5609,7 +5575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ "asn1-rs", - "base64 0.13.0", + "base64 0.13.1", "data-encoding", "der-parser", "lazy_static", @@ -5617,14 +5583,14 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror", - "time 0.3.23", + "time", ] [[package]] name = "xattr" -version = "0.2.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] @@ -5650,7 +5616,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.23", + "time", ] [[package]] @@ -5668,9 +5634,9 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.31", - "syn 2.0.26", + "proc-macro2 1.0.67", + "quote 1.0.33", + "syn 2.0.37", ] [[package]] diff --git a/package-lock.json b/package-lock.json index 876bcbef2..92cd5a8cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "@project-serum/anchor": "0.26.0", "@solana/spl-token": "0.3.7", "@solana/web3.js": "1.73.0", - "@uxd-protocol/uxd-client": "8.1.4-rc1" + "@uxd-protocol/uxd-client": "8.2.0-rc2" }, "devDependencies": { "@types/bn.js": "^5.1.1", @@ -278,9 +278,9 @@ "dev": true }, "node_modules/@uxd-protocol/uxd-client": { - "version": "8.1.4-rc1", - "resolved": "https://registry.npmjs.org/@uxd-protocol/uxd-client/-/uxd-client-8.1.4-rc1.tgz", - "integrity": "sha512-rO8XAJQ00LCHZUX3sZJrsTWcahQJIc4xBCNCXhlPJvTpwuCIzHemat4QOuRYisbgBnqdtg8J+qUUdRvDBlpNlQ==", + "version": "8.2.0-rc2", + "resolved": "https://registry.npmjs.org/@uxd-protocol/uxd-client/-/uxd-client-8.2.0-rc2.tgz", + "integrity": "sha512-VJRnDQzmcOKHI8rIbpciuPke+C518zMQwJR6xhRIU5tGSipsLA9rmKSiOuOkZ8LXmWzCRLclV2P6w+m0HTxxbQ==", "dependencies": { "@project-serum/anchor": "0.26.0", "@solana/spl-token": "0.3.7", @@ -2908,9 +2908,9 @@ "dev": true }, "@uxd-protocol/uxd-client": { - "version": "8.1.4-rc1", - "resolved": "https://registry.npmjs.org/@uxd-protocol/uxd-client/-/uxd-client-8.1.4-rc1.tgz", - "integrity": "sha512-rO8XAJQ00LCHZUX3sZJrsTWcahQJIc4xBCNCXhlPJvTpwuCIzHemat4QOuRYisbgBnqdtg8J+qUUdRvDBlpNlQ==", + "version": "8.2.0-rc2", + "resolved": "https://registry.npmjs.org/@uxd-protocol/uxd-client/-/uxd-client-8.2.0-rc2.tgz", + "integrity": "sha512-VJRnDQzmcOKHI8rIbpciuPke+C518zMQwJR6xhRIU5tGSipsLA9rmKSiOuOkZ8LXmWzCRLclV2P6w+m0HTxxbQ==", "requires": { "@project-serum/anchor": "0.26.0", "@solana/spl-token": "0.3.7", diff --git a/package.json b/package.json index 7ab807f10..15c53dfb1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "@project-serum/anchor": "0.26.0", "@solana/spl-token": "0.3.7", "@solana/web3.js": "1.73.0", - "@uxd-protocol/uxd-client": "8.1.4-rc1" + "@uxd-protocol/uxd-client": "8.2.0-rc2" }, "devDependencies": { "@types/bn.js": "^5.1.1", diff --git a/programs/uxd/Cargo.toml b/programs/uxd/Cargo.toml index d32611e00..a8345f852 100644 --- a/programs/uxd/Cargo.toml +++ b/programs/uxd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uxd" -version = "8.1.4" +version = "8.2.0" authors = [ "acammm ", "cnek ", @@ -27,7 +27,7 @@ production = [] development = [] [dependencies] -uxd-cpi = { version = "8.1.4", features = ["development"] } +uxd-cpi = { version = "8.2.0", features = ["development"] } anchor-lang = "0.26.0" anchor-spl = "0.26.0" @@ -35,7 +35,7 @@ mercurial-vault = { git = "https://github.com/mercurial-finance/vault-sdk", feat "cpi", ], rev = "3724175d8435f7acb7a33077a5a9f1eb58ab3399" } -credix_client = { version = "0.7.5", features = [ +credix_client = { version = "0.9.1", features = [ "pre-mainnet", "cpi", ], default-features = false } @@ -44,11 +44,13 @@ num = "0.4.0" [dev-dependencies] proptest = "1.0.0" -solana-program = "=1.14.21" -solana-program-test = "=1.14.21" +async-trait = "0.1.73" solana-sdk = "=1.14.21" +solana-client = "=1.14.21" +solana-program-test = "=1.14.21" spl-token = "3.5.0" spl-associated-token-account = "1.1.2" toml_datetime = "=0.6.1" # This lib introduced a breaking change in 0.6.2 winnow = "=0.4.1" # This lib introduced a breaking change in 0.4.6 +time-macros = "=0.2.10" # This lib introduced a breaking change in 0.2.11 diff --git a/programs/uxd/src/error.rs b/programs/uxd/src/error.rs index 9e7605240..7395309ed 100644 --- a/programs/uxd/src/error.rs +++ b/programs/uxd/src/error.rs @@ -111,10 +111,10 @@ pub enum UxdError { InvalidCredixPass, #[msg("The Credix Pass doesn't have the fees exemption.")] InvalidCredixPassNoFees, - #[msg("The Credix Multisig Key isn't the ProgramState one.")] - InvalidCredixMultisigKey, - #[msg("The Credix TreasuryCollateral isn't the GlobalMarketState one.")] - InvalidCredixTreasuryCollateral, + #[msg("The Credix Treasury isn't the ProgramState one.")] + InvalidCredixTreasury, + #[msg("The Credix TreasuryPool isn't the GlobalMarketState one.")] + InvalidCredixTreasuryPoolCollateral, #[msg("The Credix WithdrawEpoch isn't in its request phase.")] InvalidCredixWithdrawEpochRequestPhase, #[msg("The Credix WithdrawEpoch isn't in its redeem phase.")] diff --git a/programs/uxd/src/instructions/credix_lp/collect_profits_of_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/collect_profits_of_credix_lp_depository.rs index 5a94251a9..38cf1b7b2 100644 --- a/programs/uxd/src/instructions/credix_lp/collect_profits_of_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/collect_profits_of_credix_lp_depository.rs @@ -70,14 +70,14 @@ pub struct CollectProfitsOfCredixLpDepository<'info> { /// #7 #[account( - has_one = credix_multisig_key @UxdError::InvalidCredixMultisigKey, + has_one = credix_treasury @UxdError::InvalidCredixTreasury, )] pub credix_program_state: Box>, /// #8 #[account( mut, - constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_collateral.key() @UxdError::InvalidCredixTreasuryCollateral, + constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_pool_collateral.key() @UxdError::InvalidCredixTreasuryPoolCollateral, )] pub credix_global_market_state: Box>, @@ -105,7 +105,7 @@ pub struct CollectProfitsOfCredixLpDepository<'info> { bump, seeds::program = credix_client::ID, constraint = credix_pass.user == depository.key() @UxdError::InvalidCredixPass, - constraint = credix_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_pass: Account<'info, credix_client::CredixPass>, @@ -114,19 +114,19 @@ pub struct CollectProfitsOfCredixLpDepository<'info> { mut, token::mint = collateral_mint, )] - pub credix_treasury_collateral: Box>, + pub credix_treasury_pool_collateral: Box>, /// #14 /// CHECK: not used by us, checked by credix program - pub credix_multisig_key: AccountInfo<'info>, + pub credix_treasury: AccountInfo<'info>, /// #15 #[account( mut, - token::authority = credix_multisig_key, + token::authority = credix_treasury, token::mint = collateral_mint, )] - pub credix_multisig_collateral: Box>, + pub credix_treasury_collateral: Box>, /// #16 #[account( @@ -436,9 +436,9 @@ impl<'info> CollectProfitsOfCredixLpDepository<'info> { liquidity_pool_token_account: self.credix_liquidity_collateral.to_account_info(), lp_token_mint: self.credix_shares_mint.to_account_info(), credix_pass: self.credix_pass.to_account_info(), - treasury_pool_token_account: self.credix_treasury_collateral.to_account_info(), - credix_multisig_key: self.credix_multisig_key.to_account_info(), - credix_multisig_token_account: self.credix_multisig_collateral.to_account_info(), + treasury_pool_token_account: self.credix_treasury_pool_collateral.to_account_info(), + credix_treasury: self.credix_treasury.to_account_info(), + credix_treasury_token_account: self.credix_treasury_collateral.to_account_info(), system_program: self.system_program.to_account_info(), token_program: self.token_program.to_account_info(), associated_token_program: self.associated_token_program.to_account_info(), diff --git a/programs/uxd/src/instructions/credix_lp/mint_with_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/mint_with_credix_lp_depository.rs index 5ef2c782e..2c0529aed 100644 --- a/programs/uxd/src/instructions/credix_lp/mint_with_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/mint_with_credix_lp_depository.rs @@ -129,7 +129,7 @@ pub struct MintWithCredixLpDepository<'info> { bump, seeds::program = credix_client::ID, constraint = credix_pass.user == depository.key() @UxdError::InvalidCredixPass, - constraint = credix_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_pass: Account<'info, credix_client::CredixPass>, diff --git a/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs index d04f2d2d1..4f37aa8ac 100644 --- a/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs @@ -18,7 +18,6 @@ use crate::CONTROLLER_NAMESPACE; use crate::CREDIX_LP_DEPOSITORY_NAMESPACE; use crate::CREDIX_LP_EXTERNAL_PASS_NAMESPACE; use crate::CREDIX_LP_EXTERNAL_WITHDRAW_EPOCH_NAMESPACE; -use crate::CREDIX_LP_EXTERNAL_WITHDRAW_REQUEST_NAMESPACE; use crate::IDENTITY_DEPOSITORY_NAMESPACE; use crate::MERCURIAL_VAULT_DEPOSITORY_NAMESPACE; @@ -110,7 +109,7 @@ pub struct RebalanceCreateWithdrawRequestFromCredixLpDepository<'info> { bump, seeds::program = credix_client::ID, constraint = credix_pass.user == depository.key() @UxdError::InvalidCredixPass, - constraint = credix_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_pass: Account<'info, credix_client::CredixPass>, @@ -129,23 +128,8 @@ pub struct RebalanceCreateWithdrawRequestFromCredixLpDepository<'info> { pub credix_withdraw_epoch: Account<'info, credix_client::WithdrawEpoch>, /// #14 - /// CHECK: initialized by credix program, not manipulated by us - #[account( - mut, - seeds = [ - credix_global_market_state.key().as_ref(), - depository.key().as_ref(), - &credix_global_market_state.latest_withdraw_epoch_idx.to_le_bytes(), - CREDIX_LP_EXTERNAL_WITHDRAW_REQUEST_NAMESPACE - ], - bump, - seeds::program = credix_client::ID, - )] - pub credix_withdraw_request: AccountInfo<'info>, - - /// #15 pub system_program: Program<'info, System>, - /// #16 + /// #15 pub credix_program: Program<'info, credix_client::program::Credix>, } @@ -273,7 +257,6 @@ impl<'info> RebalanceCreateWithdrawRequestFromCredixLpDepository<'info> { lp_token_mint: self.credix_shares_mint.to_account_info(), credix_pass: self.credix_pass.to_account_info(), withdraw_epoch: self.credix_withdraw_epoch.to_account_info(), - withdraw_request: self.credix_withdraw_request.to_account_info(), system_program: self.system_program.to_account_info(), }; let cpi_program = self.credix_program.to_account_info(); diff --git a/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs index 5a2f9de2c..95f0acfc2 100644 --- a/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs @@ -15,8 +15,6 @@ use crate::state::mercurial_vault_depository::MercurialVaultDepository; use crate::utils::calculate_credix_lp_depository_target_amount; use crate::utils::checked_add; use crate::utils::checked_as_u64; -use crate::utils::checked_div; -use crate::utils::checked_mul; use crate::utils::checked_sub; use crate::utils::compute_decrease; use crate::utils::compute_increase; @@ -28,7 +26,6 @@ use crate::CONTROLLER_NAMESPACE; use crate::CREDIX_LP_DEPOSITORY_NAMESPACE; use crate::CREDIX_LP_EXTERNAL_PASS_NAMESPACE; use crate::CREDIX_LP_EXTERNAL_WITHDRAW_EPOCH_NAMESPACE; -use crate::CREDIX_LP_EXTERNAL_WITHDRAW_REQUEST_NAMESPACE; use crate::IDENTITY_DEPOSITORY_COLLATERAL_NAMESPACE; use crate::IDENTITY_DEPOSITORY_NAMESPACE; use crate::MERCURIAL_VAULT_DEPOSITORY_NAMESPACE; @@ -113,14 +110,14 @@ pub struct RebalanceRedeemWithdrawRequestFromCredixLpDepository<'info> { /// #10 #[account( - has_one = credix_multisig_key @UxdError::InvalidCredixMultisigKey, + has_one = credix_treasury @UxdError::InvalidCredixTreasury, )] pub credix_program_state: Box>, /// #11 #[account( mut, - constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_collateral.key() @UxdError::InvalidCredixTreasuryCollateral, + constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_pool_collateral.key() @UxdError::InvalidCredixTreasuryPoolCollateral, )] pub credix_global_market_state: Box>, @@ -148,7 +145,7 @@ pub struct RebalanceRedeemWithdrawRequestFromCredixLpDepository<'info> { bump, seeds::program = credix_client::ID, constraint = credix_pass.user == depository.key() @UxdError::InvalidCredixPass, - constraint = credix_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_pass: Account<'info, credix_client::CredixPass>, @@ -157,19 +154,19 @@ pub struct RebalanceRedeemWithdrawRequestFromCredixLpDepository<'info> { mut, token::mint = collateral_mint, )] - pub credix_treasury_collateral: Box>, + pub credix_treasury_pool_collateral: Box>, /// #17 /// CHECK: not used by us, checked by credix program - pub credix_multisig_key: AccountInfo<'info>, + pub credix_treasury: AccountInfo<'info>, /// #18 #[account( mut, - token::authority = credix_multisig_key, + token::authority = credix_treasury, token::mint = collateral_mint, )] - pub credix_multisig_collateral: Box>, + pub credix_treasury_collateral: Box>, /// #19 #[account( @@ -186,36 +183,21 @@ pub struct RebalanceRedeemWithdrawRequestFromCredixLpDepository<'info> { pub credix_withdraw_epoch: Account<'info, credix_client::WithdrawEpoch>, /// #20 - #[account( - mut, - owner = credix_client::ID, - seeds = [ - credix_global_market_state.key().as_ref(), - depository.key().as_ref(), - &credix_global_market_state.latest_withdraw_epoch_idx.to_le_bytes(), - CREDIX_LP_EXTERNAL_WITHDRAW_REQUEST_NAMESPACE - ], - bump, - seeds::program = credix_client::ID, - )] - pub credix_withdraw_request: Account<'info, credix_client::WithdrawRequest>, - - /// #21 #[account( mut, token::mint = collateral_mint, )] pub profits_beneficiary_collateral: Box>, - /// #22 + /// #21 pub system_program: Program<'info, System>, - /// #23 + /// #22 pub token_program: Program<'info, Token>, - /// #24 + /// #23 pub associated_token_program: Program<'info, AssociatedToken>, - /// #25 + /// #24 pub credix_program: Program<'info, credix_client::program::Credix>, - /// #26 + /// #25 pub rent: Sysvar<'info, Rent>, } @@ -325,35 +307,11 @@ pub(crate) fn handler( // -- And where the withdrawn collateral will be going (profits or rebalanced) // --------------------------------------------------------------------- - let withdrawable_total_collateral_amount = { - // Read credix withdrawal accounts onchain state - let locked_liquidity = ctx.accounts.credix_global_market_state.locked_liquidity; - let investor_total_lp_amount = ctx - .accounts - .credix_withdraw_request - .investor_total_lp_amount; - let participating_investors_total_lp_amount = ctx - .accounts - .credix_withdraw_epoch - .participating_investors_total_lp_amount; - // All investors gets an equivalent slice of the locked liquidity, - // based on their relative position size in the lp pool - // Note: all intermediary maths is in u128 because we are doing u64 multiplications - let withdrawable_base_amount = checked_as_u64(checked_div::( - checked_mul::( - u128::from(locked_liquidity), - u128::from(investor_total_lp_amount), - )?, - u128::from(participating_investors_total_lp_amount), - )?)?; - // Finished, just need to take into account the amount already withdrawn and the requested amount - let requested_base_amount = ctx.accounts.credix_withdraw_request.base_amount; - let withdrawn_base_amount = ctx.accounts.credix_withdraw_request.base_amount_withdrawn; - std::cmp::min( - checked_sub(requested_base_amount, withdrawn_base_amount)?, - checked_sub(withdrawable_base_amount, withdrawn_base_amount)?, - ) - }; + let withdrawable_total_collateral_amount = + ctx.accounts.credix_withdraw_epoch.max_withdrawable_amount( + &ctx.accounts.credix_global_market_state, + ctx.accounts.depository.key(), + )?; // How much we CAN withdraw now (may be lower than how much we want) msg!( @@ -638,11 +596,10 @@ impl<'info> RebalanceRedeemWithdrawRequestFromCredixLpDepository<'info> { liquidity_pool_token_account: self.credix_liquidity_collateral.to_account_info(), lp_token_mint: self.credix_shares_mint.to_account_info(), credix_pass: self.credix_pass.to_account_info(), - treasury_pool_token_account: self.credix_treasury_collateral.to_account_info(), - credix_multisig_key: self.credix_multisig_key.to_account_info(), - credix_multisig_token_account: self.credix_multisig_collateral.to_account_info(), + treasury_pool_token_account: self.credix_treasury_pool_collateral.to_account_info(), + credix_treasury: self.credix_treasury.to_account_info(), + credix_treasury_token_account: self.credix_treasury_collateral.to_account_info(), withdraw_epoch: self.credix_withdraw_epoch.to_account_info(), - withdraw_request: self.credix_withdraw_request.to_account_info(), system_program: self.system_program.to_account_info(), token_program: self.token_program.to_account_info(), associated_token_program: self.associated_token_program.to_account_info(), diff --git a/programs/uxd/src/instructions/credix_lp/redeem_from_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/redeem_from_credix_lp_depository.rs index 60d797beb..810d6665a 100644 --- a/programs/uxd/src/instructions/credix_lp/redeem_from_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/redeem_from_credix_lp_depository.rs @@ -98,14 +98,14 @@ pub struct RedeemFromCredixLpDepository<'info> { /// #11 #[account( - has_one = credix_multisig_key @UxdError::InvalidCredixMultisigKey, + has_one = credix_treasury @UxdError::InvalidCredixTreasury, )] pub credix_program_state: Box>, /// #12 #[account( mut, - constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_collateral.key() @UxdError::InvalidCredixTreasuryCollateral, + constraint = credix_global_market_state.treasury_pool_token_account == credix_treasury_pool_collateral.key() @UxdError::InvalidCredixTreasuryPoolCollateral, )] pub credix_global_market_state: Box>, @@ -132,7 +132,7 @@ pub struct RedeemFromCredixLpDepository<'info> { bump, seeds::program = credix_client::ID, constraint = credix_pass.user == depository.key() @UxdError::InvalidCredixPass, - constraint = credix_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_pass: Account<'info, credix_client::CredixPass>, @@ -141,19 +141,19 @@ pub struct RedeemFromCredixLpDepository<'info> { mut, token::mint = collateral_mint, )] - pub credix_treasury_collateral: Box>, + pub credix_treasury_pool_collateral: Box>, /// #18 /// CHECK: not used by us, checked by credix program - pub credix_multisig_key: AccountInfo<'info>, + pub credix_treasury: AccountInfo<'info>, /// #19 #[account( mut, - token::authority = credix_multisig_key, + token::authority = credix_treasury, token::mint = collateral_mint, )] - pub credix_multisig_collateral: Box>, + pub credix_treasury_collateral: Box>, /// #20 pub system_program: Program<'info, System>, @@ -469,9 +469,9 @@ impl<'info> RedeemFromCredixLpDepository<'info> { liquidity_pool_token_account: self.credix_liquidity_collateral.to_account_info(), lp_token_mint: self.credix_shares_mint.to_account_info(), credix_pass: self.credix_pass.to_account_info(), - treasury_pool_token_account: self.credix_treasury_collateral.to_account_info(), - credix_multisig_key: self.credix_multisig_key.to_account_info(), - credix_multisig_token_account: self.credix_multisig_collateral.to_account_info(), + treasury_pool_token_account: self.credix_treasury_pool_collateral.to_account_info(), + credix_treasury: self.credix_treasury.to_account_info(), + credix_treasury_token_account: self.credix_treasury_collateral.to_account_info(), system_program: self.system_program.to_account_info(), token_program: self.token_program.to_account_info(), associated_token_program: self.associated_token_program.to_account_info(), diff --git a/programs/uxd/src/instructions/mint.rs b/programs/uxd/src/instructions/mint.rs index b90fb6095..565a572fe 100644 --- a/programs/uxd/src/instructions/mint.rs +++ b/programs/uxd/src/instructions/mint.rs @@ -154,7 +154,7 @@ pub struct Mint<'info> { bump, seeds::program = credix_client::ID, constraint = credix_lp_depository_pass.user == credix_lp_depository.key() @UxdError::InvalidCredixPass, - constraint = credix_lp_depository_pass.disable_withdrawal_fee @UxdError::InvalidCredixPassNoFees, + constraint = credix_lp_depository_pass.disable_withdrawal_fee() @UxdError::InvalidCredixPassNoFees, )] pub credix_lp_depository_pass: Account<'info, credix_client::CredixPass>, diff --git a/programs/uxd/src/lib.rs b/programs/uxd/src/lib.rs index c64a292b2..0ae97eba0 100644 --- a/programs/uxd/src/lib.rs +++ b/programs/uxd/src/lib.rs @@ -15,7 +15,7 @@ pub mod utils; // CI Uses F3UToS4WKQkyAAs5TwM_21ANq2xNfDRB7tGRWx4DxapaR on Devnet // (it's auto swapped by the script, keypair are held in target/deployment) #[cfg(feature = "development")] -declare_id!("EqMrasrCXsbE6mpXaopUH1qip7auwX4AF5UWWpXaLr6u"); +declare_id!("CW5VzSk7WC4NPyuNt19VFev9FUHhyk5xxHTj2DUWBexu"); #[cfg(feature = "production")] declare_id!("UXD8m9cvwk4RcSxnX2HZ9VudQCEeDH6fRnB4CAP57Dr"); @@ -37,7 +37,6 @@ pub const IDENTITY_DEPOSITORY_COLLATERAL_NAMESPACE: &[u8] = b"IDENTITYDEPOSITORY pub const CREDIX_LP_DEPOSITORY_NAMESPACE: &[u8] = b"CREDIX_LP_DEPOSITORY"; pub const CREDIX_LP_EXTERNAL_PASS_NAMESPACE: &[u8] = b"credix-pass"; pub const CREDIX_LP_EXTERNAL_WITHDRAW_EPOCH_NAMESPACE: &[u8] = b"withdraw-epoch"; -pub const CREDIX_LP_EXTERNAL_WITHDRAW_REQUEST_NAMESPACE: &[u8] = b"withdraw-request"; pub const MAX_REDEEMABLE_GLOBAL_SUPPLY_CAP: u128 = u128::MAX; diff --git a/programs/uxd/tests/integration_tests/api/mod.rs b/programs/uxd/tests/integration_tests/api/mod.rs index 05590050f..c26381790 100644 --- a/programs/uxd/tests/integration_tests/api/mod.rs +++ b/programs/uxd/tests/integration_tests/api/mod.rs @@ -1,5 +1,5 @@ +pub mod program_context; pub mod program_credix; pub mod program_mercurial; pub mod program_spl; -pub mod program_test_context; pub mod program_uxd; diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/create_program_test_context.rs b/programs/uxd/tests/integration_tests/api/program_context/create_program_test_context.rs similarity index 100% rename from programs/uxd/tests/integration_tests/api/program_test_context/create_program_test_context.rs rename to programs/uxd/tests/integration_tests/api/program_context/create_program_test_context.rs diff --git a/programs/uxd/tests/integration_tests/api/program_context/mod.rs b/programs/uxd/tests/integration_tests/api/program_context/mod.rs new file mode 100644 index 000000000..861e0a43a --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/mod.rs @@ -0,0 +1,15 @@ +pub mod create_program_test_context; +pub mod process_instruction; +pub mod program_context_rpc; +pub mod program_context_test; +pub mod program_context_trait; +pub mod program_error; +pub mod read_account; + +pub use create_program_test_context::*; +pub use process_instruction::*; +pub use program_context_rpc::*; +pub use program_context_test::*; +pub use program_context_trait::*; +pub use program_error::*; +pub use read_account::*; diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/process_instruction.rs b/programs/uxd/tests/integration_tests/api/program_context/process_instruction.rs similarity index 51% rename from programs/uxd/tests/integration_tests/api/program_test_context/process_instruction.rs rename to programs/uxd/tests/integration_tests/api/program_context/process_instruction.rs index 3da73c358..f63098d02 100644 --- a/programs/uxd/tests/integration_tests/api/program_test_context/process_instruction.rs +++ b/programs/uxd/tests/integration_tests/api/program_context/process_instruction.rs @@ -1,23 +1,14 @@ -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestBanksClientExt; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use solana_sdk::transaction::Transaction; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; async fn process_instruction_result( - program_test_context: &mut ProgramTestContext, instruction: Instruction, - result: Result<(), program_test_context::ProgramTestError>, -) -> Result<(), program_test_context::ProgramTestError> { - // Increment the blockhash, so that the next transaction can run sequentially - program_test_context.last_blockhash = program_test_context - .banks_client - .get_new_latest_blockhash(&program_test_context.last_blockhash) - .await - .map_err(program_test_context::ProgramTestError::Io)?; + result: Result<(), program_context::ProgramError>, +) -> Result<(), program_context::ProgramError> { // Log the result, useful for debugging as STDOUT is displayed when a test fails println!(" -------- PROCESSING INSTRUCTION --------"); println!( @@ -53,53 +44,44 @@ async fn process_instruction_result( } pub async fn process_instruction( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, instruction: Instruction, payer: &Keypair, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { + let latest_blockhash = program_context.get_latest_blockhash().await?; let mut transaction: Transaction = Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey())); - transaction.partial_sign(&[payer], program_test_context.last_blockhash); - let result = program_test_context - .banks_client - .process_transaction(transaction) - .await - .map_err(program_test_context::ProgramTestError::BanksClient); - process_instruction_result(program_test_context, instruction.clone(), result).await + transaction.partial_sign(&[payer], latest_blockhash); + let result = program_context.process_transaction(transaction).await; + process_instruction_result(instruction.clone(), result).await } pub async fn process_instruction_with_signer( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, instruction: Instruction, payer: &Keypair, signer: &Keypair, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { + let latest_blockhash = program_context.get_latest_blockhash().await?; let mut transaction: Transaction = Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey())); - transaction.partial_sign(&[payer, signer], program_test_context.last_blockhash); - let result = program_test_context - .banks_client - .process_transaction(transaction) - .await - .map_err(program_test_context::ProgramTestError::BanksClient); - process_instruction_result(program_test_context, instruction.clone(), result).await + transaction.partial_sign(&[payer, signer], latest_blockhash); + let result = program_context.process_transaction(transaction).await; + process_instruction_result(instruction.clone(), result).await } pub async fn process_instruction_with_signers( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, instruction: Instruction, payer: &Keypair, signers: &[&Keypair], -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { + let latest_blockhash = program_context.get_latest_blockhash().await?; let mut transaction: Transaction = Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey())); let mut keypairs = signers.to_owned(); keypairs.push(payer); - transaction.partial_sign(&keypairs, program_test_context.last_blockhash); - let result = program_test_context - .banks_client - .process_transaction(transaction) - .await - .map_err(program_test_context::ProgramTestError::BanksClient); - process_instruction_result(program_test_context, instruction.clone(), result).await + transaction.partial_sign(&keypairs, latest_blockhash); + let result = program_context.process_transaction(transaction).await; + process_instruction_result(instruction.clone(), result).await } diff --git a/programs/uxd/tests/integration_tests/api/program_context/program_context_rpc.rs b/programs/uxd/tests/integration_tests/api/program_context/program_context_rpc.rs new file mode 100644 index 000000000..34588094d --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/program_context_rpc.rs @@ -0,0 +1,86 @@ +use solana_client::nonblocking::rpc_client::RpcClient; +use solana_sdk::account::Account; +use solana_sdk::commitment_config::CommitmentConfig; +use solana_sdk::hash::Hash; +use solana_sdk::pubkey::Pubkey; +use solana_sdk::sysvar::clock::Clock; +use solana_sdk::sysvar::Sysvar; +use solana_sdk::transaction::Transaction; + +use async_trait::async_trait; + +use crate::integration_tests::api::program_context; + +#[async_trait] +impl program_context::ProgramContext for RpcClient { + async fn get_latest_blockhash(&mut self) -> Result { + RpcClient::get_latest_blockhash(self) + .await + .map_err(program_context::ProgramError::Client) + } + + async fn get_rent_minimum_balance( + &mut self, + space: usize, + ) -> Result { + self.get_minimum_balance_for_rent_exemption(space) + .await + .map_err(program_context::ProgramError::Client) + } + + async fn get_clock(&mut self) -> Result { + Clock::get().map_err(program_context::ProgramError::Program) + } + + async fn get_account( + &mut self, + address: &Pubkey, + ) -> Result, program_context::ProgramError> { + let response = self + .get_account_with_commitment(address, CommitmentConfig::processed()) + .await + .map_err(program_context::ProgramError::Client)?; + Ok(response.value) + } + + async fn process_transaction( + &mut self, + transaction: Transaction, + ) -> Result<(), program_context::ProgramError> { + let signature = self + .send_transaction(&transaction) + .await + .map_err(program_context::ProgramError::Client)?; + println!("process_transaction signature:{:?}", signature); + loop { + let confirmed = self + .confirm_transaction(&signature) + .await + .map_err(program_context::ProgramError::Client)?; + if confirmed { + break; + } + } + Ok(()) + } + + async fn process_airdrop( + &mut self, + _to: &Pubkey, + _lamports: u64, + ) -> Result<(), program_context::ProgramError> { + Err(program_context::ProgramError::Custom( + "Airdrop not supported", + )) + } + + async fn move_clock_forward( + &mut self, + _unix_timestamp_delta: u64, + _slot_delta: u64, + ) -> Result<(), program_context::ProgramError> { + Err(program_context::ProgramError::Custom( + "Clock forward not supported", + )) + } +} diff --git a/programs/uxd/tests/integration_tests/api/program_context/program_context_test.rs b/programs/uxd/tests/integration_tests/api/program_context/program_context_test.rs new file mode 100644 index 000000000..2697ab237 --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/program_context_test.rs @@ -0,0 +1,99 @@ +use solana_program_test::ProgramTestBanksClientExt; +use solana_program_test::ProgramTestContext; +use solana_sdk::account::Account; +use solana_sdk::hash::Hash; +use solana_sdk::pubkey::Pubkey; +use solana_sdk::signer::keypair::Keypair; +use solana_sdk::signer::Signer; +use solana_sdk::sysvar::clock::Clock; +use solana_sdk::transaction::Transaction; + +use async_trait::async_trait; + +use crate::integration_tests::api::program_context; + +#[async_trait] +impl program_context::ProgramContext for ProgramTestContext { + async fn get_latest_blockhash(&mut self) -> Result { + Ok(self.last_blockhash) + } + + async fn get_rent_minimum_balance( + &mut self, + space: usize, + ) -> Result { + let rent = self + .banks_client + .get_rent() + .await + .map_err(program_context::ProgramError::BanksClient)?; + Ok(rent.minimum_balance(space)) + } + + async fn get_clock(&mut self) -> Result { + let clock = self + .banks_client + .get_sysvar::() + .await + .map_err(program_context::ProgramError::BanksClient)?; + Ok(clock) + } + + async fn get_account( + &mut self, + address: &Pubkey, + ) -> Result, program_context::ProgramError> { + self.banks_client + .get_account(*address) + .await + .map_err(program_context::ProgramError::BanksClient) + } + + async fn process_transaction( + &mut self, + transaction: Transaction, + ) -> Result<(), program_context::ProgramError> { + self.last_blockhash = self + .banks_client + .get_new_latest_blockhash(&self.last_blockhash) + .await + .map_err(program_context::ProgramError::Io)?; + self.banks_client + .process_transaction(transaction) + .await + .map_err(program_context::ProgramError::BanksClient) + } + + async fn process_airdrop( + &mut self, + to: &Pubkey, + lamports: u64, + ) -> Result<(), program_context::ProgramError> { + let from = Keypair::from_bytes(&self.payer.to_bytes()) + .map_err(|e| program_context::ProgramError::Signature(e.to_string()))?; + let instruction = solana_sdk::system_instruction::transfer(&from.pubkey(), to, lamports); + let latest_blockhash = self.get_latest_blockhash().await?; + let mut transaction: Transaction = + Transaction::new_with_payer(&[instruction.clone()], Some(&from.pubkey())); + transaction.partial_sign(&[&from], latest_blockhash); + self.process_transaction(transaction).await + } + + async fn move_clock_forward( + &mut self, + unix_timestamp_delta: u64, + slot_delta: u64, + ) -> Result<(), program_context::ProgramError> { + let current_clock = self + .banks_client + .get_sysvar::() + .await + .map_err(program_context::ProgramError::BanksClient)?; + let mut forwarded_clock = current_clock; + forwarded_clock.epoch += 1; + forwarded_clock.slot += slot_delta; + forwarded_clock.unix_timestamp += i64::try_from(unix_timestamp_delta).unwrap(); + self.set_sysvar::(&forwarded_clock); + Ok(()) + } +} diff --git a/programs/uxd/tests/integration_tests/api/program_context/program_context_trait.rs b/programs/uxd/tests/integration_tests/api/program_context/program_context_trait.rs new file mode 100644 index 000000000..e39186615 --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/program_context_trait.rs @@ -0,0 +1,43 @@ +use solana_sdk::account::Account; +use solana_sdk::hash::Hash; +use solana_sdk::pubkey::Pubkey; +use solana_sdk::sysvar::clock::Clock; +use solana_sdk::transaction::Transaction; + +use async_trait::async_trait; + +use crate::integration_tests::api::program_context; + +#[async_trait] +pub trait ProgramContext { + async fn get_latest_blockhash(&mut self) -> Result; + + async fn get_rent_minimum_balance( + &mut self, + space: usize, + ) -> Result; + + async fn get_clock(&mut self) -> Result; + + async fn get_account( + &mut self, + address: &Pubkey, + ) -> Result, program_context::ProgramError>; + + async fn process_transaction( + &mut self, + transaction: Transaction, + ) -> Result<(), program_context::ProgramError>; + + async fn process_airdrop( + &mut self, + to: &Pubkey, + lamports: u64, + ) -> Result<(), program_context::ProgramError>; + + async fn move_clock_forward( + &mut self, + unix_timestamp_delta: u64, + slot_delta: u64, + ) -> Result<(), program_context::ProgramError>; +} diff --git a/programs/uxd/tests/integration_tests/api/program_context/program_error.rs b/programs/uxd/tests/integration_tests/api/program_context/program_error.rs new file mode 100644 index 000000000..efd22ae88 --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/program_error.rs @@ -0,0 +1,10 @@ +#[derive(Debug)] +pub enum ProgramError { + BanksClient(solana_program_test::BanksClientError), + Client(solana_client::client_error::ClientError), + Signature(String), + Program(solana_sdk::program_error::ProgramError), + Anchor(anchor_lang::error::Error), + Io(std::io::Error), + Custom(&'static str), +} diff --git a/programs/uxd/tests/integration_tests/api/program_context/read_account.rs b/programs/uxd/tests/integration_tests/api/program_context/read_account.rs new file mode 100644 index 000000000..4bf42d6ad --- /dev/null +++ b/programs/uxd/tests/integration_tests/api/program_context/read_account.rs @@ -0,0 +1,41 @@ +use crate::integration_tests::api::program_context; +use anchor_lang::AccountDeserialize; +use solana_sdk::program_pack::IsInitialized; +use solana_sdk::program_pack::Pack; +use solana_sdk::pubkey::Pubkey; + +pub async fn read_account_exists( + program_context: &mut Box, + address: &Pubkey, +) -> Result { + Ok(program_context.get_account(address).await?.is_some()) +} + +pub async fn read_account_data( + program_context: &mut Box, + address: &Pubkey, +) -> Result, program_context::ProgramError> { + let raw_account = program_context + .get_account(address) + .await? + .ok_or(program_context::ProgramError::Custom("AccountDoesNotExist"))?; + Ok(raw_account.data) +} + +pub async fn read_account_anchor( + program_context: &mut Box, + address: &Pubkey, +) -> Result { + let raw_account_data = program_context::read_account_data(program_context, address).await?; + let mut raw_account_slice: &[u8] = &raw_account_data; + T::try_deserialize(&mut raw_account_slice).map_err(program_context::ProgramError::Anchor) +} + +pub async fn read_account_packed( + program_context: &mut Box, + address: &Pubkey, +) -> Result { + let raw_account_data = program_context::read_account_data(program_context, address).await?; + let raw_account_slice: &[u8] = &raw_account_data; + T::unpack(raw_account_slice).map_err(program_context::ProgramError::Program) +} diff --git a/programs/uxd/tests/integration_tests/api/program_credix/accounts/find_pdas.rs b/programs/uxd/tests/integration_tests/api/program_credix/accounts/find_pdas.rs index 4e0886723..75b6e2dc2 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/accounts/find_pdas.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/accounts/find_pdas.rs @@ -1,6 +1,5 @@ -use solana_program::pubkey::Pubkey; - -const CREDIX_MARKETPLACE_SEED: &str = "this-can-be-whatever"; +use solana_sdk::pubkey::Pubkey; +const CREDIX_MARKETPLACE_SEED: &str = "credix-marketplace"; pub fn find_market_seeds() -> String { String::from(CREDIX_MARKETPLACE_SEED) @@ -33,12 +32,26 @@ pub fn find_liquidity_pool_token_account( spl_associated_token_account::get_associated_token_address(signing_authority, base_token_mint) } -pub fn find_treasury(multisig: &Pubkey) -> Pubkey { - *multisig // The treasury is the same key as the multisig on mainnet +pub fn find_credix_treasury(multisig: &Pubkey) -> Pubkey { + *multisig // The treasury is an abritrary wallet that collect the fees } -pub fn find_treasury_pool_token_account(treasury: &Pubkey, base_token_mint: &Pubkey) -> Pubkey { - spl_associated_token_account::get_associated_token_address(treasury, base_token_mint) +pub fn find_credix_treasury_token_account( + credix_treasury: &Pubkey, + base_token_mint: &Pubkey, +) -> Pubkey { + spl_associated_token_account::get_associated_token_address(credix_treasury, base_token_mint) +} + +pub fn find_treasury_pool(multisig: &Pubkey) -> Pubkey { + *multisig // The treasury_pool is an abritrary wallet that collect the fees +} + +pub fn find_treasury_pool_token_account( + treasury_pool: &Pubkey, + base_token_mint: &Pubkey, +) -> Pubkey { + spl_associated_token_account::get_associated_token_address(treasury_pool, base_token_mint) } pub fn find_credix_pass_pda(global_market_state: &Pubkey, pass_holder: &Pubkey) -> (Pubkey, u8) { @@ -72,11 +85,3 @@ pub fn find_repayment_schedule_pda(global_market_state: &Pubkey, deal: &Pubkey) pub fn find_withdraw_epoch_pda(global_market_state: &Pubkey, epoch_idx: u32) -> (Pubkey, u8) { credix_client::WithdrawEpoch::generate_pda(*global_market_state, epoch_idx) } - -pub fn find_withdraw_request_pda( - global_market_state: &Pubkey, - investor: &Pubkey, - epoch_idx: u32, -) -> (Pubkey, u8) { - credix_client::WithdrawRequest::generate_pda(*global_market_state, *investor, epoch_idx) -} diff --git a/programs/uxd/tests/integration_tests/api/program_credix/binaries/dump.sh b/programs/uxd/tests/integration_tests/api/program_credix/binaries/dump.sh deleted file mode 100644 index d56be448c..000000000 --- a/programs/uxd/tests/integration_tests/api/program_credix/binaries/dump.sh +++ /dev/null @@ -1,8 +0,0 @@ -solana config set --url https://api.devnet.solana.com -solana program dump crdszSnZQu7j36KfsMJ4VEmMUTJgrNYXwoPVHUANpAu executable-devnet.so - -solana config set --url https://api.devnet.solana.com -solana program dump crdRi38zEhQdzpsxnKur73WHBM9BSvXMSfGcbLyJCdP executable-pre-mainnet.so - -solana config set --url https://api.mainnet-beta.solana.com -solana program dump CRDx2YkdtYtGZXGHZ59wNv1EwKHQndnRc1gT4p8i2vPX executable-mainnet-beta.so diff --git a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-devnet.so b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-devnet.so index a32963f0f..d8da5d23d 100644 Binary files a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-devnet.so and b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-devnet.so differ diff --git a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-mainnet-beta.so b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-mainnet-beta.so index 9c7e00616..0bafa1bb6 100644 Binary files a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-mainnet-beta.so and b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-mainnet-beta.so differ diff --git a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-pre-mainnet.so b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-pre-mainnet.so index a6c25e720..af6866f5d 100644 Binary files a/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-pre-mainnet.so and b/programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-pre-mainnet.so differ diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_activate_deal.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_activate_deal.rs index 7e9557742..9439b8fef 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_activate_deal.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_activate_deal.rs @@ -1,21 +1,20 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_activate_deal( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, borrower: &Pubkey, deal_number: u16, base_token_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -51,10 +50,10 @@ pub async fn process_activate_deal( repayment_schedule, market_admins, credix_pass, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = credix_client::instruction::ActivateDeal {}; let instruction = Instruction { @@ -62,5 +61,5 @@ pub async fn process_activate_deal( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_credix_pass.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_credix_pass.rs index d253e90aa..d52849c85 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_credix_pass.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_credix_pass.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_create_credix_pass( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, pass_holder: &Pubkey, fields: &credix_client::instruction::CreateCredixPass, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let program_state = program_credix::accounts::find_program_state_pda().0; @@ -32,13 +31,13 @@ pub async fn process_create_credix_pass( global_market_state, credix_pass, market_admins, - system_program: anchor_lang::system_program::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + system_program: solana_sdk::system_program::ID, + rent: solana_sdk::sysvar::rent::ID, }; let instruction = Instruction { program_id: credix_client::id(), accounts: accounts.to_account_metas(None), data: fields.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_deal.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_deal.rs index 374226e68..058dc087b 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_deal.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_deal.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_create_deal( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, borrower: &Pubkey, deal_number: u16, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -36,7 +35,7 @@ pub async fn process_create_deal( global_market_state, deal, market_admins, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, }; let payload = credix_client::instruction::CreateDeal { _max_funding_duration: 128, @@ -53,5 +52,5 @@ pub async fn process_create_deal( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_epoch.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_epoch.rs index b9334a665..dc68d7962 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_epoch.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_epoch.rs @@ -1,18 +1,17 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_create_withdraw_epoch( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, epoch_idx: u32, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -29,7 +28,7 @@ pub async fn process_create_withdraw_epoch( global_market_state, withdraw_epoch, market_admins, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, }; let payload = credix_client::instruction::CreateWithdrawEpoch {}; let instruction = Instruction { @@ -37,5 +36,5 @@ pub async fn process_create_withdraw_epoch( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_request.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_request.rs index 88f2ff45c..7b1c751a8 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_request.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_create_withdraw_request.rs @@ -1,21 +1,20 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_create_withdraw_request( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, base_token_mint: &Pubkey, investor: &Keypair, investor_lp_token_account: &Pubkey, amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -30,20 +29,14 @@ pub async fn process_create_withdraw_request( let lp_token_mint = program_credix::accounts::find_lp_token_mint_pda(&market_seeds).0; // Find the next withdraw epoch account - let epoch_idx = program_test_context::read_account_anchor::( - program_test_context, + let epoch_idx = program_context::read_account_anchor::( + program_context, &global_market_state, ) .await? .latest_withdraw_epoch_idx; let withdraw_epoch = program_credix::accounts::find_withdraw_epoch_pda(&global_market_state, epoch_idx).0; - let withdraw_request = program_credix::accounts::find_withdraw_request_pda( - &global_market_state, - &investor.pubkey(), - epoch_idx, - ) - .0; // Execute IX let accounts = credix_client::accounts::CreateWithdrawRequest { @@ -53,11 +46,10 @@ pub async fn process_create_withdraw_request( signing_authority, credix_pass, withdraw_epoch, - withdraw_request, investor_lp_token_account: *investor_lp_token_account, liquidity_pool_token_account, lp_token_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, }; let payload = credix_client::instruction::CreateWithdrawRequest { _amount: amount }; let instruction = Instruction { @@ -65,5 +57,5 @@ pub async fn process_create_withdraw_request( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, investor).await + program_context::process_instruction(program_context, instruction, investor).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_deposit_funds.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_deposit_funds.rs index edad6c311..153c34fe3 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_deposit_funds.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_deposit_funds.rs @@ -1,22 +1,21 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_deposit_funds( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, base_token_mint: &Pubkey, investor: &Keypair, investor_token_account: &Pubkey, investor_lp_token_account: &Pubkey, amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -41,10 +40,10 @@ pub async fn process_deposit_funds( liquidity_pool_token_account, base_token_mint: *base_token_mint, lp_token_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = credix_client::instruction::DepositFunds { _amount: amount }; let instruction = Instruction { @@ -52,5 +51,5 @@ pub async fn process_deposit_funds( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, investor).await + program_context::process_instruction(program_context, instruction, investor).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_market.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_market.rs index c420bf353..c39852396 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_market.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_market.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; use solana_sdk::clock::SECONDS_PER_DAY; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_initialize_market( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let program_state = program_credix::accounts::find_program_state_pda().0; @@ -27,9 +26,9 @@ pub async fn process_initialize_market( &signing_authority, base_token_mint, ); - let treasury = program_credix::accounts::find_treasury(&multisig.pubkey()); + let treasury_pool = program_credix::accounts::find_treasury_pool(&multisig.pubkey()); let treasury_pool_token_account = - program_credix::accounts::find_treasury_pool_token_account(&treasury, base_token_mint); + program_credix::accounts::find_treasury_pool_token_account(&treasury_pool, base_token_mint); // Each withdraw epoch will last 3 days each let withdraw_epochs_seconds = 3 * u32::try_from(SECONDS_PER_DAY).unwrap(); @@ -44,12 +43,12 @@ pub async fn process_initialize_market( base_token_mint: *base_token_mint, signing_authority, liquidity_pool_token_account, - treasury, + treasury: treasury_pool, treasury_pool_token_account, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = credix_client::instruction::InitializeMarket { _global_market_seed: market_seeds.clone(), @@ -73,5 +72,5 @@ pub async fn process_initialize_market( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_program_state.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_program_state.rs index 516749eb2..f41580369 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_program_state.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_initialize_program_state.rs @@ -1,32 +1,39 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_initialize_program_state( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let program_state = program_credix::accounts::find_program_state_pda().0; - let treasury = program_credix::accounts::find_treasury(&multisig.pubkey()); + let treasury_pool = program_credix::accounts::find_treasury_pool(&multisig.pubkey()); // Execute IX let accounts = credix_client::accounts::InitializeProgramState { owner: multisig.pubkey(), program_state, - system_program: anchor_lang::system_program::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + system_program: solana_sdk::system_program::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = credix_client::instruction::InitializeProgramState { _credix_managers: [ - treasury, treasury, treasury, treasury, treasury, treasury, treasury, treasury, - treasury, treasury, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, + treasury_pool, ], _credix_multisig_key: multisig.pubkey(), }; @@ -35,5 +42,5 @@ pub async fn process_initialize_program_state( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_open_deal.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_open_deal.rs index cfd0a9ffa..640eb6be2 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_open_deal.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_open_deal.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_open_deal( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, borrower: &Pubkey, deal_number: u16, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -42,5 +41,5 @@ pub async fn process_open_deal( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_repay_deal.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_repay_deal.rs index 6a712418a..5318bb0c3 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_repay_deal.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_repay_deal.rs @@ -1,23 +1,22 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_repay_deal( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, borrower: &Keypair, borrower_token_account: &Pubkey, multisig: &Pubkey, deal_number: u16, base_token_mint: &Pubkey, amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let program_state = program_credix::accounts::find_program_state_pda().0; @@ -29,9 +28,9 @@ pub async fn process_repay_deal( &signing_authority, base_token_mint, ); - let treasury = program_credix::accounts::find_treasury(multisig); + let treasury_pool = program_credix::accounts::find_treasury_pool(multisig); let treasury_pool_token_account = - program_credix::accounts::find_treasury_pool_token_account(&treasury, base_token_mint); + program_credix::accounts::find_treasury_pool_token_account(&treasury_pool, base_token_mint); let credix_pass = program_credix::accounts::find_credix_pass_pda(&global_market_state, &borrower.pubkey()).0; let deal = program_credix::accounts::find_deal_pda( @@ -47,8 +46,12 @@ pub async fn process_repay_deal( let repayment_schedule = program_credix::accounts::find_repayment_schedule_pda(&global_market_state, &deal).0; - let credix_multisig_token_account = - spl_associated_token_account::get_associated_token_address(multisig, base_token_mint); + let credix_treasury = program_credix::accounts::find_credix_treasury(multisig); + let credix_treasury_token_account = + program_credix::accounts::find_credix_treasury_token_account( + &credix_treasury, + base_token_mint, + ); // Execute IX let accounts = credix_client::accounts::RepayDeal { @@ -66,11 +69,11 @@ pub async fn process_repay_deal( deal_token_account, deal_tranches, repayment_schedule, - credix_multisig_key: *multisig, - credix_multisig_token_account, + credix_treasury, + credix_treasury_token_account, credix_pass, variable_interest_rates: credix_client::id(), // Optional, Not set - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, }; @@ -80,5 +83,5 @@ pub async fn process_repay_deal( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, borrower).await + program_context::process_instruction(program_context, instruction, borrower).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_locked_liquidity.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_locked_liquidity.rs index 7e65a751a..742dab33d 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_locked_liquidity.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_locked_liquidity.rs @@ -1,19 +1,18 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_set_locked_liquidity( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -25,9 +24,9 @@ pub async fn process_set_locked_liquidity( ); // Find the current withdraw request account - let latest_withdraw_epoch_idx = program_test_context::read_account_anchor::< + let latest_withdraw_epoch_idx = program_context::read_account_anchor::< credix_client::GlobalMarketState, - >(program_test_context, &global_market_state) + >(program_context, &global_market_state) .await? .latest_withdraw_epoch_idx; let withdraw_epoch = program_credix::accounts::find_withdraw_epoch_pda( @@ -51,5 +50,5 @@ pub async fn process_set_locked_liquidity( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_repayment_schedule.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_repayment_schedule.rs index 6d944b6cb..3891f1a19 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_repayment_schedule.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_repayment_schedule.rs @@ -1,23 +1,21 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::clock::Clock; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; use solana_sdk::clock::SECONDS_PER_DAY; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_set_repayment_schedule( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, borrower: &Pubkey, deal_number: u16, principal: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -29,12 +27,7 @@ pub async fn process_set_repayment_schedule( program_credix::accounts::find_repayment_schedule_pda(&global_market_state, &deal).0; // Start the deal now - let unix_timestamp_now = program_test_context - .banks_client - .get_sysvar::() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)? - .unix_timestamp; + let unix_timestamp_now = program_context.get_clock().await?.unix_timestamp; // Execute IX let accounts = credix_client::accounts::SetRepaymentSchedule { @@ -43,22 +36,23 @@ pub async fn process_set_repayment_schedule( market_admins, repayment_schedule, global_market_state, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, }; let payload = credix_client::instruction::SetRepaymentSchedule { _offset: 0, _total_periods: 1, _start_ts: unix_timestamp_now, _daycount_convention: credix_client::DaycountConvention::Act365, - _repayment_period_inputs: vec![credix_client::RepaymentPeriodInput { + _repayment_periods: vec![credix_client::RepaymentPeriod { waterfall_index: 0, accrual_in_days: 30, - calculation_waterfall_index: 0, principal_expected: Some(principal), time_frame: credix_client::TimeFrame { start: unix_timestamp_now, end: unix_timestamp_now + 30 * i64::try_from(SECONDS_PER_DAY).unwrap(), }, + calculation_waterfall_index: 0, + calculation_date: unix_timestamp_now, }], _waterfall_definitions: vec![credix_client::DistributionWaterfall { waterfall_type: credix_client::DistributionWaterfallType::Amortization, @@ -93,5 +87,5 @@ pub async fn process_set_repayment_schedule( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_tranches.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_tranches.rs index 86242fe8d..0efb73830 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_tranches.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_set_tranches.rs @@ -1,22 +1,21 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_set_tranches( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, borrower: &Pubkey, deal_number: u16, principal: u64, interest: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -79,7 +78,7 @@ pub async fn process_set_tranches( deal_tranches, repayment_schedule, global_market_state, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, }; let payload = credix_client::instruction::SetTranches { _tranche_configs: vec![lp_tranche], @@ -89,5 +88,5 @@ pub async fn process_set_tranches( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_update_global_market_state.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_update_global_market_state.rs index c023f2137..46e259364 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_update_global_market_state.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_update_global_market_state.rs @@ -1,18 +1,17 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_update_global_market_state( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, has_withdrawal_epochs: bool, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -39,5 +38,5 @@ pub async fn process_update_global_market_state( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, multisig).await + program_context::process_instruction(program_context, instruction, multisig).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_withdraw_from_deal.rs b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_withdraw_from_deal.rs index 912ccd556..034a79e8e 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_withdraw_from_deal.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/instructions/process_withdraw_from_deal.rs @@ -1,22 +1,21 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; pub async fn process_withdraw_from_deal( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, borrower: &Keypair, borrower_token_account: &Pubkey, deal_number: u16, base_token_mint: &Pubkey, amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let market_seeds = program_credix::accounts::find_market_seeds(); let global_market_state = @@ -53,10 +52,10 @@ pub async fn process_withdraw_from_deal( repayment_schedule, credix_pass, off_ramp_token_account: credix_client::id(), // Optional, Not set - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = credix_client::instruction::WithdrawFromDeal { _amount: amount }; let instruction = Instruction { @@ -64,5 +63,5 @@ pub async fn process_withdraw_from_deal( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, borrower).await + program_context::process_instruction(program_context, instruction, borrower).await } diff --git a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_deploy_program.rs b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_deploy_program.rs index 88007aa65..509850dd4 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_deploy_program.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_deploy_program.rs @@ -1,52 +1,51 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; pub async fn process_deploy_program( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { let market_seeds = program_credix::accounts::find_market_seeds(); let signing_authority = program_credix::accounts::find_signing_authority_pda(&market_seeds).0; - let treasury = program_credix::accounts::find_treasury(&multisig.pubkey()); - - // Airdrop funds to the credix authority wallet, the multisig (acting as payer) - program_spl::instructions::process_lamports_airdrop( - program_test_context, - &multisig.pubkey(), - 1_000_000_000_000, - ) - .await?; + let treasury_pool = program_credix::accounts::find_treasury_pool(&multisig.pubkey()); + let credix_treasury = program_credix::accounts::find_credix_treasury(&multisig.pubkey()); // Create associated token accounts for the authorities wallets program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, multisig, base_token_mint, &signing_authority, ) .await?; program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, + multisig, + base_token_mint, + &treasury_pool, + ) + .await?; + program_spl::instructions::process_associated_token_account_get_or_init( + program_context, multisig, base_token_mint, - &treasury, + &credix_treasury, ) .await?; // Initialize the program state - program_credix::instructions::process_initialize_program_state(program_test_context, multisig) + program_credix::instructions::process_initialize_program_state(program_context, multisig) .await?; // Initialize the global market state program_credix::instructions::process_initialize_market( - program_test_context, + program_context, multisig, base_token_mint, ) @@ -54,7 +53,7 @@ pub async fn process_deploy_program( // Turn on the withdrawal epochs program_credix::instructions::process_update_global_market_state( - program_test_context, + program_context, multisig, true, ) diff --git a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_actors_behaviors.rs b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_actors_behaviors.rs index c64675bf2..7fdb68c04 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_actors_behaviors.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_actors_behaviors.rs @@ -1,18 +1,17 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::utils::ui_amount_to_native_amount; pub async fn process_dummy_actors_behaviors( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, base_token_authority: &Keypair, base_token_decimals: u8, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // The amounts we will be moving around let dummy_investor_deposit_amount = ui_amount_to_native_amount(100_000, base_token_decimals); let dummy_borrower_borrow_principal_amount = dummy_investor_deposit_amount; @@ -21,7 +20,7 @@ pub async fn process_dummy_actors_behaviors( // Initialize the lp pool by having an investor deposit money program_credix::procedures::process_dummy_investor( - program_test_context, + program_context, multisig, base_token_mint, base_token_authority, @@ -32,7 +31,7 @@ pub async fn process_dummy_actors_behaviors( // Increase the LP value of slightly by having a borrower borrow and pay interestes program_credix::procedures::process_dummy_borrower( - program_test_context, + program_context, multisig, base_token_mint, base_token_authority, diff --git a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_borrower.rs b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_borrower.rs index edec966a4..fe677cc68 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_borrower.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_borrower.rs @@ -1,21 +1,20 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; pub async fn process_dummy_borrower( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, base_token_authority: &Keypair, borrow_principal_amount: u64, borrow_interest_amount: u64, borrow_repay_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Prepare our dummy borrower @@ -26,17 +25,14 @@ pub async fn process_dummy_borrower( let dummy_borrower = Keypair::new(); // Airdrop lamports to the dummy borrower wallet - program_spl::instructions::process_lamports_airdrop( - program_test_context, - &dummy_borrower.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&dummy_borrower.pubkey(), 1_000_000_000_000) + .await?; // Create the borrower ATAs let dummy_borrower_token_account = program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, &dummy_borrower, base_token_mint, &dummy_borrower.pubkey(), @@ -45,7 +41,7 @@ pub async fn process_dummy_borrower( // Give some collateral (base token) to our dummy borrower program_spl::instructions::process_token_mint_to( - program_test_context, + program_context, &dummy_borrower, base_token_mint, base_token_authority, @@ -56,7 +52,7 @@ pub async fn process_dummy_borrower( // Create the credix-pass for the dummy investor program_credix::instructions::process_create_credix_pass( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), &credix_client::instruction::CreateCredixPass { @@ -77,14 +73,14 @@ pub async fn process_dummy_borrower( // --------------------------------------------------------------------- program_credix::instructions::process_create_deal( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), 0, ) .await?; program_credix::instructions::process_set_repayment_schedule( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), 0, @@ -92,7 +88,7 @@ pub async fn process_dummy_borrower( ) .await?; program_credix::instructions::process_set_tranches( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), 0, @@ -101,14 +97,14 @@ pub async fn process_dummy_borrower( ) .await?; program_credix::instructions::process_open_deal( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), 0, ) .await?; program_credix::instructions::process_activate_deal( - program_test_context, + program_context, multisig, &dummy_borrower.pubkey(), 0, @@ -123,7 +119,7 @@ pub async fn process_dummy_borrower( // --------------------------------------------------------------------- program_credix::instructions::process_withdraw_from_deal( - program_test_context, + program_context, &dummy_borrower, &dummy_borrower_token_account, 0, @@ -133,7 +129,7 @@ pub async fn process_dummy_borrower( .await?; program_credix::instructions::process_repay_deal( - program_test_context, + program_context, &dummy_borrower, &dummy_borrower_token_account, &multisig.pubkey(), diff --git a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_investor.rs b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_investor.rs index 50aac1421..fb0629825 100644 --- a/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_investor.rs +++ b/programs/uxd/tests/integration_tests/api/program_credix/procedures/process_dummy_investor.rs @@ -1,20 +1,19 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; pub async fn process_dummy_investor( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, multisig: &Keypair, base_token_mint: &Pubkey, base_token_authority: &Keypair, investor_deposit_amount: u64, investor_withdraw_request_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { let market_seeds = program_credix::accounts::find_market_seeds(); let lp_token_mint = program_credix::accounts::find_lp_token_mint_pda(&market_seeds).0; @@ -28,17 +27,14 @@ pub async fn process_dummy_investor( let dummy_investor = Keypair::new(); // Airdrop lamports to the dummy investor wallet - program_spl::instructions::process_lamports_airdrop( - program_test_context, - &dummy_investor.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&dummy_investor.pubkey(), 1_000_000_000_000) + .await?; // Create the investor ATAs let dummy_investor_token_account = program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, &dummy_investor, base_token_mint, &dummy_investor.pubkey(), @@ -46,7 +42,7 @@ pub async fn process_dummy_investor( .await?; let dummy_investor_lp_token_account = program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, &dummy_investor, &lp_token_mint, &dummy_investor.pubkey(), @@ -55,7 +51,7 @@ pub async fn process_dummy_investor( // Give collateral (base token) to our dummy investor program_spl::instructions::process_token_mint_to( - program_test_context, + program_context, &dummy_investor, base_token_mint, base_token_authority, @@ -72,7 +68,7 @@ pub async fn process_dummy_investor( // Create the credix-pass for the dummy investor program_credix::instructions::process_create_credix_pass( - program_test_context, + program_context, multisig, &dummy_investor.pubkey(), &credix_client::instruction::CreateCredixPass { @@ -88,7 +84,7 @@ pub async fn process_dummy_investor( // The dummy investor will do a dummy deposit program_credix::instructions::process_deposit_funds( - program_test_context, + program_context, base_token_mint, &dummy_investor, &dummy_investor_token_account, @@ -100,7 +96,7 @@ pub async fn process_dummy_investor( // The dummy investor will optionally create a dummy withdraw request if investor_withdraw_request_amount > 0 { program_credix::instructions::process_create_withdraw_request( - program_test_context, + program_context, base_token_mint, &dummy_investor, &dummy_investor_lp_token_account, diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/accounts/find_pdas.rs b/programs/uxd/tests/integration_tests/api/program_mercurial/accounts/find_pdas.rs index 473792a75..14666de57 100644 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/accounts/find_pdas.rs +++ b/programs/uxd/tests/integration_tests/api/program_mercurial/accounts/find_pdas.rs @@ -1,4 +1,4 @@ -use solana_program::pubkey::Pubkey; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; pub fn find_base() -> Keypair { diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/dump.sh b/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/dump.sh deleted file mode 100644 index 6a115b405..000000000 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/dump.sh +++ /dev/null @@ -1,5 +0,0 @@ -solana config set --url https://api.devnet.solana.com -solana program dump 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi executable-devnet.so - -solana config set --url https://api.mainnet-beta.solana.com -solana program dump 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi executable-mainnet-beta.so diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-mainnet-beta.so b/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-mainnet-beta.so index 630b48ba7..e78bc5194 100644 Binary files a/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-mainnet-beta.so and b/programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-mainnet-beta.so differ diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_deposit.rs b/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_deposit.rs index 7a2027353..0ce22324e 100644 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_deposit.rs +++ b/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_deposit.rs @@ -1,23 +1,22 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; pub async fn process_deposit( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, token_mint: &Pubkey, lp_mint: &Pubkey, user: &Keypair, user_token: &Pubkey, user_lp: &Pubkey, token_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let base = program_mercurial::accounts::find_base(); let vault = program_mercurial::accounts::find_vault_pda(token_mint, &base.pubkey()).0; @@ -42,5 +41,5 @@ pub async fn process_deposit( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, user).await + program_context::process_instruction(program_context, instruction, user).await } diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_initialize.rs b/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_initialize.rs index 228e3b71b..edb3c308b 100644 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_initialize.rs +++ b/programs/uxd/tests/integration_tests/api/program_mercurial/instructions/process_initialize.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; pub async fn process_initialize( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, admin: &Keypair, token_mint: &Pubkey, lp_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let base = program_mercurial::accounts::find_base(); let vault = program_mercurial::accounts::find_vault_pda(token_mint, &base.pubkey()).0; @@ -31,9 +30,9 @@ pub async fn process_initialize( token_mint: *token_mint, fee_vault, lp_mint: *lp_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = mercurial_vault::instruction::Initialize {}; let instruction = Instruction { @@ -41,11 +40,6 @@ pub async fn process_initialize( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - admin, - &base, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, admin, &base) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_deploy_program.rs b/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_deploy_program.rs index 75d2059f2..a7bab7064 100644 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_deploy_program.rs +++ b/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_deploy_program.rs @@ -1,35 +1,26 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; pub async fn process_deploy_program( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, admin: &Keypair, token_mint: &Pubkey, lp_mint: &Keypair, lp_mint_decimals: u8, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let base = program_mercurial::accounts::find_base(); let vault = program_mercurial::accounts::find_vault_pda(token_mint, &base.pubkey()).0; let treasury = program_mercurial::accounts::find_treasury(); - // Airdrop funds to the mercurial admin wallet (acting as payer) - program_spl::instructions::process_lamports_airdrop( - program_test_context, - &admin.pubkey(), - 1_000_000_000_000, - ) - .await?; - // Create the lp mint program_spl::instructions::process_token_mint_init( - program_test_context, + program_context, admin, lp_mint, lp_mint_decimals, @@ -39,7 +30,7 @@ pub async fn process_deploy_program( // Create the fee_vault, which is the treasury ATA program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, admin, &lp_mint.pubkey(), &treasury, @@ -48,7 +39,7 @@ pub async fn process_deploy_program( // Vault initialize program_mercurial::instructions::process_initialize( - program_test_context, + program_context, admin, token_mint, &lp_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_dummy_actors_behaviors.rs b/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_dummy_actors_behaviors.rs index 2f93b235d..74efdb299 100644 --- a/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_dummy_actors_behaviors.rs +++ b/programs/uxd/tests/integration_tests/api/program_mercurial/procedures/process_dummy_actors_behaviors.rs @@ -1,31 +1,27 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; pub async fn process_dummy_actors_behaviors( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, token_mint: &Keypair, lp_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { let dummy_investor = Keypair::new(); // Airdrop lamports to the dummy investor wallet - program_spl::instructions::process_lamports_airdrop( - program_test_context, - &dummy_investor.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&dummy_investor.pubkey(), 1_000_000_000_000) + .await?; // Create dummy investor ATAs let dummy_investor_token = program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, &dummy_investor, &token_mint.pubkey(), &dummy_investor.pubkey(), @@ -33,7 +29,7 @@ pub async fn process_dummy_actors_behaviors( .await?; let dummy_investor_lp = program_spl::instructions::process_associated_token_account_get_or_init( - program_test_context, + program_context, &dummy_investor, lp_mint, &dummy_investor.pubkey(), @@ -42,7 +38,7 @@ pub async fn process_dummy_actors_behaviors( // Airdrop some token to our dummy investor program_spl::instructions::process_token_mint_to( - program_test_context, + program_context, &dummy_investor, &token_mint.pubkey(), token_mint, @@ -53,7 +49,7 @@ pub async fn process_dummy_actors_behaviors( // The dummy investor will do a dummy deposit to initialize the lp-pool program_mercurial::instructions::process_deposit( - program_test_context, + program_context, &token_mint.pubkey(), lp_mint, &dummy_investor, diff --git a/programs/uxd/tests/integration_tests/api/program_spl/instructions/mod.rs b/programs/uxd/tests/integration_tests/api/program_spl/instructions/mod.rs index 713d55f67..38bb78962 100644 --- a/programs/uxd/tests/integration_tests/api/program_spl/instructions/mod.rs +++ b/programs/uxd/tests/integration_tests/api/program_spl/instructions/mod.rs @@ -1,9 +1,7 @@ pub mod process_associated_token_account_get_or_init; -pub mod process_lamports_airdrop; pub mod process_token_mint_init; pub mod process_token_mint_to; pub use process_associated_token_account_get_or_init::*; -pub use process_lamports_airdrop::*; pub use process_token_mint_init::*; pub use process_token_mint_to::*; diff --git a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_associated_token_account_get_or_init.rs b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_associated_token_account_get_or_init.rs index 280226ea2..c794d7abb 100644 --- a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_associated_token_account_get_or_init.rs +++ b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_associated_token_account_get_or_init.rs @@ -1,16 +1,19 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; pub async fn process_associated_token_account_get_or_init( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, mint: &Pubkey, wallet: &Pubkey, -) -> Result { +) -> Result { + let pda = spl_associated_token_account::get_associated_token_address(wallet, mint); + if program_context::read_account_exists(program_context, &pda).await? { + return Ok(pda); + } let instruction = spl_associated_token_account::instruction::create_associated_token_account_idempotent( &payer.pubkey(), @@ -18,8 +21,6 @@ pub async fn process_associated_token_account_get_or_init( mint, &spl_token::id(), ); - program_test_context::process_instruction(program_test_context, instruction, payer).await?; - Ok(spl_associated_token_account::get_associated_token_address( - wallet, mint, - )) + program_context::process_instruction(program_context, instruction, payer).await?; + Ok(pda) } diff --git a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_lamports_airdrop.rs b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_lamports_airdrop.rs deleted file mode 100644 index 3cf9d5c64..000000000 --- a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_lamports_airdrop.rs +++ /dev/null @@ -1,17 +0,0 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; -use solana_sdk::signer::keypair::Keypair; -use solana_sdk::signer::Signer; - -use crate::integration_tests::api::program_test_context; - -pub async fn process_lamports_airdrop( - program_test_context: &mut ProgramTestContext, - to: &Pubkey, - lamports: u64, -) -> Result<(), program_test_context::ProgramTestError> { - let from = Keypair::from_bytes(&program_test_context.payer.to_bytes()) - .map_err(|e| program_test_context::ProgramTestError::Signature(e.to_string()))?; - let instruction = solana_program::system_instruction::transfer(&from.pubkey(), to, lamports); - program_test_context::process_instruction(program_test_context, instruction, &from).await -} diff --git a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_init.rs b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_init.rs index bf63130b0..8ff399c8f 100644 --- a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_init.rs +++ b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_init.rs @@ -1,34 +1,30 @@ -use solana_program::program_pack::Pack; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::program_pack::Pack; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Mint; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; pub async fn process_token_mint_init( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, mint: &Keypair, decimals: u8, authority: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { - let rent = program_test_context - .banks_client - .get_rent() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)?; +) -> Result<(), program_context::ProgramError> { + let rent_space = Mint::LEN; + let rent_minimum_balance = program_context.get_rent_minimum_balance(rent_space).await?; - let instruction_create = solana_program::system_instruction::create_account( + let instruction_create = solana_sdk::system_instruction::create_account( &payer.pubkey(), &mint.pubkey(), - rent.minimum_balance(Mint::LEN), - Mint::LEN as u64, + rent_minimum_balance, + rent_space as u64, &spl_token::id(), ); - program_test_context::process_instruction_with_signer( - program_test_context, + program_context::process_instruction_with_signer( + program_context, instruction_create, payer, mint, @@ -42,10 +38,9 @@ pub async fn process_token_mint_init( Some(authority), decimals, ) - .map_err(program_test_context::ProgramTestError::Program)?; + .map_err(program_context::ProgramError::Program)?; - program_test_context::process_instruction(program_test_context, instruction_init, payer) - .await?; + program_context::process_instruction(program_context, instruction_init, payer).await?; Ok(()) } diff --git a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_to.rs b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_to.rs index 6830eac55..6651a3160 100644 --- a/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_to.rs +++ b/programs/uxd/tests/integration_tests/api/program_spl/instructions/process_token_mint_to.rs @@ -1,18 +1,17 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; pub async fn process_token_mint_to( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, mint: &Pubkey, authority: &Keypair, token_account: &Pubkey, amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { let instruction = spl_token::instruction::mint_to( &spl_token::id(), mint, @@ -21,13 +20,8 @@ pub async fn process_token_mint_to( &[], amount, ) - .map_err(program_test_context::ProgramTestError::Program)?; + .map_err(program_context::ProgramError::Program)?; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - authority, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, payer, authority) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/mod.rs b/programs/uxd/tests/integration_tests/api/program_test_context/mod.rs deleted file mode 100644 index 0de9899e5..000000000 --- a/programs/uxd/tests/integration_tests/api/program_test_context/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod create_program_test_context; -pub mod move_clock; -pub mod process_instruction; -pub mod program_test_error; -pub mod read_account; - -pub use create_program_test_context::*; -pub use move_clock::*; -pub use process_instruction::*; -pub use program_test_error::*; -pub use read_account::*; diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/move_clock.rs b/programs/uxd/tests/integration_tests/api/program_test_context/move_clock.rs deleted file mode 100644 index bbddb65c4..000000000 --- a/programs/uxd/tests/integration_tests/api/program_test_context/move_clock.rs +++ /dev/null @@ -1,50 +0,0 @@ -use solana_program::clock::Clock; -use solana_program_test::ProgramTestContext; - -use crate::integration_tests::api::program_test_context; - -pub async fn move_clock_forward( - program_test_context: &mut ProgramTestContext, - unix_timestamp_delta: u64, - slot_delta: u64, -) -> Result<(), program_test_context::ProgramTestError> { - // Read the context sysvar clock - let current_clock = program_test_context - .banks_client - .get_sysvar::() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)?; - - // Move the clock - move_clock_to( - program_test_context, - current_clock.unix_timestamp + i64::try_from(unix_timestamp_delta).unwrap(), - current_clock.slot + slot_delta, - ) - .await -} - -pub async fn move_clock_to( - program_test_context: &mut ProgramTestContext, - unix_timestamp: i64, - slot: u64, -) -> Result<(), program_test_context::ProgramTestError> { - // Read the context sysvar clock - let current_clock = program_test_context - .banks_client - .get_sysvar::() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)?; - - // Update the clock fields - let mut forwarded_clock = current_clock; - forwarded_clock.epoch += 1; - forwarded_clock.slot = slot; - forwarded_clock.unix_timestamp = unix_timestamp; - - // Update the context sysvar clock - program_test_context.set_sysvar::(&forwarded_clock); - - // Done - Ok(()) -} diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/program_test_error.rs b/programs/uxd/tests/integration_tests/api/program_test_context/program_test_error.rs deleted file mode 100644 index c1b6260fb..000000000 --- a/programs/uxd/tests/integration_tests/api/program_test_context/program_test_error.rs +++ /dev/null @@ -1,12 +0,0 @@ -use solana_program::program_error::ProgramError; -use solana_program_test::BanksClientError; - -#[derive(Debug)] -pub enum ProgramTestError { - BanksClient(BanksClientError), - Signature(String), - Program(ProgramError), - Anchor(anchor_lang::error::Error), - Io(std::io::Error), - Custom(&'static str), -} diff --git a/programs/uxd/tests/integration_tests/api/program_test_context/read_account.rs b/programs/uxd/tests/integration_tests/api/program_test_context/read_account.rs deleted file mode 100644 index 8f7964ec4..000000000 --- a/programs/uxd/tests/integration_tests/api/program_test_context/read_account.rs +++ /dev/null @@ -1,43 +0,0 @@ -use anchor_lang::AccountDeserialize; -use solana_program::program_pack::IsInitialized; -use solana_program::program_pack::Pack; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; - -use crate::integration_tests::api::program_test_context; - -pub async fn read_account_data( - program_test_context: &mut ProgramTestContext, - address: &Pubkey, -) -> Result, program_test_context::ProgramTestError> { - let raw_account = program_test_context - .banks_client - .get_account(*address) - .await - .map_err(program_test_context::ProgramTestError::BanksClient)? - .ok_or(program_test_context::ProgramTestError::Custom( - "AccountDoesNotExist", - ))?; - Ok(raw_account.data) -} - -pub async fn read_account_anchor( - program_test_context: &mut ProgramTestContext, - address: &Pubkey, -) -> Result { - let raw_account_data = - program_test_context::read_account_data(program_test_context, address).await?; - let mut raw_account_slice: &[u8] = &raw_account_data; - T::try_deserialize(&mut raw_account_slice) - .map_err(program_test_context::ProgramTestError::Anchor) -} - -pub async fn read_account_packed( - program_test_context: &mut ProgramTestContext, - address: &Pubkey, -) -> Result { - let raw_account_data = - program_test_context::read_account_data(program_test_context, address).await?; - let raw_account_slice: &[u8] = &raw_account_data; - T::unpack(raw_account_slice).map_err(program_test_context::ProgramTestError::Program) -} diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/accounts/find_pdas.rs b/programs/uxd/tests/integration_tests/api/program_uxd/accounts/find_pdas.rs index 79e9f6fc0..f616ee1d9 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/accounts/find_pdas.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/accounts/find_pdas.rs @@ -1,5 +1,4 @@ -use solana_program::pubkey::Pubkey; - +use solana_sdk::pubkey::Pubkey; pub fn find_controller_pda() -> (Pubkey, u8) { Pubkey::find_program_address(&[uxd::CONTROLLER_NAMESPACE], &uxd::id()) } diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_collect_profits_of_mercurial_vault_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_collect_profits_of_mercurial_vault_depository.rs index 09ef9cc46..5cc284a56 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_collect_profits_of_mercurial_vault_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_collect_profits_of_mercurial_vault_depository.rs @@ -1,9 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::clock::Clock; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -12,18 +10,18 @@ use spl_token::state::Mint; use uxd::state::Controller; use uxd::state::MercurialVaultDepository; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_collect_profits_of_mercurial_vault_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, collateral_mint: &Pubkey, mercurial_vault_lp_mint: &Pubkey, profits_beneficiary_collateral: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let mercurial_base = program_mercurial::accounts::find_base(); @@ -45,49 +43,38 @@ pub async fn process_collect_profits_of_mercurial_vault_depository( // Read state before let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; - let mercurial_vault_before = - program_test_context::read_account_anchor::( - program_test_context, - &mercurial_vault, - ) - .await?; - let mercurial_vault_lp_mint_before = program_test_context::read_account_packed::( - program_test_context, - mercurial_vault_lp_mint, + let mercurial_vault_before = program_context::read_account_anchor::( + program_context, + &mercurial_vault, ) .await?; + let mercurial_vault_lp_mint_before = + program_context::read_account_packed::(program_context, mercurial_vault_lp_mint) + .await?; let mercurial_vault_depository_lp_token_vault_amount_before = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, &mercurial_vault_depository_lp_token_vault, ) .await? .amount; let profits_beneficiary_collateral_amount_before = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, profits_beneficiary_collateral, ) .await? .amount; - let unix_timestamp_before = u64::try_from( - program_test_context - .banks_client - .get_sysvar::() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)? - .unix_timestamp, - ) - .unwrap(); + let unix_timestamp_before = + u64::try_from(program_context.get_clock().await?.unix_timestamp).unwrap(); // Execute IX let accounts = uxd::accounts::CollectProfitsOfMercurialVaultDepository { @@ -100,7 +87,7 @@ pub async fn process_collect_profits_of_mercurial_vault_depository( mercurial_vault_lp_mint: *mercurial_vault_lp_mint, mercurial_vault_collateral_token_safe, profits_beneficiary_collateral: *profits_beneficiary_collateral, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, mercurial_vault_program: mercurial_vault::ID, }; @@ -110,53 +97,42 @@ pub async fn process_collect_profits_of_mercurial_vault_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, payer).await?; + program_context::process_instruction(program_context, instruction, payer).await?; // Read state after let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; - let mercurial_vault_after = - program_test_context::read_account_anchor::( - program_test_context, - &mercurial_vault, - ) - .await?; - let mercurial_vault_lp_mint_after = program_test_context::read_account_packed::( - program_test_context, - mercurial_vault_lp_mint, + let mercurial_vault_after = program_context::read_account_anchor::( + program_context, + &mercurial_vault, ) .await?; + let mercurial_vault_lp_mint_after = + program_context::read_account_packed::(program_context, mercurial_vault_lp_mint) + .await?; let mercurial_vault_depository_lp_token_vault_amount_after = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, &mercurial_vault_depository_lp_token_vault, ) .await? .amount; let profits_beneficiary_collateral_amount_after = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, profits_beneficiary_collateral, ) .await? .amount; - let unix_timestamp_after = u64::try_from( - program_test_context - .banks_client - .get_sysvar::() - .await - .map_err(program_test_context::ProgramTestError::BanksClient)? - .unix_timestamp, - ) - .unwrap(); + let unix_timestamp_after = + u64::try_from(program_context.get_clock().await?.unix_timestamp).unwrap(); // Compute Assets and Liabilities let assets_value_before = mercurial_vault_before diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_controller.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_controller.rs index 663e2e8c0..f85215b69 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_controller.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_controller.rs @@ -1,29 +1,27 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use uxd::instructions::EditControllerFields; use uxd::state::Controller; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_edit_controller( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, fields: &EditControllerFields, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; // Read state before let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; // Execute IX let accounts = uxd::accounts::EditController { @@ -36,8 +34,8 @@ pub async fn process_edit_controller( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, + program_context::process_instruction_with_signer( + program_context, instruction, payer, authority, @@ -46,8 +44,7 @@ pub async fn process_edit_controller( // Read state after let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; // redeemable_global_supply_cap must have been updated if specified in fields let redeemable_global_supply_cap_before = controller_before.redeemable_global_supply_cap; diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_credix_lp_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_credix_lp_depository.rs index 2535b6752..eb3e5579c 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_credix_lp_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_credix_lp_depository.rs @@ -1,25 +1,24 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use uxd::instructions::EditCredixLpDepositoryFields; use uxd::state::CredixLpDepository; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_edit_credix_lp_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, fields: &EditCredixLpDepositoryFields, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let credix_market_seeds = program_credix::accounts::find_market_seeds(); @@ -32,12 +31,11 @@ pub async fn process_edit_credix_lp_depository( .0; // Read state before - let credix_lp_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; + let credix_lp_depository_before = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; // Execute IX let accounts = uxd::accounts::EditCredixLpDepository { @@ -51,8 +49,8 @@ pub async fn process_edit_credix_lp_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, + program_context::process_instruction_with_signer( + program_context, instruction, payer, authority, @@ -60,12 +58,11 @@ pub async fn process_edit_credix_lp_depository( .await?; // Read state after - let credix_lp_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; + let credix_lp_depository_after = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; // redeemable_amount_under_management_cap must have been updated if specified in fields let redeemable_amount_under_management_cap_before = diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_identity_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_identity_depository.rs index 5f33a92e2..7797aa3a8 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_identity_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_identity_depository.rs @@ -1,33 +1,31 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use uxd::instructions::EditIdentityDepositoryFields; use uxd::state::IdentityDepository; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_edit_identity_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, fields: &EditIdentityDepositoryFields, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let identity_depository = program_uxd::accounts::find_identity_depository_pda().0; // Read state before - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; // Execute IX let accounts = uxd::accounts::EditIdentityDepository { @@ -41,8 +39,8 @@ pub async fn process_edit_identity_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, + program_context::process_instruction_with_signer( + program_context, instruction, payer, authority, @@ -50,12 +48,11 @@ pub async fn process_edit_identity_depository( .await?; // Read state after - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; // redeemable_amount_under_management_cap must have been updated if specified in fields let redeemable_amount_under_management_cap_before = diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_mercurial_vault_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_mercurial_vault_depository.rs index 2b71ba03c..5ae8edee6 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_mercurial_vault_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_edit_mercurial_vault_depository.rs @@ -1,25 +1,24 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use uxd::instructions::EditMercurialVaultDepositoryFields; use uxd::state::MercurialVaultDepository; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_edit_mercurial_vault_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, fields: &EditMercurialVaultDepositoryFields, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let mercurial_base = program_mercurial::accounts::find_base(); @@ -32,9 +31,9 @@ pub async fn process_edit_mercurial_vault_depository( .0; // Read state before - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; // Execute IX @@ -49,8 +48,8 @@ pub async fn process_edit_mercurial_vault_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, + program_context::process_instruction_with_signer( + program_context, instruction, payer, authority, @@ -58,9 +57,9 @@ pub async fn process_edit_mercurial_vault_depository( .await?; // Read state after - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; // redeemable_amount_under_management_cap must have been updated if specified in fields diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_controller.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_controller.rs index 34b1ec723..525186b28 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_controller.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_controller.rs @@ -1,19 +1,18 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_initialize_controller( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, redeemable_mint_decimals: u8, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -24,9 +23,9 @@ pub async fn process_initialize_controller( payer: payer.pubkey(), controller, redeemable_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::InitializeController { redeemable_mint_decimals, @@ -36,11 +35,6 @@ pub async fn process_initialize_controller( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - authority, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, payer, authority) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_identity_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_identity_depository.rs index 4be308ff4..e42dd0e14 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_identity_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_initialize_identity_depository.rs @@ -1,20 +1,19 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_initialize_identity_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let identity_depository = program_uxd::accounts::find_identity_depository_pda().0; @@ -29,9 +28,9 @@ pub async fn process_initialize_identity_depository( depository: identity_depository, collateral_vault: identity_depository_collateral_vault, collateral_mint: *collateral_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::InitializeIdentityDepository {}; let instruction = Instruction { @@ -39,11 +38,6 @@ pub async fn process_initialize_identity_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - authority, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, payer, authority) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint.rs index d58106e13..816cde53a 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -14,15 +13,15 @@ use uxd::state::IdentityDepository; use uxd::state::MercurialVaultDepository; use uxd::utils::calculate_amount_less_fees; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::api::program_uxd::instructions::process_mint_with_credix_lp_depository_collateral_amount_after_precision_loss; #[allow(clippy::too_many_arguments)] pub async fn process_mint( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, collateral_mint: &Pubkey, mercurial_vault_depository_vault_lp_mint: &Pubkey, @@ -33,7 +32,7 @@ pub async fn process_mint( expected_identity_depository_collateral_amount: u64, expected_mercurial_vault_depository_collateral_amount: u64, expected_credix_lp_depository_collateral_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -96,35 +95,31 @@ pub async fn process_mint( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) + .await?; + let credix_lp_depository_before = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) .await?; - let credix_lp_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -152,13 +147,13 @@ pub async fn process_mint( credix_lp_depository_signing_authority, credix_lp_depository_liquidity_collateral, credix_lp_depository_shares_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, mercurial_vault_program: mercurial_vault::ID, credix_program: credix_client::ID, uxd_program: uxd::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::Mint { collateral_amount }; let instruction = Instruction { @@ -166,45 +161,36 @@ pub async fn process_mint( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - user, - ) - .await?; + program_context::process_instruction_with_signer(program_context, instruction, payer, user) + .await?; // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) + .await?; + let credix_lp_depository_after = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) .await?; - let credix_lp_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -216,7 +202,7 @@ pub async fn process_mint( expected_mercurial_vault_depository_collateral_amount, mercurial_vault_depository_before.minting_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let mercurial_vault_depository_fees_amount = expected_mercurial_vault_depository_collateral_amount - mercurial_vault_depository_redeemable_amount; @@ -224,7 +210,7 @@ pub async fn process_mint( // Compute credix_lp_depository amounts let credix_lp_depository_collateral_amount_after_precision_loss = process_mint_with_credix_lp_depository_collateral_amount_after_precision_loss( - program_test_context, + program_context, collateral_mint, expected_credix_lp_depository_collateral_amount, ) @@ -233,7 +219,7 @@ pub async fn process_mint( credix_lp_depository_collateral_amount_after_precision_loss, credix_lp_depository_before.minting_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let credix_lp_depository_fees_amount = credix_lp_depository_collateral_amount_after_precision_loss - credix_lp_depository_redeemable_amount; diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_credix_lp_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_credix_lp_depository.rs index d53d7c226..5bfd366b6 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_credix_lp_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_credix_lp_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -14,13 +13,13 @@ use uxd::utils::calculate_amount_less_fees; use uxd::utils::compute_shares_amount_for_value_floor; use uxd::utils::compute_value_for_shares_amount_floor; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_mint_with_credix_lp_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, @@ -28,7 +27,7 @@ pub async fn process_mint_with_credix_lp_depository( user_collateral: &Pubkey, user_redeemable: &Pubkey, collateral_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -65,24 +64,21 @@ pub async fn process_mint_with_credix_lp_depository( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let credix_lp_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let credix_lp_depository_before = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -104,11 +100,11 @@ pub async fn process_mint_with_credix_lp_depository( credix_liquidity_collateral, credix_shares_mint, credix_pass, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, credix_program: credix_client::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::MintWithCredixLpDepository { collateral_amount }; let instruction = Instruction { @@ -116,8 +112,8 @@ pub async fn process_mint_with_credix_lp_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signers( - program_test_context, + program_context::process_instruction_with_signers( + program_context, instruction, payer, &[authority, user], @@ -126,31 +122,28 @@ pub async fn process_mint_with_credix_lp_depository( // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let credix_lp_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let credix_lp_depository_after = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; // Compute collateral amount deposited after precision loss let collateral_amount_after_precision_loss = process_mint_with_credix_lp_depository_collateral_amount_after_precision_loss( - program_test_context, + program_context, collateral_mint, collateral_amount, ) @@ -161,7 +154,7 @@ pub async fn process_mint_with_credix_lp_depository( collateral_amount_after_precision_loss, credix_lp_depository_before.minting_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; // Compute fees amount let fees_amount = collateral_amount_after_precision_loss - redeemable_amount; @@ -228,10 +221,10 @@ pub async fn process_mint_with_credix_lp_depository( } pub async fn process_mint_with_credix_lp_depository_collateral_amount_after_precision_loss( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, collateral_mint: &Pubkey, collateral_amount: u64, -) -> Result { +) -> Result { // Read on chain accounts that contains the credix useful states let credix_market_seeds = program_credix::accounts::find_market_seeds(); let credix_global_market_state = @@ -246,19 +239,17 @@ pub async fn process_mint_with_credix_lp_depository_collateral_amount_after_prec ); // Fetch information from onchain credix lp pool, to be able to predict precision loss - let credix_shares_mint_supply = program_test_context::read_account_packed::( - program_test_context, - &credix_shares_mint, - ) - .await? - .supply; - let credix_pool_outstanding_credit = program_test_context::read_account_anchor::< + let credix_shares_mint_supply = + program_context::read_account_packed::(program_context, &credix_shares_mint) + .await? + .supply; + let credix_pool_outstanding_credit = program_context::read_account_anchor::< credix_client::GlobalMarketState, - >(program_test_context, &credix_global_market_state) + >(program_context, &credix_global_market_state) .await? .pool_outstanding_credit; - let credix_liquidity_collateral_amount = program_test_context::read_account_packed::( - program_test_context, + let credix_liquidity_collateral_amount = program_context::read_account_packed::( + program_context, &credix_liquidity_collateral, ) .await? @@ -272,13 +263,13 @@ pub async fn process_mint_with_credix_lp_depository_collateral_amount_after_prec total_shares_supply, total_shares_value, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let collateral_amount_after_precision_loss = compute_value_for_shares_amount_floor( shares_amount, total_shares_supply, total_shares_value, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; // Done Ok(collateral_amount_after_precision_loss) diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_identity_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_identity_depository.rs index ef4c4a927..17040977c 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_identity_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_identity_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -11,18 +10,18 @@ use spl_token::state::Mint; use uxd::state::Controller; use uxd::state::IdentityDepository; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_mint_with_identity_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, user: &Keypair, user_collateral: &Pubkey, user_redeemable: &Pubkey, collateral_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -32,24 +31,21 @@ pub async fn process_mint_with_identity_depository( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -64,7 +60,7 @@ pub async fn process_mint_with_identity_depository( redeemable_mint, user_collateral: *user_collateral, user_redeemable: *user_redeemable, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, }; let payload = uxd::instruction::MintWithIdentityDepository { collateral_amount }; @@ -73,8 +69,8 @@ pub async fn process_mint_with_identity_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signers( - program_test_context, + program_context::process_instruction_with_signers( + program_context, instruction, payer, &[authority, user], @@ -83,24 +79,21 @@ pub async fn process_mint_with_identity_depository( // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_mercurial_vault_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_mercurial_vault_depository.rs index aa443031c..9865da9a9 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_mercurial_vault_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_mint_with_mercurial_vault_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -12,13 +11,13 @@ use uxd::state::Controller; use uxd::state::MercurialVaultDepository; use uxd::utils::calculate_amount_less_fees; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_mint_with_mercurial_vault_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, @@ -27,7 +26,7 @@ pub async fn process_mint_with_mercurial_vault_depository( user_collateral: &Pubkey, user_redeemable: &Pubkey, collateral_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -50,22 +49,20 @@ pub async fn process_mint_with_mercurial_vault_depository( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -84,7 +81,7 @@ pub async fn process_mint_with_mercurial_vault_depository( mercurial_vault, mercurial_vault_lp_mint: *mercurial_vault_lp_mint, mercurial_vault_collateral_token_safe, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, mercurial_vault_program: mercurial_vault::ID, }; @@ -94,8 +91,8 @@ pub async fn process_mint_with_mercurial_vault_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signers( - program_test_context, + program_context::process_instruction_with_signers( + program_context, instruction, payer, &[authority, user], @@ -104,22 +101,20 @@ pub async fn process_mint_with_mercurial_vault_depository( // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -128,7 +123,7 @@ pub async fn process_mint_with_mercurial_vault_depository( collateral_amount, mercurial_vault_depository_before.minting_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let fees_amount = collateral_amount - redeemable_amount; // redeemable_mint.supply must have increased by the minted amount (equivalent to redeemable_amount) diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_create_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_create_withdraw_request_from_credix_lp_depository.rs index e60ccd34e..a21f096ee 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_create_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_create_withdraw_request_from_credix_lp_depository.rs @@ -1,21 +1,20 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_rebalance_create_withdraw_request_from_credix_lp_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, collateral_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; @@ -56,9 +55,9 @@ pub async fn process_rebalance_create_withdraw_request_from_credix_lp_depository ); // Find the credix withdraw accounts - let credix_latest_withdraw_epoch_idx = program_test_context::read_account_anchor::< + let credix_latest_withdraw_epoch_idx = program_context::read_account_anchor::< credix_client::GlobalMarketState, - >(program_test_context, &credix_global_market_state) + >(program_context, &credix_global_market_state) .await? .latest_withdraw_epoch_idx; let credix_withdraw_epoch = program_credix::accounts::find_withdraw_epoch_pda( @@ -66,12 +65,6 @@ pub async fn process_rebalance_create_withdraw_request_from_credix_lp_depository credix_latest_withdraw_epoch_idx, ) .0; - let credix_withdraw_request = program_credix::accounts::find_withdraw_request_pda( - &credix_global_market_state, - &credix_lp_depository, - credix_latest_withdraw_epoch_idx, - ) - .0; // Execute IX let accounts = uxd::accounts::RebalanceCreateWithdrawRequestFromCredixLpDepository { @@ -88,8 +81,7 @@ pub async fn process_rebalance_create_withdraw_request_from_credix_lp_depository credix_shares_mint, credix_pass, credix_withdraw_epoch, - credix_withdraw_request, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, credix_program: credix_client::ID, }; let payload = uxd::instruction::RebalanceCreateWithdrawRequestFromCredixLpDepository {}; @@ -98,7 +90,7 @@ pub async fn process_rebalance_create_withdraw_request_from_credix_lp_depository accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, payer).await?; + program_context::process_instruction(program_context, instruction, payer).await?; // Done Ok(()) diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_redeem_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_redeem_withdraw_request_from_credix_lp_depository.rs index 058fce472..2c6d6b682 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_redeem_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_rebalance_redeem_withdraw_request_from_credix_lp_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -12,20 +11,20 @@ use uxd::state::Controller; use uxd::state::CredixLpDepository; use uxd::state::IdentityDepository; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, collateral_mint: &Pubkey, - credix_multisig_key: &Pubkey, + credix_multisig: &Pubkey, profits_beneficiary_collateral: &Pubkey, expected_withdrawal_overflow_value: u64, expected_withdrawal_profits_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -60,8 +59,14 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository &credix_signing_authority, collateral_mint, ); - let credix_treasury = program_credix::accounts::find_treasury(credix_multisig_key); - let credix_treasury_collateral = program_credix::accounts::find_treasury_pool_token_account( + let credix_treasury_pool = program_credix::accounts::find_treasury_pool(credix_multisig); + let credix_treasury_pool_collateral = + program_credix::accounts::find_treasury_pool_token_account( + &credix_treasury_pool, + collateral_mint, + ); + let credix_treasury = program_credix::accounts::find_credix_treasury(credix_multisig); + let credix_treasury_collateral = program_credix::accounts::find_credix_treasury_token_account( &credix_treasury, collateral_mint, ); @@ -70,10 +75,6 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository &credix_lp_depository, ) .0; - let credix_multisig_collateral = spl_associated_token_account::get_associated_token_address( - credix_multisig_key, - collateral_mint, - ); let credix_lp_depository_collateral = program_uxd::accounts::find_credix_lp_depository_collateral( &credix_lp_depository, @@ -85,9 +86,9 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository ); // Find the credix withdraw accounts - let credix_latest_withdraw_epoch_idx = program_test_context::read_account_anchor::< + let credix_latest_withdraw_epoch_idx = program_context::read_account_anchor::< credix_client::GlobalMarketState, - >(program_test_context, &credix_global_market_state) + >(program_context, &credix_global_market_state) .await? .latest_withdraw_epoch_idx; let credix_withdraw_epoch = program_credix::accounts::find_withdraw_epoch_pda( @@ -95,42 +96,32 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository credix_latest_withdraw_epoch_idx, ) .0; - let credix_withdraw_request = program_credix::accounts::find_withdraw_request_pda( - &credix_global_market_state, - &credix_lp_depository, - credix_latest_withdraw_epoch_idx, - ) - .0; // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let credix_lp_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let credix_lp_depository_before = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let identity_depository_collateral_amount_before = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, &identity_depository_collateral, ) .await? .amount; let profits_beneficiary_collateral_amount_before = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, profits_beneficiary_collateral, ) .await? @@ -151,19 +142,18 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository credix_shares_mint, credix_pass, credix_withdraw_epoch, - credix_withdraw_request, + credix_treasury_pool_collateral, + credix_treasury, credix_treasury_collateral, - credix_multisig_key: *credix_multisig_key, - credix_multisig_collateral, profits_beneficiary_collateral: *profits_beneficiary_collateral, identity_depository, identity_depository_collateral, mercurial_vault_depository, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, credix_program: credix_client::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::RebalanceRedeemWithdrawRequestFromCredixLpDepository {}; let instruction = Instruction { @@ -171,37 +161,33 @@ pub async fn process_rebalance_redeem_withdraw_request_from_credix_lp_depository accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction(program_test_context, instruction, payer).await?; + program_context::process_instruction(program_context, instruction, payer).await?; // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let credix_lp_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &credix_lp_depository, - ) - .await?; - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let credix_lp_depository_after = program_context::read_account_anchor::( + program_context, + &credix_lp_depository, + ) + .await?; + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let identity_depository_collateral_amount_after = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, &identity_depository_collateral, ) .await? .amount; let profits_beneficiary_collateral_amount_after = - program_test_context::read_account_packed::( - program_test_context, + program_context::read_account_packed::( + program_context, profits_beneficiary_collateral, ) .await? diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem.rs index 3f17d33b5..d12564a7f 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -13,14 +12,14 @@ use uxd::state::IdentityDepository; use uxd::state::MercurialVaultDepository; use uxd::utils::calculate_amount_less_fees; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_redeem( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, collateral_mint: &Pubkey, mercurial_vault_depository_vault_lp_mint: &Pubkey, @@ -30,7 +29,7 @@ pub async fn process_redeem( redeemable_amount: u64, expected_identity_depository_redeemable_amount: u64, expected_mercurial_vault_depository_redeemable_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -70,29 +69,26 @@ pub async fn process_redeem( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -113,12 +109,12 @@ pub async fn process_redeem( mercurial_vault_depository_lp_token_vault, mercurial_vault_depository_collateral_token_safe, credix_lp_depository, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, mercurial_vault_program: mercurial_vault::ID, uxd_program: uxd::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::Redeem { redeemable_amount }; let instruction = Instruction { @@ -126,39 +122,31 @@ pub async fn process_redeem( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - user, - ) - .await?; + program_context::process_instruction_with_signer(program_context, instruction, payer, user) + .await?; // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -170,7 +158,7 @@ pub async fn process_redeem( expected_mercurial_vault_depository_redeemable_amount, mercurial_vault_depository_before.redeeming_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let mercurial_vault_depository_fees_amount = expected_mercurial_vault_depository_redeemable_amount - mercurial_vault_depository_collateral_amount; diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_identity_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_identity_depository.rs index 4b7439dd9..8f6d01d29 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_identity_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_identity_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -11,18 +10,18 @@ use spl_token::state::Mint; use uxd::state::Controller; use uxd::state::IdentityDepository; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; pub async fn process_redeem_from_identity_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, user: &Keypair, user_collateral: &Pubkey, user_redeemable: &Pubkey, redeemable_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -32,24 +31,21 @@ pub async fn process_redeem_from_identity_depository( // Read state before let redeemable_mint_before = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let identity_depository_before = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let identity_depository_before = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -64,7 +60,7 @@ pub async fn process_redeem_from_identity_depository( redeemable_mint, user_collateral: *user_collateral, user_redeemable: *user_redeemable, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, }; let payload = uxd::instruction::RedeemFromIdentityDepository { redeemable_amount }; @@ -73,8 +69,8 @@ pub async fn process_redeem_from_identity_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signers( - program_test_context, + program_context::process_instruction_with_signers( + program_context, instruction, payer, &[authority, user], @@ -83,24 +79,21 @@ pub async fn process_redeem_from_identity_depository( // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let identity_depository_after = - program_test_context::read_account_anchor::( - program_test_context, - &identity_depository, - ) - .await?; + program_context::read_account_anchor::(program_context, &controller).await?; + let identity_depository_after = program_context::read_account_anchor::( + program_context, + &identity_depository, + ) + .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_mercurial_vault_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_mercurial_vault_depository.rs index da8c2b15d..1b3baedd5 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_mercurial_vault_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_redeem_from_mercurial_vault_depository.rs @@ -1,8 +1,7 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use spl_token::state::Account; @@ -12,13 +11,13 @@ use uxd::state::Controller; use uxd::state::MercurialVaultDepository; use uxd::utils::calculate_amount_less_fees; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_redeem_from_mercurial_vault_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, @@ -27,7 +26,7 @@ pub async fn process_redeem_from_mercurial_vault_depository( user_collateral: &Pubkey, user_redeemable: &Pubkey, redeemable_amount: u64, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let redeemable_mint = program_uxd::accounts::find_redeemable_mint_pda().0; @@ -49,26 +48,24 @@ pub async fn process_redeem_from_mercurial_vault_depository( program_mercurial::accounts::find_token_vault_pda(&mercurial_vault).0; // Read state before - let redeemable_mint_before = - program_test_context::read_account_packed::( - program_test_context, - &redeemable_mint, - ) - .await?; + let redeemable_mint_before = program_context::read_account_packed::( + program_context, + &redeemable_mint, + ) + .await?; let controller_before = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_before = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_before = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_before = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_before = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -87,7 +84,7 @@ pub async fn process_redeem_from_mercurial_vault_depository( mercurial_vault, mercurial_vault_lp_mint: *mercurial_vault_lp_mint, mercurial_vault_collateral_token_safe, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, mercurial_vault_program: mercurial_vault::ID, }; @@ -97,8 +94,8 @@ pub async fn process_redeem_from_mercurial_vault_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signers( - program_test_context, + program_context::process_instruction_with_signers( + program_context, instruction, payer, &[authority, user], @@ -107,22 +104,20 @@ pub async fn process_redeem_from_mercurial_vault_depository( // Read state after let redeemable_mint_after = - program_test_context::read_account_packed::(program_test_context, &redeemable_mint) - .await?; + program_context::read_account_packed::(program_context, &redeemable_mint).await?; let controller_after = - program_test_context::read_account_anchor::(program_test_context, &controller) - .await?; - let mercurial_vault_depository_after = program_test_context::read_account_anchor::< + program_context::read_account_anchor::(program_context, &controller).await?; + let mercurial_vault_depository_after = program_context::read_account_anchor::< MercurialVaultDepository, - >(program_test_context, &mercurial_vault_depository) + >(program_context, &mercurial_vault_depository) .await?; let user_collateral_amount_after = - program_test_context::read_account_packed::(program_test_context, user_collateral) + program_context::read_account_packed::(program_context, user_collateral) .await? .amount; let user_redeemable_amount_after = - program_test_context::read_account_packed::(program_test_context, user_redeemable) + program_context::read_account_packed::(program_context, user_redeemable) .await? .amount; @@ -131,7 +126,7 @@ pub async fn process_redeem_from_mercurial_vault_depository( redeemable_amount, mercurial_vault_depository_before.minting_fee_in_bps, ) - .map_err(program_test_context::ProgramTestError::Anchor)?; + .map_err(program_context::ProgramError::Anchor)?; let fees_amount = redeemable_amount - collateral_amount; // redeemable_mint.supply must have decreased by the redeemed amount (equivalent to redeemable_amount) diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_credix_lp_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_credix_lp_depository.rs index a3e981737..62edd5639 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_credix_lp_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_credix_lp_depository.rs @@ -1,24 +1,23 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_register_credix_lp_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, minting_fee_in_bps: u8, redeeming_fee_in_bps: u8, redeemable_amount_under_management_cap: u128, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let credix_program_state = program_credix::accounts::find_program_state_pda().0; @@ -62,10 +61,10 @@ pub async fn process_register_credix_lp_depository( credix_signing_authority, credix_liquidity_collateral, credix_shares_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, associated_token_program: anchor_spl::associated_token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::RegisterCredixLpDepository { minting_fee_in_bps, @@ -77,11 +76,6 @@ pub async fn process_register_credix_lp_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - authority, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, payer, authority) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_mercurial_vault_depository.rs b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_mercurial_vault_depository.rs index 96e4c95d9..8bd38a027 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_mercurial_vault_depository.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/instructions/process_register_mercurial_vault_depository.rs @@ -1,18 +1,17 @@ use anchor_lang::InstructionData; use anchor_lang::ToAccountMetas; -use solana_program::instruction::Instruction; -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::instruction::Instruction; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_register_mercurial_vault_depository( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, @@ -20,7 +19,7 @@ pub async fn process_register_mercurial_vault_depository( minting_fee_in_bps: u8, redeeming_fee_in_bps: u8, redeemable_amount_under_management_cap: u128, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find needed accounts let controller = program_uxd::accounts::find_controller_pda().0; let mercurial_base = program_mercurial::accounts::find_base(); @@ -48,9 +47,9 @@ pub async fn process_register_mercurial_vault_depository( depository_lp_token_vault: mercurial_vault_depository_lp_token_vault, mercurial_vault, mercurial_vault_lp_mint: *mercurial_vault_lp_mint, - system_program: anchor_lang::system_program::ID, + system_program: solana_sdk::system_program::ID, token_program: anchor_spl::token::ID, - rent: anchor_lang::solana_program::sysvar::rent::ID, + rent: solana_sdk::sysvar::rent::ID, }; let payload = uxd::instruction::RegisterMercurialVaultDepository { minting_fee_in_bps, @@ -62,11 +61,6 @@ pub async fn process_register_mercurial_vault_depository( accounts: accounts.to_account_metas(None), data: payload.data(), }; - program_test_context::process_instruction_with_signer( - program_test_context, - instruction, - payer, - authority, - ) - .await + program_context::process_instruction_with_signer(program_context, instruction, payer, authority) + .await } diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_deploy_program.rs b/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_deploy_program.rs index bcc284b29..5a21ad954 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_deploy_program.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_deploy_program.rs @@ -1,5 +1,4 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; @@ -8,15 +7,15 @@ use uxd::instructions::EditCredixLpDepositoryFields; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[allow(clippy::too_many_arguments)] pub async fn process_deploy_program( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Keypair, @@ -24,7 +23,7 @@ pub async fn process_deploy_program( credix_multisig: &Keypair, collateral_mint_decimals: u8, redeemable_mint_decimals: u8, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Use restictive default values for all tests // Can be modified in individual test cases through edits // This forces all tests be explicit about their requirements @@ -44,7 +43,7 @@ pub async fn process_deploy_program( // Create the collateral mint program_spl::instructions::process_token_mint_init( - program_test_context, + program_context, payer, collateral_mint, collateral_mint_decimals, @@ -54,14 +53,14 @@ pub async fn process_deploy_program( // Controller setup program_uxd::instructions::process_initialize_controller( - program_test_context, + program_context, payer, authority, redeemable_mint_decimals, ) .await?; program_uxd::instructions::process_edit_controller( - program_test_context, + program_context, payer, authority, &EditControllerFields { @@ -77,14 +76,14 @@ pub async fn process_deploy_program( // Identity depository setup program_uxd::instructions::process_initialize_identity_depository( - program_test_context, + program_context, payer, authority, &collateral_mint.pubkey(), ) .await?; program_uxd::instructions::process_edit_identity_depository( - program_test_context, + program_context, payer, authority, &EditIdentityDepositoryFields { @@ -98,17 +97,19 @@ pub async fn process_deploy_program( // Mercurial onchain dependency program deployment let mercurial_admin = Keypair::new(); - let mercurial_vault_lp_mint_decimals = collateral_mint_decimals; + program_context + .process_airdrop(&mercurial_admin.pubkey(), 1_000_000_000_000) + .await?; program_mercurial::procedures::process_deploy_program( - program_test_context, + program_context, &mercurial_admin, &collateral_mint.pubkey(), mercurial_vault_lp_mint, - mercurial_vault_lp_mint_decimals, + collateral_mint_decimals, ) .await?; program_mercurial::procedures::process_dummy_actors_behaviors( - program_test_context, + program_context, collateral_mint, &mercurial_vault_lp_mint.pubkey(), ) @@ -116,7 +117,7 @@ pub async fn process_deploy_program( // Mercurial vault depository setup program_uxd::instructions::process_register_mercurial_vault_depository( - program_test_context, + program_context, payer, authority, &collateral_mint.pubkey(), @@ -127,7 +128,7 @@ pub async fn process_deploy_program( ) .await?; program_uxd::instructions::process_edit_mercurial_vault_depository( - program_test_context, + program_context, payer, authority, &collateral_mint.pubkey(), @@ -146,14 +147,17 @@ pub async fn process_deploy_program( .await?; // Credix onchain dependency program deployment + program_context + .process_airdrop(&credix_multisig.pubkey(), 1_000_000_000_000) + .await?; program_credix::procedures::process_deploy_program( - program_test_context, + program_context, credix_multisig, &collateral_mint.pubkey(), ) .await?; program_credix::procedures::process_dummy_actors_behaviors( - program_test_context, + program_context, credix_multisig, &collateral_mint.pubkey(), collateral_mint, @@ -171,7 +175,7 @@ pub async fn process_deploy_program( ) .0; program_credix::instructions::process_create_credix_pass( - program_test_context, + program_context, credix_multisig, &credix_lp_depository, &credix_client::instruction::CreateCredixPass { @@ -187,7 +191,7 @@ pub async fn process_deploy_program( // Credix lp depository setup program_uxd::instructions::process_register_credix_lp_depository( - program_test_context, + program_context, payer, authority, &collateral_mint.pubkey(), @@ -197,7 +201,7 @@ pub async fn process_deploy_program( ) .await?; program_uxd::instructions::process_edit_credix_lp_depository( - program_test_context, + program_context, payer, authority, &collateral_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_set_router_depositories.rs b/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_set_router_depositories.rs index 68f9866ac..846240958 100644 --- a/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_set_router_depositories.rs +++ b/programs/uxd/tests/integration_tests/api/program_uxd/procedures/process_set_router_depositories.rs @@ -1,22 +1,21 @@ -use solana_program::pubkey::Pubkey; -use solana_program_test::ProgramTestContext; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use uxd::instructions::EditControllerFields; use uxd::instructions::EditRouterDepositories; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_mercurial; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; pub async fn process_set_router_depositories( - program_test_context: &mut ProgramTestContext, + program_context: &mut Box, payer: &Keypair, authority: &Keypair, collateral_mint: &Pubkey, -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // Find the important PDAs to resolve the depositories address to be whitelisted let identity_depository = program_uxd::accounts::find_identity_depository_pda().0; @@ -40,7 +39,7 @@ pub async fn process_set_router_depositories( // Set the controller's depositories addresses program_uxd::instructions::process_edit_controller( - program_test_context, + program_context, payer, authority, &EditControllerFields { diff --git a/programs/uxd/tests/integration_tests/suites/mod.rs b/programs/uxd/tests/integration_tests/suites/mod.rs index 16f6ae855..cf8a40534 100644 --- a/programs/uxd/tests/integration_tests/suites/mod.rs +++ b/programs/uxd/tests/integration_tests/suites/mod.rs @@ -5,6 +5,7 @@ pub mod test_credix_lp_depository_rebalance_illiquid; pub mod test_credix_lp_depository_rebalance_liquid; pub mod test_credix_lp_depository_rebalance_no_overflow; pub mod test_credix_lp_depository_rebalance_under_requested; +pub mod test_ensure_devnet; pub mod test_identity_depository_edit; pub mod test_identity_depository_mint_and_redeem; pub mod test_mercurial_vault_depository_edit; diff --git a/programs/uxd/tests/integration_tests/suites/test_controller_edit.rs b/programs/uxd/tests/integration_tests/suites/test_controller_edit.rs index 5391d6b12..928f97927 100644 --- a/programs/uxd/tests/integration_tests/suites/test_controller_edit.rs +++ b/programs/uxd/tests/integration_tests/suites/test_controller_edit.rs @@ -1,5 +1,5 @@ -use anchor_lang::prelude::Pubkey; use solana_program_test::tokio; +use solana_sdk::pubkey::Pubkey; use solana_sdk::signer::keypair::Keypair; use solana_sdk::signer::Signer; @@ -7,27 +7,24 @@ use uxd::instructions::EditControllerFields; use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditRouterDepositories; -use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; #[tokio::test] -async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestError> { +async fn test_controller_edit() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -41,7 +38,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -59,7 +56,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Using the wrong authority should fail assert!(program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &payer, &EditControllerFields { @@ -76,7 +73,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Using the correct authority should succeed program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -92,7 +89,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Setting weights that dont add up to 100% should fail assert!(program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -113,7 +110,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Setting weights that add up to 100% should succeed program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -133,7 +130,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Using the correct authority should allow to edit depositories addresses program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -153,7 +150,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Using None should succeed program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -169,7 +166,7 @@ async fn test_controller_edit() -> Result<(), program_test_context::ProgramTestE // Setting everything at once should succeed program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_edit.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_edit.rs index e0f289d24..d39e6aa53 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_edit.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_edit.rs @@ -4,27 +4,25 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditCredixLpDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[tokio::test] -async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::ProgramTestError> { +async fn test_credix_lp_depository_edit() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -38,7 +36,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -51,7 +49,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Initialize some ATAs let payer_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &payer.pubkey(), @@ -59,7 +57,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr .await?; let authority_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &authority.pubkey(), @@ -73,7 +71,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change redeemable_amount_under_management_cap program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -89,7 +87,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change minting_fee_in_bps program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -105,7 +103,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change redeeming_fee_in_bps program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -121,7 +119,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change minting_disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -137,7 +135,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change profits_beneficiary_collateral program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -159,7 +157,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change everything, using the wrong authority (should fail) assert!( program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &payer, &collateral_mint.pubkey(), @@ -177,7 +175,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change everything, using the correct authority (should succeed) program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -193,7 +191,7 @@ async fn test_credix_lp_depository_edit() -> Result<(), program_test_context::Pr // Change nothing, using the correct authority (should succeed) program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_mint.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_mint.rs index f10ceffb3..a3e2ea303 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_mint.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_mint.rs @@ -5,28 +5,26 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditControllerFields; use uxd::instructions::EditCredixLpDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] -async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::ProgramTestError> { +async fn test_credix_lp_depository_mint() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -40,7 +38,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -56,7 +54,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -64,7 +62,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -94,7 +92,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting should fail because the user doesnt have collateral yet assert!( program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -109,7 +107,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -121,7 +119,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting should fail because the controller cap is too low assert!( program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -136,7 +134,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Set the controller cap program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -153,7 +151,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting should fail because the depository cap is too low assert!( program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -168,7 +166,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -185,7 +183,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting too much should fail (above cap, but enough collateral) assert!( program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -201,7 +199,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting zero should fail assert!( program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -222,7 +220,7 @@ async fn test_credix_lp_depository_mint() -> Result<(), program_test_context::Pr // Minting should work now that everything is set program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_illiquid.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_illiquid.rs index 5ef126eb4..7dc2d3a8e 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_illiquid.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_illiquid.rs @@ -10,30 +10,28 @@ use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] -async fn test_credix_lp_depository_rebalance_illiquid( -) -> Result<(), program_test_context::ProgramTestError> { +async fn test_credix_lp_depository_rebalance_illiquid() -> Result<(), program_context::ProgramError> +{ // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -47,7 +45,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -64,7 +62,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -72,7 +70,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -82,7 +80,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Create a collateral account for our profits_beneficiary let profits_beneficiary_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &profits_beneficiary.pubkey(), @@ -108,7 +106,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -119,7 +117,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Set the controller cap and the weights program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -139,7 +137,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Now we set the router depositories to the correct PDAs program_uxd::procedures::process_set_router_depositories( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -148,7 +146,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Set the identity_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -160,7 +158,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Set the mercurial_vault_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -176,7 +174,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Set the credix_lp_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -192,7 +190,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Minting on credix should work now that everything is set program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -216,8 +214,8 @@ async fn test_credix_lp_depository_rebalance_illiquid( &credix_signing_authority, &collateral_mint.pubkey(), ); - let credix_liquidity_collateral_amount = program_test_context::read_account_packed::( - &mut program_test_context, + let credix_liquidity_collateral_amount = program_context::read_account_packed::( + &mut program_context, &credix_liquidity_collateral, ) .await? @@ -225,7 +223,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Have a borrower borrow EVERYTHING except a tiny liquid amount program_credix::procedures::process_dummy_borrower( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), &collateral_mint, @@ -243,7 +241,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Create an epoch (done by credix team usually) program_credix::instructions::process_create_withdraw_epoch( - &mut program_test_context, + &mut program_context, &credix_multisig, 1, ) @@ -251,19 +249,20 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Since the epoch was just created it should be available to create a WithdrawRequest program_uxd::instructions::process_rebalance_create_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), ) .await?; // Pretend 3 days have passed (the time for the request period) - program_test_context::move_clock_forward(&mut program_test_context, 3 * SECONDS_PER_DAY, 1) + program_context + .move_clock_forward(3 * SECONDS_PER_DAY, 1) .await?; // Set the epoch's locked liquidity (done by credix team usually) program_credix::instructions::process_set_locked_liquidity( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), ) @@ -279,7 +278,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Executing the rebalance request should now work as intended because we are in the execute period program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), @@ -294,7 +293,7 @@ async fn test_credix_lp_depository_rebalance_illiquid( // Any subsequent execution should yield zero movement (since we already moved funds) program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_liquid.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_liquid.rs index 78303dee2..b781dffac 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_liquid.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_liquid.rs @@ -9,30 +9,27 @@ use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] -async fn test_credix_lp_depository_rebalance_liquid( -) -> Result<(), program_test_context::ProgramTestError> { +async fn test_credix_lp_depository_rebalance_liquid() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -46,7 +43,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -63,7 +60,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -71,7 +68,7 @@ async fn test_credix_lp_depository_rebalance_liquid( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -81,7 +78,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Create a collateral account for our profits_beneficiary let profits_beneficiary_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &profits_beneficiary.pubkey(), @@ -106,7 +103,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -117,7 +114,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Set the controller cap and the weights program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -137,7 +134,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Now we set the router depositories to the correct PDAs program_uxd::procedures::process_set_router_depositories( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -146,7 +143,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Set the identity_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -158,7 +155,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Set the mercurial_vault_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -174,7 +171,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Set the credix_lp_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -190,7 +187,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Minting on credix should work now that everything is set program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -209,7 +206,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Create an epoch (done by credix team usually) program_credix::instructions::process_create_withdraw_epoch( - &mut program_test_context, + &mut program_context, &credix_multisig, 1, ) @@ -217,7 +214,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Since the epoch was just created it should be available to create a WithdrawRequest program_uxd::instructions::process_rebalance_create_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), ) @@ -226,7 +223,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Any subsequent creation of the WithdrawRequest should fail assert!( program_uxd::instructions::process_rebalance_create_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), ) @@ -237,7 +234,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Executing the WithdrawRequest should fail because we are still in the request period assert!( program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), @@ -250,12 +247,13 @@ async fn test_credix_lp_depository_rebalance_liquid( ); // Pretend 3 days have passed (the time for the request period) - program_test_context::move_clock_forward(&mut program_test_context, 3 * SECONDS_PER_DAY, 1) + program_context + .move_clock_forward(3 * SECONDS_PER_DAY, 1) .await?; // Set the epoch's locked liquidity (done by credix team usually) program_credix::instructions::process_set_locked_liquidity( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), ) @@ -271,7 +269,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Executing the rebalance request should now work as intended because we are in the execute period program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), @@ -284,7 +282,7 @@ async fn test_credix_lp_depository_rebalance_liquid( // Any subsequent execution should yield zero movement (since we already moved funds) program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_no_overflow.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_no_overflow.rs index 0da79ccbc..6b487379c 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_no_overflow.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_no_overflow.rs @@ -9,30 +9,28 @@ use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] async fn test_credix_lp_depository_rebalance_no_overflow( -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -46,7 +44,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -63,7 +61,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -71,7 +69,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -81,7 +79,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Create a collateral account for our profits_beneficiary let profits_beneficiary_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &profits_beneficiary.pubkey(), @@ -105,7 +103,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -116,7 +114,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Set the controller cap and the weights program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -136,7 +134,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Now we set the router depositories to the correct PDAs program_uxd::procedures::process_set_router_depositories( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -145,7 +143,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Set the identity_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -157,7 +155,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Set the mercurial_vault_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -173,7 +171,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Set the credix_lp_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -189,7 +187,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Minting on credix should work now that everything is set program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -207,7 +205,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Create an epoch (done by credix team usually) program_credix::instructions::process_create_withdraw_epoch( - &mut program_test_context, + &mut program_context, &credix_multisig, 1, ) @@ -215,19 +213,20 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Since the epoch was just created it should be available to create a WithdrawRequest program_uxd::instructions::process_rebalance_create_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), ) .await?; // Pretend 3 days have passed (the time for the request period) - program_test_context::move_clock_forward(&mut program_test_context, 3 * SECONDS_PER_DAY, 1) + program_context + .move_clock_forward(3 * SECONDS_PER_DAY, 1) .await?; // Set the epoch's locked liquidity (done by credix team usually) program_credix::instructions::process_set_locked_liquidity( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), ) @@ -236,7 +235,7 @@ async fn test_credix_lp_depository_rebalance_no_overflow( // Executing the rebalance request should now work as intended because we are in the execute period let expected_credix_profits = amount_the_user_should_be_able_to_mint / 100; // minting fees 1% program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_under_requested.rs b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_under_requested.rs index 66d42e159..a4d24f7c5 100644 --- a/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_under_requested.rs +++ b/programs/uxd/tests/integration_tests/suites/test_credix_lp_depository_rebalance_under_requested.rs @@ -9,30 +9,28 @@ use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_credix; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] async fn test_credix_lp_depository_rebalance_under_requested( -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -46,7 +44,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -63,7 +61,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -71,7 +69,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -81,7 +79,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Create a collateral account for our profits_beneficiary let profits_beneficiary_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &profits_beneficiary.pubkey(), @@ -110,7 +108,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -121,7 +119,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Set the controller cap and the weights program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -141,7 +139,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Now we set the router depositories to the correct PDAs program_uxd::procedures::process_set_router_depositories( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -150,7 +148,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Set the identity_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -162,7 +160,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Set the mercurial_vault_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -178,7 +176,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Set the credix_lp_depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -201,7 +199,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Minting on credix should work, happens BEFORE the request program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -214,7 +212,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Create an epoch (done by credix team usually) program_credix::instructions::process_create_withdraw_epoch( - &mut program_test_context, + &mut program_context, &credix_multisig, 1, ) @@ -222,7 +220,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Since the epoch was just created it should be available to create a WithdrawRequest program_uxd::instructions::process_rebalance_create_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), ) @@ -230,7 +228,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Minting on credix should work, but happens AFTER the request program_uxd::instructions::process_mint_with_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -243,7 +241,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Simulate a competing investor that will compete for our withdraw liquidity program_credix::procedures::process_dummy_investor( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), &collateral_mint, @@ -253,12 +251,13 @@ async fn test_credix_lp_depository_rebalance_under_requested( .await?; // Pretend 3 days have passed (the time for the request period) - program_test_context::move_clock_forward(&mut program_test_context, 3 * SECONDS_PER_DAY, 1) + program_context + .move_clock_forward(3 * SECONDS_PER_DAY, 1) .await?; // Set the epoch's locked liquidity (done by credix team usually) program_credix::instructions::process_set_locked_liquidity( - &mut program_test_context, + &mut program_context, &credix_multisig, &collateral_mint.pubkey(), ) @@ -278,7 +277,7 @@ async fn test_credix_lp_depository_rebalance_under_requested( // Executing the rebalance request should now work as intended because we are in the execute period program_uxd::instructions::process_rebalance_redeem_withdraw_request_from_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &credix_multisig.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_ensure_devnet.rs b/programs/uxd/tests/integration_tests/suites/test_ensure_devnet.rs new file mode 100644 index 000000000..662e5326a --- /dev/null +++ b/programs/uxd/tests/integration_tests/suites/test_ensure_devnet.rs @@ -0,0 +1,342 @@ +use solana_program_test::tokio; +use solana_sdk::pubkey::Pubkey; +use solana_sdk::signer::keypair::Keypair; +use solana_sdk::signer::Signer; +use std::str::FromStr; + +use uxd::instructions::EditControllerFields; +use uxd::instructions::EditCredixLpDepositoryFields; +use uxd::instructions::EditDepositoriesRoutingWeightBps; +use uxd::instructions::EditIdentityDepositoryFields; +use uxd::instructions::EditMercurialVaultDepositoryFields; +use uxd::instructions::EditRouterDepositories; + +use crate::integration_tests::api::program_context; +use crate::integration_tests::api::program_credix; +use crate::integration_tests::api::program_mercurial; +use crate::integration_tests::api::program_spl; +use crate::integration_tests::api::program_uxd; +use crate::integration_tests::utils::ui_amount_to_native_amount; + +use solana_client::nonblocking::rpc_client::RpcClient; + +fn create_keypair(secret: [u8; 64]) -> Result { + Keypair::from_bytes(&secret) + .map_err(|e| program_context::ProgramError::Signature(e.to_string())) +} + +#[tokio::test] +async fn test_ensure_devnet() -> Result<(), program_context::ProgramError> { + // --------------------------------------------------------------------- + // -- Setup basic context and accounts needed for devnet setup + // --------------------------------------------------------------------- + + let mut program_context: Box = + Box::new(RpcClient::new("https://api.devnet.solana.com".to_string())); + + // Eyh77zP5b7arPtPgpnCT8vsGmq9p5Z9HHnBSeQLnAFQi + let payer = create_keypair([ + 219, 139, 131, 236, 34, 125, 165, 13, 18, 248, 93, 160, 73, 236, 214, 251, 179, 235, 124, + 126, 56, 47, 222, 28, 166, 239, 130, 126, 66, 127, 26, 187, 207, 173, 205, 133, 48, 102, 2, + 219, 20, 234, 72, 102, 53, 122, 175, 166, 198, 11, 198, 248, 59, 40, 137, 208, 193, 138, + 197, 171, 147, 124, 212, 175, + ])?; + // aca3VWxwBeu8FTZowJ9hfSKGzntjX68EXh1N9xpE1PC + let authority = create_keypair([ + 197, 246, 88, 131, 17, 216, 175, 8, 72, 13, 40, 236, 135, 104, 59, 108, 17, 106, 164, 234, + 46, 136, 171, 148, 111, 176, 32, 136, 59, 253, 224, 247, 8, 156, 98, 175, 196, 123, 178, + 151, 182, 220, 253, 138, 191, 233, 135, 182, 173, 175, 33, 68, 162, 191, 254, 166, 133, + 219, 8, 10, 17, 154, 146, 223, + ])?; + + // Reuse somewhat common mint used by credix for devnet USDC + let collateral_mint = Pubkey::from_str("Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr").unwrap(); + + // Create a collateral account for our profits_beneficiary (owned by authority) + let profits_beneficiary_collateral = + program_spl::instructions::process_associated_token_account_get_or_init( + &mut program_context, + &payer, + &collateral_mint, + &authority.pubkey(), + ) + .await?; + + // Set all caps to a very large amount (1B) + let supply_cap = u128::from(ui_amount_to_native_amount(1_000_000_000, 6)); + + // --------------------------------------------------------------------- + // -- Useful ATAs + // --------------------------------------------------------------------- + + let authority_collateral = + program_spl::instructions::process_associated_token_account_get_or_init( + &mut program_context, + &payer, + &collateral_mint, + &authority.pubkey(), + ) + .await?; + let authority_redeemable = + program_spl::instructions::process_associated_token_account_get_or_init( + &mut program_context, + &payer, + &program_uxd::accounts::find_redeemable_mint_pda().0, + &authority.pubkey(), + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup mercurial instance + // --------------------------------------------------------------------- + + let mercurial_vault_lp_mint = create_keypair([ + 90, 138, 35, 214, 209, 183, 0, 86, 76, 138, 199, 70, 48, 104, 9, 227, 94, 43, 67, 26, 233, + 128, 61, 117, 130, 99, 181, 114, 127, 100, 200, 129, 13, 59, 134, 19, 81, 172, 155, 180, + 150, 234, 35, 53, 105, 199, 116, 239, 239, 77, 142, 60, 202, 215, 83, 80, 173, 34, 95, 47, + 34, 66, 44, 26, + ])?; + + if !program_context::read_account_exists( + &mut program_context, + &mercurial_vault_lp_mint.pubkey(), + ) + .await? + { + program_mercurial::procedures::process_deploy_program( + &mut program_context, + &payer, + &collateral_mint, + &mercurial_vault_lp_mint, + 6, + ) + .await?; + } + + let authority_mercurial_lp = + program_spl::instructions::process_associated_token_account_get_or_init( + &mut program_context, + &payer, + &mercurial_vault_lp_mint.pubkey(), + &authority.pubkey(), + ) + .await?; + program_mercurial::instructions::process_deposit( + &mut program_context, + &collateral_mint, + &mercurial_vault_lp_mint.pubkey(), + &authority, + &authority_collateral, + &authority_mercurial_lp, + 10_000, // 0.01 collateral + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup controller + // --------------------------------------------------------------------- + + let controller = program_uxd::accounts::find_controller_pda().0; + if !program_context::read_account_exists(&mut program_context, &controller).await? { + program_uxd::instructions::process_initialize_controller( + &mut program_context, + &payer, + &authority, + 6, + ) + .await?; + } + + program_uxd::instructions::process_edit_controller( + &mut program_context, + &payer, + &authority, + &EditControllerFields { + redeemable_global_supply_cap: Some(supply_cap), + depositories_routing_weight_bps: None, + router_depositories: None, + outflow_limit_per_epoch_amount: None, + outflow_limit_per_epoch_bps: Some(100 * 100), // 100% + slots_per_epoch: Some(172800), + }, + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup identity_depository + // --------------------------------------------------------------------- + + let identity_depository = program_uxd::accounts::find_identity_depository_pda().0; + if !program_context::read_account_exists(&mut program_context, &identity_depository).await? { + program_uxd::instructions::process_initialize_identity_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + ) + .await?; + } + program_uxd::instructions::process_edit_identity_depository( + &mut program_context, + &payer, + &authority, + &EditIdentityDepositoryFields { + redeemable_amount_under_management_cap: Some(supply_cap), + minting_disabled: Some(false), + }, + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup mercurial_vault_depository + // --------------------------------------------------------------------- + + let mercurial_base = program_mercurial::accounts::find_base(); + let mercurial_vault = + program_mercurial::accounts::find_vault_pda(&collateral_mint, &mercurial_base.pubkey()).0; + let mercurial_vault_depository = program_uxd::accounts::find_mercurial_vault_depository_pda( + &collateral_mint, + &mercurial_vault, + ) + .0; + + if !program_context::read_account_exists(&mut program_context, &mercurial_vault_depository) + .await? + { + program_uxd::instructions::process_register_mercurial_vault_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + &mercurial_vault_lp_mint.pubkey(), + 0, + 0, + 0, + ) + .await?; + } + program_uxd::instructions::process_edit_mercurial_vault_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + &EditMercurialVaultDepositoryFields { + redeemable_amount_under_management_cap: Some(supply_cap), + minting_fee_in_bps: Some(100), + redeeming_fee_in_bps: Some(100), + minting_disabled: Some(false), + profits_beneficiary_collateral: Some(profits_beneficiary_collateral), + }, + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup credix_lp_depository + // --------------------------------------------------------------------- + + let credix_market_seeds = program_credix::accounts::find_market_seeds(); + let credix_global_market_state = + program_credix::accounts::find_global_market_state_pda(&credix_market_seeds).0; + let credix_lp_depository = program_uxd::accounts::find_credix_lp_depository_pda( + &collateral_mint, + &credix_global_market_state, + ) + .0; + + if !program_context::read_account_exists(&mut program_context, &credix_lp_depository).await? { + program_uxd::instructions::process_register_credix_lp_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + 0, + 0, + 0, + ) + .await?; + } + program_uxd::instructions::process_edit_credix_lp_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + &EditCredixLpDepositoryFields { + redeemable_amount_under_management_cap: Some(supply_cap), + minting_fee_in_bps: Some(100), + redeeming_fee_in_bps: Some(100), + minting_disabled: Some(false), + profits_beneficiary_collateral: Some(profits_beneficiary_collateral), + }, + ) + .await?; + + // --------------------------------------------------------------------- + // -- Setup router + // --------------------------------------------------------------------- + + program_uxd::instructions::process_edit_controller( + &mut program_context, + &payer, + &authority, + &EditControllerFields { + redeemable_global_supply_cap: None, + depositories_routing_weight_bps: Some(EditDepositoriesRoutingWeightBps { + identity_depository_weight_bps: 34 * 100, // 34% + mercurial_vault_depository_weight_bps: 33 * 100, // 33% + credix_lp_depository_weight_bps: 33 * 100, // 33% + }), + router_depositories: Some(EditRouterDepositories { + identity_depository, + mercurial_vault_depository, + credix_lp_depository, + }), + outflow_limit_per_epoch_amount: None, + outflow_limit_per_epoch_bps: None, + slots_per_epoch: None, + }, + ) + .await?; + + // --------------------------------------------------------------------- + // -- Check that all mints work + // --------------------------------------------------------------------- + + program_uxd::instructions::process_mint_with_identity_depository( + &mut program_context, + &payer, + &authority, + &authority, + &authority_collateral, + &authority_redeemable, + 10_000, // 0.01 collateral + ) + .await?; + + program_uxd::instructions::process_mint_with_mercurial_vault_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + &mercurial_vault_lp_mint.pubkey(), + &authority, + &authority_collateral, + &authority_redeemable, + 10_000, // 0.01 collateral + ) + .await?; + + program_uxd::instructions::process_mint_with_credix_lp_depository( + &mut program_context, + &payer, + &authority, + &collateral_mint, + &authority, + &authority_collateral, + &authority_redeemable, + 10_000, // 0.01 collateral + ) + .await?; + + // Done + Ok(()) +} diff --git a/programs/uxd/tests/integration_tests/suites/test_identity_depository_edit.rs b/programs/uxd/tests/integration_tests/suites/test_identity_depository_edit.rs index 31a2f1b21..ce256ef1d 100644 --- a/programs/uxd/tests/integration_tests/suites/test_identity_depository_edit.rs +++ b/programs/uxd/tests/integration_tests/suites/test_identity_depository_edit.rs @@ -4,27 +4,24 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditIdentityDepositoryFields; -use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_uxd; #[tokio::test] -async fn test_identity_depository_edit() -> Result<(), program_test_context::ProgramTestError> { +async fn test_identity_depository_edit() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -38,7 +35,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -56,7 +53,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Change redeemable_amount_under_management_cap program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -68,7 +65,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Change minting_disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -85,7 +82,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Change everything, using the wrong authority (should fail) assert!(program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &payer, &EditIdentityDepositoryFields { @@ -98,7 +95,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Change everything, using the correct authority (should succeed) program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -110,7 +107,7 @@ async fn test_identity_depository_edit() -> Result<(), program_test_context::Pro // Change nothing, using the correct authority (should succeed) program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { diff --git a/programs/uxd/tests/integration_tests/suites/test_identity_depository_mint_and_redeem.rs b/programs/uxd/tests/integration_tests/suites/test_identity_depository_mint_and_redeem.rs index 128b2b945..d71d00aae 100644 --- a/programs/uxd/tests/integration_tests/suites/test_identity_depository_mint_and_redeem.rs +++ b/programs/uxd/tests/integration_tests/suites/test_identity_depository_mint_and_redeem.rs @@ -5,29 +5,26 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditControllerFields; use uxd::instructions::EditIdentityDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] -async fn test_identity_depository_mint_and_redeem( -) -> Result<(), program_test_context::ProgramTestError> { +async fn test_identity_depository_mint_and_redeem() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -41,7 +38,7 @@ async fn test_identity_depository_mint_and_redeem( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -57,7 +54,7 @@ async fn test_identity_depository_mint_and_redeem( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -65,7 +62,7 @@ async fn test_identity_depository_mint_and_redeem( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -98,7 +95,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting should fail because the user doesnt have collateral yet assert!( program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -112,7 +109,7 @@ async fn test_identity_depository_mint_and_redeem( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -124,7 +121,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting should fail because the controller cap is too low assert!( program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -138,7 +135,7 @@ async fn test_identity_depository_mint_and_redeem( // Set the controller cap program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -155,7 +152,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting should fail because the depository cap is too low assert!( program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -169,7 +166,7 @@ async fn test_identity_depository_mint_and_redeem( // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -182,7 +179,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting too much should fail (above cap, but enough collateral) assert!( program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -197,7 +194,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting zero should fail assert!( program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -219,7 +216,7 @@ async fn test_identity_depository_mint_and_redeem( // Minting should work now that everything is set program_uxd::instructions::process_mint_with_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -231,7 +228,7 @@ async fn test_identity_depository_mint_and_redeem( // Redeeming the correct amount should succeed program_uxd::instructions::process_redeem_from_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -244,7 +241,7 @@ async fn test_identity_depository_mint_and_redeem( // Redeeming too much should fail assert!( program_uxd::instructions::process_redeem_from_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, @@ -259,7 +256,7 @@ async fn test_identity_depository_mint_and_redeem( // Redeeming zero should fail assert!( program_uxd::instructions::process_redeem_from_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &user, diff --git a/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_edit.rs b/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_edit.rs index 6c685e5a7..2dff824cb 100644 --- a/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_edit.rs +++ b/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_edit.rs @@ -4,28 +4,25 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; #[tokio::test] -async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_context::ProgramTestError> -{ +async fn test_mercurial_vault_depository_edit() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -39,7 +36,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -52,7 +49,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Initialize some ATAs let payer_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &payer.pubkey(), @@ -60,7 +57,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte .await?; let authority_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &authority.pubkey(), @@ -74,7 +71,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change redeemable_amount_under_management_cap program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -90,7 +87,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change minting_fee_in_bps program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -106,7 +103,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change redeeming_fee_in_bps program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -122,7 +119,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change minting_disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -138,7 +135,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change profits_beneficiary_collateral program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -160,7 +157,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change everything, using the wrong authority (should fail) assert!( program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &payer, &collateral_mint.pubkey(), @@ -178,7 +175,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change everything, using the correct authority (should succeed) program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -194,7 +191,7 @@ async fn test_mercurial_vault_depository_edit() -> Result<(), program_test_conte // Change nothing, using the correct authority (should succeed) program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_mint_and_redeem_and_collect_profits.rs b/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_mint_and_redeem_and_collect_profits.rs index 947930544..811150a7a 100644 --- a/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_mint_and_redeem_and_collect_profits.rs +++ b/programs/uxd/tests/integration_tests/suites/test_mercurial_vault_depository_mint_and_redeem_and_collect_profits.rs @@ -4,29 +4,27 @@ use solana_sdk::signer::Signer; use uxd::instructions::EditControllerFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( -) -> Result<(), program_test_context::ProgramTestError> { +) -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -40,7 +38,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -57,7 +55,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -65,7 +63,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -75,7 +73,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Create a collateral account for our profits_beneficiary let profits_beneficiary_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &profits_beneficiary.pubkey(), @@ -108,7 +106,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting should fail because the user doesnt have collateral yet assert!( program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -124,7 +122,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -136,7 +134,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting should fail because the controller cap is too low assert!( program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -152,7 +150,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Set the controller cap program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -169,7 +167,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting should fail because the depository cap is too low assert!( program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -185,7 +183,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -202,7 +200,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting too much should fail (above cap, but enough collateral) assert!( program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -219,7 +217,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting zero should fail assert!( program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -243,7 +241,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Minting should work now that everything is set program_uxd::instructions::process_mint_with_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -257,7 +255,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Redeeming the correct amount should succeed program_uxd::instructions::process_redeem_from_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -272,7 +270,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Redeeming too much should fail assert!( program_uxd::instructions::process_redeem_from_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -289,7 +287,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Redeeming zero should fail assert!( program_uxd::instructions::process_redeem_from_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -313,7 +311,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Collecting profits first should fail because we havent set a profits beneficiary assert!( program_uxd::instructions::process_collect_profits_of_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -325,7 +323,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Setting the profits beneficiary program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -341,7 +339,7 @@ async fn test_mercurial_vault_depository_mint_and_redeem_and_collect_profits( // Now that profits beneficiary is set, collecting profits should succeed program_uxd::instructions::process_collect_profits_of_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), diff --git a/programs/uxd/tests/integration_tests/suites/test_mint_and_redeem.rs b/programs/uxd/tests/integration_tests/suites/test_mint_and_redeem.rs index f6aeafeca..fe2adae10 100644 --- a/programs/uxd/tests/integration_tests/suites/test_mint_and_redeem.rs +++ b/programs/uxd/tests/integration_tests/suites/test_mint_and_redeem.rs @@ -8,28 +8,26 @@ use uxd::instructions::EditDepositoriesRoutingWeightBps; use uxd::instructions::EditIdentityDepositoryFields; use uxd::instructions::EditMercurialVaultDepositoryFields; +use crate::integration_tests::api::program_context; use crate::integration_tests::api::program_spl; -use crate::integration_tests::api::program_test_context; use crate::integration_tests::api::program_uxd; use crate::integration_tests::utils::ui_amount_to_native_amount; #[tokio::test] -async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestError> { +async fn test_mint_and_redeem() -> Result<(), program_context::ProgramError> { // --------------------------------------------------------------------- // -- Phase 1 // -- Setup basic context and accounts needed for this test suite // --------------------------------------------------------------------- - let mut program_test_context = program_test_context::create_program_test_context().await; + let mut program_context: Box = + Box::new(program_context::create_program_test_context().await); // Fund payer let payer = Keypair::new(); - program_spl::instructions::process_lamports_airdrop( - &mut program_test_context, - &payer.pubkey(), - 1_000_000_000_000, - ) - .await?; + program_context + .process_airdrop(&payer.pubkey(), 1_000_000_000_000) + .await?; // Hardcode mints decimals let collateral_mint_decimals = 6; @@ -43,7 +41,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Initialize basic UXD program state program_uxd::procedures::process_deploy_program( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint, @@ -59,7 +57,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Create a collateral account for our user let user_collateral = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &user.pubkey(), @@ -67,7 +65,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE .await?; // Create a redeemable account for our user let user_redeemable = program_spl::instructions::process_associated_token_account_get_or_init( - &mut program_test_context, + &mut program_context, &payer, &program_uxd::accounts::find_redeemable_mint_pda().0, &user.pubkey(), @@ -110,7 +108,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Airdrop collateral to our user program_spl::instructions::process_token_mint_to( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &collateral_mint, @@ -121,7 +119,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the controller cap and weights program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -141,7 +139,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_identity_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditIdentityDepositoryFields { @@ -153,7 +151,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_mercurial_vault_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -169,7 +167,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the depository cap and make sure minting is not disabled program_uxd::instructions::process_edit_credix_lp_depository( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -190,7 +188,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Minting should fail now, as the depositories are not set yet assert!(program_uxd::instructions::process_mint( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -207,7 +205,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Now we set the router depositories to the correct PDAs program_uxd::procedures::process_set_router_depositories( - &mut program_test_context, + &mut program_context, &payer, &authority, &collateral_mint.pubkey(), @@ -221,7 +219,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Minting should work now that everything is set, weights should be respected program_uxd::instructions::process_mint( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -237,7 +235,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the controller weights to new values program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -258,7 +256,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Minting should now respect the new weights // Note: due to the precision loss from the first mint, we need to adjust by 1 in some places program_uxd::instructions::process_mint( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -276,7 +274,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Set the controller weights to 100% to mercurial_vault_depository program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -296,7 +294,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Redeeming now should fail because that's too much outflow assert!(program_uxd::instructions::process_redeem( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -312,7 +310,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Increase the outflow limit to over what we want to redeem next program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -329,7 +327,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Redeeming now should work and not touch mercurial at all since it is underflowing // Meaning that other depositories are overflowing and should be prioritized program_uxd::instructions::process_redeem( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -344,7 +342,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Increase the outflow limit to over what we want to redeem next program_uxd::instructions::process_edit_controller( - &mut program_test_context, + &mut program_context, &payer, &authority, &EditControllerFields { @@ -372,7 +370,7 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE // Redeeming immediately should fail because of outflow limit assert!(program_uxd::instructions::process_redeem( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -387,11 +385,13 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE .is_err()); // Move 1 epoch forward (bypass outflow limit) - program_test_context::move_clock_forward(&mut program_test_context, 1, slots_per_epoch).await?; + program_context + .move_clock_forward(1, slots_per_epoch) + .await?; // It should now succeed doing the same thing after waiting a day program_uxd::instructions::process_redeem( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), @@ -405,11 +405,13 @@ async fn test_mint_and_redeem() -> Result<(), program_test_context::ProgramTestE .await?; // Move 1 epoch forward (bypass outflow limit) - program_test_context::move_clock_forward(&mut program_test_context, 1, slots_per_epoch).await?; + program_context + .move_clock_forward(1, slots_per_epoch) + .await?; // Any more redeeming will fail as all the liquid redeem source have been exhausted now assert!(program_uxd::instructions::process_redeem( - &mut program_test_context, + &mut program_context, &payer, &collateral_mint.pubkey(), &mercurial_vault_lp_mint.pubkey(), diff --git a/scripts/download_integrations_binaries.sh b/scripts/download_integrations_binaries.sh new file mode 100755 index 000000000..8644fe173 --- /dev/null +++ b/scripts/download_integrations_binaries.sh @@ -0,0 +1,17 @@ + +# Mercurial +solana config set --url https://api.devnet.solana.com +solana program dump 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-devnet.so + +solana config set --url https://api.mainnet-beta.solana.com +solana program dump 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi programs/uxd/tests/integration_tests/api/program_mercurial/binaries/executable-mainnet-beta.so + +# Credix +solana config set --url https://api.devnet.solana.com +solana program dump crdszSnZQu7j36KfsMJ4VEmMUTJgrNYXwoPVHUANpAu programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-devnet.so + +solana config set --url https://api.devnet.solana.com +solana program dump crdRi38zEhQdzpsxnKur73WHBM9BSvXMSfGcbLyJCdP programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-pre-mainnet.so + +solana config set --url https://api.mainnet-beta.solana.com +solana program dump CRDx2YkdtYtGZXGHZ59wNv1EwKHQndnRc1gT4p8i2vPX programs/uxd/tests/integration_tests/api/program_credix/binaries/executable-mainnet-beta.so diff --git a/scripts/trigger_rebalance_credix.js b/scripts/trigger_rebalance_credix.js index f0f584603..ccef49807 100644 --- a/scripts/trigger_rebalance_credix.js +++ b/scripts/trigger_rebalance_credix.js @@ -5,8 +5,6 @@ const { MercurialVaultDepository, UXDClient, nativeToUi, - uiToNative, - CredixLpDepositoryAccount, } = require('@uxd-protocol/uxd-client'); const { Connection, @@ -331,42 +329,6 @@ async function main() { ); console.log(); - const credixWithdrawRequestAccount = - await CredixLpDepository.getCredixWithdrawRequestAccount( - credixProgram, - credixWithdrawRequest - ); - console.log('> credixWithdrawRequestAccount'); - console.log( - 'credixWithdrawRequestAccount.baseAmount(requested)', - nativeToUi(credixWithdrawRequestAccount.baseAmount, credixBaseDecimals) - ); - console.log( - 'credixWithdrawRequestAccount.baseAmountWithdrawn', - nativeToUi( - credixWithdrawRequestAccount.baseAmountWithdrawn, - credixBaseDecimals - ) - ); - console.log( - 'credixWithdrawRequestAccount.investorTotalLpAmount', - nativeToUi( - credixWithdrawRequestAccount.investorTotalLpAmount, - credixBaseDecimals - ) - ); - console.log( - 'credixWithdrawRequestAccount.baseAmountWithdrawable(computed)', - nativeToUi( - credixGlobalMarketStateAccount.lockedLiquidity - .mul(credixWithdrawRequestAccount.investorTotalLpAmount) - .div(credixWithdrawEpochAccount.participatingInvestorsTotalLpAmount) - .sub(credixWithdrawRequestAccount.baseAmountWithdrawn), - credixBaseDecimals - ) - ); - console.log(); - const credixSharesMintAccount = await getConnection().getTokenSupply( credixLpDepository.credixSharesMint ); @@ -476,80 +438,6 @@ async function main() { } console.log('> overflow_value:', overflow_value.toString()); - const withdrawable_total_collateral_amount = - credixGlobalMarketStateAccount.lockedLiquidity - .mul(credixWithdrawRequestAccount.investorTotalLpAmount) - .div(credixWithdrawEpochAccount.participatingInvestorsTotalLpAmount) - .sub(credixWithdrawRequestAccount.baseAmountWithdrawn); - console.log( - '> withdrawable_total_collateral_amount:', - withdrawable_total_collateral_amount.toString() - ); - - const withdrawal_profits_collateral_amount = BN.min( - withdrawable_total_collateral_amount, - profits_collateral_amount - ); - console.log( - '> withdrawal_profits_collateral_amount:', - withdrawal_profits_collateral_amount.toString() - ); - - const withdrawal_overflow_value = BN.min( - withdrawable_total_collateral_amount.sub( - withdrawal_profits_collateral_amount - ), - overflow_value - ); - console.log( - '> withdrawal_overflow_value:', - withdrawal_overflow_value.toString() - ); - - const withdrawal_total_collateral_amount = - withdrawal_profits_collateral_amount.add(withdrawal_overflow_value); - console.log( - '> withdrawal_total_collateral_amount:', - withdrawal_total_collateral_amount.toString() - ); - - const withdrawal_total_shares_amount = compute_shares_amount_for_value_floor( - withdrawal_total_collateral_amount, - total_shares_supply_before, - total_shares_value_before - ); - console.log( - '> withdrawal_total_shares_amount:', - withdrawal_total_shares_amount.toString() - ); - - const withdrawal_total_collateral_amount_after_precision_loss = - compute_value_for_shares_amount_floor( - withdrawal_total_shares_amount, - total_shares_supply_before, - total_shares_value_before - ); - console.log( - '> withdrawal_total_collateral_amount_after_precision_loss:', - withdrawal_total_collateral_amount_after_precision_loss.toString() - ); - - let withdrawal_overflow_value_after_precision_loss = - withdrawal_overflow_value; // Precision loss should be taken from the profits, not the overflow - console.log( - '> withdrawal_overflow_value_after_precision_loss:', - withdrawal_overflow_value_after_precision_loss.toString() - ); - - let withdrawal_profits_collateral_amount_after_precision_loss = - withdrawal_total_collateral_amount_after_precision_loss.sub( - withdrawal_overflow_value_after_precision_loss - ); - console.log( - '> withdrawal_profits_collateral_amount_after_precision_loss:', - withdrawal_profits_collateral_amount_after_precision_loss.toString() - ); - console.log(); } @@ -561,12 +449,4 @@ function compute_value_for_shares_amount_floor( return shares_amount.mul(total_shares_value).div(total_shares_supply); } -function compute_shares_amount_for_value_floor( - value, - total_shares_supply, - total_shares_value -) { - return value.mul(total_shares_supply).div(total_shares_value); -} - main(); diff --git a/target/deploy/uxd-keypair.json b/target/deploy/uxd-keypair.json index c3c0190ac..c739f9b2a 100644 --- a/target/deploy/uxd-keypair.json +++ b/target/deploy/uxd-keypair.json @@ -1,6 +1,6 @@ [ - 238, 224, 27, 91, 145, 77, 82, 79, 186, 221, 19, 117, 66, 180, 116, 221, 158, - 13, 244, 18, 141, 2, 254, 24, 217, 229, 19, 185, 43, 133, 202, 213, 205, 139, - 99, 187, 240, 83, 197, 255, 82, 225, 99, 21, 166, 242, 154, 240, 170, 132, - 113, 195, 181, 92, 144, 162, 22, 30, 185, 100, 184, 150, 207, 66 + 25, 131, 115, 209, 217, 198, 55, 178, 80, 237, 130, 200, 83, 201, 163, 107, + 194, 169, 133, 49, 51, 134, 25, 12, 90, 30, 174, 94, 70, 237, 247, 193, 170, + 227, 124, 213, 121, 30, 58, 251, 157, 52, 231, 62, 201, 129, 169, 60, 123, + 165, 90, 101, 132, 219, 230, 91, 245, 220, 153, 164, 232, 154, 198, 158 ] diff --git a/target/idl/uxd.json b/target/idl/uxd.json index f740325ff..1f92df7d7 100644 --- a/target/idl/uxd.json +++ b/target/idl/uxd.json @@ -1,5 +1,5 @@ { - "version": "8.1.4", + "version": "8.2.0", "name": "uxd", "instructions": [ { @@ -1557,19 +1557,19 @@ "docs": ["#16"] }, { - "name": "credixTreasuryCollateral", + "name": "credixTreasuryPoolCollateral", "isMut": true, "isSigner": false, "docs": ["#17"] }, { - "name": "credixMultisigKey", + "name": "credixTreasury", "isMut": false, "isSigner": false, "docs": ["#18"] }, { - "name": "credixMultisigCollateral", + "name": "credixTreasuryCollateral", "isMut": true, "isSigner": false, "docs": ["#19"] @@ -1688,19 +1688,19 @@ "docs": ["#12"] }, { - "name": "credixTreasuryCollateral", + "name": "credixTreasuryPoolCollateral", "isMut": true, "isSigner": false, "docs": ["#13"] }, { - "name": "credixMultisigKey", + "name": "credixTreasury", "isMut": false, "isSigner": false, "docs": ["#14"] }, { - "name": "credixMultisigCollateral", + "name": "credixTreasuryCollateral", "isMut": true, "isSigner": false, "docs": ["#15"] @@ -1828,23 +1828,17 @@ "isSigner": false, "docs": ["#13"] }, - { - "name": "credixWithdrawRequest", - "isMut": true, - "isSigner": false, - "docs": ["#14"] - }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "docs": ["#15"] + "docs": ["#14"] }, { "name": "credixProgram", "isMut": false, "isSigner": false, - "docs": ["#16"] + "docs": ["#15"] } ], "args": [] @@ -1945,19 +1939,19 @@ "docs": ["#15"] }, { - "name": "credixTreasuryCollateral", + "name": "credixTreasuryPoolCollateral", "isMut": true, "isSigner": false, "docs": ["#16"] }, { - "name": "credixMultisigKey", + "name": "credixTreasury", "isMut": false, "isSigner": false, "docs": ["#17"] }, { - "name": "credixMultisigCollateral", + "name": "credixTreasuryCollateral", "isMut": true, "isSigner": false, "docs": ["#18"] @@ -1968,47 +1962,41 @@ "isSigner": false, "docs": ["#19"] }, - { - "name": "credixWithdrawRequest", - "isMut": true, - "isSigner": false, - "docs": ["#20"] - }, { "name": "profitsBeneficiaryCollateral", "isMut": true, "isSigner": false, - "docs": ["#21"] + "docs": ["#20"] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "docs": ["#22"] + "docs": ["#21"] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "docs": ["#23"] + "docs": ["#22"] }, { "name": "associatedTokenProgram", "isMut": false, "isSigner": false, - "docs": ["#24"] + "docs": ["#23"] }, { "name": "credixProgram", "isMut": false, "isSigner": false, - "docs": ["#25"] + "docs": ["#24"] }, { "name": "rent", "isMut": false, "isSigner": false, - "docs": ["#26"] + "docs": ["#25"] } ], "args": [] @@ -3606,13 +3594,13 @@ }, { "code": 6052, - "name": "InvalidCredixMultisigKey", - "msg": "The Credix Multisig Key isn't the ProgramState one." + "name": "InvalidCredixTreasury", + "msg": "The Credix Treasury isn't the ProgramState one." }, { "code": 6053, - "name": "InvalidCredixTreasuryCollateral", - "msg": "The Credix TreasuryCollateral isn't the GlobalMarketState one." + "name": "InvalidCredixTreasuryPoolCollateral", + "msg": "The Credix TreasuryPool isn't the GlobalMarketState one." }, { "code": 6054, @@ -3641,6 +3629,6 @@ } ], "metadata": { - "address": "EqMrasrCXsbE6mpXaopUH1qip7auwX4AF5UWWpXaLr6u" + "address": "CW5VzSk7WC4NPyuNt19VFev9FUHhyk5xxHTj2DUWBexu" } } diff --git a/target/types/uxd.ts b/target/types/uxd.ts index 8c3f7f714..a62e088fb 100644 --- a/target/types/uxd.ts +++ b/target/types/uxd.ts @@ -1,5 +1,5 @@ export type Uxd = { - version: '8.1.4'; + version: '8.2.0'; name: 'uxd'; instructions: [ { @@ -1555,19 +1555,19 @@ export type Uxd = { docs: ['#16']; }, { - name: 'credixTreasuryCollateral'; + name: 'credixTreasuryPoolCollateral'; isMut: true; isSigner: false; docs: ['#17']; }, { - name: 'credixMultisigKey'; + name: 'credixTreasury'; isMut: false; isSigner: false; docs: ['#18']; }, { - name: 'credixMultisigCollateral'; + name: 'credixTreasuryCollateral'; isMut: true; isSigner: false; docs: ['#19']; @@ -1686,19 +1686,19 @@ export type Uxd = { docs: ['#12']; }, { - name: 'credixTreasuryCollateral'; + name: 'credixTreasuryPoolCollateral'; isMut: true; isSigner: false; docs: ['#13']; }, { - name: 'credixMultisigKey'; + name: 'credixTreasury'; isMut: false; isSigner: false; docs: ['#14']; }, { - name: 'credixMultisigCollateral'; + name: 'credixTreasuryCollateral'; isMut: true; isSigner: false; docs: ['#15']; @@ -1826,23 +1826,17 @@ export type Uxd = { isSigner: false; docs: ['#13']; }, - { - name: 'credixWithdrawRequest'; - isMut: true; - isSigner: false; - docs: ['#14']; - }, { name: 'systemProgram'; isMut: false; isSigner: false; - docs: ['#15']; + docs: ['#14']; }, { name: 'credixProgram'; isMut: false; isSigner: false; - docs: ['#16']; + docs: ['#15']; } ]; args: []; @@ -1943,19 +1937,19 @@ export type Uxd = { docs: ['#15']; }, { - name: 'credixTreasuryCollateral'; + name: 'credixTreasuryPoolCollateral'; isMut: true; isSigner: false; docs: ['#16']; }, { - name: 'credixMultisigKey'; + name: 'credixTreasury'; isMut: false; isSigner: false; docs: ['#17']; }, { - name: 'credixMultisigCollateral'; + name: 'credixTreasuryCollateral'; isMut: true; isSigner: false; docs: ['#18']; @@ -1966,47 +1960,41 @@ export type Uxd = { isSigner: false; docs: ['#19']; }, - { - name: 'credixWithdrawRequest'; - isMut: true; - isSigner: false; - docs: ['#20']; - }, { name: 'profitsBeneficiaryCollateral'; isMut: true; isSigner: false; - docs: ['#21']; + docs: ['#20']; }, { name: 'systemProgram'; isMut: false; isSigner: false; - docs: ['#22']; + docs: ['#21']; }, { name: 'tokenProgram'; isMut: false; isSigner: false; - docs: ['#23']; + docs: ['#22']; }, { name: 'associatedTokenProgram'; isMut: false; isSigner: false; - docs: ['#24']; + docs: ['#23']; }, { name: 'credixProgram'; isMut: false; isSigner: false; - docs: ['#25']; + docs: ['#24']; }, { name: 'rent'; isMut: false; isSigner: false; - docs: ['#26']; + docs: ['#25']; } ]; args: []; @@ -3604,13 +3592,13 @@ export type Uxd = { }, { code: 6052; - name: 'InvalidCredixMultisigKey'; - msg: "The Credix Multisig Key isn't the ProgramState one."; + name: 'InvalidCredixTreasury'; + msg: "The Credix Treasury isn't the ProgramState one."; }, { code: 6053; - name: 'InvalidCredixTreasuryCollateral'; - msg: "The Credix TreasuryCollateral isn't the GlobalMarketState one."; + name: 'InvalidCredixTreasuryPoolCollateral'; + msg: "The Credix TreasuryPool isn't the GlobalMarketState one."; }, { code: 6054; @@ -3641,7 +3629,7 @@ export type Uxd = { }; export const IDL: Uxd = { - version: '8.1.4', + version: '8.2.0', name: 'uxd', instructions: [ { @@ -5197,19 +5185,19 @@ export const IDL: Uxd = { docs: ['#16'], }, { - name: 'credixTreasuryCollateral', + name: 'credixTreasuryPoolCollateral', isMut: true, isSigner: false, docs: ['#17'], }, { - name: 'credixMultisigKey', + name: 'credixTreasury', isMut: false, isSigner: false, docs: ['#18'], }, { - name: 'credixMultisigCollateral', + name: 'credixTreasuryCollateral', isMut: true, isSigner: false, docs: ['#19'], @@ -5328,19 +5316,19 @@ export const IDL: Uxd = { docs: ['#12'], }, { - name: 'credixTreasuryCollateral', + name: 'credixTreasuryPoolCollateral', isMut: true, isSigner: false, docs: ['#13'], }, { - name: 'credixMultisigKey', + name: 'credixTreasury', isMut: false, isSigner: false, docs: ['#14'], }, { - name: 'credixMultisigCollateral', + name: 'credixTreasuryCollateral', isMut: true, isSigner: false, docs: ['#15'], @@ -5468,23 +5456,17 @@ export const IDL: Uxd = { isSigner: false, docs: ['#13'], }, - { - name: 'credixWithdrawRequest', - isMut: true, - isSigner: false, - docs: ['#14'], - }, { name: 'systemProgram', isMut: false, isSigner: false, - docs: ['#15'], + docs: ['#14'], }, { name: 'credixProgram', isMut: false, isSigner: false, - docs: ['#16'], + docs: ['#15'], }, ], args: [], @@ -5585,19 +5567,19 @@ export const IDL: Uxd = { docs: ['#15'], }, { - name: 'credixTreasuryCollateral', + name: 'credixTreasuryPoolCollateral', isMut: true, isSigner: false, docs: ['#16'], }, { - name: 'credixMultisigKey', + name: 'credixTreasury', isMut: false, isSigner: false, docs: ['#17'], }, { - name: 'credixMultisigCollateral', + name: 'credixTreasuryCollateral', isMut: true, isSigner: false, docs: ['#18'], @@ -5608,47 +5590,41 @@ export const IDL: Uxd = { isSigner: false, docs: ['#19'], }, - { - name: 'credixWithdrawRequest', - isMut: true, - isSigner: false, - docs: ['#20'], - }, { name: 'profitsBeneficiaryCollateral', isMut: true, isSigner: false, - docs: ['#21'], + docs: ['#20'], }, { name: 'systemProgram', isMut: false, isSigner: false, - docs: ['#22'], + docs: ['#21'], }, { name: 'tokenProgram', isMut: false, isSigner: false, - docs: ['#23'], + docs: ['#22'], }, { name: 'associatedTokenProgram', isMut: false, isSigner: false, - docs: ['#24'], + docs: ['#23'], }, { name: 'credixProgram', isMut: false, isSigner: false, - docs: ['#25'], + docs: ['#24'], }, { name: 'rent', isMut: false, isSigner: false, - docs: ['#26'], + docs: ['#25'], }, ], args: [], @@ -7246,13 +7222,13 @@ export const IDL: Uxd = { }, { code: 6052, - name: 'InvalidCredixMultisigKey', - msg: "The Credix Multisig Key isn't the ProgramState one.", + name: 'InvalidCredixTreasury', + msg: "The Credix Treasury isn't the ProgramState one.", }, { code: 6053, - name: 'InvalidCredixTreasuryCollateral', - msg: "The Credix TreasuryCollateral isn't the GlobalMarketState one.", + name: 'InvalidCredixTreasuryPoolCollateral', + msg: "The Credix TreasuryPool isn't the GlobalMarketState one.", }, { code: 6054,