From 5fbf834375d49d9bf3fc52b15c1d330e68b08507 Mon Sep 17 00:00:00 2001 From: kent-3 <100624004+kent-3@users.noreply.github.com> Date: Sun, 26 May 2024 17:31:35 -0400 Subject: [PATCH] fix schema generation --- Cargo.lock | 2037 +++++++++++++++++ .../liquidity_book/lb_factory/Cargo.toml | 22 +- .../schema/all_bin_steps_response.json | 19 + .../schema/all_lb_pairs_response.json | 140 ++ .../lb_factory/schema/execute_msg.json | 542 +++++ .../schema/fee_recipient_response.json | 20 + .../lb_factory/schema/instantiate_msg.json | 67 + .../schema/is_quote_asset_response.json | 14 + .../schema/lb_pair_at_index_response.json | 111 + .../lb_pair_implementation_response.json | 34 + .../schema/lb_pair_information_response.json | 137 ++ .../lb_token_implementation_response.json | 34 + .../schema/min_bin_step_response.json | 16 + .../schema/number_of_lb_pairs_response.json | 16 + .../number_of_quote_assets_response.json | 16 + .../schema/open_bin_steps_response.json | 19 + .../lb_factory/schema/preset_response.json | 56 + .../lb_factory/schema/query_msg.json | 312 +++ .../schema/quote_asset_at_index_response.json | 70 + .../lb_factory/{schema => src/bin}/schema.rs | 40 +- .../lb_factory/src/bin/secretcli/main.rs | 24 +- .../liquidity_book/lb_factory/src/contract.rs | 24 +- contracts/liquidity_book/lb_pair/Cargo.toml | 24 +- .../lb_pair/schema/active_id_response.json | 16 + .../lb_pair/schema/all_bins_response.json | 57 + .../lb_pair/schema/bin_response.json | 28 + .../lb_pair/schema/bin_step_response.json | 16 + .../schema/bin_updating_heights_response.json | 10 + .../lb_pair/schema/bins_response.json | 36 + .../lb_pair/schema/execute_msg.json | 523 +++++ .../lb_pair/schema/factory_response.json | 20 + .../schema/get_pair_info_response.json | 342 +++ .../schema/id_from_price_response.json | 16 + .../lb_pair/schema/instantiate_msg.json | 273 +++ .../lb_pair/schema/invoke_msg.json | 49 + .../lb_pair/schema/lb_token_response.json | 35 + .../lb_pair/schema/mint_response.json | 45 + .../schema/next_non_empty_bin_response.json | 16 + .../schema/oracle_parameters_response.json | 34 + .../schema/oracle_sample_at_response.json | 76 + .../schema/price_from_id_response.json | 20 + .../schema/protocol_fees_response.json | 22 + .../lb_pair/schema/query_msg.json | 748 ++++++ .../lb_pair/schema/reserves_response.json | 22 + .../schema/rewards_distribution_response.json | 48 + .../lb_pair/schema/staking_response.json | 35 + .../static_fee_parameters_response.json | 52 + .../lb_pair/schema/swap_in_response.json | 28 + .../lb_pair/schema/swap_out_response.json | 36 + .../schema/swap_simulation_response.json | 48 + .../lb_pair/schema/token_x_response.json | 70 + .../lb_pair/schema/token_y_response.json | 70 + .../lb_pair/schema/tokens_response.json | 74 + .../lb_pair/schema/total_supply_response.json | 20 + .../updated_bins_after_height_response.json | 51 + .../updated_bins_at_height_response.json | 36 + ...ated_bins_at_multiple_height_response.json | 36 + .../variable_fee_parameters_response.json | 34 + .../lb_pair/{schema => src/bin}/schema.rs | 54 +- contracts/liquidity_book/lb_router/Cargo.toml | 10 +- .../lb_router/schema/execute_msg.json | 334 +++ .../lb_router/schema/init_msg.json | 59 + .../lb_router/schema/invoke_msg.json | 68 + .../lb_router/schema/query_msg.json | 157 ++ .../lb_router/schema/query_msg_response.json | 137 ++ .../lb_router/{schema => src/bin}/schema.rs | 10 +- .../liquidity_book/lb_staking/Cargo.toml | 8 +- .../lb_staking/schema/execute_msg.json | 447 ++++ .../lb_staking/schema/instantiate_msg.json | 73 + .../lb_staking/schema/invoke_msg.json | 65 + .../lb_staking/schema/query_answer.json | 660 ++++++ .../lb_staking/schema/query_msg.json | 403 ++++ .../lb_staking/{schema => src/bin}/schema.rs | 12 +- contracts/liquidity_book/lb_token/Cargo.toml | 17 +- .../lb_token/schema/execute_msg.json | 973 ++++++++ .../lb_token/schema/instantiate_msg.json | 474 ++++ .../lb_token/schema/query_answer.json | 968 ++++++++ .../lb_token/schema/query_msg.json | 606 +++++ .../lb_token/{schema => src/bin}/schema.rs | 6 +- contracts/liquidity_book/tests/Cargo.toml | 6 - .../multi_test/src/interfaces/lb_factory.rs | 20 +- .../liquidity_book/lb_factory.rs | 42 +- 82 files changed, 12254 insertions(+), 191 deletions(-) create mode 100644 Cargo.lock create mode 100644 contracts/liquidity_book/lb_factory/schema/all_bin_steps_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/all_lb_pairs_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/execute_msg.json create mode 100644 contracts/liquidity_book/lb_factory/schema/fee_recipient_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/instantiate_msg.json create mode 100644 contracts/liquidity_book/lb_factory/schema/is_quote_asset_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/lb_pair_at_index_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/lb_pair_implementation_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/lb_pair_information_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/lb_token_implementation_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/min_bin_step_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/number_of_lb_pairs_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/number_of_quote_assets_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/open_bin_steps_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/preset_response.json create mode 100644 contracts/liquidity_book/lb_factory/schema/query_msg.json create mode 100644 contracts/liquidity_book/lb_factory/schema/quote_asset_at_index_response.json rename contracts/liquidity_book/lb_factory/{schema => src/bin}/schema.rs (51%) create mode 100644 contracts/liquidity_book/lb_pair/schema/active_id_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/all_bins_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/bin_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/bin_step_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/bin_updating_heights_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/bins_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/execute_msg.json create mode 100644 contracts/liquidity_book/lb_pair/schema/factory_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/get_pair_info_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/id_from_price_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/instantiate_msg.json create mode 100644 contracts/liquidity_book/lb_pair/schema/invoke_msg.json create mode 100644 contracts/liquidity_book/lb_pair/schema/lb_token_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/mint_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/next_non_empty_bin_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/oracle_parameters_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/oracle_sample_at_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/price_from_id_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/protocol_fees_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/query_msg.json create mode 100644 contracts/liquidity_book/lb_pair/schema/reserves_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/rewards_distribution_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/staking_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/static_fee_parameters_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/swap_in_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/swap_out_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/swap_simulation_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/token_x_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/token_y_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/tokens_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/total_supply_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/updated_bins_after_height_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/updated_bins_at_height_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/updated_bins_at_multiple_height_response.json create mode 100644 contracts/liquidity_book/lb_pair/schema/variable_fee_parameters_response.json rename contracts/liquidity_book/lb_pair/{schema => src/bin}/schema.rs (68%) create mode 100644 contracts/liquidity_book/lb_router/schema/execute_msg.json create mode 100644 contracts/liquidity_book/lb_router/schema/init_msg.json create mode 100644 contracts/liquidity_book/lb_router/schema/invoke_msg.json create mode 100644 contracts/liquidity_book/lb_router/schema/query_msg.json create mode 100644 contracts/liquidity_book/lb_router/schema/query_msg_response.json rename contracts/liquidity_book/lb_router/{schema => src/bin}/schema.rs (61%) create mode 100644 contracts/liquidity_book/lb_staking/schema/execute_msg.json create mode 100644 contracts/liquidity_book/lb_staking/schema/instantiate_msg.json create mode 100644 contracts/liquidity_book/lb_staking/schema/invoke_msg.json create mode 100644 contracts/liquidity_book/lb_staking/schema/query_answer.json create mode 100644 contracts/liquidity_book/lb_staking/schema/query_msg.json rename contracts/liquidity_book/lb_staking/{schema => src/bin}/schema.rs (67%) create mode 100644 contracts/liquidity_book/lb_token/schema/execute_msg.json create mode 100644 contracts/liquidity_book/lb_token/schema/instantiate_msg.json create mode 100644 contracts/liquidity_book/lb_token/schema/query_answer.json create mode 100644 contracts/liquidity_book/lb_token/schema/query_msg.json rename contracts/liquidity_book/lb_token/{schema => src/bin}/schema.rs (73%) diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..e02566d7 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2037 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "admin" +version = "0.2.0" +dependencies = [ + "cosmwasm-schema 1.5.5", + "rstest", + "secret-cosmwasm-std", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "airdrop" +version = "0.1.0" +dependencies = [ + "rs_merkle", + "shade-protocol", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "basic_staking" +version = "0.1.0" +dependencies = [ + "secret-cosmwasm-std", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "bech32" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bincode2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49f6183038e081170ebbbadee6678966c7d54728938a3e7de7f4e780770318f" +dependencies = [ + "byteorder", + "serde", +] + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cc" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const_format" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "contract-derive" +version = "0.1.0" +dependencies = [ + "shade-protocol", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-derive" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "242e98e7a231c122e08f300d9db3262d1007b51758a8732cd6210b3e9faa4f3a" +dependencies = [ + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.0.0" +source = "git+https://github.com/CosmWasm/cosmwasm?rev=1e05e7e#1e05e7eeac406b4e9f15e0700f8997a7baf0c7f6" +dependencies = [ + "cosmwasm-schema-derive 1.0.0", + "schemars 0.8.21", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7879036156092ad1c22fe0d7316efc5a5eceec2bc3906462a2560215f2a2f929" +dependencies = [ + "cosmwasm-schema-derive 1.5.5", + "schemars 0.8.21", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d403dea1175a5b20fd2d29dda180fa9f1391dd46f354a8639391d1e549a99e5e" +dependencies = [ + "cosmwasm-schema-derive 2.0.3", + "schemars 0.8.21", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.0.0" +source = "git+https://github.com/CosmWasm/cosmwasm?rev=1e05e7e#1e05e7eeac406b4e9f15e0700f8997a7baf0c7f6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb57855fbfc83327f8445ae0d413b1a05ac0d68c396ab4d122b2abd7bb82cb6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c3153038e91080ded2e2554689e802be2a34a24c6e49c039ae94810c99a680" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "doc2book" +version = "0.1.0" +dependencies = [ + "pretty_assertions", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ethnum" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "forward_ref" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "k256" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2 0.10.8", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lb-factory" +version = "0.1.0" +dependencies = [ + "anyhow", + "cosmwasm-schema 2.0.3", + "ethnum", + "lb-libraries", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", + "serde_json", + "shade-protocol", + "thiserror", +] + +[[package]] +name = "lb-libraries" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 2.0.3", + "ethnum", + "primitive-types", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-toolkit", + "serde", + "thiserror", +] + +[[package]] +name = "lb-pair" +version = "0.1.0" +dependencies = [ + "anyhow", + "cosmwasm-schema 2.0.3", + "ethnum", + "lb-libraries", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", + "serde-json-wasm 1.0.1", + "serde_json", + "shade-protocol", + "thiserror", +] + +[[package]] +name = "lb-router" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 2.0.3", + "lb-libraries", + "schemars 0.8.21", + "secret-multi-test", + "serde", + "serde_json", + "serial_test", + "shade-protocol", + "snafu", +] + +[[package]] +name = "lb-staking" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 2.0.3", + "lb-libraries", + "schemars 0.8.21", + "secret-multi-test", + "serde", + "serde_json", + "serial_test", + "shade-protocol", + "snafu", +] + +[[package]] +name = "lb-token" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 2.0.3", + "lb-libraries", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "secret-toolkit", + "serde", + "serde_json", + "shade-protocol", +] + +[[package]] +name = "lb_tests" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethnum", + "lb-libraries", + "rand", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", + "serde-json-wasm 1.0.1", + "serial_test", + "shade-multi-test", + "shade-protocol", + "thiserror", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mock_adapter" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 1.0.0", + "schemars 0.8.21", + "serde", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "mock_sienna_pair" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 1.5.5", + "shade-protocol", +] + +[[package]] +name = "mock_stkd_derivative" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema 1.5.5", + "mock_sienna_pair", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "multi-derive" +version = "0.1.0" + +[[package]] +name = "nanoid" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" +dependencies = [ + "rand", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "uint", +] + +[[package]] +name = "proc-macro2" +version = "1.0.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "query-authentication" +version = "0.1.0" +source = "git+https://github.com/securesecrets/query-authentication?branch=cosmwasm_v1_upgrade#024c13c08c8e4d25d890de2418fb1ae2c45425e9" +dependencies = [ + "bech32 0.8.1", + "cosmwasm-schema 1.5.5", + "remain", + "ripemd160", + "schemars 0.8.21", + "secp256k1", + "secret-cosmwasm-std", + "serde", + "sha2 0.9.9", + "thiserror", +] + +[[package]] +name = "query_auth" +version = "0.1.0" +dependencies = [ + "schemars 0.7.6", + "secret-cosmwasm-std", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags", +] + +[[package]] +name = "remain" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46aef80f842736de545ada6ec65b81ee91504efd6853f4b96de7414c42ae7443" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint", + "hmac", + "zeroize", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "rs_merkle" +version = "1.1.0" +source = "git+https://github.com/FloppyDisck/rs-merkle?branch=node_export#b35c0aa203fdd7ba6c963ba84efb46906792c660" +dependencies = [ + "sha2 0.9.9", +] + +[[package]] +name = "rstest" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c9dc66cc29792b663ffb5269be669f1613664e69ad56441fdb895c2347b930" +dependencies = [ + "futures", + "futures-timer", + "rstest_macros", + "rustc_version", +] + +[[package]] +name = "rstest_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5015e68a0685a95ade3eee617ff7101ab6a3fc689203101ca16ebc16f2b89c66" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schemars" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be77ed66abed6954aabf6a3e31a84706bedbf93750d267e92ef4a6d90bbd6a61" +dependencies = [ + "schemars_derive 0.7.6", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", + "schemars_derive 0.8.21", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11af7a475c9ee266cfaa9e303a47c830ebe072bf3101ab907a7b7b9d816fa01d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals 0.25.0", + "syn 1.0.109", +] + +[[package]] +name = "schemars_derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals 0.29.1", + "syn 2.0.66", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrt_staking" +version = "0.1.0" +dependencies = [ + "secret-cosmwasm-std", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +dependencies = [ + "cc", +] + +[[package]] +name = "secret-cosmwasm-crypto" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8535d61c88d0a6c222df2cebb69859d8e9ba419a299a1bc84c904b0d9c00c7b2" +dependencies = [ + "digest 0.10.7", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + +[[package]] +name = "secret-cosmwasm-std" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4393b01aa6587007161a6bb193859deaa8165ab06c8a35f253d329ff99e4d" +dependencies = [ + "base64 0.13.1", + "cosmwasm-derive", + "derivative", + "forward_ref", + "hex", + "schemars 0.8.21", + "secret-cosmwasm-crypto", + "serde", + "serde-json-wasm 0.4.1", + "thiserror", + "uint", +] + +[[package]] +name = "secret-cosmwasm-storage" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb43da2cb72a53b16ea1555bca794fb828b48ab24ebeb45f8e26f1881c45a783" +dependencies = [ + "secret-cosmwasm-std", + "serde", +] + +[[package]] +name = "secret-multi-test" +version = "0.13.4" +source = "git+https://github.com/securesecrets/secret-plus-utils#ca5c1704375c622398811b6339711b52b8dd3ad1" +dependencies = [ + "anyhow", + "derivative", + "itertools", + "nanoid", + "prost", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-storage-plus 0.13.4 (git+https://github.com/securesecrets/secret-plus-utils)", + "secret-utils", + "serde", + "thiserror", +] + +[[package]] +name = "secret-storage-plus" +version = "0.13.4" +source = "git+https://github.com/securesecrets/secret-plus-utils?tag=v0.1.1#96438a5bf7f1fb0acc540fe3a43e934f01e6711f" +dependencies = [ + "bincode2", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", +] + +[[package]] +name = "secret-storage-plus" +version = "0.13.4" +source = "git+https://github.com/securesecrets/secret-plus-utils#ca5c1704375c622398811b6339711b52b8dd3ad1" +dependencies = [ + "bincode2", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", +] + +[[package]] +name = "secret-toolkit" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338c972c0a98de51ccbb859312eb7672bc64b9050b086f058748ba26a509edbb" +dependencies = [ + "secret-toolkit-crypto", + "secret-toolkit-permit", + "secret-toolkit-serialization", + "secret-toolkit-snip20", + "secret-toolkit-snip721", + "secret-toolkit-storage", + "secret-toolkit-utils", + "secret-toolkit-viewing-key", +] + +[[package]] +name = "secret-toolkit-crypto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003d7d5772c67f2240b7f298f96eb73a8a501916fe18c1d730ebfd591bf7e519" +dependencies = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "secp256k1", + "secret-cosmwasm-std", + "sha2 0.10.8", +] + +[[package]] +name = "secret-toolkit-permit" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4330571400b5959450fa37040609e6804a147d83f606783506bc2275f1527712" +dependencies = [ + "bech32 0.9.1", + "remain", + "ripemd", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-toolkit-crypto", + "serde", +] + +[[package]] +name = "secret-toolkit-serialization" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890adaeaa710f9f7068a807eb1553edc8c30ce9907290895c9097dd642fc613b" +dependencies = [ + "bincode2", + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", +] + +[[package]] +name = "secret-toolkit-snip20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8144a11df9a75adf42acd645f938eb2c1ab508d6672033eb84b1e672247d2f05" +dependencies = [ + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-toolkit-utils", + "serde", +] + +[[package]] +name = "secret-toolkit-snip721" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2ab35fd2a52306f87ab8dceab75254cc1b87c95c43acf9e30c09372f0ee971" +dependencies = [ + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-toolkit-utils", + "serde", +] + +[[package]] +name = "secret-toolkit-storage" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e8c5418af3e7ae1d1331c383b32d56c74a340dbc3b972d53555a768698f2a3" +dependencies = [ + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "secret-toolkit-serialization", + "serde", +] + +[[package]] +name = "secret-toolkit-utils" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f1cba2e70fd701e3dfc6072807c02eeeb9776bee49e346a9c7745d84ff40c8" +dependencies = [ + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "serde", +] + +[[package]] +name = "secret-toolkit-viewing-key" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d89a0b69fa9b12735a612fa30e6e7e48130943982f1783b7ddd5c46ed09e921" +dependencies = [ + "base64 0.21.7", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "secret-toolkit-crypto", + "secret-toolkit-utils", + "serde", + "subtle", +] + +[[package]] +name = "secret-utils" +version = "0.13.4" +source = "git+https://github.com/securesecrets/secret-plus-utils#ca5c1704375c622398811b6339711b52b8dd3ad1" +dependencies = [ + "schemars 0.8.21", + "secret-cosmwasm-std", + "serde", + "thiserror", +] + +[[package]] +name = "secretcli" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-json-wasm" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-json-wasm" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "serde_derive_internals" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serial_test" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" +dependencies = [ + "dashmap", + "futures", + "lazy_static", + "log", + "parking_lot", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "shade-multi-test" +version = "0.1.0" +dependencies = [ + "admin", + "airdrop", + "anyhow", + "basic_staking", + "lb-factory", + "lb-libraries", + "lb-pair", + "lb-router", + "lb-staking", + "lb-token", + "mock_adapter", + "mock_sienna_pair", + "mock_stkd_derivative", + "multi-derive", + "query_auth", + "scrt_staking", + "shade-protocol", + "snip20", + "snip20_migration", + "stkd_scrt", + "treasury", + "treasury_manager", +] + +[[package]] +name = "shade-protocol" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64 0.12.3", + "chrono", + "const_format", + "contract-derive", + "cosmwasm-schema 1.5.5", + "ethnum", + "lb-libraries", + "primitive-types", + "query-authentication", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "remain", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "secret-multi-test", + "secret-storage-plus 0.13.4 (git+https://github.com/securesecrets/secret-plus-utils?tag=v0.1.1)", + "secret-toolkit", + "serde", + "sha2 0.9.9", + "strum", + "strum_macros", + "subtle", + "thiserror", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "snafu" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418b8136fec49956eba89be7da2847ec1909df92a9ae4178b5ff0ff092c8d95e" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a4812a669da00d17d8266a0439eddcacbc88b17f732f927e52eeb9d196f7fb5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "snip20" +version = "0.1.0" +dependencies = [ + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "snip20_derivative" +version = "1.0.0" +dependencies = [ + "base64 0.13.1", + "cosmwasm-schema 1.5.5", + "schemars 0.8.21", + "secret-cosmwasm-std", + "secret-cosmwasm-storage", + "secret-toolkit", + "secret-toolkit-crypto", + "serde", + "shade-protocol", +] + +[[package]] +name = "snip20_migration" +version = "0.1.0" +dependencies = [ + "rstest", + "schemars 0.7.6", + "serde_json", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stkd_scrt" +version = "0.1.0" +dependencies = [ + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[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 = "treasury" +version = "0.1.0" +dependencies = [ + "mock_adapter", + "serde_json", + "shade-multi-test", + "shade-protocol", + "treasury", +] + +[[package]] +name = "treasury_manager" +version = "0.1.0" +dependencies = [ + "chrono", + "cosmwasm-schema 1.0.0", + "itertools", + "mock_adapter", + "schemars 0.7.6", + "shade-multi-test", + "shade-protocol", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/contracts/liquidity_book/lb_factory/Cargo.toml b/contracts/liquidity_book/lb_factory/Cargo.toml index b899be20..6e4e6b32 100644 --- a/contracts/liquidity_book/lb_factory/Cargo.toml +++ b/contracts/liquidity_book/lb_factory/Cargo.toml @@ -8,30 +8,26 @@ exclude = ["contract.wasm", "hash.txt"] crate-type = ["cdylib", "rlib"] -[[example]] +[[bin]] name = "schema" -path = "schema/schema.rs" +path = "src/bin/schema.rs" [features] -default = ["schema"] -schema = [] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] [dependencies] -shade-protocol = { path = "../../../packages/shade_protocol" } +shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] } lb-libraries = { path = "../../../packages/lb_libraries" } -schemars = "0.8.16" -serde = { version = "1.0" } +schemars = "0.8.21" +serde = { version = "1.0.203" } cosmwasm-schema = "2.0.3" -thiserror = { version = "1.0" } -ethnum = { version = "1.5" } -serde_json = "1" +thiserror = { version = "1.0.61" } +ethnum = { version = "1.5.0" } +serde_json = "1.0.117" [dev-dependencies] -anyhow = "1" +anyhow = "1.0.86" cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11" } diff --git a/contracts/liquidity_book/lb_factory/schema/all_bin_steps_response.json b/contracts/liquidity_book/lb_factory/schema/all_bin_steps_response.json new file mode 100644 index 00000000..593a080e --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/all_bin_steps_response.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllBinStepsResponse", + "type": "object", + "required": [ + "bin_step_with_preset" + ], + "properties": { + "bin_step_with_preset": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/all_lb_pairs_response.json b/contracts/liquidity_book/lb_factory/schema/all_lb_pairs_response.json new file mode 100644 index 00000000..8acfd24b --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/all_lb_pairs_response.json @@ -0,0 +1,140 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllLbPairsResponse", + "type": "object", + "required": [ + "lb_pairs_available" + ], + "properties": { + "lb_pairs_available": { + "type": "array", + "items": { + "$ref": "#/definitions/LBPairInformation" + } + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "LBPair": { + "type": "object", + "required": [ + "bin_step", + "contract", + "token_x", + "token_y" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "contract": { + "$ref": "#/definitions/ContractInfo" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "LBPairInformation": { + "type": "object", + "required": [ + "bin_step", + "created_by_owner", + "ignored_for_routing", + "info" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "created_by_owner": { + "type": "boolean" + }, + "ignored_for_routing": { + "type": "boolean" + }, + "info": { + "$ref": "#/definitions/LBPair" + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/execute_msg.json b/contracts/liquidity_book/lb_factory/schema/execute_msg.json new file mode 100644 index 00000000..e02815b4 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/execute_msg.json @@ -0,0 +1,542 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "set_lb_pair_implementation" + ], + "properties": { + "set_lb_pair_implementation": { + "type": "object", + "required": [ + "implementation" + ], + "properties": { + "implementation": { + "$ref": "#/definitions/ContractImplementation" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_lb_token_implementation" + ], + "properties": { + "set_lb_token_implementation": { + "type": "object", + "required": [ + "implementation" + ], + "properties": { + "implementation": { + "$ref": "#/definitions/ContractImplementation" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_staking_contract_implementation" + ], + "properties": { + "set_staking_contract_implementation": { + "type": "object", + "required": [ + "implementation" + ], + "properties": { + "implementation": { + "$ref": "#/definitions/ContractImplementation" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "create_lb_pair" + ], + "properties": { + "create_lb_pair": { + "type": "object", + "required": [ + "active_id", + "bin_step", + "entropy", + "token_x", + "token_y", + "viewing_key" + ], + "properties": { + "active_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "entropy": { + "type": "string" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + }, + "viewing_key": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_pair_preset" + ], + "properties": { + "set_pair_preset": { + "type": "object", + "required": [ + "base_factor", + "bin_step", + "decay_period", + "epoch_staking_duration", + "epoch_staking_index", + "filter_period", + "is_open", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "rewards_distribution_algorithm", + "total_reward_bins", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "epoch_staking_duration": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epoch_staking_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "expiry_staking_duration": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "is_open": { + "type": "boolean" + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "rewards_distribution_algorithm": { + "$ref": "#/definitions/RewardsDistributionAlgorithm" + }, + "total_reward_bins": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_preset_open_state" + ], + "properties": { + "set_preset_open_state": { + "type": "object", + "required": [ + "bin_step", + "is_open" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "is_open": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_preset" + ], + "properties": { + "remove_preset": { + "type": "object", + "required": [ + "bin_step" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_fee_parameters_on_pair" + ], + "properties": { + "set_fee_parameters_on_pair": { + "type": "object", + "required": [ + "base_factor", + "bin_step", + "decay_period", + "filter_period", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "token_x", + "token_y", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_fee_recipient" + ], + "properties": { + "set_fee_recipient": { + "type": "object", + "required": [ + "fee_recipient" + ], + "properties": { + "fee_recipient": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "add_quote_asset" + ], + "properties": { + "add_quote_asset": { + "type": "object", + "required": [ + "asset" + ], + "properties": { + "asset": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_quote_asset" + ], + "properties": { + "remove_quote_asset": { + "type": "object", + "required": [ + "asset" + ], + "properties": { + "asset": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "force_decay" + ], + "properties": { + "force_decay": { + "type": "object", + "required": [ + "pair" + ], + "properties": { + "pair": { + "$ref": "#/definitions/LBPair" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractImplementation": { + "type": "object", + "required": [ + "code_hash", + "id" + ], + "properties": { + "code_hash": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "LBPair": { + "type": "object", + "required": [ + "bin_step", + "contract", + "token_x", + "token_y" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "contract": { + "$ref": "#/definitions/ContractInfo" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "RewardsDistributionAlgorithm": { + "type": "string", + "enum": [ + "time_based_rewards", + "volume_based_rewards" + ] + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/fee_recipient_response.json b/contracts/liquidity_book/lb_factory/schema/fee_recipient_response.json new file mode 100644 index 00000000..1fc76aff --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/fee_recipient_response.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FeeRecipientResponse", + "type": "object", + "required": [ + "fee_recipient" + ], + "properties": { + "fee_recipient": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/instantiate_msg.json b/contracts/liquidity_book/lb_factory/schema/instantiate_msg.json new file mode 100644 index 00000000..b3338da9 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/instantiate_msg.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "admin_auth", + "fee_recipient", + "query_auth", + "recover_staking_funds_receiver" + ], + "properties": { + "admin_auth": { + "$ref": "#/definitions/RawContract" + }, + "fee_recipient": { + "$ref": "#/definitions/Addr" + }, + "max_bins_per_swap": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "query_auth": { + "$ref": "#/definitions/RawContract" + }, + "recover_staking_funds_receiver": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "RawContract": { + "description": "A contract that does not contain a validated address. Should be accepted as user input because we shouldn't assume addresses are verified Addrs. https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Addr.html", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/is_quote_asset_response.json b/contracts/liquidity_book/lb_factory/schema/is_quote_asset_response.json new file mode 100644 index 00000000..9914fad6 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/is_quote_asset_response.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IsQuoteAssetResponse", + "type": "object", + "required": [ + "is_quote" + ], + "properties": { + "is_quote": { + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/lb_pair_at_index_response.json b/contracts/liquidity_book/lb_factory/schema/lb_pair_at_index_response.json new file mode 100644 index 00000000..be7984d6 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/lb_pair_at_index_response.json @@ -0,0 +1,111 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LbPairAtIndexResponse", + "type": "object", + "required": [ + "lb_pair" + ], + "properties": { + "lb_pair": { + "$ref": "#/definitions/LBPair" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "LBPair": { + "type": "object", + "required": [ + "bin_step", + "contract", + "token_x", + "token_y" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "contract": { + "$ref": "#/definitions/ContractInfo" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/lb_pair_implementation_response.json b/contracts/liquidity_book/lb_factory/schema/lb_pair_implementation_response.json new file mode 100644 index 00000000..01741d51 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/lb_pair_implementation_response.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LbPairImplementationResponse", + "type": "object", + "required": [ + "lb_pair_implementation" + ], + "properties": { + "lb_pair_implementation": { + "$ref": "#/definitions/ContractImplementation" + } + }, + "additionalProperties": false, + "definitions": { + "ContractImplementation": { + "type": "object", + "required": [ + "code_hash", + "id" + ], + "properties": { + "code_hash": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/lb_pair_information_response.json b/contracts/liquidity_book/lb_factory/schema/lb_pair_information_response.json new file mode 100644 index 00000000..1ba695ed --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/lb_pair_information_response.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LbPairInformationResponse", + "type": "object", + "required": [ + "lb_pair_information" + ], + "properties": { + "lb_pair_information": { + "$ref": "#/definitions/LBPairInformation" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "LBPair": { + "type": "object", + "required": [ + "bin_step", + "contract", + "token_x", + "token_y" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "contract": { + "$ref": "#/definitions/ContractInfo" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "LBPairInformation": { + "type": "object", + "required": [ + "bin_step", + "created_by_owner", + "ignored_for_routing", + "info" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "created_by_owner": { + "type": "boolean" + }, + "ignored_for_routing": { + "type": "boolean" + }, + "info": { + "$ref": "#/definitions/LBPair" + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/lb_token_implementation_response.json b/contracts/liquidity_book/lb_factory/schema/lb_token_implementation_response.json new file mode 100644 index 00000000..59104b2f --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/lb_token_implementation_response.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LbTokenImplementationResponse", + "type": "object", + "required": [ + "lb_token_implementation" + ], + "properties": { + "lb_token_implementation": { + "$ref": "#/definitions/ContractImplementation" + } + }, + "additionalProperties": false, + "definitions": { + "ContractImplementation": { + "type": "object", + "required": [ + "code_hash", + "id" + ], + "properties": { + "code_hash": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/min_bin_step_response.json b/contracts/liquidity_book/lb_factory/schema/min_bin_step_response.json new file mode 100644 index 00000000..ff4ac43e --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/min_bin_step_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MinBinStepResponse", + "type": "object", + "required": [ + "min_bin_step" + ], + "properties": { + "min_bin_step": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/number_of_lb_pairs_response.json b/contracts/liquidity_book/lb_factory/schema/number_of_lb_pairs_response.json new file mode 100644 index 00000000..a237ebfc --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/number_of_lb_pairs_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumberOfLbPairsResponse", + "type": "object", + "required": [ + "lb_pair_number" + ], + "properties": { + "lb_pair_number": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/number_of_quote_assets_response.json b/contracts/liquidity_book/lb_factory/schema/number_of_quote_assets_response.json new file mode 100644 index 00000000..18b79010 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/number_of_quote_assets_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumberOfQuoteAssetsResponse", + "type": "object", + "required": [ + "number_of_quote_assets" + ], + "properties": { + "number_of_quote_assets": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/open_bin_steps_response.json b/contracts/liquidity_book/lb_factory/schema/open_bin_steps_response.json new file mode 100644 index 00000000..e03a49c6 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/open_bin_steps_response.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OpenBinStepsResponse", + "type": "object", + "required": [ + "open_bin_steps" + ], + "properties": { + "open_bin_steps": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/preset_response.json b/contracts/liquidity_book/lb_factory/schema/preset_response.json new file mode 100644 index 00000000..22e1dd72 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/preset_response.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PresetResponse", + "type": "object", + "required": [ + "base_factor", + "decay_period", + "filter_period", + "is_open", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "is_open": { + "type": "boolean" + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_factory/schema/query_msg.json b/contracts/liquidity_book/lb_factory/schema/query_msg.json new file mode 100644 index 00000000..b9fbdc6c --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/query_msg.json @@ -0,0 +1,312 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_min_bin_step" + ], + "properties": { + "get_min_bin_step": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_fee_recipient" + ], + "properties": { + "get_fee_recipient": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_lb_pair_implementation" + ], + "properties": { + "get_lb_pair_implementation": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_lb_token_implementation" + ], + "properties": { + "get_lb_token_implementation": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_number_of_lb_pairs" + ], + "properties": { + "get_number_of_lb_pairs": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_lb_pair_at_index" + ], + "properties": { + "get_lb_pair_at_index": { + "type": "object", + "required": [ + "index" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_number_of_quote_assets" + ], + "properties": { + "get_number_of_quote_assets": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_quote_asset_at_index" + ], + "properties": { + "get_quote_asset_at_index": { + "type": "object", + "required": [ + "index" + ], + "properties": { + "index": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "is_quote_asset" + ], + "properties": { + "is_quote_asset": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_lb_pair_information" + ], + "properties": { + "get_lb_pair_information": { + "type": "object", + "required": [ + "bin_step", + "token_x", + "token_y" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_preset" + ], + "properties": { + "get_preset": { + "type": "object", + "required": [ + "bin_step" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_all_bin_steps" + ], + "properties": { + "get_all_bin_steps": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_open_bin_steps" + ], + "properties": { + "get_open_bin_steps": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_all_lb_pairs" + ], + "properties": { + "get_all_lb_pairs": { + "type": "object", + "required": [ + "token_x", + "token_y" + ], + "properties": { + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/quote_asset_at_index_response.json b/contracts/liquidity_book/lb_factory/schema/quote_asset_at_index_response.json new file mode 100644 index 00000000..a51f1ce5 --- /dev/null +++ b/contracts/liquidity_book/lb_factory/schema/quote_asset_at_index_response.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QuoteAssetAtIndexResponse", + "type": "object", + "required": [ + "asset" + ], + "properties": { + "asset": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_factory/schema/schema.rs b/contracts/liquidity_book/lb_factory/src/bin/schema.rs similarity index 51% rename from contracts/liquidity_book/lb_factory/schema/schema.rs rename to contracts/liquidity_book/lb_factory/src/bin/schema.rs index f38cacaa..dc678d6e 100644 --- a/contracts/liquidity_book/lb_factory/schema/schema.rs +++ b/contracts/liquidity_book/lb_factory/src/bin/schema.rs @@ -1,29 +1,19 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::{env::current_dir, fs::create_dir_all}; +use std::{env, fs::create_dir_all, path::PathBuf}; use shade_protocol::liquidity_book::lb_factory::{ - AllBinStepsResponse, - AllLBPairsResponse, - ExecuteMsg, - FeeRecipientResponse, - InstantiateMsg, - IsQuoteAssetResponse, - LBPairAtIndexResponse, - LBPairImplementationResponse, - LBPairInformationResponse, - LBTokenImplementationResponse, - MinBinStepResponse, - NumberOfLBPairsResponse, - NumberOfQuoteAssetsResponse, - OpenBinStepsResponse, - PresetResponse, - QueryMsg, - QuoteAssetAtIndexResponse, + AllBinStepsResponse, AllLbPairsResponse, ExecuteMsg, FeeRecipientResponse, InstantiateMsg, + IsQuoteAssetResponse, LbPairAtIndexResponse, LbPairImplementationResponse, + LbPairInformationResponse, LbTokenImplementationResponse, MinBinStepResponse, + NumberOfLbPairsResponse, NumberOfQuoteAssetsResponse, OpenBinStepsResponse, PresetResponse, + QueryMsg, QuoteAssetAtIndexResponse, }; fn main() { - let mut out_dir = current_dir().unwrap(); + // Get the directory of the current crate + let mut out_dir = env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(); out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); remove_schemas(&out_dir).unwrap(); @@ -34,16 +24,16 @@ fn main() { // Add export_schema for each response struct export_schema(&schema_for!(MinBinStepResponse), &out_dir); export_schema(&schema_for!(FeeRecipientResponse), &out_dir); - export_schema(&schema_for!(LBPairImplementationResponse), &out_dir); - export_schema(&schema_for!(LBTokenImplementationResponse), &out_dir); - export_schema(&schema_for!(NumberOfLBPairsResponse), &out_dir); - export_schema(&schema_for!(LBPairAtIndexResponse), &out_dir); + export_schema(&schema_for!(LbPairImplementationResponse), &out_dir); + export_schema(&schema_for!(LbTokenImplementationResponse), &out_dir); + export_schema(&schema_for!(NumberOfLbPairsResponse), &out_dir); + export_schema(&schema_for!(LbPairAtIndexResponse), &out_dir); export_schema(&schema_for!(NumberOfQuoteAssetsResponse), &out_dir); export_schema(&schema_for!(QuoteAssetAtIndexResponse), &out_dir); export_schema(&schema_for!(IsQuoteAssetResponse), &out_dir); - export_schema(&schema_for!(LBPairInformationResponse), &out_dir); + export_schema(&schema_for!(LbPairInformationResponse), &out_dir); export_schema(&schema_for!(PresetResponse), &out_dir); export_schema(&schema_for!(AllBinStepsResponse), &out_dir); export_schema(&schema_for!(OpenBinStepsResponse), &out_dir); - export_schema(&schema_for!(AllLBPairsResponse), &out_dir); + export_schema(&schema_for!(AllLbPairsResponse), &out_dir); } diff --git a/contracts/liquidity_book/lb_factory/src/bin/secretcli/main.rs b/contracts/liquidity_book/lb_factory/src/bin/secretcli/main.rs index 8b29d935..f21a8f1d 100644 --- a/contracts/liquidity_book/lb_factory/src/bin/secretcli/main.rs +++ b/contracts/liquidity_book/lb_factory/src/bin/secretcli/main.rs @@ -182,16 +182,16 @@ fn main() -> io::Result<()> { let get_min_bin_step = QueryMsg::GetMinBinStep {}; let get_fee_recipient = QueryMsg::GetFeeRecipient {}; - let get_lb_pair_implementation = QueryMsg::GetLBPairImplementation {}; - let get_lb_token_implementation = QueryMsg::GetLBTokenImplementation {}; - let get_number_of_lb_pairs = QueryMsg::GetNumberOfLBPairs {}; - let get_lb_pair_at_index = QueryMsg::GetLBPairAtIndex { index: 0 }; + let get_lb_pair_implementation = QueryMsg::GetLbPairImplementation {}; + let get_lb_token_implementation = QueryMsg::GetLbTokenImplementation {}; + let get_number_of_lb_pairs = QueryMsg::GetNumberOfLbPairs {}; + let get_lb_pair_at_index = QueryMsg::GetLbPairAtIndex { index: 0 }; let get_number_of_quote_assets = QueryMsg::GetNumberOfQuoteAssets {}; let get_quote_asset_at_index = QueryMsg::GetQuoteAssetAtIndex { index: 0 }; let is_quote_asset = QueryMsg::IsQuoteAsset { token: TokenType::example(), }; - let get_lb_pair_information = QueryMsg::GetLBPairInformation { + let get_lb_pair_information = QueryMsg::GetLbPairInformation { token_x: TokenType::example(), token_y: TokenType::example(), bin_step: BIN_STEP, @@ -199,7 +199,7 @@ fn main() -> io::Result<()> { let get_preset = QueryMsg::GetPreset { bin_step: BIN_STEP }; let get_all_bin_steps = QueryMsg::GetAllBinSteps {}; let get_open_bin_steps = QueryMsg::GetOpenBinSteps {}; - let get_all_lb_pairs = QueryMsg::GetAllLBPairs { + let get_all_lb_pairs = QueryMsg::GetAllLbPairs { token_x: TokenType::example(), token_y: TokenType::example(), }; @@ -210,15 +210,15 @@ fn main() -> io::Result<()> { let get_fee_recipient_response = FeeRecipientResponse { fee_recipient: Addr::recipient(), }; - let get_lb_pair_implementation_response = LBPairImplementationResponse { + let get_lb_pair_implementation_response = LbPairImplementationResponse { lb_pair_implementation: ContractImplementation::example(), }; - let get_lb_token_implementation_response = LBTokenImplementationResponse { + let get_lb_token_implementation_response = LbTokenImplementationResponse { lb_token_implementation: ContractImplementation::example(), }; - let get_number_of_lb_pairs_response = NumberOfLBPairsResponse { lb_pair_number: 1 }; + let get_number_of_lb_pairs_response = NumberOfLbPairsResponse { lb_pair_number: 1 }; - let get_lb_pair_at_index_response = LBPairAtIndexResponse { + let get_lb_pair_at_index_response = LbPairAtIndexResponse { lb_pair: LBPair { token_x: TokenType::example(), token_y: TokenType::example(), @@ -237,7 +237,7 @@ fn main() -> io::Result<()> { let is_quote_asset_response = IsQuoteAssetResponse { is_quote: true }; - let get_lb_pair_information_response = LBPairInformationResponse { + let get_lb_pair_information_response = LbPairInformationResponse { lb_pair_information: LBPairInformation::example(), }; @@ -260,7 +260,7 @@ fn main() -> io::Result<()> { open_bin_steps: vec![20, 50, 100], }; - let get_all_lb_pairs_response = AllLBPairsResponse { + let get_all_lb_pairs_response = AllLbPairsResponse { lb_pairs_available: vec![LBPairInformation::example(), LBPairInformation::example()], }; diff --git a/contracts/liquidity_book/lb_factory/src/contract.rs b/contracts/liquidity_book/lb_factory/src/contract.rs index ee39828f..9342a8a4 100644 --- a/contracts/liquidity_book/lb_factory/src/contract.rs +++ b/contracts/liquidity_book/lb_factory/src/contract.rs @@ -813,14 +813,14 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { match msg { QueryMsg::GetMinBinStep {} => query_min_bin_step(deps), QueryMsg::GetFeeRecipient {} => query_fee_recipient(deps), - QueryMsg::GetLBPairImplementation {} => query_lb_pair_implementation(deps), - QueryMsg::GetLBTokenImplementation {} => query_lb_token_implementation(deps), - QueryMsg::GetNumberOfLBPairs {} => query_number_of_lb_pairs(deps), - QueryMsg::GetLBPairAtIndex { index } => query_lb_pair_at_index(deps, index), + QueryMsg::GetLbPairImplementation {} => query_lb_pair_implementation(deps), + QueryMsg::GetLbTokenImplementation {} => query_lb_token_implementation(deps), + QueryMsg::GetNumberOfLbPairs {} => query_number_of_lb_pairs(deps), + QueryMsg::GetLbPairAtIndex { index } => query_lb_pair_at_index(deps, index), QueryMsg::GetNumberOfQuoteAssets {} => query_number_of_quote_assets(deps), QueryMsg::GetQuoteAssetAtIndex { index } => query_quote_asset_at_index(deps, index), QueryMsg::IsQuoteAsset { token } => query_is_quote_asset(deps, token), - QueryMsg::GetLBPairInformation { + QueryMsg::GetLbPairInformation { token_x, token_y, bin_step, @@ -828,7 +828,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { QueryMsg::GetPreset { bin_step } => query_preset(deps, bin_step), QueryMsg::GetAllBinSteps {} => query_all_bin_steps(deps), QueryMsg::GetOpenBinSteps {} => query_open_bin_steps(deps), - QueryMsg::GetAllLBPairs { token_x, token_y } => query_all_lb_pairs(deps, token_x, token_y), + QueryMsg::GetAllLbPairs { token_x, token_y } => query_all_lb_pairs(deps, token_x, token_y), } } @@ -864,7 +864,7 @@ fn query_fee_recipient(deps: Deps) -> Result { /// * `lb_pair_implementation` - The code ID and hash of the LBPair implementation. fn query_lb_pair_implementation(deps: Deps) -> Result { let config = STATE.load(deps.storage)?; - let response = LBPairImplementationResponse { + let response = LbPairImplementationResponse { lb_pair_implementation: config.lb_pair_implementation, }; to_binary(&response).map_err(Error::CwErr) @@ -877,7 +877,7 @@ fn query_lb_pair_implementation(deps: Deps) -> Result { /// * `lb_token_implementation` - The code ID and hash of the LBToken implementation. fn query_lb_token_implementation(deps: Deps) -> Result { let config = STATE.load(deps.storage)?; - let response = LBTokenImplementationResponse { + let response = LbTokenImplementationResponse { lb_token_implementation: config.lb_token_implementation, }; to_binary(&response).map_err(Error::CwErr) @@ -891,7 +891,7 @@ fn query_lb_token_implementation(deps: Deps) -> Result { fn query_number_of_lb_pairs(deps: Deps) -> Result { let lb_pair_number = ALL_LB_PAIRS.get_len(deps.storage)?; - let response = NumberOfLBPairsResponse { lb_pair_number }; + let response = NumberOfLbPairsResponse { lb_pair_number }; to_binary(&response).map_err(Error::CwErr) } @@ -908,7 +908,7 @@ fn query_number_of_lb_pairs(deps: Deps) -> Result { fn query_lb_pair_at_index(_deps: Deps, _index: u32) -> Result { let lb_pair = todo!(); - let response = LBPairAtIndexResponse { lb_pair }; + let response = LbPairAtIndexResponse { lb_pair }; to_binary(&response).map_err(Error::CwErr) } @@ -980,7 +980,7 @@ fn query_lb_pair_information( let lb_pair_information: LBPairInformation = _get_lb_pair_information(deps, token_a, token_b, bin_step)?; - let response = LBPairInformationResponse { + let response = LbPairInformationResponse { lb_pair_information, }; to_binary(&response).map_err(Error::CwErr) @@ -1172,7 +1172,7 @@ fn query_all_lb_pairs(deps: Deps, token_x: TokenType, token_y: TokenType) -> Res }) .collect(); - let response = AllLBPairsResponse { + let response = AllLbPairsResponse { lb_pairs_available: lb_pairs_available?, }; to_binary(&response).map_err(Error::CwErr) diff --git a/contracts/liquidity_book/lb_pair/Cargo.toml b/contracts/liquidity_book/lb_pair/Cargo.toml index 7775aa16..29580810 100644 --- a/contracts/liquidity_book/lb_pair/Cargo.toml +++ b/contracts/liquidity_book/lb_pair/Cargo.toml @@ -7,29 +7,25 @@ exclude = ["contract.wasm", "hash.txt"] [lib] crate-type = ["cdylib", "rlib"] -[[example]] +[[bin]] name = "schema" -path = "schema/schema.rs" +path = "src/bin/schema.rs" [features] -default = ["schema"] -schema = [] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] + [dependencies] -shade-protocol = { path = "../../../packages/shade_protocol" } +shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] } lb-libraries = { path = "../../../packages/lb_libraries" } schemars = "0.8.16" -serde = { version = "1.0" } -serde-json-wasm = { version = "1.0" } +serde = { version = "1.0.203" } +serde-json-wasm = { version = "1.0.1" } cosmwasm-schema = "2.0.3" -thiserror = { version = "1.0" } -ethnum = { version = "1.5" } -serde_json = "1" +thiserror = { version = "1.0.61" } +ethnum = { version = "1.5.0" } +serde_json = "1.0.117" [dev-dependencies] -anyhow = "1" +anyhow = "1.0.86" cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11" } diff --git a/contracts/liquidity_book/lb_pair/schema/active_id_response.json b/contracts/liquidity_book/lb_pair/schema/active_id_response.json new file mode 100644 index 00000000..7a0ccd0a --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/active_id_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ActiveIdResponse", + "type": "object", + "required": [ + "active_id" + ], + "properties": { + "active_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/all_bins_response.json b/contracts/liquidity_book/lb_pair/schema/all_bins_response.json new file mode 100644 index 00000000..6d3f97fe --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/all_bins_response.json @@ -0,0 +1,57 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllBinsResponse", + "type": "object", + "required": [ + "current_block_height", + "last_id", + "reserves" + ], + "properties": { + "current_block_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "last_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "reserves": { + "type": "array", + "items": { + "$ref": "#/definitions/BinResponse" + } + } + }, + "additionalProperties": false, + "definitions": { + "BinResponse": { + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/bin_response.json b/contracts/liquidity_book/lb_pair/schema/bin_response.json new file mode 100644 index 00000000..9d120e24 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/bin_response.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BinResponse", + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/bin_step_response.json b/contracts/liquidity_book/lb_pair/schema/bin_step_response.json new file mode 100644 index 00000000..708e5aac --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/bin_step_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BinStepResponse", + "type": "object", + "required": [ + "bin_step" + ], + "properties": { + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/bin_updating_heights_response.json b/contracts/liquidity_book/lb_pair/schema/bin_updating_heights_response.json new file mode 100644 index 00000000..71796fb9 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/bin_updating_heights_response.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BinUpdatingHeightsResponse", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/bins_response.json b/contracts/liquidity_book/lb_pair/schema/bins_response.json new file mode 100644 index 00000000..372eb7b3 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/bins_response.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BinsResponse", + "type": "array", + "items": { + "$ref": "#/definitions/BinResponse" + }, + "definitions": { + "BinResponse": { + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/execute_msg.json b/contracts/liquidity_book/lb_pair/schema/execute_msg.json new file mode 100644 index 00000000..2727d442 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/execute_msg.json @@ -0,0 +1,523 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "swap_tokens" + ], + "properties": { + "swap_tokens": { + "type": "object", + "required": [ + "offer" + ], + "properties": { + "expected_return": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "offer": { + "$ref": "#/definitions/TokenAmount" + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "to": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Snip20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "add_liquidity" + ], + "properties": { + "add_liquidity": { + "type": "object", + "required": [ + "liquidity_parameters" + ], + "properties": { + "liquidity_parameters": { + "$ref": "#/definitions/LiquidityParameters" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_liquidity" + ], + "properties": { + "remove_liquidity": { + "type": "object", + "required": [ + "remove_liquidity_params" + ], + "properties": { + "remove_liquidity_params": { + "$ref": "#/definitions/RemoveLiquidity" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "collect_protocol_fees" + ], + "properties": { + "collect_protocol_fees": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_static_fee_parameters" + ], + "properties": { + "set_static_fee_parameters": { + "type": "object", + "required": [ + "base_factor", + "decay_period", + "filter_period", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "force_decay" + ], + "properties": { + "force_decay": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "calculate_rewards_distribution" + ], + "properties": { + "calculate_rewards_distribution": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reset_rewards_config" + ], + "properties": { + "reset_rewards_config": { + "type": "object", + "properties": { + "base_rewards_bins": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "distribution": { + "anyOf": [ + { + "$ref": "#/definitions/RewardsDistributionAlgorithm" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_contract_status" + ], + "properties": { + "set_contract_status": { + "type": "object", + "required": [ + "contract_status" + ], + "properties": { + "contract_status": { + "$ref": "#/definitions/ContractStatus" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "ContractStatus": { + "type": "string", + "enum": [ + "active", + "freeze_all", + "lp_withdraw_only" + ] + }, + "LiquidityParameters": { + "type": "object", + "required": [ + "active_id_desired", + "amount_x", + "amount_x_min", + "amount_y", + "amount_y_min", + "bin_step", + "deadline", + "delta_ids", + "distribution_x", + "distribution_y", + "id_slippage", + "token_x", + "token_y" + ], + "properties": { + "active_id_desired": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "amount_x": { + "$ref": "#/definitions/Uint128" + }, + "amount_x_min": { + "$ref": "#/definitions/Uint128" + }, + "amount_y": { + "$ref": "#/definitions/Uint128" + }, + "amount_y_min": { + "$ref": "#/definitions/Uint128" + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "deadline": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "delta_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "distribution_x": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "distribution_y": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "id_slippage": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "RemoveLiquidity": { + "type": "object", + "required": [ + "amount_x_min", + "amount_y_min", + "amounts", + "bin_step", + "deadline", + "ids", + "token_x", + "token_y" + ], + "properties": { + "amount_x_min": { + "$ref": "#/definitions/Uint128" + }, + "amount_y_min": { + "$ref": "#/definitions/Uint128" + }, + "amounts": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint256" + } + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "deadline": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "RewardsDistributionAlgorithm": { + "type": "string", + "enum": [ + "time_based_rewards", + "volume_based_rewards" + ] + }, + "Snip20ReceiveMsg": { + "type": "object", + "required": [ + "amount", + "from", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "from": { + "type": "string" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "TokenAmount": { + "type": "object", + "required": [ + "amount", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + } + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/factory_response.json b/contracts/liquidity_book/lb_pair/schema/factory_response.json new file mode 100644 index 00000000..bb9984db --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/factory_response.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FactoryResponse", + "type": "object", + "required": [ + "factory" + ], + "properties": { + "factory": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/get_pair_info_response.json b/contracts/liquidity_book/lb_pair/schema/get_pair_info_response.json new file mode 100644 index 00000000..f3517947 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/get_pair_info_response.json @@ -0,0 +1,342 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GetPairInfoResponse", + "type": "object", + "required": [ + "amount_0", + "amount_1", + "contract_version", + "fee_info", + "liquidity_token", + "pair", + "total_liquidity" + ], + "properties": { + "amount_0": { + "$ref": "#/definitions/Uint128" + }, + "amount_1": { + "$ref": "#/definitions/Uint128" + }, + "contract_version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "factory": { + "anyOf": [ + { + "$ref": "#/definitions/ContractInfo" + }, + { + "type": "null" + } + ] + }, + "fee_info": { + "$ref": "#/definitions/FeeInfo" + }, + "liquidity_token": { + "$ref": "#/definitions/ContractInfo" + }, + "pair": { + "$ref": "#/definitions/TokenPair" + }, + "stable_info": { + "anyOf": [ + { + "$ref": "#/definitions/StablePairInfoResponse" + }, + { + "type": "null" + } + ] + }, + "total_liquidity": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Contract": { + "description": "In the process of being deprecated for [cosmwasm_std::ContractInfo] so use that instead when possible.", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "CustomIterationControls": { + "type": "object", + "required": [ + "epsilon", + "max_iter_bisect", + "max_iter_newton" + ], + "properties": { + "epsilon": { + "$ref": "#/definitions/Uint256" + }, + "max_iter_bisect": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "max_iter_newton": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "Decimal256": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal256(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 115792089237316195423570985008687907853269984665640564039457.584007913129639935 (which is (2^256 - 1) / 10^18)", + "type": "string" + }, + "Fee": { + "type": "object", + "required": [ + "denom", + "nom" + ], + "properties": { + "denom": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "nom": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "FeeInfo": { + "type": "object", + "required": [ + "lp_fee", + "shade_dao_address", + "shade_dao_fee", + "stable_lp_fee", + "stable_shade_dao_fee" + ], + "properties": { + "lp_fee": { + "$ref": "#/definitions/Fee" + }, + "shade_dao_address": { + "$ref": "#/definitions/Addr" + }, + "shade_dao_fee": { + "$ref": "#/definitions/Fee" + }, + "stable_lp_fee": { + "$ref": "#/definitions/Fee" + }, + "stable_shade_dao_fee": { + "$ref": "#/definitions/Fee" + } + }, + "additionalProperties": false + }, + "StablePairInfoResponse": { + "type": "object", + "required": [ + "stable_params", + "stable_token0_data", + "stable_token1_data" + ], + "properties": { + "p": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal256" + }, + { + "type": "null" + } + ] + }, + "stable_params": { + "$ref": "#/definitions/StableParams" + }, + "stable_token0_data": { + "$ref": "#/definitions/StableTokenData" + }, + "stable_token1_data": { + "$ref": "#/definitions/StableTokenData" + } + }, + "additionalProperties": false + }, + "StableParams": { + "type": "object", + "required": [ + "a", + "gamma1", + "gamma2", + "max_price_impact_allowed", + "min_trade_size_x_for_y", + "min_trade_size_y_for_x", + "oracle" + ], + "properties": { + "a": { + "$ref": "#/definitions/Decimal256" + }, + "custom_iteration_controls": { + "anyOf": [ + { + "$ref": "#/definitions/CustomIterationControls" + }, + { + "type": "null" + } + ] + }, + "gamma1": { + "$ref": "#/definitions/Uint256" + }, + "gamma2": { + "$ref": "#/definitions/Uint256" + }, + "max_price_impact_allowed": { + "$ref": "#/definitions/Decimal256" + }, + "min_trade_size_x_for_y": { + "$ref": "#/definitions/Decimal256" + }, + "min_trade_size_y_for_x": { + "$ref": "#/definitions/Decimal256" + }, + "oracle": { + "$ref": "#/definitions/Contract" + } + }, + "additionalProperties": false + }, + "StableTokenData": { + "type": "object", + "required": [ + "decimals", + "oracle_key" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "oracle_key": { + "type": "string" + } + }, + "additionalProperties": false + }, + "TokenPair": { + "type": "object", + "required": [ + "token_0", + "token_1" + ], + "properties": { + "token_0": { + "$ref": "#/definitions/TokenType" + }, + "token_1": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/id_from_price_response.json b/contracts/liquidity_book/lb_pair/schema/id_from_price_response.json new file mode 100644 index 00000000..1cfcab13 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/id_from_price_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IdFromPriceResponse", + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/instantiate_msg.json b/contracts/liquidity_book/lb_pair/schema/instantiate_msg.json new file mode 100644 index 00000000..adbbae33 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/instantiate_msg.json @@ -0,0 +1,273 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "active_id", + "admin_auth", + "bin_step", + "entropy", + "epoch_staking_duration", + "epoch_staking_index", + "factory", + "lb_token_implementation", + "pair_parameters", + "protocol_fee_recipient", + "query_auth", + "recover_staking_funds_receiver", + "rewards_distribution_algorithm", + "staking_contract_implementation", + "token_x", + "token_y", + "viewing_key" + ], + "properties": { + "active_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "admin_auth": { + "$ref": "#/definitions/RawContract" + }, + "bin_step": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "entropy": { + "type": "string" + }, + "epoch_staking_duration": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epoch_staking_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "expiry_staking_duration": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "factory": { + "$ref": "#/definitions/ContractInfo" + }, + "lb_token_implementation": { + "$ref": "#/definitions/ContractImplementation" + }, + "max_bins_per_swap": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "pair_parameters": { + "$ref": "#/definitions/StaticFeeParameters" + }, + "protocol_fee_recipient": { + "$ref": "#/definitions/Addr" + }, + "query_auth": { + "$ref": "#/definitions/RawContract" + }, + "recover_staking_funds_receiver": { + "$ref": "#/definitions/Addr" + }, + "rewards_distribution_algorithm": { + "$ref": "#/definitions/RewardsDistributionAlgorithm" + }, + "staking_contract_implementation": { + "$ref": "#/definitions/ContractImplementation" + }, + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + }, + "total_reward_bins": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "viewing_key": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractImplementation": { + "type": "object", + "required": [ + "code_hash", + "id" + ], + "properties": { + "code_hash": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "RawContract": { + "description": "A contract that does not contain a validated address. Should be accepted as user input because we shouldn't assume addresses are verified Addrs. https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Addr.html", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "RewardsDistributionAlgorithm": { + "type": "string", + "enum": [ + "time_based_rewards", + "volume_based_rewards" + ] + }, + "StaticFeeParameters": { + "type": "object", + "required": [ + "base_factor", + "decay_period", + "filter_period", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/invoke_msg.json b/contracts/liquidity_book/lb_pair/schema/invoke_msg.json new file mode 100644 index 00000000..1d062721 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/invoke_msg.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InvokeMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "swap_tokens" + ], + "properties": { + "swap_tokens": { + "type": "object", + "properties": { + "expected_return": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "to": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/lb_token_response.json b/contracts/liquidity_book/lb_pair/schema/lb_token_response.json new file mode 100644 index 00000000..234810f0 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/lb_token_response.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LbTokenResponse", + "type": "object", + "required": [ + "contract" + ], + "properties": { + "contract": { + "$ref": "#/definitions/ContractInfo" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/mint_response.json b/contracts/liquidity_book/lb_pair/schema/mint_response.json new file mode 100644 index 00000000..384b9394 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/mint_response.json @@ -0,0 +1,45 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintResponse", + "type": "object", + "required": [ + "amounts_left", + "amounts_received", + "liquidity_minted" + ], + "properties": { + "amounts_left": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "amounts_received": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "liquidity_minted": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint256" + } + } + }, + "additionalProperties": false, + "definitions": { + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/next_non_empty_bin_response.json b/contracts/liquidity_book/lb_pair/schema/next_non_empty_bin_response.json new file mode 100644 index 00000000..ea198356 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/next_non_empty_bin_response.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NextNonEmptyBinResponse", + "type": "object", + "required": [ + "next_id" + ], + "properties": { + "next_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/oracle_parameters_response.json b/contracts/liquidity_book/lb_pair/schema/oracle_parameters_response.json new file mode 100644 index 00000000..1bf3a46f --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/oracle_parameters_response.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OracleParametersResponse", + "type": "object", + "required": [ + "first_timestamp", + "last_updated", + "sample_lifetime", + "size" + ], + "properties": { + "first_timestamp": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "last_updated": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "sample_lifetime": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "size": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/oracle_sample_at_response.json b/contracts/liquidity_book/lb_pair/schema/oracle_sample_at_response.json new file mode 100644 index 00000000..e04806ce --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/oracle_sample_at_response.json @@ -0,0 +1,76 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OracleSampleAtResponse", + "type": "object", + "required": [ + "created_at", + "cumulative_bin_crossed", + "cumulative_fee_x", + "cumulative_fee_y", + "cumulative_id", + "cumulative_txns", + "cumulative_volatility", + "cumulative_volume_x", + "cumulative_volume_y", + "lifetime", + "oracle_id" + ], + "properties": { + "created_at": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "cumulative_bin_crossed": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "cumulative_fee_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "cumulative_fee_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "cumulative_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "cumulative_txns": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "cumulative_volatility": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "cumulative_volume_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "cumulative_volume_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "lifetime": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "oracle_id": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/price_from_id_response.json b/contracts/liquidity_book/lb_pair/schema/price_from_id_response.json new file mode 100644 index 00000000..561ed672 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/price_from_id_response.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PriceFromIdResponse", + "type": "object", + "required": [ + "price" + ], + "properties": { + "price": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false, + "definitions": { + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/protocol_fees_response.json b/contracts/liquidity_book/lb_pair/schema/protocol_fees_response.json new file mode 100644 index 00000000..483ec858 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/protocol_fees_response.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProtocolFeesResponse", + "type": "object", + "required": [ + "protocol_fee_x", + "protocol_fee_y" + ], + "properties": { + "protocol_fee_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "protocol_fee_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/query_msg.json b/contracts/liquidity_book/lb_pair/schema/query_msg.json new file mode 100644 index 00000000..d585d57e --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/query_msg.json @@ -0,0 +1,748 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_staking_contract" + ], + "properties": { + "get_staking_contract": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_lb_token" + ], + "properties": { + "get_lb_token": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_pair_info" + ], + "properties": { + "get_pair_info": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "swap_simulation" + ], + "properties": { + "swap_simulation": { + "type": "object", + "required": [ + "offer" + ], + "properties": { + "exclude_fee": { + "type": [ + "boolean", + "null" + ] + }, + "offer": { + "$ref": "#/definitions/TokenAmount" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_factory" + ], + "properties": { + "get_factory": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_tokens" + ], + "properties": { + "get_tokens": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_token_x" + ], + "properties": { + "get_token_x": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_token_y" + ], + "properties": { + "get_token_y": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_bin_step" + ], + "properties": { + "get_bin_step": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_reserves" + ], + "properties": { + "get_reserves": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_active_id" + ], + "properties": { + "get_active_id": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_bin_reserves" + ], + "properties": { + "get_bin_reserves": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_bins_reserves" + ], + "properties": { + "get_bins_reserves": { + "type": "object", + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_all_bins_reserves" + ], + "properties": { + "get_all_bins_reserves": { + "type": "object", + "properties": { + "id": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_updated_bin_at_height" + ], + "properties": { + "get_updated_bin_at_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_updated_bin_at_multiple_heights" + ], + "properties": { + "get_updated_bin_at_multiple_heights": { + "type": "object", + "required": [ + "heights" + ], + "properties": { + "heights": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_updated_bin_after_height" + ], + "properties": { + "get_updated_bin_after_height": { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_bin_updating_heights" + ], + "properties": { + "get_bin_updating_heights": { + "type": "object", + "properties": { + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_next_non_empty_bin" + ], + "properties": { + "get_next_non_empty_bin": { + "type": "object", + "required": [ + "id", + "swap_for_y" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "swap_for_y": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_protocol_fees" + ], + "properties": { + "get_protocol_fees": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_static_fee_parameters" + ], + "properties": { + "get_static_fee_parameters": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_variable_fee_parameters" + ], + "properties": { + "get_variable_fee_parameters": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_oracle_parameters" + ], + "properties": { + "get_oracle_parameters": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_oracle_sample_at" + ], + "properties": { + "get_oracle_sample_at": { + "type": "object", + "required": [ + "oracle_id" + ], + "properties": { + "oracle_id": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_oracle_samples_at" + ], + "properties": { + "get_oracle_samples_at": { + "type": "object", + "required": [ + "oracle_ids" + ], + "properties": { + "oracle_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_oracle_samples_after" + ], + "properties": { + "get_oracle_samples_after": { + "type": "object", + "required": [ + "oracle_id" + ], + "properties": { + "oracle_id": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint16", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_price_from_id" + ], + "properties": { + "get_price_from_id": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_id_from_price" + ], + "properties": { + "get_id_from_price": { + "type": "object", + "required": [ + "price" + ], + "properties": { + "price": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_swap_in" + ], + "properties": { + "get_swap_in": { + "type": "object", + "required": [ + "amount_out", + "swap_for_y" + ], + "properties": { + "amount_out": { + "$ref": "#/definitions/Uint128" + }, + "swap_for_y": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_swap_out" + ], + "properties": { + "get_swap_out": { + "type": "object", + "required": [ + "amount_in", + "swap_for_y" + ], + "properties": { + "amount_in": { + "$ref": "#/definitions/Uint128" + }, + "swap_for_y": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "total_supply" + ], + "properties": { + "total_supply": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_rewards_distribution" + ], + "properties": { + "get_rewards_distribution": { + "type": "object", + "properties": { + "epoch_id": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenAmount": { + "type": "object", + "required": [ + "amount", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + } + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/reserves_response.json b/contracts/liquidity_book/lb_pair/schema/reserves_response.json new file mode 100644 index 00000000..a6f5cb09 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/reserves_response.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ReservesResponse", + "type": "object", + "required": [ + "reserve_x", + "reserve_y" + ], + "properties": { + "reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/rewards_distribution_response.json b/contracts/liquidity_book/lb_pair/schema/rewards_distribution_response.json new file mode 100644 index 00000000..de331cfd --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/rewards_distribution_response.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RewardsDistributionResponse", + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/RewardsDistribution" + } + }, + "additionalProperties": false, + "definitions": { + "RewardsDistribution": { + "type": "object", + "required": [ + "denominator", + "ids", + "weightages" + ], + "properties": { + "denominator": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "weightages": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/staking_response.json b/contracts/liquidity_book/lb_pair/schema/staking_response.json new file mode 100644 index 00000000..4ed254ff --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/staking_response.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StakingResponse", + "type": "object", + "required": [ + "contract" + ], + "properties": { + "contract": { + "$ref": "#/definitions/ContractInfo" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/static_fee_parameters_response.json b/contracts/liquidity_book/lb_pair/schema/static_fee_parameters_response.json new file mode 100644 index 00000000..8524bff1 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/static_fee_parameters_response.json @@ -0,0 +1,52 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StaticFeeParametersResponse", + "type": "object", + "required": [ + "base_factor", + "decay_period", + "filter_period", + "max_volatility_accumulator", + "protocol_share", + "reduction_factor", + "variable_fee_control" + ], + "properties": { + "base_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "decay_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "filter_period": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "max_volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "protocol_share": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "reduction_factor": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "variable_fee_control": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/swap_in_response.json b/contracts/liquidity_book/lb_pair/schema/swap_in_response.json new file mode 100644 index 00000000..77618169 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/swap_in_response.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SwapInResponse", + "type": "object", + "required": [ + "amount_in", + "amount_out_left", + "fee" + ], + "properties": { + "amount_in": { + "$ref": "#/definitions/Uint128" + }, + "amount_out_left": { + "$ref": "#/definitions/Uint128" + }, + "fee": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/swap_out_response.json b/contracts/liquidity_book/lb_pair/schema/swap_out_response.json new file mode 100644 index 00000000..a793167e --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/swap_out_response.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SwapOutResponse", + "type": "object", + "required": [ + "amount_in_left", + "amount_out", + "lp_fees", + "shade_dao_fees", + "total_fees" + ], + "properties": { + "amount_in_left": { + "$ref": "#/definitions/Uint128" + }, + "amount_out": { + "$ref": "#/definitions/Uint128" + }, + "lp_fees": { + "$ref": "#/definitions/Uint128" + }, + "shade_dao_fees": { + "$ref": "#/definitions/Uint128" + }, + "total_fees": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false, + "definitions": { + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/swap_simulation_response.json b/contracts/liquidity_book/lb_pair/schema/swap_simulation_response.json new file mode 100644 index 00000000..5ca6e193 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/swap_simulation_response.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SwapSimulationResponse", + "type": "object", + "required": [ + "lp_fee_amount", + "price", + "result", + "shade_dao_fee_amount", + "total_fee_amount" + ], + "properties": { + "lp_fee_amount": { + "$ref": "#/definitions/Uint128" + }, + "price": { + "type": "string" + }, + "result": { + "$ref": "#/definitions/SwapResult" + }, + "shade_dao_fee_amount": { + "$ref": "#/definitions/Uint128" + }, + "total_fee_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false, + "definitions": { + "SwapResult": { + "type": "object", + "required": [ + "return_amount" + ], + "properties": { + "return_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/token_x_response.json b/contracts/liquidity_book/lb_pair/schema/token_x_response.json new file mode 100644 index 00000000..6bcb39ea --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/token_x_response.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokenXResponse", + "type": "object", + "required": [ + "token_x" + ], + "properties": { + "token_x": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/token_y_response.json b/contracts/liquidity_book/lb_pair/schema/token_y_response.json new file mode 100644 index 00000000..0c139342 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/token_y_response.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokenYResponse", + "type": "object", + "required": [ + "token_y" + ], + "properties": { + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/tokens_response.json b/contracts/liquidity_book/lb_pair/schema/tokens_response.json new file mode 100644 index 00000000..6f14e021 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/tokens_response.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokensResponse", + "type": "object", + "required": [ + "token_x", + "token_y" + ], + "properties": { + "token_x": { + "$ref": "#/definitions/TokenType" + }, + "token_y": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/total_supply_response.json b/contracts/liquidity_book/lb_pair/schema/total_supply_response.json new file mode 100644 index 00000000..aa684bc0 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/total_supply_response.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TotalSupplyResponse", + "type": "object", + "required": [ + "total_supply" + ], + "properties": { + "total_supply": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false, + "definitions": { + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/updated_bins_after_height_response.json b/contracts/liquidity_book/lb_pair/schema/updated_bins_after_height_response.json new file mode 100644 index 00000000..650af5be --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/updated_bins_after_height_response.json @@ -0,0 +1,51 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UpdatedBinsAfterHeightResponse", + "type": "object", + "required": [ + "bins", + "current_block_height" + ], + "properties": { + "bins": { + "type": "array", + "items": { + "$ref": "#/definitions/BinResponse" + } + }, + "current_block_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "BinResponse": { + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/updated_bins_at_height_response.json b/contracts/liquidity_book/lb_pair/schema/updated_bins_at_height_response.json new file mode 100644 index 00000000..2d9e16f4 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/updated_bins_at_height_response.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UpdatedBinsAtHeightResponse", + "type": "array", + "items": { + "$ref": "#/definitions/BinResponse" + }, + "definitions": { + "BinResponse": { + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/updated_bins_at_multiple_height_response.json b/contracts/liquidity_book/lb_pair/schema/updated_bins_at_multiple_height_response.json new file mode 100644 index 00000000..60018a0c --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/updated_bins_at_multiple_height_response.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "UpdatedBinsAtMultipleHeightResponse", + "type": "array", + "items": { + "$ref": "#/definitions/BinResponse" + }, + "definitions": { + "BinResponse": { + "type": "object", + "required": [ + "bin_id", + "bin_reserve_x", + "bin_reserve_y" + ], + "properties": { + "bin_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "bin_reserve_x": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "bin_reserve_y": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_pair/schema/variable_fee_parameters_response.json b/contracts/liquidity_book/lb_pair/schema/variable_fee_parameters_response.json new file mode 100644 index 00000000..b4600403 --- /dev/null +++ b/contracts/liquidity_book/lb_pair/schema/variable_fee_parameters_response.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VariableFeeParametersResponse", + "type": "object", + "required": [ + "id_reference", + "time_of_last_update", + "volatility_accumulator", + "volatility_reference" + ], + "properties": { + "id_reference": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "time_of_last_update": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "volatility_accumulator": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "volatility_reference": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false +} diff --git a/contracts/liquidity_book/lb_pair/schema/schema.rs b/contracts/liquidity_book/lb_pair/src/bin/schema.rs similarity index 68% rename from contracts/liquidity_book/lb_pair/schema/schema.rs rename to contracts/liquidity_book/lb_pair/src/bin/schema.rs index 973d1bfb..eaf8048e 100644 --- a/contracts/liquidity_book/lb_pair/schema/schema.rs +++ b/contracts/liquidity_book/lb_pair/src/bin/schema.rs @@ -1,49 +1,23 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::{env::current_dir, fs::create_dir_all}; +use std::{env, fs::create_dir_all, path::PathBuf}; use shade_protocol::liquidity_book::lb_pair::{ - ActiveIdResponse, - AllBinsResponse, - BinResponse, - BinStepResponse, - BinUpdatingHeightsResponse, - BinsResponse, - ExecuteMsg, - FactoryResponse, - GetPairInfoResponse, - IdFromPriceResponse, - InstantiateMsg, - InvokeMsg, - LbTokenResponse, - MintResponse, - // Add other structs as needed - NextNonEmptyBinResponse, - OracleParametersResponse, - OracleSampleAtResponse, - PriceFromIdResponse, - ProtocolFeesResponse, - QueryMsg, - ReservesResponse, - RewardsDistributionResponse, - // Import all response structs - StakingResponse, - StaticFeeParametersResponse, - SwapInResponse, - SwapOutResponse, - SwapSimulationResponse, - TokenXResponse, - TokenYResponse, - TokensResponse, - TotalSupplyResponse, - UpdatedBinsAfterHeightResponse, - UpdatedBinsAtHeightResponse, - UpdatedBinsAtMultipleHeightResponse, - VariableFeeParametersResponse, + ActiveIdResponse, AllBinsResponse, BinResponse, BinStepResponse, BinUpdatingHeightsResponse, + BinsResponse, ExecuteMsg, FactoryResponse, GetPairInfoResponse, IdFromPriceResponse, + InstantiateMsg, InvokeMsg, LbTokenResponse, MintResponse, NextNonEmptyBinResponse, + OracleParametersResponse, OracleSampleAtResponse, PriceFromIdResponse, ProtocolFeesResponse, + QueryMsg, ReservesResponse, RewardsDistributionResponse, StakingResponse, + StaticFeeParametersResponse, SwapInResponse, SwapOutResponse, SwapSimulationResponse, + TokenXResponse, TokenYResponse, TokensResponse, TotalSupplyResponse, + UpdatedBinsAfterHeightResponse, UpdatedBinsAtHeightResponse, + UpdatedBinsAtMultipleHeightResponse, VariableFeeParametersResponse, }; fn main() { - let mut out_dir = current_dir().unwrap(); + // Get the directory of the current crate + let mut out_dir = env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(); out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); remove_schemas(&out_dir).unwrap(); @@ -52,7 +26,6 @@ fn main() { export_schema(&schema_for!(InvokeMsg), &out_dir); export_schema(&schema_for!(QueryMsg), &out_dir); - // Add export_schema for each response struct export_schema(&schema_for!(StakingResponse), &out_dir); export_schema(&schema_for!(LbTokenResponse), &out_dir); export_schema(&schema_for!(GetPairInfoResponse), &out_dir); @@ -84,5 +57,4 @@ fn main() { export_schema(&schema_for!(TotalSupplyResponse), &out_dir); export_schema(&schema_for!(RewardsDistributionResponse), &out_dir); export_schema(&schema_for!(MintResponse), &out_dir); - // Continue adding export_schema calls for any other structs you need } diff --git a/contracts/liquidity_book/lb_router/Cargo.toml b/contracts/liquidity_book/lb_router/Cargo.toml index 49b8a927..80914ed8 100644 --- a/contracts/liquidity_book/lb_router/Cargo.toml +++ b/contracts/liquidity_book/lb_router/Cargo.toml @@ -8,24 +8,22 @@ exclude = ["contract.wasm", "hash.txt"] [lib] crate-type = ["cdylib", "rlib"] -[[example]] +[[bin]] name = "schema" -path = "schema/schema.rs" +path = "src/bin/schema.rs" [features] -default = ["schema"] -schema = [] [dependencies] -shade-protocol = { path = "../../../packages/shade_protocol" } +shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] } lb-libraries = { path = "../../../packages/lb_libraries" } snafu = { version = "0.8.3" } schemars = "0.8.21" serde = { version = "1.0.203", default-features = false, features = ["derive", "alloc"] } cosmwasm-schema = "2.0.3" -serde_json = "1" +serde_json = "1.0.117" [dev-dependencies] diff --git a/contracts/liquidity_book/lb_router/schema/execute_msg.json b/contracts/liquidity_book/lb_router/schema/execute_msg.json new file mode 100644 index 00000000..a77277c1 --- /dev/null +++ b/contracts/liquidity_book/lb_router/schema/execute_msg.json @@ -0,0 +1,334 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Snip20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "swap_tokens_for_exact" + ], + "properties": { + "swap_tokens_for_exact": { + "type": "object", + "required": [ + "offer", + "path" + ], + "properties": { + "expected_return": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "offer": { + "description": "The token type to swap from.", + "allOf": [ + { + "$ref": "#/definitions/TokenAmount" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "path": { + "type": "array", + "items": { + "$ref": "#/definitions/Hop" + } + }, + "recipient": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "register_s_n_i_p20_token" + ], + "properties": { + "register_s_n_i_p20_token": { + "type": "object", + "required": [ + "token_addr", + "token_code_hash" + ], + "properties": { + "oracle_key": { + "type": [ + "string", + "null" + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "token_addr": { + "type": "string" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "recover_funds" + ], + "properties": { + "recover_funds": { + "type": "object", + "required": [ + "amount", + "to", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "to": { + "type": "string" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_config" + ], + "properties": { + "set_config": { + "type": "object", + "properties": { + "admin_auth": { + "anyOf": [ + { + "$ref": "#/definitions/Contract" + }, + { + "type": "null" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Contract": { + "description": "In the process of being deprecated for [cosmwasm_std::ContractInfo] so use that instead when possible.", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Hop": { + "type": "object", + "required": [ + "addr", + "code_hash" + ], + "properties": { + "addr": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Snip20ReceiveMsg": { + "type": "object", + "required": [ + "amount", + "from", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "from": { + "type": "string" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "TokenAmount": { + "type": "object", + "required": [ + "amount", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + } + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_router/schema/init_msg.json b/contracts/liquidity_book/lb_router/schema/init_msg.json new file mode 100644 index 00000000..0e64cfe2 --- /dev/null +++ b/contracts/liquidity_book/lb_router/schema/init_msg.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InitMsg", + "type": "object", + "required": [ + "admin_auth", + "entropy", + "prng_seed" + ], + "properties": { + "admin_auth": { + "$ref": "#/definitions/Contract" + }, + "airdrop_address": { + "anyOf": [ + { + "$ref": "#/definitions/Contract" + }, + { + "type": "null" + } + ] + }, + "entropy": { + "$ref": "#/definitions/Binary" + }, + "prng_seed": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Contract": { + "description": "In the process of being deprecated for [cosmwasm_std::ContractInfo] so use that instead when possible.", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_router/schema/invoke_msg.json b/contracts/liquidity_book/lb_router/schema/invoke_msg.json new file mode 100644 index 00000000..cff7f439 --- /dev/null +++ b/contracts/liquidity_book/lb_router/schema/invoke_msg.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InvokeMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "swap_tokens_for_exact" + ], + "properties": { + "swap_tokens_for_exact": { + "type": "object", + "required": [ + "path" + ], + "properties": { + "expected_return": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "path": { + "type": "array", + "items": { + "$ref": "#/definitions/Hop" + } + }, + "recipient": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Hop": { + "type": "object", + "required": [ + "addr", + "code_hash" + ], + "properties": { + "addr": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_router/schema/query_msg.json b/contracts/liquidity_book/lb_router/schema/query_msg.json new file mode 100644 index 00000000..b7914169 --- /dev/null +++ b/contracts/liquidity_book/lb_router/schema/query_msg.json @@ -0,0 +1,157 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "swap_simulation" + ], + "properties": { + "swap_simulation": { + "type": "object", + "required": [ + "offer", + "path" + ], + "properties": { + "exclude_fee": { + "type": [ + "boolean", + "null" + ] + }, + "offer": { + "$ref": "#/definitions/TokenAmount" + }, + "path": { + "type": "array", + "items": { + "$ref": "#/definitions/Hop" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_config" + ], + "properties": { + "get_config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "registered_tokens" + ], + "properties": { + "registered_tokens": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Hop": { + "type": "object", + "required": [ + "addr", + "code_hash" + ], + "properties": { + "addr": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "TokenAmount": { + "type": "object", + "required": [ + "amount", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + } + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_router/schema/query_msg_response.json b/contracts/liquidity_book/lb_router/schema/query_msg_response.json new file mode 100644 index 00000000..93a4684f --- /dev/null +++ b/contracts/liquidity_book/lb_router/schema/query_msg_response.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsgResponse", + "oneOf": [ + { + "type": "object", + "required": [ + "swap_simulation" + ], + "properties": { + "swap_simulation": { + "type": "object", + "required": [ + "lp_fee_amount", + "price", + "result", + "shade_dao_fee_amount", + "total_fee_amount" + ], + "properties": { + "lp_fee_amount": { + "$ref": "#/definitions/Uint128" + }, + "price": { + "type": "string" + }, + "result": { + "$ref": "#/definitions/SwapResult" + }, + "shade_dao_fee_amount": { + "$ref": "#/definitions/Uint128" + }, + "total_fee_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_config" + ], + "properties": { + "get_config": { + "type": "object", + "required": [ + "admin_auth" + ], + "properties": { + "admin_auth": { + "$ref": "#/definitions/Contract" + }, + "airdrop_address": { + "anyOf": [ + { + "$ref": "#/definitions/Contract" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "registered_tokens" + ], + "properties": { + "registered_tokens": { + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Contract": { + "description": "In the process of being deprecated for [cosmwasm_std::ContractInfo] so use that instead when possible.", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "SwapResult": { + "type": "object", + "required": [ + "return_amount" + ], + "properties": { + "return_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_router/schema/schema.rs b/contracts/liquidity_book/lb_router/src/bin/schema.rs similarity index 61% rename from contracts/liquidity_book/lb_router/schema/schema.rs rename to contracts/liquidity_book/lb_router/src/bin/schema.rs index c0e8cb89..518599b1 100644 --- a/contracts/liquidity_book/lb_router/schema/schema.rs +++ b/contracts/liquidity_book/lb_router/src/bin/schema.rs @@ -1,11 +1,15 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::{env::current_dir, fs::create_dir_all}; +use std::{env, fs::create_dir_all, path::PathBuf}; -use shade_protocol::swap::router::{ExecuteMsg, InitMsg, InvokeMsg, QueryMsg, QueryMsgResponse}; +use shade_protocol::liquidity_book::lb_router::{ + ExecuteMsg, InitMsg, InvokeMsg, QueryMsg, QueryMsgResponse, +}; fn main() { - let mut out_dir = current_dir().unwrap(); + // Get the directory of the current crate + let mut out_dir = env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(); out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); remove_schemas(&out_dir).unwrap(); diff --git a/contracts/liquidity_book/lb_staking/Cargo.toml b/contracts/liquidity_book/lb_staking/Cargo.toml index d54a3717..87c0ffaa 100644 --- a/contracts/liquidity_book/lb_staking/Cargo.toml +++ b/contracts/liquidity_book/lb_staking/Cargo.toml @@ -8,18 +8,16 @@ exclude = ["contract.wasm", "hash.txt"] [lib] crate-type = ["cdylib", "rlib"] -[[example]] +[[bin]] name = "schema" -path = "schema/schema.rs" +path = "src/bin/schema.rs" [features] -default = ["schema"] -schema = [] [dependencies] -shade-protocol = { path = "../../../packages/shade_protocol" } +shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] } lb-libraries = { path = "../../../packages/lb_libraries" } snafu = { version = "0.8.3" } schemars = "0.8.21" diff --git a/contracts/liquidity_book/lb_staking/schema/execute_msg.json b/contracts/liquidity_book/lb_staking/schema/execute_msg.json new file mode 100644 index 00000000..86e1590b --- /dev/null +++ b/contracts/liquidity_book/lb_staking/schema/execute_msg.json @@ -0,0 +1,447 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "claim_rewards" + ], + "properties": { + "claim_rewards": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "end_epoch" + ], + "properties": { + "end_epoch": { + "type": "object", + "required": [ + "epoch_index", + "rewards_distribution" + ], + "properties": { + "epoch_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "rewards_distribution": { + "$ref": "#/definitions/RewardsDistribution" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "unstake" + ], + "properties": { + "unstake": { + "type": "object", + "required": [ + "amounts", + "token_ids" + ], + "properties": { + "amounts": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint256" + } + }, + "token_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "snip1155_receive" + ], + "properties": { + "snip1155_receive": { + "$ref": "#/definitions/Snip1155ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Snip20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "register_reward_tokens" + ], + "properties": { + "register_reward_tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractInfo" + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_config" + ], + "properties": { + "update_config": { + "type": "object", + "properties": { + "admin_auth": { + "anyOf": [ + { + "$ref": "#/definitions/RawContract" + }, + { + "type": "null" + } + ] + }, + "epoch_duration": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "expiry_duration": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "query_auth": { + "anyOf": [ + { + "$ref": "#/definitions/RawContract" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "recover_funds" + ], + "properties": { + "recover_funds": { + "type": "object", + "required": [ + "amount", + "to", + "token" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "to": { + "type": "string" + }, + "token": { + "$ref": "#/definitions/TokenType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "recover_expired_funds" + ], + "properties": { + "recover_expired_funds": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "RawContract": { + "description": "A contract that does not contain a validated address. Should be accepted as user input because we shouldn't assume addresses are verified Addrs. https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Addr.html", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "RewardsDistribution": { + "type": "object", + "required": [ + "denominator", + "ids", + "weightages" + ], + "properties": { + "denominator": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "weightages": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + }, + "Snip1155ReceiveMsg": { + "description": "Snip1155ReceiveMsg should be de/serialized under `Snip1155Receive()` variant in a HandleMsg", + "type": "object", + "required": [ + "amount", + "from", + "sender", + "token_id" + ], + "properties": { + "amount": { + "description": "amount of tokens being transferred", + "allOf": [ + { + "$ref": "#/definitions/Uint256" + } + ] + }, + "from": { + "description": "the previous owner of the tokens being transferred", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "memo": { + "description": "optional memo", + "type": [ + "string", + "null" + ] + }, + "msg": { + "description": "optional message", + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "sender": { + "description": "the address that sent the `Send` or `BatchSend` message", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "token_id": { + "description": "unique token_id `String`", + "type": "string" + } + } + }, + "Snip20ReceiveMsg": { + "type": "object", + "required": [ + "amount", + "from", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "from": { + "type": "string" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "TokenType": { + "oneOf": [ + { + "type": "object", + "required": [ + "custom_token" + ], + "properties": { + "custom_token": { + "type": "object", + "required": [ + "contract_addr", + "token_code_hash" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + }, + "token_code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_staking/schema/instantiate_msg.json b/contracts/liquidity_book/lb_staking/schema/instantiate_msg.json new file mode 100644 index 00000000..5ac92fa1 --- /dev/null +++ b/contracts/liquidity_book/lb_staking/schema/instantiate_msg.json @@ -0,0 +1,73 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "admin_auth", + "amm_pair", + "epoch_duration", + "epoch_index", + "lb_token", + "query_auth", + "recover_funds_receiver" + ], + "properties": { + "admin_auth": { + "$ref": "#/definitions/RawContract" + }, + "amm_pair": { + "type": "string" + }, + "epoch_duration": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epoch_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "expiry_duration": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "lb_token": { + "$ref": "#/definitions/RawContract" + }, + "query_auth": { + "$ref": "#/definitions/RawContract" + }, + "recover_funds_receiver": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "RawContract": { + "description": "A contract that does not contain a validated address. Should be accepted as user input because we shouldn't assume addresses are verified Addrs. https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Addr.html", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "type": "string" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + } + } +} diff --git a/contracts/liquidity_book/lb_staking/schema/invoke_msg.json b/contracts/liquidity_book/lb_staking/schema/invoke_msg.json new file mode 100644 index 00000000..4e1947be --- /dev/null +++ b/contracts/liquidity_book/lb_staking/schema/invoke_msg.json @@ -0,0 +1,65 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InvokeMsg", + "oneOf": [ + { + "description": "From is used to determine the staker since this can be called by the AMMPair when auto staking.", + "type": "object", + "required": [ + "stake" + ], + "properties": { + "stake": { + "type": "object", + "properties": { + "from": { + "type": [ + "string", + "null" + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "add_rewards" + ], + "properties": { + "add_rewards": { + "type": "object", + "required": [ + "end" + ], + "properties": { + "end": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/liquidity_book/lb_staking/schema/query_answer.json b/contracts/liquidity_book/lb_staking/schema/query_answer.json new file mode 100644 index 00000000..1a0a26e6 --- /dev/null +++ b/contracts/liquidity_book/lb_staking/schema/query_answer.json @@ -0,0 +1,660 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryAnswer", + "description": "the query responses for each [QueryMsg](crate::msg::QueryMsg) variant", + "oneOf": [ + { + "description": "returns contract-level information:", + "type": "object", + "required": [ + "contract_info" + ], + "properties": { + "contract_info": { + "type": "object", + "required": [ + "admin_auth", + "epoch_durations", + "epoch_index", + "lb_pair", + "lb_token", + "query_auth" + ], + "properties": { + "admin_auth": { + "$ref": "#/definitions/Contract" + }, + "epoch_durations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "epoch_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "expiry_durations": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "lb_pair": { + "$ref": "#/definitions/Addr" + }, + "lb_token": { + "$ref": "#/definitions/ContractInfo" + }, + "query_auth": { + "$ref": "#/definitions/Contract" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "epoch_info" + ], + "properties": { + "epoch_info": { + "type": "object", + "required": [ + "duration", + "end_time", + "start_time" + ], + "properties": { + "duration": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "end_time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "expired_at": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "reward_tokens": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/RewardTokenInfo" + } + }, + "rewards_distribution": { + "anyOf": [ + { + "$ref": "#/definitions/RewardsDistribution" + }, + { + "type": "null" + } + ] + }, + "start_time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "registered_tokens" + ], + "properties": { + "registered_tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/ContractInfo" + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "id_total_balance" + ], + "properties": { + "id_total_balance": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "returns balance of a specific token_id. Owners can give permission to other addresses to query their balance", + "type": "object", + "required": [ + "staker_info" + ], + "properties": { + "staker_info": { + "type": "object", + "required": [ + "total_rewards_earned" + ], + "properties": { + "last_claim_rewards_round": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "starting_round": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "total_rewards_earned": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "returns all token_id balances owned by an address. Only owners can use this query", + "type": "object", + "required": [ + "all_balances" + ], + "properties": { + "all_balances": { + "type": "array", + "items": { + "$ref": "#/definitions/OwnerBalance" + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "liquidity" + ], + "properties": { + "liquidity": { + "type": "array", + "items": { + "$ref": "#/definitions/Liquidity" + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_balance" + ], + "properties": { + "token_id_balance": { + "type": "object", + "properties": { + "total_supply": { + "anyOf": [ + { + "$ref": "#/definitions/Uint256" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transaction_history" + ], + "properties": { + "transaction_history": { + "type": "object", + "required": [ + "count", + "txns" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "txns": { + "type": "array", + "items": { + "$ref": "#/definitions/Tx" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "returned when an viewing_key-specific errors occur during a user's attempt to perform an authenticated query", + "type": "object", + "required": [ + "viewing_key_error" + ], + "properties": { + "viewing_key_error": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Contract": { + "description": "In the process of being deprecated for [cosmwasm_std::ContractInfo] so use that instead when possible.", + "type": "object", + "required": [ + "address", + "code_hash" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ContractInfo": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "code_hash": { + "default": "", + "type": "string" + } + } + }, + "Liquidity": { + "type": "object", + "required": [ + "token_id", + "total_liquidity", + "user_liquidity" + ], + "properties": { + "token_id": { + "type": "string" + }, + "total_liquidity": { + "$ref": "#/definitions/Uint256" + }, + "user_liquidity": { + "$ref": "#/definitions/Uint256" + } + }, + "additionalProperties": false + }, + "OwnerBalance": { + "type": "object", + "required": [ + "amount", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "token_id": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Reward": { + "type": "object", + "required": [ + "epoch_index", + "rewards" + ], + "properties": { + "epoch_index": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "rewards": { + "type": "array", + "items": { + "$ref": "#/definitions/RewardToken" + } + } + }, + "additionalProperties": false + }, + "RewardToken": { + "type": "object", + "required": [ + "amounts", + "ids", + "token", + "total_amount" + ], + "properties": { + "amounts": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint128" + } + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "token": { + "$ref": "#/definitions/ContractInfo" + }, + "total_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + }, + "RewardTokenInfo": { + "type": "object", + "required": [ + "claimed_rewards", + "decimals", + "end", + "reward_per_epoch", + "start", + "token", + "total_rewards" + ], + "properties": { + "claimed_rewards": { + "$ref": "#/definitions/Uint128" + }, + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "end": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "reward_per_epoch": { + "$ref": "#/definitions/Uint128" + }, + "start": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "token": { + "$ref": "#/definitions/ContractInfo" + }, + "total_rewards": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + }, + "RewardsDistribution": { + "type": "object", + "required": [ + "denominator", + "ids", + "weightages" + ], + "properties": { + "denominator": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "weightages": { + "type": "array", + "items": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + }, + "Tx": { + "description": "tx in storage", + "type": "object", + "required": [ + "action", + "block_height", + "block_time", + "tx_id" + ], + "properties": { + "action": { + "description": "tx type and specifics", + "allOf": [ + { + "$ref": "#/definitions/TxAction" + } + ] + }, + "block_height": { + "description": "the block containing this tx", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "block_time": { + "description": "the time (in seconds since 01/01/1970) of the block containing this tx", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "tx_id": { + "description": "tx id", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "TxAction": { + "description": "tx type and specifics for storage", + "oneOf": [ + { + "type": "object", + "required": [ + "stake" + ], + "properties": { + "stake": { + "type": "object", + "required": [ + "amounts", + "ids" + ], + "properties": { + "amounts": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint256" + } + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "un_stake" + ], + "properties": { + "un_stake": { + "type": "object", + "required": [ + "amounts", + "ids" + ], + "properties": { + "amounts": { + "type": "array", + "items": { + "$ref": "#/definitions/Uint256" + } + }, + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "claim_rewards" + ], + "properties": { + "claim_rewards": { + "type": "array", + "items": { + "$ref": "#/definitions/Reward" + } + } + }, + "additionalProperties": false + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_staking/schema/query_msg.json b/contracts/liquidity_book/lb_staking/schema/query_msg.json new file mode 100644 index 00000000..8c2f0e2d --- /dev/null +++ b/contracts/liquidity_book/lb_staking/schema/query_msg.json @@ -0,0 +1,403 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "Query messages to SNIP1155 contract. See [QueryAnswer](crate::msg::QueryAnswer) for the response messages for each variant, which has more detail.", + "oneOf": [ + { + "description": "returns public information of the SNIP1155 contract", + "type": "object", + "required": [ + "contract_info" + ], + "properties": { + "contract_info": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "epoch_info" + ], + "properties": { + "epoch_info": { + "type": "object", + "properties": { + "index": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "registered_tokens" + ], + "properties": { + "registered_tokens": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "id_total_balance" + ], + "properties": { + "id_total_balance": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "auth", + "token_id" + ], + "properties": { + "auth": { + "$ref": "#/definitions/Auth" + }, + "token_id": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "staker_info" + ], + "properties": { + "staker_info": { + "type": "object", + "required": [ + "auth" + ], + "properties": { + "auth": { + "$ref": "#/definitions/Auth" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_balances" + ], + "properties": { + "all_balances": { + "type": "object", + "required": [ + "auth" + ], + "properties": { + "auth": { + "$ref": "#/definitions/Auth" + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "liquidity" + ], + "properties": { + "liquidity": { + "type": "object", + "required": [ + "auth", + "token_ids" + ], + "properties": { + "auth": { + "$ref": "#/definitions/Auth" + }, + "round_index": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "token_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transaction_history" + ], + "properties": { + "transaction_history": { + "type": "object", + "required": [ + "auth", + "txn_type" + ], + "properties": { + "auth": { + "$ref": "#/definitions/Auth" + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "txn_type": { + "$ref": "#/definitions/QueryTxnType" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Auth": { + "oneOf": [ + { + "type": "object", + "required": [ + "viewing_key" + ], + "properties": { + "viewing_key": { + "type": "object", + "required": [ + "address", + "key" + ], + "properties": { + "address": { + "type": "string" + }, + "key": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "permit" + ], + "properties": { + "permit": { + "$ref": "#/definitions/Permit_for_PermitData" + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "PermitData": { + "type": "object", + "required": [ + "data", + "key" + ], + "properties": { + "data": { + "$ref": "#/definitions/Binary" + }, + "key": { + "type": "string" + } + }, + "additionalProperties": false + }, + "PermitSignature": { + "type": "object", + "required": [ + "pub_key", + "signature" + ], + "properties": { + "pub_key": { + "$ref": "#/definitions/PubKey" + }, + "signature": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, + "Permit_for_PermitData": { + "description": "Where the information will be stored", + "type": "object", + "required": [ + "params", + "signature" + ], + "properties": { + "account_number": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "chain_id": { + "type": [ + "string", + "null" + ] + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "params": { + "$ref": "#/definitions/PermitData" + }, + "sequence": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "signature": { + "$ref": "#/definitions/PermitSignature" + } + }, + "additionalProperties": false + }, + "PubKey": { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "description": "ignored, but must be \"tendermint/PubKeySecp256k1\" otherwise the verification will fail", + "type": "string" + }, + "value": { + "description": "Secp256k1 PubKey", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + }, + "additionalProperties": false + }, + "QueryTxnType": { + "type": "string", + "enum": [ + "all", + "stake", + "un_stake", + "claim_rewards" + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use secret_cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_staking/schema/schema.rs b/contracts/liquidity_book/lb_staking/src/bin/schema.rs similarity index 67% rename from contracts/liquidity_book/lb_staking/schema/schema.rs rename to contracts/liquidity_book/lb_staking/src/bin/schema.rs index c2818dec..d079beab 100644 --- a/contracts/liquidity_book/lb_staking/schema/schema.rs +++ b/contracts/liquidity_book/lb_staking/src/bin/schema.rs @@ -1,17 +1,15 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::{env::current_dir, fs::create_dir_all}; +use std::{env, fs::create_dir_all, path::PathBuf}; use shade_protocol::liquidity_book::lb_staking::{ - ExecuteMsg, - InstantiateMsg, - InvokeMsg, - QueryAnswer, - QueryMsg, + ExecuteMsg, InstantiateMsg, InvokeMsg, QueryAnswer, QueryMsg, }; fn main() { - let mut out_dir = current_dir().unwrap(); + // Get the directory of the current crate + let mut out_dir = env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(); out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); remove_schemas(&out_dir).unwrap(); diff --git a/contracts/liquidity_book/lb_token/Cargo.toml b/contracts/liquidity_book/lb_token/Cargo.toml index 4cdbda46..11c74251 100644 --- a/contracts/liquidity_book/lb_token/Cargo.toml +++ b/contracts/liquidity_book/lb_token/Cargo.toml @@ -8,26 +8,22 @@ exclude = ["contract.wasm", "hash.txt"] [lib] crate-type = ["cdylib", "rlib"] -[[example]] +[[bin]] name = "schema" -path = "schema/schema.rs" +path = "src/bin/schema.rs" [features] -default = ["schema"] -schema = [] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] [dependencies] -shade-protocol = { path = "../../../packages/shade_protocol" } +shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] } lb-libraries = { path = "../../../packages/lb_libraries" } +cosmwasm-schema = "2.0.3" cosmwasm-std = { package = "secret-cosmwasm-std", version = "=1.1.11" } cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "=1.1.11" } -serde = { version = "1.0.158", default-features = false, features = ["derive"] } -schemars = "0.8.12" +serde = { version = "1.0.203", default-features = false, features = ["derive"] } +schemars = "0.8.21" #snafu = { version = "0.6.3" } #base64 = "0.21.2" @@ -36,6 +32,5 @@ schemars = "0.8.12" [dev-dependencies] -cosmwasm-schema = "2.0.3" serde_json = "1.0.117" secret-toolkit = { version = "0.10.0", default-features = false, features = ["crypto"] } diff --git a/contracts/liquidity_book/lb_token/schema/execute_msg.json b/contracts/liquidity_book/lb_token/schema/execute_msg.json new file mode 100644 index 00000000..9534ae17 --- /dev/null +++ b/contracts/liquidity_book/lb_token/schema/execute_msg.json @@ -0,0 +1,973 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "description": "Handle messages to SNIP1155 contract.\n\nMostly responds with `HandleAnswer { : { status: success }}` if successful. See [HandleAnswer](crate::msg::HandleAnswer) for the response messages for each variant.", + "oneOf": [ + { + "description": "mints additional tokens of existing fungible token_ids, if configuration allows this, ie `enable_mint == true`. Only minters can access this function", + "type": "object", + "required": [ + "mint_tokens" + ], + "properties": { + "mint_tokens": { + "type": "object", + "required": [ + "mint_tokens" + ], + "properties": { + "memo": { + "type": [ + "string", + "null" + ] + }, + "mint_tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/TokenAmount" + } + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "burns existing tokens, if configuration allows this, ie `enable_burn == true`. Only owners can burn their own tokens in the base specifications. Flexibility is built into the contract functions to allow other addresses to burn tokens, allowed in additional specifications.", + "type": "object", + "required": [ + "burn_tokens" + ], + "properties": { + "burn_tokens": { + "type": "object", + "required": [ + "burn_tokens" + ], + "properties": { + "burn_tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/TokenAmount" + } + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "allows owner or minter to change metadata if allowed by token_id configuration.", + "type": "object", + "required": [ + "change_metadata" + ], + "properties": { + "change_metadata": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "private_metadata": { + "description": "does not attempt to change if left blank. Can effectively remove metadata by setting metadata to `Some(Metadata {token_uri: None, extension: None})` used Box to reduce the total size of the enum variant, to decrease size difference between variants. Not strictly necessary.", + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "public_metadata": { + "description": "does not attempt to change if left blank. Can effectively remove metadata by setting metadata to `Some(Metadata {token_uri: None, extension: None})` used Box to reduce the total size of the enum variant, to decrease size difference between variants. Not strictly necessary.", + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "transfers one or more tokens of a single token_id. Other third address can perform this function if it has permission to transfer. ie: if addr3 can call this function to transfer tokens from addr0 to addr2, if addr0 gives addr3 enough transfer allowance.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "from", + "recipient", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "from": { + "$ref": "#/definitions/Addr" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "recipient": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "performs `transfer`s of multiple token_ids in a single transaction", + "type": "object", + "required": [ + "batch_transfer" + ], + "properties": { + "batch_transfer": { + "type": "object", + "required": [ + "actions" + ], + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/TransferAction" + } + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "similar to transfer, but also sends a cosmos message. The recipient needs to be a contract that has a SNIP1155Receive handle function. See [receiver](crate::receiver) for more information.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "from", + "recipient", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "from": { + "$ref": "#/definitions/Addr" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "recipient": { + "$ref": "#/definitions/Addr" + }, + "recipient_code_hash": { + "type": [ + "string", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "performs `send` of multiple token_ids in a single transaction", + "type": "object", + "required": [ + "batch_send" + ], + "properties": { + "batch_send": { + "type": "object", + "required": [ + "actions" + ], + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/SendAction" + } + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "allows an owner of token_ids to change transfer or viewership permissions to other addresses.\n\nThe base specification has three types of permissions: * view balance permission: owner can allow another address to view owner's balance of specific token_ids * view private metadata: owner can allow another address to view private metadata of specific token_ids * transfer allowance: owner can give permission to another address to transfer tokens up to a certain limit (cumulatively) Owners can set an [expiry](crate::state::expiration) for each of these permissions.\n\nSNIP1155 gives flexibility for permissions to have any combination of * type of permission granted * on which token_ids", + "type": "object", + "required": [ + "give_permission" + ], + "properties": { + "give_permission": { + "type": "object", + "required": [ + "allowed_address", + "token_id" + ], + "properties": { + "allowed_address": { + "description": "address being granted/revoked permission", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "padding": { + "description": "optional message length padding", + "type": [ + "string", + "null" + ] + }, + "token_id": { + "description": "token id to apply approval/revocation to. Additional Spec feature: if == None, perform action for all owner's `token_id`s", + "type": "string" + }, + "transfer": { + "description": "set allowance by for transfer approvals. If ignored, leaves current permission settings", + "anyOf": [ + { + "$ref": "#/definitions/Uint256" + }, + { + "type": "null" + } + ] + }, + "transfer_expiry": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "view_balance": { + "description": "optional permission level for viewing balance. If ignored, leaves current permission settings", + "type": [ + "boolean", + "null" + ] + }, + "view_balance_expiry": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "view_private_metadata": { + "description": "optional permission level for viewing private metadata. If ignored, leaves current permission settings", + "type": [ + "boolean", + "null" + ] + }, + "view_private_metadata_expiry": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Removes all permissions that a specific owner has granted to a specific address, for a specific token_id. A permission grantee can use this function to renounce a permission it has been given. For owners, the `GivePermission` message can be used instead to have the same effect as `RevokePermission`.", + "type": "object", + "required": [ + "revoke_permission" + ], + "properties": { + "revoke_permission": { + "type": "object", + "required": [ + "allowed_address", + "owner", + "token_id" + ], + "properties": { + "allowed_address": { + "description": "address which has permission", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "owner": { + "description": "token owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "padding": { + "type": [ + "string", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "create_viewing_key" + ], + "properties": { + "create_viewing_key": { + "type": "object", + "required": [ + "entropy" + ], + "properties": { + "entropy": { + "type": "string" + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_viewing_key" + ], + "properties": { + "set_viewing_key": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string" + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "disallow the use of a query permit", + "type": "object", + "required": [ + "revoke_permit" + ], + "properties": { + "revoke_permit": { + "type": "object", + "required": [ + "permit_name" + ], + "properties": { + "padding": { + "type": [ + "string", + "null" + ] + }, + "permit_name": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "change_admin" + ], + "properties": { + "change_admin": { + "type": "object", + "required": [ + "new_admin" + ], + "properties": { + "new_admin": { + "$ref": "#/definitions/Addr" + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Permanently breaks admin keys for this contract. No admin function can be called after this action. Any existing curators or minters will remain as curators or minters; no new curators can be added and no current curator can be removed.\n\nRequires caller to input current admin address and contract address. These inputs are not strictly necessary, but as a safety precaution to reduce the chances of accidentally calling this function.", + "type": "object", + "required": [ + "remove_admin" + ], + "properties": { + "remove_admin": { + "type": "object", + "required": [ + "contract_address", + "current_admin" + ], + "properties": { + "contract_address": { + "$ref": "#/definitions/Addr" + }, + "current_admin": { + "$ref": "#/definitions/Addr" + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "register_receive" + ], + "properties": { + "register_receive": { + "type": "object", + "required": [ + "code_hash" + ], + "properties": { + "code_hash": { + "type": "string" + }, + "padding": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Authentication": { + "description": "media file authentication", + "type": "object", + "properties": { + "key": { + "description": "either a decryption key for encrypted files or a password for basic authentication", + "type": [ + "string", + "null" + ] + }, + "user": { + "description": "username used in basic authentication", + "type": [ + "string", + "null" + ] + } + } + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "Expiration": { + "description": "at the given point in time and after, Expiration will be considered expired", + "oneOf": [ + { + "description": "expires at this block height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "expires at the time in seconds since 01/01/1970", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "never expires", + "type": "string", + "enum": [ + "never" + ] + } + ] + }, + "Extension": { + "description": "metadata extension You can add any metadata fields you need here. These fields are based on and are the metadata fields that Stashh uses for robust NFT display. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "object", + "properties": { + "animation_url": { + "description": "url to a multimedia attachment", + "type": [ + "string", + "null" + ] + }, + "attributes": { + "description": "item attributes", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Trait" + } + }, + "background_color": { + "description": "background color represented as a six-character hexadecimal without a pre-pended #", + "type": [ + "string", + "null" + ] + }, + "description": { + "description": "item description", + "type": [ + "string", + "null" + ] + }, + "external_url": { + "description": "url to allow users to view the item on your site", + "type": [ + "string", + "null" + ] + }, + "image": { + "description": "url to the image", + "type": [ + "string", + "null" + ] + }, + "image_data": { + "description": "raw SVG image data (not recommended). Only use this if you're not including the image parameter", + "type": [ + "string", + "null" + ] + }, + "media": { + "description": "media files as specified on Stashh that allows for basic authenticatiion and decryption keys. Most of the above is used for bridging public eth NFT metadata easily, whereas `media` will be used when minting NFTs on Stashh", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/MediaFile" + } + }, + "name": { + "description": "name of the item", + "type": [ + "string", + "null" + ] + }, + "protected_attributes": { + "description": "a select list of trait_types that are in the private metadata. This will only ever be used in public metadata", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "token_subtype": { + "description": "token subtypes used by Stashh for display groupings (primarily used for badges)", + "type": [ + "string", + "null" + ] + }, + "youtube_url": { + "description": "url to a YouTube video", + "type": [ + "string", + "null" + ] + } + } + }, + "MediaFile": { + "description": "media file", + "type": "object", + "required": [ + "url" + ], + "properties": { + "authentication": { + "description": "authentication information", + "anyOf": [ + { + "$ref": "#/definitions/Authentication" + }, + { + "type": "null" + } + ] + }, + "extension": { + "description": "file extension", + "type": [ + "string", + "null" + ] + }, + "file_type": { + "description": "file type Stashh currently uses: \"image\", \"video\", \"audio\", \"text\", \"font\", \"application\"", + "type": [ + "string", + "null" + ] + }, + "url": { + "description": "url to the file. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "string" + } + } + }, + "Metadata": { + "description": "token metadata", + "type": "object", + "properties": { + "extension": { + "description": "optional on-chain metadata. Only use this if you are not using `token_uri`", + "anyOf": [ + { + "$ref": "#/definitions/Extension" + }, + { + "type": "null" + } + ] + }, + "token_uri": { + "description": "optional uri for off-chain metadata. This should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`. Only use this if you are not using `extension`", + "type": [ + "string", + "null" + ] + } + } + }, + "SendAction": { + "type": "object", + "required": [ + "amount", + "from", + "recipient", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "from": { + "$ref": "#/definitions/Addr" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "msg": { + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "recipient": { + "$ref": "#/definitions/Addr" + }, + "recipient_code_hash": { + "type": [ + "string", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + }, + "TokenAmount": { + "description": "used for MintToken and BurnToken in the base specifications", + "type": "object", + "required": [ + "balances", + "token_id" + ], + "properties": { + "balances": { + "description": "For BurnToken, only `Balance.amount` is relevant. `Balance.address` need to be the owner's address. This design decision is to allow `BurnToken` to apply to other addresses, possible in the additional specifications", + "type": "array", + "items": { + "$ref": "#/definitions/TokenIdBalance" + } + }, + "token_id": { + "type": "string" + } + } + }, + "TokenIdBalance": { + "type": "object", + "required": [ + "address", + "amount" + ], + "properties": { + "address": { + "description": "For BurnToken, `address` needs to be the owner's address. This design decision is to allow `BurnToken` to apply to other addresses, possible in the additional specifications", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "amount": { + "$ref": "#/definitions/Uint256" + } + } + }, + "Trait": { + "description": "attribute trait", + "type": "object", + "required": [ + "value" + ], + "properties": { + "display_type": { + "description": "indicates how a trait should be displayed", + "type": [ + "string", + "null" + ] + }, + "max_value": { + "description": "optional max value for numerical traits", + "type": [ + "string", + "null" + ] + }, + "trait_type": { + "description": "name of the trait", + "type": [ + "string", + "null" + ] + }, + "value": { + "description": "trait value", + "type": "string" + } + } + }, + "TransferAction": { + "type": "object", + "required": [ + "amount", + "from", + "recipient", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "from": { + "$ref": "#/definitions/Addr" + }, + "memo": { + "type": [ + "string", + "null" + ] + }, + "recipient": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_token/schema/instantiate_msg.json b/contracts/liquidity_book/lb_token/schema/instantiate_msg.json new file mode 100644 index 00000000..e50feba0 --- /dev/null +++ b/contracts/liquidity_book/lb_token/schema/instantiate_msg.json @@ -0,0 +1,474 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "curators", + "entropy", + "has_admin", + "initial_tokens", + "lb_pair_info" + ], + "properties": { + "admin": { + "description": "if `admin` == `None` && `has_admin` == `true`, the instantiator will be admin if `has_admin` == `false`, this field will be ignore (ie: there will be no admin)", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "curators": { + "description": "sets initial list of curators, which can create new token_ids", + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "entropy": { + "description": "for `create_viewing_key` function", + "type": "string" + }, + "has_admin": { + "description": "if `false` the contract will instantiate permanently as a no-admin (permissionless) contract", + "type": "boolean" + }, + "initial_tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/CurateTokenId" + } + }, + "lb_pair_info": { + "$ref": "#/definitions/LbPair" + } + }, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Authentication": { + "description": "media file authentication", + "type": "object", + "properties": { + "key": { + "description": "either a decryption key for encrypted files or a password for basic authentication", + "type": [ + "string", + "null" + ] + }, + "user": { + "description": "username used in basic authentication", + "type": [ + "string", + "null" + ] + } + } + }, + "CurateTokenId": { + "type": "object", + "required": [ + "balances", + "token_info" + ], + "properties": { + "balances": { + "type": "array", + "items": { + "$ref": "#/definitions/TokenIdBalance" + } + }, + "token_info": { + "$ref": "#/definitions/TokenInfoMsg" + } + } + }, + "Extension": { + "description": "metadata extension You can add any metadata fields you need here. These fields are based on and are the metadata fields that Stashh uses for robust NFT display. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "object", + "properties": { + "animation_url": { + "description": "url to a multimedia attachment", + "type": [ + "string", + "null" + ] + }, + "attributes": { + "description": "item attributes", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Trait" + } + }, + "background_color": { + "description": "background color represented as a six-character hexadecimal without a pre-pended #", + "type": [ + "string", + "null" + ] + }, + "description": { + "description": "item description", + "type": [ + "string", + "null" + ] + }, + "external_url": { + "description": "url to allow users to view the item on your site", + "type": [ + "string", + "null" + ] + }, + "image": { + "description": "url to the image", + "type": [ + "string", + "null" + ] + }, + "image_data": { + "description": "raw SVG image data (not recommended). Only use this if you're not including the image parameter", + "type": [ + "string", + "null" + ] + }, + "media": { + "description": "media files as specified on Stashh that allows for basic authenticatiion and decryption keys. Most of the above is used for bridging public eth NFT metadata easily, whereas `media` will be used when minting NFTs on Stashh", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/MediaFile" + } + }, + "name": { + "description": "name of the item", + "type": [ + "string", + "null" + ] + }, + "protected_attributes": { + "description": "a select list of trait_types that are in the private metadata. This will only ever be used in public metadata", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "token_subtype": { + "description": "token subtypes used by Stashh for display groupings (primarily used for badges)", + "type": [ + "string", + "null" + ] + }, + "youtube_url": { + "description": "url to a YouTube video", + "type": [ + "string", + "null" + ] + } + } + }, + "LbPair": { + "description": "message sent my instantiator and curators for a specific `token_id`'s token info", + "type": "object", + "required": [ + "decimals", + "lb_pair_address", + "name", + "symbol" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "lb_pair_address": { + "$ref": "#/definitions/Addr" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + } + }, + "MediaFile": { + "description": "media file", + "type": "object", + "required": [ + "url" + ], + "properties": { + "authentication": { + "description": "authentication information", + "anyOf": [ + { + "$ref": "#/definitions/Authentication" + }, + { + "type": "null" + } + ] + }, + "extension": { + "description": "file extension", + "type": [ + "string", + "null" + ] + }, + "file_type": { + "description": "file type Stashh currently uses: \"image\", \"video\", \"audio\", \"text\", \"font\", \"application\"", + "type": [ + "string", + "null" + ] + }, + "url": { + "description": "url to the file. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "string" + } + } + }, + "Metadata": { + "description": "token metadata", + "type": "object", + "properties": { + "extension": { + "description": "optional on-chain metadata. Only use this if you are not using `token_uri`", + "anyOf": [ + { + "$ref": "#/definitions/Extension" + }, + { + "type": "null" + } + ] + }, + "token_uri": { + "description": "optional uri for off-chain metadata. This should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`. Only use this if you are not using `extension`", + "type": [ + "string", + "null" + ] + } + } + }, + "TknConfig": { + "oneOf": [ + { + "type": "object", + "required": [ + "fungible" + ], + "properties": { + "fungible": { + "type": "object", + "required": [ + "decimals", + "enable_burn", + "enable_mint", + "minter_may_update_metadata", + "minters", + "public_total_supply" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "enable_burn": { + "type": "boolean" + }, + "enable_mint": { + "type": "boolean" + }, + "minter_may_update_metadata": { + "type": "boolean" + }, + "minters": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "public_total_supply": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "nft" + ], + "properties": { + "nft": { + "type": "object", + "required": [ + "enable_burn", + "minter_may_update_metadata", + "minters", + "owner_is_public", + "owner_may_update_metadata", + "public_total_supply" + ], + "properties": { + "enable_burn": { + "type": "boolean" + }, + "minter_may_update_metadata": { + "type": "boolean" + }, + "minters": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "owner_is_public": { + "type": "boolean" + }, + "owner_may_update_metadata": { + "type": "boolean" + }, + "public_total_supply": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "TokenIdBalance": { + "type": "object", + "required": [ + "address", + "amount" + ], + "properties": { + "address": { + "description": "For BurnToken, `address` needs to be the owner's address. This design decision is to allow `BurnToken` to apply to other addresses, possible in the additional specifications", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "amount": { + "$ref": "#/definitions/Uint256" + } + } + }, + "TokenInfoMsg": { + "description": "message sent my instantiator and curators for a specific `token_id`'s token info", + "type": "object", + "required": [ + "name", + "symbol", + "token_config", + "token_id" + ], + "properties": { + "name": { + "type": "string" + }, + "private_metadata": { + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "public_metadata": { + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "symbol": { + "type": "string" + }, + "token_config": { + "$ref": "#/definitions/TknConfig" + }, + "token_id": { + "type": "string" + } + } + }, + "Trait": { + "description": "attribute trait", + "type": "object", + "required": [ + "value" + ], + "properties": { + "display_type": { + "description": "indicates how a trait should be displayed", + "type": [ + "string", + "null" + ] + }, + "max_value": { + "description": "optional max value for numerical traits", + "type": [ + "string", + "null" + ] + }, + "trait_type": { + "description": "name of the trait", + "type": [ + "string", + "null" + ] + }, + "value": { + "description": "trait value", + "type": "string" + } + } + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_token/schema/query_answer.json b/contracts/liquidity_book/lb_token/schema/query_answer.json new file mode 100644 index 00000000..b79f293e --- /dev/null +++ b/contracts/liquidity_book/lb_token/schema/query_answer.json @@ -0,0 +1,968 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryAnswer", + "description": "the query responses for each [QueryMsg](crate::msg::QueryMsg) variant", + "oneOf": [ + { + "description": "returns contract-level information:", + "type": "object", + "required": [ + "token_contract_info" + ], + "properties": { + "token_contract_info": { + "type": "object", + "required": [ + "all_token_ids", + "curators" + ], + "properties": { + "admin": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "all_token_ids": { + "description": "the list of all token_ids that have been curated", + "type": "array", + "items": { + "type": "string" + } + }, + "curators": { + "description": "the list of curators in the contract", + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "id_total_balance" + ], + "properties": { + "id_total_balance": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "returns balance of a specific token_id. Owners can give permission to other addresses to query their balance", + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "returns all token_id balances owned by an address. Only owners can use this query", + "type": "object", + "required": [ + "all_balances" + ], + "properties": { + "all_balances": { + "type": "array", + "items": { + "$ref": "#/definitions/OwnerBalance" + } + } + }, + "additionalProperties": false + }, + { + "description": "all permissions related to a particular address. Note that \"curation\" is not recorded as a transaction per se, but the tokens minted as part of the initial_balances set by the curator is recorded under `TxAction::Mint`", + "type": "object", + "required": [ + "transaction_history" + ], + "properties": { + "transaction_history": { + "type": "object", + "required": [ + "total", + "txs" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "txs": { + "type": "array", + "items": { + "$ref": "#/definitions/Tx" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "permission" + ], + "properties": { + "permission": { + "anyOf": [ + { + "$ref": "#/definitions/Permission" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + { + "description": "all permissions granted, viewable by the permission granter. Users or applications can match the permission_keys that corresponds to each permission as they have a similar order, ie: the index of `permission_keys` vector corresponds to the index of the `permissions` vector.", + "type": "object", + "required": [ + "all_permissions" + ], + "properties": { + "all_permissions": { + "type": "object", + "required": [ + "permission_keys", + "permissions", + "total" + ], + "properties": { + "permission_keys": { + "type": "array", + "items": { + "$ref": "#/definitions/PermissionKey" + } + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + }, + "total": { + "description": "the total number of permission entries stored for a given granter, which may include \"blank\" permissions, ie: where all permissions are set to `false` or `Uint256(0)`", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_public_info" + ], + "properties": { + "token_id_public_info": { + "type": "object", + "required": [ + "token_id_info" + ], + "properties": { + "owner": { + "description": "if owner_is_public == false, total_supply = None", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "token_id_info": { + "description": "token_id_info.private_metadata will always = None", + "allOf": [ + { + "$ref": "#/definitions/StoredTokenInfo" + } + ] + }, + "total_supply": { + "description": "if public_total_supply == false, total_supply = None", + "anyOf": [ + { + "$ref": "#/definitions/Uint256" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_private_info" + ], + "properties": { + "token_id_private_info": { + "type": "object", + "required": [ + "token_id_info" + ], + "properties": { + "owner": { + "description": "if owner_is_public == false, total_supply = None", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "token_id_info": { + "$ref": "#/definitions/StoredTokenInfo" + }, + "total_supply": { + "description": "if public_total_supply == false, total_supply = None", + "anyOf": [ + { + "$ref": "#/definitions/Uint256" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "returns None if contract has not registered with SNIP1155 contract", + "type": "object", + "required": [ + "registered_code_hash" + ], + "properties": { + "registered_code_hash": { + "type": "object", + "properties": { + "code_hash": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "description": "returned when an viewing_key-specific errors occur during a user's attempt to perform an authenticated query", + "type": "object", + "required": [ + "viewing_key_error" + ], + "properties": { + "viewing_key_error": { + "type": "object", + "required": [ + "msg" + ], + "properties": { + "msg": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Authentication": { + "description": "media file authentication", + "type": "object", + "properties": { + "key": { + "description": "either a decryption key for encrypted files or a password for basic authentication", + "type": [ + "string", + "null" + ] + }, + "user": { + "description": "username used in basic authentication", + "type": [ + "string", + "null" + ] + } + } + }, + "Expiration": { + "description": "at the given point in time and after, Expiration will be considered expired", + "oneOf": [ + { + "description": "expires at this block height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "expires at the time in seconds since 01/01/1970", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "never expires", + "type": "string", + "enum": [ + "never" + ] + } + ] + }, + "Extension": { + "description": "metadata extension You can add any metadata fields you need here. These fields are based on and are the metadata fields that Stashh uses for robust NFT display. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "object", + "properties": { + "animation_url": { + "description": "url to a multimedia attachment", + "type": [ + "string", + "null" + ] + }, + "attributes": { + "description": "item attributes", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Trait" + } + }, + "background_color": { + "description": "background color represented as a six-character hexadecimal without a pre-pended #", + "type": [ + "string", + "null" + ] + }, + "description": { + "description": "item description", + "type": [ + "string", + "null" + ] + }, + "external_url": { + "description": "url to allow users to view the item on your site", + "type": [ + "string", + "null" + ] + }, + "image": { + "description": "url to the image", + "type": [ + "string", + "null" + ] + }, + "image_data": { + "description": "raw SVG image data (not recommended). Only use this if you're not including the image parameter", + "type": [ + "string", + "null" + ] + }, + "media": { + "description": "media files as specified on Stashh that allows for basic authenticatiion and decryption keys. Most of the above is used for bridging public eth NFT metadata easily, whereas `media` will be used when minting NFTs on Stashh", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/MediaFile" + } + }, + "name": { + "description": "name of the item", + "type": [ + "string", + "null" + ] + }, + "protected_attributes": { + "description": "a select list of trait_types that are in the private metadata. This will only ever be used in public metadata", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "token_subtype": { + "description": "token subtypes used by Stashh for display groupings (primarily used for badges)", + "type": [ + "string", + "null" + ] + }, + "youtube_url": { + "description": "url to a YouTube video", + "type": [ + "string", + "null" + ] + } + } + }, + "MediaFile": { + "description": "media file", + "type": "object", + "required": [ + "url" + ], + "properties": { + "authentication": { + "description": "authentication information", + "anyOf": [ + { + "$ref": "#/definitions/Authentication" + }, + { + "type": "null" + } + ] + }, + "extension": { + "description": "file extension", + "type": [ + "string", + "null" + ] + }, + "file_type": { + "description": "file type Stashh currently uses: \"image\", \"video\", \"audio\", \"text\", \"font\", \"application\"", + "type": [ + "string", + "null" + ] + }, + "url": { + "description": "url to the file. Urls should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`", + "type": "string" + } + } + }, + "Metadata": { + "description": "token metadata", + "type": "object", + "properties": { + "extension": { + "description": "optional on-chain metadata. Only use this if you are not using `token_uri`", + "anyOf": [ + { + "$ref": "#/definitions/Extension" + }, + { + "type": "null" + } + ] + }, + "token_uri": { + "description": "optional uri for off-chain metadata. This should be prefixed with `http://`, `https://`, `ipfs://`, or `ar://`. Only use this if you are not using `extension`", + "type": [ + "string", + "null" + ] + } + } + }, + "OwnerBalance": { + "type": "object", + "required": [ + "amount", + "token_id" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "token_id": { + "type": "string" + } + } + }, + "Permission": { + "description": "struct to store permission for a `[token_id, owner, allowed_addr]` combination", + "type": "object", + "required": [ + "trfer_allowance_exp", + "trfer_allowance_perm", + "view_balance_exp", + "view_balance_perm", + "view_pr_metadata_exp", + "view_pr_metadata_perm" + ], + "properties": { + "trfer_allowance_exp": { + "$ref": "#/definitions/Expiration" + }, + "trfer_allowance_perm": { + "$ref": "#/definitions/Uint256" + }, + "view_balance_exp": { + "$ref": "#/definitions/Expiration" + }, + "view_balance_perm": { + "type": "boolean" + }, + "view_pr_metadata_exp": { + "$ref": "#/definitions/Expiration" + }, + "view_pr_metadata_perm": { + "type": "boolean" + } + } + }, + "PermissionKey": { + "description": "to store all keys to access all permissions for a given `owner`", + "type": "object", + "required": [ + "allowed_addr", + "token_id" + ], + "properties": { + "allowed_addr": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + }, + "StoredTokenInfo": { + "description": "information for a specific `token_id`", + "type": "object", + "required": [ + "curator", + "name", + "symbol", + "token_config", + "token_id" + ], + "properties": { + "curator": { + "$ref": "#/definitions/Addr" + }, + "name": { + "type": "string" + }, + "private_metadata": { + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "public_metadata": { + "anyOf": [ + { + "$ref": "#/definitions/Metadata" + }, + { + "type": "null" + } + ] + }, + "symbol": { + "type": "string" + }, + "token_config": { + "$ref": "#/definitions/TknConfig" + }, + "token_id": { + "type": "string" + } + } + }, + "TknConfig": { + "oneOf": [ + { + "type": "object", + "required": [ + "fungible" + ], + "properties": { + "fungible": { + "type": "object", + "required": [ + "decimals", + "enable_burn", + "enable_mint", + "minter_may_update_metadata", + "minters", + "public_total_supply" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "enable_burn": { + "type": "boolean" + }, + "enable_mint": { + "type": "boolean" + }, + "minter_may_update_metadata": { + "type": "boolean" + }, + "minters": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "public_total_supply": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "nft" + ], + "properties": { + "nft": { + "type": "object", + "required": [ + "enable_burn", + "minter_may_update_metadata", + "minters", + "owner_is_public", + "owner_may_update_metadata", + "public_total_supply" + ], + "properties": { + "enable_burn": { + "type": "boolean" + }, + "minter_may_update_metadata": { + "type": "boolean" + }, + "minters": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + }, + "owner_is_public": { + "type": "boolean" + }, + "owner_may_update_metadata": { + "type": "boolean" + }, + "public_total_supply": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Trait": { + "description": "attribute trait", + "type": "object", + "required": [ + "value" + ], + "properties": { + "display_type": { + "description": "indicates how a trait should be displayed", + "type": [ + "string", + "null" + ] + }, + "max_value": { + "description": "optional max value for numerical traits", + "type": [ + "string", + "null" + ] + }, + "trait_type": { + "description": "name of the trait", + "type": [ + "string", + "null" + ] + }, + "value": { + "description": "trait value", + "type": "string" + } + } + }, + "Tx": { + "description": "tx in storage", + "type": "object", + "required": [ + "action", + "block_height", + "block_time", + "token_id", + "tx_id" + ], + "properties": { + "action": { + "description": "tx type and specifics", + "allOf": [ + { + "$ref": "#/definitions/TxAction" + } + ] + }, + "block_height": { + "description": "the block containing this tx", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "block_time": { + "description": "the time (in seconds since 01/01/1970) of the block containing this tx", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "memo": { + "description": "optional memo", + "type": [ + "string", + "null" + ] + }, + "token_id": { + "description": "token id", + "type": "string" + }, + "tx_id": { + "description": "tx id", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "TxAction": { + "description": "tx type and specifics for storage with Addr", + "oneOf": [ + { + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "type": "object", + "required": [ + "amount", + "minter", + "recipient" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "minter": { + "$ref": "#/definitions/Addr" + }, + "recipient": { + "$ref": "#/definitions/Addr" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint256" + }, + "burner": { + "description": "in the base specification, the burner MUST be the owner. In the additional specifications, it is OPTIONAL to allow other addresses to burn tokens.", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "owner": { + "$ref": "#/definitions/Addr" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "`transfer` or `send` txs", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "from", + "recipient" + ], + "properties": { + "amount": { + "description": "amount of tokens transferred", + "allOf": [ + { + "$ref": "#/definitions/Uint256" + } + ] + }, + "from": { + "description": "previous owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "recipient": { + "description": "new owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "sender": { + "description": "optional sender if not owner", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Uint256": { + "description": "An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances out of primitive uint types or `new` to provide big endian bytes:\n\n``` # use secret_cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```", + "type": "string" + } + } +} diff --git a/contracts/liquidity_book/lb_token/schema/query_msg.json b/contracts/liquidity_book/lb_token/schema/query_msg.json new file mode 100644 index 00000000..8fdd50a4 --- /dev/null +++ b/contracts/liquidity_book/lb_token/schema/query_msg.json @@ -0,0 +1,606 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "Query messages to SNIP1155 contract. See [QueryAnswer](crate::msg::QueryAnswer) for the response messages for each variant, which has more detail.", + "oneOf": [ + { + "description": "returns public information of the SNIP1155 contract", + "type": "object", + "required": [ + "contract_info" + ], + "properties": { + "contract_info": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "id_total_balance" + ], + "properties": { + "id_total_balance": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "key", + "owner", + "token_id", + "viewer" + ], + "properties": { + "key": { + "type": "string" + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + }, + "viewer": { + "$ref": "#/definitions/Addr" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_balances" + ], + "properties": { + "all_balances": { + "type": "object", + "required": [ + "key", + "owner" + ], + "properties": { + "key": { + "type": "string" + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "tx_history_page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "tx_history_page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transaction_history" + ], + "properties": { + "transaction_history": { + "type": "object", + "required": [ + "address", + "key", + "page_size" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "key": { + "type": "string" + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "permission" + ], + "properties": { + "permission": { + "type": "object", + "required": [ + "allowed_address", + "key", + "owner", + "token_id" + ], + "properties": { + "allowed_address": { + "$ref": "#/definitions/Addr" + }, + "key": { + "type": "string" + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "displays all permissions that a given address has granted", + "type": "object", + "required": [ + "all_permissions" + ], + "properties": { + "all_permissions": { + "type": "object", + "required": [ + "address", + "key", + "page_size" + ], + "properties": { + "address": { + "description": "address that has granted permissions to others", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "key": { + "type": "string" + }, + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_public_info" + ], + "properties": { + "token_id_public_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_private_info" + ], + "properties": { + "token_id_private_info": { + "type": "object", + "required": [ + "address", + "key", + "token_id" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "key": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "registered_code_hash" + ], + "properties": { + "registered_code_hash": { + "type": "object", + "required": [ + "contract" + ], + "properties": { + "contract": { + "$ref": "#/definitions/Addr" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "with_permit" + ], + "properties": { + "with_permit": { + "type": "object", + "required": [ + "permit", + "query" + ], + "properties": { + "permit": { + "$ref": "#/definitions/Permit_for_TokenPermissions" + }, + "query": { + "$ref": "#/definitions/QueryWithPermit" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "PermitParams_for_TokenPermissions": { + "type": "object", + "required": [ + "allowed_tokens", + "chain_id", + "permissions", + "permit_name" + ], + "properties": { + "allowed_tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "chain_id": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/TokenPermissions" + } + }, + "permit_name": { + "type": "string" + } + } + }, + "PermitSignature": { + "type": "object", + "required": [ + "pub_key", + "signature" + ], + "properties": { + "pub_key": { + "$ref": "#/definitions/PubKey" + }, + "signature": { + "$ref": "#/definitions/Binary" + } + } + }, + "Permit_for_TokenPermissions": { + "type": "object", + "required": [ + "params", + "signature" + ], + "properties": { + "params": { + "$ref": "#/definitions/PermitParams_for_TokenPermissions" + }, + "signature": { + "$ref": "#/definitions/PermitSignature" + } + } + }, + "PubKey": { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "description": "ignored, but must be \"tendermint/PubKeySecp256k1\" otherwise the verification will fail", + "type": "string" + }, + "value": { + "description": "Secp256k1 PubKey", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + } + }, + "QueryWithPermit": { + "oneOf": [ + { + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "owner", + "token_id" + ], + "properties": { + "owner": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_balances" + ], + "properties": { + "all_balances": { + "type": "object", + "properties": { + "tx_history_page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "tx_history_page_size": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transaction_history" + ], + "properties": { + "transaction_history": { + "type": "object", + "required": [ + "page_size" + ], + "properties": { + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "permission" + ], + "properties": { + "permission": { + "type": "object", + "required": [ + "allowed_address", + "owner", + "token_id" + ], + "properties": { + "allowed_address": { + "$ref": "#/definitions/Addr" + }, + "owner": { + "$ref": "#/definitions/Addr" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_permissions" + ], + "properties": { + "all_permissions": { + "type": "object", + "required": [ + "page_size" + ], + "properties": { + "page": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "page_size": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "token_id_private_info" + ], + "properties": { + "token_id_private_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "TokenPermissions": { + "oneOf": [ + { + "description": "Allowance for SNIP-20 - Permission to query allowance of the owner & spender", + "type": "string", + "enum": [ + "allowance" + ] + }, + { + "description": "Balance for SNIP-20 - Permission to query balance", + "type": "string", + "enum": [ + "balance" + ] + }, + { + "description": "History for SNIP-20 - Permission to query transfer_history & transaction_hisotry", + "type": "string", + "enum": [ + "history" + ] + }, + { + "description": "Owner permission indicates that the bearer of this permit should be granted all the access of the creator/signer of the permit. SNIP-721 uses this to grant viewing access to all data that the permit creator owns and is whitelisted for. For SNIP-721 use, a permit with Owner permission should NEVER be given to anyone else. If someone wants to share private data, they should whitelist the address they want to share with via a SetWhitelistedApproval tx, and that address will view the data by creating their own permit with Owner permission", + "type": "string", + "enum": [ + "owner" + ] + } + ] + } + } +} diff --git a/contracts/liquidity_book/lb_token/schema/schema.rs b/contracts/liquidity_book/lb_token/src/bin/schema.rs similarity index 73% rename from contracts/liquidity_book/lb_token/schema/schema.rs rename to contracts/liquidity_book/lb_token/src/bin/schema.rs index 62110e88..4a6bc990 100644 --- a/contracts/liquidity_book/lb_token/schema/schema.rs +++ b/contracts/liquidity_book/lb_token/src/bin/schema.rs @@ -1,11 +1,13 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::{env::current_dir, fs::create_dir_all}; +use std::{env, fs::create_dir_all, path::PathBuf}; use shade_protocol::liquidity_book::lb_token::{ExecuteMsg, InstantiateMsg, QueryAnswer, QueryMsg}; fn main() { - let mut out_dir = current_dir().unwrap(); + // Get the directory of the current crate + let mut out_dir = env::var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap(); out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); remove_schemas(&out_dir).unwrap(); diff --git a/contracts/liquidity_book/tests/Cargo.toml b/contracts/liquidity_book/tests/Cargo.toml index ac49af65..551860ca 100644 --- a/contracts/liquidity_book/tests/Cargo.toml +++ b/contracts/liquidity_book/tests/Cargo.toml @@ -8,10 +8,6 @@ exclude = ["contract.wasm", "hash.txt"] crate-type = ["cdylib", "rlib"] [features] -default = [] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] [dependencies] @@ -38,6 +34,4 @@ shade-multi-test = { path = "../../../packages/multi_test", features = [ "query_auth", "snip20", ] } -# TODO: why is this here? -lb-pair = { path = "../lb_pair" } serial_test = "2.0.0" diff --git a/packages/multi_test/src/interfaces/lb_factory.rs b/packages/multi_test/src/interfaces/lb_factory.rs index e6ee2be7..21ac8877 100644 --- a/packages/multi_test/src/interfaces/lb_factory.rs +++ b/packages/multi_test/src/interfaces/lb_factory.rs @@ -318,8 +318,8 @@ pub fn query_lb_pair_implementation( app: &mut App, lb_factory: &ContractInfo, ) -> StdResult { - match (lb_factory::QueryMsg::GetLBPairImplementation {}.test_query(lb_factory, app)) { - Ok(lb_factory::LBPairImplementationResponse { + match (lb_factory::QueryMsg::GetLbPairImplementation {}.test_query(lb_factory, app)) { + Ok(lb_factory::LbPairImplementationResponse { lb_pair_implementation, }) => Ok(lb_pair_implementation), Err(e) => Err(StdError::generic_err(e.to_string())), @@ -330,8 +330,8 @@ pub fn query_lb_token_implementation( app: &mut App, lb_factory: &ContractInfo, ) -> StdResult { - match (lb_factory::QueryMsg::GetLBTokenImplementation {}.test_query(lb_factory, app)) { - Ok(lb_factory::LBTokenImplementationResponse { + match (lb_factory::QueryMsg::GetLbTokenImplementation {}.test_query(lb_factory, app)) { + Ok(lb_factory::LbTokenImplementationResponse { lb_token_implementation, }) => Ok(lb_token_implementation), Err(e) => Err(StdError::generic_err(e.to_string())), @@ -353,8 +353,8 @@ pub fn query_fee_recipient(app: &mut App, lb_factory: &ContractInfo) -> StdResul } pub fn query_number_of_lb_pairs(app: &mut App, lb_factory: &ContractInfo) -> StdResult { - match (lb_factory::QueryMsg::GetNumberOfLBPairs {}.test_query(lb_factory, app)) { - Ok(lb_factory::NumberOfLBPairsResponse { lb_pair_number }) => Ok(lb_pair_number), + match (lb_factory::QueryMsg::GetNumberOfLbPairs {}.test_query(lb_factory, app)) { + Ok(lb_factory::NumberOfLbPairsResponse { lb_pair_number }) => Ok(lb_pair_number), Err(e) => Err(StdError::generic_err(e.to_string())), } } @@ -365,8 +365,8 @@ pub fn query_all_lb_pairs( token_x: TokenType, token_y: TokenType, ) -> StdResult> { - match (lb_factory::QueryMsg::GetAllLBPairs { token_x, token_y }.test_query(lb_factory, app)) { - Ok(lb_factory::AllLBPairsResponse { lb_pairs_available }) => Ok(lb_pairs_available), + match (lb_factory::QueryMsg::GetAllLbPairs { token_x, token_y }.test_query(lb_factory, app)) { + Ok(lb_factory::AllLbPairsResponse { lb_pairs_available }) => Ok(lb_pairs_available), Err(e) => Err(StdError::generic_err(e.to_string())), } } @@ -378,14 +378,14 @@ pub fn query_lb_pair_information( token_y: TokenType, bin_step: u16, ) -> StdResult { - match (lb_factory::QueryMsg::GetLBPairInformation { + match (lb_factory::QueryMsg::GetLbPairInformation { token_x, token_y, bin_step, } .test_query(lb_factory, app)) { - Ok(lb_factory::LBPairInformationResponse { + Ok(lb_factory::LbPairInformationResponse { lb_pair_information, }) => Ok(lb_pair_information), Err(e) => Err(StdError::generic_err(e.to_string())), diff --git a/packages/shade_protocol/src/contract_interfaces/liquidity_book/lb_factory.rs b/packages/shade_protocol/src/contract_interfaces/liquidity_book/lb_factory.rs index 0ae18a82..358bc447 100644 --- a/packages/shade_protocol/src/contract_interfaces/liquidity_book/lb_factory.rs +++ b/packages/shade_protocol/src/contract_interfaces/liquidity_book/lb_factory.rs @@ -130,27 +130,22 @@ pub enum QueryMsg { GetMinBinStep {}, #[returns(FeeRecipientResponse)] GetFeeRecipient {}, - #[returns(LBPairImplementationResponse)] - #[serde(rename = "get_lb_pair_implementation")] - GetLBPairImplementation {}, - #[returns(LBTokenImplementationResponse)] - #[serde(rename = "get_lb_token_implementation")] - GetLBTokenImplementation {}, - #[returns(NumberOfLBPairsResponse)] - #[serde(rename = "get_number_of_lb_pairs")] - GetNumberOfLBPairs {}, - #[returns(LBPairAtIndexResponse)] - #[serde(rename = "get_lb_pair_at_index")] - GetLBPairAtIndex { index: u32 }, + #[returns(LbPairImplementationResponse)] + GetLbPairImplementation {}, + #[returns(LbTokenImplementationResponse)] + GetLbTokenImplementation {}, + #[returns(NumberOfLbPairsResponse)] + GetNumberOfLbPairs {}, + #[returns(LbPairAtIndexResponse)] + GetLbPairAtIndex { index: u32 }, #[returns(NumberOfQuoteAssetsResponse)] GetNumberOfQuoteAssets {}, #[returns(QuoteAssetAtIndexResponse)] GetQuoteAssetAtIndex { index: u32 }, #[returns(IsQuoteAssetResponse)] IsQuoteAsset { token: TokenType }, - #[returns(LBPairInformationResponse)] - #[serde(rename = "get_lb_pair_information")] - GetLBPairInformation { + #[returns(LbPairInformationResponse)] + GetLbPairInformation { token_x: TokenType, token_y: TokenType, bin_step: u16, @@ -161,9 +156,8 @@ pub enum QueryMsg { GetAllBinSteps {}, #[returns(OpenBinStepsResponse)] GetOpenBinSteps {}, - #[returns(AllLBPairsResponse)] - #[serde(rename = "get_all_lb_pairs")] - GetAllLBPairs { + #[returns(AllLbPairsResponse)] + GetAllLbPairs { token_x: TokenType, token_y: TokenType, }, @@ -185,22 +179,22 @@ pub struct FeeRecipientResponse { } #[cw_serde] -pub struct LBPairImplementationResponse { +pub struct LbPairImplementationResponse { pub lb_pair_implementation: ContractImplementation, } #[cw_serde] -pub struct LBTokenImplementationResponse { +pub struct LbTokenImplementationResponse { pub lb_token_implementation: ContractImplementation, } #[cw_serde] -pub struct NumberOfLBPairsResponse { +pub struct NumberOfLbPairsResponse { pub lb_pair_number: u32, } #[cw_serde] -pub struct LBPairAtIndexResponse { +pub struct LbPairAtIndexResponse { pub lb_pair: LBPair, } @@ -220,7 +214,7 @@ pub struct IsQuoteAssetResponse { } #[cw_serde] -pub struct LBPairInformationResponse { +pub struct LbPairInformationResponse { pub lb_pair_information: LBPairInformation, } @@ -249,6 +243,6 @@ pub struct OpenBinStepsResponse { } #[cw_serde] -pub struct AllLBPairsResponse { +pub struct AllLbPairsResponse { pub lb_pairs_available: Vec, }