From 00bbcdf3b72d70ab21ff8c1cdc721c3afb401e6b Mon Sep 17 00:00:00 2001 From: Yongwoo Lee Date: Wed, 2 Jun 2021 15:12:48 +0900 Subject: [PATCH] feat!: remove cosmwasm-ext (#117) --- .github/workflows/tests.yml | 145 +- contracts/collection-tester/.cargo/config | 6 - contracts/collection-tester/Cargo.lock | 1534 ----------------- contracts/collection-tester/Cargo.toml | 27 - .../collection-tester/examples/schema.rs | 19 - .../collection-tester/schema/handle_msg.json | 735 -------- .../collection-tester/schema/init_msg.json | 5 - .../collection-tester/schema/query_msg.json | 295 ---- contracts/collection-tester/schema/state.json | 22 - contracts/collection-tester/src/contract.rs | 1221 ------------- contracts/collection-tester/src/lib.rs | 6 - contracts/collection-tester/src/msg.rs | 203 --- contracts/collection-tester/src/state.rs | 20 - contracts/token-tester/.cargo/config | 6 - contracts/token-tester/Cargo.lock | 1530 ---------------- contracts/token-tester/Cargo.toml | 27 - contracts/token-tester/examples/schema.rs | 19 - contracts/token-tester/schema/handle_msg.json | 336 ---- contracts/token-tester/schema/init_msg.json | 5 - contracts/token-tester/schema/query_msg.json | 149 -- contracts/token-tester/schema/state.json | 22 - contracts/token-tester/src/contract.rs | 591 ------- contracts/token-tester/src/lib.rs | 6 - contracts/token-tester/src/msg.rs | 104 -- contracts/token-tester/src/state.rs | 20 - packages/ext/.cargo/config | 5 - packages/ext/Cargo.lock | 188 -- packages/ext/Cargo.toml | 18 - packages/ext/README.md | 1 - packages/ext/examples/schema.rs | 18 - ..._collection_route_and__collection_msg.json | 683 -------- ...apper_for__token_route_and__token_msg.json | 330 ---- packages/ext/src/collection.rs | 512 ------ packages/ext/src/lib.rs | 24 - packages/ext/src/msg.rs | 56 - packages/ext/src/msg_collection.rs | 174 -- packages/ext/src/msg_token.rs | 137 -- packages/ext/src/querier_collection.rs | 403 ----- packages/ext/src/querier_token.rs | 185 -- packages/ext/src/query.rs | 60 - packages/ext/src/token.rs | 37 - 41 files changed, 2 insertions(+), 9882 deletions(-) delete mode 100644 contracts/collection-tester/.cargo/config delete mode 100644 contracts/collection-tester/Cargo.lock delete mode 100644 contracts/collection-tester/Cargo.toml delete mode 100644 contracts/collection-tester/examples/schema.rs delete mode 100644 contracts/collection-tester/schema/handle_msg.json delete mode 100644 contracts/collection-tester/schema/init_msg.json delete mode 100644 contracts/collection-tester/schema/query_msg.json delete mode 100644 contracts/collection-tester/schema/state.json delete mode 100644 contracts/collection-tester/src/contract.rs delete mode 100644 contracts/collection-tester/src/lib.rs delete mode 100644 contracts/collection-tester/src/msg.rs delete mode 100644 contracts/collection-tester/src/state.rs delete mode 100644 contracts/token-tester/.cargo/config delete mode 100644 contracts/token-tester/Cargo.lock delete mode 100644 contracts/token-tester/Cargo.toml delete mode 100644 contracts/token-tester/examples/schema.rs delete mode 100644 contracts/token-tester/schema/handle_msg.json delete mode 100644 contracts/token-tester/schema/init_msg.json delete mode 100644 contracts/token-tester/schema/query_msg.json delete mode 100644 contracts/token-tester/schema/state.json delete mode 100644 contracts/token-tester/src/contract.rs delete mode 100644 contracts/token-tester/src/lib.rs delete mode 100644 contracts/token-tester/src/msg.rs delete mode 100644 contracts/token-tester/src/state.rs delete mode 100644 packages/ext/.cargo/config delete mode 100644 packages/ext/Cargo.lock delete mode 100644 packages/ext/Cargo.toml delete mode 100644 packages/ext/README.md delete mode 100644 packages/ext/examples/schema.rs delete mode 100644 packages/ext/schema/link_msg_wrapper_for__collection_route_and__collection_msg.json delete mode 100644 packages/ext/schema/link_msg_wrapper_for__token_route_and__token_msg.json delete mode 100644 packages/ext/src/collection.rs delete mode 100644 packages/ext/src/lib.rs delete mode 100644 packages/ext/src/msg.rs delete mode 100644 packages/ext/src/msg_collection.rs delete mode 100644 packages/ext/src/msg_token.rs delete mode 100644 packages/ext/src/querier_collection.rs delete mode 100644 packages/ext/src/querier_token.rs delete mode 100644 packages/ext/src/query.rs delete mode 100644 packages/ext/src/token.rs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8b7995f57..d7e287cf7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -145,66 +145,11 @@ jobs: working-directory: ${{env.working-directory}} run: cargo build --locked - name: Run unit tests - working-directory: ${{env.working-directory}} - run: cargo test --locked - - name: Run unit tests (with iterator support) - working-directory: ${{env.working-directory}} - run: cargo test --locked --features iterator - - package_ext: - name: package_ext - runs-on: ubuntu-latest - env: - working-directory: ./packages/ext - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.50.0 - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-package_ext-rust:1.50.0-${{ hashFiles('Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build library for native target (no features) - working-directory: ${{env.working-directory}} - run: cargo build --locked --no-default-features - - name: Build library for wasm target (no features) - working-directory: ${{env.working-directory}} - run: cargo wasm --locked --no-default-features - - name: Run unit tests (no features) - working-directory: ${{env.working-directory}} - run: cargo test --locked --no-default-features - - name: Build library for native target (all features) - working-directory: ${{env.working-directory}} - run: cargo build --locked - - name: Build library for wasm target (all features) - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Run unit tests (all features) working-directory: ${{env.working-directory}} run: cargo test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date + - name: Run unit tests (with iterator support) working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi + run: cargo test --locked --features iterator package_vm: name: package_vm @@ -609,92 +554,6 @@ jobs: exit 1 fi - contract_token_tester: - name: contract_token_tester - runs-on: ubuntu-latest - env: - working-directory: ./contracts/token-tester - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_token_tester-rust:1.50.0-${{ hashFiles('Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: RUST_BACKTRACE=1 cargo unit-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - - contract_collection_tester: - name: contract_collection_tester - runs-on: ubuntu-latest - env: - working-directory: ./contracts/collection-tester - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: wasm32-unknown-unknown - profile: minimal - override: true - - name: Cache cargo - uses: actions/cache@v2 - with: - path: ~/.cargo - key: cargocache-v2-contract_collection_tester-rust:1.50.0-${{ hashFiles('Cargo.lock') }} - - name: Version information - run: rustc --version; cargo --version; rustup --version; rustup target list --installed - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown && rustup target list --installed - - name: Build wasm binary - working-directory: ${{env.working-directory}} - run: cargo wasm --locked - - name: Unit tests - working-directory: ${{env.working-directory}} - run: RUST_BACKTRACE=1 cargo unit-test --locked - - name: Build and run schema generator - working-directory: ${{env.working-directory}} - run: cargo schema --locked - - name: Ensure schemas are up-to-date - working-directory: ${{env.working-directory}} - run: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 - fi - fmt: name: fmt runs-on: ubuntu-latest diff --git a/contracts/collection-tester/.cargo/config b/contracts/collection-tester/.cargo/config deleted file mode 100644 index 7c115322a..000000000 --- a/contracts/collection-tester/.cargo/config +++ /dev/null @@ -1,6 +0,0 @@ -[alias] -wasm = "build --release --target wasm32-unknown-unknown" -wasm-debug = "build --target wasm32-unknown-unknown" -unit-test = "test --lib --features backtraces" -integration-test = "test --test integration" -schema = "run --example schema" diff --git a/contracts/collection-tester/Cargo.lock b/contracts/collection-tester/Cargo.lock deleted file mode 100644 index a2f81a58d..000000000 --- a/contracts/collection-tester/Cargo.lock +++ /dev/null @@ -1,1534 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" -dependencies = [ - "gimli 0.23.0", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "backtrace" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" -dependencies = [ - "byteorder", - "serde", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bitvec" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98fcd36dda4e17b7d7abc64cb549bf0201f4ab71e00700c798ca7e62ed3761fa" -dependencies = [ - "funty", - "radium", - "wyz", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "cc" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clru" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591ff76ca0691bd91c1b0b5b987e5cf93b21ec810ad96665c5a569c60846dd93" - -[[package]] -name = "collection-tester" -version = "0.14.0-beta1" -dependencies = [ - "cosmwasm-ext", - "cosmwasm-schema", - "cosmwasm-std", - "cosmwasm-storage", - "cosmwasm-vm", - "schemars", - "serde", - "snafu", -] - -[[package]] -name = "const-oid" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f6b64db6932c7e49332728e3a6bd82c6b7e16016607d20923b537c3bc4c0d5f" - -[[package]] -name = "const_fn" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" - -[[package]] -name = "cosmwasm-crypto" -version = "0.14.0-0.3.0" -dependencies = [ - "digest", - "ed25519-zebra", - "k256", - "rand_core 0.5.1", - "thiserror", -] - -[[package]] -name = "cosmwasm-derive" -version = "0.14.0-0.3.0" -dependencies = [ - "syn", -] - -[[package]] -name = "cosmwasm-ext" -version = "0.14.0-0.3.0" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", - "serde_json", -] - -[[package]] -name = "cosmwasm-schema" -version = "0.14.0-0.3.0" -dependencies = [ - "schemars", - "serde_json", -] - -[[package]] -name = "cosmwasm-std" -version = "0.14.0-0.3.0" -dependencies = [ - "base64", - "cosmwasm-crypto", - "cosmwasm-derive", - "schemars", - "serde", - "serde-json-wasm", - "thiserror", -] - -[[package]] -name = "cosmwasm-storage" -version = "0.14.0-0.3.0" -dependencies = [ - "cosmwasm-std", - "serde", -] - -[[package]] -name = "cosmwasm-vm" -version = "0.14.0-0.3.0" -dependencies = [ - "clru", - "cosmwasm-crypto", - "cosmwasm-std", - "hex", - "parity-wasm", - "schemars", - "serde", - "serde_json", - "sha2", - "thiserror", - "wasmer", - "wasmer-middlewares", -] - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "cranelift-bforest" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1" -dependencies = [ - "byteorder", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli 0.22.0", - "log", - "regalloc", - "smallvec", - "target-lexicon", - "thiserror", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7" -dependencies = [ - "cranelift-codegen-shared", - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" - -[[package]] -name = "cranelift-entity" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6" -dependencies = [ - "serde", -] - -[[package]] -name = "cranelift-frontend" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" -dependencies = [ - "cfg-if 1.0.0", - "const_fn", - "crossbeam-utils", - "lazy_static", - "memoffset 0.5.6", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "const_fn", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" -dependencies = [ - "byteorder", - "digest", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "der" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f59c66c30bb7445c8320a5f9233e437e3572368099f25532a59054328899b4" -dependencies = [ - "const-oid", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "dynasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7d1242462849390bb2ad38aeed769499f1afc7383affa2ab0c1baa894c0200" -dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dynasmrt" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dd4d1d5ca12258cef339a57a7643e8b233a42dea9bb849630ddd9dd7726aa9" -dependencies = [ - "byteorder", - "dynasm", - "memmap2", -] - -[[package]] -name = "ecdsa" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fbdb4ff710acb4db8ca29f93b897529ea6d6a45626d5183b47e012aa6ae7e4" -dependencies = [ - "elliptic-curve", - "hmac", - "signature", -] - -[[package]] -name = "ed25519-zebra" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a128b76af6dd4b427e34a6fd43dc78dbfe73672ec41ff615a2414c1a0ad0409" -dependencies = [ - "curve25519-dalek", - "hex", - "rand_core 0.5.1", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "elliptic-curve" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2db227e61a43a34915680bdda462ec0e212095518020a88a1f91acd16092c39" -dependencies = [ - "bitvec", - "digest", - "ff", - "funty", - "generic-array", - "group", - "pkcs8", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "enumset" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd795df6708a599abf1ee10eacc72efd052b7a5f70fdf0715e4d5151a6db9c3" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19c52f9ec503c8a68dc04daf71a04b07e690c32ab1a8b68e33897f255269d47" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "ff" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01646e077d4ebda82b73f1bca002ea1e91561a77df2431a9e79729bcc31950ef" -dependencies = [ - "bitvec", - "rand_core 0.5.1", - "subtle", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "funty" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.10.2+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" - -[[package]] -name = "group" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11f9f5fbf1943b48ae7c2bf6846e7d827a512d1be4f23af708f5ca5d01dde1" -dependencies = [ - "ff", - "rand_core 0.5.1", - "subtle", -] - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - -[[package]] -name = "hermit-abi" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" - -[[package]] -name = "hmac" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "k256" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf02ecc966e1b7e8db1c81ac8f321ba24d1cfab5b634961fab10111f015858e1" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" - -[[package]] -name = "libc" -version = "0.2.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" - -[[package]] -name = "libloading" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" -dependencies = [ - "cfg-if 1.0.0", - "winapi", -] - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "memmap2" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "more-asserts" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" -dependencies = [ - "crc32fast", - "indexmap", -] - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-wasm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d17797de36b94bc5f73edad736fd0a77ce5ab64dd622f809c1eead8c91fa6564" - -[[package]] -name = "pin-project-lite" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" - -[[package]] -name = "pkcs8" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4839a901843f3942576e65857f0ebf2e190ef7024d3c62a94099ba3f819ad1d" -dependencies = [ - "der", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha", - "rand_core 0.6.2", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.2", -] - -[[package]] -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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" -dependencies = [ - "getrandom 0.2.2", -] - -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core 0.6.2", -] - -[[package]] -name = "rayon" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regalloc" -version = "0.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "schemars" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be77ed66abed6954aabf6a3e31a84706bedbf93750d267e92ef4a6d90bbd6a61" -dependencies = [ - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11af7a475c9ee266cfaa9e303a47c830ebe072bf3101ab907a7b7b9d816fa01d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "1.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-json-wasm" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50eef3672ec8fa45f3457fd423ba131117786784a895548021976117c1ded449" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_derive_internals" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8" -dependencies = [ - "block-buffer", - "cfg-if 1.0.0", - "cpuid-bool", - "digest", - "opaque-debug", -] - -[[package]] -name = "signature" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" -dependencies = [ - "digest", - "rand_core 0.5.1", -] - -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - -[[package]] -name = "snafu" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c4e6046e4691afe918fd1b603fd6e515bcda5388a1092a9edbada307d159f09" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7073448732a89f2f3e6581989106067f403d378faeafb4a50812eb814170d3e5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" - -[[package]] -name = "syn" -version = "1.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "target-lexicon" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" - -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" -dependencies = [ - "cfg-if 1.0.0", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasmer" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70cfae554988d904d64ca17ab0e7cd652ee5c8a0807094819c1ea93eb9d6866" -dependencies = [ - "cfg-if 0.1.10", - "indexmap", - "more-asserts", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-engine", - "wasmer-engine-jit", - "wasmer-engine-native", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-compiler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7732a9cab472bd921d5a0c422f45b3d03f62fa2c40a89e0770cef6d47e383e" -dependencies = [ - "enumset", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb9395f094e1d81534f4c5e330ed4cdb424e8df870d29ad585620284f5fddb" -dependencies = [ - "cranelift-codegen", - "cranelift-frontend", - "gimli 0.22.0", - "more-asserts", - "rayon", - "serde", - "smallvec", - "tracing", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426ae6ef0f606ca815510f3e2ef6f520e217514bfb7a664defe180b9a9e75d07" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "lazy_static", - "more-asserts", - "rayon", - "serde", - "smallvec", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-derive" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b86dcd2c3efdb8390728a2b56f762db07789aaa5aa872a9dc776ba3a7912ed" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmer-engine" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efe4667d6bd888f26ae8062a63a9379fa697415b4b4e380f33832e8418fd71b5" -dependencies = [ - "backtrace", - "bincode", - "lazy_static", - "memmap2", - "more-asserts", - "rustc-demangle", - "serde", - "serde_bytes", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-engine-jit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26770be802888011b4a3072f2a282fc2faa68aa48c71b3db6252a3937a85f3da" -dependencies = [ - "bincode", - "cfg-if 0.1.10", - "region", - "serde", - "serde_bytes", - "wasmer-compiler", - "wasmer-engine", - "wasmer-types", - "wasmer-vm", - "winapi", -] - -[[package]] -name = "wasmer-engine-native" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb4083a6c69f2cd4b000b82a80717f37c6cc2e536aee3a8ffe9af3edc276a8b" -dependencies = [ - "bincode", - "cfg-if 0.1.10", - "leb128", - "libloading", - "serde", - "tempfile", - "tracing", - "wasmer-compiler", - "wasmer-engine", - "wasmer-object", - "wasmer-types", - "wasmer-vm", - "which", -] - -[[package]] -name = "wasmer-middlewares" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "547baee2c0733cf436db7d137a8d1f86737a6321fc0fe6cd74caecf6f759c3c4" -dependencies = [ - "wasmer", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-object" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf8e0c12b82ff81ebecd30d7e118be5fec871d6de885a90eeb105df0a769a7b" -dependencies = [ - "object", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-types" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f4ac28c2951cd792c18332f03da523ed06b170f5cf6bb5b1bdd7e36c2a8218" -dependencies = [ - "cranelift-entity", - "serde", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7635ba0b6d2fd325f588d69a950ad9fa04dddbf6ad08b6b2a183146319bf6ae" -dependencies = [ - "backtrace", - "cc", - "cfg-if 0.1.10", - "indexmap", - "libc", - "memoffset 0.6.1", - "more-asserts", - "region", - "serde", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.65.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" - -[[package]] -name = "wast" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5ae96da18bb5926341516fd409b5a8ce4e4714da7f0a1063d3b20ac9f9a1e1" -dependencies = [ - "leb128", -] - -[[package]] -name = "wat" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0fa059022c5dabe129f02b429d67086400deb8277f89c975555dacc1dadbcc" -dependencies = [ - "wast", -] - -[[package]] -name = "which" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" -dependencies = [ - "libc", - "thiserror", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" - -[[package]] -name = "zeroize" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" diff --git a/contracts/collection-tester/Cargo.toml b/contracts/collection-tester/Cargo.toml deleted file mode 100644 index 10303328e..000000000 --- a/contracts/collection-tester/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "collection-tester" -version = "0.14.0-beta1" -authors = ["shiki.tak"] -edition = "2018" -description = "simple tester for cosmwasm/ext" - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -default = ["cranelift"] -# For quicker tests, cargo test --lib. for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces", "cosmwasm-vm/backtraces"] -cranelift = ["cosmwasm-vm/cranelift"] - -[dependencies] -cosmwasm-ext = { path = "../../packages/ext" } -cosmwasm-std = { path = "../../packages/std", features = ["iterator"] } -cosmwasm-storage = { path = "../../packages/storage", features = ["iterator"] } -schemars = "0.7" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } -snafu = { version = "0.6.3" } - -[dev-dependencies] -cosmwasm-schema = { path = "../../packages/schema" } -cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] } diff --git a/contracts/collection-tester/examples/schema.rs b/contracts/collection-tester/examples/schema.rs deleted file mode 100644 index 1ea654fd4..000000000 --- a/contracts/collection-tester/examples/schema.rs +++ /dev/null @@ -1,19 +0,0 @@ -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; - -use collection_tester::msg::{HandleMsg, InitMsg, QueryMsg}; -use collection_tester::state::State; - -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!(InitMsg), &out_dir); - export_schema(&schema_for!(HandleMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); - export_schema(&schema_for!(State), &out_dir); -} diff --git a/contracts/collection-tester/schema/handle_msg.json b/contracts/collection-tester/schema/handle_msg.json deleted file mode 100644 index ef75f28b5..000000000 --- a/contracts/collection-tester/schema/handle_msg.json +++ /dev/null @@ -1,735 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "HandleMsg", - "anyOf": [ - { - "type": "object", - "required": [ - "create" - ], - "properties": { - "create": { - "type": "object", - "required": [ - "base_img_uri", - "meta", - "name", - "owner" - ], - "properties": { - "base_img_uri": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "issue_nft" - ], - "properties": { - "issue_nft": { - "type": "object", - "required": [ - "contract_id", - "meta", - "name", - "owner" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "issue_ft" - ], - "properties": { - "issue_ft": { - "type": "object", - "required": [ - "amount", - "contract_id", - "decimals", - "meta", - "mintable", - "name", - "owner", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "decimals": { - "$ref": "#/definitions/Uint128" - }, - "meta": { - "type": "string" - }, - "mintable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "mint_nft" - ], - "properties": { - "mint_nft": { - "type": "object", - "required": [ - "contract_id", - "from", - "to", - "token_types" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "token_types": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "mint_ft" - ], - "properties": { - "mint_ft": { - "type": "object", - "required": [ - "contract_id", - "from", - "to", - "tokens" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "tokens": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn_nft" - ], - "properties": { - "burn_nft": { - "type": "object", - "required": [ - "contract_id", - "from", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn_nft_from" - ], - "properties": { - "burn_nft_from": { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn_ft" - ], - "properties": { - "burn_ft": { - "type": "object", - "required": [ - "amounts", - "contract_id", - "from" - ], - "properties": { - "amounts": { - "type": "array", - "items": { - "type": "string" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn_ft_from" - ], - "properties": { - "burn_ft_from": { - "type": "object", - "required": [ - "amounts", - "contract_id", - "from", - "proxy" - ], - "properties": { - "amounts": { - "type": "array", - "items": { - "type": "string" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer_nft" - ], - "properties": { - "transfer_nft": { - "type": "object", - "required": [ - "contract_id", - "from", - "to", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer_nft_from" - ], - "properties": { - "transfer_nft_from": { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "to", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer_ft" - ], - "properties": { - "transfer_ft": { - "type": "object", - "required": [ - "contract_id", - "from", - "to", - "tokens" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "tokens": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer_ft_from" - ], - "properties": { - "transfer_ft_from": { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "to", - "tokens" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "tokens": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "modify" - ], - "properties": { - "modify": { - "type": "object", - "required": [ - "contract_id", - "key", - "owner", - "token_index", - "token_type", - "value" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "token_index": { - "type": "string" - }, - "token_type": { - "type": "string" - }, - "value": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "approve" - ], - "properties": { - "approve": { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "disapprove" - ], - "properties": { - "disapprove": { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "grant_perm" - ], - "properties": { - "grant_perm": { - "type": "object", - "required": [ - "contract_id", - "from", - "permission", - "to" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "type": "string" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "revoke_perm" - ], - "properties": { - "revoke_perm": { - "type": "object", - "required": [ - "contract_id", - "from", - "permission" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "attach" - ], - "properties": { - "attach": { - "type": "object", - "required": [ - "contract_id", - "from", - "to_token_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to_token_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "detach" - ], - "properties": { - "detach": { - "type": "object", - "required": [ - "contract_id", - "from", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "attach_from" - ], - "properties": { - "attach_from": { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "to_token_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to_token_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "detach_from" - ], - "properties": { - "detach_from": { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "token_id": { - "type": "string" - } - } - } - } - } - ], - "definitions": { - "HumanAddr": { - "type": "string" - }, - "Uint128": { - "type": "string" - } - } -} diff --git a/contracts/collection-tester/schema/init_msg.json b/contracts/collection-tester/schema/init_msg.json deleted file mode 100644 index 2b274b4e6..000000000 --- a/contracts/collection-tester/schema/init_msg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InitMsg", - "type": "object" -} diff --git a/contracts/collection-tester/schema/query_msg.json b/contracts/collection-tester/schema/query_msg.json deleted file mode 100644 index 2ac0f0bab..000000000 --- a/contracts/collection-tester/schema/query_msg.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "anyOf": [ - { - "type": "object", - "required": [ - "get_collection" - ], - "properties": { - "get_collection": { - "type": "object", - "required": [ - "contract_id" - ], - "properties": { - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_balance" - ], - "properties": { - "get_balance": { - "type": "object", - "required": [ - "addr", - "contract_id", - "token_id" - ], - "properties": { - "addr": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_token_type" - ], - "properties": { - "get_token_type": { - "type": "object", - "required": [ - "contract_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_token_types" - ], - "properties": { - "get_token_types": { - "type": "object", - "required": [ - "contract_id" - ], - "properties": { - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_token" - ], - "properties": { - "get_token": { - "type": "object", - "required": [ - "contract_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_tokens" - ], - "properties": { - "get_tokens": { - "type": "object", - "required": [ - "contract_id" - ], - "properties": { - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_nft_count" - ], - "properties": { - "get_nft_count": { - "type": "object", - "required": [ - "contract_id", - "target", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "target": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_total" - ], - "properties": { - "get_total": { - "type": "object", - "required": [ - "contract_id", - "target", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "target": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_root_or_parent_or_children" - ], - "properties": { - "get_root_or_parent_or_children": { - "type": "object", - "required": [ - "contract_id", - "target", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "target": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_perms" - ], - "properties": { - "get_perms": { - "type": "object", - "required": [ - "addr", - "contract_id" - ], - "properties": { - "addr": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_approved" - ], - "properties": { - "get_approved": { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_approvers" - ], - "properties": { - "get_approvers": { - "type": "object", - "required": [ - "contract_id", - "proxy" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - } - ], - "definitions": { - "HumanAddr": { - "type": "string" - } - } -} diff --git a/contracts/collection-tester/schema/state.json b/contracts/collection-tester/schema/state.json deleted file mode 100644 index d4b4a3340..000000000 --- a/contracts/collection-tester/schema/state.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "State", - "type": "object", - "required": [ - "owner" - ], - "properties": { - "owner": { - "$ref": "#/definitions/CanonicalAddr" - } - }, - "definitions": { - "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", - "type": "string" - }, - "CanonicalAddr": { - "$ref": "#/definitions/Binary" - } - } -} diff --git a/contracts/collection-tester/src/contract.rs b/contracts/collection-tester/src/contract.rs deleted file mode 100644 index a8890638f..000000000 --- a/contracts/collection-tester/src/contract.rs +++ /dev/null @@ -1,1221 +0,0 @@ -use std::convert::TryFrom; -use std::str::FromStr; - -use cosmwasm_std::{ - attr, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, HumanAddr, MessageInfo, Response, - StdError, StdResult, Uint128, -}; - -use cosmwasm_ext::{ - Change, Coin, Collection, CollectionMsg, CollectionPerm, CollectionRoute, - LinkCollectionQuerier, LinkMsgWrapper, MintNFTParam, Module, MsgData, Response as ExtResponse, - Target, -}; - -use crate::msg::{HandleMsg, InitMsg, QueryMsg}; -use crate::state::{config, State}; - -pub fn instantiate( - deps: DepsMut, - _env: Env, - info: MessageInfo, - _msg: InitMsg, -) -> StdResult { - let state = State { - owner: deps.api.canonical_address(&info.sender)?, - }; - - config(deps.storage).save(&state)?; - - Ok(Response { - submessages: vec![], - messages: vec![], - attributes: vec![attr("action", "instantiate")], - data: None, - }) -} - -type CollectionExecuteResponse = Response>; -pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: HandleMsg, -) -> StdResult { - match msg { - HandleMsg::Create { - owner, - name, - meta, - base_img_uri, - } => try_create(deps, env, info, owner, name, meta, base_img_uri), - HandleMsg::IssueNft { - owner, - contract_id, - name, - meta, - } => try_issue_nft(deps, env, info, owner, contract_id, name, meta), - HandleMsg::IssueFt { - owner, - contract_id, - to, - name, - meta, - amount, - mintable, - decimals, - } => try_issue_ft( - deps, - env, - info, - owner, - contract_id, - to, - name, - meta, - amount, - mintable, - decimals, - ), - HandleMsg::MintNft { - from, - contract_id, - to, - token_types, - } => try_mint_nft(deps, env, info, from, contract_id, to, token_types), - HandleMsg::MintFt { - from, - contract_id, - to, - tokens, - } => try_mint_ft(deps, env, info, from, contract_id, to, tokens), - HandleMsg::BurnNft { - from, - contract_id, - token_id, - } => try_burn_nft(deps, env, info, from, contract_id, token_id), - HandleMsg::BurnNftFrom { - proxy, - contract_id, - from, - token_ids, - } => try_burn_nft_from(deps, env, info, proxy, contract_id, from, token_ids), - HandleMsg::BurnFt { - from, - contract_id, - amounts, - } => try_burn_ft(deps, env, info, from, contract_id, amounts), - HandleMsg::BurnFtFrom { - proxy, - contract_id, - from, - amounts, - } => try_burn_ft_from(deps, env, info, proxy, contract_id, from, amounts), - HandleMsg::TransferNft { - from, - contract_id, - to, - token_ids, - } => try_transfer_nft(deps, env, info, from, contract_id, to, token_ids), - HandleMsg::TransferNftFrom { - proxy, - contract_id, - from, - to, - token_ids, - } => try_transfer_nft_from(deps, env, info, proxy, contract_id, from, to, token_ids), - HandleMsg::TransferFt { - from, - contract_id, - to, - tokens, - } => try_transfer_ft(deps, env, info, from, contract_id, to, tokens), - HandleMsg::TransferFtFrom { - proxy, - contract_id, - from, - to, - tokens, - } => try_transfer_ft_from(deps, env, info, proxy, contract_id, from, to, tokens), - HandleMsg::Modify { - owner, - contract_id, - token_type, - token_index, - key, - value, - } => try_modify( - deps, - env, - info, - owner, - contract_id, - token_type, - token_index, - key, - value, - ), - HandleMsg::Approve { - approver, - contract_id, - proxy, - } => try_approve(deps, env, info, approver, contract_id, proxy), - HandleMsg::Disapprove { - approver, - contract_id, - proxy, - } => try_disapprove(deps, env, info, approver, contract_id, proxy), - HandleMsg::GrantPerm { - from, - contract_id, - to, - permission, - } => try_grant_perm(deps, env, info, from, contract_id, to, permission), - HandleMsg::RevokePerm { - from, - contract_id, - permission, - } => try_revoke_perm(deps, env, info, from, contract_id, permission), - HandleMsg::Attach { - from, - contract_id, - to_token_id, - token_id, - } => try_attach(deps, env, info, from, contract_id, to_token_id, token_id), - HandleMsg::Detach { - from, - contract_id, - token_id, - } => try_detach(deps, env, info, from, contract_id, token_id), - HandleMsg::AttachFrom { - proxy, - contract_id, - from, - to_token_id, - token_id, - } => try_attach_from( - deps, - env, - info, - proxy, - contract_id, - from, - to_token_id, - token_id, - ), - HandleMsg::DetachFrom { - proxy, - contract_id, - from, - token_id, - } => try_detach_from(deps, env, info, proxy, contract_id, from, token_id), - } -} - -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::GetCollection { contract_id } => query_collection(deps, env, contract_id), - QueryMsg::GetBalance { - contract_id, - token_id, - addr, - } => query_balance(deps, env, contract_id, token_id, addr), - QueryMsg::GetTokenType { - contract_id, - token_id, - } => query_token_type(deps, env, contract_id, token_id), - QueryMsg::GetTokenTypes { contract_id } => query_token_types(deps, env, contract_id), - QueryMsg::GetToken { - contract_id, - token_id, - } => query_token(deps, env, contract_id, token_id), - QueryMsg::GetTokens { contract_id } => query_tokens(deps, env, contract_id), - QueryMsg::GetNftCount { - contract_id, - token_id, - target, - } => query_nft_count(deps, env, contract_id, token_id, target), - QueryMsg::GetTotal { - contract_id, - token_id, - target, - } => query_total(deps, env, contract_id, token_id, target), - QueryMsg::GetRootOrParentOrChildren { - contract_id, - token_id, - target, - } => query_root_or_parent_or_children(deps, env, contract_id, token_id, target), - QueryMsg::GetPerms { contract_id, addr } => query_perms(deps, env, contract_id, addr), - QueryMsg::GetApproved { - contract_id, - proxy, - approver, - } => query_is_approved(deps, env, contract_id, proxy, approver), - QueryMsg::GetApprovers { proxy, contract_id } => { - query_approvers(deps, env, proxy, contract_id) - } - } -} - -pub fn try_create( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - name: String, - meta: String, - base_img_uri: String, -) -> StdResult { - // Some kind of logic. - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Create, - data: CollectionMsg::Create { - owner, - name, - meta, - base_img_uri, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg.into()], - attributes: vec![attr("action", "create")], - data: None, - }; - Ok(res) -} - -pub fn try_issue_nft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - contract_id: String, - name: String, - meta: String, -) -> StdResult { - // Some kind of logic. - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::IssueNft, - data: CollectionMsg::IssueNft { - owner, - contract_id, - name, - meta, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "issue_nft")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_issue_ft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - contract_id: String, - to: HumanAddr, - name: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::IssueFt, - data: CollectionMsg::IssueFt { - owner, - contract_id, - to, - name, - meta, - amount, - mintable, - decimals, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "issue_ft")], - data: None, - }; - Ok(res) -} - -pub fn try_mint_nft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - token_types: Vec, -) -> StdResult { - let mut params: Vec = vec![]; - for (i, _) in token_types.iter().enumerate() { - let mint_nft_param = MintNFTParam::new( - "nft-".to_string() + &(i.to_string()), - "".to_string(), - token_types[i].clone(), - ); - params.push(mint_nft_param) - } - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::MintNft, - data: CollectionMsg::MintNft { - from, - contract_id, - to, - params, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "mint_nft")], - data: None, - }; - Ok(res) -} - -pub fn try_mint_ft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - tokens: Vec, -) -> StdResult { - let mut amount: Vec = vec![]; - tokens.iter().for_each(|token| { - let v: Vec<&str> = (token).split(':').collect(); - let coin = Coin::new(v[1].to_string(), Uint128::try_from(v[0]).unwrap()); - amount.push(coin); - }); - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::MintFt, - data: CollectionMsg::MintFt { - from, - contract_id, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "mint_ft")], - data: None, - }; - Ok(res) -} - -pub fn try_burn_nft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - token_id: String, -) -> StdResult { - let token_ids = vec![token_id]; - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::BurnNft, - data: CollectionMsg::BurnNft { - from, - contract_id, - token_ids, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn_nft")], - data: None, - }; - Ok(res) -} - -pub fn try_burn_nft_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_ids: Vec, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::BurnNftFrom, - data: CollectionMsg::BurnNftFrom { - proxy, - contract_id, - from, - token_ids, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn_nft_from")], - data: None, - }; - Ok(res) -} - -pub fn try_burn_ft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - tokens: Vec, -) -> StdResult { - let mut amount: Vec = vec![]; - tokens.iter().for_each(|token| { - let v: Vec<&str> = (token).split(':').collect(); - let coin = Coin::new(v[1].to_string(), Uint128::try_from(v[0]).unwrap()); - amount.push(coin); - }); - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::BurnFt, - data: CollectionMsg::BurnFt { - from, - contract_id, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn_nft")], - data: None, - }; - Ok(res) -} - -pub fn try_burn_ft_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - tokens: Vec, -) -> StdResult { - let mut amount: Vec = vec![]; - tokens.iter().for_each(|token| { - let v: Vec<&str> = (token).split(':').collect(); - let coin = Coin::new(v[1].to_string(), Uint128::try_from(v[0]).unwrap()); - amount.push(coin); - }); - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::BurnFtFrom, - data: CollectionMsg::BurnFtFrom { - proxy, - contract_id, - from, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn_nft_from")], - data: None, - }; - Ok(res) -} - -pub fn try_transfer_nft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - token_ids: Vec, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::TransferNft, - data: CollectionMsg::TransferNft { - from, - contract_id, - to, - token_ids, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer_nft")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_transfer_nft_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - token_ids: Vec, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::TransferNftFrom, - data: CollectionMsg::TransferNftFrom { - proxy, - contract_id, - from, - to, - token_ids, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer_nft_from")], - data: None, - }; - Ok(res) -} - -pub fn try_transfer_ft( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - tokens: Vec, -) -> StdResult { - let mut amount: Vec = vec![]; - tokens.iter().for_each(|token| { - let v: Vec<&str> = (token).split(':').collect(); - let coin = Coin::new(v[1].to_string(), Uint128::try_from(v[0]).unwrap()); - amount.push(coin); - }); - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::TransferFt, - data: CollectionMsg::TransferFt { - from, - contract_id, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer_ft")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_transfer_ft_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - tokens: Vec, -) -> StdResult { - let mut amount: Vec = vec![]; - tokens.iter().for_each(|token| { - let v: Vec<&str> = (token).split(':').collect(); - let coin = Coin::new(v[1].to_string(), Uint128::try_from(v[0]).unwrap()); - amount.push(coin); - }); - - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::TransferFtFrom, - data: CollectionMsg::TransferFtFrom { - proxy, - contract_id, - from, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer_ft_from")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_modify( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - contract_id: String, - token_type: String, - token_index: String, - key: String, - value: String, -) -> StdResult { - let change = Change::new(key, value); - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Modify, - data: CollectionMsg::Modify { - owner, - contract_id, - token_type, - token_index, - changes: vec![change], - }, - }, - } - .into(); - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "modify_collection")], - data: None, - }; - Ok(res) -} - -pub fn try_approve( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Approve, - data: CollectionMsg::Approve { - approver, - contract_id, - proxy, - }, - }, - } - .into(); - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "approve")], - data: None, - }; - Ok(res) -} - -pub fn try_disapprove( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Disapprove, - data: CollectionMsg::Disapprove { - approver, - contract_id, - proxy, - }, - }, - } - .into(); - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "approve")], - data: None, - }; - Ok(res) -} - -pub fn try_grant_perm( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - perm_str: String, -) -> StdResult { - let permission = CollectionPerm::from_str(&perm_str).unwrap(); - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::GrantPerm, - data: CollectionMsg::GrantPerm { - from, - contract_id, - to, - permission, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "grant_perm")], - data: None, - }; - Ok(res) -} - -pub fn try_revoke_perm( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - perm_str: String, -) -> StdResult { - let permission = CollectionPerm::from_str(&perm_str).unwrap(); - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::RevokePerm, - data: CollectionMsg::RevokePerm { - from, - contract_id, - permission, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "revoke_perm")], - data: None, - }; - Ok(res) -} - -pub fn try_attach( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to_token_id: String, - token_id: String, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Attach, - data: CollectionMsg::Attach { - from, - contract_id, - to_token_id, - token_id, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "attach")], - data: None, - }; - Ok(res) -} - -pub fn try_detach( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - token_id: String, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::Detach, - data: CollectionMsg::Detach { - from, - contract_id, - token_id, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "detach")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_attach_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to_token_id: String, - token_id: String, -) -> StdResult>> { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::AttachFrom, - data: CollectionMsg::AttachFrom { - proxy, - contract_id, - from, - to_token_id, - token_id, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "attach_from")], - data: None, - }; - Ok(res) -} - -pub fn try_detach_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_id: String, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Collectionencode, - msg_data: MsgData { - route: CollectionRoute::DetachFrom, - data: CollectionMsg::DetachFrom { - proxy, - contract_id, - from, - token_id, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "detach_from")], - data: None, - }; - Ok(res) -} - -fn query_collection(deps: Deps, _env: Env, contract_id: String) -> StdResult { - let res = match LinkCollectionQuerier::new(deps.querier).query_collection(contract_id)? { - Some(collection_response) => collection_response, - None => return to_binary(&None::>>), - }; - let out = to_binary(&res)?; - Ok(out) -} - -fn query_balance( - deps: Deps, - _env: Env, - contract_id: String, - token_id: String, - addr: HumanAddr, -) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_balance(contract_id, token_id, addr) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_token_type( - deps: Deps, - _env: Env, - contract_id: String, - token_id: String, -) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_token_type(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_token_types(deps: Deps, _env: Env, contract_id: String) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_token_types(contract_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_token(deps: Deps, _env: Env, contract_id: String, token_id: String) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_token(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_tokens(deps: Deps, _env: Env, contract_id: String) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_tokens(contract_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_nft_count( - deps: Deps, - _env: Env, - contract_id: String, - token_id: String, - target: String, -) -> StdResult { - let res = match &*target { - "count" => LinkCollectionQuerier::new(deps.querier) - .query_nft_count(contract_id, token_id) - .unwrap(), - "mint" => LinkCollectionQuerier::new(deps.querier) - .query_nft_mint(contract_id, token_id) - .unwrap(), - "burn" => LinkCollectionQuerier::new(deps.querier) - .query_nft_burn(contract_id, token_id) - .unwrap(), - _ => Uint128(0), - }; - let out = to_binary(&res)?; - Ok(out) -} - -fn query_total( - deps: Deps, - _env: Env, - contract_id: String, - token_id: String, - target_str: String, -) -> StdResult { - let target = Target::from_str(&target_str).unwrap(); - if Target::Supply == target { - let res = LinkCollectionQuerier::new(deps.querier) - .query_supply(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else if Target::Mint == target { - let res = LinkCollectionQuerier::new(deps.querier) - .query_mint(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else { - let res = LinkCollectionQuerier::new(deps.querier) - .query_burn(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } -} - -fn query_root_or_parent_or_children( - deps: Deps, - _env: Env, - contract_id: String, - token_id: String, - target: String, -) -> StdResult { - if target == "root" { - let res = LinkCollectionQuerier::new(deps.querier) - .query_root(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else if target == "parent" { - let res = LinkCollectionQuerier::new(deps.querier) - .query_parent(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else { - let res = LinkCollectionQuerier::new(deps.querier) - .query_children(contract_id, token_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } -} - -fn query_perms(deps: Deps, _env: Env, contract_id: String, addr: HumanAddr) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_perm(contract_id, addr) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_is_approved( - deps: Deps, - _env: Env, - contract_id: String, - proxy: HumanAddr, - approver: HumanAddr, -) -> StdResult { - let res = LinkCollectionQuerier::new(deps.querier) - .query_is_approved(contract_id, proxy, approver) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_approvers( - deps: Deps, - _env: Env, - proxy: HumanAddr, - contract_id: String, -) -> StdResult { - let res = match LinkCollectionQuerier::new(deps.querier).query_approvers(proxy, contract_id)? { - Some(approvers) => approvers, - None => return to_binary(&None::>>), - }; - let out = to_binary(&res)?; - Ok(out) -} diff --git a/contracts/collection-tester/src/lib.rs b/contracts/collection-tester/src/lib.rs deleted file mode 100644 index 37b3108ac..000000000 --- a/contracts/collection-tester/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod contract; -pub mod msg; -pub mod state; - -#[cfg(target_arch = "wasm32")] -cosmwasm_std::create_entry_points!(contract); diff --git a/contracts/collection-tester/src/msg.rs b/contracts/collection-tester/src/msg.rs deleted file mode 100644 index c2c5d1eaf..000000000 --- a/contracts/collection-tester/src/msg.rs +++ /dev/null @@ -1,203 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, Uint128}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct InitMsg {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum HandleMsg { - Create { - owner: HumanAddr, - name: String, - meta: String, - base_img_uri: String, - }, - IssueNft { - owner: HumanAddr, - contract_id: String, - name: String, - meta: String, - }, - IssueFt { - owner: HumanAddr, - contract_id: String, - to: HumanAddr, - name: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, - }, - MintNft { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - token_types: Vec, - }, - MintFt { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - tokens: Vec, - }, - BurnNft { - from: HumanAddr, - contract_id: String, - token_id: String, - }, - BurnNftFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_ids: Vec, - }, - BurnFt { - from: HumanAddr, - contract_id: String, - amounts: Vec, - }, - BurnFtFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - amounts: Vec, - }, - TransferNft { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - token_ids: Vec, - }, - TransferNftFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - token_ids: Vec, - }, - TransferFt { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - tokens: Vec, - }, - TransferFtFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - tokens: Vec, - }, - Modify { - owner: HumanAddr, - contract_id: String, - token_type: String, - token_index: String, - key: String, - value: String, - }, - Approve { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, - Disapprove { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, - GrantPerm { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - permission: String, - }, - RevokePerm { - from: HumanAddr, - contract_id: String, - permission: String, - }, - Attach { - from: HumanAddr, - contract_id: String, - to_token_id: String, - token_id: String, - }, - Detach { - from: HumanAddr, - contract_id: String, - token_id: String, - }, - AttachFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to_token_id: String, - token_id: String, - }, - DetachFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_id: String, - }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum QueryMsg { - // GetCount returns the current count as a json-encoded number - GetCollection { - contract_id: String, - }, - GetBalance { - contract_id: String, - token_id: String, - addr: HumanAddr, - }, - GetTokenType { - contract_id: String, - token_id: String, - }, - GetTokenTypes { - contract_id: String, - }, - GetToken { - contract_id: String, - token_id: String, - }, - GetTokens { - contract_id: String, - }, - GetNftCount { - contract_id: String, - token_id: String, - target: String, - }, - GetTotal { - contract_id: String, - token_id: String, - target: String, - }, - GetRootOrParentOrChildren { - contract_id: String, - token_id: String, - target: String, - }, - GetPerms { - contract_id: String, - addr: HumanAddr, - }, - GetApproved { - contract_id: String, - proxy: HumanAddr, - approver: HumanAddr, - }, - GetApprovers { - proxy: HumanAddr, - contract_id: String, - }, -} diff --git a/contracts/collection-tester/src/state.rs b/contracts/collection-tester/src/state.rs deleted file mode 100644 index 9005e710f..000000000 --- a/contracts/collection-tester/src/state.rs +++ /dev/null @@ -1,20 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{CanonicalAddr, Storage}; -use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton}; - -pub static CONFIG_KEY: &[u8] = b"config"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct State { - pub owner: CanonicalAddr, -} - -pub fn config(storage: &mut dyn Storage) -> Singleton { - singleton(storage, CONFIG_KEY) -} - -pub fn config_read(storage: &dyn Storage) -> ReadonlySingleton { - singleton_read(storage, CONFIG_KEY) -} diff --git a/contracts/token-tester/.cargo/config b/contracts/token-tester/.cargo/config deleted file mode 100644 index 7c115322a..000000000 --- a/contracts/token-tester/.cargo/config +++ /dev/null @@ -1,6 +0,0 @@ -[alias] -wasm = "build --release --target wasm32-unknown-unknown" -wasm-debug = "build --target wasm32-unknown-unknown" -unit-test = "test --lib --features backtraces" -integration-test = "test --test integration" -schema = "run --example schema" diff --git a/contracts/token-tester/Cargo.lock b/contracts/token-tester/Cargo.lock deleted file mode 100644 index 8f3da0214..000000000 --- a/contracts/token-tester/Cargo.lock +++ /dev/null @@ -1,1530 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" -dependencies = [ - "gimli 0.23.0", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "backtrace" -version = "0.3.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object 0.23.0", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d" -dependencies = [ - "byteorder", - "serde", -] - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bitvec" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98fcd36dda4e17b7d7abc64cb549bf0201f4ab71e00700c798ca7e62ed3761fa" -dependencies = [ - "funty", - "radium", - "wyz", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byteorder" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" - -[[package]] -name = "cc" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clru" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591ff76ca0691bd91c1b0b5b987e5cf93b21ec810ad96665c5a569c60846dd93" - -[[package]] -name = "const-oid" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f6b64db6932c7e49332728e3a6bd82c6b7e16016607d20923b537c3bc4c0d5f" - -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" - -[[package]] -name = "cosmwasm-crypto" -version = "0.14.0-0.3.0" -dependencies = [ - "digest", - "ed25519-zebra", - "k256", - "rand_core 0.5.1", - "thiserror", -] - -[[package]] -name = "cosmwasm-derive" -version = "0.14.0-0.3.0" -dependencies = [ - "syn", -] - -[[package]] -name = "cosmwasm-ext" -version = "0.14.0-0.3.0" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", - "serde_json", -] - -[[package]] -name = "cosmwasm-schema" -version = "0.14.0-0.3.0" -dependencies = [ - "schemars", - "serde_json", -] - -[[package]] -name = "cosmwasm-std" -version = "0.14.0-0.3.0" -dependencies = [ - "base64", - "cosmwasm-crypto", - "cosmwasm-derive", - "schemars", - "serde", - "serde-json-wasm", - "thiserror", -] - -[[package]] -name = "cosmwasm-storage" -version = "0.14.0-0.3.0" -dependencies = [ - "cosmwasm-std", - "serde", -] - -[[package]] -name = "cosmwasm-vm" -version = "0.14.0-0.3.0" -dependencies = [ - "clru", - "cosmwasm-crypto", - "cosmwasm-std", - "hex", - "parity-wasm", - "schemars", - "serde", - "serde_json", - "sha2", - "thiserror", - "wasmer", - "wasmer-middlewares", -] - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "cranelift-bforest" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1" -dependencies = [ - "byteorder", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli 0.22.0", - "log", - "regalloc", - "smallvec", - "target-lexicon", - "thiserror", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7" -dependencies = [ - "cranelift-codegen-shared", - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" - -[[package]] -name = "cranelift-entity" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6" -dependencies = [ - "serde", -] - -[[package]] -name = "cranelift-frontend" -version = "0.68.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" -dependencies = [ - "cfg-if 1.0.0", - "const_fn", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" -dependencies = [ - "byteorder", - "digest", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "der" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f59c66c30bb7445c8320a5f9233e437e3572368099f25532a59054328899b4" -dependencies = [ - "const-oid", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "dynasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7d1242462849390bb2ad38aeed769499f1afc7383affa2ab0c1baa894c0200" -dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dynasmrt" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dd4d1d5ca12258cef339a57a7643e8b233a42dea9bb849630ddd9dd7726aa9" -dependencies = [ - "byteorder", - "dynasm", - "memmap2", -] - -[[package]] -name = "ecdsa" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fbdb4ff710acb4db8ca29f93b897529ea6d6a45626d5183b47e012aa6ae7e4" -dependencies = [ - "elliptic-curve", - "hmac", - "signature", -] - -[[package]] -name = "ed25519-zebra" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a128b76af6dd4b427e34a6fd43dc78dbfe73672ec41ff615a2414c1a0ad0409" -dependencies = [ - "curve25519-dalek", - "hex", - "rand_core 0.5.1", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "elliptic-curve" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2db227e61a43a34915680bdda462ec0e212095518020a88a1f91acd16092c39" -dependencies = [ - "bitvec", - "digest", - "ff", - "funty", - "generic-array", - "group", - "pkcs8", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "enumset" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd795df6708a599abf1ee10eacc72efd052b7a5f70fdf0715e4d5151a6db9c3" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19c52f9ec503c8a68dc04daf71a04b07e690c32ab1a8b68e33897f255269d47" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "ff" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01646e077d4ebda82b73f1bca002ea1e91561a77df2431a9e79729bcc31950ef" -dependencies = [ - "bitvec", - "rand_core 0.5.1", - "subtle", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "funty" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.10.2+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" - -[[package]] -name = "group" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11f9f5fbf1943b48ae7c2bf6846e7d827a512d1be4f23af708f5ca5d01dde1" -dependencies = [ - "ff", - "rand_core 0.5.1", - "subtle", -] - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - -[[package]] -name = "hermit-abi" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" - -[[package]] -name = "hmac" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "itoa" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" - -[[package]] -name = "k256" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf02ecc966e1b7e8db1c81ac8f321ba24d1cfab5b634961fab10111f015858e1" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" - -[[package]] -name = "libc" -version = "0.2.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" - -[[package]] -name = "libloading" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" -dependencies = [ - "cfg-if 1.0.0", - "winapi", -] - -[[package]] -name = "log" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "memmap2" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "more-asserts" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" -dependencies = [ - "crc32fast", - "indexmap", -] - -[[package]] -name = "object" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-wasm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d17797de36b94bc5f73edad736fd0a77ce5ab64dd622f809c1eead8c91fa6564" - -[[package]] -name = "pin-project-lite" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" - -[[package]] -name = "pkcs8" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4839a901843f3942576e65857f0ebf2e190ef7024d3c62a94099ba3f819ad1d" -dependencies = [ - "der", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha", - "rand_core 0.6.2", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.2", -] - -[[package]] -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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" -dependencies = [ - "getrandom 0.2.2", -] - -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core 0.6.2", -] - -[[package]] -name = "rayon" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regalloc" -version = "0.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "schemars" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be77ed66abed6954aabf6a3e31a84706bedbf93750d267e92ef4a6d90bbd6a61" -dependencies = [ - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11af7a475c9ee266cfaa9e303a47c830ebe072bf3101ab907a7b7b9d816fa01d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "1.0.123" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-json-wasm" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50eef3672ec8fa45f3457fd423ba131117786784a895548021976117c1ded449" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.123" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_derive_internals" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8" -dependencies = [ - "block-buffer", - "cfg-if 1.0.0", - "cpuid-bool", - "digest", - "opaque-debug", -] - -[[package]] -name = "signature" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" -dependencies = [ - "digest", - "rand_core 0.5.1", -] - -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" - -[[package]] -name = "syn" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "target-lexicon" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b29e388d11a2c0605bdc806ce6ed1d623a5bdbbdd5b423053444999331184e" - -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "token-tester" -version = "0.14.0-0.3.0" -dependencies = [ - "cosmwasm-ext", - "cosmwasm-schema", - "cosmwasm-std", - "cosmwasm-storage", - "cosmwasm-vm", - "schemars", - "serde", - "snafu", -] - -[[package]] -name = "tracing" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" -dependencies = [ - "cfg-if 1.0.0", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasmer" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70cfae554988d904d64ca17ab0e7cd652ee5c8a0807094819c1ea93eb9d6866" -dependencies = [ - "cfg-if 0.1.10", - "indexmap", - "more-asserts", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-engine", - "wasmer-engine-jit", - "wasmer-engine-native", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-compiler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7732a9cab472bd921d5a0c422f45b3d03f62fa2c40a89e0770cef6d47e383e" -dependencies = [ - "enumset", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb9395f094e1d81534f4c5e330ed4cdb424e8df870d29ad585620284f5fddb" -dependencies = [ - "cranelift-codegen", - "cranelift-frontend", - "gimli 0.22.0", - "more-asserts", - "rayon", - "serde", - "smallvec", - "tracing", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426ae6ef0f606ca815510f3e2ef6f520e217514bfb7a664defe180b9a9e75d07" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "lazy_static", - "more-asserts", - "rayon", - "serde", - "smallvec", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-derive" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b86dcd2c3efdb8390728a2b56f762db07789aaa5aa872a9dc776ba3a7912ed" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmer-engine" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efe4667d6bd888f26ae8062a63a9379fa697415b4b4e380f33832e8418fd71b5" -dependencies = [ - "backtrace", - "bincode", - "lazy_static", - "memmap2", - "more-asserts", - "rustc-demangle", - "serde", - "serde_bytes", - "target-lexicon", - "thiserror", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-engine-jit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26770be802888011b4a3072f2a282fc2faa68aa48c71b3db6252a3937a85f3da" -dependencies = [ - "bincode", - "cfg-if 0.1.10", - "region", - "serde", - "serde_bytes", - "wasmer-compiler", - "wasmer-engine", - "wasmer-types", - "wasmer-vm", - "winapi", -] - -[[package]] -name = "wasmer-engine-native" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb4083a6c69f2cd4b000b82a80717f37c6cc2e536aee3a8ffe9af3edc276a8b" -dependencies = [ - "bincode", - "cfg-if 0.1.10", - "leb128", - "libloading", - "serde", - "tempfile", - "tracing", - "wasmer-compiler", - "wasmer-engine", - "wasmer-object", - "wasmer-types", - "wasmer-vm", - "which", -] - -[[package]] -name = "wasmer-middlewares" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "547baee2c0733cf436db7d137a8d1f86737a6321fc0fe6cd74caecf6f759c3c4" -dependencies = [ - "wasmer", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-object" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf8e0c12b82ff81ebecd30d7e118be5fec871d6de885a90eeb105df0a769a7b" -dependencies = [ - "object 0.22.0", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-types" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f4ac28c2951cd792c18332f03da523ed06b170f5cf6bb5b1bdd7e36c2a8218" -dependencies = [ - "cranelift-entity", - "serde", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7635ba0b6d2fd325f588d69a950ad9fa04dddbf6ad08b6b2a183146319bf6ae" -dependencies = [ - "backtrace", - "cc", - "cfg-if 0.1.10", - "indexmap", - "libc", - "memoffset", - "more-asserts", - "region", - "serde", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.65.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" - -[[package]] -name = "wast" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5ae96da18bb5926341516fd409b5a8ce4e4714da7f0a1063d3b20ac9f9a1e1" -dependencies = [ - "leb128", -] - -[[package]] -name = "wat" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0fa059022c5dabe129f02b429d67086400deb8277f89c975555dacc1dadbcc" -dependencies = [ - "wast", -] - -[[package]] -name = "which" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" -dependencies = [ - "libc", - "thiserror", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" - -[[package]] -name = "zeroize" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" diff --git a/contracts/token-tester/Cargo.toml b/contracts/token-tester/Cargo.toml deleted file mode 100644 index f879a1bba..000000000 --- a/contracts/token-tester/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "token-tester" -version = "0.14.0-0.3.0" -authors = ["shiki.tak"] -edition = "2018" -description = "simple tester for cosmwasm/ext" - -[lib] -crate-type = ["cdylib", "rlib"] - -[features] -default = ["cranelift"] -# For quicker tests, cargo test --lib. for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces", "cosmwasm-vm/backtraces"] -cranelift = ["cosmwasm-vm/cranelift"] - -[dependencies] -cosmwasm-ext = { path = "../../packages/ext" } -cosmwasm-std = { path = "../../packages/std", features = ["iterator"] } -cosmwasm-storage = { path = "../../packages/storage", features = ["iterator"] } -schemars = "0.7" -serde = { version = "1.0.103", default-features = false, features = ["derive"] } -snafu = { version = "0.6.3" } - -[dev-dependencies] -cosmwasm-schema = { path = "../../packages/schema" } -cosmwasm-vm = { path = "../../packages/vm", default-features = false, features = ["iterator"] } diff --git a/contracts/token-tester/examples/schema.rs b/contracts/token-tester/examples/schema.rs deleted file mode 100644 index 6e83e2fd1..000000000 --- a/contracts/token-tester/examples/schema.rs +++ /dev/null @@ -1,19 +0,0 @@ -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; - -use token_tester::msg::{HandleMsg, InitMsg, QueryMsg}; -use token_tester::state::State; - -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!(InitMsg), &out_dir); - export_schema(&schema_for!(HandleMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); - export_schema(&schema_for!(State), &out_dir); -} diff --git a/contracts/token-tester/schema/handle_msg.json b/contracts/token-tester/schema/handle_msg.json deleted file mode 100644 index df2428819..000000000 --- a/contracts/token-tester/schema/handle_msg.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "HandleMsg", - "anyOf": [ - { - "type": "object", - "required": [ - "issue" - ], - "properties": { - "issue": { - "type": "object", - "required": [ - "amount", - "decimals", - "img_uri", - "meta", - "mintable", - "name", - "owner", - "symbol", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "decimals": { - "$ref": "#/definitions/Uint128" - }, - "img_uri": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "mintable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "symbol": { - "type": "string" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer" - ], - "properties": { - "transfer": { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "transfer_from" - ], - "properties": { - "transfer_from": { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "mint" - ], - "properties": { - "mint": { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn" - ], - "properties": { - "burn": { - "type": "object", - "required": [ - "amount", - "contract_id", - "from" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "burn_from" - ], - "properties": { - "burn_from": { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "grant_perm" - ], - "properties": { - "grant_perm": { - "type": "object", - "required": [ - "contract_id", - "from", - "permission", - "to" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "type": "string" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "revoke_perm" - ], - "properties": { - "revoke_perm": { - "type": "object", - "required": [ - "contract_id", - "from", - "permission" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "modify" - ], - "properties": { - "modify": { - "type": "object", - "required": [ - "contract_id", - "key", - "owner", - "value" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "value": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "approve" - ], - "properties": { - "approve": { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - } - ], - "definitions": { - "HumanAddr": { - "type": "string" - }, - "Uint128": { - "type": "string" - } - } -} diff --git a/contracts/token-tester/schema/init_msg.json b/contracts/token-tester/schema/init_msg.json deleted file mode 100644 index 2b274b4e6..000000000 --- a/contracts/token-tester/schema/init_msg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InitMsg", - "type": "object" -} diff --git a/contracts/token-tester/schema/query_msg.json b/contracts/token-tester/schema/query_msg.json deleted file mode 100644 index 324a37a79..000000000 --- a/contracts/token-tester/schema/query_msg.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "anyOf": [ - { - "type": "object", - "required": [ - "get_token" - ], - "properties": { - "get_token": { - "type": "object", - "required": [ - "contract_id" - ], - "properties": { - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_balance" - ], - "properties": { - "get_balance": { - "type": "object", - "required": [ - "address", - "contract_id" - ], - "properties": { - "address": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_total" - ], - "properties": { - "get_total": { - "type": "object", - "required": [ - "contract_id", - "target" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "target": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_perm" - ], - "properties": { - "get_perm": { - "type": "object", - "required": [ - "address", - "contract_id" - ], - "properties": { - "address": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_is_approved" - ], - "properties": { - "get_is_approved": { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - }, - { - "type": "object", - "required": [ - "get_approvers" - ], - "properties": { - "get_approvers": { - "type": "object", - "required": [ - "contract_id", - "proxy" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - } - } - ], - "definitions": { - "HumanAddr": { - "type": "string" - } - } -} diff --git a/contracts/token-tester/schema/state.json b/contracts/token-tester/schema/state.json deleted file mode 100644 index d4b4a3340..000000000 --- a/contracts/token-tester/schema/state.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "State", - "type": "object", - "required": [ - "owner" - ], - "properties": { - "owner": { - "$ref": "#/definitions/CanonicalAddr" - } - }, - "definitions": { - "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", - "type": "string" - }, - "CanonicalAddr": { - "$ref": "#/definitions/Binary" - } - } -} diff --git a/contracts/token-tester/src/contract.rs b/contracts/token-tester/src/contract.rs deleted file mode 100644 index 4e30c6902..000000000 --- a/contracts/token-tester/src/contract.rs +++ /dev/null @@ -1,591 +0,0 @@ -use std::str::FromStr; - -use cosmwasm_std::{ - attr, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, HumanAddr, MessageInfo, Response, - StdResult, Uint128, -}; - -use cosmwasm_ext::{ - Change, LinkMsgWrapper, LinkTokenQuerier, Module, MsgData, Response as ExtResponse, Target, - Token, TokenMsg, TokenPerm, TokenRoute, -}; - -use crate::msg::{HandleMsg, InitMsg, QueryMsg}; -use crate::state::{config, config_read, State}; - -pub fn instantiate( - deps: DepsMut, - _env: Env, - info: MessageInfo, - _msg: InitMsg, -) -> StdResult { - let state = State { - owner: deps.api.canonical_address(&info.sender)?, - }; - - config(deps.storage).save(&state)?; - - Ok(Response { - submessages: vec![], - messages: vec![], - attributes: vec![attr("action", "instantiate")], - data: None, - }) -} - -type TokenExecuteResponse = Response>; -pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: HandleMsg, -) -> StdResult { - match msg { - HandleMsg::Issue { - owner, - to, - name, - symbol, - img_uri, - meta, - amount, - mintable, - decimals, - } => try_issue( - deps, env, info, owner, to, name, symbol, img_uri, meta, amount, mintable, decimals, - ), - HandleMsg::Transfer { - from, - contract_id, - to, - amount, - } => try_transfer(deps, env, info, from, contract_id, to, amount), - HandleMsg::TransferFrom { - proxy, - from, - contract_id, - to, - amount, - } => try_transfer_from(deps, env, info, proxy, from, contract_id, to, amount), - HandleMsg::Mint { - from, - contract_id, - to, - amount, - } => try_mint(deps, env, info, from, contract_id, to, amount), - HandleMsg::Burn { - from, - contract_id, - amount, - } => try_burn(deps, env, info, from, contract_id, amount), - HandleMsg::BurnFrom { - proxy, - from, - contract_id, - amount, - } => try_burn_from(deps, env, info, proxy, from, contract_id, amount), - HandleMsg::GrantPerm { - from, - contract_id, - to, - permission, - } => try_grant_perm(deps, env, info, from, contract_id, to, permission), - HandleMsg::RevokePerm { - from, - contract_id, - permission, - } => try_revoke_perm(deps, env, info, from, contract_id, permission), - HandleMsg::Modify { - owner, - contract_id, - key, - value, - } => try_modify(deps, env, info, owner, contract_id, key, value), - HandleMsg::Approve { - approver, - contract_id, - proxy, - } => try_approve(deps, env, info, approver, contract_id, proxy), - } -} - -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::GetToken { contract_id } => query_token(deps, env, contract_id), - QueryMsg::GetBalance { - contract_id, - address, - } => query_balance(deps, env, contract_id, address), - QueryMsg::GetTotal { - contract_id, - target, - } => query_total(deps, env, contract_id, target), - QueryMsg::GetPerm { - contract_id, - address, - } => query_perm(deps, env, contract_id, address), - QueryMsg::GetIsApproved { - proxy, - contract_id, - approver, - } => query_is_approved(deps, env, proxy, contract_id, approver), - QueryMsg::GetApprovers { proxy, contract_id } => { - query_approvers(deps, env, proxy, contract_id) - } - } -} - -#[allow(clippy::too_many_arguments)] -pub fn try_issue( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - to: HumanAddr, - name: String, - symbol: String, - img_uri: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, -) -> StdResult { - let msg: CosmosMsg> = - LinkMsgWrapper:: { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Issue, - data: TokenMsg::Issue { - owner, - to, - name, - symbol, - img_uri, - meta, - amount, - mintable, - decimals, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "issue")], - data: None, - }; - Ok(res) -} - -pub fn try_transfer( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, -) -> StdResult { - // Some kind of logic. - - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Transfer, - data: TokenMsg::Transfer { - from, - contract_id, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer")], - data: None, - }; - Ok(res) -} - -#[allow(clippy::too_many_arguments)] -pub fn try_transfer_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, -) -> StdResult { - // Some kind of logic. - - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::TransferFrom, - data: TokenMsg::TransferFrom { - proxy, - from, - contract_id, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "transfer_from")], - data: None, - }; - Ok(res) -} - -pub fn try_mint( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, -) -> StdResult { - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Mint, - data: TokenMsg::Mint { - from, - contract_id, - to, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "mint")], - data: None, - }; - Ok(res) -} - -pub fn try_burn( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - amount: Uint128, -) -> StdResult { - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Burn, - data: TokenMsg::Burn { - from, - contract_id, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn")], - data: None, - }; - Ok(res) -} - -pub fn try_burn_from( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - amount: Uint128, -) -> StdResult { - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::BurnFrom, - data: TokenMsg::BurnFrom { - proxy, - from, - contract_id, - amount, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "burn_from")], - data: None, - }; - Ok(res) -} - -pub fn try_grant_perm( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - perm_str: String, -) -> StdResult { - let permission = TokenPerm::from_str(&perm_str).unwrap(); - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::GrantPerm, - data: TokenMsg::GrantPerm { - from, - contract_id, - to, - permission, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "grant_perm")], - data: None, - }; - Ok(res) -} - -pub fn try_revoke_perm( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - from: HumanAddr, - contract_id: String, - perm_str: String, -) -> StdResult { - let permission = TokenPerm::from_str(&perm_str).unwrap(); - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::RevokePerm, - data: TokenMsg::RevokePerm { - from, - contract_id, - permission, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "revoke_perm")], - data: None, - }; - Ok(res) -} - -pub fn try_modify( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - owner: HumanAddr, - contract_id: String, - key: String, - value: String, -) -> StdResult { - let change = Change::new(key, value); - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Modify, - data: TokenMsg::Modify { - owner, - contract_id, - changes: vec![change], - }, - }, - } - .into(); - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "modify")], - data: None, - }; - Ok(res) -} - -pub fn try_approve( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, -) -> StdResult { - let msg: CosmosMsg> = LinkMsgWrapper { - module: Module::Tokenencode, - msg_data: MsgData { - route: TokenRoute::Approve, - data: TokenMsg::Approve { - approver, - contract_id, - proxy, - }, - }, - } - .into(); - - let res = Response { - submessages: vec![], - messages: vec![msg], - attributes: vec![attr("action", "approve")], - data: None, - }; - Ok(res) -} - -fn query_token(deps: Deps, _env: Env, contract_id: String) -> StdResult { - let res = match LinkTokenQuerier::new(deps.querier).query_token(contract_id)? { - Some(token_response) => token_response, - None => return to_binary(&None::>>), - }; - - let out = to_binary(&res)?; - Ok(out) -} - -fn query_balance( - deps: Deps, - _env: Env, - contract_id: String, - address: HumanAddr, -) -> StdResult { - let res = LinkTokenQuerier::new(deps.querier) - .query_balance(contract_id, address) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_total( - deps: Deps, - _env: Env, - contract_id: String, - target_str: String, -) -> StdResult { - let target = Target::from_str(&target_str).unwrap(); - if Target::Supply == target { - let res = LinkTokenQuerier::new(deps.querier) - .query_supply(contract_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else if Target::Mint == target { - let res = LinkTokenQuerier::new(deps.querier) - .query_mint(contract_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } else { - let res = LinkTokenQuerier::new(deps.querier) - .query_burn(contract_id) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) - } -} - -fn query_perm(deps: Deps, _env: Env, contract_id: String, address: HumanAddr) -> StdResult { - let res = match LinkTokenQuerier::new(deps.querier).query_perm(contract_id, address)? { - Some(permissions) => permissions, - None => return to_binary(&None::>>), - }; - let out = to_binary(&res)?; - Ok(out) -} - -fn query_is_approved( - deps: Deps, - _env: Env, - proxy: HumanAddr, - contract_id: String, - approver: HumanAddr, -) -> StdResult { - let res = LinkTokenQuerier::new(deps.querier) - .query_is_approved(proxy, contract_id, approver) - .unwrap(); - let out = to_binary(&res)?; - Ok(out) -} - -fn query_approvers( - deps: Deps, - _env: Env, - proxy: HumanAddr, - contract_id: String, -) -> StdResult { - let res = match LinkTokenQuerier::new(deps.querier).query_approvers(proxy, contract_id)? { - Some(approvers) => approvers, - None => return to_binary(&None::>>), - }; - let out = to_binary(&res)?; - Ok(out) -} - -fn _query_owner(deps: Deps, _env: Env) -> StdResult { - let state = config_read(deps.storage).load()?; - Ok(deps.api.human_address(&state.owner)?) -} - -#[cfg(test)] -mod tests { - use super::*; - use cosmwasm_std::testing::{ - mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage, - }; - use cosmwasm_std::{coins, Env, OwnedDeps}; - - fn create_contract(owner: String) -> (OwnedDeps, Env) { - let mut deps = mock_dependencies(&coins(1000, "cony")); - let env = mock_env(); - let info = mock_info(owner, &coins(1000, "cony")); - let res = instantiate(deps.as_mut(), env.clone(), info.clone(), InitMsg {}).unwrap(); - assert_eq!(0, res.messages.len()); - (deps, env) - } - - #[test] - fn init_contract() { - let addr = "creator"; - - let (deps, _) = create_contract(addr.to_string()); - let env = mock_env(); - let value = _query_owner(deps.as_ref(), env).unwrap(); - assert_eq!(addr, value.as_str()); - } -} diff --git a/contracts/token-tester/src/lib.rs b/contracts/token-tester/src/lib.rs deleted file mode 100644 index 37b3108ac..000000000 --- a/contracts/token-tester/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod contract; -pub mod msg; -pub mod state; - -#[cfg(target_arch = "wasm32")] -cosmwasm_std::create_entry_points!(contract); diff --git a/contracts/token-tester/src/msg.rs b/contracts/token-tester/src/msg.rs deleted file mode 100644 index 976aebe7b..000000000 --- a/contracts/token-tester/src/msg.rs +++ /dev/null @@ -1,104 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, Uint128}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct InitMsg {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum HandleMsg { - Issue { - owner: HumanAddr, - to: HumanAddr, - name: String, - symbol: String, - img_uri: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, - }, - Transfer { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - TransferFrom { - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - Mint { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - Burn { - from: HumanAddr, - contract_id: String, - amount: Uint128, - }, - BurnFrom { - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - amount: Uint128, - }, - GrantPerm { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - permission: String, - }, - RevokePerm { - from: HumanAddr, - contract_id: String, - permission: String, - }, - Modify { - owner: HumanAddr, - contract_id: String, - key: String, - value: String, - }, - Approve { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum QueryMsg { - GetToken { - contract_id: String, - }, - GetBalance { - contract_id: String, - address: HumanAddr, - }, - GetTotal { - contract_id: String, - target: String, - }, - GetPerm { - contract_id: String, - address: HumanAddr, - }, - GetIsApproved { - proxy: HumanAddr, - contract_id: String, - approver: HumanAddr, - }, - GetApprovers { - proxy: HumanAddr, - contract_id: String, - }, -} diff --git a/contracts/token-tester/src/state.rs b/contracts/token-tester/src/state.rs deleted file mode 100644 index 9005e710f..000000000 --- a/contracts/token-tester/src/state.rs +++ /dev/null @@ -1,20 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{CanonicalAddr, Storage}; -use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton}; - -pub static CONFIG_KEY: &[u8] = b"config"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct State { - pub owner: CanonicalAddr, -} - -pub fn config(storage: &mut dyn Storage) -> Singleton { - singleton(storage, CONFIG_KEY) -} - -pub fn config_read(storage: &dyn Storage) -> ReadonlySingleton { - singleton_read(storage, CONFIG_KEY) -} diff --git a/packages/ext/.cargo/config b/packages/ext/.cargo/config deleted file mode 100644 index 8c7cbe465..000000000 --- a/packages/ext/.cargo/config +++ /dev/null @@ -1,5 +0,0 @@ -[alias] -wasm = "build --release --target wasm32-unknown-unknown" -wasm-debug = "build --target wasm32-unknown-unknown" -unit-test = "test --lib --features backtraces" -schema = "run --example schema" diff --git a/packages/ext/Cargo.lock b/packages/ext/Cargo.lock deleted file mode 100644 index 4cbfb4f25..000000000 --- a/packages/ext/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - -[[package]] -name = "cosmwasm-schema" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1592dd62fbf542dca476606d4768ae54c5febd586c5e246d147c3c90b2f4289c" -dependencies = [ - "schemars", - "serde_json", -] - -[[package]] -name = "cosmwasm-std" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7934161da3638926acf9ac1ee92d0080993052df6dcd09fc5deb1d1ba6fbcb02" -dependencies = [ - "base64", - "schemars", - "serde", - "serde-json-wasm", - "snafu", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "proc-macro2" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "schemars" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be77ed66abed6954aabf6a3e31a84706bedbf93750d267e92ef4a6d90bbd6a61" -dependencies = [ - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11af7a475c9ee266cfaa9e303a47c830ebe072bf3101ab907a7b7b9d816fa01d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", -] - -[[package]] -name = "serde" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-json-wasm" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7294d94d390f1d2334697c065ea591d7074c676e2d20aa6f1df752fced29823f" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_derive_internals" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "snafu" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f5aed652511f5c9123cf2afbe9c244c29db6effa2abb05c866e965c82405ce" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf8f7d5720104a9df0f7076a8682024e958bba0fe9848767bb44f251f3648e9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "syn" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "ext" -version = "1.1.0" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "schemars", - "serde", -] - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" diff --git a/packages/ext/Cargo.toml b/packages/ext/Cargo.toml deleted file mode 100644 index 9e262c2ea..000000000 --- a/packages/ext/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "cosmwasm-ext" -version = "0.14.0-0.3.0" -authors = ["shiki.tak"] -edition = "2018" -description = "Bindings for CosmWasm contracts to call into custom modules of Link Core" -readme = "README.md" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -cosmwasm-std = { path = "../std", version = "0.14.0-0.3.0" } -schemars = "0.7" -serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] } -serde_json = "1.0" - -[dev-dependencies] -cosmwasm-schema = { path = "../schema" } diff --git a/packages/ext/README.md b/packages/ext/README.md deleted file mode 100644 index d16900c42..000000000 --- a/packages/ext/README.md +++ /dev/null @@ -1 +0,0 @@ -# link-extension diff --git a/packages/ext/examples/schema.rs b/packages/ext/examples/schema.rs deleted file mode 100644 index eb2904a21..000000000 --- a/packages/ext/examples/schema.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_ext::{CollectionMsg, CollectionRoute, LinkMsgWrapper, TokenMsg, TokenRoute}; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; - -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!(LinkMsgWrapper), &out_dir); - export_schema( - &schema_for!(LinkMsgWrapper), - &out_dir, - ); -} diff --git a/packages/ext/schema/link_msg_wrapper_for__collection_route_and__collection_msg.json b/packages/ext/schema/link_msg_wrapper_for__collection_route_and__collection_msg.json deleted file mode 100644 index 9032f21f8..000000000 --- a/packages/ext/schema/link_msg_wrapper_for__collection_route_and__collection_msg.json +++ /dev/null @@ -1,683 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "LinkMsgWrapper_for_CollectionRoute_and_CollectionMsg", - "type": "object", - "required": [ - "module", - "msg_data" - ], - "properties": { - "module": { - "$ref": "#/definitions/Module" - }, - "msg_data": { - "$ref": "#/definitions/MsgData_for_CollectionRoute_and_CollectionMsg" - } - }, - "definitions": { - "Change": { - "type": "object", - "required": [ - "field", - "value" - ], - "properties": { - "field": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "Coin": { - "type": "object", - "required": [ - "amount", - "token_id" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "token_id": { - "type": "string" - } - } - }, - "CollectionMsg": { - "anyOf": [ - { - "type": "object", - "required": [ - "base_img_uri", - "meta", - "name", - "owner" - ], - "properties": { - "base_img_uri": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "meta", - "name", - "owner" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "decimals", - "meta", - "mintable", - "name", - "owner", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "decimals": { - "$ref": "#/definitions/Uint128" - }, - "meta": { - "type": "string" - }, - "mintable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "params", - "to" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "params": { - "type": "array", - "items": { - "$ref": "#/definitions/MintNFTParam" - } - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "to", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "to", - "token_ids" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - }, - "token_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy", - "to" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "permission", - "to" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "$ref": "#/definitions/permission" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "permission" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "$ref": "#/definitions/permission" - } - } - }, - { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "to_token_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to_token_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "token_id": { - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "to_token_id", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to_token_id": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "proxy", - "token_id" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "token_id": { - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "changes", - "contract_id", - "owner", - "token_index", - "token_type" - ], - "properties": { - "changes": { - "type": "array", - "items": { - "$ref": "#/definitions/Change" - } - }, - "contract_id": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "token_index": { - "type": "string" - }, - "token_type": { - "type": "string" - } - } - } - ] - }, - "CollectionRoute": { - "type": "string", - "enum": [ - "create", - "issue_nft", - "issue_ft", - "mint_nft", - "mint_ft", - "burn_nft", - "burn_nft_from", - "burn_ft", - "burn_ft_from", - "transfer_nft", - "transfer_nft_from", - "transfer_ft", - "transfer_ft_from", - "approve", - "disapprove", - "attach", - "detach", - "attach_from", - "detach_from", - "grant_perm", - "revoke_perm", - "modify" - ] - }, - "HumanAddr": { - "type": "string" - }, - "MintNFTParam": { - "type": "object", - "required": [ - "meta", - "name", - "token_type" - ], - "properties": { - "meta": { - "type": "string" - }, - "name": { - "type": "string" - }, - "token_type": { - "type": "string" - } - } - }, - "Module": { - "type": "string", - "enum": [ - "tokenencode", - "collectionencode" - ] - }, - "MsgData_for_CollectionRoute_and_CollectionMsg": { - "type": "object", - "required": [ - "data", - "route" - ], - "properties": { - "data": { - "$ref": "#/definitions/CollectionMsg" - }, - "route": { - "$ref": "#/definitions/CollectionRoute" - } - } - }, - "Uint128": { - "type": "string" - }, - "permission": { - "type": "string", - "enum": [ - "mint", - "burn", - "issue", - "modify" - ] - } - } -} diff --git a/packages/ext/schema/link_msg_wrapper_for__token_route_and__token_msg.json b/packages/ext/schema/link_msg_wrapper_for__token_route_and__token_msg.json deleted file mode 100644 index 1b30f2ca5..000000000 --- a/packages/ext/schema/link_msg_wrapper_for__token_route_and__token_msg.json +++ /dev/null @@ -1,330 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "LinkMsgWrapper_for_TokenRoute_and_TokenMsg", - "type": "object", - "required": [ - "module", - "msg_data" - ], - "properties": { - "module": { - "$ref": "#/definitions/Module" - }, - "msg_data": { - "$ref": "#/definitions/MsgData_for_TokenRoute_and_TokenMsg" - } - }, - "definitions": { - "Change": { - "type": "object", - "required": [ - "field", - "value" - ], - "properties": { - "field": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "HumanAddr": { - "type": "string" - }, - "Module": { - "type": "string", - "enum": [ - "tokenencode", - "collectionencode" - ] - }, - "MsgData_for_TokenRoute_and_TokenMsg": { - "type": "object", - "required": [ - "data", - "route" - ], - "properties": { - "data": { - "$ref": "#/definitions/TokenMsg" - }, - "route": { - "$ref": "#/definitions/TokenRoute" - } - } - }, - "TokenMsg": { - "anyOf": [ - { - "type": "object", - "required": [ - "amount", - "decimals", - "img_uri", - "meta", - "mintable", - "name", - "owner", - "symbol", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "decimals": { - "$ref": "#/definitions/Uint128" - }, - "img_uri": { - "type": "string" - }, - "meta": { - "type": "string" - }, - "mintable": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - }, - "symbol": { - "type": "string" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "to" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "amount", - "contract_id", - "from", - "proxy" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "permission", - "to" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "$ref": "#/definitions/permission" - }, - "to": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "contract_id", - "from", - "permission" - ], - "properties": { - "contract_id": { - "type": "string" - }, - "from": { - "$ref": "#/definitions/HumanAddr" - }, - "permission": { - "$ref": "#/definitions/permission" - } - } - }, - { - "type": "object", - "required": [ - "changes", - "contract_id", - "owner" - ], - "properties": { - "changes": { - "type": "array", - "items": { - "$ref": "#/definitions/Change" - } - }, - "contract_id": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/HumanAddr" - } - } - }, - { - "type": "object", - "required": [ - "approver", - "contract_id", - "proxy" - ], - "properties": { - "approver": { - "$ref": "#/definitions/HumanAddr" - }, - "contract_id": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/HumanAddr" - } - } - } - ] - }, - "TokenRoute": { - "type": "string", - "enum": [ - "issue", - "transfer", - "transfer_from", - "mint", - "burn", - "burn_from", - "grant_perm", - "revoke_perm", - "modify", - "approve" - ] - }, - "Uint128": { - "type": "string" - }, - "permission": { - "type": "string", - "enum": [ - "mint", - "burn", - "modify" - ] - } - } -} diff --git a/packages/ext/src/collection.rs b/packages/ext/src/collection.rs deleted file mode 100644 index c086e48a9..000000000 --- a/packages/ext/src/collection.rs +++ /dev/null @@ -1,512 +0,0 @@ -use schemars::JsonSchema; -use serde::de::{Deserialize as deDeserialize, Deserializer, MapAccess, Visitor}; -use serde::{Deserialize, Serialize}; -use std::fmt; - -use std::str::FromStr; - -use cosmwasm_std::{HumanAddr, Uint128}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct Collection { - pub contract_id: String, - pub name: String, - pub meta: String, - pub base_img_uri: String, -} - -#[derive(Serialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(untagged)] -pub enum Token { - FT(FungibleToken), - NFT(NonFungibleToken), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct FungibleToken { - pub contract_id: String, - pub token_id: String, - pub decimals: Uint128, - pub mintable: bool, - pub name: String, - pub meta: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct NonFungibleToken { - pub contract_id: String, - pub token_id: String, - pub owner: HumanAddr, - pub name: String, - pub meta: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct TokenType { - pub contract_id: String, - pub token_type: String, - pub name: String, - pub meta: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct Coin { - pub token_id: String, - pub amount: Uint128, -} - -impl Coin { - pub fn new(token_id: String, amount: Uint128) -> Self { - Coin { token_id, amount } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct MintNFTParam { - pub name: String, - pub meta: String, - pub token_type: String, -} - -impl MintNFTParam { - pub fn new(name: String, meta: String, token_type: String) -> Self { - MintNFTParam { - name, - meta, - token_type, - } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename = "permission")] -#[serde(rename_all = "snake_case")] -pub enum CollectionPerm { - Mint, - Burn, - Issue, - Modify, -} - -impl FromStr for CollectionPerm { - type Err = &'static str; - fn from_str(s: &str) -> Result { - match s { - "mint" => Ok(CollectionPerm::Mint), - "burn" => Ok(CollectionPerm::Burn), - "issue" => Ok(CollectionPerm::Issue), - "modify" => Ok(CollectionPerm::Modify), - _ => Err("Unknown permission type"), - } - } -} - -const FIELDS: &[&str] = &[ - "contract_id", - "token_id", - "name", - "meta", - "decimals", - "mintable", - "owner", -]; - -#[derive(Serialize)] -#[serde(rename_all = "snake_case")] -enum Field { - ContractId, - TokenId, - Name, - Meta, - Decimals, - Mintable, - Owner, -} - -struct FieldVisitor; - -impl<'de> Visitor<'de> for FieldVisitor { - type Value = Field; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str(&format!( - "`{}` or `{}` or `{}` or `{}` or `{}` or `{}` or `{}`", - FIELDS[0], FIELDS[1], FIELDS[2], FIELDS[3], FIELDS[4], FIELDS[5], FIELDS[6] - )) - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - match v { - "contract_id" => Ok(Field::ContractId), - "token_id" => Ok(Field::TokenId), - "name" => Ok(Field::Name), - "meta" => Ok(Field::Meta), - "decimals" => Ok(Field::Decimals), - "mintable" => Ok(Field::Mintable), - "owner" => Ok(Field::Owner), - _ => Err(serde::de::Error::unknown_field(v, FIELDS)), - } - } -} - -impl<'de> deDeserialize<'de> for Field { - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - deserializer.deserialize_identifier(FieldVisitor) - } -} - -struct TokenVisitor; - -impl<'de> Visitor<'de> for TokenVisitor { - type Value = Token; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("struct Token") - } - - fn visit_map(self, mut map: A) -> Result>::Error> - where - A: MapAccess<'de>, - { - let mut contract_id = None; - let mut token_id = None; - let mut name = None; - let mut meta = None; - let mut decimals_str = None; - let mut mintable = None; - let mut owner = None; - - while let Some(key) = map.next_key::()? { - match key { - Field::ContractId => { - if contract_id.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[0])); - } - contract_id = Some(map.next_value::()?); - } - Field::TokenId => { - if token_id.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[1])); - } - token_id = Some(map.next_value::()?); - } - Field::Name => { - if name.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[2])); - } - name = Some(map.next_value::()?); - } - Field::Meta => { - if meta.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[3])); - } - meta = Some(map.next_value::()?); - } - Field::Decimals => { - if decimals_str.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[4])); - } - decimals_str = Some(map.next_value::()?); - } - Field::Mintable => { - if mintable.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[5])); - } - mintable = Some(map.next_value::()?); - } - Field::Owner => { - if owner.is_some() { - return Err(serde::de::Error::duplicate_field(FIELDS[6])); - } - owner = Some(map.next_value::()?); - } - } - } - - let res: Result = match ( - contract_id, - token_id, - name, - meta, - decimals_str, - mintable, - owner, - ) { - ( - Some(contract_id), - Some(token_id), - Some(name), - Some(meta), - Some(decimals_str), - Some(mintable), - None, - ) => { - let decimals = (&decimals_str) - .parse::() - .unwrap_or_else(|e| panic!(e)); - Ok(Token::FT(FungibleToken { - contract_id, - token_id, - name, - meta, - decimals: Uint128::from(decimals), - mintable, - })) - } - ( - Some(contract_id), - Some(token_id), - Some(name), - Some(meta), - None, - None, - Some(owner), - ) => Ok(Token::NFT(NonFungibleToken { - contract_id, - token_id, - name, - meta, - owner: HumanAddr::from(owner), - })), - _ => Err(serde::de::Error::missing_field( - "The fields required to deserialize to FT or NFT are missing", - )), - }; - res - } -} - -impl<'de> deDeserialize<'de> for Token { - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - deserializer.deserialize_struct("Token", FIELDS, TokenVisitor) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - use crate::query::Response; - - #[test] - fn test_ft_and_nft_deserialize() { - let json = r#" - [ - { - "type": "collection/FT", - "value": { - "contract_id": "9be17165", - "token_id": "0000000100000000", - "decimals": "18", - "mintable": true, - "name": "ft_test_name-1", - "meta": "" - } - }, - { - "type": "collection/NFT", - "value": { - "contract_id": "9be17165", - "token_id": "1000000100000001", - "owner": "link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu", - "name": "nft-0", - "meta": "" - } - } - ] - "#; - - let res = serde_json::from_str::>>(json); - assert!(res.is_ok()); - let tokens = res.unwrap(); - let ft = tokens[0].clone(); - let nft = tokens[1].clone(); - - assert_eq!( - ft, - Response { - key: "collection/FT".to_string(), - value: Token::FT(FungibleToken { - contract_id: "9be17165".to_string(), - token_id: "0000000100000000".to_string(), - name: "ft_test_name-1".to_string(), - meta: "".to_string(), - decimals: Uint128(18), - mintable: true, - }) - } - ); - assert_eq!( - nft, - Response { - key: "collection/NFT".to_string(), - value: Token::NFT(NonFungibleToken { - contract_id: "9be17165".to_string(), - token_id: "1000000100000001".to_string(), - name: "nft-0".to_string(), - meta: "".to_string(), - owner: HumanAddr::from("link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu"), - }) - } - ) - } - - #[test] - fn test_fts_deserialize() { - let json = r#" - [ - { - "type": "collection/FT", - "value": { - "contract_id": "9be17165", - "token_id": "0000000100000000", - "decimals": "18", - "mintable": true, - "name": "ft_test_name-1", - "meta": "" - } - }, - { - "type": "collection/FT", - "value": { - "contract_id": "9be17165", - "token_id": "0000000100000001", - "decimals": "8", - "mintable": false, - "name": "ft_test_name-2", - "meta": "meta" - - } - } - ] - "#; - - let res = serde_json::from_str::>>(json); - assert!(res.is_ok()); - let tokens = res.unwrap(); - let ft1 = tokens[0].clone(); - let ft2 = tokens[1].clone(); - - assert_eq!( - ft1, - Response { - key: "collection/FT".to_string(), - value: Token::FT(FungibleToken { - contract_id: "9be17165".to_string(), - token_id: "0000000100000000".to_string(), - name: "ft_test_name-1".to_string(), - meta: "".to_string(), - decimals: Uint128(18), - mintable: true, - }) - } - ); - assert_eq!( - ft2, - Response { - key: "collection/FT".to_string(), - value: Token::FT(FungibleToken { - contract_id: "9be17165".to_string(), - token_id: "0000000100000001".to_string(), - name: "ft_test_name-2".to_string(), - meta: "meta".to_string(), - decimals: Uint128(8), - mintable: false, - }) - } - ) - } - - #[test] - fn test_nfts_deserialize() { - let json = r#" - [ - { - "type": "collection/NFT", - "value": { - "contract_id": "9be17165", - "token_id": "1000000100000001", - "owner": "link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu", - "name": "nft-0", - "meta": "" - } - }, - { - "type": "collection/NFT", - "value": { - "contract_id": "9be17165", - "token_id": "1000000100000002", - "owner": "link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu", - "name": "nft-1", - "meta": "" - } - } - ] - "#; - - let res = serde_json::from_str::>>(json); - assert!(res.is_ok()); - let tokens = res.unwrap(); - let nft1 = tokens[0].clone(); - let nft2 = tokens[1].clone(); - - assert_eq!( - nft1, - Response { - key: "collection/NFT".to_string(), - value: Token::NFT(NonFungibleToken { - contract_id: "9be17165".to_string(), - token_id: "1000000100000001".to_string(), - name: "nft-0".to_string(), - meta: "".to_string(), - owner: HumanAddr::from("link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu"), - }) - } - ); - assert_eq!( - nft2, - Response { - key: "collection/NFT".to_string(), - value: Token::NFT(NonFungibleToken { - contract_id: "9be17165".to_string(), - token_id: "1000000100000002".to_string(), - name: "nft-1".to_string(), - meta: "".to_string(), - owner: HumanAddr::from("link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu"), - }) - } - ) - } - - #[test] - fn test_invalid_token_deserialize() { - let json = r#" - [ - { - "type": "collection/FT", - "value": { - "contract_id": "9be17165", - "token_id": "0000000100000000", - "decimals": "18", - "mintable": true, - "name": "ft_test_name-1", - "meta": "" - "owner": "link18vd8fpwxzck93qlwghaj6arh4p7c5n89fvcmzu", - } - } - ] - "#; - - let res = serde_json::from_str::>>(json); - assert!(!res.is_ok()); - } -} diff --git a/packages/ext/src/lib.rs b/packages/ext/src/lib.rs deleted file mode 100644 index 76e0641b4..000000000 --- a/packages/ext/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -mod collection; -mod msg; -mod msg_collection; -mod msg_token; -mod querier_collection; -mod querier_token; -mod query; -mod token; - -pub use collection::{ - Coin, Collection, CollectionPerm, MintNFTParam, Token as CollectionToken, TokenType, -}; -pub use msg::{Change, LinkMsgWrapper, Module, MsgData}; -pub use msg_collection::{CollectionMsg, CollectionRoute}; -pub use msg_token::{TokenMsg, TokenRoute}; -pub use querier_collection::{CollectionQuery, CollectionQueryRoute, LinkCollectionQuerier}; -pub use querier_token::{LinkTokenQuerier, TokenQuery, TokenQueryRoute}; -pub use query::{LinkQueryWrapper, QueryData, Response, Target}; -pub use token::{Token, TokenPerm}; - -// This export is added to all contracts that import this package, signifying that they require -// "link" support on the chain they run on. -#[no_mangle] -extern "C" fn requires_link() {} diff --git a/packages/ext/src/msg.rs b/packages/ext/src/msg.rs deleted file mode 100644 index ea844d1ab..000000000 --- a/packages/ext/src/msg.rs +++ /dev/null @@ -1,56 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::msg_collection::{CollectionMsg, CollectionRoute}; -use crate::msg_token::{TokenMsg, TokenRoute}; -use cosmwasm_std::CosmosMsg; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum Module { - Tokenencode, - Collectionencode, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Change { - pub field: String, - pub value: String, -} - -impl Change { - pub fn new(field: String, value: String) -> Self { - Change { field, value } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LinkMsgWrapper { - pub module: Module, - pub msg_data: MsgData, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MsgData { - pub route: R, - pub data: D, -} - -impl Into>> - for LinkMsgWrapper -{ - fn into(self) -> CosmosMsg> { - CosmosMsg::Custom(self) - } -} - -impl Into>> - for LinkMsgWrapper -{ - fn into(self) -> CosmosMsg> { - CosmosMsg::Custom(self) - } -} diff --git a/packages/ext/src/msg_collection.rs b/packages/ext/src/msg_collection.rs deleted file mode 100644 index 8dd462bac..000000000 --- a/packages/ext/src/msg_collection.rs +++ /dev/null @@ -1,174 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, Uint128}; - -use crate::collection::{Coin, CollectionPerm, MintNFTParam}; -use crate::msg::Change; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum CollectionRoute { - Create, - IssueNft, - IssueFt, - MintNft, - MintFt, - BurnNft, - BurnNftFrom, - BurnFt, - BurnFtFrom, - TransferNft, - TransferNftFrom, - TransferFt, - TransferFtFrom, - Approve, - Disapprove, - Attach, - Detach, - AttachFrom, - DetachFrom, - GrantPerm, - RevokePerm, - Modify, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -#[serde(untagged)] -pub enum CollectionMsg { - Create { - owner: HumanAddr, - name: String, - meta: String, - base_img_uri: String, - }, - IssueNft { - owner: HumanAddr, - contract_id: String, - name: String, - meta: String, - }, - IssueFt { - owner: HumanAddr, - contract_id: String, - to: HumanAddr, - name: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, - }, - MintNft { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - params: Vec, - }, - MintFt { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Vec, - }, - BurnNft { - from: HumanAddr, - contract_id: String, - token_ids: Vec, - }, - BurnNftFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_ids: Vec, - }, - BurnFt { - from: HumanAddr, - contract_id: String, - amount: Vec, - }, - BurnFtFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - amount: Vec, - }, - TransferNft { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - token_ids: Vec, - }, - TransferNftFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - token_ids: Vec, - }, - TransferFt { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Vec, - }, - TransferFtFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to: HumanAddr, - amount: Vec, - }, - GrantPerm { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - permission: CollectionPerm, - }, - RevokePerm { - from: HumanAddr, - contract_id: String, - permission: CollectionPerm, - }, - Approve { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, - Disapprove { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, - Attach { - from: HumanAddr, - contract_id: String, - to_token_id: String, - token_id: String, - }, - Detach { - from: HumanAddr, - contract_id: String, - token_id: String, - }, - AttachFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - to_token_id: String, - token_id: String, - }, - DetachFrom { - proxy: HumanAddr, - contract_id: String, - from: HumanAddr, - token_id: String, - }, - Modify { - owner: HumanAddr, - contract_id: String, - token_type: String, - token_index: String, - changes: Vec, - }, -} diff --git a/packages/ext/src/msg_token.rs b/packages/ext/src/msg_token.rs deleted file mode 100644 index af74e699b..000000000 --- a/packages/ext/src/msg_token.rs +++ /dev/null @@ -1,137 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, Uint128}; - -use crate::msg::Change; -use crate::token::TokenPerm; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum TokenRoute { - Issue, - Transfer, - TransferFrom, - Mint, - Burn, - BurnFrom, - GrantPerm, - RevokePerm, - Modify, - Approve, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -#[serde(untagged)] -pub enum TokenMsg { - Issue { - owner: HumanAddr, - to: HumanAddr, - name: String, - symbol: String, - img_uri: String, - meta: String, - amount: Uint128, - mintable: bool, - decimals: Uint128, - }, - Transfer { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - TransferFrom { - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - Mint { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - amount: Uint128, - }, - Burn { - from: HumanAddr, - contract_id: String, - amount: Uint128, - }, - BurnFrom { - proxy: HumanAddr, - from: HumanAddr, - contract_id: String, - amount: Uint128, - }, - GrantPerm { - from: HumanAddr, - contract_id: String, - to: HumanAddr, - permission: TokenPerm, - }, - RevokePerm { - from: HumanAddr, - contract_id: String, - permission: TokenPerm, - }, - Modify { - owner: HumanAddr, - contract_id: String, - changes: Vec, - }, - Approve { - approver: HumanAddr, - contract_id: String, - proxy: HumanAddr, - }, -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - #[allow(irrefutable_let_patterns)] - fn new_msg_issue() { - let addr1 = HumanAddr::from("addr1"); - let addr2 = HumanAddr::from("addr2"); - - let msg_issue = TokenMsg::Issue { - owner: addr1.clone(), - to: addr2.clone(), - name: "test_token".to_string(), - symbol: "TT1".to_string(), - img_uri: "".to_string(), - meta: "".to_string(), - amount: Uint128(100), - mintable: true, - decimals: Uint128(18), - }; - - if let TokenMsg::Issue { - owner, - to, - name, - symbol, - img_uri, - meta, - amount, - mintable, - decimals, - } = msg_issue - { - assert_eq!(owner, addr1); - assert_eq!(to, addr2); - assert_eq!(name, "test_token".to_string()); - assert_eq!(symbol, "TT1".to_string()); - assert_eq!(img_uri, "".to_string()); - assert_eq!(meta, "".to_string()); - assert_eq!(amount, Uint128(100)); - assert_eq!(mintable, true); - assert_eq!(decimals, Uint128(18)); - } - } -} diff --git a/packages/ext/src/querier_collection.rs b/packages/ext/src/querier_collection.rs deleted file mode 100644 index fe54dd85b..000000000 --- a/packages/ext/src/querier_collection.rs +++ /dev/null @@ -1,403 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, QuerierWrapper, StdResult, Uint128}; - -use crate::collection::{Collection, CollectionPerm, Token, TokenType}; -use crate::query::{LinkQueryWrapper, Module, QueryData, Response}; - -pub struct LinkCollectionQuerier<'a> { - querier: QuerierWrapper<'a>, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum CollectionQueryRoute { - Collections, - Balance, - Tokens, - Supply, - Perms, - Tokentypes, - Nftcount, - Nftmint, - Nftburn, - Mint, - Burn, - Total, - Root, - Parent, - Children, - Approved, - Approver, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum CollectionQuery { - CollectionParam { - contract_id: String, - }, - BalanceParam { - contract_id: String, - token_id: String, - addr: HumanAddr, - }, - TokentypesParam { - contract_id: String, - token_id: String, - }, - TokensParam { - contract_id: String, - token_id: String, - }, - TotalParam { - contract_id: String, - token_id: String, - }, - PermParam { - contract_id: String, - address: HumanAddr, - }, - ParentParam { - contract_id: String, - token_id: String, - }, - RootParam { - contract_id: String, - token_id: String, - }, - ChildrenParam { - contract_id: String, - token_id: String, - }, - IsApprovedParam { - contract_id: String, - proxy: HumanAddr, - approver: HumanAddr, - }, - ApproversParam { - contract_id: String, - proxy: HumanAddr, - }, -} - -impl<'a> LinkCollectionQuerier<'a> { - pub fn new(querier: QuerierWrapper<'a>) -> Self { - LinkCollectionQuerier { querier } - } - - pub fn query_collection(&self, contract_id: String) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Collections, - data: CollectionQuery::CollectionParam { contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_balance( - &self, - contract_id: String, - token_id: String, - addr: HumanAddr, - ) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Balance, - data: CollectionQuery::BalanceParam { - contract_id, - token_id, - addr, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_token_type( - &self, - contract_id: String, - token_id: String, - ) -> StdResult> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Tokentypes, - data: CollectionQuery::TokentypesParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_token_types(&self, contract_id: String) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Tokentypes, - data: CollectionQuery::TokentypesParam { - contract_id, - token_id: "".to_string(), - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_token(&self, contract_id: String, token_id: String) -> StdResult> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Tokens, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_tokens(&self, contract_id: String) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Tokens, - data: CollectionQuery::TokensParam { - contract_id, - token_id: "".to_string(), - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_nft_count(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Nftcount, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_nft_mint(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Nftmint, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_nft_burn(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Nftburn, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_supply(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Supply, - data: CollectionQuery::TotalParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_mint(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Mint, - data: CollectionQuery::TotalParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_burn(&self, contract_id: String, token_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Burn, - data: CollectionQuery::TotalParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_parent( - &self, - contract_id: String, - token_id: String, - ) -> StdResult> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Parent, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_root(&self, contract_id: String, token_id: String) -> StdResult> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Root, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_children( - &self, - contract_id: String, - token_id: String, - ) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Children, - data: CollectionQuery::TokensParam { - contract_id, - token_id, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_perm( - &self, - contract_id: String, - address: HumanAddr, - ) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Perms, - data: CollectionQuery::PermParam { - contract_id, - address, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_is_approved( - &self, - contract_id: String, - proxy: HumanAddr, - approver: HumanAddr, - ) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Approved, - data: CollectionQuery::IsApprovedParam { - contract_id, - proxy, - approver, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_approvers( - &self, - proxy: HumanAddr, - contract_id: String, - ) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Collectionencode, - query_data: QueryData { - route: CollectionQueryRoute::Approver, - data: CollectionQuery::ApproversParam { proxy, contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } -} diff --git a/packages/ext/src/querier_token.rs b/packages/ext/src/querier_token.rs deleted file mode 100644 index 410b21b56..000000000 --- a/packages/ext/src/querier_token.rs +++ /dev/null @@ -1,185 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{HumanAddr, QuerierWrapper, StdResult, Uint128}; - -use crate::query::{LinkQueryWrapper, Module, QueryData, Response}; -use crate::token::{Token, TokenPerm}; - -pub struct LinkTokenQuerier<'a> { - querier: QuerierWrapper<'a>, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum TokenQueryRoute { - Tokens, - Balance, - Supply, - Mint, - Burn, - Perms, - Approved, - Approvers, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum TokenQuery { - TokenParam { - contract_id: String, - }, - BalanceParam { - contract_id: String, - address: HumanAddr, - }, - TotalParam { - contract_id: String, - }, - PermParam { - contract_id: String, - address: HumanAddr, - }, - IsApprovedParam { - proxy: HumanAddr, - contract_id: String, - approver: HumanAddr, - }, - ApproversParam { - proxy: HumanAddr, - contract_id: String, - }, -} - -impl<'a> LinkTokenQuerier<'a> { - pub fn new(querier: QuerierWrapper<'a>) -> Self { - LinkTokenQuerier { querier } - } - - pub fn query_token(&self, contract_id: String) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Tokens, - data: TokenQuery::TokenParam { contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_balance(&self, contract_id: String, address: HumanAddr) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Balance, - data: TokenQuery::BalanceParam { - contract_id, - address, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_supply(&self, contract_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Supply, - data: TokenQuery::TotalParam { contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_mint(&self, contract_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Mint, - data: TokenQuery::TotalParam { contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_burn(&self, contract_id: String) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Burn, - data: TokenQuery::TotalParam { contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_perm( - &self, - contract_id: String, - address: HumanAddr, - ) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Perms, - data: TokenQuery::PermParam { - contract_id, - address, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_is_approved( - &self, - proxy: HumanAddr, - contract_id: String, - approver: HumanAddr, - ) -> StdResult { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Approved, - data: TokenQuery::IsApprovedParam { - proxy, - contract_id, - approver, - }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } - - pub fn query_approvers( - &self, - proxy: HumanAddr, - contract_id: String, - ) -> StdResult>> { - let request = LinkQueryWrapper:: { - module: Module::Tokenencode, - query_data: QueryData { - route: TokenQueryRoute::Approvers, - data: TokenQuery::ApproversParam { proxy, contract_id }, - }, - }; - - let res = self.querier.custom_query(&request.into())?; - Ok(res) - } -} diff --git a/packages/ext/src/query.rs b/packages/ext/src/query.rs deleted file mode 100644 index d59c2481a..000000000 --- a/packages/ext/src/query.rs +++ /dev/null @@ -1,60 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use std::str::FromStr; - -use cosmwasm_std::CustomQuery; - -use crate::querier_collection::{CollectionQuery, CollectionQueryRoute}; -use crate::querier_token::{TokenQuery, TokenQueryRoute}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum Module { - Tokenencode, - Collectionencode, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LinkQueryWrapper { - pub module: Module, - pub query_data: QueryData, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryData { - pub route: R, - pub data: D, -} - -impl CustomQuery for LinkQueryWrapper {} - -impl CustomQuery for LinkQueryWrapper {} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum Target { - Mint, - Burn, - Supply, -} - -impl FromStr for Target { - type Err = &'static str; - fn from_str(s: &str) -> Result { - match s { - "mint" => Ok(Target::Mint), - "burn" => Ok(Target::Burn), - "supply" => Ok(Target::Supply), - _ => Err("Unknown target type"), - } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct Response { - #[serde(rename = "type")] - pub key: String, - pub value: T, -} diff --git a/packages/ext/src/token.rs b/packages/ext/src/token.rs deleted file mode 100644 index c15a90e90..000000000 --- a/packages/ext/src/token.rs +++ /dev/null @@ -1,37 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use std::str::FromStr; - -use cosmwasm_std::Uint128; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct Token { - pub contract_id: String, - pub name: String, - pub symbol: String, - pub meta: String, - pub img_uri: String, - pub decimals: Uint128, - pub mintable: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename = "permission")] -#[serde(rename_all = "snake_case")] -pub enum TokenPerm { - Mint, - Burn, - Modify, -} - -impl FromStr for TokenPerm { - type Err = &'static str; - fn from_str(s: &str) -> Result { - match s { - "mint" => Ok(TokenPerm::Mint), - "burn" => Ok(TokenPerm::Burn), - "modify" => Ok(TokenPerm::Modify), - _ => Err("Unknown permission type"), - } - } -}