From 03ba1cd19e7d821563bc4f5a91a3791dd8d6edeb Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Fri, 3 Mar 2023 13:55:42 +0200 Subject: [PATCH 1/3] wip --- Cargo.lock | 1075 +++++------------ contracts/auction/Cargo.toml | 9 +- contracts/auction/src/contract.rs | 27 +- contracts/lockdrop/Cargo.toml | 21 +- contracts/lockdrop/src/contract.rs | 84 +- contracts/lockdrop/src/mock_querier.rs | 5 +- contracts/token-sale/.cargo/config | 4 - contracts/token-sale/Cargo.toml | 42 - contracts/token-sale/examples/schema.rs | 30 - contracts/token-sale/schema/execute_msg.json | 121 -- .../token-sale/schema/instantiate_msg.json | 33 - contracts/token-sale/schema/query_msg.json | 38 - contracts/token-sale/src/contract.rs | 419 ------- contracts/token-sale/src/error.rs | 38 - contracts/token-sale/src/lib.rs | 4 - contracts/token-sale/src/msg.rs | 86 -- contracts/token-sale/src/state.rs | 9 - packages/astroport_periphery/Cargo.toml | 2 +- packages/astroport_periphery/src/lib.rs | 4 +- 19 files changed, 333 insertions(+), 1718 deletions(-) delete mode 100644 contracts/token-sale/.cargo/config delete mode 100644 contracts/token-sale/Cargo.toml delete mode 100644 contracts/token-sale/examples/schema.rs delete mode 100644 contracts/token-sale/schema/execute_msg.json delete mode 100644 contracts/token-sale/schema/instantiate_msg.json delete mode 100644 contracts/token-sale/schema/query_msg.json delete mode 100644 contracts/token-sale/src/contract.rs delete mode 100644 contracts/token-sale/src/error.rs delete mode 100644 contracts/token-sale/src/lib.rs delete mode 100644 contracts/token-sale/src/msg.rs delete mode 100644 contracts/token-sale/src/state.rs diff --git a/Cargo.lock b/Cargo.lock index 3b733500..b115e085 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,105 +3,61 @@ version = 3 [[package]] -name = "anyhow" -version = "1.0.57" +name = "ahash" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" - -[[package]] -name = "astroport" -version = "2.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "uint", + "getrandom", + "once_cell", + "version_check", ] [[package]] -name = "astroport-auction" -version = "1.0.0" -dependencies = [ - "astroport", - "astroport-factory", - "astroport-generator", - "astroport-lockdrop", - "astroport-pair", - "astroport-periphery", - "astroport-token", - "astroport-vesting", - "astroport-whitelist", - "cosmwasm-schema", - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", - "cw-multi-test", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", -] +name = "anyhow" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] -name = "astroport-factory" -version = "1.2.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" +name = "ap-native-coin-registry" +version = "1.0.0" +source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#6da1b4765e29c64deaffd18db2da6110176efe04" dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf", - "schemars", - "serde", - "thiserror", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", ] [[package]] -name = "astroport-generator" -version = "2.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" +name = "astroport" +version = "2.1.0" +source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#6da1b4765e29c64deaffd18db2da6110176efe04" dependencies = [ - "astroport", - "astroport-governance", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf", - "schemars", - "serde", - "thiserror", + "ap-native-coin-registry", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", + "cw-utils 0.15.1", + "cw20 0.15.1", + "itertools", + "uint", ] [[package]] -name = "astroport-generator-proxy-to-mirror" +name = "astroport-auction" version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" dependencies = [ "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", + "astroport-lockdrop", + "astroport-periphery", + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-multi-test", + "cw-storage-plus 0.15.1", "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "mirror-protocol", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "astroport-governance" -version = "1.1.0" -source = "git+https://github.com/astroport-fi/astroport-governance.git?branch=main#c9ef97cdc7b363c2fbf18f39c0941a3562feec2e" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", ] @@ -111,67 +67,17 @@ name = "astroport-lockdrop" version = "1.2.0" dependencies = [ "astroport", - "astroport-auction", - "astroport-factory", - "astroport-generator", - "astroport-generator-proxy-to-mirror", - "astroport-governance", - "astroport-pair", - "astroport-pair-stable", "astroport-periphery", - "astroport-staking", - "astroport-token", - "astroport-vesting", - "astroport-whitelist", - "astroport-xastro-token", "cosmwasm-schema", - "cosmwasm-std 1.0.0", + "cosmwasm-std", "cw-multi-test", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cw-storage-plus 0.15.1", "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw20-base 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", - "terraswap 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "terraswap-factory", - "terraswap-pair", - "terraswap-token", - "voting-escrow", -] - -[[package]] -name = "astroport-pair" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "integer-sqrt", - "protobuf", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "astroport-pair-stable" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "integer-sqrt", - "protobuf", - "schemars", - "serde", - "thiserror", + "terraswap", ] [[package]] @@ -180,98 +86,14 @@ version = "1.1.0" dependencies = [ "astroport", "cosmwasm-schema", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "terraswap 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "astroport-staking" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "astroport-token" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20-base 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "snafu", -] - -[[package]] -name = "astroport-vesting" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cosmwasm-std", + "cw-storage-plus 0.15.1", "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", - "thiserror", -] - -[[package]] -name = "astroport-whitelist" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw0 0.10.3", - "cw1", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "astroport-xastro-token" -version = "1.0.0" -source = "git+https://github.com/astroport-fi/astroport-core.git?branch=main#34dd6eae2ba9620a00c080fe71638e785db226b8" -dependencies = [ - "astroport", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20-base 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "snafu", + "terraswap", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "base16ct" version = "0.1.1" @@ -280,31 +102,30 @@ checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64ct" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea908e7347a8c64e378c17e30ef880ad73e3b4498346b055c2c00ea342f3179" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] -name = "bigint" -version = "4.4.3" +name = "block-buffer" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0e8c8a600052b52482eff2cf4d810e462fdff1f656ac1ecb6232132a1ed7def" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "byteorder", - "crunchy 0.1.6", + "generic-array", ] [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ "generic-array", ] @@ -317,9 +138,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cfg-if" @@ -329,140 +150,91 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "const-oid" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" - -[[package]] -name = "const-oid" -version = "0.7.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - -[[package]] -name = "cosmwasm-bignumber" -version = "3.0.0-beta.0" -source = "git+https://github.com/terra-money/terra-cosmwasm?branch=feature/wasm-1.0#86abe81543e67ff8d32638036886720b3668ebde" -dependencies = [ - "bigint", - "cosmwasm-std 1.0.0", - "schemars", - "serde", -] - -[[package]] -name = "cosmwasm-crypto" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b110e31d47bd265e17ec88dd7328fcf40e1ee67a6131c1ab492f77fef8cd83" -dependencies = [ - "digest", - "ed25519-zebra 2.2.0", - "k256 0.9.6", - "rand_core 0.5.1", - "thiserror", -] +checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "cosmwasm-crypto" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb0afef2325df81aadbf9be1233f522ed8f6e91df870c764bc44cca2b1415bd" +checksum = "7fecd74d3a0041114110d1260f77fcb644c5d2403549b37096c44f0e643a5177" dependencies = [ - "digest", - "ed25519-zebra 3.0.0", - "k256 0.10.4", - "rand_core 0.6.3", + "digest 0.10.6", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", "thiserror", ] [[package]] name = "cosmwasm-derive" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0faf9bad5eb0a43a00406e64f8d33407a06bd1826fa976195a69db70e6c18d9d" -dependencies = [ - "syn", -] - -[[package]] -name = "cosmwasm-derive" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b36e527620a2a3e00e46b6e731ab6c9b68d11069c986f7d7be8eba79ef081a4" +checksum = "d5abeeb891e6d0098402e4d3d042f90451db52651d2fe14b170e69a1dd3e4115" dependencies = [ "syn", ] [[package]] name = "cosmwasm-schema" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772e80bbad231a47a2068812b723a1ff81dd4a0d56c9391ac748177bea3a61da" +checksum = "9118e36843df6648fd0a626c46438f87038f296ec750cef3832cafc483c483f9" dependencies = [ + "cosmwasm-schema-derive", "schemars", + "serde", "serde_json", + "thiserror", ] [[package]] -name = "cosmwasm-std" -version = "0.16.7" +name = "cosmwasm-schema-derive" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0d4e46ab20939af6366a71783324ae4babdedb111f0dd797d063a2e68718bc" +checksum = "78d6fc9854ac14e46cb69b0f396547893f93d2847aef975950ebbe73342324f3" dependencies = [ - "base64", - "cosmwasm-crypto 0.16.7", - "cosmwasm-derive 0.16.7", - "forward_ref", - "schemars", - "serde", - "serde-json-wasm 0.3.2", - "thiserror", - "uint", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "cosmwasm-std" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875994993c2082a6fcd406937bf0fca21c349e4a624f3810253a14fa83a3a195" +checksum = "5034c772c1369b160731aa00bb81f93733ab2884928edd8d588733d607ac5af4" dependencies = [ "base64", - "cosmwasm-crypto 1.0.0", - "cosmwasm-derive 1.0.0", + "cosmwasm-crypto", + "cosmwasm-derive", + "derivative", "forward_ref", + "hex", "schemars", "serde", - "serde-json-wasm 0.4.1", + "serde-json-wasm", + "sha2 0.10.6", "thiserror", "uint", ] [[package]] name = "cosmwasm-storage" -version = "0.16.7" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c243d26ba6c49abb5ed69762648a9c664ba263debce425ad10603e7b8aa92ced" +checksum = "18b4c99c6479e554ef1516950f1fa3d88bd7d0a8fc2367321c07ca0a33997dfc" dependencies = [ - "cosmwasm-std 0.16.7", - "serde", -] - -[[package]] -name = "cosmwasm-storage" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18403b07304d15d304dad11040d45bbcaf78d603b4be3fb5e2685c16f9229b5" -dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "serde", ] [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] @@ -472,8 +244,8 @@ name = "credits" version = "0.1.0" dependencies = [ "cosmwasm-schema", - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", + "cosmwasm-std", + "cosmwasm-storage", "cw-multi-test", "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -485,12 +257,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "crunchy" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" - [[package]] name = "crunchy" version = "0.2.2" @@ -499,36 +265,24 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83bd3bb4314701c568e340cd8cf78c975aa0ca79e03d3f6d1677d5b0c9c0c03" -dependencies = [ - "generic-array", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", "zeroize", ] [[package]] -name = "crypto-mac" -version = "0.11.1" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "subtle", + "typenum", ] [[package]] @@ -538,26 +292,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", - "digest", + "digest 0.9.0", "rand_core 0.5.1", "subtle", "zeroize", ] -[[package]] -name = "cw-asset" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7996c9c60e416aec195719137767d5cef8301237438bbabb772ee45a27f06e5e" -dependencies = [ - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw1155", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", -] - [[package]] name = "cw-multi-test" version = "0.13.4" @@ -565,8 +305,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f9a8ab7c3c29ec93cb7a39ce4b14a05e053153b4a17ef7cf2246af1b7c087e" dependencies = [ "anyhow", - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", + "cosmwasm-std", + "cosmwasm-storage", "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "derivative", @@ -583,7 +323,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648b1507290bbc03a8d88463d7cd9b04b1fa0155e5eef366c4fa052b9caaac7a" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "schemars", "serde", ] @@ -593,21 +333,20 @@ name = "cw-storage-plus" version = "0.13.4" source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "schemars", "serde", ] [[package]] -name = "cw-utils" -version = "0.11.1" +name = "cw-storage-plus" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef842a1792e4285beff7b3b518705f760fa4111dc1e296e53f3e92d1ef7f6220" +checksum = "dc6cf70ef7686e2da9ad7b067c5942cd3e88dd9453f7af42f54557f8af300fb0" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "schemars", "serde", - "thiserror", ] [[package]] @@ -616,7 +355,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbaecb78c8e8abfd6b4258c7f4fbeb5c49a5e45ee4d910d3240ee8e1d714e1b" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "schemars", "serde", "thiserror", @@ -627,66 +366,34 @@ name = "cw-utils" version = "0.13.4" source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" dependencies = [ - "cosmwasm-std 1.0.0", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "cw0" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c497f885a40918a02df7d938c81809965fa05cfc21b3dc591e9950237b5de0a9" -dependencies = [ - "cosmwasm-std 0.16.7", + "cosmwasm-std", "schemars", "serde", "thiserror", ] [[package]] -name = "cw0" -version = "0.10.3" +name = "cw-utils" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae676b6cced78a3d38ad4b01ab4ed66fc78ac191c3c0d6bfd5372cb2efd473b" +checksum = "0ae0b69fa7679de78825b4edeeec045066aa2b2c4b6e063d80042e565bb4da5c" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw2 0.15.1", "schemars", + "semver", "serde", "thiserror", ] -[[package]] -name = "cw1" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362649aa18f898ff8a7a18f2bfc5568e9ba56417f3c9ce0e01bc32ccb2e125e0" -dependencies = [ - "cosmwasm-std 1.0.0", - "schemars", - "serde", -] - -[[package]] -name = "cw1155" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42197c9a0fd844653177009125f24157e486578289327a3781923e427a8f9bbc" -dependencies = [ - "cosmwasm-std 1.0.0", - "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", -] - [[package]] name = "cw2" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04cf4639517490dd36b333bbd6c4fbd92e325fd0acf4683b41753bc5eb63bfc1" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", @@ -697,32 +404,33 @@ name = "cw2" version = "0.13.4" source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "cw-storage-plus 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", "schemars", "serde", ] [[package]] -name = "cw20" -version = "0.8.1" +name = "cw2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a11a2adbd52258f5b4ed5323f62bc6e559f2cefbe52ef0e58290016fde5bb083" +checksum = "5abb8ecea72e09afff830252963cb60faf945ce6cef2c20a43814516082653da" dependencies = [ - "cosmwasm-std 0.16.7", - "cw0 0.8.1", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 0.15.1", "schemars", "serde", ] [[package]] name = "cw20" -version = "0.11.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9671d7edef5608acaf5b2f1e473ee3f501eced2cd4f7392e2106c8cf02ba0720" +checksum = "4cb782b8f110819a4eb5dbbcfed25ffba49ec16bbe32b4ad8da50a5ce68fec05" dependencies = [ - "cosmwasm-std 1.0.0", - "cw-utils 0.11.1", + "cosmwasm-std", + "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", "serde", ] @@ -730,22 +438,23 @@ dependencies = [ [[package]] name = "cw20" version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cb782b8f110819a4eb5dbbcfed25ffba49ec16bbe32b4ad8da50a5ce68fec05" +source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" dependencies = [ - "cosmwasm-std 1.0.0", - "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cosmwasm-std", + "cw-utils 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", "schemars", "serde", ] [[package]] name = "cw20" -version = "0.13.4" -source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6025276fb6e603e974c21f3e4606982cdc646080e8fba3198816605505e1d9a" dependencies = [ - "cosmwasm-std 1.0.0", - "cw-utils 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", + "cosmwasm-schema", + "cosmwasm-std", + "cw-utils 0.15.1", "schemars", "serde", ] @@ -756,7 +465,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0306e606581f4fb45e82bcbb7f0333179ed53dd949c6523f01a99b4bfc1475a0" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw-utils 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -771,7 +480,7 @@ name = "cw20-base" version = "0.13.4" source = "git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a#bfe7471ae59a0aa68155841a741d428030183b1a" dependencies = [ - "cosmwasm-std 1.0.0", + "cosmwasm-std", "cw-storage-plus 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", "cw-utils 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", "cw2 0.13.4 (git+https://github.com/neutron-org/cw-plus_balances-snapshots?rev=bfe7471ae59a0aa68155841a741d428030183b1a)", @@ -783,20 +492,12 @@ dependencies = [ [[package]] name = "der" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" -dependencies = [ - "const-oid 0.6.2", -] - -[[package]] -name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ - "const-oid 0.7.1", + "const-oid", + "zeroize", ] [[package]] @@ -820,105 +521,70 @@ dependencies = [ ] [[package]] -name = "doc-comment" -version = "0.3.3" +name = "digest" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] [[package]] name = "dyn-clone" -version = "1.0.5" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" [[package]] name = "ecdsa" -version = "0.12.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der 0.4.5", - "elliptic-curve 0.10.6", - "hmac", - "signature", -] - -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der 0.5.1", - "elliptic-curve 0.11.12", + "der", + "elliptic-curve", "rfc6979", "signature", ] [[package]] name = "ed25519-zebra" -version = "2.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a128b76af6dd4b427e34a6fd43dc78dbfe73672ec41ff615a2414c1a0ad0409" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek", + "hashbrown", "hex", - "rand_core 0.5.1", + "rand_core 0.6.4", "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "ed25519-zebra" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" -dependencies = [ - "curve25519-dalek", - "hex", - "rand_core 0.6.3", - "serde", - "sha2", - "thiserror", + "sha2 0.9.9", "zeroize", ] [[package]] name = "either" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.10.6" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beca177dcb8eb540133e7680baff45e7cc4d93bf22002676cec549f82343721b" -dependencies = [ - "crypto-bigint 0.2.11", - "ff 0.10.1", - "generic-array", - "group 0.10.0", - "pkcs8 0.7.6", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", - "crypto-bigint 0.3.2", - "der 0.5.1", - "ff 0.11.1", + "crypto-bigint", + "der", + "digest 0.10.6", + "ff", "generic-array", - "group 0.11.0", - "rand_core 0.6.3", + "group", + "pkcs8", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -926,21 +592,11 @@ dependencies = [ [[package]] name = "ff" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f40b2dcd8bc322217a5f6559ae5f9e9d1de202a2ecee2e9eafcbece7562a4f" -dependencies = [ - "rand_core 0.6.3", - "subtle", -] - -[[package]] -name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -952,9 +608,9 @@ checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -962,46 +618,33 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "group" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c363a5301b8f153d80747126a04b3c82073b9fe3130571a9d170cacdeaf7912" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ - "ff 0.10.1", - "rand_core 0.6.3", + "ff", + "rand_core 0.6.4", "subtle", ] [[package]] -name = "group" -version = "0.11.0" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ff 0.11.1", - "rand_core 0.6.3", - "subtle", + "ahash", ] [[package]] @@ -1012,91 +655,51 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "integer-sqrt" -version = "0.1.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "num-traits", + "digest 0.10.6", ] [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "k256" -version = "0.9.6" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903ae2481bcdfdb7b68e0a9baa4b7c9aff600b9ae2e8e5bb5833b8c91ab851ea" -dependencies = [ - "cfg-if", - "ecdsa 0.12.4", - "elliptic-curve 0.10.6", - "sha2", -] +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa 0.13.4", - "elliptic-curve 0.11.12", - "sec1", - "sha2", + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", ] [[package]] name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "mirror-protocol" -version = "2.1.1" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b4a3ba65a8fd11cd24862cc49a2c4eebb98e8dfd38d43df72145cde19d9ca6" -dependencies = [ - "cosmwasm-std 0.16.7", - "cosmwasm-storage 0.16.7", - "cw20 0.8.1", - "schemars", - "serde", - "terraswap 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] -name = "num-traits" -version = "0.2.15" +name = "once_cell" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -1106,23 +709,12 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "pkcs8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3ef9b64d26bad0536099c816c6734379e45bbd5f14798def6809e5cc350447" -dependencies = [ - "der 0.4.5", - "spki 0.4.1", -] - -[[package]] -name = "pkcs8" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der 0.5.1", - "spki 0.5.4", - "zeroize", + "der", + "spki", ] [[package]] @@ -1159,18 +751,18 @@ dependencies = [ [[package]] name = "protobuf" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" dependencies = [ "bytes", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -1180,41 +772,38 @@ name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.7", + "getrandom", ] [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint 0.3.2", + "crypto-bigint", "hmac", "zeroize", ] [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "schemars" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1847b767a3d62d95cbf3d8a9f0e421cf57a0d8aa4f411d4b16525afb0284d4ed" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ "dyn-clone", "schemars_derive", @@ -1224,9 +813,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4d7e1b012cb3d9129567661a63755ea4b8a7386d339dc945ae187e403c6743" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ "proc-macro2", "quote", @@ -1236,17 +825,24 @@ dependencies = [ [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "der 0.5.1", + "base16ct", + "der", "generic-array", - "pkcs8 0.8.0", + "pkcs8", "subtle", "zeroize", ] +[[package]] +name = "semver" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" + [[package]] name = "serde" version = "1.0.152" @@ -1258,18 +854,9 @@ dependencies = [ [[package]] name = "serde-json-wasm" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "042ac496d97e5885149d34139bad1d617192770d7eb8f1866da2317ff4501853" -dependencies = [ - "serde", -] - -[[package]] -name = "serde-json-wasm" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" +checksum = "a15bee9b04dd165c3f4e142628982ddde884c2022a89e8ddf99c4829bf2c3a58" dependencies = [ "serde", ] @@ -1298,9 +885,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -1313,61 +900,42 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] [[package]] -name = "signature" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2807892cfa58e081aa1f1111391c7a0649d4fa127a4ffbe34bcbfb35a1171a4" -dependencies = [ - "digest", - "rand_core 0.6.3", -] - -[[package]] -name = "snafu" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.10" +name = "sha2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "proc-macro2", - "quote", - "syn", + "cfg-if", + "cpufeatures", + "digest 0.10.6", ] [[package]] -name = "spki" -version = "0.4.1" +name = "signature" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c01a0c15da1b0b0e1494112e7af814a678fec9bd157881b49beac661e9b6f32" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "der 0.4.5", + "digest 0.10.6", + "rand_core 0.6.4", ] [[package]] name = "spki" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der 0.5.1", + "der", ] [[package]] @@ -1395,138 +963,61 @@ dependencies = [ [[package]] name = "terraswap" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02458cd8271acd0fc98d097ca6d296f5f7abe6359ca841554db90de67c376500" -dependencies = [ - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "protobuf", - "schemars", - "serde", -] - -[[package]] -name = "terraswap" -version = "2.6.1" -source = "git+https://github.com/terraswap/terraswap.git?branch=main#fa3aaa48bb3bc0f9eedd6b437e312a91b1ff8b79" +checksum = "b9540f8489ec6e098de380c9fa8fa81fa95e502f87d63705aa6fba56817ad1a7" dependencies = [ - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", + "cosmwasm-std", + "cosmwasm-storage", "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf", "schemars", "serde", ] -[[package]] -name = "terraswap-factory" -version = "0.0.0" -source = "git+https://github.com/terraswap/terraswap.git?branch=main#fa3aaa48bb3bc0f9eedd6b437e312a91b1ff8b79" -dependencies = [ - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.11.1", - "protobuf", - "schemars", - "serde", - "terraswap 2.6.1 (git+https://github.com/terraswap/terraswap.git?branch=main)", -] - -[[package]] -name = "terraswap-pair" -version = "0.0.0" -source = "git+https://github.com/terraswap/terraswap.git?branch=main#fa3aaa48bb3bc0f9eedd6b437e312a91b1ff8b79" -dependencies = [ - "cosmwasm-bignumber", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "integer-sqrt", - "protobuf", - "schemars", - "serde", - "terraswap 2.6.1 (git+https://github.com/terraswap/terraswap.git?branch=main)", - "thiserror", -] - -[[package]] -name = "terraswap-token" -version = "0.0.0" -source = "git+https://github.com/terraswap/terraswap.git?branch=main#fa3aaa48bb3bc0f9eedd6b437e312a91b1ff8b79" -dependencies = [ - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw0 0.10.3", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20-base 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "terraswap 2.6.1 (git+https://github.com/terraswap/terraswap.git?branch=main)", - "thiserror", -] - [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "token_sale" -version = "0.1.0" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std 1.0.0", - "cosmwasm-storage 1.0.0", - "cw-asset", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "thiserror", -] - [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", - "crunchy 0.2.2", + "crunchy", "hex", "static_assertions", ] [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "version_check" @@ -1534,28 +1025,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "voting-escrow" -version = "1.3.0" -source = "git+https://github.com/astroport-fi/astroport-governance.git?branch=main#c9ef97cdc7b363c2fbf18f39c0941a3562feec2e" -dependencies = [ - "astroport-governance", - "cosmwasm-std 1.0.0", - "cw-storage-plus 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw2 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cw20-base 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", - "schemars", - "serde", - "thiserror", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1564,6 +1033,6 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" diff --git a/contracts/auction/Cargo.toml b/contracts/auction/Cargo.toml index 2a041765..38462532 100644 --- a/contracts/auction/Cargo.toml +++ b/contracts/auction/Cargo.toml @@ -29,7 +29,7 @@ astroport-periphery = { path = "../../packages/astroport_periphery" } cw20 = { version = "0.13" } cw2 = { version = "0.13" } cosmwasm-std = { version = "1.0" } -cw-storage-plus = { version = "0.13" } +cw-storage-plus = { version = "0.15.1" } serde = { version = "1.0.127", default-features = false, features = ["derive"] } schemars = "0.8" @@ -37,11 +37,4 @@ schemars = "0.8" cosmwasm-schema = { version = "1.0" } cosmwasm-storage = { version = "1.0" } cw-multi-test = "0.13" -# needed for intergration testing -astroport-pair = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-token = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-vesting = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-generator = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-whitelist = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-factory = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } astroport-lockdrop = { path = "../lockdrop" } diff --git a/contracts/auction/src/contract.rs b/contracts/auction/src/contract.rs index f09a6dd2..e1f174fe 100644 --- a/contracts/auction/src/contract.rs +++ b/contracts/auction/src/contract.rs @@ -14,7 +14,7 @@ use astroport_periphery::helpers::{build_approve_cw20_msg, cw20_get_balance}; use astroport_periphery::lockdrop::ExecuteMsg::EnableClaims as LockdropEnableClaims; use crate::state::{CONFIG, STATE, USERS}; -use astroport::asset::{addr_validate_to_lower, Asset, AssetInfo, PairInfo}; +use astroport::asset::{Asset, AssetInfo, PairInfo}; use astroport::generator::{ ExecuteMsg as GenExecuteMsg, PendingTokenResponse, QueryMsg as GenQueryMsg, RewardInfoResponse, }; @@ -62,13 +62,12 @@ pub fn instantiate( let config = Config { owner: msg .owner - .map(|v| addr_validate_to_lower(deps.api, &v)) + .map(|v| deps.api.addr_validate(&v)) .transpose()? .unwrap_or(info.sender), - astro_token_address: addr_validate_to_lower(deps.api, &msg.astro_token_address)?, - airdrop_contract_address: addr_validate_to_lower(deps.api, &msg.airdrop_contract_address)?, - lockdrop_contract_address: addr_validate_to_lower( - deps.api, + astro_token_address: deps.api.addr_validate(&msg.astro_token_address)?, + airdrop_contract_address: deps.api.addr_validate(&msg.airdrop_contract_address)?, + lockdrop_contract_address: deps.api.addr_validate( &msg.lockdrop_contract_address, )?, pool_info: None, @@ -274,7 +273,7 @@ pub fn handle_update_config( // UPDATE :: ADDRESSES IF PROVIDED if let Some(owner) = new_config.owner { - config.owner = addr_validate_to_lower(deps.api, &owner)?; + config.owner = deps.api.addr_validate(&owner)?; attributes.push(attr("owner", config.owner.to_string())); } @@ -284,7 +283,7 @@ pub fn handle_update_config( "Assets had already been provided to previous pool!", )); } - let astro_ust_pair_addr = addr_validate_to_lower(deps.api, &astro_ust_pair_address)?; + let astro_ust_pair_addr = deps.api.addr_validate(&astro_ust_pair_address)?; let pair_info: PairInfo = deps .querier @@ -302,7 +301,7 @@ pub fn handle_update_config( return Err(StdError::generic_err("ASTRO-UST LP tokens already staked")); } - let generator_addr = addr_validate_to_lower(deps.api, &generator_contract)?; + let generator_addr = deps.api.addr_validate(&generator_contract)?; config.generator_contract = Some(generator_addr.clone()); attributes.push(attr("generator", generator_addr.to_string())); } @@ -356,7 +355,7 @@ pub fn handle_delegate_astro_tokens( ) -> Result { let config = CONFIG.load(deps.storage)?; - let user_address = addr_validate_to_lower(deps.api, &user_address)?; + let user_address = deps.api.addr_validate(&user_address)?; // CHECK :: Auction deposit window open if !is_deposit_open(env.block.time.seconds(), &config) { @@ -684,7 +683,7 @@ fn build_provide_liquidity_to_lp_pool_msg( amount: ust.amount, }], msg: to_binary(&astroport::pair::ExecuteMsg::ProvideLiquidity { - assets: [ust, astro], + assets: [ust, astro].to_vec(), slippage_tolerance, auto_stake: None, receiver: None, @@ -867,7 +866,7 @@ pub fn handle_claim_rewards_and_withdraw_lp_shares( let astro_balance = { let res: BalanceResponse = deps.querier.query_wasm_smart( - rwi.base_reward_token, + rwi.base_reward_token.to_string(), &Cw20QueryMsg::Balance { address: env.contract.address.to_string(), }, @@ -1194,7 +1193,7 @@ pub fn update_state_on_reward_claim( let base_reward_received; state.generator_astro_per_share += { let res: BalanceResponse = deps.querier.query_wasm_smart( - rwi.base_reward_token, + rwi.base_reward_token.to_string(), &Cw20QueryMsg::Balance { address: env.contract.address.to_string(), }, @@ -1266,7 +1265,7 @@ pub fn calculate_withdrawable_lp_shares( fn query_user_info(deps: Deps, env: Env, user_address: String) -> StdResult { let config = CONFIG.load(deps.storage)?; let mut state = STATE.load(deps.storage)?; - let user_address = addr_validate_to_lower(deps.api, &user_address)?; + let user_address = deps.api.addr_validate(&user_address)?; let mut user_info = USERS .may_load(deps.storage, &user_address)? .unwrap_or_default(); diff --git a/contracts/lockdrop/Cargo.toml b/contracts/lockdrop/Cargo.toml index 405201b3..0df900b6 100644 --- a/contracts/lockdrop/Cargo.toml +++ b/contracts/lockdrop/Cargo.toml @@ -30,7 +30,7 @@ terraswap = "2.6" cosmwasm-std = { version = "1.0" } cw20 = { version = "0.13" } cw2 = { version = "0.13" } -cw-storage-plus = {version = "0.13", features = ["iterator"]} +cw-storage-plus = {version = "0.15.1", features = ["iterator"]} schemars = "0.8.3" serde = { version = "1.0.127", default-features = false, features = ["derive"] } @@ -38,22 +38,3 @@ serde = { version = "1.0.127", default-features = false, features = ["derive"] } cw20-base = { version = "0.13", features = ["library"] } cosmwasm-schema = { version = "1.0" } cw-multi-test = "0.13" - -# Terraswap contracts -terraswap-factory = { git = "https://github.com/terraswap/terraswap.git", branch = "main" } -terraswap-pair = { git = "https://github.com/terraswap/terraswap.git", branch = "main" } -terraswap-token = { git = "https://github.com/terraswap/terraswap.git", branch = "main" } -# Astroport contracts -astroport-factory = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-pair = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-pair-stable = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-token = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-vesting = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-generator = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-generator-proxy-to-mirror = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-staking = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-xastro-token = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-auction = { path = "../auction" } -astroport-whitelist = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } -astroport-governance = { git = "https://github.com/astroport-fi/astroport-governance.git", branch = "main" } -voting-escrow = { git = "https://github.com/astroport-fi/astroport-governance.git", branch = "main" } diff --git a/contracts/lockdrop/src/contract.rs b/contracts/lockdrop/src/contract.rs index 2cf12695..f237ac6c 100644 --- a/contracts/lockdrop/src/contract.rs +++ b/contracts/lockdrop/src/contract.rs @@ -1,6 +1,6 @@ use std::convert::TryInto; -use astroport::asset::{addr_validate_to_lower, pair_info_by_pool, Asset, AssetInfo}; +use astroport::asset::{pair_info_by_pool, Asset, AssetInfo}; use astroport::common::{claim_ownership, drop_ownership_proposal, propose_new_owner}; use astroport::generator::{ ExecuteMsg as GenExecuteMsg, PendingTokenResponse, QueryMsg as GenQueryMsg, RewardInfoResponse, @@ -28,7 +28,6 @@ use astroport_periphery::lockdrop::{ PoolInfo, QueryMsg, State, StateResponse, UpdateConfigMsg, UserInfoResponse, UserInfoWithListResponse, }; -use astroport_periphery::U64Key; use crate::state::{ CompatibleLoader, ASSET_POOLS, CONFIG, LOCKUP_INFO, OWNERSHIP_PROPOSAL, STATE, @@ -92,7 +91,7 @@ pub fn instantiate( let config = Config { owner: msg .owner - .map(|v| addr_validate_to_lower(deps.api, &v)) + .map(|v| deps.api.addr_validate(&v)) .transpose()? .unwrap_or(info.sender), astro_token: None, @@ -233,7 +232,7 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S } => { let recipient = recipient.map_or_else( || Ok(info.sender.clone()), - |recip_addr| addr_validate_to_lower(deps.api, &recip_addr), + |recip_addr| deps.api.addr_validate(&recip_addr), )?; handle_claim_asset_reward( deps.as_ref(), @@ -296,7 +295,7 @@ pub fn receive_cw20( info: MessageInfo, cw20_msg: Cw20ReceiveMsg, ) -> Result { - let user_address = addr_validate_to_lower(deps.api, &cw20_msg.sender)?; + let user_address = deps.api.addr_validate(&cw20_msg.sender)?; // CHECK :: Tokens sent > 0 if cw20_msg.amount == Uint128::zero() { return Err(StdError::generic_err( @@ -570,7 +569,7 @@ pub fn handle_update_config( return Err(StdError::generic_err("ASTRO token already set")); } - config.astro_token = Some(addr_validate_to_lower(deps.api, &astro_addr)?); + config.astro_token = Some(deps.api.addr_validate(&astro_addr)?); attributes.push(attr("new_astro_token", astro_addr)) }; @@ -580,7 +579,7 @@ pub fn handle_update_config( return Err(StdError::generic_err("Auction contract already set.")); } None => { - config.auction_contract = Some(addr_validate_to_lower(deps.api, &auction)?); + config.auction_contract = Some(deps.api.addr_validate(&auction)?); attributes.push(attr("auction_contract", auction)) } } @@ -603,7 +602,7 @@ pub fn handle_update_config( } } - config.generator = Some(addr_validate_to_lower(deps.api, &generator)?); + config.generator = Some(deps.api.addr_validate(&generator)?); attributes.push(attr("new_generator", generator)) } @@ -687,7 +686,7 @@ pub fn handle_initialize_pool( )); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; // CHECK ::: Is LP Token Pool already initialized if ASSET_POOLS @@ -701,8 +700,7 @@ pub fn handle_initialize_pool( let res: Option = deps .querier .query_wasm_smart(&terraswap_lp_token, &Cw20QueryMsg::Minter {})?; - addr_validate_to_lower( - deps.api, + deps.api.addr_validate( &res.ok_or_else(|| StdError::generic_err("No minter for the LP token!"))? .minter, )? @@ -768,7 +766,7 @@ pub fn handle_update_pool( )); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; // CHECK ::: Is LP Token Pool initialized let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; @@ -874,8 +872,8 @@ pub fn handle_migrate_liquidity( "Deposit / Withdrawal windows not closed", )); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; - let astroport_pool = addr_validate_to_lower(deps.api, &astroport_pool_addr)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; + let astroport_pool = deps.api.addr_validate(&astroport_pool_addr)?; let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; @@ -925,7 +923,7 @@ pub fn handle_migrate_liquidity( terraswap::asset::AssetInfo::Token { contract_addr } => { terraswap::querier::query_token_balance( &deps.querier, - addr_validate_to_lower(deps.api, contract_addr)?, + deps.api.addr_validate(contract_addr)?, env.contract.address.clone(), )? } @@ -984,7 +982,7 @@ pub fn handle_stake_lp_tokens( return Err(StdError::generic_err("Unauthorized")); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; // CHECK ::: Is LP Token Pool supported or not ? let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; @@ -1093,7 +1091,7 @@ pub fn handle_increase_lockup( pool_info.weighted_amount += calculate_weight(amount, duration, &config)?; pool_info.terraswap_amount_in_lockups += amount; - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let lockup_info = match LOCKUP_INFO.compatible_may_load( deps.as_ref(), @@ -1171,14 +1169,14 @@ pub fn handle_withdraw_from_lockup( return Err(StdError::generic_err("Invalid withdrawal request")); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; // CHECK ::: LP Token supported or not ? let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; // Retrieve Lockup position let user_address = info.sender; - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let mut lockup_info = LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; @@ -1373,7 +1371,7 @@ pub fn handle_claim_rewards_and_unlock_for_lockup( let user_address = info.sender; - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; // CHECK ::: Is LP Token Pool supported or not ? let pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; @@ -1395,7 +1393,7 @@ pub fn handle_claim_rewards_and_unlock_for_lockup( USER_INFO.save(deps.storage, &user_address, &user_info)?; // Check is there lockup or not ? - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let lockup_info = LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; @@ -1448,7 +1446,7 @@ pub fn handle_claim_rewards_and_unlock_for_lockup( let astro_balance = { let res: BalanceResponse = deps.querier.query_wasm_smart( - rwi.base_reward_token, + rwi.base_reward_token.to_string(), &Cw20QueryMsg::Balance { address: env.contract.address.to_string(), }, @@ -1541,7 +1539,7 @@ fn handle_claim_asset_reward( terraswap_lp_token: String, lock_duration: u64, ) -> StdResult { - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; let pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; if !pool_info.has_asset_rewards { @@ -1597,7 +1595,7 @@ fn handle_toggle_rewards( return Err(StdError::generic_err("Unauthorized")); } - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; ASSET_POOLS .update(deps.storage, &terraswap_lp_token, |pool_info_opt| { let mut pool_info = @@ -1668,7 +1666,7 @@ pub fn update_pool_on_dual_rewards_claim( // Increment claimed Astro rewards per LP share pool_info.generator_astro_per_share += { let res: BalanceResponse = deps.querier.query_wasm_smart( - rwi.base_reward_token, + rwi.base_reward_token.to_string(), &Cw20QueryMsg::Balance { address: env.contract.address.to_string(), }, @@ -1726,7 +1724,7 @@ pub fn callback_withdraw_user_rewards_for_lockup_optional_withdraw( ) -> StdResult { let config = CONFIG.load(deps.storage)?; let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let mut lockup_info = LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; @@ -1970,7 +1968,7 @@ pub fn callback_deposit_liquidity_in_astroport( terraswap::asset::AssetInfo::Token { contract_addr } => { let amount = terraswap::querier::query_token_balance( &deps.querier, - addr_validate_to_lower(deps.api, &contract_addr)?, + deps.api.addr_validate(&contract_addr)?, env.contract.address.clone(), )? .checked_sub(prev_asset.amount)?; @@ -1990,7 +1988,7 @@ pub fn callback_deposit_liquidity_in_astroport( assets.push(astroport::asset::Asset { info: astroport::asset::AssetInfo::Token { - contract_addr: addr_validate_to_lower(deps.api, &contract_addr)?, + contract_addr: deps.api.addr_validate(&contract_addr)?, }, amount, }); @@ -2081,7 +2079,7 @@ fn callback_distribute_asset_reward( let lockup_key = ( &terraswap_lp_token, &user_address, - U64Key::new(lock_duration), + lock_duration, ); let mut user_reward = Uint128::zero(); // get only lockups that have not yet been withdrawn @@ -2136,7 +2134,7 @@ pub fn query_state(deps: Deps) -> StdResult { /// /// * **terraswap_lp_token** is an object of type [`String`]. pub fn query_pool(deps: Deps, terraswap_lp_token: String) -> StdResult { - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; let pool_info: PoolInfo = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; Ok(pool_info) } @@ -2149,7 +2147,7 @@ pub fn query_pool(deps: Deps, terraswap_lp_token: String) -> StdResult /// /// * **user** is an object of type [`String`]. pub fn query_user_info(deps: Deps, env: Env, user: String) -> StdResult { - let user_address = addr_validate_to_lower(deps.api, &user)?; + let user_address = deps.api.addr_validate(&user)?; let user_info = USER_INFO .may_load(deps.storage, &user_address)? .unwrap_or_default(); @@ -2196,7 +2194,7 @@ pub fn query_user_info_with_lockups_list( _env: Env, user: String, ) -> StdResult { - let user_address = addr_validate_to_lower(deps.api, &user)?; + let user_address = deps.api.addr_validate(&user)?; let user_info = USER_INFO .may_load(deps.storage, &user_address)? .unwrap_or_default(); @@ -2249,10 +2247,10 @@ pub fn query_lockup_info( let config = CONFIG.load(deps.storage)?; let state = STATE.load(deps.storage)?; - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; - let user_address = addr_validate_to_lower(deps.api, user_address)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; + let user_address = deps.api.addr_validate(user_address)?; - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; let mut lockup_info = LOCKUP_INFO.compatible_load(deps, lockup_key, &config.generator)?; @@ -2396,10 +2394,10 @@ pub fn query_pending_asset_reward( ) -> StdResult { let config = CONFIG.load(deps.storage)?; - let user_address = addr_validate_to_lower(deps.api, &user_address)?; - let terraswap_lp_token = addr_validate_to_lower(deps.api, &terraswap_lp_token)?; + let user_address = deps.api.addr_validate(&user_address)?; + let terraswap_lp_token = deps.api.addr_validate(&terraswap_lp_token)?; - let lockup_key = (&terraswap_lp_token, &user_address, U64Key::new(duration)); + let lockup_key = (&terraswap_lp_token, &user_address, duration); let lockup_info_opt = LOCKUP_INFO .compatible_may_load(deps, lockup_key.clone(), &config.generator)? @@ -2599,7 +2597,7 @@ fn update_user_lockup_positions_and_calc_rewards( } for (pool, duration) in keys { let pool_info = ASSET_POOLS.load(deps.storage, &pool)?; - let lockup_key = (&pool, user_address, U64Key::new(duration)); + let lockup_key = (&pool, user_address, duration); let mut lockup_info = LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; @@ -2762,17 +2760,17 @@ mod unit_tests { // user1 with 10% share let user1 = Addr::unchecked("user1"); let user1_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user1, U64Key::new(10))); + USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user1, 10)); let user1_lp_amount = Uint128::from(100u128); // user2 with 70% share let user2 = Addr::unchecked("user2"); let user2_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user2, U64Key::new(10))); + USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user2, 10)); let user2_lp_amount = Uint128::from(700u128); // user3 with 20% share let user3 = Addr::unchecked("user3"); let user3_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user3, U64Key::new(10))); + USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user3, 10)); let user3_lp_amount = Uint128::from(200u128); let mut total_reward_index = Decimal256::one(); @@ -2936,7 +2934,7 @@ mod unit_tests { generator_proxy_debt: Default::default(), unlock_timestamp: 0, }; - let lockup_key = (&terraswap_lp_addr, &user_addr, U64Key::new(lock_duration)); + let lockup_key = (&terraswap_lp_addr, &user_addr, lock_duration); LOCKUP_INFO .save(deps.as_mut().storage, lockup_key, &lockup) .unwrap(); diff --git a/contracts/lockdrop/src/mock_querier.rs b/contracts/lockdrop/src/mock_querier.rs index d199ba08..3f106842 100644 --- a/contracts/lockdrop/src/mock_querier.rs +++ b/contracts/lockdrop/src/mock_querier.rs @@ -76,6 +76,7 @@ impl WasmMockQuerier { fee_address: Some(Addr::unchecked("fee_address")), generator_address: Some(Addr::unchecked("gen_address")), whitelist_code_id: 666, + coin_registry_address: Addr::unchecked("mock"), }) .into(), ), @@ -84,14 +85,14 @@ impl WasmMockQuerier { "minter_address" => match from_binary(msg).unwrap() { Pair {} => SystemResult::Ok( to_binary(&PairInfo { - asset_infos: [ + asset_infos: Vec::from([ AssetInfo::Token { contract_addr: Addr::unchecked("token1"), }, AssetInfo::Token { contract_addr: Addr::unchecked("token2"), }, - ], + ]), contract_addr: Addr::unchecked(contract_addr.as_str()), liquidity_token: Addr::unchecked("liquidity_token"), pair_type: PairType::Stable {}, diff --git a/contracts/token-sale/.cargo/config b/contracts/token-sale/.cargo/config deleted file mode 100644 index 336b618a..00000000 --- a/contracts/token-sale/.cargo/config +++ /dev/null @@ -1,4 +0,0 @@ -[alias] -wasm = "build --release --target wasm32-unknown-unknown" -unit-test = "test --lib" -schema = "run --example schema" diff --git a/contracts/token-sale/Cargo.toml b/contracts/token-sale/Cargo.toml deleted file mode 100644 index ead5d869..00000000 --- a/contracts/token-sale/Cargo.toml +++ /dev/null @@ -1,42 +0,0 @@ -[package] -name = "token_sale" -version = "0.1.0" -edition = "2021" -description = "Token sale contract" -authors = ["Sergey Ratiashvili "] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -crate-type = ["cdylib", "rlib"] - - -[profile.release] -opt-level = 3 -debug = false -rpath = false -lto = true -debug-assertions = false -codegen-units = 1 -panic = 'abort' -incremental = false -overflow-checks = true - -[features] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] -library = [] - -[dependencies] -cw2 = "0.13" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } -cosmwasm-std = { version = "1.0.0" } -cosmwasm-storage = { version = "1.0" } -cw-storage-plus = { version = "0.13", features = ["iterator"]} -schemars = "0.8.10" -thiserror = "1.0.24" -cw-asset = { version = "2.3.0", default-features=false } - -[dev-dependencies] -cosmwasm-schema = { version = "1.0.0" } \ No newline at end of file diff --git a/contracts/token-sale/examples/schema.rs b/contracts/token-sale/examples/schema.rs deleted file mode 100644 index da6a7bf3..00000000 --- a/contracts/token-sale/examples/schema.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2022 Neutron -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use token_sale::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; - -fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); -} diff --git a/contracts/token-sale/schema/execute_msg.json b/contracts/token-sale/schema/execute_msg.json deleted file mode 100644 index 2364c864..00000000 --- a/contracts/token-sale/schema/execute_msg.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ExecuteMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "deposit" - ], - "properties": { - "deposit": { - "type": "object" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "withdraw" - ], - "properties": { - "withdraw": { - "type": "object", - "properties": { - "amount": { - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "withdraw_tokens" - ], - "properties": { - "withdraw_tokens": { - "type": "object" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "setup_event" - ], - "properties": { - "setup_event": { - "type": "object", - "required": [ - "config" - ], - "properties": { - "config": { - "$ref": "#/definitions/EventConfig" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "withdraw_reserve" - ], - "properties": { - "withdraw_reserve": { - "type": "object" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "EventConfig": { - "type": "object", - "required": [ - "amount", - "stage1_begin", - "stage2_begin", - "stage2_end" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "stage1_begin": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "stage2_begin": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "stage2_end": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - }, - "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 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/token-sale/schema/instantiate_msg.json b/contracts/token-sale/schema/instantiate_msg.json deleted file mode 100644 index 7f9fb860..00000000 --- a/contracts/token-sale/schema/instantiate_msg.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InstantiateMsg", - "type": "object", - "required": [ - "base_denom", - "owner", - "reserve", - "token" - ], - "properties": { - "base_denom": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "reserve": { - "type": "string" - }, - "slot_duration": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "token": { - "type": "string" - } - } -} diff --git a/contracts/token-sale/schema/query_msg.json b/contracts/token-sale/schema/query_msg.json deleted file mode 100644 index 3a9c06b1..00000000 --- a/contracts/token-sale/schema/query_msg.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "config" - ], - "properties": { - "config": { - "type": "object" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "info" - ], - "properties": { - "info": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] -} diff --git a/contracts/token-sale/src/contract.rs b/contracts/token-sale/src/contract.rs deleted file mode 100644 index 9647213d..00000000 --- a/contracts/token-sale/src/contract.rs +++ /dev/null @@ -1,419 +0,0 @@ -use crate::{ - error::ContractError, - msg::{Config, EventConfig, ExecuteMsg, InfoResponse, InstantiateMsg, MigrateMsg, QueryMsg}, - state::{CONFIG, DEPOSITS, TOTAL_DEPOSIT}, -}; -use cosmwasm_std::{ - attr, entry_point, to_binary, Addr, BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Env, - MessageInfo, Response, StdError, StdResult, Uint128, -}; -use cw2::set_contract_version; -use cw_asset::{Asset, AssetInfo}; - -pub const DEFAULT_SLOT_DURATION: u64 = 60 * 60; - -const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME")); -const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); - -#[cfg_attr(not(feature = "library"), entry_point)] -pub fn instantiate( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: InstantiateMsg, -) -> Result { - set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - - let cfg = Config { - owner: deps.api.addr_validate(&msg.owner)?, - reserve: deps.api.addr_validate(&msg.reserve)?, - token: deps.api.addr_validate(&msg.token)?, - event_config: None, - base_denom: msg.base_denom, - slot_duration: msg.slot_duration.unwrap_or(DEFAULT_SLOT_DURATION), - }; - TOTAL_DEPOSIT.save(deps.storage, &Uint128::zero())?; - CONFIG.save(deps.storage, &cfg)?; - Ok(Response::new()) -} - -#[entry_point] -pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult { - Ok(Response::default()) -} - -// QUERIES - -#[entry_point] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::Config {} => query_config(deps), - QueryMsg::Info { address } => query_info(deps, env, address), - } -} - -fn query_balance(deps: &Deps, address: &Addr, denom: String) -> StdResult { - let balance = deps.querier.query_balance(address, denom)?; - Ok(balance.amount) -} - -fn query_config(deps: Deps) -> StdResult { - let config = CONFIG.load(deps.storage)?; - to_binary(&config) -} - -fn query_info(deps: Deps, env: Env, address: String) -> StdResult { - let time = env.block.time.seconds(); - let address = deps.api.addr_validate(&address)?; - let config = CONFIG.load(deps.storage)?; - let event_config = config - .event_config - .ok_or_else(|| StdError::generic_err("Event config is empty"))?; - let info = DEPOSITS.load(deps.storage, &address).unwrap_or_default(); - - let withdrawable_amount = if time > event_config.stage2_begin && !info.amount.is_zero() { - if info.withdrew_stage2 || time >= event_config.stage2_end { - Uint128::zero() - } else { - let current_slot = (event_config.stage2_end - time) / config.slot_duration; - let total_slots = - (event_config.stage2_end - event_config.stage2_begin) / config.slot_duration; - - let withdrawable_portion = - Decimal::from_ratio(current_slot + 1u64, total_slots).min(Decimal::one()); - - info.amount * withdrawable_portion - } - } else { - info.amount - }; - - let total_deposit = TOTAL_DEPOSIT.load(deps.storage)?; - let tokens_to_claim = if !total_deposit.is_zero() { - event_config - .amount - .multiply_ratio(info.amount, total_deposit) - } else { - Uint128::zero() - }; - - let clamable = - time >= event_config.stage2_end && !tokens_to_claim.is_zero() && !info.tokens_claimed; - - to_binary(&InfoResponse { - deposit: info.amount, - total_deposit, - withdrawable_amount, - tokens_to_claim, - clamable, - }) -} - -// EXECUTES - -#[entry_point] -pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: ExecuteMsg, -) -> Result { - deps.api - .debug(format!("WASMDEBUG: execute: received msg: {msg:?}").as_str()); - - match msg { - ExecuteMsg::WithdrawReserve {} => execute_withdraw_reserve(deps, env, info), - ExecuteMsg::Deposit {} => execute_deposit(deps, env, info), - ExecuteMsg::Withdraw { amount } => execute_withdraw(deps, env, info, amount), - ExecuteMsg::WithdrawTokens {} => execute_withdraw_tokens(deps, env, info), - ExecuteMsg::SetupEvent { config } => execute_setup_event(deps, env, info, config), - } -} - -fn execute_withdraw_reserve( - deps: DepsMut, - env: Env, - info: MessageInfo, -) -> Result { - let config = CONFIG.load(deps.storage)?; - let event_cfg = config - .event_config - .ok_or(ContractError::EmptyEventConfig {})?; - - if info.sender.as_str() != config.owner.as_str() { - return Err(ContractError::Unauthorized {}); - } - - if env.block.time.seconds() < event_cfg.stage2_end { - return Err(ContractError::InvalidReserveWithdraw { - text: "cannot withdraw funds yet".to_string(), - }); - } - - let balance = query_balance( - &deps.as_ref(), - &env.contract.address, - config.base_denom.clone(), - )?; - - let msg = BankMsg::Send { - to_address: config.reserve.to_string(), - amount: vec![Coin { - denom: config.base_denom, - amount: balance, - }], - }; - let res = Response::new().add_message(msg); - Ok(res.add_attributes(vec![ - attr("action", "withdraw_reserve"), - attr("amount", balance.to_string()), - ])) -} - -fn execute_deposit(deps: DepsMut, env: Env, info: MessageInfo) -> Result { - let config = CONFIG.load(deps.storage)?; - let event_config = config.event_config.unwrap(); - - if env.block.time.seconds() < event_config.stage1_begin { - return Err(ContractError::DepositError { - text: format!( - "deposit period is not start yet, now: {}, start: {}", - env.block.time.seconds(), - event_config.stage1_begin - ), - }); - } - - if env.block.time.seconds() >= event_config.stage2_begin { - return Err(ContractError::DepositError { - text: "deposit period is finished".to_string(), - }); - } - - if info.funds.len() != 1 { - return Err(ContractError::DepositError { - text: format!("deposit must be sent as one sum of {}", config.base_denom), - }); - } - - let coin = &info.funds[0]; - if coin.denom != config.base_denom || coin.amount == Uint128::zero() { - return Err(ContractError::DepositError { - text: format!("deposit must be positive amount of {}", config.base_denom), - }); - } - - DEPOSITS.update(deps.storage, &info.sender, |current| -> StdResult<_> { - let mut deposit = current.unwrap_or_default(); - deposit.amount += coin.amount; - - Ok(deposit) - })?; - - TOTAL_DEPOSIT.update(deps.storage, |amount| -> StdResult<_> { - Ok(amount + coin.amount) - })?; - - Ok(Response::new() - .add_attribute("action", "deposit") - .add_attribute("amount", coin.amount.to_string())) -} - -fn execute_withdraw( - deps: DepsMut, - env: Env, - info: MessageInfo, - amount: Option, -) -> Result { - let config = CONFIG.load(deps.storage)?; - let event_config = config.event_config.unwrap(); - let current_time = env.block.time.seconds(); - - if current_time >= event_config.stage2_end { - return Err(ContractError::WithdrawError { - text: "withdraw period is over".to_string(), - }); - } - let mut deposit_info = DEPOSITS - .load(deps.storage, &info.sender) - .unwrap_or_default(); - - if deposit_info.amount == Uint128::zero() { - return Err(ContractError::WithdrawError { - text: "nothing to withdraw".to_string(), - }); - } - - let withdrawable_amount = if current_time > event_config.stage2_begin { - if deposit_info.withdrew_stage2 { - return Err(ContractError::WithdrawError { - text: "a withdraw was already executed on phase 2".to_string(), - }); - } - - let current_slot = (event_config.stage2_end - current_time) / config.slot_duration; - let total_slots = - (event_config.stage2_end - event_config.stage2_begin) / config.slot_duration; - let withdrawable_portion = - Decimal::from_ratio(current_slot + 1u64, total_slots).min(Decimal::one()); - - deposit_info.withdrew_stage2 = true; - deposit_info.amount * withdrawable_portion - } else { - deposit_info.amount - }; - - let withdraw_amount = match amount { - None => withdrawable_amount, - Some(requested_amount) => { - if requested_amount > withdrawable_amount { - return Err(ContractError::WithdrawError { - text: format!( - "can not withdraw more than current withdrawable amount ({withdrawable_amount})" - ), - }); - } - if requested_amount == Uint128::zero() { - return Err(ContractError::WithdrawError { - text: "withdraw amount must be bigger than 0".to_string(), - }); - } - - requested_amount - } - }; - - deposit_info.amount -= withdraw_amount; - - DEPOSITS.save(deps.storage, &info.sender, &deposit_info)?; - - TOTAL_DEPOSIT.update(deps.storage, |curr| -> StdResult { - Ok(curr - withdraw_amount) - })?; - - let msg = BankMsg::Send { - to_address: info.sender.to_string(), - amount: vec![Coin { - denom: config.base_denom, - amount: withdraw_amount, - }], - }; - - let res = Response::new().add_message(msg); - - Ok(res.add_attributes(vec![ - attr("action", "withdraw"), - attr("amount", withdraw_amount.to_string()), - ])) -} - -pub fn execute_withdraw_tokens( - deps: DepsMut, - env: Env, - info: MessageInfo, -) -> Result { - let config = CONFIG.load(deps.storage)?; - let event_config = config.event_config.unwrap(); - - if env.block.time.seconds() < event_config.stage2_end { - return Err(ContractError::WithdrawTokensError { - text: "cannot withdraw tokens yet".to_string(), - }); - } - - let mut deposit_info = DEPOSITS.load(deps.storage, &info.sender).map_err(|_| { - ContractError::WithdrawTokensError { - text: "deposit information not found".to_string(), - } - })?; - if deposit_info.tokens_claimed { - return Err(ContractError::WithdrawTokensError { - text: "tokens were already claimed".to_string(), - }); - } - - let deposit_total = TOTAL_DEPOSIT.load(deps.storage)?; - let amount = event_config - .amount - .multiply_ratio(deposit_info.amount, deposit_total); - if amount == Uint128::zero() { - return Err(ContractError::WithdrawTokensError { - text: "no tokens available for withdraw".to_string(), - }); - } - - deposit_info.tokens_claimed = true; - - DEPOSITS.save(deps.storage, &info.sender, &deposit_info)?; - let to_send = Asset { - info: AssetInfo::Cw20(config.token), - amount, - }; - Ok(Response::new() - .add_message(to_send.transfer_msg(&info.sender)?) - .add_attributes(vec![ - attr("action", "withdraw_tokens"), - attr("withdraw_amount", amount.to_string()), - ])) -} - -pub fn execute_setup_event( - deps: DepsMut, - env: Env, - info: MessageInfo, - event_config: EventConfig, -) -> Result { - let mut config = CONFIG.load(deps.storage)?; - if info.sender.as_str() != config.owner.as_str() { - return Err(ContractError::Unauthorized {}); - } - - if config.event_config.is_some() { - return Err(ContractError::DuplicatePostInit {}); - } - - if env.block.time.seconds() > event_config.stage1_begin { - return Err(ContractError::InvalidEventConfig { - text: format!( - "stage1_begin must be in the future, but is {}", - env.block.time.seconds() - ), - }); - } - if event_config.stage1_begin > event_config.stage2_begin { - return Err(ContractError::InvalidEventConfig { - text: format!( - "stage2_begin must be after stage1_begin, but stage1_begin is {} and stage2_begin is {}", - event_config.stage1_begin, - event_config.stage2_begin - ), - }); - } - if event_config.stage2_begin > event_config.stage2_end { - return Err(ContractError::InvalidEventConfig { - text: format!( - "stage2_end must be after stage2_begin, but stage2_begin is {} and stage2_end is {}", - event_config.stage2_begin, event_config.stage2_end - ), - }); - } - if (event_config.stage2_end - event_config.stage2_begin) < config.slot_duration { - return Err(ContractError::InvalidEventConfig { - text: format!( - "stage2_end must be at least {} seconds after stage2_begin, but stage2_begin is {} and stage2_end is {}", - config.slot_duration, event_config.stage2_begin, event_config.stage2_end - ), - }); - } - - config.event_config = Some(event_config.clone()); - - CONFIG.save(deps.storage, &config)?; - - let to_send = Asset { - info: AssetInfo::Cw20(config.token), - amount: event_config.amount, - }; - - Ok(Response::new().add_message(to_send.transfer_from_msg(info.sender, env.contract.address)?)) -} diff --git a/contracts/token-sale/src/error.rs b/contracts/token-sale/src/error.rs deleted file mode 100644 index 35816cf0..00000000 --- a/contracts/token-sale/src/error.rs +++ /dev/null @@ -1,38 +0,0 @@ -use cosmwasm_std::StdError; -use thiserror::Error; - -#[derive(Error, Debug, PartialEq)] -pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), - - #[error("Unauthorized")] - Unauthorized {}, - - #[error("post_initialize called multiple times")] - DuplicatePostInit {}, - - #[error("Invalid TGE config {text}")] - InvalidEventConfig { text: String }, - - #[error("Empty TGE config")] - EmptyEventConfig {}, - - #[error("Invalid deposit: {text}")] - DepositError { text: String }, - - #[error("Invalid withdraw: {text}")] - WithdrawError { text: String }, - - #[error("Invalid withdraw tokens: {text}")] - WithdrawTokensError { text: String }, - - #[error("Invalid reserve withdraw: {text}")] - InvalidReserveWithdraw { text: String }, - - #[error("Invalid release tokens: {text}")] - ReleaseTokensError { text: String }, - - #[error("Fee can not be bigger than 1")] - InvalidFee {}, -} diff --git a/contracts/token-sale/src/lib.rs b/contracts/token-sale/src/lib.rs deleted file mode 100644 index a5abdbb0..00000000 --- a/contracts/token-sale/src/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod contract; -pub mod error; -pub mod msg; -pub mod state; diff --git a/contracts/token-sale/src/msg.rs b/contracts/token-sale/src/msg.rs deleted file mode 100644 index 91ffe4c2..00000000 --- a/contracts/token-sale/src/msg.rs +++ /dev/null @@ -1,86 +0,0 @@ -use cosmwasm_std::{Addr, Uint128}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum QueryMsg { - Config {}, - Info { address: String }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct InstantiateMsg { - pub owner: String, - pub base_denom: String, - pub reserve: String, - pub token: String, - pub slot_duration: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct MigrateMsg {} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum ExecuteMsg { - Deposit {}, - Withdraw { amount: Option }, - WithdrawTokens {}, - SetupEvent { config: EventConfig }, - WithdrawReserve {}, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -pub struct ConfigResponse { - pub owner: String, - pub receiver: String, - pub token: String, - pub launch_config: Option, - pub base_denom: String, - pub tokens_released: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -pub struct DepositResponse { - pub deposit: Uint128, - pub total_deposit: Uint128, - pub withdrawable_amount: Uint128, - pub tokens_to_claim: Uint128, - pub can_claim: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -pub struct Config { - pub owner: Addr, - pub token: Addr, - pub event_config: Option, - pub base_denom: String, - pub reserve: Addr, - pub slot_duration: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] -pub struct EventConfig { - pub amount: Uint128, - pub stage1_begin: u64, // timestamp when deposit and withdraw is allowed - pub stage2_begin: u64, // timestamp when withdraw is allowed one time. The percentage of allowed withdrawal decreases from 100% to 0% over time. - pub stage2_end: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema, Default)] -pub struct InfoResponse { - pub deposit: Uint128, - pub total_deposit: Uint128, - pub withdrawable_amount: Uint128, - pub tokens_to_claim: Uint128, - pub clamable: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema, Default)] -pub struct DepositInfo { - pub amount: Uint128, - pub withdrew_stage2: bool, - pub tokens_claimed: bool, -} diff --git a/contracts/token-sale/src/state.rs b/contracts/token-sale/src/state.rs deleted file mode 100644 index 6f471b26..00000000 --- a/contracts/token-sale/src/state.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::msg::{Config, DepositInfo}; -use cosmwasm_std::{Addr, Uint128}; -use cw_storage_plus::{Item, Map}; - -pub const CONFIG: Item = Item::new("config"); - -pub const TOTAL_TOKEN: Item = Item::new("total_token"); -pub const TOTAL_DEPOSIT: Item = Item::new("total_deposit"); -pub const DEPOSITS: Map<&Addr, DepositInfo> = Map::new("deposits"); diff --git a/packages/astroport_periphery/Cargo.toml b/packages/astroport_periphery/Cargo.toml index 2cd09217..c1e8ce78 100644 --- a/packages/astroport_periphery/Cargo.toml +++ b/packages/astroport_periphery/Cargo.toml @@ -13,7 +13,7 @@ backtraces = ["cosmwasm-std/backtraces"] [dependencies] cw20 = { version = "0.13" } -cw-storage-plus = "0.13" +cw-storage-plus = "0.15.1" cosmwasm-std = { version = "1.0" } terraswap = "2.6" astroport = { git = "https://github.com/astroport-fi/astroport-core.git", branch = "main" } diff --git a/packages/astroport_periphery/src/lib.rs b/packages/astroport_periphery/src/lib.rs index 036e3e80..0dead48a 100644 --- a/packages/astroport_periphery/src/lib.rs +++ b/packages/astroport_periphery/src/lib.rs @@ -5,6 +5,4 @@ pub mod lockdrop; pub mod simple_airdrop; pub mod utils; -use cw_storage_plus::IntKeyOld; - -pub type U64Key = IntKeyOld; +pub type U64Key = u64; From abfd583630ffbe498c6bbbe0bf1a85809f2f1986 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Fri, 3 Mar 2023 16:22:18 +0400 Subject: [PATCH 2/3] fmt --- contracts/auction/src/contract.rs | 4 +--- contracts/lockdrop/src/contract.rs | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/contracts/auction/src/contract.rs b/contracts/auction/src/contract.rs index e1f174fe..49bb4d1b 100644 --- a/contracts/auction/src/contract.rs +++ b/contracts/auction/src/contract.rs @@ -67,9 +67,7 @@ pub fn instantiate( .unwrap_or(info.sender), astro_token_address: deps.api.addr_validate(&msg.astro_token_address)?, airdrop_contract_address: deps.api.addr_validate(&msg.airdrop_contract_address)?, - lockdrop_contract_address: deps.api.addr_validate( - &msg.lockdrop_contract_address, - )?, + lockdrop_contract_address: deps.api.addr_validate(&msg.lockdrop_contract_address)?, pool_info: None, generator_contract: None, astro_incentive_amount: None, diff --git a/contracts/lockdrop/src/contract.rs b/contracts/lockdrop/src/contract.rs index f237ac6c..637a38bb 100644 --- a/contracts/lockdrop/src/contract.rs +++ b/contracts/lockdrop/src/contract.rs @@ -2076,11 +2076,7 @@ fn callback_distribute_asset_reward( let config = CONFIG.load(deps.storage)?; - let lockup_key = ( - &terraswap_lp_token, - &user_address, - lock_duration, - ); + let lockup_key = (&terraswap_lp_token, &user_address, lock_duration); let mut user_reward = Uint128::zero(); // get only lockups that have not yet been withdrawn let lockup_info_opt = LOCKUP_INFO @@ -2759,18 +2755,15 @@ mod unit_tests { let total_lp_amount = Uint128::from(1000u128); // user1 with 10% share let user1 = Addr::unchecked("user1"); - let user1_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user1, 10)); + let user1_path = USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user1, 10)); let user1_lp_amount = Uint128::from(100u128); // user2 with 70% share let user2 = Addr::unchecked("user2"); - let user2_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user2, 10)); + let user2_path = USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user2, 10)); let user2_lp_amount = Uint128::from(700u128); // user3 with 20% share let user3 = Addr::unchecked("user3"); - let user3_path = - USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user3, 10)); + let user3_path = USERS_ASSET_REWARD_INDEX.key((&terraswap_lp_token, &user3, 10)); let user3_lp_amount = Uint128::from(200u128); let mut total_reward_index = Decimal256::one(); From 310544d24f5c8ea62bb87b10ca54132c5910f341 Mon Sep 17 00:00:00 2001 From: Murad Karammaev Date: Fri, 3 Mar 2023 15:34:28 +0300 Subject: [PATCH 3/3] fix clippy warnings, run `make build` --- contracts/auction/schema/execute_msg.json | 2 +- contracts/lockdrop/schema/execute_msg.json | 14 ++-- .../schema/lock_up_info_response.json | 8 +- contracts/lockdrop/schema/pool_info.json | 8 +- .../lockdrop/schema/user_info_response.json | 8 +- contracts/lockdrop/src/contract.rs | 74 +++++++++---------- contracts/lockdrop/src/state.rs | 6 +- 7 files changed, 62 insertions(+), 58 deletions(-) diff --git a/contracts/auction/schema/execute_msg.json b/contracts/auction/schema/execute_msg.json index badd3eff..44b62eb7 100644 --- a/contracts/auction/schema/execute_msg.json +++ b/contracts/auction/schema/execute_msg.json @@ -145,7 +145,7 @@ "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", + "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" }, "CallbackMsg": { diff --git a/contracts/lockdrop/schema/execute_msg.json b/contracts/lockdrop/schema/execute_msg.json index 7108f4b4..bbec3c45 100644 --- a/contracts/lockdrop/schema/execute_msg.json +++ b/contracts/lockdrop/schema/execute_msg.json @@ -363,7 +363,6 @@ "type": "string" }, "Asset": { - "title": "Description", "description": "This enum describes a Terra asset (native or CW20).", "type": "object", "required": [ @@ -387,10 +386,11 @@ } ] } - } + }, + "additionalProperties": false }, "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"terra...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", "oneOf": [ { "description": "Non-native Token", @@ -408,7 +408,8 @@ "contract_addr": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -429,7 +430,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -437,7 +439,7 @@ ] }, "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", + "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" }, "CallbackMsg": { diff --git a/contracts/lockdrop/schema/lock_up_info_response.json b/contracts/lockdrop/schema/lock_up_info_response.json index 579c103a..6f18d1bd 100644 --- a/contracts/lockdrop/schema/lock_up_info_response.json +++ b/contracts/lockdrop/schema/lock_up_info_response.json @@ -124,7 +124,7 @@ "type": "string" }, "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"terra...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", "oneOf": [ { "description": "Non-native Token", @@ -142,7 +142,8 @@ "contract_addr": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -163,7 +164,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/lockdrop/schema/pool_info.json b/contracts/lockdrop/schema/pool_info.json index 0a01f7dd..a8c17971 100644 --- a/contracts/lockdrop/schema/pool_info.json +++ b/contracts/lockdrop/schema/pool_info.json @@ -74,7 +74,7 @@ "type": "string" }, "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"terra...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", "oneOf": [ { "description": "Non-native Token", @@ -92,7 +92,8 @@ "contract_addr": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -113,7 +114,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/lockdrop/schema/user_info_response.json b/contracts/lockdrop/schema/user_info_response.json index c020d525..a0dd1bde 100644 --- a/contracts/lockdrop/schema/user_info_response.json +++ b/contracts/lockdrop/schema/user_info_response.json @@ -59,7 +59,7 @@ "type": "string" }, "AssetInfo": { - "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"terra...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", "oneOf": [ { "description": "Non-native Token", @@ -77,7 +77,8 @@ "contract_addr": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -98,7 +99,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/lockdrop/src/contract.rs b/contracts/lockdrop/src/contract.rs index 637a38bb..4528d28a 100644 --- a/contracts/lockdrop/src/contract.rs +++ b/contracts/lockdrop/src/contract.rs @@ -1093,39 +1093,36 @@ pub fn handle_increase_lockup( let lockup_key = (&terraswap_lp_token, &user_address, duration); - let lockup_info = match LOCKUP_INFO.compatible_may_load( - deps.as_ref(), - lockup_key.clone(), - &config.generator, - )? { - Some(mut li) => { - li.lp_units_locked = li.lp_units_locked.checked_add(amount)?; - li - } - None => { - if config.max_positions_per_user == user_info.lockup_positions_index { - return Err(StdError::generic_err(format!( - "Users can only have max {} lockup positions", - config.max_positions_per_user - ))); + let lockup_info = + match LOCKUP_INFO.compatible_may_load(deps.as_ref(), lockup_key, &config.generator)? { + Some(mut li) => { + li.lp_units_locked = li.lp_units_locked.checked_add(amount)?; + li } - // Update number of lockup positions the user is having - user_info.lockup_positions_index += 1; - - LockupInfoV2 { - lp_units_locked: amount, - astroport_lp_transferred: None, - astro_rewards: Uint128::zero(), - unlock_timestamp: config.init_timestamp - + config.deposit_window - + config.withdrawal_window - + (duration * SECONDS_PER_WEEK), - generator_astro_debt: Uint128::zero(), - generator_proxy_debt: Default::default(), - withdrawal_flag: false, + None => { + if config.max_positions_per_user == user_info.lockup_positions_index { + return Err(StdError::generic_err(format!( + "Users can only have max {} lockup positions", + config.max_positions_per_user + ))); + } + // Update number of lockup positions the user is having + user_info.lockup_positions_index += 1; + + LockupInfoV2 { + lp_units_locked: amount, + astroport_lp_transferred: None, + astro_rewards: Uint128::zero(), + unlock_timestamp: config.init_timestamp + + config.deposit_window + + config.withdrawal_window + + (duration * SECONDS_PER_WEEK), + generator_astro_debt: Uint128::zero(), + generator_proxy_debt: Default::default(), + withdrawal_flag: false, + } } - } - }; + }; // SAVE UPDATED STATE LOCKUP_INFO.save(deps.storage, lockup_key, &lockup_info)?; @@ -1178,7 +1175,7 @@ pub fn handle_withdraw_from_lockup( let user_address = info.sender; let lockup_key = (&terraswap_lp_token, &user_address, duration); let mut lockup_info = - LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; + LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key, &config.generator)?; // CHECK :: Has user already withdrawn LP tokens once post the deposit window closure state if lockup_info.withdrawal_flag { @@ -1394,8 +1391,7 @@ pub fn handle_claim_rewards_and_unlock_for_lockup( // Check is there lockup or not ? let lockup_key = (&terraswap_lp_token, &user_address, duration); - let lockup_info = - LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; + let lockup_info = LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key, &config.generator)?; // CHECK :: Can the Lockup position be unlocked or not ? if withdraw_lp_stake && env.block.time.seconds() < lockup_info.unlock_timestamp { @@ -1726,7 +1722,7 @@ pub fn callback_withdraw_user_rewards_for_lockup_optional_withdraw( let mut pool_info = ASSET_POOLS.load(deps.storage, &terraswap_lp_token)?; let lockup_key = (&terraswap_lp_token, &user_address, duration); let mut lockup_info = - LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; + LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key, &config.generator)?; let mut user_info = USER_INFO .may_load(deps.storage, &user_address)? @@ -2002,7 +1998,7 @@ pub fn callback_deposit_liquidity_in_astroport( contract_addr: astroport_pool.to_string(), funds: coins, msg: to_binary(&astroport::pair::ExecuteMsg::ProvideLiquidity { - assets: assets.clone().try_into().unwrap(), + assets: assets.clone(), slippage_tolerance, auto_stake: None, receiver: None, @@ -2080,7 +2076,7 @@ fn callback_distribute_asset_reward( let mut user_reward = Uint128::zero(); // get only lockups that have not yet been withdrawn let lockup_info_opt = LOCKUP_INFO - .compatible_may_load(deps.as_ref(), lockup_key.clone(), &config.generator)? + .compatible_may_load(deps.as_ref(), lockup_key, &config.generator)? .filter(|lock_info| lock_info.astroport_lp_transferred.is_none()); if let Some(lockup_info) = lockup_info_opt { let user_index_lp_path = USERS_ASSET_REWARD_INDEX.key(lockup_key); @@ -2396,7 +2392,7 @@ pub fn query_pending_asset_reward( let lockup_key = (&terraswap_lp_token, &user_address, duration); let lockup_info_opt = LOCKUP_INFO - .compatible_may_load(deps, lockup_key.clone(), &config.generator)? + .compatible_may_load(deps, lockup_key, &config.generator)? .filter(|lock_info| lock_info.astroport_lp_transferred.is_none()); let mut user_reward = Uint128::zero(); @@ -2595,7 +2591,7 @@ fn update_user_lockup_positions_and_calc_rewards( let pool_info = ASSET_POOLS.load(deps.storage, &pool)?; let lockup_key = (&pool, user_address, duration); let mut lockup_info = - LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key.clone(), &config.generator)?; + LOCKUP_INFO.compatible_load(deps.as_ref(), lockup_key, &config.generator)?; if lockup_info.astro_rewards == Uint128::zero() { // Weighted lockup balance (using terraswap LP units to calculate as pool's total weighted balance is calculated on terraswap LP deposits summed over each deposit tx) diff --git a/contracts/lockdrop/src/state.rs b/contracts/lockdrop/src/state.rs index 2bef3c46..882664e6 100644 --- a/contracts/lockdrop/src/state.rs +++ b/contracts/lockdrop/src/state.rs @@ -48,8 +48,8 @@ impl CompatibleLoader<(&Addr, &Addr, U64Key), LockupInfoV2> key: (&Addr, &Addr, U64Key), generator: &Option, ) -> StdResult { - self.load(deps.storage, key.clone()).or_else(|_| { - let old_lockup_info = OLD_LOCKUP_INFO.load(deps.storage, key.clone())?; + self.load(deps.storage, key).or_else(|_| { + let old_lockup_info = OLD_LOCKUP_INFO.load(deps.storage, key)?; let mut generator_proxy_debt = RestrictedVector::default(); let generator = generator.as_ref().expect("Generator should be set!"); @@ -96,7 +96,7 @@ impl CompatibleLoader<(&Addr, &Addr, U64Key), LockupInfoV2> key: (&Addr, &Addr, U64Key), generator: &Option, ) -> StdResult> { - if !OLD_LOCKUP_INFO.has(deps.storage, key.clone()) { + if !OLD_LOCKUP_INFO.has(deps.storage, key) { return Ok(None); } Some(self.compatible_load(deps, key, generator)).transpose()