diff --git a/.circleci/config.yml b/.circleci/config.yml index a7f8a50939..cc9e698ef9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: lint: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: medium environment: VERBOSE: "1" @@ -13,7 +13,7 @@ jobs: command: ./scripts/rustfmt.sh build: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: xlarge environment: - VERBOSE: "1" @@ -37,14 +37,33 @@ jobs: - "~/.cargo" - "./target" benchmark-build: - docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + machine: + image: ubuntu-2004:202010-01 resource_class: xlarge environment: - VERBOSE: "1" - - RUSTC_WORKSPACE_WRAPPER: ./scripts/rustc.sh steps: - checkout + - run: + shell: /bin/bash + name: Setup rust-nightly environment. + command: | + sudo apt update + sudo apt install build-essential \ + clang cmake \ + gcc jq libclang-dev libssl-dev \ + pkg-config ca-certificates rsync curl \ + -y --no-install-recommends + export TOOLCHAIN=`cat rust-toolchain` + # Download rustup installer. + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs >./rustup_install.sh + # Run rustup installer. + bash ./rustup_install.sh -y --default-toolchain $TOOLCHAIN + # Add rustup to PATH. + source $HOME/.cargo/env + # Install wasm tools. + ./scripts/init.sh + - run: name: Store rust version in an environment var for cache key command: rustc --version > rust.version @@ -53,6 +72,8 @@ jobs: - v2-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - run: name: Build binary with runtime-benchmarks + environment: + - RUSTC_WORKSPACE_WRAPPER: ./scripts/rustc.sh command: cargo build --release --features=runtime-benchmarks,running-ci no_output_timeout: 1h - persist_to_workspace: @@ -62,7 +83,6 @@ jobs: - save_cache: key: v2-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: - - "/usr/local/cargo" - "~/.cargo" - "./target" benchmark: @@ -76,11 +96,11 @@ jobs: at: . - run: name: Run benchmarks - command: ./polymesh benchmark -p=* -e=* -r 1 -s 1 --execution native --db-cache 512 --heap-pages=2048 + command: ./polymesh benchmark pallet -p=* -e=* -r 1 -s 1 --execution native --db-cache 512 --heap-pages=2048 no_output_timeout: 1h migration-tests: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: large environment: - VERBOSE: "1" @@ -106,7 +126,7 @@ jobs: - "./target" test: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: large environment: - VERBOSE: "1" @@ -141,19 +161,21 @@ jobs: - "./target" coverage: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 - resource_class: large + - image: cimg/rust:1.60.0 + resource_class: xlarge environment: - VERBOSE: "1" - - RUSTC_WORKSPACE_WRAPPER: ./scripts/rustc.sh steps: + - run: + name: Install libclang + command: sudo apt-get update && sudo apt-get install libclang-dev - checkout - run: name: Store rust version in a file for cache key - command: rustc --version > rust.version + command: rustc --version | tee rust.version - restore_cache: keys: - - v5-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + - v6-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} - run: name: Install dependencies command: rustup component add llvm-tools-preview && cargo install rustfilt cargo-binutils @@ -162,14 +184,12 @@ jobs: command: bash ./scripts/coverage.sh no_output_timeout: 1h - save_cache: - key: v5-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} + key: v6-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }} paths: - - "/usr/local/cargo" - "~/.cargo" - - "./target" cli: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: xlarge environment: VERBOSE: "1" @@ -208,7 +228,7 @@ jobs: - "./scripts/cli/node_modules" clippy: docker: - - image: polymathnet/rust:debian-nightly-2021-08-24 + - image: polymathnet/rust:debian-nightly-2022-05-10 resource_class: large environment: VERBOSE: "1" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8e9dc63ae4..8e857a5c0d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,8 +12,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use rust nightly 2021-08-24 for building docs. - run: echo "nightly-2021-08-24" > ./rust-toolchain - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: diff --git a/.maintain/benchmarks_1.sh b/.maintain/benchmarks_1.sh index 6e07fad328..6f12dcdf2e 100755 --- a/.maintain/benchmarks_1.sh +++ b/.maintain/benchmarks_1.sh @@ -1,10 +1,10 @@ -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_session -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_multisig -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_corporate_ballot -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_babe -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_timestamp -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_scheduler -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_indices -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_corporate_actions -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_asset -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_test_utils -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt \ No newline at end of file +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_session -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_multisig -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_corporate_ballot -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_babe -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_timestamp -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_scheduler -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_indices -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_corporate_actions -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_asset -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_test_utils -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt diff --git a/.maintain/benchmarks_2.sh b/.maintain/benchmarks_2.sh index 32eb8b1c31..97757b9fbb 100755 --- a/.maintain/benchmarks_2.sh +++ b/.maintain/benchmarks_2.sh @@ -1,11 +1,11 @@ -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_im_online -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_compliance_manager -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_sto -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_relayer -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_identity -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_committee -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_statistics -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_protocol_fee -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_group -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_checkpoint -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=frame_system -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt \ No newline at end of file +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_im_online -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_compliance_manager -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_sto -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_relayer -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_identity -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_committee -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_statistics -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_protocol_fee -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_group -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_checkpoint -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=frame_system -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt diff --git a/.maintain/benchmarks_3.sh b/.maintain/benchmarks_3.sh index 3f0a4926ec..749140e696 100755 --- a/.maintain/benchmarks_3.sh +++ b/.maintain/benchmarks_3.sh @@ -1,11 +1,11 @@ -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_staking -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_portfolio -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_grandpa -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_capital_distribution -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_utility -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_settlement -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_pips -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_external_agents -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_balances -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_treasury -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt -./target/release/polymesh benchmark -s 100 -r 5 -p=pallet_rewards -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt \ No newline at end of file +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_staking -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_portfolio -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_grandpa -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_capital_distribution -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_utility -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_settlement -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_pips -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_external_agents -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_balances -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_treasury -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_rewards -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs --raw >> data.txt 2>> log.txt diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs index 2253452e20..b37875046f 100644 --- a/.maintain/frame-weight-template.hbs +++ b/.maintain/frame-weight-template.hbs @@ -18,7 +18,7 @@ //! Autogenerated weights for {{pallet}} //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} -//! DATE: {{date}}, STEPS: {{cmd.steps}}, REPEAT: {{cmd.repeat}}, LOW RANGE: {{cmd.lowest_range_values}}, HIGH RANGE: {{cmd.highest_range_values}} +//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` //! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} // Executed Command: @@ -29,75 +29,37 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for {{pallet}}. -pub trait WeightInfo { - {{~#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{c.name}}: u32, {{/each~}} - ) -> Weight; - {{~/each}} -} +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for {{pallet}} using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - {{~#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} - ) -> Weight { - ({{underscore benchmark.base_weight}} as Weight) - {{~#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)) - {{~/each}} - {{~#if (ne benchmark.base_reads "0")}} - .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight)) - {{~/if}} - {{~#each benchmark.component_reads as |cr|}} - .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight))) - {{~/each}} - {{~#if (ne benchmark.base_writes "0")}} - .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight)) - {{~/if}} - {{~#each benchmark.component_writes as |cw|}} - .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))) - {{~/each}} - } - {{~/each}} -} - -// For backwards compatibility and tests -impl WeightInfo for () { - {{~#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} - ) -> Weight { - ({{underscore benchmark.base_weight}} as Weight) - {{~#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)) - {{~/each}} - {{~#if (ne benchmark.base_reads "0")}} - .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight)) - {{~/if}} - {{~#each benchmark.component_reads as |cr|}} - .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight))) - {{~/each}} - {{~#if (ne benchmark.base_writes "0")}} - .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight)) - {{~/if}} - {{~#each benchmark.component_writes as |cw|}} - .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))) - {{~/each}} - } - {{~/each}} +pub struct WeightInfo; +impl {{pallet}}::WeightInfo for WeightInfo { + {{#each benchmarks as |benchmark|}} + {{#each benchmark.comments as |comment|}} + // {{comment}} + {{/each}} + fn {{benchmark.name~}} + ( + {{~#each benchmark.components as |c| ~}} + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} + ) -> Weight { + ({{underscore benchmark.base_weight}} as Weight) + {{#each benchmark.component_weight as |cw|}} + // Standard Error: {{underscore cw.error}} + .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)) + {{/each}} + {{#if (ne benchmark.base_reads "0")}} + .saturating_add(DbWeight::get().reads({{benchmark.base_reads}} as Weight)) + {{/if}} + {{#each benchmark.component_reads as |cr|}} + .saturating_add(DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight))) + {{/each}} + {{#if (ne benchmark.base_writes "0")}} + .saturating_add(DbWeight::get().writes({{benchmark.base_writes}} as Weight)) + {{/if}} + {{#each benchmark.component_writes as |cw|}} + .saturating_add(DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))) + {{/each}} + } + {{/each}} } diff --git a/Cargo.lock b/Cargo.lock index 5d9771ec51..2958b4dff5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,20 +14,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.14.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli 0.23.0", -] - -[[package]] -name = "addr2line" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" -dependencies = [ - "gimli 0.25.0", + "gimli", ] [[package]] @@ -38,71 +29,46 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.3.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] name = "aes" -version = "0.5.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd2bc6d3f370b5666245ff421e231cba4353df936e26986d2918e61a8fd6aef6" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "aes-soft", - "aesni", - "block-cipher", + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug 0.3.0", ] [[package]] name = "aes-gcm" -version = "0.7.0" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0301c9e9c443494d970a07885e8cf3e587bae8356a1d5abd0999068413f7205f" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ "aead", "aes", - "block-cipher", + "cipher", + "ctr", "ghash", - "subtle 2.4.1", + "subtle", ] -[[package]] -name = "aes-soft" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63dd91889c49327ad7ef3b500fd1109dbd3c509a03db0d4a9ce413b79f575cb6" -dependencies = [ - "block-cipher", - "byteorder", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aesni" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6fe808308bb07d393e2ea47780043ec47683fcf19cf5efc8ca51c50cc8c68a" -dependencies = [ - "block-cipher", - "opaque-debug 0.3.0", -] - -[[package]] -name = "ahash" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" - [[package]] name = "ahash" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.6", "once_cell", "version_check", ] @@ -116,15 +82,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -136,15 +93,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.43" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "approx" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" dependencies = [ "num-traits", ] @@ -172,27 +129,23 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "asn1_der" -version = "0.6.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" -dependencies = [ - "asn1_der_derive", -] +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" [[package]] -name = "asn1_der_derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" +name = "asset-metadata" +version = "0.1.0" dependencies = [ - "quote", - "syn", + "parity-scale-codec 3.1.2", + "polymesh-primitives", + "scale-info", ] [[package]] @@ -222,9 +175,9 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.2" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +checksum = "c290043c9a95b05d45e952fb6383c67bcb61471f60cfa21e890dba6654234f43" dependencies = [ "async-channel", "async-executor", @@ -250,16 +203,16 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.1", + "socket2", "waker-fn", "winapi 0.3.9", ] [[package]] name = "async-lock" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" dependencies = [ "event-listener", ] @@ -275,9 +228,9 @@ dependencies = [ [[package]] name = "async-process" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b21b63ab5a0db0369deb913540af2892750e42d949faacc7a61495ac418a1692" +checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" dependencies = [ "async-io", "blocking", @@ -292,16 +245,16 @@ dependencies = [ [[package]] name = "async-std" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" +checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" dependencies = [ "async-channel", "async-global-executor", "async-io", "async-lock", "async-process", - "crossbeam-utils 0.8.5", + "crossbeam-utils", "futures-channel", "futures-core", "futures-io", @@ -312,23 +265,38 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", "pin-utils", "slab", "wasm-bindgen-futures", ] +[[package]] +name = "async-std-resolver" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +dependencies = [ + "async-std", + "async-trait", + "futures-io", + "futures-util", + "pin-utils", + "socket2", + "trust-dns-resolver", +] + [[package]] name = "async-task" -version = "4.0.3" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" +checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" dependencies = [ "proc-macro2", "quote", @@ -341,11 +309,11 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", ] [[package]] @@ -354,18 +322,18 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", ] [[package]] name = "atomic" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281" +checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" dependencies = [ "autocfg", ] @@ -389,36 +357,42 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.61" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ - "addr2line 0.16.0", + "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.26.1", + "object 0.28.4", "rustc-demangle", ] [[package]] name = "base-x" -version = "0.2.8" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc19a4937b4fbd3fe3379793130e42060d10627a360f2127802b10b87e7baf74" + +[[package]] +name = "base16ct" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" [[package]] name = "base58" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" [[package]] name = "base64" @@ -432,6 +406,26 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "beefy-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "parity-scale-codec 3.1.2", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bimap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" + [[package]] name = "bincode" version = "1.3.3" @@ -443,9 +437,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.1" +version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ "bitflags", "cexpr", @@ -478,36 +472,23 @@ dependencies = [ [[package]] name = "bitvec" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" -dependencies = [ - "funty", - "radium 0.5.3", - "tap", - "wyz", -] - -[[package]] -name = "bitvec" -version = "0.20.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" +checksum = "1489fcb93a5bb47da0462ca93ad252ad6af2145cce58d10d46a83931ba9f016b" dependencies = [ "funty", - "radium 0.6.2", + "radium 0.7.0", "tap", "wyz", ] [[package]] name = "blake2" -version = "0.9.1" -source = "git+https://github.com/PolymathNetwork/hashes?branch=master#237feb84842994875159500f9e5e62d6a511d030" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.3", ] [[package]] @@ -576,16 +557,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding 0.2.1", - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] -name = "block-cipher" -version = "0.8.0" +name = "block-buffer" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] @@ -605,9 +586,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "1.0.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" dependencies = [ "async-channel", "async-task", @@ -625,9 +606,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", @@ -647,27 +628,27 @@ dependencies = [ [[package]] name = "bulletproofs" version = "2.0.1" -source = "git+https://github.com/PolymathNetwork/bulletproofs.git?branch=bump-dalek#6cd831b7004e5b7e168d715bd6c99801bbc6b771" +source = "git+https://github.com/PolymathNetwork/bulletproofs.git?branch=bump-dalek#a8651f673610f1dc9122db4d8b7d0a451bab1608" dependencies = [ "byteorder", "curve25519-dalek 3.2.0", "digest 0.9.0", - "merlin 2.0.1", - "rand 0.7.3", - "rand_core 0.5.1", + "merlin 3.0.0", + "rand 0.8.5", + "rand_core 0.6.3", "serde", "serde_derive", - "sha3", - "subtle 2.4.1", + "sha3 0.9.1", + "subtle", "thiserror", "zeroize", ] [[package]] name = "bumpalo" -version = "3.7.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byte-slice-cast" @@ -677,9 +658,9 @@ checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" [[package]] name = "byte-slice-cast" -version = "1.0.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" +checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" [[package]] name = "byte-tools" @@ -700,27 +681,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ "byteorder", - "either", "iovec", ] [[package]] name = "bytes" -version = "0.5.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] -name = "bytes" -version = "1.0.1" +name = "bzip2-sys" +version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] [[package]] name = "cache-padded" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" + +[[package]] +name = "camino" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07fd178c5af4d59e83498ef15cf3f154e1a6f9d091270cb86283c65ef44e9ef0" +dependencies = [ + "serde", +] [[package]] name = "cargo-platform" @@ -733,13 +727,13 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.12.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ + "camino", "cargo-platform", - "semver 0.11.0", - "semver-parser 0.10.2", + "semver 1.0.9", "serde", "serde_json", ] @@ -755,18 +749,18 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.69" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] [[package]] name = "cexpr" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] @@ -785,24 +779,26 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "0.5.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244fbce0d47e97e8ef2f63b81d5e05882cb518c68531eb33194990d7b7e85845" +checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" dependencies = [ - "stream-cipher", + "cfg-if 1.0.0", + "cipher", + "cpufeatures", "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf18d374d66df0c05cdddd528a7db98f78c28e2519b120855c4f84c5027b1f5" +checksum = "3b84ed6d1d5f7aa9bdde921a5090e0ca4d934d250ea3b402a5fab3a994e28a2a" dependencies = [ "aead", "chacha20", + "cipher", "poly1305", - "stream-cipher", "zeroize", ] @@ -826,59 +822,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff0e3bc0b6446b3f9663c1a6aba6ef06c5aeaa1bc92bd18077be337198ab9768" dependencies = [ "multibase", - "multihash", + "multihash 0.13.2", "unsigned-varint 0.5.1", ] [[package]] name = "cipher" -version = "0.2.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] name = "clang-sys" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" dependencies = [ "glob 0.3.0", "libc", - "libloading 0.7.0", + "libloading 0.7.3", ] [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term 0.11.0", - "atty", "bitflags", - "strsim", - "textwrap", + "textwrap 0.11.0", "unicode-width", - "vec_map", ] [[package]] -name = "cloudabi" -version = "0.0.3" +name = "clap" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ + "atty", "bitflags", + "clap_derive", + "clap_lex", + "indexmap", + "lazy_static", + "strsim", + "termcolor", + "textwrap 0.15.0", +] + +[[package]] +name = "clap_derive" +version = "3.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" +dependencies = [ + "heck 0.4.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", ] [[package]] name = "cmake" -version = "0.1.45" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" dependencies = [ "cc", ] @@ -895,7 +917,7 @@ dependencies = [ [[package]] name = "confidential_identity" version = "1.0.0" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3#bfb4829e28b55e0a25efc321830579415aa9ff7a" +source = "git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1#6e6ca687cabb8d1203893a294d605e4ea2c15be5" dependencies = [ "blake2", "byteorder", @@ -903,13 +925,13 @@ dependencies = [ "curve25519-dalek 3.2.0", "failure", "lazy_static", - "merlin 2.0.1", - "rand 0.7.3", - "rand_core 0.5.1", + "merlin 3.0.0", + "rand 0.8.5", + "rand_core 0.6.3", "schnorrkel 0.10.1", "serde", "serde_json", - "sha3", + "sha3 0.9.1", "sp-io", "sp-std", "zeroize", @@ -918,26 +940,33 @@ dependencies = [ [[package]] name = "confidential_identity" version = "1.1.2" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v2.0.0#de6627508a9d7aa6818730b98215574eeec427bf" +source = "git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v2#d2d978ba023fb142ade19d4474385dcfc8b3d6fd" dependencies = [ "blake2", "byteorder", "criterion", - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v2.0.0)", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v2)", "curve25519-dalek 3.2.0", "failure", - "parity-scale-codec 2.2.0", - "rand 0.7.3", - "rand_core 0.5.1", + "parity-scale-codec 3.1.2", + "rand 0.8.5", + "rand_core 0.6.3", + "scale-info", "serde", "serde_bytes", "serde_json", - "sha3", + "sha3 0.9.1", "sp-io", "sp-std", "zeroize", ] +[[package]] +name = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -952,9 +981,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -962,133 +991,131 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.7.0" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "core2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] [[package]] name = "cpp_demangle" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea47428dc9d2237f3c6bc134472edfd63ebba0af932e783506dcfd66f10d18a" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "cpufeatures" -version = "0.1.5" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] -[[package]] -name = "cpuid-bool" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" - [[package]] name = "cranelift-bforest" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4066fd63b502d73eb8c5fa6bcab9c7962b05cd580f6b149ee83a8e730d8ce7fb" +checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a54e4beb833a3c873a18a8fe735d73d732044004c7539a072c8faa35ccb0c60" +checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" dependencies = [ - "byteorder", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli 0.23.0", + "gimli", "log", "regalloc", - "serde", - "smallvec 1.6.1", + "smallvec", "target-lexicon", - "thiserror", ] [[package]] name = "cranelift-codegen-meta" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54cac7cacb443658d8f0ff36a3545822613fa202c946c0891897843bc933810" +checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" dependencies = [ "cranelift-codegen-shared", - "cranelift-entity", ] [[package]] name = "cranelift-codegen-shared" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a109760aff76788b2cdaeefad6875a73c2b450be13906524f6c2a81e05b8d83c" +checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" [[package]] name = "cranelift-entity" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b044234aa32531f89a08b487630ddc6744696ec04c8123a1ad388de837f5de3" +checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5452b3e4e97538ee5ef2cc071301c69a86c7adf2770916b9d04e9727096abd93" +checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" dependencies = [ "cranelift-codegen", "log", - "smallvec 1.6.1", + "smallvec", "target-lexicon", ] [[package]] name = "cranelift-native" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68035c10b2e80f26cc29c32fa824380877f38483504c2a47b54e7da311caaf3" +checksum = "501241b0cdf903412ec9075385ac9f2b1eb18a89044d1538e97fab603231f70c" dependencies = [ "cranelift-codegen", - "raw-cpuid", + "libc", "target-lexicon", ] [[package]] name = "cranelift-wasm" -version = "0.69.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a530eb9d1c95b3309deb24c3d179d8b0ba5837ed98914a429787c395f614949d" +checksum = "16d9e4211bbc3268042a96dd4de5bd979cda22434991d035f5f8eacba987fad2" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "itertools 0.9.0", + "itertools", "log", - "serde", - "smallvec 1.6.1", - "thiserror", + "smallvec", "wasmparser", + "wasmtime-types", ] [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -1101,10 +1128,10 @@ checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10" dependencies = [ "atty", "cast", - "clap", + "clap 2.34.0", "criterion-plot", "csv", - "itertools 0.10.1", + "itertools", "lazy_static", "num-traits", "oorandom", @@ -1126,28 +1153,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" dependencies = [ "cast", - "itertools 0.10.1", + "itertools", ] [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch 0.8.2", - "crossbeam-utils 0.7.2", - "maybe-uninit", + "crossbeam-utils", ] [[package]] @@ -1157,122 +1173,108 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch 0.9.5", - "crossbeam-utils 0.8.5", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", + "cfg-if 1.0.0", + "crossbeam-utils", "lazy_static", - "maybe-uninit", - "memoffset 0.5.6", + "memoffset", "scopeguard", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.5" +name = "crossbeam-utils" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.5", "lazy_static", - "memoffset 0.6.4", - "scopeguard", ] [[package]] -name = "crossbeam-queue" -version = "0.2.3" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crossbeam-utils" -version = "0.7.2" +name = "crypto-bigint" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", + "generic-array 0.14.5", + "rand_core 0.6.3", + "subtle", + "zeroize", ] [[package]] -name = "crossbeam-utils" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +name = "crypto-cli" +version = "1.0.0" dependencies = [ - "cfg-if 1.0.0", - "lazy_static", + "confidential_identity 1.0.0", + "hex", + "parity-scale-codec 3.1.2", + "polymesh-primitives", ] [[package]] -name = "crunchy" -version = "0.2.2" +name = "crypto-common" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-cli" -version = "1.0.0" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ - "confidential_identity 1.0.0", - "hex", - "parity-scale-codec 2.2.0", - "polymesh-primitives", + "generic-array 0.14.5", + "typenum", ] [[package]] name = "crypto-mac" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.12.4", - "subtle 1.0.0", + "generic-array 0.14.5", + "subtle", ] [[package]] name = "crypto-mac" -version = "0.8.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.4", - "subtle 2.4.1", + "generic-array 0.14.5", + "subtle", ] [[package]] name = "cryptography_core" version = "1.0.0" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3#bfb4829e28b55e0a25efc321830579415aa9ff7a" +source = "git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1#6e6ca687cabb8d1203893a294d605e4ea2c15be5" dependencies = [ "bulletproofs", "byteorder", "criterion", "curve25519-dalek 3.2.0", "failure", - "merlin 2.0.1", - "parity-scale-codec 2.2.0", - "rand 0.7.3", - "rand_core 0.5.1", + "merlin 3.0.0", + "parity-scale-codec 3.1.2", + "rand 0.8.5", + "rand_core 0.6.3", "serde", - "sha3", + "sha3 0.9.1", "sp-std", "zeroize", ] @@ -1280,7 +1282,7 @@ dependencies = [ [[package]] name = "cryptography_core" version = "1.0.0" -source = "git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v2.0.0#de6627508a9d7aa6818730b98215574eeec427bf" +source = "git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v2#d2d978ba023fb142ade19d4474385dcfc8b3d6fd" dependencies = [ "blake2", "bulletproofs", @@ -1288,12 +1290,12 @@ dependencies = [ "criterion", "curve25519-dalek 3.2.0", "failure", - "merlin 2.0.1", - "parity-scale-codec 2.2.0", - "rand 0.7.3", - "rand_core 0.5.1", + "merlin 3.0.0", + "parity-scale-codec 3.1.2", + "rand 0.8.5", + "rand_core 0.6.3", "serde", - "sha3", + "sha3 0.9.1", "sp-std", "zeroize", ] @@ -1306,12 +1308,12 @@ checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" dependencies = [ "cssparser-macros", "dtoa-short", - "itoa", + "itoa 0.4.8", "matches", "phf", "proc-macro2", "quote", - "smallvec 1.6.1", + "smallvec", "syn", ] @@ -1333,7 +1335,7 @@ checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ "bstr", "csv-core", - "itoa", + "itoa 0.4.8", "ryu", "serde", ] @@ -1349,23 +1351,32 @@ dependencies = [ [[package]] name = "ct-logs" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c8e13110a84b6315df212c045be706af261fd364791cad863285439ebba672e" +checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" dependencies = [ - "sct", + "sct 0.6.1", ] [[package]] name = "ctor" -version = "0.1.20" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ "quote", "syn", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + [[package]] name = "cuckoofilter" version = "0.5.0" @@ -1386,22 +1397,35 @@ dependencies = [ "byteorder", "digest 0.8.1", "rand_core 0.5.1", - "subtle 2.4.1", + "subtle", "zeroize", ] [[package]] name = "curve25519-dalek" version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +source = "git+https://github.com/PolymathNetwork/curve25519-dalek?branch=master#bc3078e882261caf31b73a0d735078f930a1c4df" dependencies = [ "byteorder", "digest 0.9.0", "packed_simd_2", - "rand_core 0.5.1", + "rand_core 0.6.3", + "scale-info", "serde", - "subtle 2.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.3", + "subtle", "zeroize", ] @@ -1431,16 +1455,25 @@ dependencies = [ "syn", ] +[[package]] +name = "der" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", +] + [[package]] name = "derive_more" -version = "0.99.16" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.3.3", + "rustc_version 0.4.0", "syn", ] @@ -1459,14 +1492,25 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", ] [[package]] name = "directories" -version = "3.0.2" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e69600ff1703123957937708eb27f7a564e48885c537782722ed0ba3189ce1d7" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" dependencies = [ "dirs-sys", ] @@ -1481,14 +1525,25 @@ dependencies = [ "dirs-sys-next", ] +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" +dependencies = [ + "libc", + "redox_users 0.3.5", + "winapi 0.3.9", +] + [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users", + "redox_users 0.4.3", "winapi 0.3.9", ] @@ -1499,7 +1554,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users", + "redox_users 0.4.3", "winapi 0.3.9", ] @@ -1513,19 +1568,31 @@ dependencies = [ "quick-error 1.2.3", ] +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + [[package]] name = "dtoa" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +[[package]] +name = "dtoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5caaa75cbd2b960ff1e5392d2cfb1f44717fffe12fc1f32b7b5d1267f99732a6" + [[package]] name = "dtoa-short" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" dependencies = [ - "dtoa", + "dtoa 0.4.8", ] [[package]] @@ -1551,15 +1618,27 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" +checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" + +[[package]] +name = "ecdsa" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] [[package]] name = "ed25519" -version = "1.2.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" dependencies = [ "signature", ] @@ -1574,7 +1653,7 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "sha2 0.9.5", + "sha2 0.9.9", "zeroize", ] @@ -1590,6 +1669,42 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "elliptic-curve" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "ff", + "generic-array 0.14.5", + "group", + "rand_core 0.6.3", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck 0.4.0", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -1597,32 +1712,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime", + "humantime 1.3.0", "log", "regex", "termcolor", ] [[package]] -name = "environmental" -version = "1.1.3" +name = "env_logger" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime 2.1.0", + "log", + "regex", + "termcolor", +] [[package]] -name = "erased-serde" -version = "0.3.16" +name = "environmental" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de9ad4541d99dc22b59134e7ff8dc3d6c988c89ecd7324bf10a8362b07a2afa" -dependencies = [ - "serde", -] +checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" [[package]] name = "errno" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ "errno-dragonfly", "libc", @@ -1631,19 +1750,19 @@ dependencies = [ [[package]] name = "errno-dragonfly" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "gcc", + "cc", "libc", ] [[package]] name = "event-listener" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" +checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" [[package]] name = "exit-future" @@ -1651,7 +1770,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", ] [[package]] @@ -1690,9 +1809,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -1706,29 +1825,40 @@ dependencies = [ "libc", ] +[[package]] +name = "ff" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +dependencies = [ + "rand_core 0.6.3", + "subtle", +] + [[package]] name = "file-per-thread-logger" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126" +checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" dependencies = [ - "env_logger", + "env_logger 0.9.0", "log", ] [[package]] name = "finality-grandpa" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd795898c348a8ec9edc66ec9e014031c764d4c88cc26d09b492cd93eb41339" +checksum = "d9def033d8505edf199f6a5d07aa7e6d2d6185b164293b77f0efd108f4f3e11d" dependencies = [ "either", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", "log", "num-traits", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.11.2", + "scale-info", ] [[package]] @@ -1738,22 +1868,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand 0.8.4", + "rand 0.8.5", "rustc-hex", "static_assertions", ] [[package]] name = "fixedbitset" -version = "0.2.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flate2" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" +checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" dependencies = [ "cfg-if 1.0.0", "crc32fast", @@ -1771,9 +1901,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", ] [[package]] @@ -1788,15 +1918,19 @@ dependencies = [ [[package]] name = "frame-benchmarking" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", "linregress", - "parity-scale-codec 2.2.0", + "log", + "parity-scale-codec 3.1.2", "paste", + "scale-info", + "serde", "sp-api", + "sp-application-crypto", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -1806,36 +1940,90 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "Inflector", "chrono", + "clap 3.1.18", "frame-benchmarking", + "frame-support", + "frame-system", "handlebars", - "parity-scale-codec 2.2.0", + "hash-db", + "hex", + "itertools", + "kvdb", + "lazy_static", + "linked-hash-map", + "log", + "memory-db", + "parity-scale-codec 3.1.2", + "prettytable-rs", + "rand 0.8.5", + "rand_pcg 0.3.1", + "sc-block-builder", "sc-cli", + "sc-client-api", "sc-client-db", "sc-executor", "sc-service", + "sc-sysinfo", "serde", + "serde_json", + "serde_nanos", + "sp-api", + "sp-blockchain", "sp-core", + "sp-database", "sp-externalities", + "sp-inherents", "sp-keystore", "sp-runtime", "sp-state-machine", - "structopt", + "sp-storage", + "sp-trie", + "tempfile", + "thiserror", + "thousands", +] + +[[package]] +name = "frame-election-provider-solution-type" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-election-provider-support" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "frame-election-provider-solution-type", + "frame-support", + "frame-system", + "parity-scale-codec 3.1.2", + "scale-info", + "sp-arithmetic", + "sp-npos-elections", + "sp-runtime", + "sp-std", ] [[package]] name = "frame-executive" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-core", "sp-io", "sp-runtime", @@ -1845,32 +2033,36 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "13.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "parity-scale-codec 2.2.0", + "cfg-if 1.0.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", - "sp-core", - "sp-std", ] [[package]] name = "frame-support" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", + "k256", "log", "once_cell", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "paste", + "scale-info", "serde", - "smallvec 1.6.1", + "smallvec", "sp-arithmetic", "sp-core", + "sp-core-hashing-proc-macro", "sp-inherents", "sp-io", "sp-runtime", @@ -1878,12 +2070,13 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-tracing", + "tt-call", ] [[package]] name = "frame-support-procedural" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -1894,11 +2087,11 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", @@ -1907,7 +2100,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "proc-macro2", "quote", @@ -1916,12 +2109,13 @@ dependencies = [ [[package]] name = "frame-system" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", - "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "log", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-core", "sp-io", @@ -1932,13 +2126,14 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "sp-core", "sp-runtime", "sp-std", @@ -1946,10 +2141,10 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sp-api", ] @@ -1981,12 +2176,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -2005,15 +2194,15 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "funty" -version = "1.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futf" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" dependencies = [ "mac", "new_debug_unreachable", @@ -2027,9 +2216,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" dependencies = [ "futures-channel", "futures-core", @@ -2042,9 +2231,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", "futures-sink", @@ -2052,41 +2241,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" - -[[package]] -name = "futures-cpupool" -version = "0.1.8" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" -dependencies = [ - "futures 0.1.31", - "num_cpus", -] - -[[package]] -name = "futures-diagnose" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" -dependencies = [ - "futures 0.1.31", - "futures 0.3.16", - "lazy_static", - "log", - "parking_lot 0.9.0", - "pin-project 0.4.28", - "serde", - "serde_json", -] +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-executor" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" dependencies = [ "futures-core", "futures-task", @@ -2096,9 +2259,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-lite" @@ -2111,18 +2274,16 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "autocfg", - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -2130,32 +2291,26 @@ dependencies = [ [[package]] name = "futures-rustls" -version = "0.21.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1387e07917c711fb4ee4f48ea0adb04a3c9739e53ef85bf43ae1edc2937a8b" +checksum = "e01fe9932a224b72b45336d96040aa86386d674a31d0af27d800ea7bc8ca97fe" dependencies = [ "futures-io", - "rustls 0.19.1", - "webpki", + "rustls 0.20.5", + "webpki 0.22.0", ] [[package]] name = "futures-sink" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" - -[[package]] -name = "futures-timer" -version = "2.0.2" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-timer" @@ -2165,11 +2320,10 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.16" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ - "autocfg", "futures 0.1.31", "futures-channel", "futures-core", @@ -2178,10 +2332,8 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -2194,12 +2346,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" - [[package]] name = "generic-array" version = "0.12.4" @@ -2211,9 +2357,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -2235,26 +2381,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.10.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] name = "ghash" -version = "0.3.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug 0.3.0", "polyval", @@ -2262,21 +2412,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.23.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" dependencies = [ "fallible-iterator", "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" - [[package]] name = "glob" version = "0.2.11" @@ -2304,66 +2448,57 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", - "web-sys", ] [[package]] -name = "h2" -version = "0.1.26" +name = "group" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" dependencies = [ - "byteorder", - "bytes 0.4.12", - "fnv", - "futures 0.1.31", - "http 0.1.21", - "indexmap", - "log", - "slab", - "string", - "tokio-io", + "ff", + "rand_core 0.6.3", + "subtle", ] [[package]] name = "h2" -version = "0.2.7" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ - "bytes 0.5.6", + "bytes 1.1.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.4", + "http", "indexmap", "slab", - "tokio 0.2.25", - "tokio-util", + "tokio", + "tokio-util 0.7.2", "tracing", - "tracing-futures", ] [[package]] name = "half" -version = "1.7.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "handlebars" -version = "3.5.5" +version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3" +checksum = "99d6a30320f094710245150395bc763ad23128d6a1ebbad7594dc4164b62c56b" dependencies = [ "log", "pest", @@ -2390,20 +2525,20 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.4.7", + "ahash", ] [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" dependencies = [ - "ahash 0.7.4", + "ahash", ] [[package]] @@ -2415,6 +2550,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -2432,9 +2573,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0" +checksum = "d70693199b3cf4552f3fa720b54163927a3ebed2aef240efaf556033ab336a11" dependencies = [ "hex-literal-impl", "proc-macro-hack", @@ -2442,15 +2583,15 @@ dependencies = [ [[package]] name = "hex-literal" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "hex-literal-impl" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f769599eb31de176303197b7ba4973299c38c7a7604a6bc88c3eef05b9b46" +checksum = "59448fc2f82a5fb6907f78c3d69d843e82ff5b051923313cc4438cb0c7b745a8" dependencies = [ "proc-macro-hack", ] @@ -2461,16 +2602,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac 0.7.0", - "digest 0.8.1", -] - [[package]] name = "hmac" version = "0.8.1" @@ -2482,14 +2613,13 @@ dependencies = [ ] [[package]] -name = "hmac-drbg" -version = "0.2.0" +name = "hmac" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "digest 0.8.1", - "generic-array 0.12.4", - "hmac 0.7.1", + "crypto-mac 0.11.1", + "digest 0.9.0", ] [[package]] @@ -2499,15 +2629,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.4", + "generic-array 0.14.5", "hmac 0.8.1", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + [[package]] name = "html5ever" -version = "0.25.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" +checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" dependencies = [ "log", "mac", @@ -2519,59 +2660,37 @@ dependencies = [ [[package]] name = "http" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" -dependencies = [ - "bytes 0.4.12", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "http 0.1.21", - "tokio-buf", + "itoa 1.0.2", ] [[package]] name = "http-body" -version = "0.3.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ - "bytes 0.5.6", - "http 0.2.4", + "bytes 1.1.0", + "http", + "pin-project-lite 0.2.9", ] [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -2583,75 +2702,50 @@ dependencies = [ ] [[package]] -name = "hyper" -version = "0.12.36" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c843caf6296fc1f93444735205af9ed4e109a539005abb2564ae1d6fad34c52" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "futures-cpupool", - "h2 0.1.26", - "http 0.1.21", - "http-body 0.1.0", - "httparse", - "iovec", - "itoa", - "log", - "net2", - "rustc_version 0.2.3", - "time", - "tokio 0.1.22", - "tokio-buf", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "want 0.2.0", -] +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.13.10" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ - "bytes 0.5.6", + "bytes 1.1.0", "futures-channel", "futures-core", "futures-util", - "h2 0.2.7", - "http 0.2.4", - "http-body 0.3.1", + "h2", + "http", + "http-body", "httparse", "httpdate", - "itoa", - "pin-project 1.0.8", - "socket2 0.3.19", - "tokio 0.2.25", + "itoa 1.0.2", + "pin-project-lite 0.2.9", + "socket2", + "tokio", "tower-service", "tracing", - "want 0.3.0", + "want", ] [[package]] name = "hyper-rustls" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ - "bytes 0.5.6", "ct-logs", "futures-util", - "hyper 0.13.10", + "hyper", "log", - "rustls 0.18.1", + "rustls 0.19.1", "rustls-native-certs", - "tokio 0.2.25", + "tokio", "tokio-rustls", - "webpki", + "webpki 0.21.4", ] [[package]] @@ -2678,64 +2772,55 @@ dependencies = [ [[package]] name = "if-addrs" -version = "0.6.5" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28538916eb3f3976311f5dfbe67b5362d0add1293d0a9cad17debf86f8e3aa48" +checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" dependencies = [ - "if-addrs-sys", "libc", "winapi 0.3.9", ] -[[package]] -name = "if-addrs-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "if-watch" -version = "0.1.8" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b8538953a3f0d0d3868f0a706eb4273535e10d72acb5c82c1c23ae48835c85" +checksum = "ae8f4a3c3d4c89351ca83e120c1c00b27df945d38e05695668c9d4b4f7bc52f3" dependencies = [ "async-io", - "futures 0.3.16", - "futures-lite", + "core-foundation", + "fnv", + "futures 0.3.21", "if-addrs", "ipnet", - "libc", "log", - "winapi 0.3.9", + "rtnetlink", + "system-configuration", + "windows", ] [[package]] name = "impl-codec" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", ] [[package]] name = "impl-serde" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" dependencies = [ "serde", ] [[package]] name = "impl-trait-for-tuples" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", @@ -2744,9 +2829,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", "hashbrown 0.11.2", @@ -2774,9 +2859,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", ] @@ -2791,14 +2876,10 @@ dependencies = [ ] [[package]] -name = "intervalier" -version = "0.4.0" +name = "io-lifetimes" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" -dependencies = [ - "futures 0.3.16", - "futures-timer 2.0.2", -] +checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" [[package]] name = "iovec" @@ -2811,30 +2892,33 @@ dependencies = [ [[package]] name = "ip_network" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee15951c035f79eddbef745611ec962f63f4558f1dadf98ab723cc603487c6f" +checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] -name = "ipnet" -version = "2.3.1" +name = "ipconfig" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +dependencies = [ + "socket2", + "widestring", + "winapi 0.3.9", + "winreg", +] [[package]] -name = "itertools" -version = "0.9.0" +name = "ipnet" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -2845,6 +2929,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + [[package]] name = "jobserver" version = "0.1.24" @@ -2856,21 +2946,21 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.53" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpc-client-transports" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489b9c612e60c766f751ab40fcb43cbb55a1e10bb44a9b4307ed510ca598cbd7" +checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" dependencies = [ - "failure", - "futures 0.1.31", + "derive_more", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-pubsub", "log", @@ -2881,11 +2971,13 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0745a6379e3edc893c84ec203589790774e4247420033e71a76d3ab4687991fa" +checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" dependencies = [ - "futures 0.1.31", + "futures 0.3.21", + "futures-executor", + "futures-util", "log", "serde", "serde_derive", @@ -2894,18 +2986,19 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f764902d7b891344a0acb65625f32f6f7c6db006952143bd650209fbe7d94db" +checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0" dependencies = [ + "futures 0.3.21", "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a847f9ec7bb52149b2786a17c9cb260d6effc6b8eeb8c16b343a487a7563a3" +checksum = "5b939a78fa820cdfcb7ee7484466746a7377760970f6f9c6fe19f9edcc8a38d2" dependencies = [ "proc-macro-crate 0.1.5", "proc-macro2", @@ -2915,76 +3008,95 @@ dependencies = [ [[package]] name = "jsonrpc-http-server" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb5c4513b7b542f42da107942b7b759f27120b5cc894729f88254b28dff44b7" +checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff" dependencies = [ - "hyper 0.12.36", + "futures 0.3.21", + "hyper", "jsonrpc-core", "jsonrpc-server-utils", "log", "net2", - "parking_lot 0.10.2", + "parking_lot 0.11.2", "unicase", ] [[package]] name = "jsonrpc-ipc-server" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf50e53e4eea8f421a7316c5f63e395f7bc7c4e786a6dc54d76fab6ff7aa7ce7" +checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845" dependencies = [ + "futures 0.3.21", "jsonrpc-core", "jsonrpc-server-utils", "log", "parity-tokio-ipc", - "parking_lot 0.10.2", - "tokio-service", + "parking_lot 0.11.2", + "tower-service", ] [[package]] name = "jsonrpc-pubsub" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "639558e0604013be9787ae52f798506ae42bf4220fe587bdc5625871cc8b9c77" +checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011" dependencies = [ + "futures 0.3.21", "jsonrpc-core", + "lazy_static", "log", - "parking_lot 0.10.2", + "parking_lot 0.11.2", "rand 0.7.3", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f1f3990650c033bd8f6bd46deac76d990f9bbfb5f8dc8c4767bf0a00392176" +checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4" dependencies = [ - "bytes 0.4.12", + "bytes 1.1.0", + "futures 0.3.21", "globset", "jsonrpc-core", "lazy_static", "log", - "tokio 0.1.22", - "tokio-codec", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", "unicase", ] [[package]] name = "jsonrpc-ws-server" -version = "15.1.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6596fe75209b73a2a75ebe1dce4e60e03b88a2b25e8807b667597f6315150d22" +checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946" dependencies = [ + "futures 0.3.21", "jsonrpc-core", "jsonrpc-server-utils", "log", "parity-ws", - "parking_lot 0.10.2", + "parking_lot 0.11.2", "slab", ] +[[package]] +name = "k256" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +dependencies = [ + "cfg-if 1.0.0", + "ecdsa", + "elliptic-curve", + "sec1", +] + [[package]] name = "keccak" version = "0.1.0" @@ -3012,30 +3124,30 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8891bd853eff90e33024195d79d578dc984c82f9e0715fcd2b525a0c19d52811" +checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" dependencies = [ "parity-util-mem", - "smallvec 1.6.1", + "smallvec", ] [[package]] name = "kvdb-memorydb" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a0da8e08caf08d384a620ec19bb6c9b85c84137248e202617fb91881f25912" +checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" dependencies = [ "kvdb", "parity-util-mem", - "parking_lot 0.11.1", + "parking_lot 0.12.0", ] [[package]] name = "kvdb-rocksdb" -version = "0.11.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b27cdb788bf1c8ade782289f9dbee626940be2961fd75c7cde993fa2f1ded1" +checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" dependencies = [ "fs-swap", "kvdb", @@ -3043,10 +3155,10 @@ dependencies = [ "num_cpus", "owning_ref", "parity-util-mem", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "regex", "rocksdb", - "smallvec 1.6.1", + "smallvec", ] [[package]] @@ -3066,15 +3178,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "leb128" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.100" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" +checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" [[package]] name = "libloading" @@ -3088,9 +3200,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if 1.0.0", "winapi 0.3.9", @@ -3104,22 +3216,25 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libm" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" [[package]] name = "libp2p" -version = "0.34.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5133112ce42be9482f6a87be92a605dd6bbc9e93c297aee77d172ff06908f3a" +checksum = "475ce2ac4a9727e53a519f6ee05b38abfcba8f0d39c4d24f103d184e36fd5b0f" dependencies = [ "atomic", - "bytes 1.0.1", - "futures 0.3.16", + "bytes 1.1.0", + "futures 0.3.21", + "futures-timer", + "getrandom 0.2.6", + "instant", "lazy_static", + "libp2p-autonat", "libp2p-core", - "libp2p-core-derive", "libp2p-deflate", "libp2p-dns", "libp2p-floodsub", @@ -3127,232 +3242,270 @@ dependencies = [ "libp2p-identify", "libp2p-kad", "libp2p-mdns", + "libp2p-metrics", "libp2p-mplex", "libp2p-noise", "libp2p-ping", "libp2p-plaintext", "libp2p-pnet", + "libp2p-relay", + "libp2p-rendezvous", "libp2p-request-response", "libp2p-swarm", + "libp2p-swarm-derive", "libp2p-tcp", "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", - "parity-multiaddr", - "parking_lot 0.11.1", - "pin-project 1.0.8", - "smallvec 1.6.1", - "wasm-timer", + "multiaddr", + "parking_lot 0.12.0", + "pin-project 1.0.10", + "rand 0.7.3", + "smallvec", +] + +[[package]] +name = "libp2p-autonat" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13b690e65046af6a09c0b27bd9508fa1cab0efce889de74b0b643b9d2a98f9a" +dependencies = [ + "async-trait", + "futures 0.3.21", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-request-response", + "libp2p-swarm", + "log", + "prost", + "prost-build", + "rand 0.8.5", ] [[package]] name = "libp2p-core" -version = "0.27.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2d56aadc2c2bf22cd7797f86e56a65b5b3994a0136b65be3106938acae7a26" +checksum = "db5b02602099fb75cb2d16f9ea860a320d6eb82ce41e95ab680912c454805cd5" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", "either", "fnv", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", + "instant", "lazy_static", - "libsecp256k1 0.3.5", + "libsecp256k1 0.7.0", "log", - "multihash", + "multiaddr", + "multihash 0.16.2", "multistream-select", - "parity-multiaddr", - "parking_lot 0.11.1", - "pin-project 1.0.8", + "parking_lot 0.12.0", + "pin-project 1.0.10", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.5", "ring", "rw-stream-sink", - "sha2 0.9.5", - "smallvec 1.6.1", + "sha2 0.10.2", + "smallvec", "thiserror", - "unsigned-varint 0.7.0", + "unsigned-varint 0.7.1", "void", "zeroize", ] -[[package]] -name = "libp2p-core-derive" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4bc40943156e42138d22ed3c57ff0e1a147237742715937622a99b10fbe0156" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "libp2p-deflate" -version = "0.27.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d42eed63305f0420736fa487f9acef720c4528bd7852a6a760f5ccde4813345" +checksum = "6b1d37f042f748e224f04785d0e987ae09a2aa518d6401d82d412dad83e360ed" dependencies = [ "flate2", - "futures 0.3.16", + "futures 0.3.21", "libp2p-core", ] [[package]] name = "libp2p-dns" -version = "0.27.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5153b6db68fd4baa3b304e377db744dd8fea8ff4e4504509ee636abcde88d3e3" +checksum = "066e33e854e10b5c93fc650458bf2179c7e0d143db260b0963e44a94859817f1" dependencies = [ - "futures 0.3.16", + "async-std-resolver", + "futures 0.3.21", "libp2p-core", "log", + "smallvec", + "trust-dns-resolver", ] [[package]] name = "libp2p-floodsub" -version = "0.27.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c63dfa06581b24b1d12bf9815b43689a784424be217d6545c800c7c75a207f" +checksum = "733d3ea6ebe7a7a85df2bc86678b93f24b015fae5fe3b3acc4c400e795a55d2d" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.16", + "futures 0.3.21", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", "rand 0.7.3", - "smallvec 1.6.1", + "smallvec", ] [[package]] name = "libp2p-gossipsub" -version = "0.27.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12451ba9493e87c91baf2a6dffce9ddf1fbc807a0861532d7cf477954f8ebbee" +checksum = "a90c989a7c0969c2ab63e898da9bc735e3be53fb4f376e9c045ce516bcc9f928" dependencies = [ - "asynchronous-codec 0.5.0", + "asynchronous-codec 0.6.0", "base64 0.13.0", "byteorder", - "bytes 1.0.1", + "bytes 1.1.0", "fnv", - "futures 0.3.16", + "futures 0.3.21", "hex_fmt", + "instant", "libp2p-core", "libp2p-swarm", "log", + "prometheus-client", "prost", "prost-build", "rand 0.7.3", "regex", - "sha2 0.9.5", - "smallvec 1.6.1", - "unsigned-varint 0.6.0", + "sha2 0.10.2", + "smallvec", + "unsigned-varint 0.7.1", "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.27.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40fb36a059b7a8cce1514bd8b546fa612e006c9937caa7f5950cb20021fe91e" +checksum = "c5ef5a5b57904c7c33d6713ef918d239dc6b7553458f3475d87f8a18e9c651c8" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", + "futures-timer", "libp2p-core", "libp2p-swarm", "log", + "lru", "prost", "prost-build", - "smallvec 1.6.1", - "wasm-timer", + "smallvec", ] [[package]] name = "libp2p-kad" -version = "0.28.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3da6c9acbcc05f93235d201d7d45ef4e8b88a45d8836f98becd8b4d443f066" +checksum = "564e6bd64d177446399ed835b9451a8825b07929d6daa6a94e6405592974725e" dependencies = [ "arrayvec 0.5.2", "asynchronous-codec 0.6.0", - "bytes 1.0.1", + "bytes 1.1.0", "either", "fnv", - "futures 0.3.16", + "futures 0.3.21", + "futures-timer", + "instant", "libp2p-core", "libp2p-swarm", "log", "prost", "prost-build", "rand 0.7.3", - "sha2 0.9.5", - "smallvec 1.6.1", + "sha2 0.10.2", + "smallvec", + "thiserror", "uint", - "unsigned-varint 0.7.0", + "unsigned-varint 0.7.1", "void", - "wasm-timer", ] [[package]] name = "libp2p-mdns" -version = "0.28.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9e6374814d1b118d97ccabdfc975c8910bd16dc38a8bc058eeb08bf2080fe1" +checksum = "611ae873c8e280ccfab0d57c7a13cac5644f364529e233114ff07863946058b0" dependencies = [ "async-io", "data-encoding", "dns-parser", - "futures 0.3.16", + "futures 0.3.21", "if-watch", "lazy_static", "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", - "smallvec 1.6.1", - "socket2 0.3.19", + "rand 0.8.5", + "smallvec", + "socket2", "void", ] +[[package]] +name = "libp2p-metrics" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985be799bb3796e0c136c768208c3c06604a38430571906a13dcfeda225a3b9d" +dependencies = [ + "libp2p-core", + "libp2p-gossipsub", + "libp2p-identify", + "libp2p-kad", + "libp2p-ping", + "libp2p-relay", + "libp2p-swarm", + "prometheus-client", +] + [[package]] name = "libp2p-mplex" -version = "0.27.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350ce8b3923594aedabd5d6e3f875d058435052a29c3f32df378bc70d10be464" +checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" dependencies = [ "asynchronous-codec 0.6.0", - "bytes 1.0.1", - "futures 0.3.16", + "bytes 1.1.0", + "futures 0.3.21", "libp2p-core", "log", "nohash-hasher", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "rand 0.7.3", - "smallvec 1.6.1", - "unsigned-varint 0.7.0", + "smallvec", + "unsigned-varint 0.7.1", ] [[package]] name = "libp2p-noise" -version = "0.29.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aca322b52a0c5136142a7c3971446fb1e9964923a526c9cc6ef3b7c94e57778" +checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "curve25519-dalek 3.2.0", - "futures 0.3.16", + "futures 0.3.21", "lazy_static", "libp2p-core", "log", "prost", "prost-build", - "rand 0.7.3", - "sha2 0.9.5", + "rand 0.8.5", + "sha2 0.10.2", "snow", "static_assertions", "x25519-dalek", @@ -3361,122 +3514,184 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.27.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3813276d0708c8db0f500d8beda1bda9ad955723b9cb272c41f4727256f73c" +checksum = "bf57a3c2e821331dda9fe612d4654d676ab6e33d18d9434a18cced72630df6ad" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", + "futures-timer", + "instant", "libp2p-core", "libp2p-swarm", "log", "rand 0.7.3", "void", - "wasm-timer", ] [[package]] name = "libp2p-plaintext" -version = "0.27.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d58defcadb646ae4b033e130b48d87410bf76394dc3335496cae99dac803e61" +checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" dependencies = [ "asynchronous-codec 0.6.0", - "bytes 1.0.1", - "futures 0.3.16", + "bytes 1.1.0", + "futures 0.3.21", "libp2p-core", "log", "prost", "prost-build", - "unsigned-varint 0.7.0", + "unsigned-varint 0.7.1", "void", ] [[package]] name = "libp2p-pnet" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce3374f3b28162db9d3442c9347c4f14cb01e8290052615c7d341d40eae0599" +checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "log", - "pin-project 1.0.8", + "pin-project 1.0.10", "rand 0.7.3", "salsa20", - "sha3", + "sha3 0.9.1", ] [[package]] -name = "libp2p-request-response" -version = "0.9.1" +name = "libp2p-relay" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10e5552827c33d8326502682da73a0ba4bfa40c1b55b216af3c303f32169dd89" +checksum = "3aa754cb7bccef51ebc3c458c6bbcef89d83b578a9925438389be841527d408f" dependencies = [ - "async-trait", - "bytes 1.0.1", - "futures 0.3.16", + "asynchronous-codec 0.6.0", + "bytes 1.1.0", + "either", + "futures 0.3.21", + "futures-timer", + "instant", "libp2p-core", "libp2p-swarm", "log", - "lru", - "minicbor", - "rand 0.7.3", - "smallvec 1.6.1", - "unsigned-varint 0.7.0", - "wasm-timer", -] + "pin-project 1.0.10", + "prost", + "prost-build", + "rand 0.8.5", + "smallvec", + "static_assertions", + "thiserror", + "unsigned-varint 0.7.1", + "void", +] + +[[package]] +name = "libp2p-rendezvous" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd0baab894c5b84da510b915d53264d566c3c35889f09931fe9edbd2a773bee" +dependencies = [ + "asynchronous-codec 0.6.0", + "bimap", + "futures 0.3.21", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "prost", + "prost-build", + "rand 0.8.5", + "sha2 0.10.2", + "thiserror", + "unsigned-varint 0.7.1", + "void", +] + +[[package]] +name = "libp2p-request-response" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6a6fc6c9ad95661f46989473b34bd2993d14a4de497ff3b2668a910d4b869" +dependencies = [ + "async-trait", + "bytes 1.1.0", + "futures 0.3.21", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.7.3", + "smallvec", + "unsigned-varint 0.7.1", +] [[package]] name = "libp2p-swarm" -version = "0.27.2" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7955b973e1fd2bd61ffd43ce261c1223f61f4aacd5bae362a924993f9a25fd98" +checksum = "8f0c69ad9e8f7c5fc50ad5ad9c7c8b57f33716532a2b623197f69f93e374d14c" dependencies = [ "either", - "futures 0.3.16", + "fnv", + "futures 0.3.21", + "futures-timer", + "instant", "libp2p-core", "log", + "pin-project 1.0.10", "rand 0.7.3", - "smallvec 1.6.1", + "smallvec", + "thiserror", "void", - "wasm-timer", ] [[package]] -name = "libp2p-tcp" +name = "libp2p-swarm-derive" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a5aef80e519a6cb8e2663605142f97baaaea1a252eecbf8756184765f7471b" +checksum = "daf2fe8c80b43561355f4d51875273b5b6dfbac37952e8f64b1270769305c9d7" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "libp2p-tcp" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" dependencies = [ "async-io", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", "if-watch", "ipnet", "libc", "libp2p-core", "log", - "socket2 0.3.19", + "socket2", ] [[package]] name = "libp2p-uds" -version = "0.27.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ac51ce419f60be966e02103c17f67ff5dc4422ba83ba54d251d6c62a4ed487" +checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb" dependencies = [ "async-std", - "futures 0.3.16", + "futures 0.3.21", "libp2p-core", "log", ] [[package]] name = "libp2p-wasm-ext" -version = "0.27.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6149c46cb76935c80bc8be6ec6e3ebd5f5e1679765a255fb34331d54610f15dd" +checksum = "4f6ea0f84a967ef59a16083f222c18115ae2e91db69809dce275df62e101b279" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3486,12 +3701,12 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.28.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b1c6a3431045da8b925ed83384e4c5163e14b990572307fca9c507435d4d22" +checksum = "c932834c3754501c368d1bf3d0fb458487a642b90fc25df082a3a2f3d3b32e37" dependencies = [ "either", - "futures 0.3.16", + "futures 0.3.21", "futures-rustls", "libp2p-core", "log", @@ -3504,61 +3719,67 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.30.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4819358c542a86ff95f6ae691efb4b94ddaf477079b01a686f5705b79bfc232a" +checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "libp2p-core", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "thiserror", "yamux", ] [[package]] name = "librocksdb-sys" -version = "6.20.3" +version = "0.6.1+6.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c309a9d2470844aceb9a4a098cf5286154d20596868b75a6b36357d2bb9ca25d" +checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" dependencies = [ "bindgen", + "bzip2-sys", "cc", "glob 0.3.0", "libc", + "libz-sys", + "tikv-jemalloc-sys", ] [[package]] name = "libsecp256k1" -version = "0.3.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" dependencies = [ "arrayref", - "crunchy", - "digest 0.8.1", - "hmac-drbg 0.2.0", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core 0.2.2", + "libsecp256k1-gen-ecmult 0.2.1", + "libsecp256k1-gen-genmult 0.2.1", "rand 0.7.3", - "sha2 0.8.2", - "subtle 2.4.1", + "serde", + "sha2 0.9.9", "typenum", ] [[package]] name = "libsecp256k1" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" dependencies = [ "arrayref", - "base64 0.12.3", + "base64 0.13.0", "digest 0.9.0", - "hmac-drbg 0.3.0", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.7.3", + "hmac-drbg", + "libsecp256k1-core 0.3.0", + "libsecp256k1-gen-ecmult 0.3.0", + "libsecp256k1-gen-genmult 0.3.0", + "rand 0.8.5", "serde", - "sha2 0.9.5", + "sha2 0.9.9", "typenum", ] @@ -3570,7 +3791,18 @@ checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" dependencies = [ "crunchy", "digest 0.9.0", - "subtle 2.4.1", + "subtle", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", ] [[package]] @@ -3579,7 +3811,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.2.2", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core 0.3.0", ] [[package]] @@ -3588,14 +3829,23 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.2.2", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core 0.3.0", ] [[package]] name = "libz-sys" -version = "1.1.3" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" dependencies = [ "cc", "pkg-config", @@ -3619,37 +3869,35 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6e407dadb4ca4b31bc69c27aff00e7ca4534fdcee855159b039a7cebb5f395" +checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" dependencies = [ "nalgebra", "statrs", ] [[package]] -name = "lock_api" -version = "0.3.4" +name = "linux-raw-sys" +version = "0.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] +checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", "value-bag", @@ -3657,13 +3905,42 @@ dependencies = [ [[package]] name = "lru" -version = "0.6.6" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" +checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889" dependencies = [ "hashbrown 0.11.2", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lz4" +version = "1.23.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edcb94251b1c375c459e5abe9fb0168c1c826c3370172684844f8f3f8d1a885" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "mac" version = "0.1.1" @@ -3699,6 +3976,12 @@ dependencies = [ "tendril", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchers" version = "0.0.1" @@ -3716,24 +3999,18 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "matrixmultiply" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741" +checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" dependencies = [ "rawpointer", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" @@ -3745,31 +4022,31 @@ dependencies = [ ] [[package]] -name = "memoffset" -version = "0.5.6" +name = "memmap2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" dependencies = [ - "autocfg", + "libc", ] [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "memory-db" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "814bbecfc0451fc314eeea34f05bbcd5b98a7ad7af37faee088b86a1e633f1d4" +checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" dependencies = [ "hash-db", - "hashbrown 0.9.1", + "hashbrown 0.12.1", "parity-util-mem", ] @@ -3804,33 +4081,18 @@ dependencies = [ ] [[package]] -name = "minicbor" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2b2c73f9640fccab53947e2b3474d5071fcbc8f82cac51ddf6c8041a30a9ea" -dependencies = [ - "minicbor-derive", -] - -[[package]] -name = "minicbor-derive" -version = "0.6.4" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54999f917cd092b13904737e26631aa2b2b88d625db68e4bab461dcd8006c788" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" dependencies = [ "adler", - "autocfg", ] [[package]] @@ -3846,45 +4108,34 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow 0.2.2", + "miow", "net2", "slab", "winapi 0.2.8", ] [[package]] -name = "mio-extras" -version = "2.0.6" +name = "mio" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" dependencies = [ - "lazycell", + "libc", "log", - "mio", - "slab", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", ] [[package]] -name = "mio-named-pipes" -version = "0.1.7" +name = "mio-extras" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ + "lazycell", "log", - "mio", - "miow 0.3.7", - "winapi 0.3.9", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", + "mio 0.6.23", + "slab", ] [[package]] @@ -3900,19 +4151,28 @@ dependencies = [ ] [[package]] -name = "miow" -version = "0.3.7" +name = "more-asserts" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi 0.3.9", -] +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] -name = "more-asserts" -version = "0.2.1" +name = "multiaddr" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" +checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" +dependencies = [ + "arrayref", + "bs58", + "byteorder", + "data-encoding", + "multihash 0.16.2", + "percent-encoding 2.1.0", + "serde", + "static_assertions", + "unsigned-varint 0.7.1", + "url 2.2.2", +] [[package]] name = "multibase" @@ -3935,20 +4195,47 @@ dependencies = [ "blake2s_simd", "blake3", "digest 0.9.0", - "generic-array 0.14.4", - "multihash-derive", - "sha2 0.9.5", - "sha3", + "generic-array 0.14.5", + "multihash-derive 0.7.2", + "sha2 0.9.9", + "sha3 0.9.1", "unsigned-varint 0.5.1", ] +[[package]] +name = "multihash" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3db354f401db558759dfc1e568d010a5d4146f4d3f637be1275ec4a3cf09689" +dependencies = [ + "core2", + "digest 0.10.3", + "multihash-derive 0.8.0", + "sha2 0.10.2", + "unsigned-varint 0.7.1", +] + [[package]] name = "multihash-derive" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" dependencies = [ - "proc-macro-crate 1.0.0", + "proc-macro-crate 1.1.3", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "multihash-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd" +dependencies = [ + "proc-macro-crate 1.1.3", "proc-macro-error", "proc-macro2", "quote", @@ -3964,16 +4251,16 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d91ec0a2440aaff5f78ec35631a7027d50386c6163aa975f7caa0d5da4b6ff8" +checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" dependencies = [ - "bytes 1.0.1", - "futures 0.3.16", + "bytes 1.1.0", + "futures 0.3.21", "log", - "pin-project 1.0.8", - "smallvec 1.6.1", - "unsigned-varint 0.7.0", + "pin-project 1.0.10", + "smallvec", + "unsigned-varint 0.7.1", ] [[package]] @@ -3988,7 +4275,7 @@ dependencies = [ "num-complex", "num-rational 0.4.0", "num-traits", - "rand 0.8.4", + "rand 0.8.5", "rand_distr", "simba", "typenum", @@ -4007,11 +4294,11 @@ dependencies = [ [[package]] name = "names" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef320dab323286b50fb5cdda23f61c796a72a89998ab565ca32525c5c556f2da" +checksum = "e7d66043b25d4a6cccb23619d10c19c25304b355a7dccd4a8e11423dd2382146" dependencies = [ - "rand 0.3.23", + "rand 0.8.5", ] [[package]] @@ -4026,46 +4313,124 @@ dependencies = [ ] [[package]] -name = "new_debug_unreachable" -version = "1.0.4" +name = "netlink-packet-core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] [[package]] -name = "node-bench" -version = "0.9.0" +name = "netlink-packet-route" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733ea73609acfd7fa7ddadfb7bf709b0471668c456ad9513685af543a06342b2" dependencies = [ - "derive_more", - "fs_extra", - "futures 0.3.16", - "hash-db", - "hex", - "kvdb", - "kvdb-rocksdb", - "lazy_static", - "log", - "node-testing", - "parity-db", - "parity-util-mem", - "polymesh-primitives", - "polymesh-runtime-testnet", - "rand 0.7.3", - "sc-basic-authorship", - "sc-cli", - "sc-client-api", - "sc-transaction-pool", - "serde", - "serde_json", - "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "anyhow", + "bitflags", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] + +[[package]] +name = "netlink-proto" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8785b8141e8432aa45fceb922a7e876d7da3fad37fa7e7ec702ace3aa0826b" +dependencies = [ + "bytes 1.1.0", + "futures 0.3.21", + "log", + "netlink-packet-core", + "netlink-sys", + "tokio", +] + +[[package]] +name = "netlink-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4c9f9547a08241bee7b6558b9b98e1f290d187de8b7cfca2bbb4937bcaa8f8" +dependencies = [ + "async-io", + "bytes 1.1.0", + "futures 0.3.21", + "libc", + "log", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nix" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", + "memoffset", +] + +[[package]] +name = "node-bench" +version = "0.9.0" +dependencies = [ + "clap 3.1.18", + "derive_more", + "fs_extra", + "futures 0.3.21", + "hash-db", + "hex", + "kvdb", + "kvdb-rocksdb", + "lazy_static", + "log", + "node-testing", + "parity-db 0.2.4", + "parity-util-mem", + "polymesh-primitives", + "polymesh-runtime-testnet", + "rand 0.7.3", + "sc-basic-authorship", + "sc-cli", + "sc-client-api", + "sc-transaction-pool", + "serde", + "serde_json", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-trie", - "structopt", "tempfile", ] @@ -4085,8 +4450,8 @@ dependencies = [ "pallet-session", "pallet-timestamp", "pallet-transaction-payment", - "pallet-treasury 3.0.0", - "parity-scale-codec 2.2.0", + "pallet-treasury 4.0.0-dev", + "parity-scale-codec 3.1.2", "polymesh-primitives", "polymesh-runtime-testnet", "sc-executor", @@ -4098,7 +4463,7 @@ dependencies = [ "sp-state-machine", "sp-trie", "substrate-test-client", - "trie-root", + "trie-root 0.16.0", "wabt", ] @@ -4117,7 +4482,7 @@ dependencies = [ "pallet-pips", "pallet-portfolio", "pallet-transaction-payment", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives", "serde", "sp-api", @@ -4139,7 +4504,7 @@ dependencies = [ "pallet-pips", "pallet-portfolio", "pallet-transaction-payment", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives", "serde", "serde_json", @@ -4156,7 +4521,7 @@ dependencies = [ "frame-support", "frame-system", "fs_extra", - "futures 0.3.16", + "futures 0.3.21", "log", "node-executor", "pallet-balances 0.1.0", @@ -4167,8 +4532,8 @@ dependencies = [ "pallet-staking", "pallet-timestamp", "pallet-transaction-payment", - "pallet-treasury 3.0.0", - "parity-scale-codec 2.2.0", + "pallet-treasury 4.0.0-dev", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-runtime-testnet", @@ -4207,14 +4572,12 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "6.1.2" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ - "bitvec 0.19.5", - "funty", "memchr", - "version_check", + "minimal-lexical", ] [[package]] @@ -4230,18 +4593,28 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" dependencies = [ "num-traits", ] +[[package]] +name = "num-format" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +dependencies = [ + "arrayvec 0.4.12", + "itoa 0.4.8", +] + [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -4272,19 +4645,19 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm 0.2.1", + "libm 0.2.2", ] [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -4292,31 +4665,29 @@ dependencies = [ [[package]] name = "object" -version = "0.22.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" dependencies = [ "crc32fast", "indexmap", + "memchr", ] [[package]] name = "object" -version = "0.26.1" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2766204889d09937d00bfbb7fec56bb2a199e2ade963cab19185d8a6104c7c" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" -dependencies = [ - "parking_lot 0.11.1", -] +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "oorandom" @@ -4338,9 +4709,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "os_str_bytes" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435" [[package]] name = "owning_ref" @@ -4353,11 +4730,11 @@ dependencies = [ [[package]] name = "packed_simd_2" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e64858a2d3733fdd61adfdd6da89aa202f7ff0e741d2fc7ed1e452ba9dc99d7" +checksum = "defdcfef86dcc44ad208f71d9ff4ce28df6537a4e0d6b0e8e845cb8ca10059a6" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libm 0.1.4", ] @@ -4365,11 +4742,11 @@ dependencies = [ name = "pallet-asset" version = "0.1.0" dependencies = [ - "arrayvec 0.7.1", + "arrayvec 0.7.2", "frame-benchmarking", "frame-support", "frame-system", - "hex-literal 0.2.1", + "hex-literal 0.2.2", "libsecp256k1 0.6.0", "pallet-balances 0.1.0", "pallet-base", @@ -4380,11 +4757,12 @@ dependencies = [ "pallet-session", "pallet-statistics", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", "rustc-hex", + "scale-info", "serde", "serde_derive", "serde_json", @@ -4399,14 +4777,14 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", "pallet-session", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-application-crypto", "sp-authority-discovery", "sp-runtime", @@ -4415,42 +4793,41 @@ dependencies = [ [[package]] name = "pallet-authorship" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "sp-authorship", - "sp-inherents", "sp-runtime", "sp-std", ] [[package]] name = "pallet-babe" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-authorship", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-application-crypto", "sp-consensus-babe", "sp-consensus-vrf", - "sp-inherents", "sp-io", "sp-runtime", "sp-session", "sp-staking", "sp-std", - "sp-timestamp", ] [[package]] @@ -4460,12 +4837,14 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-permissions", "pallet-timestamp", "pallet-transaction-payment", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4479,14 +4858,15 @@ dependencies = [ [[package]] name = "pallet-balances" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.2.0", - "serde", + "log", + "parity-scale-codec 3.1.2", + "scale-info", "sp-runtime", "sp-std", ] @@ -4497,9 +4877,10 @@ version = "0.1.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4517,14 +4898,16 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-balances 0.1.0", "pallet-base", "pallet-identity", "pallet-multisig", "pallet-scheduler", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-core", "sp-runtime", @@ -4541,9 +4924,10 @@ dependencies = [ "pallet-identity", "pallet-permissions", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4569,9 +4953,10 @@ dependencies = [ "pallet-identity", "pallet-permissions", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4582,6 +4967,90 @@ dependencies = [ "sp-version", ] +[[package]] +name = "pallet-contracts" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "bitflags", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-contracts-primitives", + "pallet-contracts-proc-macro", + "parity-scale-codec 3.1.2", + "rand 0.8.5", + "rand_pcg 0.3.1", + "scale-info", + "serde", + "smallvec", + "sp-core", + "sp-io", + "sp-runtime", + "sp-sandbox", + "sp-std", + "wasm-instrument", + "wasmi-validation", +] + +[[package]] +name = "pallet-contracts-primitives" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "bitflags", + "parity-scale-codec 3.1.2", + "scale-info", + "serde", + "sp-core", + "sp-rpc", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-contracts-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pallet-contracts-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", + "parity-scale-codec 3.1.2", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", +] + +[[package]] +name = "pallet-contracts-rpc-runtime-api" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "pallet-contracts-primitives", + "parity-scale-codec 3.1.2", + "scale-info", + "sp-api", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-corporate-actions" version = "0.1.0" @@ -4598,10 +5067,11 @@ dependencies = [ "pallet-portfolio", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4623,10 +5093,11 @@ dependencies = [ "pallet-base", "pallet-identity", "pallet-permissions", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", + "scale-info", "serde", "serde_derive", "sp-std", @@ -4634,19 +5105,21 @@ dependencies = [ [[package]] name = "pallet-grandpa" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-authorship", "pallet-session", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-application-crypto", "sp-core", "sp-finality-grandpa", + "sp-io", "sp-runtime", "sp-session", "sp-staking", @@ -4662,9 +5135,10 @@ dependencies = [ "frame-system", "pallet-identity", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4683,7 +5157,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-group-rpc-runtime-api", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives", "serde", "sp-api", @@ -4697,7 +5171,7 @@ dependencies = [ name = "pallet-group-rpc-runtime-api" version = "2.0.0" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "serde", @@ -4718,13 +5192,15 @@ dependencies = [ "frame-support", "frame-system", "hex", + "log", "pallet-balances 0.1.0", "pallet-base", "pallet-permissions", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "schnorrkel 0.10.1", "serde", "serde_derive", @@ -4738,15 +5214,16 @@ dependencies = [ [[package]] name = "pallet-im-online" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-authorship", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-application-crypto", "sp-core", "sp-io", @@ -4757,14 +5234,14 @@ dependencies = [ [[package]] name = "pallet-indices" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-core", "sp-io", "sp-keyring", @@ -4779,12 +5256,14 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-identity", "pallet-permissions", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-core", "sp-runtime", @@ -4794,13 +5273,15 @@ dependencies = [ [[package]] name = "pallet-offences" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", - "pallet-balances 3.0.0", - "parity-scale-codec 2.2.0", + "log", + "pallet-balances 4.0.0-dev", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-runtime", "sp-staking", @@ -4814,9 +5295,10 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-runtime", "sp-std", @@ -4837,13 +5319,14 @@ dependencies = [ "pallet-permissions", "pallet-timestamp", "pallet-treasury 0.1.0", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", "polymesh-runtime-common", - "rand 0.8.4", + "rand 0.8.5", "rand_chacha 0.3.1", + "scale-info", "serde", "serde_derive", "sp-api", @@ -4865,14 +5348,31 @@ dependencies = [ "pallet-base", "pallet-identity", "pallet-permissions", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-arithmetic", "sp-std", ] +[[package]] +name = "pallet-preimage" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec 3.1.2", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-protocol-fee" version = "0.1.0" @@ -4881,9 +5381,10 @@ dependencies = [ "frame-support", "frame-system", "pallet-identity", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-core", "sp-io", @@ -4899,7 +5400,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-protocol-fee-rpc-runtime-api", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "serde", "sp-api", @@ -4912,7 +5413,7 @@ name = "pallet-protocol-fee-rpc-runtime-api" version = "0.1.0" dependencies = [ "frame-support", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "serde", "serde_json", @@ -4922,13 +5423,14 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "safe-mix", + "scale-info", "sp-runtime", "sp-std", ] @@ -4941,9 +5443,10 @@ dependencies = [ "frame-support", "frame-system", "pallet-identity", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "sp-runtime", "sp-std", ] @@ -4957,9 +5460,10 @@ dependencies = [ "frame-system", "pallet-identity", "pallet-staking", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-core", "sp-runtime", @@ -4968,14 +5472,15 @@ dependencies = [ [[package]] name = "pallet-scheduler" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "parity-scale-codec 2.2.0", - "serde", + "log", + "parity-scale-codec 3.1.2", + "scale-info", "sp-io", "sp-runtime", "sp-std", @@ -4983,15 +5488,16 @@ dependencies = [ [[package]] name = "pallet-session" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", + "log", "pallet-timestamp", - "parity-scale-codec 2.2.0", - "serde", + "parity-scale-codec 3.1.2", + "scale-info", "sp-core", "sp-io", "sp-runtime", @@ -5009,7 +5515,7 @@ dependencies = [ "frame-support", "frame-system", "hex", - "hex-literal 0.2.1", + "hex-literal 0.2.2", "pallet-asset", "pallet-balances 0.1.0", "pallet-base", @@ -5020,17 +5526,17 @@ dependencies = [ "pallet-scheduler", "pallet-statistics", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", + "scale-info", "serde", "serde_derive", "sp-api", "sp-core", "sp-io", "sp-runtime", - "sp-serializer", "sp-std", "sp-version", ] @@ -5040,17 +5546,20 @@ name = "pallet-staking" version = "2.0.0" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", + "log", "pallet-authorship", "pallet-babe", "pallet-identity", "pallet-session", "pallet-staking-reward-curve", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "rand_chacha 0.2.2", + "scale-info", "serde", "sp-arithmetic", "sp-core", @@ -5065,10 +5574,10 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", @@ -5082,7 +5591,7 @@ dependencies = [ "jsonrpc-core-client", "jsonrpc-derive", "pallet-staking-rpc-runtime-api", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "serde", "sp-api", "sp-blockchain", @@ -5107,12 +5616,15 @@ dependencies = [ "frame-support", "frame-system", "lazy_static", + "log", "pallet-external-agents", + "pallet-identity", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -5141,17 +5653,17 @@ dependencies = [ "pallet-portfolio", "pallet-settlement", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "polymesh-primitives-derive", + "scale-info", "serde", "serde_derive", "sp-api", "sp-core", "sp-io", "sp-runtime", - "sp-serializer", "sp-std", "sp-version", ] @@ -5162,7 +5674,8 @@ version = "2.0.0" dependencies = [ "frame-support", "frame-system", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-core", "sp-io", @@ -5180,9 +5693,10 @@ dependencies = [ "frame-system", "pallet-identity", "pallet-permissions", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-std", @@ -5190,15 +5704,15 @@ dependencies = [ [[package]] name = "pallet-timestamp" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", - "serde", + "log", + "parity-scale-codec 3.1.2", + "scale-info", "sp-inherents", "sp-io", "sp-runtime", @@ -5213,9 +5727,10 @@ dependencies = [ "frame-support", "frame-system", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_json", "sp-api", @@ -5234,9 +5749,10 @@ dependencies = [ "pallet-balances 0.1.0", "pallet-identity", "pallet-permissions", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "serde_derive", "sp-api", @@ -5249,14 +5765,15 @@ dependencies = [ [[package]] name = "pallet-treasury" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "pallet-balances 3.0.0", - "parity-scale-codec 2.2.0", + "pallet-balances 4.0.0-dev", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-runtime", "sp-std", @@ -5270,12 +5787,13 @@ dependencies = [ "frame-support", "frame-system", "hex", - "hex-literal 0.2.1", + "hex-literal 0.2.2", "pallet-balances 0.1.0", "pallet-permissions", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "serde", "sp-core", "sp-io", @@ -5295,27 +5813,28 @@ dependencies = [ "hex", "libc", "log", - "memmap2", - "parking_lot 0.11.1", - "rand 0.8.4", + "memmap2 0.2.3", + "parking_lot 0.11.2", + "rand 0.8.5", ] [[package]] -name = "parity-multiaddr" -version = "0.11.2" +name = "parity-db" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58341485071825827b7f03cf7efd1cb21e6a709bea778fb50227fd45d2f361b4" +checksum = "55a7901b85874402471e131de3332dde0e51f38432c69a3853627c8e25433048" dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "multihash", - "percent-encoding 2.1.0", - "serde", - "static_assertions", - "unsigned-varint 0.7.0", - "url 2.2.2", + "blake2-rfc", + "crc32fast", + "fs2", + "hex", + "libc", + "log", + "lz4", + "memmap2 0.2.3", + "parking_lot 0.11.2", + "rand 0.8.5", + "snap", ] [[package]] @@ -5333,15 +5852,15 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.2.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8975095a2a03bbbdc70a74ab11a4f76a6d0b84680d87c68d722531b0ac28e8a9" +checksum = "e8b44461635bbb1a0300f100a841e571e7d919c81c73075ef5d152ffdb521066" dependencies = [ - "arrayvec 0.7.1", - "bitvec 0.20.4", - "byte-slice-cast 1.0.0", + "arrayvec 0.7.2", + "bitvec 1.0.0", + "byte-slice-cast 1.2.1", "impl-trait-for-tuples", - "parity-scale-codec-derive 2.2.0", + "parity-scale-codec-derive 3.1.2", "serde", ] @@ -5359,11 +5878,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "2.2.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40dbbfef7f0a1143c5b06e0d76a6278e25dac0bc1af4be51a0fbb73f07e7ad09" +checksum = "c45ed1f39709f5a89338fab50e59816b2e8815f5bb58276e7ddf9afd495f73f8" dependencies = [ - "proc-macro-crate 1.0.0", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", @@ -5377,36 +5896,31 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-tokio-ipc" -version = "0.4.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e57fea504fea33f9fbb5f49f378359030e7e026a6ab849bb9e8f0787376f1bf" +checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6" dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", + "futures 0.3.21", "libc", "log", - "mio-named-pipes", - "miow 0.3.7", "rand 0.7.3", - "tokio 0.1.22", - "tokio-named-pipes", - "tokio-uds", + "tokio", "winapi 0.3.9", ] [[package]] name = "parity-util-mem" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664a8c6b8e62d8f9f2f937e391982eb433ab285b4cd9545b342441e04a906e42" +checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.9.1", + "hashbrown 0.12.1", "impl-trait-for-tuples", "parity-util-mem-derive", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "primitive-types", - "smallvec 1.6.1", + "smallvec", "winapi 0.3.9", ] @@ -5432,21 +5946,21 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.41.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" +checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-ws" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322d72dfe461b8b9e367d057ceace105379d64d5b03907d23c481ccf3fbf8aa4" +checksum = "5983d3929ad50f12c3eb9a6743f19d691866ecd44da74c0a3308c3f8a56df0c6" dependencies = [ "byteorder", "bytes 0.4.12", "httparse", "log", - "mio", + "mio 0.6.23", "mio-extras", "rand 0.7.3", "sha-1 0.8.2", @@ -5462,94 +5976,57 @@ checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.6.2", - "rustc_version 0.2.3", + "instant", + "lock_api", + "parking_lot_core 0.8.5", ] [[package]] name = "parking_lot" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", + "lock_api", + "parking_lot_core 0.9.3", ] [[package]] -name = "parking_lot" -version = "0.11.1" +name = "parking_lot_core" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ + "cfg-if 1.0.0", "instant", - "lock_api 0.4.4", - "parking_lot_core 0.8.3", + "libc", + "redox_syscall 0.2.13", + "smallvec", + "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if 1.0.0", "libc", - "redox_syscall 0.1.57", - "rustc_version 0.2.3", - "smallvec 0.6.14", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "smallvec 1.6.1", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall 0.2.10", - "smallvec 1.6.1", - "winapi 0.3.9", + "redox_syscall 0.2.13", + "smallvec", + "windows-sys", ] [[package]] name = "paste" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" - -[[package]] -name = "pbkdf2" -version = "0.3.0" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" -dependencies = [ - "byteorder", - "crypto-mac 0.7.0", -] +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" [[package]] name = "pbkdf2" @@ -5561,10 +6038,13 @@ dependencies = [ ] [[package]] -name = "pdqselect" -version = "0.1.0" +name = "pbkdf2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec91767ecc0a0bbe558ce8c9da33c068066c57ecc8bb8477ef8c1ad3ef77c27" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] [[package]] name = "peeking_take_while" @@ -5638,9 +6118,9 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ "fixedbitset", "indexmap", @@ -5653,7 +6133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ "phf_macros", - "phf_shared", + "phf_shared 0.8.0", "proc-macro-hack", ] @@ -5663,8 +6143,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.8.0", + "phf_shared 0.8.0", ] [[package]] @@ -5673,18 +6153,28 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ - "phf_shared", + "phf_shared 0.8.0", "rand 0.7.3", ] +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + [[package]] name = "phf_macros" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.8.0", + "phf_shared 0.8.0", "proc-macro-hack", "proc-macro2", "quote", @@ -5700,29 +6190,38 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f" +checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" dependencies = [ - "pin-project-internal 0.4.28", + "pin-project-internal 0.4.29", ] [[package]] name = "pin-project" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ - "pin-project-internal 1.0.8", + "pin-project-internal 1.0.10", ] [[package]] name = "pin-project-internal" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e" +checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" dependencies = [ "proc-macro2", "quote", @@ -5731,9 +6230,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ "proc-macro2", "quote", @@ -5748,9 +6247,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -5760,9 +6259,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plotters" @@ -5794,9 +6293,9 @@ dependencies = [ [[package]] name = "polling" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25" +checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" dependencies = [ "cfg-if 1.0.0", "libc", @@ -5807,34 +6306,38 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpuid-bool", + "cpufeatures", + "opaque-debug 0.3.0", "universal-hash", ] [[package]] name = "polymesh" -version = "4.1.2" +version = "5.0.0" dependencies = [ "chrono", + "clap 3.1.18", "ed25519-dalek", "frame-benchmarking", "frame-benchmarking-cli", "frame-support", "frame-system", "frame-system-rpc-runtime-api", - "futures 0.3.16", + "futures 0.3.21", "jsonrpc-core", "log", "node-rpc", "node-rpc-runtime-api", "pallet-asset", + "pallet-babe", "pallet-balances 0.1.0", "pallet-bridge", "pallet-committee", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-group", @@ -5853,7 +6356,7 @@ dependencies = [ "pallet-staking", "pallet-staking-rpc-runtime-api", "pallet-sudo", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-node-rpc", "polymesh-primitives", @@ -5872,18 +6375,20 @@ dependencies = [ "sc-consensus", "sc-consensus-babe", "sc-consensus-slots", + "sc-consensus-uncles", "sc-executor", "sc-finality-grandpa", - "sc-light", "sc-network", "sc-rpc", "sc-service", + "sc-sync-state-rpc", "sc-telemetry", "sc-transaction-pool", "serde", "serde_json", "sp-api", "sp-authority-discovery", + "sp-authorship", "sp-block-builder", "sp-blockchain", "sp-consensus", @@ -5891,11 +6396,13 @@ dependencies = [ "sp-consensus-slots", "sp-core", "sp-inherents", + "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", + "sp-timestamp", "sp-transaction-pool", - "structopt", + "sp-transaction-storage-proof", "substrate-prometheus-endpoint", "vergen", ] @@ -5904,7 +6411,7 @@ dependencies = [ name = "polymesh-build-tool" version = "0.1.0" dependencies = [ - "substrate-wasm-builder 3.0.0", + "substrate-wasm-builder", ] [[package]] @@ -5917,9 +6424,10 @@ dependencies = [ "lazy_static", "pallet-session", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives", "polymesh-primitives-derive", + "scale-info", "schnorrkel 0.10.1", "serde", "serde_derive", @@ -5932,6 +6440,39 @@ dependencies = [ "substrate-test-runtime-client", ] +[[package]] +name = "polymesh-contracts" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-asset", + "pallet-base", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-identity", + "pallet-permissions", + "parity-scale-codec 3.1.2", + "polymesh-common-utilities", + "polymesh-primitives", + "pwasm-utils", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "polymesh-exec-macro" +version = "1.0.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "polymesh-extensions" version = "0.1.0" @@ -5940,9 +6481,10 @@ dependencies = [ "frame-system", "pallet-permissions", "pallet-transaction-payment", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", + "scale-info", "sp-runtime", "sp-std", ] @@ -5953,10 +6495,11 @@ version = "0.1.0" dependencies = [ "jsonrpc-core", "node-rpc", + "pallet-contracts-rpc", "pallet-group-rpc", "pallet-protocol-fee-rpc", "pallet-staking-rpc", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives", "sc-chain-spec", "sc-client-api", @@ -5969,6 +6512,7 @@ dependencies = [ "sc-rpc", "sc-rpc-api", "sc-sync-state-rpc", + "sc-transaction-pool-api", "sp-api", "sp-block-builder", "sp-blockchain", @@ -5976,7 +6520,6 @@ dependencies = [ "sp-consensus-babe", "sp-keystore", "sp-runtime", - "sp-transaction-pool", "substrate-frame-rpc-system", ] @@ -5993,11 +6536,12 @@ dependencies = [ "frame-system", "hex", "libsecp256k1 0.6.0", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-primitives-derive", - "rand 0.7.3", - "rand_core 0.5.1", + "rand 0.8.5", + "rand_core 0.6.3", "rustc-hex", + "scale-info", "schnorrkel 0.10.1", "serde", "serde_json", @@ -6024,12 +6568,13 @@ dependencies = [ name = "polymesh-runtime-ci" version = "0.1.0" dependencies = [ - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3)", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1)", "frame-executive", "frame-support", "frame-system", "frame-system-rpc-runtime-api", "lazy_static", + "log", "node-rpc-runtime-api", "pallet-asset", "pallet-authority-discovery", @@ -6040,6 +6585,9 @@ dependencies = [ "pallet-bridge", "pallet-committee", "pallet-compliance-manager", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6053,6 +6601,7 @@ dependencies = [ "pallet-permissions", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-protocol-fee-rpc-runtime-api", "pallet-randomness-collective-flip", @@ -6072,16 +6621,18 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury 0.1.0", "pallet-utility", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-build-tool", "polymesh-common-utilities", + "polymesh-contracts", "polymesh-extensions", "polymesh-primitives", "polymesh-runtime-common", "polymesh-weights", + "scale-info", "serde", "serde_derive", - "smallvec 1.6.1", + "smallvec", "sp-api", "sp-arithmetic", "sp-authority-discovery", @@ -6109,19 +6660,22 @@ dependencies = [ "pallet-asset", "pallet-authorship", "pallet-balances 0.1.0", + "pallet-bridge", "pallet-committee", "pallet-compliance-manager", "pallet-group-rpc-runtime-api", "pallet-identity", "pallet-multisig", "pallet-portfolio", + "pallet-relayer", + "pallet-test-utils", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-common-utilities", "polymesh-primitives", "rand 0.7.3", "serde", - "smallvec 1.6.1", + "smallvec", "sp-core", "sp-io", "sp-runtime", @@ -6132,14 +6686,16 @@ dependencies = [ name = "polymesh-runtime-develop" version = "0.1.0" dependencies = [ - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3)", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1)", "frame-benchmarking", "frame-executive", "frame-support", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", - "hex-literal 0.3.3", + "getrandom 0.2.6", + "hex-literal 0.3.4", + "log", "node-rpc-runtime-api", "pallet-asset", "pallet-authority-discovery", @@ -6150,6 +6706,9 @@ dependencies = [ "pallet-bridge", "pallet-committee", "pallet-compliance-manager", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6163,6 +6722,7 @@ dependencies = [ "pallet-permissions", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-protocol-fee-rpc-runtime-api", "pallet-randomness-collective-flip", @@ -6182,13 +6742,15 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury 0.1.0", "pallet-utility", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-build-tool", "polymesh-common-utilities", + "polymesh-contracts", "polymesh-extensions", "polymesh-primitives", "polymesh-runtime-common", "polymesh-weights", + "scale-info", "serde", "sp-api", "sp-arithmetic", @@ -6211,12 +6773,13 @@ dependencies = [ name = "polymesh-runtime-mainnet" version = "0.1.0" dependencies = [ - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3)", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1)", "frame-executive", "frame-support", "frame-system", "frame-system-rpc-runtime-api", "lazy_static", + "log", "node-rpc-runtime-api", "pallet-asset", "pallet-authority-discovery", @@ -6227,6 +6790,9 @@ dependencies = [ "pallet-bridge", "pallet-committee", "pallet-compliance-manager", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6240,6 +6806,7 @@ dependencies = [ "pallet-permissions", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-protocol-fee-rpc-runtime-api", "pallet-randomness-collective-flip", @@ -6258,16 +6825,18 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury 0.1.0", "pallet-utility", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-build-tool", "polymesh-common-utilities", + "polymesh-contracts", "polymesh-extensions", "polymesh-primitives", "polymesh-runtime-common", "polymesh-weights", + "scale-info", "serde", "serde_derive", - "smallvec 1.6.1", + "smallvec", "sp-api", "sp-arithmetic", "sp-authority-discovery", @@ -6289,12 +6858,13 @@ dependencies = [ name = "polymesh-runtime-testnet" version = "0.1.0" dependencies = [ - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3)", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1)", "frame-executive", "frame-support", "frame-system", "frame-system-rpc-runtime-api", "lazy_static", + "log", "node-rpc-runtime-api", "pallet-asset", "pallet-authority-discovery", @@ -6305,6 +6875,9 @@ dependencies = [ "pallet-bridge", "pallet-committee", "pallet-compliance-manager", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6318,6 +6891,7 @@ dependencies = [ "pallet-permissions", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-protocol-fee-rpc-runtime-api", "pallet-randomness-collective-flip", @@ -6337,16 +6911,18 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury 0.1.0", "pallet-utility", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "polymesh-build-tool", "polymesh-common-utilities", + "polymesh-contracts", "polymesh-extensions", "polymesh-primitives", "polymesh-runtime-common", "polymesh-weights", + "scale-info", "serde", "serde_derive", - "smallvec 1.6.1", + "smallvec", "sp-api", "sp-arithmetic", "sp-authority-discovery", @@ -6370,17 +6946,19 @@ version = "1.0.0" dependencies = [ "chrono", "confidential_identity 1.0.0", - "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?tag=confidential-identity-v1.1.3)", - "env_logger", + "cryptography_core 1.0.0 (git+https://github.com/PolymathNetwork/cryptography.git?branch=confidential-identity-v1)", + "env_logger 0.7.1", "frame-benchmarking", + "frame-election-provider-support", "frame-executive", "frame-support", "frame-system", "frame-system-rpc-runtime-api", - "hex-literal 0.3.3", + "hex-literal 0.3.4", "ink_primitives", "lazy_static", "libsecp256k1 0.6.0", + "log", "node-rpc-runtime-api", "pallet-asset", "pallet-authority-discovery", @@ -6391,6 +6969,9 @@ dependencies = [ "pallet-bridge", "pallet-committee", "pallet-compliance-manager", + "pallet-contracts", + "pallet-contracts-primitives", + "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6404,6 +6985,7 @@ dependencies = [ "pallet-permissions", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-protocol-fee-rpc-runtime-api", "pallet-randomness-collective-flip", @@ -6423,18 +7005,21 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury 0.1.0", "pallet-utility", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "polymesh-common-utilities", + "polymesh-contracts", + "polymesh-exec-macro", "polymesh-extensions", "polymesh-primitives", "polymesh-runtime-common", "polymesh-runtime-develop", "polymesh-weights", "rand 0.7.3", + "scale-info", "serde", "serde_json", - "smallvec 1.6.1", + "smallvec", "sp-api", "sp-arithmetic", "sp-authority-discovery", @@ -6478,6 +7063,7 @@ dependencies = [ "pallet-multisig", "pallet-pips", "pallet-portfolio", + "pallet-preimage", "pallet-protocol-fee", "pallet-relayer", "pallet-rewards", @@ -6491,26 +7077,28 @@ dependencies = [ "pallet-timestamp", "pallet-treasury 0.1.0", "pallet-utility", + "polymesh-contracts", "polymesh-runtime-common", "sp-std", ] [[package]] name = "polyval" -version = "0.4.5" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ - "cpuid-bool", + "cfg-if 1.0.0", + "cpufeatures", "opaque-debug 0.3.0", "universal-hash", ] [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "precomputed-hash" @@ -6518,15 +7106,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "prettytable-rs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fd04b170004fa2daccf418a7f8253aaf033c27760b5f225889024cf66d7ac2e" +dependencies = [ + "atty", + "csv", + "encode_unicode", + "lazy_static", + "term", + "unicode-width", +] + [[package]] name = "primitive-types" -version = "0.9.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06345ee39fbccfb06ab45f3a1a5798d9dafa04cb8921a76d227040003a234b0e" +checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" dependencies = [ "fixed-hash", "impl-codec", "impl-serde", + "scale-info", "uint", ] @@ -6541,9 +7144,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.0.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ "thiserror", "toml", @@ -6579,71 +7182,90 @@ version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" dependencies = [ "unicode-xid", ] [[package]] name = "prometheus" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8425533e7122f0c3cc7a37e6244b16ad3a2cc32ae7ac6276e2a75da0d9c200d" +checksum = "b7f64969ffd5dd8f39bd57a68ac53c163a095ed9d0fb707146da1b27025a3504" dependencies = [ "cfg-if 1.0.0", "fnv", "lazy_static", - "parking_lot 0.11.1", - "regex", + "memchr", + "parking_lot 0.11.2", "thiserror", ] +[[package]] +name = "prometheus-client" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" +dependencies = [ + "dtoa 1.0.2", + "itoa 1.0.2", + "owning_ref", + "prometheus-client-derive-text-encode", +] + +[[package]] +name = "prometheus-client-derive-text-encode" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "prost" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "prost-derive", ] [[package]] name = "prost-build" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" dependencies = [ - "bytes 1.0.1", - "heck", - "itertools 0.9.0", + "bytes 1.1.0", + "heck 0.3.3", + "itertools", + "lazy_static", "log", "multimap", "petgraph", "prost", "prost-types", + "regex", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools", "proc-macro2", "quote", "syn", @@ -6651,32 +7273,32 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "prost", ] [[package]] name = "psm" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0617ee61163b5d941d804065ce49040967610a4d4278fae73e096a057b01d358" +checksum = "871372391786ccec00d3c5d3d6608905b3d4db263639cfe075d3b60a736d115a" dependencies = [ "cc", ] [[package]] name = "pwasm-utils" -version = "0.14.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7" +checksum = "880b3384fb00b8f6ecccd5d358b93bd2201900ae3daad213791d1864f6441f5c" dependencies = [ "byteorder", "log", - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", ] [[package]] @@ -6704,9 +7326,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.9" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] @@ -6719,38 +7341,9 @@ checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" [[package]] name = "radium" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" - -[[package]] -name = "radium" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" - -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi 0.3.9", -] +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] name = "rand" @@ -6762,20 +7355,19 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc 0.2.0", - "rand_pcg", + "rand_hc", + "rand_pcg 0.2.1", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.3", - "rand_hc 0.3.1", ] [[package]] @@ -6798,21 +7390,6 @@ dependencies = [ "rand_core 0.6.3", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -6828,17 +7405,17 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.6", ] [[package]] name = "rand_distr" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051b398806e42b9cd04ad9ec8f81e355d0a382c543ac6672c62f5a5b452ef142" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -6850,15 +7427,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - [[package]] name = "rand_pcg" version = "0.2.1" @@ -6869,14 +7437,12 @@ dependencies = [ ] [[package]] -name = "raw-cpuid" -version = "8.1.2" +name = "rand_pcg" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdf7d9dbd43f3d81d94a49c1c3df73cc2b3827995147e6cf7f89d4ec5483e73" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" dependencies = [ - "bitflags", - "cc", - "rustc_version 0.2.3", + "rand_core 0.6.3", ] [[package]] @@ -6887,38 +7453,28 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", - "crossbeam-deque 0.8.1", + "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", - "crossbeam-deque 0.8.1", - "crossbeam-utils 0.8.5", - "lazy_static", + "crossbeam-deque", + "crossbeam-utils", "num_cpus", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.1.57" @@ -6927,37 +7483,49 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom 0.1.16", + "redox_syscall 0.1.57", + "rust-argon2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.3", - "redox_syscall 0.2.10", + "getrandom 0.2.6", + "redox_syscall 0.2.13", + "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "685d58625b6c2b83e4cc88a27c4bf65adb7b6b16dbdc413e515c9405b47432ab" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +checksum = "a043824e29c94169374ac5183ac0ed43f5724dc4556b19568007486bd840fa1f" dependencies = [ "proc-macro2", "quote", @@ -6966,20 +7534,20 @@ dependencies = [ [[package]] name = "regalloc" -version = "0.0.31" +version = "0.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" +checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" dependencies = [ "log", "rustc-hash", - "smallvec 1.6.1", + "smallvec", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", @@ -7022,15 +7590,36 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error 1.2.3", +] + [[package]] name = "retain_mut" -version = "0.1.3" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c17925a9027d298a4603d286befe3f9dc0e8ed02523141914eb628798d6e5b" +checksum = "8c31b5c4033f8fdde8700e4657be2c497e7288f01515be52168c631e2e4d4086" [[package]] -name = "ring" -version = "0.16.20" +name = "rfc6979" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +dependencies = [ + "crypto-bigint", + "hmac 0.11.0", + "zeroize", +] + +[[package]] +name = "ring" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ @@ -7045,9 +7634,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c749134fda8bfc90d0de643d59bfc841dcb3ac8a1062e12b6754bd60235c48b3" +checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" dependencies = [ "libc", "librocksdb-sys", @@ -7063,11 +7652,38 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "rtnetlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f54290e54521dac3de4149d83ddf9f62a359b3cc93bcb494a794a41e6f4744b" +dependencies = [ + "async-global-executor", + "futures 0.3.21", + "log", + "netlink-packet-route", + "netlink-proto", + "nix", + "thiserror", +] + +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils", +] + [[package]] name = "rustc-demangle" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" @@ -7092,76 +7708,86 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 0.11.0", + "semver 1.0.9", ] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustix" +version = "0.33.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" dependencies = [ - "semver 1.0.4", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "winapi 0.3.9", ] [[package]] name = "rustls" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "log", "ring", - "sct", - "webpki", + "sct 0.6.1", + "webpki 0.21.4", ] [[package]] name = "rustls" -version = "0.19.1" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "a024a432ae760ab3bff924ad91ce1cfa52cb57ed16e1ef32d0d249cfee1a6c13" dependencies = [ - "base64 0.13.0", "log", "ring", - "sct", - "webpki", + "sct 0.7.0", + "webpki 0.22.0", ] [[package]] name = "rustls-native-certs" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629d439a7672da82dd955498445e496ee2096fe2117b9f796558a43fdb9e59b8" +checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" dependencies = [ "openssl-probe", - "rustls 0.18.1", + "rustls 0.19.1", "schannel", "security-framework", ] +[[package]] +name = "rustversion" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" + [[package]] name = "rw-stream-sink" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.16", - "pin-project 0.4.28", + "futures 0.3.21", + "pin-project 0.4.29", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "safe-mix" @@ -7174,9 +7800,9 @@ dependencies = [ [[package]] name = "salsa20" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399f290ffc409596022fce5ea5d4138184be4784f2b28c62c59f0d8389059a15" +checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" dependencies = [ "cipher", ] @@ -7190,25 +7816,34 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sc-allocator" +version = "4.1.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "log", + "sp-core", + "sp-wasm-interface", + "thiserror", +] + [[package]] name = "sc-authority-discovery" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "async-trait", - "derive_more", - "either", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", + "ip_network", "libp2p", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "prost", "prost-build", "rand 0.7.3", "sc-client-api", "sc-network", - "serde_json", "sp-api", "sp-authority-discovery", "sp-blockchain", @@ -7216,42 +7851,42 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-prometheus-endpoint", + "thiserror", ] [[package]] name = "sc-basic-authorship" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sc-block-builder", "sc-client-api", "sc-proposer-metrics", "sc-telemetry", + "sc-transaction-pool-api", "sp-api", "sp-blockchain", "sp-consensus", "sp-core", "sp-inherents", "sp-runtime", - "sp-transaction-pool", "substrate-prometheus-endpoint", ] [[package]] name = "sc-block-builder" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sc-client-api", "sp-api", "sp-block-builder", "sp-blockchain", - "sp-consensus", "sp-core", "sp-inherents", "sp-runtime", @@ -7260,31 +7895,27 @@ dependencies = [ [[package]] name = "sc-chain-spec" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "memmap2 0.5.3", + "parity-scale-codec 3.1.2", "sc-chain-spec-derive", - "sc-consensus-babe", - "sc-consensus-epochs", - "sc-finality-grandpa", "sc-network", "sc-telemetry", "serde", "serde_json", - "sp-chain-spec", - "sp-consensus-babe", "sp-core", "sp-runtime", ] [[package]] name = "sc-chain-spec-derive" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", @@ -7292,26 +7923,29 @@ dependencies = [ [[package]] name = "sc-cli" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "chrono", + "clap 3.1.18", "fdlimit", - "futures 0.3.16", + "futures 0.3.21", "hex", "libp2p", "log", "names", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "rand 0.7.3", "regex", "rpassword", "sc-client-api", + "sc-client-db", "sc-keystore", "sc-network", "sc-service", "sc-telemetry", "sc-tracing", + "sc-utils", "serde", "serde_json", "sp-blockchain", @@ -7320,112 +7954,110 @@ dependencies = [ "sp-keystore", "sp-panic-handler", "sp-runtime", - "sp-utils", "sp-version", - "structopt", "thiserror", "tiny-bip39", - "tokio 0.2.25", + "tokio", ] [[package]] name = "sc-client-api" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", "fnv", - "futures 0.3.16", + "futures 0.3.21", "hash-db", - "kvdb", - "lazy_static", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "sc-executor", + "sc-transaction-pool-api", + "sc-utils", "sp-api", "sp-blockchain", "sp-consensus", "sp-core", "sp-database", "sp-externalities", - "sp-inherents", "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-std", "sp-storage", - "sp-transaction-pool", "sp-trie", - "sp-utils", - "sp-version", "substrate-prometheus-endpoint", ] [[package]] name = "sc-client-db" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "blake2-rfc", "hash-db", "kvdb", "kvdb-memorydb", "kvdb-rocksdb", "linked-hash-map", "log", - "parity-db", - "parity-scale-codec 2.2.0", - "parity-util-mem", - "parking_lot 0.11.1", + "parity-db 0.3.13", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "sc-client-api", - "sc-executor", "sc-state-db", "sp-arithmetic", "sp-blockchain", - "sp-consensus", "sp-core", "sp-database", "sp-runtime", "sp-state-machine", "sp-trie", - "substrate-prometheus-endpoint", ] [[package]] name = "sc-consensus" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "async-trait", + "futures 0.3.21", + "futures-timer", + "libp2p", + "log", + "parking_lot 0.12.0", "sc-client-api", + "sc-utils", + "serde", + "sp-api", "sp-blockchain", "sp-consensus", + "sp-core", "sp-runtime", + "sp-state-machine", + "substrate-prometheus-endpoint", + "thiserror", ] [[package]] name = "sc-consensus-babe" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", + "async-trait", "fork-tree", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", "log", "merlin 2.0.1", "num-bigint", "num-rational 0.2.4", "num-traits", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", - "pdqselect", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "rand 0.7.3", "retain_mut", "sc-client-api", + "sc-consensus", "sc-consensus-epochs", "sc-consensus-slots", - "sc-consensus-uncles", "sc-keystore", "sc-telemetry", "schnorrkel 0.9.1", @@ -7443,19 +8075,17 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-timestamp", - "sp-utils", "sp-version", "substrate-prometheus-endpoint", + "thiserror", ] [[package]] name = "sc-consensus-babe-rpc" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", - "futures 0.3.16", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -7471,35 +8101,35 @@ dependencies = [ "sp-core", "sp-keystore", "sp-runtime", + "thiserror", ] [[package]] name = "sc-consensus-epochs" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "fork-tree", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", "sc-client-api", + "sc-consensus", "sp-blockchain", "sp-runtime", ] [[package]] name = "sc-consensus-slots" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", + "async-trait", + "futures 0.3.21", + "futures-timer", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", "sc-client-api", + "sc-consensus", "sc-telemetry", - "sp-api", - "sp-application-crypto", "sp-arithmetic", "sp-blockchain", "sp-consensus", @@ -7508,125 +8138,124 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-trie", + "sp-timestamp", "thiserror", ] [[package]] name = "sc-consensus-uncles" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "log", "sc-client-api", "sp-authorship", - "sp-consensus", - "sp-core", - "sp-inherents", "sp-runtime", + "thiserror", ] [[package]] name = "sc-executor" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", "lazy_static", - "libsecp256k1 0.6.0", - "log", - "parity-scale-codec 2.2.0", - "parity-wasm 0.41.0", - "parking_lot 0.11.1", + "lru", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "sc-executor-common", "sc-executor-wasmi", "sc-executor-wasmtime", "sp-api", "sp-core", + "sp-core-hashing-proc-macro", "sp-externalities", "sp-io", "sp-panic-handler", "sp-runtime-interface", - "sp-serializer", "sp-tasks", "sp-trie", "sp-version", "sp-wasm-interface", + "tracing", "wasmi", ] [[package]] name = "sc-executor-common" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", - "parity-scale-codec 2.2.0", - "parity-wasm 0.41.0", - "sp-allocator", - "sp-core", + "environmental", + "parity-scale-codec 3.1.2", + "sc-allocator", + "sp-maybe-compressed-blob", + "sp-sandbox", "sp-serializer", "sp-wasm-interface", "thiserror", + "wasm-instrument", "wasmi", ] [[package]] name = "sc-executor-wasmi" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "sc-allocator", "sc-executor-common", - "sp-allocator", - "sp-core", "sp-runtime-interface", + "sp-sandbox", "sp-wasm-interface", "wasmi", ] [[package]] name = "sc-executor-wasmtime" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "cfg-if 1.0.0", + "libc", "log", - "parity-scale-codec 2.2.0", - "parity-wasm 0.41.0", - "pwasm-utils", + "parity-scale-codec 3.1.2", + "parity-wasm 0.42.2", + "sc-allocator", "sc-executor-common", - "scoped-tls", - "sp-allocator", - "sp-core", "sp-runtime-interface", + "sp-sandbox", "sp-wasm-interface", "wasmtime", ] [[package]] name = "sc-finality-grandpa" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", + "ahash", + "async-trait", + "dyn-clone", "finality-grandpa", "fork-tree", - "futures 0.3.16", - "futures-timer 3.0.2", - "linked-hash-map", + "futures 0.3.21", + "futures-timer", + "hex", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", - "pin-project 1.0.8", - "rand 0.7.3", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", + "rand 0.8.5", "sc-block-builder", + "sc-chain-spec", "sc-client-api", "sc-consensus", "sc-keystore", "sc-network", "sc-network-gossip", "sc-telemetry", + "sc-utils", "serde_json", "sp-api", "sp-application-crypto", @@ -7635,27 +8264,25 @@ dependencies = [ "sp-consensus", "sp-core", "sp-finality-grandpa", - "sp-inherents", "sp-keystore", "sp-runtime", - "sp-utils", "substrate-prometheus-endpoint", + "thiserror", ] [[package]] name = "sc-finality-grandpa-rpc" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", "finality-grandpa", - "futures 0.3.16", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sc-client-api", "sc-finality-grandpa", "sc-rpc", @@ -7664,84 +8291,56 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-runtime", + "thiserror", ] [[package]] name = "sc-informant" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "ansi_term 0.12.1", - "futures 0.3.16", + "ansi_term", + "futures 0.3.21", + "futures-timer", "log", "parity-util-mem", "sc-client-api", "sc-network", + "sc-transaction-pool-api", "sp-blockchain", "sp-runtime", - "sp-transaction-pool", - "sp-utils", - "wasm-timer", ] [[package]] name = "sc-keystore" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "async-trait", - "derive_more", - "futures 0.3.16", - "futures-util", "hex", - "merlin 2.0.1", - "parking_lot 0.11.1", - "rand 0.7.3", + "parking_lot 0.12.0", "serde_json", "sp-application-crypto", "sp-core", "sp-keystore", - "subtle 2.4.1", -] - -[[package]] -name = "sc-light" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ - "hash-db", - "lazy_static", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", - "sc-client-api", - "sc-executor", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-externalities", - "sp-runtime", - "sp-state-machine", + "thiserror", ] [[package]] name = "sc-network" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "async-std", "async-trait", "asynchronous-codec 0.5.0", "bitflags", - "bs58", - "bytes 1.0.1", + "bytes 1.1.0", "cid", - "derive_more", "either", - "erased-serde", "fnv", "fork-tree", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", "hex", "ip_network", "libp2p", @@ -7749,93 +8348,95 @@ dependencies = [ "linked_hash_set", "log", "lru", - "nohash-hasher", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", - "pin-project 1.0.8", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", + "pin-project 1.0.10", "prost", "prost-build", "rand 0.7.3", "sc-block-builder", "sc-client-api", + "sc-consensus", "sc-peerset", + "sc-utils", "serde", "serde_json", - "smallvec 1.6.1", + "smallvec", "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-core", + "sp-finality-grandpa", "sp-runtime", - "sp-utils", "substrate-prometheus-endpoint", "thiserror", "unsigned-varint 0.6.0", "void", - "wasm-timer", "zeroize", ] [[package]] name = "sc-network-gossip" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", + "ahash", + "futures 0.3.21", + "futures-timer", "libp2p", "log", "lru", "sc-network", "sp-runtime", "substrate-prometheus-endpoint", - "wasm-timer", + "tracing", ] [[package]] name = "sc-offchain" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "bytes 0.5.6", + "bytes 1.1.0", "fnv", - "futures 0.3.16", - "futures-timer 3.0.2", - "hyper 0.13.10", + "futures 0.3.21", + "futures-timer", + "hex", + "hyper", "hyper-rustls", - "log", "num_cpus", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "once_cell", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "rand 0.7.3", "sc-client-api", - "sc-keystore", "sc-network", + "sc-utils", "sp-api", "sp-core", "sp-offchain", "sp-runtime", - "sp-utils", "threadpool", + "tracing", ] [[package]] name = "sc-peerset" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "libp2p", "log", + "sc-utils", "serde_json", - "sp-utils", "wasm-timer", ] [[package]] name = "sc-proposer-metrics" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -7843,115 +8444,115 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "sc-block-builder", + "sc-chain-spec", "sc-client-api", - "sc-executor", - "sc-keystore", "sc-rpc-api", "sc-tracing", + "sc-transaction-pool-api", + "sc-utils", "serde_json", "sp-api", "sp-blockchain", - "sp-chain-spec", "sp-core", "sp-keystore", "sp-offchain", "sp-rpc", "sp-runtime", "sp-session", - "sp-state-machine", - "sp-transaction-pool", - "sp-utils", "sp-version", ] [[package]] name = "sc-rpc-api" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", - "futures 0.3.16", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-pubsub", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", + "sc-chain-spec", + "sc-transaction-pool-api", + "scale-info", "serde", "serde_json", - "sp-chain-spec", "sp-core", "sp-rpc", "sp-runtime", - "sp-transaction-pool", + "sp-tracing", "sp-version", + "thiserror", ] [[package]] name = "sc-rpc-server" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.1.31", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-http-server", "jsonrpc-ipc-server", "jsonrpc-pubsub", "jsonrpc-ws-server", "log", - "serde", "serde_json", - "sp-runtime", "substrate-prometheus-endpoint", + "tokio", ] [[package]] name = "sc-service" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "async-trait", "directories", "exit-future", - "futures 0.1.31", - "futures 0.3.16", - "futures-timer 3.0.2", + "futures 0.3.21", + "futures-timer", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", - "lazy_static", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "parity-util-mem", - "parking_lot 0.11.1", - "pin-project 1.0.8", + "parking_lot 0.12.0", + "pin-project 1.0.10", "rand 0.7.3", "sc-block-builder", "sc-chain-spec", "sc-client-api", "sc-client-db", + "sc-consensus", "sc-executor", "sc-informant", "sc-keystore", - "sc-light", "sc-network", "sc-offchain", "sc-rpc", "sc-rpc-server", + "sc-sysinfo", "sc-telemetry", "sc-tracing", "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", "serde", "serde_json", "sp-api", @@ -7962,167 +8563,215 @@ dependencies = [ "sp-core", "sp-externalities", "sp-inherents", - "sp-io", "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", + "sp-storage", "sp-tracing", "sp-transaction-pool", + "sp-transaction-storage-proof", "sp-trie", - "sp-utils", "sp-version", "substrate-prometheus-endpoint", "tempfile", "thiserror", + "tokio", "tracing", "tracing-futures", - "wasm-timer", ] [[package]] name = "sc-state-db" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "parity-util-mem", "parity-util-mem-derive", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "sc-client-api", "sp-core", - "thiserror", ] [[package]] name = "sc-sync-state-rpc" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3777fc5dc8e90c4f27a3824cd4c08eeab578758ea2267b7563a22a829b44060" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", + "parity-scale-codec 3.1.2", "sc-chain-spec", "sc-client-api", "sc-consensus-babe", "sc-consensus-epochs", "sc-finality-grandpa", - "sc-rpc-api", + "serde", "serde_json", "sp-blockchain", "sp-runtime", "thiserror", ] +[[package]] +name = "sc-sysinfo" +version = "6.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "futures 0.3.21", + "libc", + "log", + "rand 0.7.3", + "rand_pcg 0.2.1", + "regex", + "sc-telemetry", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-std", +] + [[package]] name = "sc-telemetry" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "chrono", - "futures 0.3.16", + "futures 0.3.21", "libp2p", "log", - "parking_lot 0.11.1", - "pin-project 1.0.8", + "parking_lot 0.12.0", + "pin-project 1.0.10", "rand 0.7.3", "serde", "serde_json", - "sp-utils", - "take_mut", - "tracing", - "tracing-subscriber", - "void", + "thiserror", "wasm-timer", ] [[package]] name = "sc-tracing" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "ansi_term 0.12.1", + "ansi_term", "atty", - "erased-serde", + "chrono", "lazy_static", + "libc", "log", "once_cell", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "regex", "rustc-hash", - "sc-telemetry", + "sc-client-api", + "sc-rpc-server", "sc-tracing-proc-macro", "serde", - "serde_json", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", "sp-tracing", "thiserror", "tracing", - "tracing-core", "tracing-log", "tracing-subscriber", - "wasm-bindgen", - "web-sys", ] [[package]] name = "sc-tracing-proc-macro" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", ] [[package]] -name = "sc-transaction-graph" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sc-transaction-pool" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", - "futures 0.3.16", + "futures 0.3.21", + "futures-timer", "linked-hash-map", "log", + "parity-scale-codec 3.1.2", "parity-util-mem", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "retain_mut", + "sc-client-api", + "sc-transaction-pool-api", + "sc-utils", "serde", + "sp-api", "sp-blockchain", "sp-core", "sp-runtime", + "sp-tracing", "sp-transaction-pool", - "sp-utils", + "substrate-prometheus-endpoint", "thiserror", - "wasm-timer", ] [[package]] -name = "sc-transaction-pool" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sc-transaction-pool-api" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-diagnose", - "intervalier", + "futures 0.3.21", "log", - "parity-scale-codec 2.2.0", - "parity-util-mem", - "parking_lot 0.11.1", - "sc-client-api", - "sc-transaction-graph", - "sp-api", + "serde", "sp-blockchain", - "sp-core", "sp-runtime", - "sp-tracing", - "sp-transaction-pool", - "sp-utils", - "substrate-prometheus-endpoint", "thiserror", - "wasm-timer", +] + +[[package]] +name = "sc-utils" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "futures 0.3.21", + "futures-timer", + "lazy_static", + "log", + "parking_lot 0.12.0", + "prometheus", +] + +[[package]] +name = "scale-info" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8980cafbe98a7ee7a9cc16b32ebce542c77883f512d83fbf2ddc8f6a85ea74c9" +dependencies = [ + "bitvec 1.0.0", + "cfg-if 1.0.0", + "derive_more", + "parity-scale-codec 3.1.2", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4260c630e8a8a33429d1688eff2f163f24c65a4e1b1578ef6b565061336e4b6f" +dependencies = [ + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -8148,16 +8797,15 @@ dependencies = [ "merlin 2.0.1", "rand 0.7.3", "rand_core 0.5.1", - "serde", "sha2 0.8.2", - "subtle 2.4.1", + "subtle", "zeroize", ] [[package]] name = "schnorrkel" version = "0.10.1" -source = "git+https://github.com/PolymathNetwork/schnorrkel?branch=rebase-head#5630c0d25a3a182666f0d76713b650eeacb6d0a9" +source = "git+https://github.com/PolymathNetwork/schnorrkel?branch=rebase-head#8badbc3657ea40d33ef4d9b7d75e41c460cf6146" dependencies = [ "arrayref", "arrayvec 0.5.2", @@ -8165,19 +8813,14 @@ dependencies = [ "curve25519-dalek 3.2.0", "merlin 3.0.0", "rand_core 0.6.3", + "scale-info", "serde", "serde_bytes", - "sha2 0.9.5", - "subtle 2.4.1", + "sha2 0.9.9", + "subtle", "zeroize", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "scopeguard" version = "1.1.0" @@ -8196,54 +8839,74 @@ dependencies = [ "html5ever", "matches", "selectors", - "smallvec 1.6.1", + "smallvec", "tendril", ] [[package]] -name = "scroll" -version = "0.10.2" +name = "sct" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ - "scroll_derive", + "ring", + "untrusted", ] [[package]] -name = "scroll_derive" -version = "0.10.5" +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "proc-macro2", - "quote", - "syn", + "ring", + "untrusted", ] [[package]] -name = "sct" -version = "0.6.1" +name = "sec1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ - "ring", - "untrusted", + "der", + "generic-array 0.14.5", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +dependencies = [ + "cc", ] [[package]] name = "secrecy" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" dependencies = [ "zeroize", ] [[package]] name = "security-framework" -version = "1.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad502866817f0575705bd7be36e2b2535cc33262d493aa733a2ec862baa2bc2b" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -8254,9 +8917,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "1.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ceb04988b17b6d1dcd555390fa822ca5637b4a14e1f5099f13d351bed4d6c7" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -8278,7 +8941,7 @@ dependencies = [ "phf_codegen", "precomputed-hash", "servo_arc", - "smallvec 1.6.1", + "smallvec", "thin-slice", ] @@ -8288,7 +8951,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" dependencies = [ - "semver-parser 0.7.0", + "semver-parser", ] [[package]] @@ -8297,54 +8960,38 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", + "semver-parser", ] [[package]] name = "semver" -version = "0.11.0" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" dependencies = [ - "semver-parser 0.10.2", "serde", ] -[[package]] -name = "semver" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" - [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" -version = "1.0.129" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" dependencies = [ "serde", ] @@ -8361,9 +9008,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.129" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -8372,15 +9019,24 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.66" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ - "itoa", + "itoa 1.0.2", "ryu", "serde", ] +[[package]] +name = "serde_nanos" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e44969a61f5d316be20a42ff97816efb3b407a924d06824c3d8a49fa8450de0e" +dependencies = [ + "serde", +] + [[package]] name = "servo_arc" version = "0.1.1" @@ -8405,9 +9061,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -8430,9 +9086,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.5" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -8441,6 +9097,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + [[package]] name = "sha3" version = "0.9.1" @@ -8453,26 +9120,36 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha3" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" +dependencies = [ + "digest 0.10.3", + "keccak", +] + [[package]] name = "sharded-slab" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740223c51853f3145fe7c90360d2d4232f2b62e3449489c207eccde818979982" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" dependencies = [ "lazy_static", ] [[package]] name = "shlex" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "470c5a6397076fae0094aaf06a08e6ba6f37acb77d3b1b91ea92b4d6c8650c39" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" dependencies = [ "libc", "signal-hook-registry", @@ -8489,9 +9166,13 @@ dependencies = [ [[package]] name = "signature" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335" +checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +dependencies = [ + "digest 0.9.0", + "rand_core 0.6.3", +] [[package]] name = "simba" @@ -8507,65 +9188,50 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.6" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "0.6.14" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] -name = "smallvec" -version = "1.6.1" +name = "snap" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" [[package]] name = "snow" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795dd7aeeee24468e5a32661f6d27f7b5cbed802031b2d7640c7b10f8fb2dd50" +checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", - "rand 0.7.3", - "rand_core 0.5.1", + "curve25519-dalek 4.0.0-pre.1", + "rand_core 0.6.3", "ring", - "rustc_version 0.2.3", - "sha2 0.9.5", - "subtle 2.4.1", - "x25519-dalek", -] - -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", + "rustc_version 0.4.0", + "sha2 0.10.2", + "subtle", ] [[package]] name = "socket2" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi 0.3.9", @@ -8573,39 +9239,28 @@ dependencies = [ [[package]] name = "soketto" -version = "0.4.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64 0.12.3", - "bytes 0.5.6", + "base64 0.13.0", + "bytes 1.1.0", "flate2", - "futures 0.3.16", + "futures 0.3.21", "httparse", "log", - "rand 0.7.3", - "sha-1 0.9.7", -] - -[[package]] -name = "sp-allocator" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ - "log", - "sp-core", - "sp-std", - "sp-wasm-interface", - "thiserror", + "rand 0.8.5", + "sha-1 0.9.8", ] [[package]] name = "sp-api" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "hash-db", - "parity-scale-codec 2.2.0", + "log", + "parity-scale-codec 3.1.2", "sp-api-proc-macro", "sp-core", "sp-runtime", @@ -8617,11 +9272,11 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "blake2-rfc", - "proc-macro-crate 0.1.5", + "blake2", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", @@ -8629,10 +9284,11 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-core", "sp-io", @@ -8641,23 +9297,26 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "5.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "integer-sqrt", "num-traits", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-debug-derive", "sp-std", + "static_assertions", ] [[package]] name = "sp-authority-discovery" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "sp-api", "sp-application-crypto", "sp-runtime", @@ -8666,10 +9325,11 @@ dependencies = [ [[package]] name = "sp-authorship" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "async-trait", + "parity-scale-codec 3.1.2", "sp-inherents", "sp-runtime", "sp-std", @@ -8677,10 +9337,10 @@ dependencies = [ [[package]] name = "sp-block-builder" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sp-api", "sp-inherents", "sp-runtime", @@ -8689,14 +9349,14 @@ dependencies = [ [[package]] name = "sp-blockchain" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "log", "lru", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "sp-api", "sp-consensus", "sp-database", @@ -8705,49 +9365,36 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sp-chain-spec" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "sp-consensus" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-timer 3.0.2", - "libp2p", + "async-trait", + "futures 0.3.21", + "futures-timer", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", - "serde", - "sp-api", + "parity-scale-codec 3.1.2", "sp-core", "sp-inherents", "sp-runtime", "sp-state-machine", "sp-std", - "sp-trie", - "sp-utils", "sp-version", - "substrate-prometheus-endpoint", "thiserror", - "wasm-timer", ] [[package]] name = "sp-consensus-aura" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "async-trait", + "parity-scale-codec 3.1.2", + "scale-info", "sp-api", "sp-application-crypto", + "sp-consensus", "sp-consensus-slots", "sp-inherents", "sp-runtime", @@ -8757,11 +9404,14 @@ dependencies = [ [[package]] name = "sp-consensus-babe" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "async-trait", "merlin 2.0.1", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", + "serde", "sp-api", "sp-application-crypto", "sp-consensus", @@ -8777,20 +9427,24 @@ dependencies = [ [[package]] name = "sp-consensus-slots" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", + "serde", "sp-arithmetic", "sp-runtime", + "sp-std", + "sp-timestamp", ] [[package]] name = "sp-consensus-vrf" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "schnorrkel 0.9.1", "sp-core", "sp-runtime", @@ -8799,86 +9453,114 @@ dependencies = [ [[package]] name = "sp-core" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "base58", + "bitflags", "blake2-rfc", "byteorder", "dyn-clonable", "ed25519-dalek", - "futures 0.3.16", + "futures 0.3.21", "hash-db", "hash256-std-hasher", "hex", "impl-serde", "lazy_static", - "libsecp256k1 0.6.0", + "libsecp256k1 0.7.0", "log", "merlin 2.0.1", "num-traits", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "parity-util-mem", - "parking_lot 0.11.1", + "parking_lot 0.12.0", "primitive-types", "rand 0.7.3", "regex", + "scale-info", "schnorrkel 0.9.1", + "secp256k1", "secrecy", "serde", - "sha2 0.9.5", + "sp-core-hashing", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", "sp-std", "sp-storage", + "ss58-registry", "substrate-bip39", "thiserror", "tiny-bip39", - "tiny-keccak", - "twox-hash", "wasmi", "zeroize", ] [[package]] -name = "sp-database" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sp-core-hashing" +version = "4.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "kvdb", - "parking_lot 0.11.1", + "blake2", + "byteorder", + "digest 0.10.3", + "sha2 0.10.2", + "sha3 0.10.1", + "sp-std", + "twox-hash", ] [[package]] -name = "sp-debug-derive" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "proc-macro2", "quote", + "sp-core-hashing", "syn", ] [[package]] -name = "sp-externalities" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sp-database" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "environmental", - "parity-scale-codec 2.2.0", - "sp-std", - "sp-storage", + "kvdb", + "parking_lot 0.12.0", ] [[package]] -name = "sp-finality-grandpa" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ +name = "sp-debug-derive" +version = "4.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.12.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "environmental", + "parity-scale-codec 3.1.2", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-finality-grandpa" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ "finality-grandpa", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-api", "sp-application-crypto", @@ -8890,27 +9572,30 @@ dependencies = [ [[package]] name = "sp-inherents" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec 3.1.2", "sp-core", + "sp-runtime", "sp-std", "thiserror", ] [[package]] name = "sp-io" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "hash-db", - "libsecp256k1 0.6.0", + "libsecp256k1 0.7.0", "log", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", + "secp256k1", "sp-core", "sp-externalities", "sp-keystore", @@ -8926,8 +9611,8 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "lazy_static", "sp-core", @@ -8937,49 +9622,48 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.12.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "async-trait", - "derive_more", - "futures 0.3.16", + "futures 0.3.21", "merlin 2.0.1", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "schnorrkel 0.9.1", "serde", "sp-core", "sp-externalities", + "thiserror", +] + +[[package]] +name = "sp-maybe-compressed-blob" +version = "4.1.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "thiserror", + "zstd", ] [[package]] name = "sp-npos-elections" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "serde", "sp-arithmetic", "sp-core", - "sp-npos-elections-compact", + "sp-runtime", "sp-std", ] -[[package]] -name = "sp-npos-elections-compact" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sp-offchain" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "sp-api", "sp-core", @@ -8988,34 +9672,38 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "backtrace", + "lazy_static", + "regex", ] [[package]] name = "sp-rpc" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "rustc-hash", "serde", "sp-core", ] [[package]] name = "sp-runtime" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "parity-util-mem", "paste", "rand 0.7.3", + "scale-info", "serde", "sp-application-crypto", "sp-arithmetic", @@ -9026,11 +9714,11 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", @@ -9043,20 +9731,34 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "5.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "Inflector", - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", "proc-macro2", "quote", "syn", ] +[[package]] +name = "sp-sandbox" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "log", + "parity-scale-codec 3.1.2", + "sp-core", + "sp-io", + "sp-std", + "sp-wasm-interface", + "wasmi", +] + [[package]] name = "sp-serializer" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "serde", "serde_json", @@ -9064,10 +9766,11 @@ dependencies = [ [[package]] name = "sp-session" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "sp-api", "sp-core", "sp-runtime", @@ -9077,48 +9780,49 @@ dependencies = [ [[package]] name = "sp-staking" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "scale-info", "sp-runtime", "sp-std", ] [[package]] name = "sp-state-machine" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.12.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "hash-db", "log", "num-traits", - "parity-scale-codec 2.2.0", - "parking_lot 0.11.1", + "parity-scale-codec 3.1.2", + "parking_lot 0.12.0", "rand 0.7.3", - "smallvec 1.6.1", + "smallvec", "sp-core", "sp-externalities", "sp-panic-handler", "sp-std", "sp-trie", "thiserror", - "trie-db", - "trie-root", + "tracing", + "trie-root 0.17.0", ] [[package]] name = "sp-std" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" [[package]] name = "sp-storage" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "impl-serde", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "ref-cast", "serde", "sp-debug-derive", @@ -9127,8 +9831,8 @@ dependencies = [ [[package]] name = "sp-tasks" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "log", "sp-core", @@ -9140,25 +9844,26 @@ dependencies = [ [[package]] name = "sp-timestamp" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "async-trait", + "futures-timer", + "log", + "parity-scale-codec 3.1.2", "sp-api", "sp-inherents", "sp-runtime", "sp-std", - "wasm-timer", + "thiserror", ] [[package]] name = "sp-tracing" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "5.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sp-std", "tracing", "tracing-core", @@ -9167,67 +9872,84 @@ dependencies = [ [[package]] name = "sp-transaction-pool" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "derive_more", - "futures 0.3.16", - "log", - "parity-scale-codec 2.2.0", - "serde", "sp-api", - "sp-blockchain", "sp-runtime", - "thiserror", ] [[package]] -name = "sp-trie" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sp-transaction-storage-proof" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "hash-db", - "memory-db", - "parity-scale-codec 2.2.0", + "async-trait", + "log", + "parity-scale-codec 3.1.2", + "scale-info", "sp-core", + "sp-inherents", + "sp-runtime", "sp-std", - "trie-db", - "trie-root", + "sp-trie", ] [[package]] -name = "sp-utils" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +name = "sp-trie" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "futures-core", - "futures-timer 3.0.2", - "lazy_static", - "prometheus", + "hash-db", + "memory-db", + "parity-scale-codec 3.1.2", + "scale-info", + "sp-core", + "sp-std", + "thiserror", + "trie-db", + "trie-root 0.17.0", ] [[package]] name = "sp-version" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "5.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "impl-serde", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", + "parity-wasm 0.42.2", + "scale-info", "serde", + "sp-core-hashing-proc-macro", "sp-runtime", "sp-std", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" +dependencies = [ + "parity-scale-codec 3.1.2", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "sp-wasm-interface" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "6.0.0" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "impl-trait-for-tuples", - "parity-scale-codec 2.2.0", + "log", + "parity-scale-codec 3.1.2", "sp-std", "wasmi", + "wasmtime", ] [[package]] @@ -9236,6 +9958,21 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "ss58-registry" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceb8b72a924ccfe7882d0e26144c114503760a4d1248bb5cd06c8ab2d55404cc" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -9258,169 +9995,125 @@ dependencies = [ "lazy_static", "nalgebra", "num-traits", - "rand 0.8.4", -] - -[[package]] -name = "stream-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e15f898d8d8f25db24c253ea615cc14acf418ff307822995814e7d42cfa89" -dependencies = [ - "block-cipher", - "generic-array 0.14.4", -] - -[[package]] -name = "string" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" -dependencies = [ - "bytes 0.4.12", + "rand 0.8.5", ] [[package]] name = "string_cache" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" dependencies = [ - "lazy_static", "new_debug_unreachable", - "phf_shared", + "once_cell", + "parking_lot 0.12.0", + "phf_shared 0.10.0", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.10.0", + "phf_shared 0.10.0", "proc-macro2", "quote", ] [[package]] name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.15" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.20.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" +checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.20.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2", "quote", + "rustversion", "syn", ] [[package]] name = "substrate-bip39" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" dependencies = [ - "hmac 0.7.1", - "pbkdf2 0.3.0", + "hmac 0.11.0", + "pbkdf2 0.8.0", "schnorrkel 0.9.1", - "sha2 0.8.2", + "sha2 0.9.9", "zeroize", ] [[package]] name = "substrate-frame-rpc-system" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ "frame-system-rpc-runtime-api", - "futures 0.3.16", + "futures 0.3.21", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "log", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sc-client-api", "sc-rpc-api", - "serde", + "sc-transaction-pool-api", "sp-api", "sp-block-builder", "sp-blockchain", "sp-core", "sp-runtime", - "sp-transaction-pool", ] [[package]] name = "substrate-prometheus-endpoint" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "async-std", - "derive_more", "futures-util", - "hyper 0.13.10", + "hyper", "log", "prometheus", - "tokio 0.2.25", + "thiserror", + "tokio", ] [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.1.31", - "futures 0.3.16", - "hash-db", + "async-trait", + "futures 0.3.21", "hex", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "sc-client-api", "sc-client-db", "sc-consensus", "sc-executor", - "sc-light", + "sc-offchain", "sc-service", "serde", "serde_json", @@ -9436,10 +10129,10 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ + "beefy-primitives", "cfg-if 1.0.0", - "frame-executive", "frame-support", "frame-system", "frame-system-rpc-runtime-api", @@ -9447,9 +10140,10 @@ dependencies = [ "memory-db", "pallet-babe", "pallet-timestamp", - "parity-scale-codec 2.2.0", + "parity-scale-codec 3.1.2", "parity-util-mem", "sc-service", + "scale-info", "serde", "sp-api", "sp-application-crypto", @@ -9471,22 +10165,20 @@ dependencies = [ "sp-transaction-pool", "sp-trie", "sp-version", - "substrate-wasm-builder 4.0.0", + "substrate-wasm-builder", "trie-db", ] [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", - "parity-scale-codec 2.2.0", + "futures 0.3.21", + "parity-scale-codec 3.1.2", "sc-block-builder", "sc-client-api", "sc-consensus", - "sc-light", - "sc-service", "sp-api", "sp-blockchain", "sp-consensus", @@ -9498,61 +10190,41 @@ dependencies = [ [[package]] name = "substrate-test-utils" -version = "3.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "4.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "substrate-test-utils-derive", - "tokio 0.2.25", + "tokio", ] [[package]] name = "substrate-test-utils-derive" -version = "0.9.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.1.3", + "proc-macro2", "quote", "syn", ] [[package]] name = "substrate-wasm-builder" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79091baab813855ddf65b191de9fe53e656b6b67c1e9bd23fdcbff8788164684" +version = "5.0.0-dev" +source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-monthly-2022-05#b945faee0e9d86916cc5799b3c377905e17379ab" dependencies = [ - "ansi_term 0.12.1", - "atty", - "build-helper", - "cargo_metadata", - "tempfile", - "toml", - "walkdir", - "wasm-gc-api", -] - -[[package]] -name = "substrate-wasm-builder" -version = "4.0.0" -source = "git+https://github.com/PolymathNetwork/substrate?branch=polymesh-4.1.2#95c0f84dd51936189eb2a30832e261307d9a06c2" -dependencies = [ - "ansi_term 0.12.1", - "atty", + "ansi_term", "build-helper", "cargo_metadata", + "sp-maybe-compressed-blob", + "strum", "tempfile", "toml", "walkdir", "wasm-gc-api", ] -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - [[package]] name = "subtle" version = "2.4.1" @@ -9561,9 +10233,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.75" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" +checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" dependencies = [ "proc-macro2", "quote", @@ -9572,9 +10244,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -9583,10 +10255,25 @@ dependencies = [ ] [[package]] -name = "take_mut" -version = "0.2.2" +name = "system-configuration" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "tap" @@ -9596,40 +10283,51 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" +checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1" [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand 0.8.4", - "redox_syscall 0.2.10", + "redox_syscall 0.2.13", "remove_dir_all", "winapi 0.3.9", ] [[package]] name = "tendril" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" dependencies = [ "futf", "mac", "utf-8", ] +[[package]] +name = "term" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" +dependencies = [ + "byteorder", + "dirs", + "winapi 0.3.9", +] + [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -9643,6 +10341,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + [[package]] name = "thin-slice" version = "0.1.1" @@ -9651,29 +10355,35 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.26" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.26" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + [[package]] name = "thread_local" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" dependencies = [ "once_cell", ] @@ -9687,6 +10397,17 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "tikv-jemalloc-sys" +version = "0.4.3+5.2.1-patched.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + [[package]] name = "time" version = "0.1.44" @@ -9700,9 +10421,9 @@ dependencies = [ [[package]] name = "tiny-bip39" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9e44c4759bae7f1032e286a7ef990bd9ed23fe831b7eeba0beb97484c2e59b8" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" dependencies = [ "anyhow", "hmac 0.8.1", @@ -9710,9 +10431,10 @@ dependencies = [ "pbkdf2 0.4.0", "rand 0.7.3", "rustc-hash", - "sha2 0.9.5", + "sha2 0.9.9", "thiserror", "unicode-normalization", + "wasm-bindgen", "zeroize", ] @@ -9737,9 +10459,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.3.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -9752,284 +10474,90 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "mio", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "tokio-udp", - "tokio-uds", -] - -[[package]] -name = "tokio" -version = "0.2.25" +version = "1.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", + "bytes 1.1.0", "libc", "memchr", - "mio", - "mio-uds", + "mio 0.8.3", "num_cpus", - "pin-project-lite 0.1.12", + "once_cell", + "parking_lot 0.12.0", + "pin-project-lite 0.2.9", "signal-hook-registry", - "slab", + "socket2", "tokio-macros", "winapi 0.3.9", ] -[[package]] -name = "tokio-buf" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" -dependencies = [ - "bytes 0.4.12", - "either", - "futures 0.1.31", -] - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "tokio-io", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures 0.1.31", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", -] - -[[package]] -name = "tokio-fs" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" -dependencies = [ - "futures 0.1.31", - "tokio-io", - "tokio-threadpool", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", -] - [[package]] name = "tokio-macros" -version = "0.2.6" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "tokio-named-pipes" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d282d483052288b2308ba5ee795f5673b159c9bdf63c385a05609da782a5eae" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "mio", - "mio-named-pipes", - "tokio 0.1.22", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "mio", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - [[package]] name = "tokio-rustls" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" -dependencies = [ - "futures-core", - "rustls 0.18.1", - "tokio 0.2.25", - "webpki", -] - -[[package]] -name = "tokio-service" -version = "0.1.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "futures 0.1.31", + "rustls 0.19.1", + "tokio", + "webpki 0.21.4", ] [[package]] -name = "tokio-sync" +name = "tokio-stream" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ - "fnv", - "futures 0.1.31", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque 0.7.4", - "crossbeam-queue", - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-udp" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", - "mio", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "futures-core", + "pin-project-lite 0.2.9", + "tokio", ] [[package]] -name = "tokio-uds" -version = "0.2.7" +name = "tokio-util" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "iovec", - "libc", + "bytes 1.1.0", + "futures-core", + "futures-sink", "log", - "mio", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "pin-project-lite 0.2.9", + "tokio", ] [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" dependencies = [ - "bytes 0.5.6", + "bytes 1.1.0", "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", + "futures-sink", + "pin-project-lite 0.2.9", + "tokio", + "tracing", ] [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] @@ -10042,22 +10570,21 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.26" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if 1.0.0", - "log", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.15" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ "proc-macro2", "quote", @@ -10066,11 +10593,12 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.19" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ "lazy_static", + "valuable", ] [[package]] @@ -10079,26 +10607,28 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.8", + "pin-project 1.0.10", "tracing", ] [[package]] name = "tracing-log" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" dependencies = [ + "ahash", "lazy_static", "log", + "lru", "tracing-core", ] [[package]] name = "tracing-serde" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" dependencies = [ "serde", "tracing-core", @@ -10106,19 +10636,20 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.20" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cbe87a2fa7e35900ce5de20220a582a9483a7063811defce79d7cbd59d4cfe" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" dependencies = [ - "ansi_term 0.12.1", + "ansi_term", "chrono", "lazy_static", "matchers", + "parking_lot 0.11.2", "regex", "serde", "serde_json", "sharded-slab", - "smallvec 1.6.1", + "smallvec", "thread_local", "tracing", "tracing-core", @@ -10128,15 +10659,15 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac131e334e81b6b3be07399482042838adcd7957aa0010231d0813e39e02fa" +checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" dependencies = [ "hash-db", - "hashbrown 0.11.2", + "hashbrown 0.12.1", "log", "rustc-hex", - "smallvec 1.6.1", + "smallvec", ] [[package]] @@ -10148,20 +10679,79 @@ dependencies = [ "hash-db", ] +[[package]] +name = "trie-root" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +dependencies = [ + "hash-db", +] + +[[package]] +name = "trust-dns-proto" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.2.3", + "ipnet", + "lazy_static", + "log", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "url 2.2.2", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +dependencies = [ + "cfg-if 1.0.0", + "futures-util", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "parking_lot 0.12.0", + "resolv-conf", + "smallvec", + "thiserror", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "tt-call" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" + [[package]] name = "twox-hash" -version = "1.6.1" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 1.0.0", - "rand 0.8.4", + "digest 0.10.3", + "rand 0.8.5", "static_assertions", ] @@ -10187,9 +10777,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" @@ -10199,9 +10789,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "uint" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" +checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" dependencies = [ "byteorder", "crunchy", @@ -10220,9 +10810,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-normalization" @@ -10235,21 +10825,21 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "universal-hash" @@ -10257,8 +10847,8 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" dependencies = [ - "generic-array 0.14.4", - "subtle 2.4.1", + "generic-array 0.14.5", + "subtle", ] [[package]] @@ -10274,19 +10864,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35581ff83d4101e58b582e607120c7f5ffb17e632a980b1f38334d76b36908b2" dependencies = [ "asynchronous-codec 0.5.0", - "bytes 1.0.1", + "bytes 1.1.0", "futures-io", "futures-util", ] [[package]] name = "unsigned-varint" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f" +checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ "asynchronous-codec 0.6.0", - "bytes 1.0.1", + "bytes 1.1.0", "futures-io", "futures-util", ] @@ -10326,11 +10916,17 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "value-bag" -version = "1.0.0-alpha.7" +version = "1.0.0-alpha.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd320e1520f94261153e96f7534476ad869c14022aee1e59af7c778075d840ae" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" dependencies = [ "ctor", "version_check", @@ -10342,12 +10938,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "vergen" version = "3.2.0" @@ -10361,9 +10951,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -10411,17 +11001,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "want" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" -dependencies = [ - "futures 0.1.31", - "log", - "try-lock", -] - [[package]] name = "want" version = "0.3.0" @@ -10444,11 +11023,17 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -10456,9 +11041,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -10471,9 +11056,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.26" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972" +checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -10483,9 +11068,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -10493,9 +11078,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -10506,9 +11091,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wasm-gc-api" @@ -10521,15 +11106,24 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "wasm-instrument" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962e5b0401bbb6c887f54e69b8c496ea36f704df65db73e81fd5ff8dc3e63a9f" +dependencies = [ + "parity-wasm 0.42.2", +] + [[package]] name = "wasm-timer" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "js-sys", - "parking_lot 0.11.1", + "parking_lot 0.11.2", "pin-utils", "wasm-bindgen", "wasm-bindgen-futures", @@ -10538,79 +11132,82 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.6.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" +checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" dependencies = [ + "downcast-rs", "errno", "libc", + "libm 0.2.2", "memory_units", "num-rational 0.2.4", "num-traits", - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", "wasmi-validation", ] [[package]] name = "wasmi-validation" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" +checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" dependencies = [ - "parity-wasm 0.41.0", + "parity-wasm 0.42.2", ] [[package]] name = "wasmparser" -version = "0.71.0" +version = "0.83.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89a30c99437829ede826802bfcf28500cf58df00e66cb9114df98813bc145ff1" +checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmtime" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7426055cb92bd9a1e9469b48154d8d6119cd8c498c8b70284e420342c05dc45d" +checksum = "21ffb4705016d5ca91e18a72ed6822dab50e6d5ddd7045461b17ef19071cdef1" dependencies = [ "anyhow", "backtrace", "bincode", "cfg-if 1.0.0", - "cpp_demangle", "indexmap", + "lazy_static", "libc", "log", + "object 0.27.1", + "once_cell", + "paste", + "psm", + "rayon", "region", - "rustc-demangle", "serde", - "smallvec 1.6.1", "target-lexicon", "wasmparser", "wasmtime-cache", + "wasmtime-cranelift", "wasmtime-environ", "wasmtime-jit", - "wasmtime-profiling", "wasmtime-runtime", - "wat", "winapi 0.3.9", ] [[package]] name = "wasmtime-cache" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01d9287e36921e46f5887a47007824ae5dbb9b7517a2d565660ab4471478709" +checksum = "85c6ab24291fa7cb3a181f5669f6c72599b7ef781669759b45c7828c5999d0c0" dependencies = [ "anyhow", "base64 0.13.0", "bincode", "directories-next", - "errno", "file-per-thread-logger", - "libc", "log", + "rustix", "serde", - "sha2 0.9.5", + "sha2 0.9.9", "toml", "winapi 0.3.9", "zstd", @@ -10618,27 +11215,20 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4134ed3a4316cd0de0e546c6004850afe472b0fa3fcdc2f2c15f8d449562d962" +checksum = "f04c810078a491b7bc4866ebe045f714d2b95e6b539e1f64009a4a7606be11de" dependencies = [ + "anyhow", "cranelift-codegen", "cranelift-entity", "cranelift-frontend", + "cranelift-native", "cranelift-wasm", - "wasmtime-environ", -] - -[[package]] -name = "wasmtime-debug" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91fa931df6dd8af2b02606307674d3bad23f55473d5f4c809dddf7e4c4dc411" -dependencies = [ - "anyhow", - "gimli 0.23.0", + "gimli", + "log", "more-asserts", - "object 0.22.0", + "object 0.27.1", "target-lexicon", "thiserror", "wasmparser", @@ -10647,135 +11237,123 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1098871dc3120aaf8190d79153e470658bb79f63ee9ca31716711e123c28220" +checksum = "61448266ea164b1ac406363cdcfac81c7c44db4d94c7a81c8620ac6c5c6cdf59" dependencies = [ "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen", "cranelift-entity", - "cranelift-wasm", - "gimli 0.23.0", + "gimli", "indexmap", "log", "more-asserts", + "object 0.27.1", "serde", + "target-lexicon", "thiserror", "wasmparser", + "wasmtime-types", ] [[package]] name = "wasmtime-jit" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738bfcd1561ede8bb174215776fd7d9a95d5f0a47ca3deabe0282c55f9a89f68" +checksum = "156b4623c6b0d4b8c24afb846c20525922f538ef464cc024abab7ea8de2109a2" dependencies = [ - "addr2line 0.14.1", + "addr2line", "anyhow", + "bincode", "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli 0.23.0", + "cpp_demangle", + "gimli", "log", - "more-asserts", - "object 0.22.0", - "rayon", + "object 0.27.1", "region", + "rustc-demangle", + "rustix", "serde", "target-lexicon", "thiserror", - "wasmparser", - "wasmtime-cranelift", - "wasmtime-debug", "wasmtime-environ", - "wasmtime-obj", - "wasmtime-profiling", + "wasmtime-jit-debug", "wasmtime-runtime", "winapi 0.3.9", ] [[package]] -name = "wasmtime-obj" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e96d77f1801131c5e86d93e42a3cf8a35402107332c202c245c83f34888a906" -dependencies = [ - "anyhow", - "more-asserts", - "object 0.22.0", - "target-lexicon", - "wasmtime-debug", - "wasmtime-environ", -] - -[[package]] -name = "wasmtime-profiling" -version = "0.22.0" +name = "wasmtime-jit-debug" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60bb672c9d894776d7b9250dd9b4fe890f8760201ee4f53e5f2da772b6c4debb" +checksum = "d5dc31f811760a6c76b2672c404866fd19b75e5fb3b0075a3e377a6846490654" dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "gimli 0.23.0", "lazy_static", - "libc", - "object 0.22.0", - "scroll", - "serde", - "target-lexicon", - "wasmtime-environ", - "wasmtime-runtime", + "object 0.27.1", + "rustix", ] [[package]] name = "wasmtime-runtime" -version = "0.22.0" +version = "0.35.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978086740949eeedfefcee667b57a9e98d9a7fc0de382fcfa0da30369e3530d" +checksum = "f907beaff69d4d920fa4688411ee4cc75c0f01859e424677f9e426e2ef749864" dependencies = [ + "anyhow", "backtrace", "cc", "cfg-if 1.0.0", "indexmap", - "lazy_static", "libc", "log", - "memoffset 0.6.4", + "mach", + "memoffset", "more-asserts", - "psm", + "rand 0.8.5", "region", + "rustix", "thiserror", "wasmtime-environ", + "wasmtime-jit-debug", "winapi 0.3.9", ] +[[package]] +name = "wasmtime-types" +version = "0.35.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514ef0e5fd197b9609dc9eb74beba0c84d5a12b2417cbae55534633329ba4852" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + [[package]] name = "wast" -version = "38.0.0" +version = "40.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ebc29df4629f497e0893aacd40f13a4a56b85ef6eb4ab6d603f07244f1a7bf2" +checksum = "9bb4f48a8b083dbc50e291e430afb8f524092bb00428957bcc63f49f856c64ac" dependencies = [ "leb128", + "memchr", + "unicode-width", ] [[package]] name = "wat" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcfaeb27e2578d2c6271a45609f4a055e6d7ba3a12eff35b1fd5ba147bdf046" +checksum = "0401b6395ce0db91629a75b29597ccb66ea29950af9fc859f1bb3a736609c76e" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.53" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -10791,13 +11369,23 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki-roots" -version = "0.21.1" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" dependencies = [ - "webpki", + "webpki 0.22.0", ] [[package]] @@ -10811,15 +11399,21 @@ dependencies = [ [[package]] name = "which" -version = "4.2.2" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" dependencies = [ "either", "lazy_static", "libc", ] +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.2.8" @@ -10863,6 +11457,101 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3" +dependencies = [ + "windows_aarch64_msvc 0.29.0", + "windows_i686_gnu 0.29.0", + "windows_i686_msvc 0.29.0", + "windows_x86_64_gnu 0.29.0", + "windows_x86_64_msvc 0.29.0", +] + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -10875,9 +11564,12 @@ dependencies = [ [[package]] name = "wyz" -version = "0.2.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" +checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +dependencies = [ + "tap", +] [[package]] name = "x25519-dalek" @@ -10892,32 +11584,32 @@ dependencies = [ [[package]] name = "yamux" -version = "0.8.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc7bd8c983209ed5d527f44b01c41b7dc146fd960c61cf9e1d25399841dc271" +checksum = "0c0608f53c1dc0bad505d03a34bbd49fbf2ad7b51eb036123e896365532745a1" dependencies = [ - "futures 0.3.16", + "futures 0.3.21", "log", "nohash-hasher", - "parking_lot 0.11.1", - "rand 0.7.3", + "parking_lot 0.12.0", + "rand 0.8.5", "static_assertions", ] [[package]] name = "zeroize" -version = "1.4.1" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377db0846015f7ae377174787dd452e1c5f5a9050bc6f954911d01f116daa0cd" +checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.1.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c1e130bebaeab2f23886bf9acbaca14b092408c452543c857f66399cd6dab1" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ "proc-macro2", "quote", @@ -10927,18 +11619,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.5.4+zstd.1.4.7" +version = "0.10.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" +checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "2.0.6+zstd.1.4.7" +version = "4.1.6+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" +checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb" dependencies = [ "libc", "zstd-sys", @@ -10946,12 +11638,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.4.18+zstd.1.4.7" +version = "1.6.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" +checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" dependencies = [ "cc", - "glob 0.3.0", - "itertools 0.9.0", "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 4c95f01a95..15a533b46e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,106 +1,111 @@ [package] name = "polymesh" -version = "4.1.2" +version = "5.0.0" authors = ["Polymath"] build = "build.rs" -edition = "2018" +edition = "2021" [[bin]] name = "polymesh" path = "src/main.rs" -# Path build to use our Substrate version from github, tag `v2.0.1-2`. +# Path build to use our Substrate version from github, `branch = "develop"`. [patch.crates-io] -frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-benchmarking-cli = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-executive = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-support = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-system = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-system-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -frame-system-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-balances = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -#pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -#pallet-contracts-primitives = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -#pallet-contracts-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -#pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-im-online = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-offences = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-randomness-collective-flip = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-session = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-treasury = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-basic-authorship = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-block-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-chain-spec = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-cli = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-client-db = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-consensus = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-consensus-babe-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-consensus-epochs = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-consensus-slots = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-executor = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-finality-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-finality-grandpa-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-keystore = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-light = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-network = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-rpc-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-service = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-telemetry = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sc-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-application-crypto = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-blockchain = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-consensus-slots = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-core = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-externalities = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-finality-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-io = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-keystore = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-keyring = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-npos-elections = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-npos-elections-compact = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-offchain = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-runtime-interface = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-serializer = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-session = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-staking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-state-machine = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-std = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-storage = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-timestamp = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-tracing = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-trie = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -sp-version = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-frame-rpc-system = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-prometheus-endpoint = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-test-utils = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-test-utils-derive = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -substrate-wasm-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } +frame-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-benchmarking-cli = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-executive = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-election-provider-support = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-system-benchmarking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-authorship = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-balances = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-contracts = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-contracts-primitives = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-contracts-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-im-online = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-indices = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-offences = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-preimage = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-randomness-collective-flip = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-scheduler = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-session = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-staking-reward-curve = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-timestamp = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-treasury = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-basic-authorship = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-block-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-chain-spec = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-cli = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-client-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-client-db = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus-babe-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus-epochs = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus-slots = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-consensus-uncles = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-executor = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-finality-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-finality-grandpa-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-keystore = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-network = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-rpc-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-service = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-telemetry = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-transaction-pool-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sc-sync-state-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-application-crypto = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-arithmetic = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-authority-discovery = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-authorship = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-block-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-blockchain = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-consensus = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-consensus-babe = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-consensus-slots = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-externalities = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-finality-grandpa = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-inherents = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-keystore = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-keyring = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-npos-elections = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-offchain = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-rpc = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-runtime-interface = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-serializer = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-session = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-staking = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-state-machine = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-storage = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-timestamp = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-tracing = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-transaction-pool = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-transaction-storage-proof = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-trie = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-frame-rpc-system = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-prometheus-endpoint = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-test-utils = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-test-utils-derive = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +substrate-wasm-builder = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } -blake2 = { git = "https://github.com/PolymathNetwork/hashes", branch = "master" } schnorrkel = { git = "https://github.com/PolymathNetwork/schnorrkel", branch = "rebase-head" } +curve25519-dalek = { git = "https://github.com/PolymathNetwork/curve25519-dalek", branch = "master" } [workspace] members = [ @@ -117,7 +122,7 @@ members = [ "pallets/committee", "pallets/common", "pallets/compliance-manager", - #"pallets/contracts", + "pallets/contracts", "pallets/corporate-actions", "pallets/external-agents", "pallets/group", @@ -136,6 +141,7 @@ members = [ "pallets/runtime/mainnet", "pallets/runtime/testnet", "pallets/runtime/tests", + "pallets/runtime/tests/exec_macro", "pallets/settlement", "pallets/staking", "pallets/staking/rpc", @@ -148,6 +154,7 @@ members = [ "pallets/test-utils", "pallets/weights", "primitives", + "primitives/asset-metadata", "rpc", "rpc/runtime-api", "utils/permissions", @@ -192,58 +199,63 @@ polymesh-runtime-ci = { path = "pallets/runtime/ci" } chrono = "0.4.11" ed25519-dalek = "1.0.0" futures = "0.3.4" -jsonrpc-core = { version = "15.0", features = ["arbitrary_precision"] } +jsonrpc-core = { version = "18.0", features = ["arbitrary_precision"] } log = "0.4.8" serde = { version = "1.0.104", default-features = false } serde_json = { version = "1.0", features = ["arbitrary_precision"] } -structopt = "0.3.15" +clap = { version = "3.1.6", features = ["derive"] } rustc-hex = "2.1.0" # Substrate -codec = { version = "2.0.0", package = "parity-scale-codec" } -frame-support = "3.0.0" -frame-system = "3.0.0" -frame-system-rpc-runtime-api = "3.0.0" -grandpa = { package = "sc-finality-grandpa", version = "0.9.0" } -#pallet-contracts = "3.0.0" -#pallet-contracts-rpc-runtime-api = "3.0.0" -pallet-im-online = "3.0.0" -pallet-indices = "3.0.0" -pallet-session = "3.0.0" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.9.0" } -sc-authority-discovery = "0.9.0" -sc-basic-authorship = "0.9.0" -sc-chain-spec = "3.0.0" -sc-cli = { version = "0.9.0", features = ["wasmtime"] } -sc-client-api = "3.0.0" -sc-client-db = "0.9.0" -sc-consensus = "0.9.0" -sc-consensus-babe = "0.9.0" -sc-consensus-slots = "0.9.0" -sc-executor = { version = "0.9.0", features = ["wasmtime"] } -sc-light = "3.0.0" -sc-network = "0.9.0" -sc-rpc = "3.0.0" -sc-service = { version = "0.9.0", features = ["wasmtime"] } -sc-telemetry = "3.0.0" -sc-transaction-pool = "3.0.0" -sp-api = "3.0.0" -sp-authority-discovery = "3.0.0" -sp-block-builder = "3.0.0" -sp-blockchain = "3.0.0" -sp-consensus = "0.9.0" -sp-consensus-babe = "0.9.0" -sp-consensus-slots = "0.9.0" -sp-core = "3.0.0" -sp-inherents = "3.0.0" -sp-offchain = "3.0.0" -sp-runtime = "3.0.0" -sp-session = "3.0.0" -sp-transaction-pool = { version = "3.0.0" } +codec = { version = "3.0.0", package = "parity-scale-codec" } +frame-support = "4.0.0-dev" +frame-system = "4.0.0-dev" +frame-system-rpc-runtime-api = "4.0.0-dev" +grandpa = { package = "sc-finality-grandpa", version = "0.10.0-dev" } +pallet-contracts-rpc-runtime-api = "4.0.0-dev" +pallet-babe = "4.0.0-dev" +pallet-im-online = "4.0.0-dev" +pallet-indices = "4.0.0-dev" +pallet-session = "4.0.0-dev" +prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0.10.0-dev" } +sc-authority-discovery = "0.10.0-dev" +sc-basic-authorship = "0.10.0-dev" +sc-chain-spec = "4.0.0-dev" +sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-client-api = "4.0.0-dev" +sc-client-db = "0.10.0-dev" +sc-consensus = "0.10.0-dev" +sc-consensus-babe = "0.10.0-dev" +sc-consensus-slots = "0.10.0-dev" +sc-consensus-uncles = "0.10.0-dev" +sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-network = "0.10.0-dev" +sc-rpc = "4.0.0-dev" +sc-service = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-telemetry = "4.0.0-dev" +sc-transaction-pool = "4.0.0-dev" +sc-sync-state-rpc = { version = "0.10.0-dev" } +sp-api = "4.0.0-dev" +sp-authority-discovery = "4.0.0-dev" +sp-authorship = "4.0.0-dev" +sp-block-builder = "4.0.0-dev" +sp-blockchain = "4.0.0-dev" +sp-consensus = "0.10.0-dev" +sp-consensus-babe = "0.10.0-dev" +sp-consensus-slots = "0.10.0-dev" +sp-keyring = { version = "6.0.0" } +sp-core = "6.0.0" +sp-inherents = "4.0.0-dev" +sp-transaction-storage-proof = "4.0.0-dev" +sp-offchain = "4.0.0-dev" +sp-runtime = "6.0.0" +sp-timestamp = "4.0.0-dev" +sp-session = "4.0.0-dev" +sp-transaction-pool = { version = "4.0.0-dev" } # These dependencies are used for runtime benchmarking -frame-benchmarking = "3.0.0" -frame-benchmarking-cli = "3.0.0" +frame-benchmarking = "4.0.0-dev" +frame-benchmarking-cli = "4.0.0-dev" [build-dependencies] vergen = "3.1.0" diff --git a/README.md b/README.md index 0a1daf3fd4..d269dea731 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ extrinsic to be benchmarked, for example: ```bash cargo run --release --features runtime-benchmarks -- \ - benchmark -p="*" -e="*" + benchmark pallet -p="*" -e="*" ``` Note that the CLI binary should be built in release mode and that the feature flag diff --git a/bin/bench/Cargo.toml b/bin/bench/Cargo.toml index 5f2b729138..225d760e53 100644 --- a/bin/bench/Cargo.toml +++ b/bin/bench/Cargo.toml @@ -4,7 +4,7 @@ name = "node-bench" version = "0.9.0" authors = ["Parity Technologies "] description = "Substrate node integration benchmarks." -edition = "2018" +edition = "2021" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,32 +13,32 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } node-testing = { path = "../testing" } -sc-cli = { version = "0.9.0", features = ["wasmtime"] } -sc-client-api = { version = "3.0.0" } -sp-runtime = { version = "3.0.0" } -sp-state-machine = { version = "0.9.0" } +sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-client-api = { version = "4.0.0-dev" } +sp-runtime = { version = "6.0.0" } +sp-state-machine = { version = "0.12.0" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" -structopt = "0.3" +clap = { version = "3.1.6", features = ["derive"] } derive_more = "0.99.2" -kvdb = "0.9" -kvdb-rocksdb = "0.11.1" -sp-trie = { version = "3.0.0" } -sp-core = { version = "3.0.0" } -sp-consensus = { version = "0.9.0" } -sp-transaction-pool = { version = "3.0.0" } -sc-basic-authorship = { version = "0.9.0" } -sp-inherents = { version = "3.0.0" } -sp-timestamp = { version = "3.0.0" } -sp-tracing = { version = "3.0.0" } +kvdb = "0.11" +kvdb-rocksdb = "0.15.0" +sp-trie = { version = "6.0.0" } +sp-core = { version = "6.0.0" } +sp-consensus = { version = "0.10.0-dev" } +sp-transaction-pool = { version = "4.0.0-dev" } +sc-basic-authorship = { version = "0.10.0-dev" } +sp-inherents = { version = "4.0.0-dev" } +sp-timestamp = { version = "4.0.0-dev" } +sp-tracing = { version = "5.0.0" } hash-db = "0.15.2" tempfile = "3.1.0" fs_extra = "1" hex = "0.4.0" rand = { version = "0.7.2", features = ["small_rng"] } lazy_static = "1.4.0" -parity-util-mem = { version = "0.9.0", default-features = false, features = ["primitive-types"] } +parity-util-mem = { version = "0.11.0", default-features = false, features = ["primitive-types"] } parity-db = { version = "0.2.4" } -sc-transaction-pool = { version = "3.0.0" } +sc-transaction-pool = { version = "4.0.0-dev" } futures = { version = "0.3.4", features = ["thread-pool"] } diff --git a/bin/bench/src/main.rs b/bin/bench/src/main.rs index 0c97c46eac..f2cbabebbc 100644 --- a/bin/bench/src/main.rs +++ b/bin/bench/src/main.rs @@ -28,7 +28,7 @@ mod tempdb; mod trie; mod txpool; -use structopt::StructOpt; +use clap::Parser; use node_testing::bench::{BlockType, DatabaseType as BenchDataBaseType, KeyTypes, Profile}; @@ -42,19 +42,19 @@ use crate::{ txpool::PoolBenchmarkDescription, }; -#[derive(Debug, StructOpt)] -#[structopt(name = "node-bench", about = "Node integration benchmarks")] +#[derive(Debug, Parser)] +#[clap(name = "node-bench", about = "Node integration benchmarks")] struct Opt { /// Show list of all available benchmarks. /// /// Will output ("name", "path"). Benchmarks can then be filtered by path. - #[structopt(short, long)] + #[clap(short, long)] list: bool, /// Machine readable json output. /// /// This also suppresses all regular output (except to stderr) - #[structopt(short, long)] + #[clap(short, long)] json: bool, /// Filter benchmarks. @@ -63,7 +63,7 @@ struct Opt { filter: Option, /// Number of transactions for block import with `custom` size. - #[structopt(long)] + #[clap(long)] transactions: Option, /// Mode @@ -72,7 +72,7 @@ struct Opt { /// /// "profile" mode adds pauses between measurable runs, /// so that actual interval can be selected in the profiler of choice. - #[structopt(short, long, default_value = "regular")] + #[clap(short, long, default_value = "regular")] mode: BenchmarkMode, } diff --git a/bin/crypto-cli/Cargo.toml b/bin/crypto-cli/Cargo.toml index 00dc5ac63a..e45057d3be 100644 --- a/bin/crypto-cli/Cargo.toml +++ b/bin/crypto-cli/Cargo.toml @@ -3,10 +3,10 @@ name = "crypto-cli" version = "1.0.0" authors = ["Polymath"] description = "Test utilities for Substrate node." -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives" } -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", tag = "confidential-identity-v1.1.3" } -codec = { version = "2.0.0", package = "parity-scale-codec" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", branch = "confidential-identity-v1" } +codec = { version = "3.0.0", package = "parity-scale-codec" } hex = "0.4.0" diff --git a/bin/executor/Cargo.toml b/bin/executor/Cargo.toml index bf94c67451..3f1e968bc7 100644 --- a/bin/executor/Cargo.toml +++ b/bin/executor/Cargo.toml @@ -3,7 +3,7 @@ name = "node-executor" version = "2.0.0" authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." -edition = "2018" +edition = "2021" license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/PolymathNetwork/substrate/" @@ -12,16 +12,16 @@ repository = "https://github.com/PolymathNetwork/substrate/" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "2.0.0" } +codec = { package = "parity-scale-codec", version = "3.0.0" } node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } -sc-executor = { version = "0.9.0", features = ["wasmtime"] } -sp-core = { version = "3.0.0" } -sp-io = { version = "3.0.0" } -sp-state-machine = { version = "0.9.0" } -sp-trie = { version = "3.0.0" } +sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } +sp-core = { version = "6.0.0" } +sp-io = { version = "6.0.0" } +sp-state-machine = { version = "0.12.0" } +sp-trie = { version = "6.0.0" } trie-root = "0.16.0" -frame-benchmarking = { version = "3.0.0" } +frame-benchmarking = { version = "4.0.0-dev" } [dev-dependencies] node-testing = { path = "../testing" } @@ -29,19 +29,19 @@ pallet-transaction-payment = { path = "../../pallets/transaction-payment" } pallet-balances = { path = "../../pallets/balances" } criterion = "0.3.0" -frame-support = { version = "3.0.0" } -frame-system = { version = "3.0.0" } -#pallet-contracts = { version = "3.0.0" } -pallet-grandpa = { version = "3.0.0" } -pallet-im-online = { version = "3.0.0" } -pallet-indices = { version = "3.0.0" } -pallet-session = { version = "3.0.0" } -pallet-timestamp = { version = "3.0.0" } -pallet-treasury = { version = "3.0.0" } -sp-application-crypto = { version = "3.0.0" } -sp-runtime = { version = "3.0.0" } -sp-externalities = { version = "0.9.0" } -substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } +frame-support = { version = "4.0.0-dev" } +frame-system = { version = "4.0.0-dev" } +#pallet-contracts = { version = "4.0.0-dev" } +pallet-grandpa = { version = "4.0.0-dev" } +pallet-im-online = { version = "4.0.0-dev" } +pallet-indices = { version = "4.0.0-dev" } +pallet-session = { version = "4.0.0-dev" } +pallet-timestamp = { version = "4.0.0-dev" } +pallet-treasury = { version = "4.0.0-dev" } +sp-application-crypto = { version = "6.0.0" } +sp-runtime = { version = "6.0.0" } +sp-externalities = { version = "0.12.0" } +substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } wabt = "0.10.0" [features] diff --git a/bin/executor/tests/basic.rs b/bin/executor/tests/basic.rs index c37a278b20..216ebde619 100644 --- a/bin/executor/tests/basic.rs +++ b/bin/executor/tests/basic.rs @@ -22,7 +22,6 @@ use frame_support::{ StorageMap, StorageValue, }; use frame_system::{self, EventRecord, Phase}; -//use pallet_contracts::ContractAddressFor; use sp_core::{storage::well_known_keys, traits::Externalities, NeverNativeValue}; use sp_runtime::{ traits::Hash as HashT, transaction_validity::InvalidTransaction, ApplyExtrinsicResult, @@ -542,170 +541,6 @@ fn full_wasm_block_import_works() { }); } -const CODE_TRANSFER: &str = r#" -(module -;; seal_call( -;; callee_ptr: u32, -;; callee_len: u32, -;; gas: u64, -;; value_ptr: u32, -;; value_len: u32, -;; input_data_ptr: u32, -;; input_data_len: u32, -;; output_ptr: u32, -;; output_len_ptr: u32 -;; ) -> u32 -(import "seal0" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32))) -(import "seal0" "seal_input" (func $seal_input (param i32 i32))) -(import "env" "memory" (memory 1 1)) -(func (export "deploy") -) -(func (export "call") - (block $fail - ;; Load input data to contract memory - (call $seal_input - (i32.const 0) - (i32.const 52) - ) - - ;; fail if the input size is not != 4 - (br_if $fail - (i32.ne - (i32.const 4) - (i32.load (i32.const 52)) - ) - ) - - (br_if $fail - (i32.ne - (i32.load8_u (i32.const 0)) - (i32.const 0) - ) - ) - (br_if $fail - (i32.ne - (i32.load8_u (i32.const 1)) - (i32.const 1) - ) - ) - (br_if $fail - (i32.ne - (i32.load8_u (i32.const 2)) - (i32.const 2) - ) - ) - (br_if $fail - (i32.ne - (i32.load8_u (i32.const 3)) - (i32.const 3) - ) - ) - - (drop - (call $seal_call - (i32.const 4) ;; Pointer to "callee" address. - (i32.const 32) ;; Length of "callee" address. - (i64.const 0) ;; How much gas to devote for the execution. 0 = all. - (i32.const 36) ;; Pointer to the buffer with value to transfer - (i32.const 16) ;; Length of the buffer with value to transfer. - (i32.const 0) ;; Pointer to input data buffer address - (i32.const 0) ;; Length of input data buffer - (i32.const 4294967295) ;; u32 max value is the sentinel value: do not copy output - (i32.const 0) ;; Length is ignored in this case - ) - ) - - (return) - ) - unreachable -) -;; Destination AccountId to transfer the funds. -;; Represented by H256 (32 bytes long) in little endian. -(data (i32.const 4) - "\09\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - "\00\00\00\00" -) -;; Amount of value to transfer. -;; Represented by u128 (16 bytes long) in little endian. -(data (i32.const 36) - "\06\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" - "\00\00" -) -;; Length of the input buffer -(data (i32.const 52) "\04") -) -"#; - -/* -#[test] -fn deploying_wasm_contract_should_work() { - let transfer_code = wabt::wat2wasm(CODE_TRANSFER).unwrap(); - let transfer_ch = ::Hashing::hash(&transfer_code); - - let addr = ::DetermineContractAddress::contract_address_for( - &transfer_ch, - &[], - &charlie(), - ); - - let subsistence = pallet_contracts::Config::::subsistence_threshold_uncached(); - - let b = construct_block( - &mut new_test_ext(compact_code_unwrap(), false), - 1, - GENESIS_HASH.into(), - vec![ - CheckedExtrinsic { - signed: None, - function: Call::Timestamp(pallet_timestamp::Call::set(42 * 1000)), - }, - CheckedExtrinsic { - signed: Some((charlie(), signed_extra(0, 0))), - function: Call::Contracts(pallet_contracts::Call::put_code::( - transfer_code, - )), - }, - CheckedExtrinsic { - signed: Some((charlie(), signed_extra(1, 0))), - function: Call::Contracts(pallet_contracts::Call::instantiate::( - 1 * DOLLARS + subsistence, - 500_000_000, - transfer_ch, - Vec::new(), - )), - }, - CheckedExtrinsic { - signed: Some((charlie(), signed_extra(2, 0))), - function: Call::Contracts(pallet_contracts::Call::call::( - pallet_indices::address::Address::Id(addr.clone()), - 10, - 500_000_000, - vec![0x00, 0x01, 0x02, 0x03], - )), - }, - ], - ); - - let mut t = new_test_ext(compact_code_unwrap(), false); - - executor_call:: _>(&mut t, "Core_execute_block", &b.0, false, None) - .0 - .unwrap(); - - t.execute_with(|| { - // Verify that the contract constructor worked well and code of TRANSFER contract is actually deployed. - assert_eq!( - &pallet_contracts::ContractInfoOf::::get(addr) - .and_then(|c| c.get_alive()) - .unwrap() - .code_hash, - &transfer_ch - ); - }); -} -*/ - #[test] fn wasm_big_block_import_fails() { let mut t = new_test_ext(compact_code_unwrap(), false); diff --git a/bin/executor/tests/common.rs b/bin/executor/tests/common.rs index 22a59a85c2..7429920862 100644 --- a/bin/executor/tests/common.rs +++ b/bin/executor/tests/common.rs @@ -126,10 +126,10 @@ pub fn executor_call< executor().call::(&mut t, &runtime_code, method, data, use_native, native_call) } -pub fn new_test_ext(code: &[u8], support_changes_trie: bool) -> TestExternalities { +pub fn new_test_ext(code: &[u8]) -> TestExternalities { let mut ext = TestExternalities::new_with_code( code, - node_testing::genesis::config(support_changes_trie, Some(code)) + node_testing::genesis::config(Some(code)) .build_storage() .unwrap(), ); diff --git a/bin/testing/Cargo.toml b/bin/testing/Cargo.toml index 63dab6a618..393217a22f 100644 --- a/bin/testing/Cargo.toml +++ b/bin/testing/Cargo.toml @@ -4,7 +4,7 @@ name = "node-testing" version = "2.0.0" authors = ["Parity Technologies "] description = "Test utilities for Substrate node." -edition = "2018" +edition = "2021" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" homepage = "https://substrate.dev" repository = "https://github.com/PolymathNetwork/substrate/" @@ -23,32 +23,32 @@ pallet-staking = { path = "../../pallets/staking" } pallet-balances = { path = "../../pallets/balances" } node-executor = { path = "../executor", features = ["wasmtime"] } -sc-service = { version = "0.9.0", features = ["test-helpers", "db", "wasmtime"] } -sc-client-db = { version = "0.9.0", features = ["kvdb-rocksdb", "parity-db"] } -sc-client-api = { version = "3.0.0" } -codec = { package = "parity-scale-codec", version = "2.0.0" } -#pallet-contracts = { version = "3.0.0" } -pallet-grandpa = { version = "3.0.0" } -pallet-indices = { version = "3.0.0" } -sp-keyring = { version = "3.0.0" } -sp-core = { version = "3.0.0" } -sp-io = { version = "3.0.0" } -frame-support = { version = "3.0.0" } -pallet-session = { version = "3.0.0" } -sp-runtime = { version = "3.0.0" } -sc-executor = { version = "0.9.0", features = ["wasmtime"] } -sp-consensus = { version = "0.9.0" } -frame-system = { version = "3.0.0" } -substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } -pallet-timestamp = { version = "3.0.0" } -pallet-treasury = { version = "3.0.0" } +sc-service = { version = "0.10.0-dev", features = ["test-helpers", "db", "wasmtime"] } +sc-client-db = { version = "0.10.0-dev", features = ["kvdb-rocksdb", "parity-db"] } +sc-client-api = { version = "4.0.0-dev" } +codec = { package = "parity-scale-codec", version = "3.0.0" } +#pallet-contracts = { version = "4.0.0-dev" } +pallet-grandpa = { version = "4.0.0-dev" } +pallet-indices = { version = "4.0.0-dev" } +sp-keyring = { version = "6.0.0" } +sp-core = { version = "6.0.0" } +sp-io = { version = "6.0.0" } +frame-support = { version = "4.0.0-dev" } +pallet-session = { version = "4.0.0-dev" } +sp-runtime = { version = "6.0.0" } +sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } +sp-consensus = { version = "0.10.0-dev" } +frame-system = { version = "4.0.0-dev" } +substrate-test-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } +pallet-timestamp = { version = "4.0.0-dev" } +pallet-treasury = { version = "4.0.0-dev" } wabt = "0.10.0" -sp-api = { version = "3.0.0" } -sp-timestamp = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0" } -sc-block-builder = { version = "0.9.0" } -sp-inherents = { version = "3.0.0" } -sp-blockchain = { version = "3.0.0" } +sp-api = { version = "4.0.0-dev" } +sp-timestamp = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev" } +sc-block-builder = { version = "0.10.0-dev" } +sp-inherents = { version = "4.0.0-dev" } +sp-blockchain = { version = "4.0.0-dev" } log = "0.4.8" tempfile = "3.1.0" fs_extra = "1" @@ -56,4 +56,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.9.0", features = ["wasmtime"] } +sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } diff --git a/bin/testing/src/client.rs b/bin/testing/src/client.rs index 51766960f1..2717436a30 100644 --- a/bin/testing/src/client.rs +++ b/bin/testing/src/client.rs @@ -42,15 +42,11 @@ pub type Transaction = sc_client_api::backend::TransactionFor Storage { - crate::genesis::config(self.support_changes_trie) - .build_storage() - .unwrap() + crate::genesis::config().build_storage().unwrap() } } diff --git a/bin/testing/src/genesis.rs b/bin/testing/src/genesis.rs index a226cbb603..dc6685fe74 100644 --- a/bin/testing/src/genesis.rs +++ b/bin/testing/src/genesis.rs @@ -30,8 +30,8 @@ use sp_runtime::{ Perbill, }; /// Create genesis runtime configuration for tests. -pub fn config(support_changes_trie: bool) -> GenesisConfig { - config_endowed(support_changes_trie, Default::default()) +pub fn config() -> GenesisConfig { + config_endowed(Default::default()) } type AccountPublic = ::Signer; @@ -51,7 +51,7 @@ where /// Create genesis runtime configuration for tests with some extra /// endowed accounts. -pub fn config_endowed(support_changes_trie: bool, extra_endowed: Vec) -> GenesisConfig { +pub fn config_endowed(extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ (alice(), 111 * DOLLARS), (bob(), 100 * DOLLARS), @@ -69,14 +69,6 @@ pub fn config_endowed(support_changes_trie: bool, extra_endowed: Vec) GenesisConfig { frame_system: Some(SystemConfig { - changes_trie_config: if support_changes_trie { - Some(ChangesTrieConfiguration { - digest_interval: 2, - digest_levels: 2, - }) - } else { - None - }, code: node_runtime::WASM_BINARY.to_vec(), }), pallet_indices: Some(IndicesConfig { indices: vec![] }), diff --git a/contracts/CountTransferManager/.gitignore b/contracts/CountTransferManager/.gitignore deleted file mode 100755 index 8de8f877e4..0000000000 --- a/contracts/CountTransferManager/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Ignore build artifacts from the local tests sub-crate. -/target/ - -# Ignore backup files creates by cargo fmt. -**/*.rs.bk - -# Remove Cargo.lock when creating an executable, leave it for libraries -# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock diff --git a/contracts/CountTransferManager/Cargo.lock b/contracts/CountTransferManager/Cargo.lock deleted file mode 100644 index c06ef8b96c..0000000000 --- a/contracts/CountTransferManager/Cargo.lock +++ /dev/null @@ -1,1191 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "CountTransferManager" -version = "0.1.0" -dependencies = [ - "ink_env", - "ink_lang", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "array-init" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51c983d65b6691893a791e55aa8bda43bbd9b11f947e5a9581710362277cc95" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bitvec" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" -dependencies = [ - "either", - "radium", -] - -[[package]] -name = "blake2" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471" -dependencies = [ - "byte-tools", - "byteorder", - "crypto-mac", - "digest", - "opaque-debug 0.2.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "bstr" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "byte-slice-cast" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "cast" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -dependencies = [ - "rustc_version", -] - -[[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 = "clap" -version = "2.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -dependencies = [ - "bitflags", - "textwrap", - "unicode-width", -] - -[[package]] -name = "cpuid-bool" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" - -[[package]] -name = "criterion" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" -dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -dependencies = [ - "cast", - "itertools", -] - -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "csv" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" -dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr", -] - -[[package]] -name = "derive_more" -version = "0.99.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" - -[[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.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "wasi", -] - -[[package]] -name = "half" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" -dependencies = [ - "libc", -] - -[[package]] -name = "impl-serde" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" -dependencies = [ - "serde", -] - -[[package]] -name = "ink_allocator" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "wee_alloc", -] - -[[package]] -name = "ink_env" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "arrayref", - "blake2", - "cfg-if 1.0.0", - "derive_more", - "ink_allocator", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "num-traits", - "parity-scale-codec", - "paste", - "rand", - "scale-info", - "sha2", - "sha3", - "static_assertions", -] - -[[package]] -name = "ink_lang" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "derive_more", - "ink_env", - "ink_lang_macro", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage", - "parity-scale-codec", - "static_assertions", -] - -[[package]] -name = "ink_lang_codegen" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "blake2", - "derive_more", - "either", - "heck", - "ink_lang_ir", - "itertools", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "ink_lang_ir" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "blake2", - "either", - "itertools", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "ink_lang_macro" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "ink_lang_codegen", - "ink_lang_ir", - "ink_primitives", - "parity-scale-codec", - "proc-macro2", - "syn", -] - -[[package]] -name = "ink_metadata" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "derive_more", - "impl-serde", - "ink_prelude", - "ink_primitives", - "scale-info", - "serde", -] - -[[package]] -name = "ink_prelude" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "ink_primitives" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "ink_prelude", - "parity-scale-codec", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ink_storage" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "array-init", - "cfg-if 1.0.0", - "criterion", - "derive_more", - "generic-array", - "ink_env", - "ink_metadata", - "ink_prelude", - "ink_primitives", - "ink_storage_derive", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "ink_storage_derive" -version = "3.0.0-rc2" -source = "git+https://github.com/paritytech/ink?tag=v3.0.0-rc2#4f8f8f165232774d93d7a6a859fc129d782a020b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "itertools" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "js-sys" -version = "0.3.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" - -[[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 = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - -[[package]] -name = "num-traits" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" -dependencies = [ - "autocfg", -] - -[[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 = "oorandom" -version = "11.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-scale-codec" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "paste" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7ae1a2180ed02ddfdb5ab70c70d596a26dd642e097bb6fe78b1bde8588ed97" - -[[package]] -name = "plotters" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -dependencies = [ - "js-sys", - "num-traits", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[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 = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rayon" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd016f0c045ad38b5251be2c9c0ab806917f82da4d36b2a327e5166adad9270" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-automata" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -dependencies = [ - "byteorder", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scale-info" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09591597256643082c89e633dc300e4892627f7e1f69006400b463a7108a93e2" -dependencies = [ - "derive_more", - "parity-scale-codec", - "scale-info-derive", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e46e58629b3dbc3334c65adfe6b4a2fd63501cdeebe7079195848c5ab8bd2c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[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_cbor" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -dependencies = [ - "half", - "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_json" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" -dependencies = [ - "block-buffer", - "cfg-if 0.1.10", - "cpuid-bool", - "digest", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer", - "digest", - "keccak", - "opaque-debug 0.3.0", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "subtle" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" - -[[package]] -name = "syn" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "synstructure" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinytemplate" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "toml" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - -[[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 = "walkdir" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasm-bindgen" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -dependencies = [ - "cfg-if 0.1.10", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" - -[[package]] -name = "web-sys" -version = "0.3.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/CountTransferManager/Cargo.toml b/contracts/CountTransferManager/Cargo.toml deleted file mode 100755 index 0362f8b73b..0000000000 --- a/contracts/CountTransferManager/Cargo.toml +++ /dev/null @@ -1,45 +0,0 @@ -[package] -name = "CountTransferManager" -version = "0.1.0" -authors = ["Polymath Inc."] -edition = "2018" - -[dependencies] -ink_metadata = { git = "https://github.com/paritytech/ink", default-features = false, features = ["derive"], optional = true, tag = "v3.0.0-rc2" } -ink_primitives = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_storage = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_lang = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_prelude = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_env = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } - -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } - -[lib] -name = "CountTransferManager" -path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Required for ABI generation, and using this contract as a dependency. - # If using `cargo contract build`, it will be automatically disabled to produce a smaller Wasm binary - "rlib", -] - -[features] -default = ["std"] -std = [ - "ink_metadata", - "ink_metadata/std", - "ink_storage/std", - "ink_lang/std", - "ink_env/std", - "ink_primitives/std", - "scale/std", - "scale-info", - "scale-info/std", -] -ink-as-dependency = [] - -[workspace] -members = [] \ No newline at end of file diff --git a/contracts/CountTransferManager/README.md b/contracts/CountTransferManager/README.md deleted file mode 100644 index 17d25946d0..0000000000 --- a/contracts/CountTransferManager/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# CountTransferManager -This smart contract is a transfer manager for limiting the number of token holders a ticker can have. - - -## Pre-requsite -`cargo-contract` Install using below command -``` -cargo install cargo-contract -``` - -Make sure the cargo contract version should be >= 0.7.1. -``` - -### Build example contract and generate the contracts metadata - -To build a single example and generate the contracts Wasm file, navigate to the root of the example smart contract and run: - -``` -cargo contract build - -``` - -To generate the contract metadata (a.k.a. the contract ABI), run the following command: - -``` -cargo contract generate-metadata - -``` - -You should now have an optimized `.wasm` file and an `metadata.json` file in the `target` folder of the contract. - -For further information, please have a look at our [smart contracts workshop](https://substrate.dev/substrate-contracts-workshop/). \ No newline at end of file diff --git a/contracts/CountTransferManager/lib.rs b/contracts/CountTransferManager/lib.rs deleted file mode 100755 index ac5a33cc7d..0000000000 --- a/contracts/CountTransferManager/lib.rs +++ /dev/null @@ -1,238 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -use ink_lang as ink; - -mod custom_types { - use scale::{Decode, Encode}; - #[cfg(feature = "std")] - use scale_info::TypeInfo; - - #[derive(Decode, Encode, PartialEq, Ord, Eq, PartialOrd, Copy, Hash, Clone, Default)] - #[cfg_attr(feature = "std", derive(TypeInfo, Debug))] - pub struct IdentityId([u8; 32]); - - impl From for IdentityId { - fn from(id: u128) -> Self { - let mut encoded_id = id.encode(); - encoded_id.resize(32, 0); - let mut did = [0; 32]; - did.copy_from_slice(&encoded_id); - IdentityId(did) - } - } - - #[derive(Decode, Encode, PartialEq, Ord, Eq, PartialOrd)] - #[cfg_attr(feature = "std", derive(TypeInfo, Debug))] - pub enum RestrictionResult { - Valid, - Invalid, - ForceValid, - } -} - -#[ink::contract] -mod count_transfer_manager { - use crate::custom_types::{IdentityId, RestrictionResult}; - pub type Counter = u64; - - #[cfg(not(feature = "ink-as-dependency"))] - use ink_storage::lazy::Lazy; - - /// Event emitted when maximum holders set - #[ink(event)] - pub struct SetMaximumHolders { - #[ink(topic)] - new_holder_count: Counter, - #[ink(topic)] - old_holder_count: Counter, - } - - /// Struct that contains the storage items of this smart contract. - #[ink(storage)] - #[derive(Default)] - pub struct CountTransferManagerStorage { - /// No. of maximum holders a ticker can have. - max_holders: Counter, - /// Owner of the smart contract. It has the special privileges over other callers - owner: Lazy, - } - - impl CountTransferManagerStorage { - /// Constructor use to set the no. of maximum holder count a - /// ticker can have. - #[ink(constructor)] - pub fn new(max_holders: Counter) -> Self { - Self { - max_holders, - owner: Lazy::new(Self::env().caller()), - } - } - - /// Sets number of max holders - /// # Arguments - /// * max_holders No. of maximum holders - #[ink(message)] - pub fn set_max_holders(&mut self, max_holders: Counter) { - self.ensure_owner(self.env().caller()); - self.env().emit_event(SetMaximumHolders { - new_holder_count: self.max_holders, - old_holder_count: max_holders, - }); - self.max_holders = max_holders; - } - - /// Returns number of max holders - #[ink(message)] - pub fn get_max_holders(&self) -> Counter { - self.max_holders - } - - /// This function is used to verify transfers initiated by the - /// runtime assets - /// - /// It will be a valid transfer even when value > from balance as we are not checking the overflow / underflow - /// of the sender balances. Assuming these will be checked in the blockchain itself. - /// - /// # Arguments - /// * `from` - Identity Id of the sender. - /// * `to` - Identity Id of the receiver. - /// * `value` - Asset amount need to transfer to the receiver. - /// * `balance_from` - Balance of sender at the time of transaction. - /// * `balance_to` - Balance of receiver at the time of transaction. - /// * `total_supply` - Total supply of the asset - /// * `current_holder_count - Total no. of investors of a ticker. - #[ink(message)] - pub fn verify_transfer( - &self, - _from: Option, - _to: Option, - value: Balance, - balance_from: Balance, - balance_to: Balance, - _total_supply: Balance, - current_holder_count: Counter, - ) -> RestrictionResult { - // Strict checking only the cases where no. of holders get increases. - if self.max_holders == current_holder_count && balance_to == 0 && balance_from > value { - return RestrictionResult::Invalid; // INVALID - } - RestrictionResult::Valid // VALID - } - - /// Simply returns the current value of `owner`. - #[ink(message)] - pub fn owner(&self) -> AccountId { - *Lazy::get(&self.owner) - } - - fn ensure_owner(&self, owner: AccountId) { - assert!(owner == self.owner(), "Not Authorized"); - } - } - - #[cfg(test)] - mod tests { - /// Imports all the definitions from the outer scope so we can use them here. - use super::*; - use ink_env::{call, test}; - type Accounts = test::DefaultAccounts; - const CALLEE: [u8; 32] = [7; 32]; - - fn set_sender(sender: AccountId) { - test::push_execution_context::( - sender, - CALLEE.into(), - 1000000, - 1000000, - test::CallData::new(call::Selector::new([0x00; 4])), // dummy - ); - } - - fn set_from_owner() { - let accounts = default_accounts(); - set_sender(accounts.alice); - } - - fn default_accounts() -> Accounts { - test::default_accounts().expect("Test environment is expected to be initialized.") - } - - /// We test if the default constructor does its job. - #[test] - fn constructor_initialization_check() { - let default_accounts = default_accounts(); - set_from_owner(); - let count_transfer_manager = CountTransferManagerStorage::new(5000u64); - assert_eq!(count_transfer_manager.get_max_holders(), 5000u64); - assert_eq!(count_transfer_manager.owner(), default_accounts.alice); - } - - #[test] - fn verify_transfer_check() { - let alice_did = IdentityId::from(1); - let bob_did = IdentityId::from(2); - set_from_owner(); - let mut count_transfer_manager = CountTransferManagerStorage::new(5u64); - assert_eq!(count_transfer_manager.get_max_holders(), 5u64); - - // Check for simple transfer case - assert_eq!( - count_transfer_manager.verify_transfer( - Some(alice_did), - Some(bob_did), - 100, - 200, - 10, - 500, - 5 - ), - RestrictionResult::Valid - ); - - assert_eq!( - count_transfer_manager.verify_transfer( - Some(alice_did), - Some(bob_did), - 100, - 200, - 0, - 500, - 5 - ), - RestrictionResult::Invalid - ); - - // allowing transfer when holder counts get change - assert_eq!(count_transfer_manager.set_max_holders(10u64), ()); - assert_eq!(count_transfer_manager.get_max_holders(), 10u64); - - assert_eq!( - count_transfer_manager.verify_transfer( - Some(alice_did), - Some(bob_did), - 100, - 200, - 0, - 500, - 5 - ), - RestrictionResult::Valid - ); - - // It will be a valid transfer as we are not checking the overflow / underflow - // of the sender balances. Assuming these will be checked in the blockchain itself - assert_eq!( - count_transfer_manager.verify_transfer( - Some(alice_did), - Some(bob_did), - 100, - 50, - 0, - 500, - 5 - ), - RestrictionResult::Valid - ); - } - } -} diff --git a/contracts/GeneralTransferManager/.cargo/config b/contracts/GeneralTransferManager/.cargo/config deleted file mode 100755 index 5e1472510b..0000000000 --- a/contracts/GeneralTransferManager/.cargo/config +++ /dev/null @@ -1,5 +0,0 @@ -[target.wasm32-unknown-unknown] -rustflags = [ - "-C", "overflow-checks=on", - "-C", "link-args=-z stack-size=65536 --import-memory" -] \ No newline at end of file diff --git a/contracts/GeneralTransferManager/.ink/abi_gen/Cargo.toml b/contracts/GeneralTransferManager/.ink/abi_gen/Cargo.toml deleted file mode 100755 index 1b9a83bed2..0000000000 --- a/contracts/GeneralTransferManager/.ink/abi_gen/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "abi-gen" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" -publish = false - -[[bin]] -name = "abi-gen" -path = "main.rs" - -[dependencies] -contract = { path = "../..", package = "general_transfer_manager", features = ["ink-generate-abi", "test-env"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" diff --git a/contracts/GeneralTransferManager/.ink/abi_gen/main.rs b/contracts/GeneralTransferManager/.ink/abi_gen/main.rs deleted file mode 100755 index 9fa36177a6..0000000000 --- a/contracts/GeneralTransferManager/.ink/abi_gen/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() -> Result<(), std::io::Error> { - let abi = contract::ink_generate_abi(); - let contents = serde_json::to_string_pretty(&abi)?; - std::fs::create_dir("target").ok(); - std::fs::write("target/abi.json", contents)?; - Ok(()) -} diff --git a/contracts/GeneralTransferManager/Cargo.lock b/contracts/GeneralTransferManager/Cargo.lock deleted file mode 100644 index 31e3dd70fa..0000000000 --- a/contracts/GeneralTransferManager/Cargo.lock +++ /dev/null @@ -1,495 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "abi-gen" -version = "0.1.0" -dependencies = [ - "general_transfer_manager 0.1.0", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "aho-corasick" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitvec" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byte-slice-cast" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "derive_more" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "general_transfer_manager" -version = "0.1.0" -dependencies = [ - "ink_abi 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_core 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_lang 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_model 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_abi" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ink_abi_derive 0.1.0 (git+https://github.com/paritytech/ink)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "ink_abi_derive" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_alloc" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_core" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "ink_abi 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_alloc 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_utils 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "ink_lang" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ink_model 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_utils 0.1.0 (git+https://github.com/paritytech/ink)", - "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_model" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "ink_core 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_utils" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.62" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "parity-scale-codec" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-slice-cast 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec-derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tiny-keccak" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "type-metadata" -version = "0.1.0" -source = "git+https://github.com/type-metadata/type-metadata.git#f50ca5c475c1abbff87bb649b1d248cd2bcc0bef" -dependencies = [ - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata-derive 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "type-metadata-derive" -version = "0.1.0" -source = "git+https://github.com/type-metadata/type-metadata.git#f50ca5c475c1abbff87bb649b1d248cd2bcc0bef" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-segmentation" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9633b74910e1870f50f5af189b08487195cdb83c0e27a71d6f64d5e09dd0538b" -"checksum byte-slice-cast 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7cbcbf18128ec71d8d4a0d054461ec59fff5b75b7d10a4c9b7c7cb1a379c3e77" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -"checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum ink_abi 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_abi_derive 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_alloc 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_core 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_lang 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_model 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_utils 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65582b5c02128a4b0fa60fb3e070216e9c84be3e4a8f1b74bc37e15a25e58daf" -"checksum parity-scale-codec-derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a81f3cd93ed368a8e41c4e79538e99ca6e8f536096de23e3a0bc3e782093ce28" -"checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" -"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" -"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" -"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" -"checksum toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7aabe75941d914b72bf3e5d3932ed92ce0664d49d8432305a8b547c37227724" -"checksum type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)" = "" -"checksum type-metadata-derive 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)" = "" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/GeneralTransferManager/Cargo.toml b/contracts/GeneralTransferManager/Cargo.toml deleted file mode 100755 index c70d0ce446..0000000000 --- a/contracts/GeneralTransferManager/Cargo.toml +++ /dev/null @@ -1,61 +0,0 @@ -[package] -name = "general_transfer_manager" -version = "0.1.0" -edition = "2018" - -[dependencies] -ink_abi = { git = "https://github.com/paritytech/ink", package = "ink_abi", default-features = false, optional = true } -ink_core = { git = "https://github.com/paritytech/ink", package = "ink_core", default-features = false } -ink_model = { git = "https://github.com/paritytech/ink", package = "ink_model", default-features = false } -ink_lang = { git = "https://github.com/paritytech/ink", package = "ink_lang", default-features = false } - -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"], optional = true } - -[lib] -name = "general_transfer_manager" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Used for ABI generation. - "rlib", -] - -[features] -default = ["test-env"] -std = [ - "ink_abi/std", - "ink_core/std", - "ink_model/std", - "ink_lang/std", - "scale/std", - "type-metadata/std", -] -test-env = [ - "std", - "ink_core/test-env", - "ink_model/test-env", - "ink_lang/test-env", -] -ink-generate-abi = [ - "std", - "ink_abi", - "type-metadata", - "ink_core/ink-generate-abi", - "ink_lang/ink-generate-abi", -] -ink-as-dependency = [] - -[profile.release] -panic = "abort" -lto = true -opt-level = "z" -overflow-checks = true - -[workspace] -members = [ - ".ink/abi_gen" -] -exclude = [ - ".ink" -] diff --git a/contracts/GeneralTransferManager/README.md b/contracts/GeneralTransferManager/README.md deleted file mode 100644 index aff0b83eae..0000000000 --- a/contracts/GeneralTransferManager/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# polymesh-general-transfer-manager - -General Transfer Manager implemented in Ink! smart contract. - -Designed to be attached to a regulated asset to allow transfers of the asset to be controlled through an exemption list. - -# Pre-Requisites - - - Rust (nightly and stable) - - Contract Crate - `cargo install --force --git https://github.com/paritytech/ink cargo-contract` - -# To build WASM - -``` -cargo contract build -``` - -# To build ABI - -``` -cargo +nightly build --features ink-generate-abi -``` \ No newline at end of file diff --git a/contracts/GeneralTransferManager/src/lib.rs b/contracts/GeneralTransferManager/src/lib.rs deleted file mode 100755 index 486ed2a992..0000000000 --- a/contracts/GeneralTransferManager/src/lib.rs +++ /dev/null @@ -1,242 +0,0 @@ -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -use ink_core::{memory::format, memory::vec::Vec, storage}; - -use ink_lang::contract; - -contract! { - #![env = ink_core::env::DefaultSrmlTypes] - - struct GeneralTransferManager { - // (transfer type, restriction type) => enabl. True signifies that the restricition is in force. - // Transfer types are general(0), issuance(1) and redemption(2). - // Transfer restricitons are fromValidCDD(0), toValidCDD(1), fromRestricted(2), toRestricted(3). - // Not using enums as ink is not able to serialize and deserialze them. As a result, - // enums can not be used in function parameters. - transfer_restrictions: storage::HashMap<(u64, u64), bool>, - owner: storage::Value, - issuance_address: storage::Value, - redemption_address: storage::Value, - default_can_send_after: storage::Value, - default_can_receive_after: storage::Value, - } - - - impl Deploy for GeneralTransferManager { - fn deploy(&mut self) { - for i in 0..3 { - for j in 0..4 { - self.transfer_restrictions.insert((i, j), false); - } - } - self.owner.set(env.caller()); - // TODO Replace with proper issuance and redemption addresses - self.issuance_address.set(env.caller()); - self.redemption_address.set(env.caller()); - self.default_can_send_after.set(0); - self.default_can_receive_after.set(0); - } - } - - impl GeneralTransferManager { - /// Sets restriction status - pub(external) fn set_restriction_status(&mut self, transfer_type: u64, restriciton_type: u64, status: bool) { - if env.caller() != *self.owner { - return; - } - self.transfer_restrictions.insert((transfer_type, restriciton_type), status); - } - - /// Returns restriction status - pub(external) fn get_restriction_status(&self, transfer_type: u64, restriciton_type: u64) -> bool { - env.println(&format!("Restriction enabled: {:?}", *self.transfer_restrictions.get(&(transfer_type, restriciton_type)).unwrap_or(&false))); - *self.transfer_restrictions.get(&(transfer_type, restriciton_type)).unwrap_or(&false) - } - - /// Sets issuance address - pub(external) fn set_issuance_address(&mut self, issuance_address: AccountId) { - if env.caller() != *self.owner { - return; - } - self.issuance_address.set(issuance_address); - } - - /// Sets default_can_send_after - pub(external) fn set_default_can_send_after(&mut self, default_can_send_after: u64) { - if env.caller() != *self.owner { - return; - } - self.default_can_send_after.set(default_can_send_after); - } - - /// Sets default_can_receive_after - pub(external) fn set_default_can_receive_after(&mut self, default_can_receive_after: u64) { - if env.caller() != *self.owner { - return; - } - self.default_can_receive_after.set(default_can_receive_after); - } - - /// Sets redemption address - pub(external) fn set_redemption_address(&mut self, redemption_address: AccountId) { - if env.caller() != *self.owner { - return; - } - self.redemption_address.set(redemption_address); - } - - /// Gets issuance address - pub(external) fn get_issuance_address(&self) -> Option { - Some(*self.issuance_address.get()) - } - - /// Gets redemption address - pub(external) fn get_redemption_address(&self) -> Option { - Some(*self.redemption_address.get()) - } - - /// Gets default_can_send_after - pub(external) fn get_default_can_send_after(&self) -> u64 { - *self.default_can_send_after.get() - } - - /// Gets default_can_receive_after - pub(external) fn get_default_can_receive_after(&self) -> u64 { - *self.default_can_receive_after.get() - } - - /// Runtime will call this function to fetch the claims needed by this module - pub(external) fn get_claims(&self) -> Option>> { - // #TODO Finalize encoding/decoding mechanism for claims. - // Currently, it is a vector of vector of u8. Every u8 represents one ASCII character. Vec represents a string. - // Vec> represents a collection of strings. Every string represents one claim. - // The string is <0|1>;;. 0 represents sender, 1 represents receiver. example: 0;can_send_after;u64 - let mut claim1 = Vec::new(); - claim1.push('0' as u8); - claim1.push(';' as u8); - claim1.push('f' as u8); - claim1.push('e' as u8); - claim1.push(';' as u8); - claim1.push('u' as u8); - claim1.push('6' as u8); - claim1.push('4' as u8); - - let mut claim2 = Vec::new(); - claim2.push('1' as u8); - claim2.push(';' as u8); - claim2.push('t' as u8); - claim2.push('e' as u8); - claim2.push(';' as u8); - claim2.push('u' as u8); - claim2.push('6' as u8); - claim2.push('4' as u8); - - let mut claim3 = Vec::new(); - claim3.push('0' as u8); - claim3.push(';' as u8); - claim3.push('c' as u8); - claim3.push('s' as u8); - claim3.push('a' as u8); - claim3.push(';' as u8); - claim3.push('u' as u8); - claim3.push('6' as u8); - claim3.push('4' as u8); - - let mut claim4 = Vec::new(); - claim4.push('1' as u8); - claim4.push(';' as u8); - claim4.push('c' as u8); - claim4.push('r' as u8); - claim4.push('a' as u8); - claim4.push(';' as u8); - claim4.push('u' as u8); - claim4.push('6' as u8); - claim4.push('4' as u8); - - let mut claims = Vec::new(); - claims.push(claim1); - claims.push(claim2); - claims.push(claim3); - claims.push(claim4); - Some(claims) - } - - /// Verify transfer function with standard interface. - pub(external) fn verify_tranfer( - &self, - sender: AccountId, - receiver: AccountId, - amount: Balance, - sender_balance: Balance, - receiver_balance: Balance, - total_supply: Balance, - number_of_investors: u64, - from_expiry: u64, - to_expiry: u64, - can_send_after: u64, - can_receive_after: u64 - ) -> u16 { //u8 doesn't work. enums don't work. Hence, using u16. - - let mut tx_type:u64 = 0; //General (Default) - if sender == *self.issuance_address { - tx_type = 1; //Issuance - } else if receiver == *self.redemption_address { - tx_type = 2; //Redemption - } - - if (*self.transfer_restrictions.get(&(tx_type, 0)).unwrap_or(&false) && from_expiry >= env.now()) || - (*self.transfer_restrictions.get(&(tx_type, 1)).unwrap_or(&false) && to_expiry >= env.now()) - { - return 1; //NA - } - - if (*self.transfer_restrictions.get(&(tx_type, 2)).unwrap_or(&false) && - if can_send_after == 0 { *self.default_can_send_after.get() } else { can_send_after } >= env.now()) || ( - *self.transfer_restrictions.get(&(tx_type, 3)).unwrap_or(&false) && - if can_receive_after == 0 { *self.default_can_receive_after.get() } else { can_receive_after } >= env.now()) - { - return 1; //NA - } - - return 2; //Valid - } - // pub(external) fn test_now(&self) -> u64 { - // env.now() - // } - } -} - -#[cfg(all(test, feature = "test-env"))] -mod tests { - use super::*; - use ink_core::env; - type Types = ink_core::env::DefaultSrmlTypes; - - #[test] - fn owner_can_change_restriction_status() { - let alice = AccountId::from([0x0; 32]); - env::test::set_caller::(alice); - let mut contract = GeneralTransferManager::deploy_mock(); - assert_eq!(contract.get_restriction_status(0, 0), false); - contract.set_restriction_status(0, 0, true); - assert_eq!(contract.get_restriction_status(0, 0), true); - } - #[test] - fn not_owner_can_not_change_restriction_status() { - let alice = AccountId::from([0x0; 32]); - let bob = AccountId::from([0x1; 32]); - env::test::set_caller::(alice); - let mut contract = GeneralTransferManager::deploy_mock(); - env::test::set_caller::(bob); - assert_eq!(contract.get_restriction_status(0, 0), false); - contract.set_restriction_status(0, 0, true); - assert_eq!(contract.get_restriction_status(0, 0), false); - } - // #[test] - // fn test_now() { - // let time = Moment::from(10u64); - // env::test::set_now::(time); - // let mut contract = GeneralTransferManager::deploy_mock(); - // assert_eq!(contract.test_now(), 10); - // } -} diff --git a/contracts/PercentageTransferManager/.gitignore b/contracts/PercentageTransferManager/.gitignore deleted file mode 100755 index bf910de10a..0000000000 --- a/contracts/PercentageTransferManager/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Ignore build artifacts from the local tests sub-crate. -/target/ - -# Ignore backup files creates by cargo fmt. -**/*.rs.bk - -# Remove Cargo.lock when creating an executable, leave it for libraries -# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock \ No newline at end of file diff --git a/contracts/PercentageTransferManager/Cargo.toml b/contracts/PercentageTransferManager/Cargo.toml deleted file mode 100755 index 5d31ac5d34..0000000000 --- a/contracts/PercentageTransferManager/Cargo.toml +++ /dev/null @@ -1,48 +0,0 @@ -[package] -name = "percentage_transfer_manager" -version = "0.1.0" -authors = ["Polymath Inc "] -edition = "2018" - -[dependencies] -ink_metadata = { git = "https://github.com/paritytech/ink", default-features = false, features = ["derive"], optional = true, tag = "v3.0.0-rc2" } -ink_primitives = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_storage = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_lang = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_prelude = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } -ink_env = { git = "https://github.com/paritytech/ink", default-features = false, tag = "v3.0.0-rc2" } - -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true } - -[lib] -name = "percentage_transfer_manager" -path = "src/lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Used for ABI generation. - "rlib", -] - -[features] -default = ["std"] -std = [ - "ink_metadata", - "ink_metadata/std", - "ink_storage/std", - "ink_lang/std", - "ink_env/std", - "ink_primitives/std", - "scale/std", - "scale-info", - "scale-info/std", -] - -[profile.release] -overflow-checks = false - -ink-as-dependency = [] - -[workspace] -members = [] diff --git a/contracts/PercentageTransferManager/README.md b/contracts/PercentageTransferManager/README.md deleted file mode 100644 index 4d5a6f1600..0000000000 --- a/contracts/PercentageTransferManager/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# PercentageTransferManager -This smart contract is a transfer manager for limiting the percentage of token supply that a single address can hold. - - -## Pre-requisite -`cargo-contract` Install using below command -``` -cargo install cargo-contract -``` - -Make sure the cargo contract version should be >= 0.7.1. - -### Build example contract and generate the contracts metadata - -To build a single example and generate the contracts Wasm file, navigate to the root of the example smart contract and run: - -``` -cargo contract build - -``` - -To generate the contract metadata (a.k.a. the contract ABI), run the following command: - -``` -cargo contract generate-metadata - -``` - -You should now have an optimized `.wasm` file and an `metadata.json` file in the `target` folder of the contract. - -For further information, please have a look at our [smart contracts workshop](https://substrate.dev/substrate-contracts-workshop/). \ No newline at end of file diff --git a/contracts/PercentageTransferManager/src/lib.rs b/contracts/PercentageTransferManager/src/lib.rs deleted file mode 100755 index 254952050c..0000000000 --- a/contracts/PercentageTransferManager/src/lib.rs +++ /dev/null @@ -1,607 +0,0 @@ -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -use ink_lang as ink; - -mod custom_types { - use ink_storage::traits::{PackedLayout, SpreadLayout}; - use scale::{Decode, Encode}; - #[cfg(feature = "std")] - use scale_info::TypeInfo; - - #[derive( - Decode, - Encode, - PartialEq, - Ord, - Eq, - PartialOrd, - Copy, - Hash, - Clone, - Default, - SpreadLayout, - PackedLayout, - )] - #[cfg_attr( - feature = "std", - derive(TypeInfo, Debug, ink_storage::traits::StorageLayout) - )] - pub struct IdentityId([u8; 32]); - - impl From for IdentityId { - fn from(id: u128) -> Self { - let mut encoded_id = id.encode(); - encoded_id.resize(32, 0); - let mut did = [0; 32]; - did.copy_from_slice(&encoded_id); - IdentityId(did) - } - } - - #[derive(Decode, Encode, PartialEq, Ord, Eq, PartialOrd)] - #[cfg_attr(feature = "std", derive(TypeInfo, Debug))] - pub enum RestrictionResult { - Valid, - Invalid, - ForceValid, - } -} - -#[ink::contract] -mod percentage_transfer_manager { - use crate::custom_types::{IdentityId, RestrictionResult}; - use ink_prelude::vec::Vec; - #[cfg(not(feature = "ink-as-dependency"))] - use ink_storage::collections::HashMap as StorageHashMap; - - /// Defines the storage of your contract. - /// Add new fields to the below struct in order - /// to add new static storage fields to your contract. - #[ink(storage)] - #[derive(Default)] - pub struct PercentageTransferManagerStorage { - /// Owner of the smart extension - pub owner: AccountId, - /// Maximum allowed percentage of the tokens hold by an investor - /// %age is based on the total supply of the asset. Multiplier of 10^6 - pub max_allowed_percentage: u128, - /// By toggling the primary issuance variable it will bypass - /// all the restrictions imposed by this smart extension - pub allow_primary_issuance: bool, - /// Exemption list that contains the list of investor's identities - /// which are not affected by this module restrictions - pub exemption_list: StorageHashMap, - } - - #[ink(event)] - pub struct ChangeAllowedPercentage { - #[ink(topic)] - old_percentage: u128, - #[ink(topic)] - new_percentage: u128, - } - - #[ink(event)] - pub struct ChangePrimaryIssuance { - #[ink(topic)] - allow_primary_issuance: bool, - } - - #[ink(event)] - pub struct ModifyExemptionList { - #[ink(topic)] - identity: IdentityId, - #[ink(topic)] - exempted: bool, - } - - #[ink(event)] - pub struct TransferOwnership { - #[ink(topic)] - new_owner: AccountId, - #[ink(topic)] - old_owner: AccountId, - } - - impl PercentageTransferManagerStorage { - /// Constructor that initializes the `u128` value to the given `max_allowed_percentage`, - /// boolean value for the `allow_primary_issuance` & `owner` of the SE. - #[ink(constructor)] - pub fn new(max_percentage: u128, primary_issuance: bool) -> Self { - Self { - owner: Self::env().caller(), - max_allowed_percentage: max_percentage, - allow_primary_issuance: primary_issuance, - exemption_list: StorageHashMap::default(), - } - } - - /// This function is used to verify transfers initiated by the - /// runtime assets - /// - /// # Arguments - /// * `from` - Identity Id of the sender. - /// * `to` - Identity Id of the receiver. - /// * `value` - Asset amount need to transfer to the receiver. - /// * `balance_from` - Balance of sender at the time of transaction. - /// * `balance_to` - Balance of receiver at the time of transaction. - /// * `total_supply` - Total supply of the asset - /// * `current_holder_count - Total no. of investors of a ticker - #[ink(message)] - pub fn verify_transfer( - &self, - from: Option, - to: Option, - value: Balance, - _balance_from: Balance, - balance_to: Balance, - total_supply: Balance, - _current_holder_count: u64, - ) -> RestrictionResult { - if from == None && self.allow_primary_issuance - || to.map_or(false, |to| self.is_exempted(&to)) - || ((balance_to + value) * 10u128.pow(6)) / total_supply - <= self.max_allowed_percentage - { - return RestrictionResult::Valid; - } - RestrictionResult::Invalid - } - - /// Change the value of allowed percentage - /// - /// # Arguments - /// * `new_percentage` - New value of Max percentage of assets hold by an investor - #[ink(message)] - pub fn change_allowed_percentage(&mut self, new_percentage: u128) { - self.ensure_owner(self.env().caller()); - assert!( - self.max_allowed_percentage != new_percentage, - "Must change setting" - ); - self.env().emit_event(ChangeAllowedPercentage { - old_percentage: self.max_allowed_percentage, - new_percentage, - }); - self.max_allowed_percentage = new_percentage; - } - - /// Sets whether or not to consider primary issuance transfers - /// - /// # Arguments - /// * `primary_issuance` - whether to allow all primary issuance transfers - #[ink(message)] - pub fn change_primary_issuance(&mut self, primary_issuance: bool) { - self.ensure_owner(self.env().caller()); - assert!( - self.allow_primary_issuance != primary_issuance, - "Must change setting" - ); - self.allow_primary_issuance = primary_issuance; - self.env().emit_event(ChangePrimaryIssuance { - allow_primary_issuance: primary_issuance, - }); - } - - /// To exempt the given Identity from the restriction - /// - /// # Arguments - /// * `identity` - Identity of the token holder whose exemption status needs to change - /// * `is_exempted` - New exemption status of the identity - #[ink(message)] - pub fn modify_exemption_list(&mut self, identity: IdentityId, is_exempted: bool) { - self.ensure_owner(self.env().caller()); - assert!( - self.is_exempted(&identity) != is_exempted, - "Must change setting" - ); - self.exemption_list.insert(identity, is_exempted); - self.env().emit_event(ModifyExemptionList { - identity, - exempted: is_exempted, - }); - } - - /// To exempt the given Identities from the restriction - /// - /// # Arguments - /// * `exemptions` - Identities & exemption status of the identities - #[ink(message)] - pub fn modify_exemption_list_batch(&mut self, exemptions: Vec<(IdentityId, bool)>) { - for (identity, status) in exemptions.into_iter() { - self.modify_exemption_list(identity, status); - } - } - - /// Transfer ownership of the smart extension - /// - /// # Arguments - /// * `new_owner` - AccountId of the new owner - #[ink(message)] - pub fn transfer_ownership(&mut self, new_owner: AccountId) { - self.ensure_owner(self.env().caller()); - self.env().emit_event(TransferOwnership { - old_owner: self.env().caller(), - new_owner, - }); - self.owner = new_owner; - } - - /// Simply returns the current value of `max_allowed_percentage`. - #[ink(message)] - pub fn get_max_allowed_percentage(&self) -> u128 { - self.max_allowed_percentage - } - - /// Simply returns the current value of `allow_primary_issuance`. - #[ink(message)] - pub fn is_primary_issuance_allowed(&self) -> bool { - self.allow_primary_issuance - } - - /// Simply returns the current value of `owner`. - #[ink(message)] - pub fn owner(&self) -> AccountId { - self.owner - } - - /// Function to know whether given Identity is exempted or not - #[ink(message)] - pub fn is_identity_exempted_or_not(&self, of: IdentityId) -> bool { - self.is_exempted(&of) - } - - /// Return all exempted identities. - #[ink(message)] - pub fn get_all_exempted_identities(&self) -> Vec { - self.exemption_list - .iter() - .filter(|(_, status)| **status) - .map(|(id, _)| *id) - .collect() - } - - fn is_exempted(&self, of: &IdentityId) -> bool { - *self.exemption_list.get(of).unwrap_or(&false) - } - - fn ensure_owner(&self, owner: AccountId) { - assert!(owner == self.owner, "Not Authorized"); - } - } - - /// Unit tests in Rust are normally defined within such a `#[cfg(test)]` - /// module and test functions are marked with a `#[test]` attribute. - /// The below code is technically just normal Rust code. - #[cfg(test)] - mod tests { - /// Imports all the definitions from the outer scope so we can use them here. - use super::*; - use ink_env::{call, test}; - type Accounts = test::DefaultAccounts; - const CALLEE: [u8; 32] = [7; 32]; - - fn set_sender(sender: AccountId) { - test::push_execution_context::( - sender, - CALLEE.into(), - 1000000, - 1000000, - test::CallData::new(call::Selector::new([0x00; 4])), // dummy - ); - } - - fn set_from_owner() { - let accounts = default_accounts(); - set_sender(accounts.alice); - } - - fn default_accounts() -> Accounts { - test::default_accounts().expect("Test environment is expected to be initialized.") - } - - /// We test if the default constructor does its job. - #[test] - fn constructor_initialization_check() { - let default_accounts = default_accounts(); - set_from_owner(); - let percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000u128, false); - assert_eq!( - percentage_transfer_manager.get_max_allowed_percentage(), - 200000u128 - ); - assert_eq!( - percentage_transfer_manager.is_primary_issuance_allowed(), - false - ); - assert_eq!(percentage_transfer_manager.owner(), default_accounts.alice); - } - - #[test] - fn test_verify_transfer_successfully() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - let from = IdentityId::from(1); - let to = IdentityId::from(2); - let multiplier: u128 = 1000000; - // test verify transfer return value - - // Should pass when transfer value is under restriction - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (100u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Valid - ); - - // Should fail if the transfer value is more than the restriction - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (410u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Invalid - ); - - // Should fail when the balance of will be more the restriction - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (301u128 * multiplier).into(), - (2000u128 * multiplier).into(), - (100u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Invalid - ); - - // Should fail when primary issuance is on because from is not None - percentage_transfer_manager.change_primary_issuance(true); - // check for the primary issuance value - assert_eq!( - percentage_transfer_manager.is_primary_issuance_allowed(), - true - ); - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (700u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Invalid - ); - - // Should pass when primary issuance is on & from is None - assert_eq!( - percentage_transfer_manager.verify_transfer( - None, - Some(to), - (700u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Valid - ); - - // Should pass when the Identity in the exemption list - percentage_transfer_manager.change_primary_issuance(false); - assert_eq!( - percentage_transfer_manager.is_primary_issuance_allowed(), - false - ); - percentage_transfer_manager.modify_exemption_list(to, true); - assert_eq!( - percentage_transfer_manager.is_identity_exempted_or_not(to), - true - ); - - assert_eq!( - percentage_transfer_manager.verify_transfer( - None, - Some(to), - (700u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Valid - ); - } - - #[test] - fn test_verify_transfer_with_decimal_percentage() { - set_from_owner(); - let percentage_transfer_manager = PercentageTransferManagerStorage::new(278940, false); // it is 27.894% of the totalSupply - let from = IdentityId::from(1); - let to = IdentityId::from(2); - let multiplier: u128 = 1000000; - - // Should pass when transfer value is under restriction - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (55788u128 * 10000).into(), // exact 27.894% of 2000 tokens - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Valid - ); - - // Should fail when passing more than 27.894% - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (558u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Invalid - ); - } - - #[test] - fn should_successfully_change_allowed_percentage() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - let from = IdentityId::from(1); - let to = IdentityId::from(2); - let multiplier: u128 = 1000000; - - // Should fail if the transfer value is more than the restriction - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (410u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Invalid - ); - - percentage_transfer_manager.change_allowed_percentage(300000u128); - - // Should pass with the same values because allowed percentage get increased - assert_eq!( - percentage_transfer_manager.verify_transfer( - Some(from), - Some(to), - (410u128 * multiplier).into(), - (2000u128 * multiplier).into(), - 0u128.into(), - (2000u128 * multiplier).into(), - 0 - ), - RestrictionResult::Valid - ); - } - - #[test] - #[should_panic(expected = "Must change setting")] - fn should_panic_when_same_value_submitted_as_param() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - //Should fail to change the allowed percentage because no change in the allowed percentage value - percentage_transfer_manager.change_allowed_percentage(200000u128); - } - - #[test] - #[should_panic(expected = "Not Authorized")] - fn should_panic_when_wrong_owner_call() { - let default_accounts = default_accounts(); - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - - // Should fail to call change_allowed_percentage when ownership changes - percentage_transfer_manager.transfer_ownership(default_accounts.bob); - assert_eq!(percentage_transfer_manager.owner(), default_accounts.bob); - percentage_transfer_manager.change_allowed_percentage(200000u128); - } - - #[test] - #[should_panic(expected = "Not Authorized")] - fn should_panic_when_calling_modify_exemption_list_by_wrong_owner() { - let default_accounts = default_accounts(); - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - let to = IdentityId::from(2); - - percentage_transfer_manager.transfer_ownership(default_accounts.bob); - assert_eq!(percentage_transfer_manager.owner(), default_accounts.bob); - percentage_transfer_manager.modify_exemption_list(to, true); - } - - #[test] - #[should_panic(expected = "Must change setting")] - fn should_panic_when_calling_modify_exemption_list_when_same_value_passed() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - let to = IdentityId::from(2); - - percentage_transfer_manager.modify_exemption_list(to, true); - // Should fail to call modify_exemption_list with same exemption state - percentage_transfer_manager.modify_exemption_list(to, true); - } - - #[test] - #[should_panic(expected = "Not Authorized")] - fn should_panic_when_calling_change_primary_issuance_by_wrong_owner() { - let default_accounts = default_accounts(); - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - - percentage_transfer_manager.transfer_ownership(default_accounts.bob); - assert_eq!(percentage_transfer_manager.owner(), default_accounts.bob); - percentage_transfer_manager.change_primary_issuance(true); - } - - #[test] - #[should_panic(expected = "Must change setting")] - fn should_panic_when_calling_change_primary_issuance_when_same_value_passed() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - - // Should fail to call change_primary_issuance with same issuance state - percentage_transfer_manager.change_primary_issuance(false); - } - - #[test] - fn should_exempt_multiple_identities() { - set_from_owner(); - let mut percentage_transfer_manager = - PercentageTransferManagerStorage::new(200000, false); - let exempted_identities = vec![ - (IdentityId::from(1), true), - (IdentityId::from(2), true), - (IdentityId::from(3), true), - ]; - let exempt_to = exempted_identities - .iter() - .map(|(id, _)| *id) - .collect::>(); - percentage_transfer_manager.modify_exemption_list_batch(exempted_identities); - let exempt_id = percentage_transfer_manager.get_all_exempted_identities(); - assert!(exempt_id == exempt_to); - assert!(percentage_transfer_manager.is_identity_exempted_or_not(IdentityId::from(1))); - assert!(percentage_transfer_manager.is_identity_exempted_or_not(IdentityId::from(2))); - assert!(percentage_transfer_manager.is_identity_exempted_or_not(IdentityId::from(3))); - } - } -} diff --git a/contracts/SimpleSTO/.cargo/config b/contracts/SimpleSTO/.cargo/config deleted file mode 100755 index 5e1472510b..0000000000 --- a/contracts/SimpleSTO/.cargo/config +++ /dev/null @@ -1,5 +0,0 @@ -[target.wasm32-unknown-unknown] -rustflags = [ - "-C", "overflow-checks=on", - "-C", "link-args=-z stack-size=65536 --import-memory" -] \ No newline at end of file diff --git a/contracts/SimpleSTO/.ink/abi_gen/Cargo.toml b/contracts/SimpleSTO/.ink/abi_gen/Cargo.toml deleted file mode 100755 index bcbfca3c82..0000000000 --- a/contracts/SimpleSTO/.ink/abi_gen/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "abi-gen" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" -publish = false - -[[bin]] -name = "abi-gen" -path = "main.rs" - -[dependencies] -contract = { path = "../..", package = "simple_sto", features = ["ink-generate-abi", "test-env"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" diff --git a/contracts/SimpleSTO/.ink/abi_gen/main.rs b/contracts/SimpleSTO/.ink/abi_gen/main.rs deleted file mode 100755 index 9fa36177a6..0000000000 --- a/contracts/SimpleSTO/.ink/abi_gen/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() -> Result<(), std::io::Error> { - let abi = contract::ink_generate_abi(); - let contents = serde_json::to_string_pretty(&abi)?; - std::fs::create_dir("target").ok(); - std::fs::write("target/abi.json", contents)?; - Ok(()) -} diff --git a/contracts/SimpleSTO/Cargo.lock b/contracts/SimpleSTO/Cargo.lock deleted file mode 100644 index 417978f983..0000000000 --- a/contracts/SimpleSTO/Cargo.lock +++ /dev/null @@ -1,495 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "abi-gen" -version = "0.1.0" -dependencies = [ - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "simple_sto 0.1.0", -] - -[[package]] -name = "aho-corasick" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitvec" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byte-slice-cast" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "derive_more" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_abi" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ink_abi_derive 0.1.0 (git+https://github.com/paritytech/ink)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "ink_abi_derive" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_alloc" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_core" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "ink_abi 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_alloc 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_utils 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "ink_lang" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ink_model 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_utils 0.1.0 (git+https://github.com/paritytech/ink)", - "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_model" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "ink_core 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ink_utils" -version = "0.1.0" -source = "git+https://github.com/paritytech/ink#53fa4d5862e11bdb8fca1715c825d63514a48686" -dependencies = [ - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itertools" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.62" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "parity-scale-codec" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-slice-cast 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-scale-codec-derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "simple_sto" -version = "0.1.0" -dependencies = [ - "ink_abi 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_core 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_lang 0.1.0 (git+https://github.com/paritytech/ink)", - "ink_model 0.1.0 (git+https://github.com/paritytech/ink)", - "parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tiny-keccak" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "type-metadata" -version = "0.1.0" -source = "git+https://github.com/type-metadata/type-metadata.git#f50ca5c475c1abbff87bb649b1d248cd2bcc0bef" -dependencies = [ - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "type-metadata-derive 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)", -] - -[[package]] -name = "type-metadata-derive" -version = "0.1.0" -source = "git+https://github.com/type-metadata/type-metadata.git#f50ca5c475c1abbff87bb649b1d248cd2bcc0bef" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-segmentation" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum bitvec 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9633b74910e1870f50f5af189b08487195cdb83c0e27a71d6f64d5e09dd0538b" -"checksum byte-slice-cast 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7cbcbf18128ec71d8d4a0d054461ec59fff5b75b7d10a4c9b7c7cb1a379c3e77" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -"checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum ink_abi 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_abi_derive 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_alloc 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_core 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_lang 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_model 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum ink_utils 0.1.0 (git+https://github.com/paritytech/ink)" = "" -"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum parity-scale-codec 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "65582b5c02128a4b0fa60fb3e070216e9c84be3e4a8f1b74bc37e15a25e58daf" -"checksum parity-scale-codec-derive 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a81f3cd93ed368a8e41c4e79538e99ca6e8f536096de23e3a0bc3e782093ce28" -"checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" -"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" -"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" -"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" -"checksum toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7aabe75941d914b72bf3e5d3932ed92ce0664d49d8432305a8b547c37227724" -"checksum type-metadata 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)" = "" -"checksum type-metadata-derive 0.1.0 (git+https://github.com/type-metadata/type-metadata.git)" = "" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/SimpleSTO/Cargo.toml b/contracts/SimpleSTO/Cargo.toml deleted file mode 100755 index b526308df1..0000000000 --- a/contracts/SimpleSTO/Cargo.toml +++ /dev/null @@ -1,61 +0,0 @@ -[package] -name = "simple_sto" -version = "0.1.0" -edition = "2018" - -[dependencies] -ink_abi = { git = "https://github.com/paritytech/ink", package = "ink_abi", default-features = false, optional = true } -ink_core = { git = "https://github.com/paritytech/ink", package = "ink_core", default-features = false } -ink_model = { git = "https://github.com/paritytech/ink", package = "ink_model", default-features = false } -ink_lang = { git = "https://github.com/paritytech/ink", package = "ink_lang", default-features = false } - -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"], optional = true } - -[lib] -name = "simple_sto" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Used for ABI generation. - "rlib", -] - -[features] -default = ["test-env"] -std = [ - "ink_abi/std", - "ink_core/std", - "ink_model/std", - "ink_lang/std", - "scale/std", - "type-metadata/std", -] -test-env = [ - "std", - "ink_core/test-env", - "ink_model/test-env", - "ink_lang/test-env", -] -ink-generate-abi = [ - "std", - "ink_abi", - "type-metadata", - "ink_core/ink-generate-abi", - "ink_lang/ink-generate-abi", -] -ink-as-dependency = [] - -[profile.release] -panic = "abort" -lto = true -opt-level = "z" -overflow-checks = true - -[workspace] -members = [ - ".ink/abi_gen" -] -exclude = [ - ".ink" -] diff --git a/contracts/SimpleSTO/README.md b/contracts/SimpleSTO/README.md deleted file mode 100644 index ae88fe7e2c..0000000000 --- a/contracts/SimpleSTO/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# polymesh-simple-sto - -Simple STO implemented in Ink! smart contract. - -Designed to be attached to the Settlement module to primary offerings of an asset. - -# Pre-Requisites - - - Rust (nightly and stable) - - Contract Crate - `cargo install --force --git https://github.com/paritytech/ink cargo-contract` - -# To build WASM - -``` -cargo contract build -``` - -# To build ABI - -``` -cargo +nightly build --features ink-generate-abi -``` \ No newline at end of file diff --git a/contracts/SimpleSTO/src/lib.rs b/contracts/SimpleSTO/src/lib.rs deleted file mode 100755 index 681407a112..0000000000 --- a/contracts/SimpleSTO/src/lib.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -use ink_core::storage; - -use ink_lang::contract; - -contract! { - #![env = ink_core::env::DefaultSrmlTypes] - - struct SimpleSTO { - token_sold: storage::Value, - max_limit: storage::Value, - reserve_percent: storage::Value, // enter 1 for 1% i.e. 0.01 ratio - starting_price: storage::Value, // price * 10000. Enter 50000 if price is 5 - owner: storage::Value, - } - - - impl Deploy for SimpleSTO { - fn deploy(&mut self) { - self.owner.set(env.caller()); - self.token_sold.set(0); - self.max_limit.set(0); - } - } - - impl SimpleSTO { - /// Sets max token sold - pub(external) fn configure(&mut self, max_limit: u128, reserve_percent: u128, starting_price: u128) { - if env.caller() != *self.owner { - return; - } - self.max_limit.set(max_limit); - self.reserve_percent.set(reserve_percent); - self.starting_price.set(starting_price); - } - - /// gets price - pub(external) fn get_price(&mut self, amount: u128) -> u128 { - let price = *self.token_sold.get() / - *self.starting_price.get() + (*self.max_limit.get() - *self.token_sold.get()) * *self.reserve_percent.get(); - let buy_amount = price * amount + *self.token_sold.get(); - if buy_amount > *self.max_limit.get() { - return 0; - } else { - self.token_sold.set(buy_amount); - return price - } - } - } -} - -#[cfg(all(test, feature = "test-env"))] -mod tests { - use super::*; - use ink_core::env; - type Types = ink_core::env::DefaultSrmlTypes; -} diff --git a/contracts/examples/RuntimeInteraction/.gitignore b/contracts/examples/RuntimeInteraction/.gitignore deleted file mode 100755 index 8de8f877e4..0000000000 --- a/contracts/examples/RuntimeInteraction/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Ignore build artifacts from the local tests sub-crate. -/target/ - -# Ignore backup files creates by cargo fmt. -**/*.rs.bk - -# Remove Cargo.lock when creating an executable, leave it for libraries -# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock diff --git a/contracts/examples/RuntimeInteraction/.ink/abi_gen/Cargo.toml b/contracts/examples/RuntimeInteraction/.ink/abi_gen/Cargo.toml deleted file mode 100755 index 5b3b7ab8a0..0000000000 --- a/contracts/examples/RuntimeInteraction/.ink/abi_gen/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "abi-gen" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2018" -publish = false - -[[bin]] -name = "abi-gen" -path = "main.rs" - -[dependencies] -contract = { path = "../..", package = "RuntimeInteraction", default-features = false, features = ["ink-generate-abi"] } -ink_lang = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] } -serde = "1.0" -serde_json = "1.0" diff --git a/contracts/examples/RuntimeInteraction/.ink/abi_gen/main.rs b/contracts/examples/RuntimeInteraction/.ink/abi_gen/main.rs deleted file mode 100755 index 54342324c6..0000000000 --- a/contracts/examples/RuntimeInteraction/.ink/abi_gen/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() -> Result<(), std::io::Error> { - let abi = ::generate_abi(); - let contents = serde_json::to_string_pretty(&abi)?; - std::fs::create_dir("target").ok(); - std::fs::write("target/metadata.json", contents)?; - Ok(()) -} diff --git a/contracts/examples/RuntimeInteraction/Cargo.toml b/contracts/examples/RuntimeInteraction/Cargo.toml deleted file mode 100755 index b8c2dc7fb7..0000000000 --- a/contracts/examples/RuntimeInteraction/Cargo.toml +++ /dev/null @@ -1,74 +0,0 @@ -[package] -name = "RuntimeInteraction" -version = "0.1.0" -authors = ["Polymath Inc."] -edition = "2018" - -[dependencies] -ink_abi = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_abi", default-features = false, features = ["derive"], optional = true } -ink_primitives = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_primitives", default-features = false } -ink_core = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_core", default-features = false } -ink_lang = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_lang", default-features = false } -ink_prelude = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_prelude", default-features = false } - -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.104", optional = true, features = ["derive"] } -custom-ink-env-types = { path = "../custom-ink-env-types", default-features = false } - -[dependencies.type-metadata] -git = "https://github.com/type-metadata/type-metadata.git" -rev = "02eae9f35c40c943b56af5b60616219f2b72b47d" -default-features = false -features = ["derive"] -optional = true - -[lib] -name = "RuntimeInteraction" -path = "lib.rs" -crate-type = [ - # Used for normal contract Wasm blobs. - "cdylib", - # Required for ABI generation, and using this contract as a dependency. - # If using `cargo contract build`, it will be automatically disabled to produce a smaller Wasm binary - "rlib", -] - -[features] -default = ["test-env"] -std = [ - "serde", - "ink_abi/std", - "ink_core/std", - "ink_primitives/std", - "ink_prelude/std", - "scale/std", - "type-metadata/std", - "custom-ink-env-types/std" -] -test-env = [ - "std", - "ink_lang/test-env", -] -ink-generate-abi = [ - "std", - "ink_abi", - "type-metadata", - "ink_core/ink-generate-abi", - "ink_lang/ink-generate-abi", - "custom-ink-env-types/ink-generate-abi" -] -ink-as-dependency = [] - -[profile.release] -panic = "abort" -lto = true -opt-level = "z" -# overflow-checks = true - -[workspace] -members = [ - ".ink/abi_gen" -] -exclude = [ - ".ink" -] diff --git a/contracts/examples/RuntimeInteraction/lib.rs b/contracts/examples/RuntimeInteraction/lib.rs deleted file mode 100755 index 269f379dc7..0000000000 --- a/contracts/examples/RuntimeInteraction/lib.rs +++ /dev/null @@ -1,81 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -use ink_lang as ink; - -#[ink::contract(version = "0.1.0", env = PolymeshRuntimeTypes)] -#[allow(non_snake_case)] -mod RuntimeInteraction { - use custom_ink_env_types::{ - calls as runtime_calls, AssetTransferRules, PolymeshRuntimeTypes, Ticker, - }; - use ink_core::{env, hash::Blake2x128, storage}; - use ink_prelude::{format, vec, vec::Vec}; - use scale::Encode; - - /// Defines the storage of your contract. - /// Add new fields to the below struct in order - /// to add new static storage fields to your contract. - #[ink(storage)] - struct RuntimeInteractionStorage {} - - impl RuntimeInteractionStorage { - /// Constructor. - #[ink(constructor)] - fn new(&mut self) {} - - #[ink(message)] - fn read_compliance_manager_storage(&self, ticker: Ticker) -> AssetTransferRules { - // Read the storage of compliance transfer manager - // Read the map storage - // Twox128(module_prefix) ++ Twox128(storage_prefix) ++ Hasher(encode(key)) - - let mut key = vec![ - // Precomputed: Twox128("ComplianceManager") - 255, 219, 199, 116, 193, 144, 129, 130, 221, 228, 247, 53, 193, 10, 8, 220, - // Precomputed: Twox128("AssetRulesMap") - 43, 166, 32, 27, 86, 56, 171, 63, 215, 7, 88, 63, 149, 251, 213, 120, - ]; - - let encoded_ticker = &ticker.encode(); - - let mut blake2_128 = Blake2x128::from(Vec::new()); - let hashed_ticker = blake2_128.hash_raw(&encoded_ticker); - - // The hasher is `Blake2_128Concat` which appends the unhashed account to the hashed account - key.extend_from_slice(&hashed_ticker); - key.extend_from_slice(&encoded_ticker); - - // fetch from runtime storage - let result = self.env().get_runtime_storage::(&key[..]); - env::println(&format!("PRINT THE KEY {:?}", key)); - match result { - Some(Ok(asset_compliance)) => { - env::println(&format!("AssetCompliances {:?}", asset_compliance)); - asset_compliance - } - Some(Err(err)) => { - env::println(&format!("Error reading AssetCompliances {:?}", err)); - AssetCompliances::default() - } - None => { - env::println(&format!("No data at key {:?}", key)); - AssetCompliances::default() - } - } - } - - #[ink(message)] - fn call_runtime_dispatch(&self, ticker: Ticker, id: u32) { - // Creating the instance of the runtime call - let remove_requirement_call = - runtime_calls::cm_remove_compliance_requirement(ticker, id); - // dispatch the call to the runtime - let result = self.env().invoke_runtime(&remove_requirement_call); - // Print the result if the async call - env::println(&format!( - "Remove active call invoke_runtime result {:?}", - result - )); - } - } -} diff --git a/contracts/examples/custom-ink-env-types/.gitignore b/contracts/examples/custom-ink-env-types/.gitignore deleted file mode 100644 index bf910de10a..0000000000 --- a/contracts/examples/custom-ink-env-types/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Ignore build artifacts from the local tests sub-crate. -/target/ - -# Ignore backup files creates by cargo fmt. -**/*.rs.bk - -# Remove Cargo.lock when creating an executable, leave it for libraries -# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock \ No newline at end of file diff --git a/contracts/examples/custom-ink-env-types/Cargo.toml b/contracts/examples/custom-ink-env-types/Cargo.toml deleted file mode 100644 index d29d3474d1..0000000000 --- a/contracts/examples/custom-ink-env-types/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "custom-ink-env-types" -version = "0.1.0" -authors = ["Polymath Inc."] -edition = "2018" - -[dependencies] -ink_core = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_core", default-features = false } -ink_prelude = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", package = "ink_prelude", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -scale = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.104", optional = true, features = ["derive"] } -scale-info = { version = "0.3", default-features = false, features = ["derive"], optional = true } -derive_more = { version = "0.99", default-features = false, features = ["from", "display"] } -sp-io = { version = "3.0.0", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] } - -[dependencies.type-metadata] -git = "https://github.com/type-metadata/type-metadata.git" -rev = "02eae9f35c40c943b56af5b60616219f2b72b47d" -default-features = false -features = ["derive"] -optional = true - -[features] -default = ["std"] -std = [ - "serde", - "scale-info", - "scale-info/std", - "scale/std", - "sp-io/std", - "sp-runtime/std", - "ink_core/std", -] -ink-generate-abi = [ - "std", - "type-metadata", - "ink_core/ink-generate-abi", -] -no_std = [ ] - -[workspace] -members = [] diff --git a/contracts/examples/custom-ink-env-types/src/calls.rs b/contracts/examples/custom-ink-env-types/src/calls.rs deleted file mode 100644 index 4c54e62aec..0000000000 --- a/contracts/examples/custom-ink-env-types/src/calls.rs +++ /dev/null @@ -1,51 +0,0 @@ -use crate::{Condition, Ticker}; -use ink_prelude::vec::Vec; -use scale::{Codec, Decode, Encode}; -use sp_runtime::traits::Member; - -/// Default runtime Call type, a subset of the runtime Call module variants -/// -/// The codec indices of the modules *MUST* match those in the concrete runtime. -#[derive(Encode, Decode)] -#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))] -pub enum Call { - #[codec(index = "27")] - ComplianceManager(ComplianceManager), -} - -impl From> for Call { - fn from(compliance_manager_call: ComplianceManager) -> Call { - Call::ComplianceManager(compliance_manager_call) - } -} -/// Generic ComplianceManager Call, could be used with other runtimes -#[derive(Encode, Decode, Clone, PartialEq, Eq)] -pub enum ComplianceManager -where - Condition: Member + Codec, - Ticker: Member + Codec, -{ - #[allow(non_camel_case_types)] - add_compliance_requirement(Ticker, Vec, Vec), - #[allow(non_camel_case_types)] - remove_compliance_requirement(Ticker, u32), -} - -/// Construct a `ComplianceManager::remove_compliance_requirement` call -pub fn cm_remove_compliance_requirement(ticker: Ticker, id: u32) -> Call { - ComplianceManager::::remove_compliance_requirement(ticker, id).into() -} - -/// Construct a `ComplianceManager::add_compliance_requirement` call -pub fn cm_add_compliance_requirement( - ticker: Ticker, - sender_conditions: Vec, - receiver_conditions: Vec, -) -> Call { - ComplianceManager::::add_compliance_requirement( - ticker, - sender_conditions, - receiver_conditions, - ) - .into() -} diff --git a/contracts/examples/custom-ink-env-types/src/lib.rs b/contracts/examples/custom-ink-env-types/src/lib.rs deleted file mode 100644 index 819fb43d23..0000000000 --- a/contracts/examples/custom-ink-env-types/src/lib.rs +++ /dev/null @@ -1,208 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -use core::{array::TryFromSliceError, convert::TryFrom}; -use derive_more::From; -use ink_core::env::Clear; -use ink_core::storage::Flush; -use ink_prelude::vec::Vec; -use scale::{Decode, Encode}; -#[cfg(feature = "std")] -use scale_info::TypeInfo; -#[cfg(feature = "std")] -use serde::{Deserialize, Serialize}; - -pub mod calls; - -/// Contract environment types defined in substrate node-runtime -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum PolymeshRuntimeTypes {} - -/// The default balance type. -pub type Balance = u128; - -/// The default timestamp type. -pub type Timestamp = u64; - -/// The default block number type. -pub type BlockNumber = u64; - -/// The default environment `AccountId` type. -/// -/// # Note -/// -/// This is a mirror of the `AccountId` type used in the default configuration -/// of PALLET contracts. -#[derive( - Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode, From, Default, -)] -#[cfg_attr(feature = "std", derive(TypeInfo))] -pub struct AccountId([u8; 32]); - -impl<'a> TryFrom<&'a [u8]> for AccountId { - type Error = TryFromSliceError; - - fn try_from(bytes: &'a [u8]) -> Result { - let address = <[u8; 32]>::try_from(bytes)?; - Ok(Self(address)) - } -} - -/// The default environment `Hash` type. -/// -/// # Note -/// -/// This is a mirror of the `Hash` type used in the default configuration -/// of PALLET contracts. -#[derive( - Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Encode, Decode, From, Default, -)] -#[cfg_attr(feature = "std", derive(TypeInfo))] -pub struct Hash([u8; 32]); - -impl<'a> TryFrom<&'a [u8]> for Hash { - type Error = TryFromSliceError; - - fn try_from(bytes: &'a [u8]) -> Result { - let address = <[u8; 32]>::try_from(bytes)?; - Ok(Self(address)) - } -} - -impl AsRef<[u8]> for Hash { - fn as_ref(&self) -> &[u8] { - &self.0[..] - } -} - -impl AsMut<[u8]> for Hash { - fn as_mut(&mut self) -> &mut [u8] { - &mut self.0[..] - } -} - -impl Clear for Hash { - fn is_clear(&self) -> bool { - self.as_ref().iter().all(|&byte| byte == 0x00) - } - - fn clear() -> Self { - Self([0x00; 32]) - } -} - -impl ink_core::env::EnvTypes for PolymeshRuntimeTypes { - type AccountId = AccountId; - type Balance = Balance; - type Hash = Hash; - type Timestamp = Timestamp; - type BlockNumber = BlockNumber; - type Call = calls::Call; -} - -const TICKER_LEN: usize = 12; - -#[derive(Decode, Encode, PartialEq, Ord, Eq, PartialOrd, Copy, Hash, Clone, Default, Debug)] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct IdentityId([u8; 32]); - -impl Flush for IdentityId {} - -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Decode, Encode, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] -pub struct JurisdictionName(pub Vec); - -/// Scope: Almost all claim needs a valid scope identity. -pub type Scope = IdentityId; - -/// All possible claims in polymesh -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] -pub enum Claim { - /// User is Accredited - Accredited(Scope), - /// User is Accredited - Affiliate(Scope), - /// User has an active BuyLockup (end date defined in claim expiry) - BuyLockup(Scope), - /// User has an active SellLockup (date defined in claim expiry) - SellLockup(Scope), - /// User has passed CDD - CustomerDueDiligence, - /// User is KYC'd - KnowYourCustomer(Scope), - /// This claim contains a string that represents the jurisdiction of the user - Jurisdiction(JurisdictionName, Scope), - /// User is exempted - Exempted(Scope), - /// User is Blocked - Blocked(Scope), - /// Empty claim - NoData, -} - -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] -/// It defines the type of Condition supported, and the filter information we will use to evaluate as a -/// predicate. -pub enum ConditionType { - /// Condition to ensure that claim filter produces one claim. - IsPresent(Claim), - /// Condition to ensure that claim filter produces an empty list. - IsAbsent(Claim), - /// Condition to ensure that at least one claim is fetched when filter is applied. - IsAnyOf(Vec), - /// Condition to ensure that at none of claims is fetched when filter is applied. - IsNoneOf(Vec), -} - -/// Type of claim requirements that a condition can have -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] -pub struct Condition { - /// Type of condition. - pub condition_type: ConditionType, - /// Trusted issuers. - pub issuers: Vec, -} - -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)] -pub struct ComplianceRequirement { - pub sender_conditions: Vec, - pub receiver_conditions: Vec, - /// Unique identifier of the asset condition - pub id: u32, -} - -/// List of conditions associated to an asset. -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)] -pub struct AssetCompliance { - /// This flag indicates if asset transfer conditions are active or paused. - pub is_paused: bool, - /// List of conditions. - pub requirements: Vec, -} - -/// Ticker symbol. -/// -/// This type stores fixed-length case-sensitive byte strings. Any value of this type that is -/// received by a Substrate module call method has to be converted to canonical uppercase -/// representation using [`Ticker::canonize`]. -#[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] -#[derive(Encode, Decode, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] -pub struct Ticker([u8; TICKER_LEN]); - -impl Default for Ticker { - fn default() -> Self { - Ticker([0u8; TICKER_LEN]) - } -} diff --git a/errors_schema.json b/errors_schema.json new file mode 100644 index 0000000000..e617916d6a --- /dev/null +++ b/errors_schema.json @@ -0,0 +1,593 @@ +{ + "InvalidModuleError": { + "_enum": [ "Invalid" ] + }, + "ModuleNoErrors": { + "_enum": [ "None" ] + }, + "SystemError": { + "_enum": [ + "InvalidSpecName", + "SpecVersionNeedsToIncrease", + "FailedToExtractRuntimeVersion", + "NonDefaultComposite", + "NonZeroRefCount" + ] + }, + "AuthorshipError": { + "_enum": [ + "InvalidUncleParent", + "UnclesAlreadySet", + "TooManyUncles", + "GenesisUncle", + "TooHighUncle", + "UncleAlreadyIncluded", + "OldUncle" + ] + }, + "BalancesError": { + "_enum": [ + "LiquidityRestrictions", + "Overflow", + "InsufficientBalance", + "ExistentialDeposit", + "ReceiverCddMissing" + ] + }, + "IdentityError": { + "_enum": [ + "AlreadyLinked", + "MissingCurrentIdentity", + "Unauthorized", + "InvalidAccountKey", + "UnAuthorizedCddProvider", + "InvalidAuthorizationFromOwner", + "InvalidAuthorizationFromCddProvider", + "NotCddProviderAttestation", + "AuthorizationsNotForSameDids", + "DidMustAlreadyExist", + "CurrentIdentityCannotBeForwarded", + "AuthorizationExpired", + "TargetHasNoCdd", + "AuthorizationHasBeenRevoked", + "InvalidAuthorizationSignature", + "KeyNotAllowed", + "NotPrimaryKey", + "DidDoesNotExist", + "DidAlreadyExists", + "SecondaryKeysContainPrimaryKey", + "FailedToChargeFee", + "NotASigner", + "CannotDecodeSignerAccountId", + "MultiSigHasBalance", + "ConfidentialScopeClaimNotAllowed", + "InvalidScopeClaim", + "ClaimVariantNotAllowed", + "TargetHasNonZeroBalanceAtScopeId", + "CDDIdNotUniqueForIdentity", + "InvalidCDDId", + "ClaimAndProofVersionsDoNotMatch", + "AccountKeyIsBeingUsed", + "CustomScopeTooLong" + ] + }, + "CddServiceProvidersError": { + "_enum": [ + "OnlyPrimaryKeyAllowed", + "DuplicateMember", + "NoSuchMember", + "LastMemberCannotQuit", + "MissingCurrentIdentity", + "ActiveMembersLimitExceeded", + "ActiveMembersLimitOverflow" + ] + }, + "PolymeshCommitteeError": { + "_enum": [ + "DuplicateVote", + "NotAMember", + "NoSuchProposal", + "ProposalExpired", + "DuplicateProposal", + "MismatchedVotingIndex", + "InvalidProportion", + "FirstVoteReject", + "ProposalsLimitReached" + ] + }, + "CommitteeMembershipError": { + "_enum": [ + "OnlyPrimaryKeyAllowed", + "DuplicateMember", + "NoSuchMember", + "LastMemberCannotQuit", + "MissingCurrentIdentity", + "ActiveMembersLimitExceeded", + "ActiveMembersLimitOverflow" + ] + }, + "TechnicalCommitteeError": { + "_enum": [ + "DuplicateVote", + "NotAMember", + "NoSuchProposal", + "ProposalExpired", + "DuplicateProposal", + "MismatchedVotingIndex", + "InvalidProportion", + "FirstVoteReject", + "ProposalsLimitReached" + ] + }, + "TechnicalCommitteeMembershipError": { + "_enum": [ + "OnlyPrimaryKeyAllowed", + "DuplicateMember", + "NoSuchMember", + "LastMemberCannotQuit", + "MissingCurrentIdentity", + "ActiveMembersLimitExceeded", + "ActiveMembersLimitOverflow" + ] + }, + "UpgradeCommitteeError": { + "_enum": [ + "DuplicateVote", + "NotAMember", + "NoSuchProposal", + "ProposalExpired", + "DuplicateProposal", + "MismatchedVotingIndex", + "InvalidProportion", + "FirstVoteReject", + "ProposalsLimitReached" + ] + }, + "UpgradeCommitteeMembershipError": { + "_enum": [ + "OnlyPrimaryKeyAllowed", + "DuplicateMember", + "NoSuchMember", + "LastMemberCannotQuit", + "MissingCurrentIdentity", + "ActiveMembersLimitExceeded", + "ActiveMembersLimitOverflow" + ] + }, + "MultiSigError": { + "_enum": [ + "CddMissing", + "ProposalMissing", + "DecodingError", + "NoSigners", + "RequiredSignaturesOutOfBounds", + "NotASigner", + "NoSuchMultisig", + "NotEnoughSigners", + "NonceOverflow", + "AlreadyVoted", + "AlreadyASigner", + "FailedToChargeFee", + "IdentityNotCreator", + "ChangeNotAllowed", + "SignerAlreadyLinked", + "MissingCurrentIdentity", + "NotPrimaryKey", + "ProposalAlreadyRejected", + "ProposalExpired", + "ProposalAlreadyExecuted", + "MultisigMissingIdentity", + "FailedToSchedule", + "TooManySigners" + ] + }, + "BridgeError": { + "_enum": [ + "ControllerNotSet", + "BadCaller", + "BadAdmin", + "NoValidCdd", + "ProposalAlreadyHandled", + "Unauthorized", + "Frozen", + "NotFrozen", + "FrozenTx", + "BridgeLimitReached", + "Overflow", + "DivisionByZero", + "TimelockedTx" + ] + }, + "StakingError": { + "_enum": [ + "NotController", + "NotStash", + "AlreadyBonded", + "AlreadyPaired", + "EmptyTargets", + "InvalidSlashIndex", + "InsufficientValue", + "NoMoreChunks", + "NoUnlockChunk", + "FundedTarget", + "InvalidEraToReward", + "NotSortedAndUnique", + "AlreadyClaimed", + "OffchainElectionEarlySubmission", + "OffchainElectionWeakSubmission", + "SnapshotUnavailable", + "OffchainElectionBogusWinnerCount", + "OffchainElectionBogusWinner", + "OffchainElectionBogusCompact", + "OffchainElectionBogusNominator", + "OffchainElectionBogusNomination", + "OffchainElectionSlashedNomination", + "OffchainElectionBogusSelfVote", + "OffchainElectionBogusEdge", + "OffchainElectionBogusScore", + "OffchainElectionBogusElectionSize", + "CallNotAllowed", + "IncorrectSlashingSpans", + "AlreadyExists", + "NotExists", + "NoChange", + "InvalidValidatorIdentity", + "InvalidValidatorCommission", + "StashIdentityDoesNotExist", + "StashIdentityNotPermissioned", + "StashIdentityNotCDDed", + "HitIntendedValidatorCount", + "IntendedCountIsExceedingConsensusLimit", + "BondTooSmall", + "BadState", + "TooManyTargets", + "BadTarget" + ] + }, + "SessionError": { + "_enum": [ + "InvalidProof", + "NoAssociatedValidatorId", + "DuplicatedKey", + "NoKeys", + "NoAccount" + ] + }, + "GrandpaError": { + "_enum": [ + "PauseFailed", + "ResumeFailed", + "ChangePending", + "TooSoon", + "InvalidKeyOwnershipProof", + "InvalidEquivocationProof", + "DuplicateOffenceReport" + ] + }, + "ImOnlineError": { + "_enum": [ + "InvalidKey", + "DuplicatedHeartbeat" + ] + }, + "SudoError": { + "_enum": [ + "RequireSudo" + ] + }, + "AssetError": { + "_enum": [ + "Unauthorized", + "AlreadyArchived", + "AlreadyUnArchived", + "ExtensionAlreadyPresent", + "AssetAlreadyCreated", + "TickerTooLong", + "TickerNotAscii", + "TickerAlreadyRegistered", + "TotalSupplyAboveLimit", + "NoSuchAsset", + "AlreadyFrozen", + "NotAnOwner", + "BalanceOverflow", + "TotalSupplyOverflow", + "InvalidGranularity", + "NotFrozen", + "InvalidTransfer", + "InsufficientBalance", + "AssetAlreadyDivisible", + "MaximumTMExtensionLimitReached", + "IncompatibleExtensionVersion", + "InvalidEthereumSignature", + "NoSuchClassicTicker", + "TickerRegistrationExpired", + "SenderSameAsReceiver", + "NoSuchDoc", + "MaxLengthOfAssetNameExceeded", + "FundingRoundNameMaxLengthExceeded", + "InvalidAssetIdentifier", + "InvestorUniquenessClaimNotAllowed", + "InvalidCustomAssetTypeId" + ] + }, + "CapitalDistributionError": { + "_enum": [ + "CANotBenefit", + "AlreadyExists", + "ExpiryBeforePayment", + "HolderAlreadyPaid", + "NoSuchDistribution", + "CannotClaimBeforeStart", + "CannotClaimAfterExpiry", + "BalancePerShareProductOverflowed", + "NotDistributionCreator", + "AlreadyReclaimed", + "NotExpired", + "DistributionStarted", + "InsufficientRemainingAmount" + ] + }, + "CheckpointError": { + "_enum": [ + "NoSuchSchedule", + "ScheduleNotRemovable", + "FailedToComputeNextCheckpoint", + "ScheduleDurationTooShort", + "SchedulesTooComplex" + ] + }, + "ComplianceManagerError": { + "_enum": [ + "Unauthorized", + "DidNotExist", + "InvalidComplianceRequirementId", + "IncorrectOperationOnTrustedIssuer", + "DuplicateComplianceRequirements", + "ComplianceRequirementTooComplex" + ] + }, + "CorporateActionError": { + "_enum": [ + "AuthNotCAATransfer", + "DetailsTooLong", + "DuplicateDidTax", + "TooManyDidTaxes", + "TooManyTargetIds", + "NoSuchCheckpointId", + "NoSuchCA", + "NoRecordDate", + "RecordDateAfterStart", + "DeclDateAfterRecordDate", + "DeclDateInFuture", + "NotTargetedByCA" + ] + }, + "CorporateBallotError": { + "_enum": [ + "CANotNotice", + "AlreadyExists", + "NoSuchBallot", + "StartAfterEnd", + "NowAfterEnd", + "NumberOfChoicesOverflow", + "VotingAlreadyStarted", + "VotingNotStarted", + "VotingAlreadyEnded", + "WrongVoteCount", + "InsufficientVotes", + "NoSuchRCVFallback", + "RCVSelfCycle", + "RCVNotAllowed" + ] + }, + "PermissionsError": { + "_enum": [ + "UnauthorizedCaller" + ] + }, + "PipsError": { + "_enum": [ + "RescheduleNotByReleaseCoordinator", + "NotFromCommunity", + "NotByCommittee", + "TooManyActivePips", + "IncorrectDeposit", + "InsufficientDeposit", + "NoSuchProposal", + "NotACommitteeMember", + "InvalidFutureBlockNumber", + "NumberOfVotesExceeded", + "StakeAmountOfVotesExceeded", + "MissingCurrentIdentity", + "IncorrectProposalState", + "CannotSkipPip", + "SnapshotResultTooLarge", + "SnapshotIdMismatch", + "ScheduledProposalDoesntExist", + "ProposalNotInScheduledState" + ] + }, + "PortfolioError": { + "_enum": [ + "PortfolioDoesNotExist", + "InsufficientPortfolioBalance", + "DestinationIsSamePortfolio", + "PortfolioNameAlreadyInUse", + "SecondaryKeyNotAuthorizedForPortfolio", + "UnauthorizedCustodian", + "InsufficientTokensLocked", + "PortfolioNotEmpty", + "DifferentIdentityPortfolios" + ] + }, + "ProtocolFeeError": { + "_enum": [ + "InsufficientAccountBalance", + "UnHandledImbalances", + "InsufficientSubsidyBalance" + ] + }, + "SchedulerError": { + "_enum": [ + "FailedToSchedule", + "NotFound", + "TargetBlockNumberInPast", + "RescheduleNoChange" + ] + }, + "SettlementError": { + "_enum": [ + "InvalidVenue", + "Unauthorized", + "NoPendingAffirm", + "InstructionNotAffirmed", + "InstructionNotPending", + "InstructionNotFailed", + "LegNotPending", + "UnauthorizedSigner", + "ReceiptAlreadyClaimed", + "ReceiptNotClaimed", + "UnauthorizedVenue", + "FailedToLockTokens", + "InstructionFailed", + "InstructionDatesInvalid", + "InstructionSettleBlockPassed", + "InvalidSignature", + "SameSenderReceiver", + "PortfolioMismatch", + "SettleOnPastBlock", + "NoPortfolioProvided", + "UnexpectedAffirmationStatus", + "FailedToSchedule", + "LegCountTooSmall", + "UnknownInstruction", + "InstructionHasTooManyLegs" + ] + }, + "StatisticsError": { + "_enum": [ + "DuplicateTransferManager", + "TransferManagerMissing", + "InvalidTransfer", + "TransferManagersLimitReached" + ] + }, + "StoError": { + "_enum": [ + "Unauthorized", + "Overflow", + "InsufficientTokensRemaining", + "FundraiserNotFound", + "FundraiserNotLive", + "FundraiserClosed", + "FundraiserExpired", + "InvalidVenue", + "InvalidPriceTiers", + "InvalidOfferingWindow", + "MaxPriceExceeded", + "InvestmentAmountTooLow" + ] + }, + "TreasuryError": { + "_enum": [ + "InsufficientBalance" + ] + }, + "UtilityError": { + "_enum": [ + "InvalidSignature", + "TargetCddMissing", + "InvalidNonce" + ] + }, + "BaseError": { + "_enum": [ + "TooLong", + "CounterOverflow" + ] + }, + "ExternalAgentsError": { + "_enum": [ + "NoSuchAG", + "UnauthorizedAgent", + "AlreadyAnAgent", + "NotAnAgent", + "RemovingLastFullAgent", + "SecondaryKeyNotAuthorizedForAsset" + ] + }, + "RelayerError": { + "_enum": [ + "UserKeyCddMissing", + "PayingKeyCddMissing", + "NoPayingKey", + "NotPayingKey", + "NotAuthorizedForPayingKey", + "NotAuthorizedForUserKey", + "Overflow" + ] + }, + "RewardsError": { + "_enum": [ + "UnknownItnAddress", + "ItnRewardAlreadyClaimed", + "InvalidSignature", + "UnableToCovertBalance" + ] + }, + "DispatchErrorModule": { + "_enum": { + "System": "SystemError", + "Babe": "ModuleNoErrors", + "Timestamp": "ModuleNoErrors", + "Indices": "ModuleNoErrors", + "Authorship": "AuthorshipError", + "Balances": "BalancesError", + "TransactionPayment": "ModuleNoErrors", + "Identity": "IdentityError", + "CddServiceProviders": "CddServiceProvidersError", + "PolymeshCommittee": "PolymeshCommitteeError", + "CommitteeMembership": "CommitteeMembershipError", + "TechnicalCommittee": "TechnicalCommitteeError", + "TechnicalCommitteeMembership": "TechnicalCommitteeMembershipError", + "UpgradeCommittee": "UpgradeCommitteeError", + "UpgradeCommitteeMembership": "UpgradeCommitteeMembershipError", + "MultiSig": "MultiSigError", + "Bridge": "BridgeError", + "Staking": "StakingError", + "Offences": "ModuleNoErrors", + "Session": "SessionError", + "AuthorityDiscovery": "ModuleNoErrors", + "Grandpa": "GrandpaError", + "Historical": "ModuleNoErrors", + "ImOnline": "ImOnlineError", + "RandomnessCollectiveFlip": "ModuleNoErrors", + "Sudo": "SudoError", + "Asset": "AssetError", + "CapitalDistribution": "CapitalDistributionError", + "Checkpoint": "CheckpointError", + "ComplianceManager": "ComplianceManagerError", + "CorporateAction": "CorporateActionError", + "CorporateBallot": "CorporateBallotError", + "Permissions": "PermissionsError", + "Pips": "PipsError", + "Portfolio": "PortfolioError", + "ProtocolFee": "ProtocolFeeError", + "Scheduler": "SchedulerError", + "Settlement": "SettlementError", + "Statistics": "StatisticsError", + "Sto": "StoError", + "Treasury": "TreasuryError", + "Utility": "UtilityError", + "Base": "BaseError", + "ExternalAgents": "ExternalAgentsError", + "Relayer": "RelayerError", + "Rewards": "RewardsError", + "InvalidModule46": "InvalidModuleError", + "InvalidModule47": "InvalidModuleError", + "InvalidModule48": "InvalidModuleError", + "InvalidModule49": "InvalidModuleError", + "TestUtils": "ModuleNoErrors" + } + } +} diff --git a/migration-tests/Cargo.toml b/migration-tests/Cargo.toml index 573ea900b7..e216ffcd2d 100644 --- a/migration-tests/Cargo.toml +++ b/migration-tests/Cargo.toml @@ -2,7 +2,7 @@ name = "migration-tests" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] futures = "0.3" @@ -15,8 +15,8 @@ sp-state-machine-old = { package = "sp-state-machine", git = "https://github.com # New migration helpers remote-externalities = { path = "remote-externalities" } -frame-support = { version = "3.0.0" } -sp-core = { version = "3.0.0" } +frame-support = { version = "4.0.0-dev" } +sp-core = { version = "6.0.0" } # Old pallets polymesh-runtime-old = { package = "polymesh-runtime-testnet", git = "https://github.com/PolymathNetwork/Polymesh", rev = "14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" } diff --git a/migration-tests/remote-externalities/Cargo.toml b/migration-tests/remote-externalities/Cargo.toml index b914574166..e768dc275e 100644 --- a/migration-tests/remote-externalities/Cargo.toml +++ b/migration-tests/remote-externalities/Cargo.toml @@ -2,12 +2,12 @@ name = "remote-externalities" version = "0.1.0" authors = ["kianenigma "] -edition = "2018" +edition = "2021" [dependencies] jsonrpc-core-client = { version = "15.1.0", features = ["http"] } -sc-rpc-api = { version = "0.9.0" } -sc-rpc = { version = "3.0.0" } +sc-rpc-api = { version = "0.10.0-dev" } +sc-rpc = { version = "4.0.0-dev" } futures = "0.1.29" hex-literal = "0.3.1" @@ -16,8 +16,8 @@ log = "0.4.11" bincode = "1.3.1" tokio = "0.1.22" -sp-io = { version = "3.0.0" } -sp-core = { version = "3.0.0" } +sp-io = { version = "6.0.0" } +sp-core = { version = "6.0.0" } [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } diff --git a/node-rpc/Cargo.toml b/node-rpc/Cargo.toml index 5739bfe859..9e05c2b970 100644 --- a/node-rpc/Cargo.toml +++ b/node-rpc/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-node-rpc" version = "0.1.0" authors = ["Parity Technologies "] -edition = "2018" +edition = "2021" license = "Apache-2.0" repository = "https://github.com/PolymathNetwork/substrate" @@ -11,33 +11,33 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] polymesh-primitives = { path = "../primitives", default-features = false } -#pallet-contracts-rpc = { version = "3.0.0" } +pallet-contracts-rpc = { version = "4.0.0-dev" } pallet-group-rpc = { path = "../pallets/group/rpc" } pallet-staking-rpc = { path = "../pallets/staking/rpc" } pallet-protocol-fee-rpc = { path = "../pallets/protocol-fee/rpc" } node-rpc = { path = "../rpc" } -jsonrpc-core = { version = "15.0", features = ["arbitrary_precision"] } +jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } -sp-blockchain = { version = "3.0.0" } -sp-runtime = { version = "3.0.0" } -sp-api = { version = "3.0.0" } -sc-client-api = { version = "3.0.0" } -sp-consensus = { version = "0.9.0" } -sp-consensus-babe = { version = "0.9.0" } -sp-block-builder = { version = "3.0.0" } -sp-keystore = { version = "0.9.0" } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } +sp-blockchain = { version = "4.0.0-dev" } +sp-runtime = { version = "6.0.0" } +sp-api = { version = "4.0.0-dev" } +sc-client-api = { version = "4.0.0-dev" } +sp-consensus = { version = "0.10.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev" } +sp-block-builder = { version = "4.0.0-dev" } +sp-keystore = { version = "0.12.0" } -sc-rpc = { version = "3.0.0" } -sc-rpc-api = { version = "0.9.0" } -sc-chain-spec = { version = "3.0.0" } -sc-consensus-babe = { version = "0.9.0" } -sc-consensus-babe-rpc = { version = "0.9.0" } -sc-consensus-epochs = { version = "0.9.0" } -sc-finality-grandpa = { version = "0.9.0" } -sc-finality-grandpa-rpc = { version = "0.9.0" } -sc-keystore = { version = "3.0.0" } -sc-sync-state-rpc = { version = "0.9.0" } -sp-transaction-pool = { version = "3.0.0" } -substrate-frame-rpc-system = { version = "3.0.0" } +sc-rpc = { version = "4.0.0-dev" } +sc-rpc-api = { version = "0.10.0-dev" } +sc-chain-spec = { version = "4.0.0-dev" } +sc-consensus-babe = { version = "0.10.0-dev" } +sc-consensus-babe-rpc = { version = "0.10.0-dev" } +sc-consensus-epochs = { version = "0.10.0-dev" } +sc-finality-grandpa = { version = "0.10.0-dev" } +sc-finality-grandpa-rpc = { version = "0.10.0-dev" } +sc-keystore = { version = "4.0.0-dev" } +sc-sync-state-rpc = { version = "0.10.0-dev" } +sc-transaction-pool-api = { version = "4.0.0-dev" } +substrate-frame-rpc-system = { version = "4.0.0-dev" } diff --git a/node-rpc/src/lib.rs b/node-rpc/src/lib.rs index 06cb7f567d..cdbf5f00f2 100644 --- a/node-rpc/src/lib.rs +++ b/node-rpc/src/lib.rs @@ -31,7 +31,7 @@ #![warn(missing_docs)] use polymesh_primitives::{ - AccountId, Block, BlockNumber, Hash, IdentityId, Index, Moment, SecondaryKey, Signatory, Ticker, + AccountId, Balance, Block, BlockNumber, Hash, IdentityId, Index, Moment, Ticker, }; use sc_client_api::AuxStore; use sc_consensus_babe::{Config, Epoch}; @@ -40,27 +40,15 @@ use sc_finality_grandpa::{ FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, }; use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_consensus::SelectChain; use sp_consensus_babe::BabeApi; use sp_keystore::SyncCryptoStorePtr; -use sp_transaction_pool::TransactionPool; use std::sync::Arc; -/// Light client extra dependencies. -pub struct LightDeps { - /// The client instance to use. - pub client: Arc, - /// Transaction pool instance. - pub pool: Arc

, - /// Remote access to the blockchain (async). - pub remote_blockchain: Arc>, - /// Fetcher instance. - pub fetcher: Arc, -} - /// Extra dependencies for BABE. pub struct BabeDeps { /// BABE protocol config. @@ -109,7 +97,7 @@ pub type IoHandler = jsonrpc_core::IoHandler; /// Instantiate all Full RPC extensions. pub fn create_full( deps: FullDeps, -) -> jsonrpc_core::IoHandler +) -> Result, Box> where C: ProvideRuntimeApi + HeaderBackend @@ -119,19 +107,11 @@ where + Send + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, - //C::Api: pallet_contracts_rpc::ContractsRuntimeApi, + C::Api: pallet_contracts_rpc::ContractsRuntimeApi, C::Api: node_rpc::transaction_payment::TransactionPaymentRuntimeApi, C::Api: pallet_staking_rpc::StakingRuntimeApi, C::Api: node_rpc::pips::PipsRuntimeApi, - C::Api: node_rpc::identity::IdentityRuntimeApi< - Block, - IdentityId, - Ticker, - AccountId, - SecondaryKey, - Signatory, - Moment, - >, + C::Api: node_rpc::identity::IdentityRuntimeApi, C::Api: pallet_protocol_fee_rpc::ProtocolFeeRuntimeApi, C::Api: node_rpc::asset::AssetRuntimeApi, C::Api: pallet_group_rpc::GroupRuntimeApi, @@ -151,7 +131,7 @@ where pips::{Pips, PipsApi}, transaction_payment::{TransactionPayment, TransactionPaymentApi}, }; - //use pallet_contracts_rpc::{Contracts, ContractsApi}; + use pallet_contracts_rpc::{Contracts, ContractsApi}; use pallet_group_rpc::{Group, GroupApi}; use pallet_protocol_fee_rpc::{ProtocolFee, ProtocolFeeApi}; use pallet_staking_rpc::{Staking, StakingApi}; @@ -191,7 +171,7 @@ where // Making synchronous calls in light client freezes the browser currently, // more context: https://github.com/PolymathNetwork/substrate/pull/3480 // These RPCs should use an asynchronous caller instead. - //io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone()))); + io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone()))); io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( client.clone(), ))); @@ -221,8 +201,7 @@ where client.clone(), shared_authority_set, shared_epoch_changes, - deny_unsafe, - ), + )?, )); io.extend_with(StakingApi::to_delegate(Staking::new(client.clone()))); io.extend_with(PipsApi::to_delegate(Pips::new(client.clone()))); @@ -236,34 +215,5 @@ where client, ))); - io -} - -/// Instantiate all Light RPC extensions. -pub fn create_light(deps: LightDeps) -> jsonrpc_core::IoHandler -where - C: sp_blockchain::HeaderBackend, - C: ProvideRuntimeApi, - C: Send + Sync + 'static, - F: sc_client_api::light::Fetcher + 'static, - P: TransactionPool + 'static, - M: jsonrpc_core::Metadata + Default, - C::Api: substrate_frame_rpc_system::AccountNonceApi - + node_rpc::transaction_payment::TransactionPaymentRuntimeApi, - UE: codec::Codec + 'static, -{ - use substrate_frame_rpc_system::{LightSystem, SystemApi}; - - let LightDeps { - client, - pool, - remote_blockchain, - fetcher, - } = deps; - let mut io = jsonrpc_core::IoHandler::default(); - io.extend_with(SystemApi::::to_delegate( - LightSystem::new(client, remote_blockchain, fetcher, pool), - )); - - io + Ok(io) } diff --git a/pallets/asset/Cargo.toml b/pallets/asset/Cargo.toml index b9b098ffd5..4df160094c 100644 --- a/pallets/asset/Cargo.toml +++ b/pallets/asset/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-asset" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -13,7 +13,7 @@ polymesh-common-utilities = { path = "../common", default-features = false } # Our Pallets pallet-balances = { path = "../balances", default-features = false } pallet-base = { path = "../base", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } +#pallet-contracts = { version = "4.0.0-dev", default-features = false } pallet-external-agents = { path = "../external-agents", default-features = false } pallet-identity = { path = "../identity", default-features = false } pallet-permissions = { path = "../permissions", default-features = false } @@ -30,22 +30,23 @@ hex-literal = "0.2.1" arrayvec = { version = "0.7.1", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } libsecp256k1 = { version = "0.6", default-features = false, features = ["hmac"] } # Only in STD -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] default = ["std"] diff --git a/pallets/asset/src/benchmarking.rs b/pallets/asset/src/benchmarking.rs index 5f42e3a31e..46eefaf731 100644 --- a/pallets/asset/src/benchmarking.rs +++ b/pallets/asset/src/benchmarking.rs @@ -25,7 +25,13 @@ use polymesh_common_utilities::{ }; //use polymesh_contracts::ExtensionInfo; use polymesh_primitives::{ - asset::AssetName, ticker::TICKER_LEN, AuthorizationData, Signatory, Ticker, + asset::AssetName, + asset_metadata::{ + AssetMetadataDescription, AssetMetadataKey, AssetMetadataName, AssetMetadataSpec, + AssetMetadataValue, AssetMetadataValueDetail, + }, + ticker::TICKER_LEN, + AuthorizationData, Signatory, Ticker, Url, }; //use polymesh_primitives::{ExtensionAttributes, SmartExtension}; use sp_io::hashing::keccak_256; @@ -47,6 +53,41 @@ pub fn make_document() -> Document { } } +/// Make metadata name for benchmarking. +fn make_metadata_name() -> AssetMetadataName { + AssetMetadataName(vec![b'n'; T::AssetMetadataNameMaxLength::get() as usize]) +} + +/// Make metadata value for benchmarking. +fn make_metadata_value() -> AssetMetadataValue { + AssetMetadataValue(vec![b'v'; T::AssetMetadataValueMaxLength::get() as usize]) +} + +/// Make metadata spec for benchmarking. +fn make_metadata_spec() -> AssetMetadataSpec { + AssetMetadataSpec { + url: Some(Url(vec![b'u'; T::MaxLen::get() as usize])), + description: Some(AssetMetadataDescription(vec![ + b'd'; + T::MaxLen::get() as usize + ])), + type_def: Some(vec![b'x'; T::AssetMetadataTypeDefMaxLength::get() as usize]), + } +} + +/// Register a global metadata type for benchmarking. +fn register_metadata_global_name() -> AssetMetadataKey { + let root = RawOrigin::Root.into(); + let name = make_metadata_name::(); + let spec = make_metadata_spec::(); + + Module::::register_asset_metadata_global_type(root, name, spec) + .expect("`register_asset_metadata_global_type` failed"); + + let key = Module::::asset_metadata_next_global_key(); + AssetMetadataKey::Global(key) +} + fn make_default_reg_config() -> TickerRegistrationConfig { TickerRegistrationConfig { max_ticker_length: 8, @@ -62,7 +103,7 @@ fn make_classic_ticker(eth_owner: ethereum::EthereumAddress, ticker: is_contract: false, }; let reg_config = make_default_reg_config::(); - let root = frame_system::RawOrigin::Root.into(); + let root = RawOrigin::Root.into(); >::reserve_classic_ticker(root, classic_ticker, 0u128.into(), reg_config) .expect("`reserve_classic_ticker` failed"); @@ -119,7 +160,7 @@ fn emulate_controller_transfer( BalanceOfAtScope::insert(s_id, id, bal); AggregateBalance::insert(ticker, id, bal); ScopeIdOf::insert(ticker, id, s_id); - Statistics::::update_transfer_stats(&ticker, None, Some(bal), bal); + Statistics::::update_asset_stats(&ticker, None, Some(&id), None, Some(bal), bal); }; mock_storage(investor_did, 1000u32.into()); mock_storage(pia, 5000u32.into()); @@ -456,4 +497,36 @@ benchmarks! { verify { assert_ne!(id, Module::::custom_type_id_seq()); } + + set_asset_metadata { + let (owner, ticker) = owned_ticker::(); + let key = register_metadata_global_name::(); + let value = make_metadata_value::(); + let details = Some(AssetMetadataValueDetail::default()); + }: _(owner.origin, ticker, key, value, details) + + set_asset_metadata_details { + let (owner, ticker) = owned_ticker::(); + let key = register_metadata_global_name::(); + let details = AssetMetadataValueDetail::default(); + }: _(owner.origin, ticker, key, details) + + register_and_set_local_asset_metadata { + let (owner, ticker) = owned_ticker::(); + let name = make_metadata_name::(); + let spec = make_metadata_spec::(); + let value = make_metadata_value::(); + let details = Some(AssetMetadataValueDetail::default()); + }: _(owner.origin, ticker, name, spec, value, details) + + register_asset_metadata_local_type { + let (owner, ticker) = owned_ticker::(); + let name = make_metadata_name::(); + let spec = make_metadata_spec::(); + }: _(owner.origin, ticker, name, spec) + + register_asset_metadata_global_type { + let name = make_metadata_name::(); + let spec = make_metadata_spec::(); + }: _(RawOrigin::Root, name, spec) } diff --git a/pallets/asset/src/checkpoint/mod.rs b/pallets/asset/src/checkpoint/mod.rs index 74696a6515..391e1f052a 100644 --- a/pallets/asset/src/checkpoint/mod.rs +++ b/pallets/asset/src/checkpoint/mod.rs @@ -62,6 +62,7 @@ use polymesh_primitives::{ calendar::{CalendarPeriod, CheckpointId, CheckpointSchedule}, storage_migration_ver, EventDid, IdentityId, Moment, Ticker, }; +use scale_info::TypeInfo; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; use sp_std::prelude::*; @@ -73,7 +74,7 @@ type ExternalAgents = pallet_external_agents::Module; /// Input specification for a checkpoint schedule. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, Debug, PartialEq, Eq)] pub struct ScheduleSpec { /// Unix time in milli-seconds. /// When `None`, this is an instruction to use the current time. diff --git a/pallets/asset/src/lib.rs b/pallets/asset/src/lib.rs index af867f28be..4d79b4f70a 100644 --- a/pallets/asset/src/lib.rs +++ b/pallets/asset/src/lib.rs @@ -50,6 +50,10 @@ //! - `remove_documents` - Remove documents for a given token. //! - `set_funding_round` - Sets the name of the current funding round. //! - `update_identifiers` - Updates the asset identifiers. +//! - `set_asset_metadata` - Set asset metadata value. +//! - `set_asset_metadata_details` - Set asset metadata value details (expire, lock status). +//! - `register_asset_metadata_local_type` - Register asset metadata local type. +//! - `register_asset_metadata_global_type` - Register asset metadata global type. //! //! ### Public Functions //! @@ -72,7 +76,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] -#![feature(bool_to_option, const_option)] +#![feature(const_option)] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -100,20 +104,23 @@ use polymesh_common_utilities::{ compliance_manager::Config as ComplianceManagerConfig, constants::*, protocol_fee::{ChargeProtocolFee, ProtocolOp}, - //traits::contracts::ContractsFn, - with_transaction, - SystematicIssuers, + with_transaction, SystematicIssuers, }; use polymesh_primitives::{ agent::AgentGroup, asset::{AssetName, AssetType, CustomAssetTypeId, FundingRoundName, GranularCanTransferResult}, + asset_metadata::{ + AssetMetadataGlobalKey, AssetMetadataKey, AssetMetadataLocalKey, AssetMetadataName, + AssetMetadataSpec, AssetMetadataValue, AssetMetadataValueDetail, + }, calendar::CheckpointId, ethereum::{self, EcdsaSignature, EthereumAddress}, - extract_auth, - statistics::TransferManagerResult, - storage_migrate_on, storage_migration_ver, AssetIdentifier, Balance, Document, DocumentId, - IdentityId, PortfolioId, ScopeId, Ticker, + extract_auth, storage_migrate_on, storage_migration_ver, + transfer_compliance::TransferConditionResult, + AssetIdentifier, Balance, Document, DocumentId, IdentityId, PortfolioId, ScopeId, SecondaryKey, + Ticker, }; +use scale_info::TypeInfo; use sp_runtime::traits::Zero; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; @@ -125,7 +132,7 @@ type Portfolio = pallet_portfolio::Module; type Statistics = pallet_statistics::Module; /// Ownership status of a ticker/token. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum AssetOwnershipRelation { NotOwned, TickerOwned, @@ -139,7 +146,7 @@ impl Default for AssetOwnershipRelation { } /// struct to store the token details. -#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)] +#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Debug)] pub struct SecurityToken { pub total_supply: Balance, pub owner_did: IdentityId, @@ -148,7 +155,7 @@ pub struct SecurityToken { } /// struct to store the ticker registration details. -#[derive(Encode, Decode, Clone, Default, PartialEq, Debug)] +#[derive(Encode, Decode, TypeInfo, Clone, Default, PartialEq, Debug)] pub struct TickerRegistration { pub owner: IdentityId, pub expiry: Option, @@ -156,7 +163,7 @@ pub struct TickerRegistration { /// struct to store the ticker registration config. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Clone, Default, PartialEq, Debug)] +#[derive(Encode, Decode, TypeInfo, Clone, Default, PartialEq, Debug)] pub struct TickerRegistrationConfig { pub max_ticker_length: u8, pub registration_length: Option, @@ -187,7 +194,7 @@ impl Default for RestrictionResult { /// Data imported from Polymath Classic regarding ticker registration/creation. /// Only used at genesis config and not stored on-chain. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, Debug, PartialEq, Eq)] pub struct ClassicTickerImport { /// Owner of the registration. pub eth_owner: EthereumAddress, @@ -201,7 +208,7 @@ pub struct ClassicTickerImport { /// Data about a ticker registration from Polymath Classic on-genesis importation. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq)] pub struct ClassicTickerRegistration { /// Owner of the registration. pub eth_owner: EthereumAddress, @@ -292,6 +299,45 @@ decl_storage! { /// Ticker => bool. pub DisableInvestorUniqueness get(fn disable_iu): map hasher(blake2_128_concat) Ticker => bool; + /// Metatdata values for an asset. + pub AssetMetadataValues get(fn asset_metadata_values): + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) AssetMetadataKey => + Option; + /// Details for an asset's Metadata values. + pub AssetMetadataValueDetails get(fn asset_metadata_value_details): + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) AssetMetadataKey => + Option>; + + /// Asset Metadata Local Name -> Key. + pub AssetMetadataLocalNameToKey get(fn asset_metadata_local_name_to_key): + double_map hasher(blake2_128_concat) Ticker, hasher(blake2_128_concat) AssetMetadataName => + Option; + /// Asset Metadata Global Name -> Key. + pub AssetMetadataGlobalNameToKey get(fn asset_metadata_global_name_to_key): + map hasher(blake2_128_concat) AssetMetadataName => Option; + + /// Asset Metadata Local Key -> Name. + pub AssetMetadataLocalKeyToName get(fn asset_metadata_local_key_to_name): + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) AssetMetadataLocalKey => + Option; + /// Asset Metadata Global Key -> Name. + pub AssetMetadataGlobalKeyToName get(fn asset_metadata_global_key_to_name): + map hasher(twox_64_concat) AssetMetadataGlobalKey => Option; + + /// Asset Metadata Local Key specs. + pub AssetMetadataLocalSpecs get(fn asset_metadata_local_specs): + double_map hasher(blake2_128_concat) Ticker, hasher(twox_64_concat) AssetMetadataLocalKey => + Option; + /// Asset Metadata Global Key specs. + pub AssetMetadataGlobalSpecs get(fn asset_metadata_global_specs): + map hasher(twox_64_concat) AssetMetadataGlobalKey => Option; + + /// Next Asset Metadata Local Key. + pub AssetMetadataNextLocalKey get(fn asset_metadata_next_local_key): + map hasher(blake2_128_concat) Ticker => AssetMetadataLocalKey; + /// Next Asset Metadata Global Key. + pub AssetMetadataNextGlobalKey get(fn asset_metadata_next_global_key): AssetMetadataGlobalKey; + /// Storage version. StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } @@ -349,6 +395,10 @@ decl_module! { const AssetNameMaxLength: u32 = T::AssetNameMaxLength::get(); const FundingRoundNameMaxLength: u32 = T::FundingRoundNameMaxLength::get(); + const AssetMetadataNameMaxLength: u32 = T::AssetMetadataNameMaxLength::get(); + const AssetMetadataValueMaxLength: u32 = T::AssetMetadataValueMaxLength::get(); + const AssetMetadataTypeDefMaxLength: u32 = T::AssetMetadataTypeDefMaxLength::get(); + fn on_runtime_upgrade() -> frame_support::weights::Weight { use frame_support::weights::constants::WEIGHT_PER_MICROS; // Keep track of upgrade cost. @@ -777,7 +827,147 @@ decl_module! { /// * `ty` contains the string representation of the asset type. #[weight = ::WeightInfo::register_custom_asset_type(ty.len() as u32)] pub fn register_custom_asset_type(origin, ty: Vec) -> DispatchResult { - Self::base_register_custom_asset_type(origin, ty) + Self::base_register_custom_asset_type(origin, ty).map(drop) + } + + /// Utility extrinsic to batch `create_asset` and `register_custom_asset_type`. + #[weight = ::WeightInfo::create_asset( + name.len() as u32, + identifiers.len() as u32, + funding_round.as_ref().map_or(0, |name| name.len()) as u32 + ) + ::WeightInfo::register_custom_asset_type(custom_asset_type.len() as u32)] + pub fn create_asset_with_custom_type( + origin, + name: AssetName, + ticker: Ticker, + divisible: bool, + custom_asset_type: Vec, + identifiers: Vec, + funding_round: Option, + disable_iu: bool, + ) -> DispatchResult { + let PermissionedCallOriginData { + primary_did, + secondary_key, + .. + } = Identity::::ensure_origin_call_permissions(origin)?; + with_transaction(|| { + let asset_type_id = Self::unsafe_register_custom_asset_type(primary_did, custom_asset_type)?; + Self::unsafe_create_asset( + primary_did, + secondary_key, + name, + ticker, + divisible, + AssetType::Custom(asset_type_id), + identifiers, + funding_round, + disable_iu, + ).map(drop) + }) + } + + /// Set asset metadata value. + /// + /// # Arguments + /// * `origin` is a signer that has permissions to act as an agent of `ticker`. + /// * `ticker` Ticker of the token. + /// * `key` Metadata key. + /// * `value` Metadata value. + /// * `details` Optional Metadata value details (expire, lock status). + /// + /// # Errors + /// * `AssetMetadataKeyIsMissing` if the metadata type key doesn't exist. + /// * `AssetMetadataValueIsLocked` if the metadata value for `key` is locked. + /// * `AssetMetadataValueMaxLengthExceeded` if the metadata value exceeds the maximum length. + /// + /// # Permissions + /// * Agent + /// * Asset + #[weight = ::WeightInfo::set_asset_metadata()] + pub fn set_asset_metadata(origin, ticker: Ticker, key: AssetMetadataKey, value: AssetMetadataValue, detail: Option>) -> DispatchResult { + Self::base_set_asset_metadata(origin, ticker, key, value, detail) + } + + /// Set asset metadata value details (expire, lock status). + /// + /// # Arguments + /// * `origin` is a signer that has permissions to act as an agent of `ticker`. + /// * `ticker` Ticker of the token. + /// * `key` Metadata key. + /// * `details` Metadata value details (expire, lock status). + /// + /// # Errors + /// * `AssetMetadataKeyIsMissing` if the metadata type key doesn't exist. + /// * `AssetMetadataValueIsLocked` if the metadata value for `key` is locked. + /// + /// # Permissions + /// * Agent + /// * Asset + #[weight = ::WeightInfo::set_asset_metadata_details()] + pub fn set_asset_metadata_details(origin, ticker: Ticker, key: AssetMetadataKey, detail: AssetMetadataValueDetail) -> DispatchResult { + Self::base_set_asset_metadata_details(origin, ticker, key, detail) + } + + /// Registers and set local asset metadata. + /// + /// # Arguments + /// * `origin` is a signer that has permissions to act as an agent of `ticker`. + /// * `ticker` Ticker of the token. + /// * `name` Metadata name. + /// * `spec` Metadata type definition. + /// * `value` Metadata value. + /// * `details` Optional Metadata value details (expire, lock status). + /// + /// # Errors + /// * `AssetMetadataLocalKeyAlreadyExists` if a local metadata type with `name` already exists for `ticker`. + /// * `AssetMetadataNameMaxLengthExceeded` if the metadata `name` exceeds the maximum length. + /// * `AssetMetadataTypeDefMaxLengthExceeded` if the metadata `spec` type definition exceeds the maximum length. + /// * `AssetMetadataValueMaxLengthExceeded` if the metadata value exceeds the maximum length. + /// + /// # Permissions + /// * Agent + /// * Asset + #[weight = ::WeightInfo::register_and_set_local_asset_metadata()] + pub fn register_and_set_local_asset_metadata(origin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, value: AssetMetadataValue, detail: Option>) -> DispatchResult { + Self::base_register_and_set_local_asset_metadata(origin, ticker, name, spec, value, detail) + } + + /// Registers asset metadata local type. + /// + /// # Arguments + /// * `origin` is a signer that has permissions to act as an agent of `ticker`. + /// * `ticker` Ticker of the token. + /// * `name` Metadata name. + /// * `spec` Metadata type definition. + /// + /// # Errors + /// * `AssetMetadataLocalKeyAlreadyExists` if a local metadata type with `name` already exists for `ticker`. + /// * `AssetMetadataNameMaxLengthExceeded` if the metadata `name` exceeds the maximum length. + /// * `AssetMetadataTypeDefMaxLengthExceeded` if the metadata `spec` type definition exceeds the maximum length. + /// + /// # Permissions + /// * Agent + /// * Asset + #[weight = ::WeightInfo::register_asset_metadata_local_type()] + pub fn register_asset_metadata_local_type(origin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec) -> DispatchResult { + Self::base_register_asset_metadata_local_type(origin, ticker, name, spec) + } + + /// Registers asset metadata global type. + /// + /// # Arguments + /// * `origin` is a signer that has permissions to act as an agent of `ticker`. + /// * `name` Metadata name. + /// * `spec` Metadata type definition. + /// + /// # Errors + /// * `AssetMetadataGlobalKeyAlreadyExists` if a globa metadata type with `name` already exists. + /// * `AssetMetadataNameMaxLengthExceeded` if the metadata `name` exceeds the maximum length. + /// * `AssetMetadataTypeDefMaxLengthExceeded` if the metadata `spec` type definition exceeds the maximum length. + #[weight = ::WeightInfo::register_asset_metadata_global_type()] + pub fn register_asset_metadata_global_type(origin, name: AssetMetadataName, spec: AssetMetadataSpec) -> DispatchResult { + Self::base_register_asset_metadata_global_type(origin, name, spec) } } } @@ -850,6 +1040,20 @@ decl_error! { InvestorUniquenessClaimNotAllowed, /// Invalid `CustomAssetTypeId`. InvalidCustomAssetTypeId, + /// Maximum length of the asset metadata type name has been exceeded. + AssetMetadataNameMaxLengthExceeded, + /// Maximum length of the asset metadata value has been exceeded. + AssetMetadataValueMaxLengthExceeded, + /// Maximum length of the asset metadata type definition has been exceeded. + AssetMetadataTypeDefMaxLengthExceeded, + /// Asset Metadata key is missing. + AssetMetadataKeyIsMissing, + /// Asset Metadata value is locked. + AssetMetadataValueIsLocked, + /// Asset Metadata Local type already exists for asset. + AssetMetadataLocalKeyAlreadyExists, + /// Asset Metadata Global type already exists. + AssetMetadataGlobalKeyAlreadyExists, } } @@ -1060,7 +1264,7 @@ impl Module { if let Some(ticker) = Self::maybe_ticker(ticker) { ticker .expiry - .filter(|&e| >::get() > e) + .filter(|&e| >::get() > e) .is_some() } else { true @@ -1071,7 +1275,7 @@ impl Module { pub fn is_ticker_registry_valid(ticker: &Ticker, did: IdentityId) -> bool { // Assumes uppercase ticker if let Some(ticker) = Self::maybe_ticker(ticker) { - let now = >::get(); + let now = >::get(); ticker.owner == did && ticker.expiry.filter(|&e| now > e).is_none() } else { false @@ -1090,7 +1294,7 @@ impl Module { match Self::maybe_ticker(ticker) { Some(TickerRegistration { expiry, owner }) => match expiry { // Ticker registered to someone but expired and can be registered again. - Some(expiry) if >::get() > expiry => { + Some(expiry) if >::get() > expiry => { TickerRegistrationStatus::Available } // Ticker is already registered to provided did (may or may not expire in future). @@ -1142,7 +1346,7 @@ impl Module { Ok(config .registration_length - .map(|exp| >::get() + exp)) + .map(|exp| >::get() + exp)) } /// Registers the given `ticker` to the `owner` identity with an optional expiry time. @@ -1196,7 +1400,7 @@ impl Module { return Ok(PORTFOLIO_FAILURE); } - if Self::statistics_failures(&from_portfolio, &to_portfolio, ticker, value) { + if Self::statistics_failures(&from_portfolio.did, &to_portfolio.did, ticker, value) { return Ok(TRANSFER_MANAGER_FAILURE); } @@ -1280,8 +1484,10 @@ impl Module { // Update statistic info. // Using the aggregate balance to update the unique investor count. - Statistics::::update_transfer_stats( + Statistics::::update_asset_stats( ticker, + Some(&from_portfolio.did), + Some(&to_portfolio.did), Some(Self::aggregate_balance_of(ticker, &from_scope_id)), Some(Self::aggregate_balance_of(ticker, &to_scope_id)), value, @@ -1377,7 +1583,14 @@ impl Module { // Using the aggregate balance to update the unique investor count. updated_to_balance = Self::aggregate_balance_of(ticker, &scope_id); } - Statistics::::update_transfer_stats(&ticker, None, Some(updated_to_balance), value); + Statistics::::update_asset_stats( + &ticker, + None, + Some(&to_did), + None, + Some(updated_to_balance), + value, + ); let round = Self::funding_round(ticker); let ticker_round = (*ticker, round.clone()); @@ -1571,49 +1784,37 @@ impl Module { Ok(()) } - /* - // Return bool to know whether the given extension is compatible with the supported version of asset. - fn is_ext_compatible(ext_type: &SmartExtensionType, extension_id: T::AccountId) -> bool { - // Access version. - let ext_version = T::ContractsFn::extension_info(extension_id).version; - Self::compatible_extension_version(ext_type) == ext_version - } - - /// Ensure the number of attached transfer manager extension should be < `MaxNumberOfTMExtensionForAsset`. - fn ensure_max_limit_for_tm_extension( - ext_type: &SmartExtensionType, - ticker: &Ticker, - ) -> DispatchResult { - if *ext_type == SmartExtensionType::TransferManager { - let no_of_ext = u32::try_from( - >::get((ticker, SmartExtensionType::TransferManager)).len(), - ) - .unwrap_or_default(); - ensure!( - no_of_ext < T::MaxNumberOfTMExtensionForAsset::get(), - Error::::MaximumTMExtensionLimitReached - ); - } - Ok(()) - } - - /// Ensure the extrinsic is signed and have valid extension id. - fn ensure_signed_and_validate_extension_id( + fn base_create_asset( origin: T::Origin, - ticker: &Ticker, - id: &T::AccountId, + name: AssetName, + ticker: Ticker, + divisible: bool, + asset_type: AssetType, + identifiers: Vec, + funding_round: Option, + disable_iu: bool, ) -> Result { - let did = >::ensure_perms(origin, *ticker)?; - ensure!( - >::contains_key((ticker, id)), - Error::::NoSuchSmartExtension - ); - Ok(did) + let PermissionedCallOriginData { + primary_did, + secondary_key, + .. + } = Identity::::ensure_origin_call_permissions(origin)?; + Self::unsafe_create_asset( + primary_did, + secondary_key, + name, + ticker, + divisible, + asset_type, + identifiers, + funding_round, + disable_iu, + ) } - */ - fn base_create_asset( - origin: T::Origin, + fn unsafe_create_asset( + did: IdentityId, + secondary_key: Option>, name: AssetName, ticker: Ticker, divisible: bool, @@ -1629,12 +1830,6 @@ impl Module { Self::ensure_asset_idents_valid(&identifiers)?; Self::ensure_asset_type_valid(asset_type)?; - let PermissionedCallOriginData { - primary_did: did, - secondary_key, - .. - } = Identity::::ensure_origin_call_permissions(origin)?; - Self::ensure_create_asset_parameters(&ticker)?; // Ensure its registered by DID or at least expired, thus available. @@ -1795,7 +1990,14 @@ impl Module { // Update statistic info. // Using the aggregate balance to update the unique investor count. let updated_from_balance = Some(Self::aggregate_balance_of(ticker, &scope_id)); - Statistics::::update_transfer_stats(&ticker, updated_from_balance, None, value); + Statistics::::update_asset_stats( + &ticker, + Some(&agent), + None, + updated_from_balance, + None, + value, + ); Self::deposit_event(RawEvent::Transfer( agent, @@ -1899,101 +2101,215 @@ impl Module { Ok(()) } - /* - fn base_add_extension( + fn is_asset_metadata_locked(ticker: Ticker, key: AssetMetadataKey) -> bool { + AssetMetadataValueDetails::::get(ticker, key).map_or(false, |details| { + details.is_locked(>::get()) + }) + } + + fn check_asset_metadata_key_exists(ticker: Ticker, key: AssetMetadataKey) -> bool { + match key { + AssetMetadataKey::Global(key) => AssetMetadataGlobalKeyToName::contains_key(key), + AssetMetadataKey::Local(key) => AssetMetadataLocalKeyToName::contains_key(ticker, key), + } + } + + /// Ensure asset metadata `value` is within the global limit. + fn ensure_asset_metadata_value_limited(value: &AssetMetadataValue) -> DispatchResult { + ensure!( + value.len() <= T::AssetMetadataValueMaxLength::get() as usize, + Error::::AssetMetadataValueMaxLengthExceeded + ); + Ok(()) + } + + /// Ensure asset metadata `name` is within the global limit. + fn ensure_asset_metadata_name_limited(name: &AssetMetadataName) -> DispatchResult { + ensure!( + name.len() <= T::AssetMetadataNameMaxLength::get() as usize, + Error::::AssetMetadataNameMaxLengthExceeded + ); + Ok(()) + } + + /// Ensure asset metadata `spec` is within the global limit. + fn ensure_asset_metadata_spec_limited(spec: &AssetMetadataSpec) -> DispatchResult { + ensure_opt_string_limited::(spec.url.as_deref())?; + ensure_opt_string_limited::(spec.description.as_deref())?; + if let Some(ref type_def) = spec.type_def { + ensure!( + type_def.len() <= T::AssetMetadataTypeDefMaxLength::get() as usize, + Error::::AssetMetadataTypeDefMaxLengthExceeded + ); + } + Ok(()) + } + + fn base_set_asset_metadata( origin: T::Origin, ticker: Ticker, - details: SmartExtension, + key: AssetMetadataKey, + value: AssetMetadataValue, + detail: Option>, ) -> DispatchResult { + // Ensure the caller has the correct permissions for this asset. let did = >::ensure_perms(origin, ticker)?; - // Enforce length limits. - ensure_string_limited::(&details.extension_name)?; - if let SmartExtensionType::Custom(ty) = &details.extension_type { - ensure_string_limited::(ty)?; - } + Self::unverified_set_asset_metadata(did, ticker, key, value, detail) + } + + fn unverified_set_asset_metadata( + did: IdentityId, + ticker: Ticker, + key: AssetMetadataKey, + value: AssetMetadataValue, + detail: Option>, + ) -> DispatchResult { + // Check value length limit. + Self::ensure_asset_metadata_value_limited(&value)?; - // Verify the details of smart extension & store it. + // Check key exists. ensure!( - !>::contains_key((ticker, &details.extension_id)), - Error::::ExtensionAlreadyPresent + Self::check_asset_metadata_key_exists(ticker, key), + Error::::AssetMetadataKeyIsMissing ); - // Ensure the version compatibility with the asset. + + // Check if value is currently locked. ensure!( - Self::is_ext_compatible(&details.extension_type, details.extension_id.clone()), - Error::::IncompatibleExtensionVersion + !Self::is_asset_metadata_locked(ticker, key), + Error::::AssetMetadataValueIsLocked ); - // Ensure the hard limit on the count of maximum transfer manager an asset can have. - Self::ensure_max_limit_for_tm_extension(&details.extension_type, &ticker)?; - // Update the storage. - let id = details.extension_id.clone(); - let name = details.extension_name.clone(); - let ty = details.extension_type.clone(); - >::append((ticker, &ty), id.clone()); - >::insert((ticker, &id), details); - Self::deposit_event(Event::::ExtensionAdded(did, ticker, id, name, ty)); + // Set asset metadata value for asset. + AssetMetadataValues::insert(ticker, key, &value); + // Set asset metadata value details. + if let Some(ref detail) = detail { + AssetMetadataValueDetails::::insert(ticker, key, detail); + } + + Self::deposit_event(RawEvent::SetAssetMetadataValue(did, ticker, value, detail)); Ok(()) } - fn base_remove_smart_extension( + fn base_set_asset_metadata_details( origin: T::Origin, ticker: Ticker, - extension_id: T::AccountId, + key: AssetMetadataKey, + detail: AssetMetadataValueDetail, ) -> DispatchResult { - // Ensure the extrinsic is signed and have valid extension id. - let did = Self::ensure_signed_and_validate_extension_id(origin, &ticker, &extension_id)?; - let extension_detail_key = (ticker, extension_id.clone()); + // Ensure the caller has the correct permissions for this asset. + let did = >::ensure_perms(origin, ticker)?; + + // Check key exists. ensure!( - >::contains_key(&extension_detail_key), - Error::::NoSuchSmartExtension + Self::check_asset_metadata_key_exists(ticker, key), + Error::::AssetMetadataKeyIsMissing ); - let extension_type = Self::extension_details(&extension_detail_key).extension_type; + // Check if value is currently locked. + ensure!( + !Self::is_asset_metadata_locked(ticker, key), + Error::::AssetMetadataValueIsLocked + ); - // Remove the storage reference for the given extension_id. - // The order of SEs do not matter, so `swap_remove` is OK. - >::mutate(&(ticker, extension_type), |extension_list| { - if let Some(pos) = extension_list.iter().position(|ext| ext == &extension_id) { - extension_list.swap_remove(pos); - } - }); - >::remove(extension_detail_key); + // Set asset metadata value details. + AssetMetadataValueDetails::::insert(ticker, key, &detail); - Self::deposit_event(RawEvent::ExtensionRemoved(did, ticker, extension_id)); + Self::deposit_event(RawEvent::SetAssetMetadataValueDetails(did, ticker, detail)); Ok(()) } - fn set_archive_on_extension( + fn base_register_and_set_local_asset_metadata( origin: T::Origin, ticker: Ticker, - extension_id: T::AccountId, - archive: bool, + name: AssetMetadataName, + spec: AssetMetadataSpec, + value: AssetMetadataValue, + detail: Option>, ) -> DispatchResult { - // Ensure the extrinsic is signed and have valid extension id. - let did = Self::ensure_signed_and_validate_extension_id(origin, &ticker, &extension_id)?; + // Ensure the caller has the correct permissions for this asset. + let did = >::ensure_perms(origin, ticker)?; - // Mutate the extension details - >::try_mutate((ticker, &extension_id), |details| { - ensure!( - details.is_archive != archive, - archive - .then_some(Error::::AlreadyArchived) - .unwrap_or(Error::::AlreadyUnArchived) - ); - details.is_archive = archive; + // Register local metadata type. + let key = Self::unverified_register_asset_metadata_local_type(did, ticker, name, spec)?; - let event = match archive { - true => RawEvent::ExtensionArchived(did, ticker, extension_id.clone()), - false => RawEvent::ExtensionUnArchived(did, ticker, extension_id.clone()), - }; + Self::unverified_set_asset_metadata(did, ticker, key, value, detail) + } - Self::deposit_event(event); - Ok(()) - }) + fn base_register_asset_metadata_local_type( + origin: T::Origin, + ticker: Ticker, + name: AssetMetadataName, + spec: AssetMetadataSpec, + ) -> DispatchResult { + // Ensure the caller has the correct permissions for this asset. + let did = >::ensure_perms(origin, ticker)?; + + Self::unverified_register_asset_metadata_local_type(did, ticker, name, spec).map(drop) + } + + fn unverified_register_asset_metadata_local_type( + did: IdentityId, + ticker: Ticker, + name: AssetMetadataName, + spec: AssetMetadataSpec, + ) -> Result { + Self::ensure_asset_metadata_name_limited(&name)?; + Self::ensure_asset_metadata_spec_limited(&spec)?; + + // Check if key already exists. + ensure!( + !AssetMetadataLocalNameToKey::contains_key(ticker, &name), + Error::::AssetMetadataLocalKeyAlreadyExists + ); + + // Next local key for asset. + let key = AssetMetadataNextLocalKey::try_mutate(ticker, try_next_pre::)?; + + // Store local key <-> name mapping. + AssetMetadataLocalNameToKey::insert(ticker, &name, key); + AssetMetadataLocalKeyToName::insert(ticker, key, &name); + + // Store local specs. + AssetMetadataLocalSpecs::insert(ticker, key, &spec); + + Self::deposit_event(RawEvent::RegisterAssetMetadataLocalType( + did, ticker, name, key, spec, + )); + Ok(key.into()) + } + + fn base_register_asset_metadata_global_type( + origin: T::Origin, + name: AssetMetadataName, + spec: AssetMetadataSpec, + ) -> DispatchResult { + Self::ensure_asset_metadata_name_limited(&name)?; + Self::ensure_asset_metadata_spec_limited(&spec)?; + + // Only allow global metadata types to be registered by root. + ensure_root(origin)?; + + // Check if key already exists. + ensure!( + !AssetMetadataGlobalNameToKey::contains_key(&name), + Error::::AssetMetadataGlobalKeyAlreadyExists + ); + + // Next global key. + let key = AssetMetadataNextGlobalKey::try_mutate(try_next_pre::)?; + + // Store global key <-> name mapping. + AssetMetadataGlobalNameToKey::insert(&name, key); + AssetMetadataGlobalKeyToName::insert(key, &name); + + // Store global specs. + AssetMetadataGlobalSpecs::insert(key, &spec); + + Self::deposit_event(RawEvent::RegisterAssetMetadataGlobalType(name, key, spec)); + Ok(()) } - */ fn base_claim_classic_ticker( origin: T::Origin, @@ -2117,8 +2433,12 @@ impl Module { value, ); let asset_frozen = Self::frozen(ticker); - let statistics_result = - Self::statistics_failures_granular(&from_portfolio, &to_portfolio, ticker, value); + let transfer_condition_result = Self::transfer_condition_failures_granular( + &from_portfolio.did, + &to_portfolio.did, + ticker, + value, + ); let compliance_result = T::ComplianceManager::verify_restriction_granular( ticker, Some(from_portfolio.did), @@ -2145,9 +2465,9 @@ impl Module { && !sender_insufficient_balance && portfolio_validity_result.result && !asset_frozen - && statistics_result.iter().all(|result| result.result) + && transfer_condition_result.iter().all(|result| result.result) && compliance_result.result, - statistics_result, + transfer_condition_result, compliance_result, portfolio_validity_result, } @@ -2197,71 +2517,86 @@ impl Module { } fn setup_statistics_failures( - from_portfolio: &PortfolioId, - to_portfolio: &PortfolioId, + from_did: &IdentityId, + to_did: &IdentityId, ticker: &Ticker, ) -> (ScopeId, ScopeId, SecurityToken) { ( - Self::scope_id(ticker, &from_portfolio.did), - Self::scope_id(ticker, &to_portfolio.did), + Self::scope_id(ticker, &from_did), + Self::scope_id(ticker, &to_did), Tokens::get(ticker), ) } fn statistics_failures( - from_portfolio: &PortfolioId, - to_portfolio: &PortfolioId, + from_did: &IdentityId, + to_did: &IdentityId, ticker: &Ticker, value: Balance, ) -> bool { let (from_scope_id, to_scope_id, token) = - Self::setup_statistics_failures(from_portfolio, to_portfolio, ticker); - Statistics::::verify_tm_restrictions( + Self::setup_statistics_failures(from_did, to_did, ticker); + Statistics::::verify_transfer_restrictions( ticker, from_scope_id, to_scope_id, - value, + from_did, + to_did, Self::aggregate_balance_of(ticker, &from_scope_id), Self::aggregate_balance_of(ticker, &to_scope_id), + value, token.total_supply, ) .is_err() } - fn statistics_failures_granular( - from_portfolio: &PortfolioId, - to_portfolio: &PortfolioId, + fn transfer_condition_failures_granular( + from_did: &IdentityId, + to_did: &IdentityId, ticker: &Ticker, value: Balance, - ) -> Vec { + ) -> Vec { let (from_scope_id, to_scope_id, token) = - Self::setup_statistics_failures(from_portfolio, to_portfolio, ticker); - Statistics::::verify_tm_restrictions_granular( + Self::setup_statistics_failures(from_did, to_did, ticker); + Statistics::::get_transfer_restrictions_results( ticker, from_scope_id, to_scope_id, - value, + from_did, + to_did, Self::aggregate_balance_of(ticker, &from_scope_id), Self::aggregate_balance_of(ticker, &to_scope_id), + value, token.total_supply, ) } - fn base_register_custom_asset_type(origin: T::Origin, ty: Vec) -> DispatchResult { - ensure_string_limited::(&ty)?; - + fn base_register_custom_asset_type( + origin: T::Origin, + ty: Vec, + ) -> Result { let did = Identity::::ensure_perms(origin)?; + Self::unsafe_register_custom_asset_type(did, ty) + } - match CustomTypesInverse::try_get(&ty) { - Ok(id) => Self::deposit_event(Event::::CustomAssetTypeExists(did, id, ty)), + fn unsafe_register_custom_asset_type( + did: IdentityId, + ty: Vec, + ) -> Result { + ensure_string_limited::(&ty)?; + + Ok(match CustomTypesInverse::try_get(&ty) { + Ok(id) => { + Self::deposit_event(Event::::CustomAssetTypeExists(did, id, ty)); + id + } Err(()) => { let id = CustomTypeIdSequence::try_mutate(try_next_pre::)?; CustomTypesInverse::insert(&ty, id); CustomTypes::insert(id, ty.clone()); Self::deposit_event(Event::::CustomAssetTypeRegistered(did, id, ty)); + id } - } - - Ok(()) + }) } } diff --git a/pallets/balances/Cargo.toml b/pallets/balances/Cargo.toml index 3b94448ff3..d746e46cc5 100644 --- a/pallets/balances/Cargo.toml +++ b/pallets/balances/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-balances" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] pallet-permissions = { path = "../permissions", default-features = false } @@ -10,27 +10,28 @@ pallet-transaction-payment = { path = "../transaction-payment", default-features polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } +log = "0.4.8" serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false} -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } - -pallet-timestamp = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } # Only for test in STD -substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05", optional = true} # Benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/balances/src/lib.rs b/pallets/balances/src/lib.rs index 0b35fe4902..6669f04b60 100644 --- a/pallets/balances/src/lib.rs +++ b/pallets/balances/src/lib.rs @@ -186,8 +186,9 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::traits::BlockRewardsReserveCurrency; use polymesh_primitives::Balance; +use scale_info::TypeInfo; use sp_runtime::{ - traits::{AccountIdConversion, StaticLookup, StoredMapError, Zero}, + traits::{AccountIdConversion, StaticLookup, Zero}, DispatchError, DispatchResult, RuntimeDebug, }; use sp_std::{cmp, mem, prelude::*, result}; @@ -214,7 +215,7 @@ decl_error! { /// A single lock on a balance. There can be many of these on an account and they "overlap", so the /// same balance is frozen by multiple locks. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub struct BalanceLock { /// An identifier for this lock. Only one lock may be in existence for each identifier. pub id: LockIdentifier, @@ -439,7 +440,7 @@ impl Module { pub fn block_rewards_reserve() -> T::AccountId { SystematicIssuers::BlockRewardReserve - .as_module_id() + .as_pallet_id() .into_account() } @@ -467,7 +468,7 @@ impl Module { /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that /// the caller will do this. pub fn mutate_account(who: &T::AccountId, f: impl FnOnce(&mut AccountData) -> R) -> R { - Self::try_mutate_account(who, |a, _| -> Result { Ok(f(a)) }) + Self::try_mutate_account(who, |a, _| -> Result { Ok(f(a)) }) .expect("Error is infallible; qed") } @@ -479,7 +480,7 @@ impl Module { /// /// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that /// the caller will do this. - fn try_mutate_account>( + fn try_mutate_account>( who: &T::AccountId, f: impl FnOnce(&mut AccountData, bool) -> Result, ) -> Result { @@ -506,7 +507,7 @@ impl Module { /// Update the account entry for `who`, given the locks. fn update_locks(who: &T::AccountId, locks: &[BalanceLock]) { if locks.len() as u32 > T::MaxLocks::get() { - frame_support::debug::warn!( + log::warn!( "Warning: A user has more currency locks than expected. \ A runtime configuration adjustment may be needed." ); @@ -531,12 +532,12 @@ impl Module { if existed { // TODO: use Locks::::hashed_key // https://github.com/paritytech/substrate/issues/4969 - system::Module::::dec_consumers(who); + system::Pallet::::dec_consumers(who); } } else { Locks::::insert(who, locks); if !existed { - let _ = system::Module::::inc_consumers(who); + let _ = system::Pallet::::inc_consumers(who); } } } @@ -666,7 +667,7 @@ impl BlockRewardsReserveCurrency> for Module let brr = Self::block_rewards_reserve(); Self::try_mutate_account( &brr, - |account, _| -> Result, StoredMapError> { + |account, _| -> Result, DispatchError> { let amount_to_mint = if account.free > Zero::zero() { let old_brr_free_balance = account.free; let new_brr_free_balance = old_brr_free_balance.saturating_sub(amount); diff --git a/pallets/base/Cargo.toml b/pallets/base/Cargo.toml index 623ae7f0fa..181ef94652 100644 --- a/pallets/base/Cargo.toml +++ b/pallets/base/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-base" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } @@ -13,15 +13,15 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } - -frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } -frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-4.1.2" } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +sp-std = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +sp-io = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +sp-runtime = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +sp-version = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +sp-api = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +frame-system = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } +frame-support = { git = "https://github.com/PolymathNetwork/substrate", default-features = false, branch = "polymesh-monthly-2022-05" } [features] diff --git a/pallets/base/src/lib.rs b/pallets/base/src/lib.rs index 41c431953b..286ae0f14f 100644 --- a/pallets/base/src/lib.rs +++ b/pallets/base/src/lib.rs @@ -27,10 +27,11 @@ use core::mem; use frame_support::dispatch::{DispatchError, DispatchResult}; -use frame_support::traits::Get; +use frame_support::traits::{Get, StorageInfo, StorageInfoTrait}; use frame_support::{decl_error, decl_module, ensure}; pub use polymesh_common_utilities::traits::base::{Config, Event}; use polymesh_primitives::checked_inc::CheckedInc; +use sp_std::vec::Vec; decl_module! { pub struct Module for enum Call where origin: T::Origin { @@ -105,3 +106,9 @@ pub fn try_next_post(seq: &mut I) -> Result frame_support::traits::IntegrityTest for Module {} + +impl StorageInfoTrait for Module { + fn storage_info() -> Vec { + Vec::new() + } +} diff --git a/pallets/bridge/Cargo.toml b/pallets/bridge/Cargo.toml index 08b38a5073..59d43866ca 100644 --- a/pallets/bridge/Cargo.toml +++ b/pallets/bridge/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-bridge" version = "1.0.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -14,18 +14,20 @@ pallet-identity = { path = "../identity", default-features = false } pallet-multisig = { path = "../multisig", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } -frame-benchmarking = { version = "3.0.0", optional = true } +frame-benchmarking = { version = "4.0.0-dev", optional = true } # Other serde = { version = "1.0.104", default-features = false } +log = "0.4.8" [features] equalize = [] diff --git a/pallets/bridge/src/genesis.rs b/pallets/bridge/src/genesis.rs index c01dc04727..c10ad634f9 100644 --- a/pallets/bridge/src/genesis.rs +++ b/pallets/bridge/src/genesis.rs @@ -1,6 +1,6 @@ use crate::{BridgeTxDetail, BridgeTxStatus, Config, GenesisConfig}; -use frame_support::{debug, storage::StorageDoubleMap}; +use frame_support::storage::StorageDoubleMap; use polymesh_common_utilities::{balances::CheckCdd, constants::currency::POLY, Context}; use polymesh_primitives::Permissions; use sp_runtime::traits::Zero; @@ -24,10 +24,10 @@ pub(crate) fn controller(config: &GenesisConfig) -> T::AccountId { config.signatures_required, ) .expect("cannot create the bridge multisig"); - debug::info!("Created bridge multisig {}", multisig_id); + log::info!("Created bridge multisig {}", multisig_id); for signer in &config.signers { - debug::info!("Accepting bridge signer auth for {:?}", signer); + log::info!("Accepting bridge signer auth for {:?}", signer); let last_auth = >::iter_prefix_values(signer) .next() .expect("cannot find bridge signer auth") @@ -40,7 +40,7 @@ pub(crate) fn controller(config: &GenesisConfig) -> T::AccountId { .expect("bridge creator account has no identity"); Identity::::unsafe_join_identity(creator_did, Permissions::default(), multisig_id.clone()); - debug::info!("Joined identity {} as signer {}", creator_did, multisig_id); + log::info!("Joined identity {} as signer {}", creator_did, multisig_id); multisig_id } @@ -61,7 +61,7 @@ pub(crate) fn bridge_tx_details( }; let recipient_did = T::CddChecker::get_key_cdd_did(&recipient); - debug::info!( + log::info!( "Credited Genesis bridge transaction to {:?}(did={:?}) with nonce {} for {:?} POLYX", recipient, recipient_did, diff --git a/pallets/bridge/src/lib.rs b/pallets/bridge/src/lib.rs index fc8adcf5cb..2f94cf20bc 100644 --- a/pallets/bridge/src/lib.rs +++ b/pallets/bridge/src/lib.rs @@ -115,9 +115,8 @@ use frame_support::{ }, weights::{DispatchClass, Pays}, }; -use frame_system::{self as system, ensure_root, ensure_signed, RawOrigin}; +use frame_system::{ensure_root, ensure_signed, RawOrigin}; use pallet_balances as balances; -use pallet_identity as identity; use pallet_multisig as multisig; use polymesh_common_utilities::traits::balances::Config as BalancesConfig; use polymesh_common_utilities::{ @@ -125,13 +124,15 @@ use polymesh_common_utilities::{ Context, GC_DID, }; use polymesh_primitives::{storage_migration_ver, Balance, IdentityId, Signatory}; +use scale_info::TypeInfo; use sp_core::H256; use sp_runtime::traits::{Saturating, Zero}; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; -use sp_std::{convert::TryFrom, fmt::Debug, prelude::*}; +use sp_std::{convert::TryFrom, fmt::Debug, prelude::*, vec}; -type Identity = identity::Module; +type Identity = pallet_identity::Module; +type System = frame_system::Pallet; pub trait Config: multisig::Config + BalancesConfig + pallet_base::Config { type Event: From> + Into<::Event>; @@ -146,7 +147,8 @@ pub trait Config: multisig::Config + BalancesConfig + pallet_base::Config { /// The status of a bridge transaction. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum BridgeTxStatus { /// No such transaction in the system. Absent, @@ -171,7 +173,8 @@ impl Default for BridgeTxStatus { /// A unique lock-and-mint bridge transaction. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct BridgeTx { /// A single transaction hash can have multiple locks. This nonce differentiates between them. pub nonce: u32, @@ -185,7 +188,8 @@ pub struct BridgeTx { } /// Additional details of a bridge transaction. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct BridgeTxDetail { /// Amount of POLYX tokens to credit. pub amount: Balance, @@ -199,7 +203,7 @@ pub struct BridgeTxDetail { } /// The status of a handled transaction for reporting purposes. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum HandledTxStatus { /// The transaction has been successfully handled. Success, @@ -611,7 +615,7 @@ impl Module { let (limit, interval_duration) = Self::bridge_limit(); ensure!(!interval_duration.is_zero(), Error::::DivisionByZero); - let current_interval = >::block_number() / interval_duration; + let current_interval = System::::block_number() / interval_duration; let (bridged, last_interval) = Self::polyx_bridged(did); let total_mint = if last_interval == current_interval { amount.checked_add(bridged).ok_or(Error::::Overflow)? @@ -622,7 +626,7 @@ impl Module { >::insert(did, (total_mint, current_interval)) } - let _pos_imbalance = >::deposit_creating(&recipient, *amount); + let _pos_imbalance = >::deposit_creating(&recipient, *amount); Ok(()) } @@ -664,7 +668,7 @@ impl Module { match Self::issue(&bridge_tx.recipient, &amount, exempted_did) { Ok(_) => { tx_details.status = BridgeTxStatus::Handled; - tx_details.execution_block = >::block_number(); + tx_details.execution_block = System::::block_number(); >::insert(&bridge_tx.recipient, &bridge_tx.nonce, tx_details); let current_did = Context::current_identity::>().unwrap_or_else(|| GC_DID); @@ -724,7 +728,7 @@ impl Module { already_tried = 24; } - let unlock_block_number = >::block_number() + let unlock_block_number = System::::block_number() .saturating_add(timelock) .saturating_add(T::BlockNumber::from(2u32.pow(already_tried.into()))); tx_details.execution_block = unlock_block_number; @@ -748,8 +752,8 @@ impl Module { Self::ensure_controller_set()?; let sender_signer = Signatory::Account(sender); - let propose = |tx| { - let proposal = ::Proposal::from(Call::::handle_bridge_tx(tx)); + let propose = |bridge_tx| { + let proposal = ::Proposal::from(Call::::handle_bridge_tx { bridge_tx }); let boxed_proposal = Box::new(proposal.into()); >::create_or_approve_proposal( Self::controller(), @@ -843,7 +847,10 @@ impl Module { bridge_tx: BridgeTx, ) -> DispatchResult { // Schedule the transaction as a dispatchable call. - let call = Call::::handle_scheduled_bridge_tx(bridge_tx.clone()).into(); + let call = Call::::handle_scheduled_bridge_tx { + bridge_tx: bridge_tx.clone(), + } + .into(); ::Scheduler::schedule( DispatchTime::At(block_number), None, diff --git a/pallets/committee/Cargo.toml b/pallets/committee/Cargo.toml index 4d163d2628..fdd971a421 100644 --- a/pallets/committee/Cargo.toml +++ b/pallets/committee/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-committee" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -15,19 +15,20 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/committee/src/benchmarking.rs b/pallets/committee/src/benchmarking.rs index 4fe565c531..0c25519d25 100644 --- a/pallets/committee/src/benchmarking.rs +++ b/pallets/committee/src/benchmarking.rs @@ -45,7 +45,7 @@ where { let bytes: [u8; 4] = n.to_be_bytes(); let padding = bytes.repeat(PROPOSAL_PADDING_WORDS); - let proposal = frame_system::Call::::remark(padding).into(); + let proposal = frame_system::Call::::remark { remark: padding }.into(); let hash = ::Hashing::hash_of(&proposal); (proposal, hash) } @@ -138,7 +138,7 @@ benchmarks_instance! { let n = 1; let d = 2; let origin = T::CommitteeOrigin::successful_origin(); - let call = Call::::set_vote_threshold(n, d); + let call = Call::::set_vote_threshold { n, d }; }: { call.dispatch_bypass_filter(origin).unwrap(); } @@ -154,7 +154,7 @@ benchmarks_instance! { let coordinator = dids.last().unwrap().clone(); Module::::change_members_sorted(&dids, &[], &dids); let origin = T::CommitteeOrigin::successful_origin(); - let call = Call::::set_release_coordinator(coordinator); + let call = Call::::set_release_coordinator { id: coordinator }; }: { call.dispatch_bypass_filter(origin).unwrap(); } @@ -168,7 +168,7 @@ benchmarks_instance! { set_expires_after { let maybe_block = MaybeBlock::Some(1u32.into()); let origin = T::CommitteeOrigin::successful_origin(); - let call = Call::::set_expires_after(maybe_block); + let call = Call::::set_expires_after { expiry: maybe_block }; }: { call.dispatch_bypass_filter(origin).unwrap(); } diff --git a/pallets/committee/src/lib.rs b/pallets/committee/src/lib.rs index d299548ac7..a868c3180a 100644 --- a/pallets/committee/src/lib.rs +++ b/pallets/committee/src/lib.rs @@ -78,6 +78,7 @@ use polymesh_common_utilities::{ Context, MaybeBlock, SystematicIssuers, GC_DID, }; use polymesh_primitives::{storage_migration_ver, IdentityId}; +use scale_info::TypeInfo; use sp_runtime::traits::Hash; use sp_std::{prelude::*, vec}; @@ -122,7 +123,7 @@ pub trait Config: } /// Origin for the committee module. -#[derive(PartialEq, Eq, Clone, Debug, Encode, Decode)] +#[derive(PartialEq, Eq, Clone, Debug, Encode, Decode, TypeInfo)] pub enum RawOrigin { /// It has been condoned by M of N members of this committee /// with `M` and `N` set dynamically in `set_vote_threshold`. @@ -132,7 +133,7 @@ pub enum RawOrigin { /// Origin for the committee module. pub type Origin = RawOrigin<::AccountId, I>; -#[derive(PartialEq, Eq, Clone, Encode, Decode, Debug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Debug)] /// Info for keeping track of a motion being voted on. pub struct PolymeshVotes { /// The proposal's unique index. @@ -524,7 +525,7 @@ impl, I: Instance> Module { expiry: MaybeBlock, ) -> Result<(), Error> { match expiry { - MaybeBlock::Some(e) if e <= frame_system::Module::::block_number() => { + MaybeBlock::Some(e) if e <= frame_system::Pallet::::block_number() => { Self::clear_proposal(proposal); >::remove(proposal); Err(Error::::ProposalExpired) @@ -570,7 +571,7 @@ impl, I: Instance> Module { let index = >::mutate(|i| mem::replace(i, *i + 1)); >::append(proposal_hash); >::insert(proposal_hash, proposal); - let now = frame_system::Module::::block_number(); + let now = frame_system::Pallet::::block_number(); let votes = PolymeshVotes { index, ayes: vec![did], diff --git a/pallets/common/Cargo.toml b/pallets/common/Cargo.toml index 5285aca244..23cb2a7830 100644 --- a/pallets/common/Cargo.toml +++ b/pallets/common/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-common-utilities" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } @@ -13,26 +13,27 @@ serde = { version = "1.0.112", default-features = false } serde_derive = { version = "1.0.112", optional = true, default-features = false} # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +#pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # Benchmarks -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } schnorrkel = { version = "0.10.1", default-features = false, optional = true } [dev-dependencies] lazy_static = { version = "1.4.0", default-features = false } -substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2" } +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05" } [features] default = ["std", "equalize"] diff --git a/pallets/common/src/constants.rs b/pallets/common/src/constants.rs index ccbcd3304d..daa6b705c7 100644 --- a/pallets/common/src/constants.rs +++ b/pallets/common/src/constants.rs @@ -1,4 +1,5 @@ -use sp_runtime::ModuleId; +use frame_support::PalletId; + /// Money matters. pub mod currency { use polymesh_primitives::Balance; @@ -84,14 +85,14 @@ pub const TRANSFER_MANAGER_FAILURE: u8 = 0xac; pub const PIP_MAX_REPORTING_SIZE: usize = 1024; /// Module ids, used for deriving sovereign account IDs for modules. -pub const TREASURY_MODULE_ID: ModuleId = ModuleId(*b"pm/trsry"); -pub const BRR_MODULE_ID: ModuleId = ModuleId(*b"pm/blrwr"); -pub const GC_MODULE_ID: ModuleId = ModuleId(*b"pm/govcm"); -pub const CDD_MODULE_ID: ModuleId = ModuleId(*b"pm/cusdd"); -pub const SETTLEMENT_MODULE_ID: ModuleId = ModuleId(*b"pm/setmn"); -pub const CLASSIC_MIGRATION_MODULE_ID: ModuleId = ModuleId(*b"pm/ehmig"); -pub const FIAT_TICKERS_RESERVATION_MODULE_ID: ModuleId = ModuleId(*b"pm/ftres"); -pub const REWARDS_MODULE_ID: ModuleId = ModuleId(*b"pm/rewrd"); +pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"pm/trsry"); +pub const BRR_PALLET_ID: PalletId = PalletId(*b"pm/blrwr"); +pub const GC_PALLET_ID: PalletId = PalletId(*b"pm/govcm"); +pub const CDD_PALLET_ID: PalletId = PalletId(*b"pm/cusdd"); +pub const SETTLEMENT_PALLET_ID: PalletId = PalletId(*b"pm/setmn"); +pub const CLASSIC_MIGRATION_PALLET_ID: PalletId = PalletId(*b"pm/ehmig"); +pub const FIAT_TICKERS_RESERVATION_PALLET_ID: PalletId = PalletId(*b"pm/ftres"); +pub const REWARDS_PALLET_ID: PalletId = PalletId(*b"pm/rewrd"); /// Base module constants pub const ENSURED_MAX_LEN: u32 = 2048; diff --git a/pallets/common/src/context.rs b/pallets/common/src/context.rs index e31c4e8aac..3335dbee90 100644 --- a/pallets/common/src/context.rs +++ b/pallets/common/src/context.rs @@ -70,8 +70,7 @@ impl Context { #[cfg(test)] mod test { use super::*; - use crate::SystematicIssuers; - use polymesh_primitives::{AccountId, IdentityId, Permission, Signatory}; + use polymesh_primitives::{AccountId, IdentityId}; use lazy_static::lazy_static; use std::{collections::BTreeMap, convert::From, sync::RwLock, thread}; @@ -110,11 +109,7 @@ mod test { *w = id; } - fn is_signer_authorized(_did: IdentityId, _signer: &Signatory) -> bool { - false - } - - fn current_payer() -> Option> { + fn current_payer() -> Option { None } @@ -123,13 +118,6 @@ mod test { fn has_valid_cdd(_target_did: IdentityId) -> bool { true } - - fn unsafe_add_systematic_cdd_claims(_targets: &[IdentityId], _issuer: SystematicIssuers) {} - fn unsafe_revoke_systematic_cdd_claims( - _targets: &[IdentityId], - _issuer: SystematicIssuers, - ) { - } } #[test] diff --git a/pallets/common/src/lib.rs b/pallets/common/src/lib.rs index b7d1da7b48..a28005650a 100644 --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -14,7 +14,6 @@ // along with this program. If not, see . #![cfg_attr(not(feature = "std"), no_std)] -#![feature(bool_to_option)] pub mod constants; @@ -37,10 +36,12 @@ pub mod benchs; use core::ops::Add; use frame_support::codec::{Decode, Encode}; +use frame_support::PalletId; use polymesh_primitives::IdentityId; +use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use sp_runtime::{DispatchResult, ModuleId}; +use sp_runtime::{DispatchError, DispatchResult}; /// It defines the valid issuers for Systematic Claims. /// @@ -116,18 +117,18 @@ impl SystematicIssuers { IdentityId(*self.as_bytes()) } - pub const fn as_module_id(self) -> ModuleId { + pub const fn as_pallet_id(self) -> PalletId { match self { - SystematicIssuers::Committee => constants::GC_MODULE_ID, - SystematicIssuers::CDDProvider => constants::CDD_MODULE_ID, - SystematicIssuers::Treasury => constants::TREASURY_MODULE_ID, - SystematicIssuers::BlockRewardReserve => constants::BRR_MODULE_ID, - SystematicIssuers::Settlement => constants::SETTLEMENT_MODULE_ID, - SystematicIssuers::ClassicMigration => constants::CLASSIC_MIGRATION_MODULE_ID, + SystematicIssuers::Committee => constants::GC_PALLET_ID, + SystematicIssuers::CDDProvider => constants::CDD_PALLET_ID, + SystematicIssuers::Treasury => constants::TREASURY_PALLET_ID, + SystematicIssuers::BlockRewardReserve => constants::BRR_PALLET_ID, + SystematicIssuers::Settlement => constants::SETTLEMENT_PALLET_ID, + SystematicIssuers::ClassicMigration => constants::CLASSIC_MIGRATION_PALLET_ID, SystematicIssuers::FiatTickersReservation => { - constants::FIAT_TICKERS_RESERVATION_MODULE_ID + constants::FIAT_TICKERS_RESERVATION_PALLET_ID } - SystematicIssuers::Rewards => constants::REWARDS_MODULE_ID, + SystematicIssuers::Rewards => constants::REWARDS_PALLET_ID, } } } @@ -138,7 +139,9 @@ pub const GC_DID: IdentityId = SystematicIssuers::Committee.as_id(); /// committing on `Ok(_)` and rolling back on `Err(_)`, returning the result. /// /// Transactions can be arbitrarily nested with commits happening to the parent. -pub fn with_transaction(tx: impl FnOnce() -> Result) -> Result { +pub fn with_transaction>( + tx: impl FnOnce() -> Result, +) -> Result { use frame_support::storage::{with_transaction, TransactionOutcome}; with_transaction(|| match tx() { r @ Ok(_) => TransactionOutcome::Commit(r), @@ -157,7 +160,7 @@ pub fn with_each_transaction( } /// Either a block number, or nothing. -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum MaybeBlock { Some(BlockNumber), diff --git a/pallets/common/src/protocol_fee.rs b/pallets/common/src/protocol_fee.rs index 2b0edf5c6a..5d1fca70e2 100644 --- a/pallets/common/src/protocol_fee.rs +++ b/pallets/common/src/protocol_fee.rs @@ -16,12 +16,14 @@ use codec::{Decode, Encode}; use frame_support::dispatch::DispatchResult; use polymesh_primitives::Balance; +use scale_info::TypeInfo; use sp_runtime::Perbill; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; /// Protocol fee operations. -#[derive(Decode, Encode, Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Decode, Encode, TypeInfo)] +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum ProtocolOp { AssetRegisterTicker, diff --git a/pallets/common/src/traits/asset.rs b/pallets/common/src/traits/asset.rs index e6ad14552b..fee42b2f7b 100644 --- a/pallets/common/src/traits/asset.rs +++ b/pallets/common/src/traits/asset.rs @@ -18,9 +18,13 @@ use frame_support::decl_event; use frame_support::dispatch::DispatchResult; use frame_support::traits::{Currency, Get, UnixTime}; use frame_support::weights::Weight; -use polymesh_primitives::asset::{AssetName, AssetType, CustomAssetTypeId, FundingRoundName}; -use polymesh_primitives::ethereum::EthereumAddress; use polymesh_primitives::{ + asset::{AssetName, AssetType, CustomAssetTypeId, FundingRoundName}, + asset_metadata::{ + AssetMetadataGlobalKey, AssetMetadataLocalKey, AssetMetadataName, AssetMetadataSpec, + AssetMetadataValue, AssetMetadataValueDetail, + }, + ethereum::EthereumAddress, AssetIdentifier, Balance, Document, DocumentId, IdentityId, PortfolioId, ScopeId, Ticker, }; use sp_std::prelude::Vec; @@ -92,6 +96,12 @@ pub trait WeightInfo { fn reserve_classic_ticker() -> Weight; fn controller_transfer() -> Weight; fn register_custom_asset_type(n: u32) -> Weight; + + fn set_asset_metadata() -> Weight; + fn set_asset_metadata_details() -> Weight; + fn register_and_set_local_asset_metadata() -> Weight; + fn register_asset_metadata_local_type() -> Weight; + fn register_asset_metadata_global_type() -> Weight; } /// The module's configuration trait. @@ -100,7 +110,6 @@ pub trait Config: + external_agents::Config + pallet_session::Config + statistics::Config - //+ contracts::Trait + portfolio::Config { /// The overarching event type. @@ -126,12 +135,19 @@ pub trait Config: /// Max length of the funding round name. type FundingRoundNameMaxLength: Get; + /// Max length for the Asset Metadata type name. + type AssetMetadataNameMaxLength: Get; + + /// Max length for the Asset Metadata value. + type AssetMetadataValueMaxLength: Get; + + /// Max length for the Asset Metadata type definition. + type AssetMetadataTypeDefMaxLength: Get; + type AssetFn: AssetFnTrait; type WeightInfo: WeightInfo; type CPWeightInfo: crate::traits::checkpoint::WeightInfo; - - //type ContractsFn: ContractsFn; } decl_event! { @@ -214,5 +230,17 @@ decl_event! { /// A custom asset type was registered on-chain. /// caller DID, the ID of the custom asset type, the string contents registered. CustomAssetTypeRegistered(IdentityId, CustomAssetTypeId, Vec), + /// Set asset metadata value. + /// (Caller DID, ticker, metadata value, optional value details) + SetAssetMetadataValue(IdentityId, Ticker, AssetMetadataValue, Option>), + /// Set asset metadata value details (expire, lock status). + /// (Caller DID, ticker, value details) + SetAssetMetadataValueDetails(IdentityId, Ticker, AssetMetadataValueDetail), + /// Register asset metadata local type. + /// (Caller DID, ticker, Local type name, Local type key, type specs) + RegisterAssetMetadataLocalType(IdentityId, Ticker, AssetMetadataName, AssetMetadataLocalKey, AssetMetadataSpec), + /// Register asset metadata global type. + /// (Global type name, Global type key, type specs) + RegisterAssetMetadataGlobalType(AssetMetadataName, AssetMetadataGlobalKey, AssetMetadataSpec), } } diff --git a/pallets/common/src/traits/balances.rs b/pallets/common/src/traits/balances.rs index dec842947d..39c7487a0a 100644 --- a/pallets/common/src/traits/balances.rs +++ b/pallets/common/src/traits/balances.rs @@ -26,15 +26,17 @@ use frame_support::{ }; use polymesh_primitives::{Balance, IdentityId}; use polymesh_primitives_derive::SliceU8StrongTyped; +use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; use sp_std::ops::BitOr; -#[derive(Encode, Default, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, SliceU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, SliceU8StrongTyped)] +#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Memo(pub [u8; 32]); // POLYMESH-NOTE: Make `AccountData` public to access it from the outside module. /// All balance information for an account. -#[derive(Encode, Decode, Clone, PartialEq, Eq, Default, RuntimeDebug)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Default, RuntimeDebug)] pub struct AccountData { /// Non-reserved part of the balance. There may still be restrictions on this, but it is the /// total pool what may in principle be transferred, reserved and used for tipping. @@ -78,7 +80,7 @@ impl AccountData { } /// Simplified reasons for withdrawing balance. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum Reasons { /// Paying system transaction fees. Fee = 0, diff --git a/pallets/common/src/traits/checkpoint.rs b/pallets/common/src/traits/checkpoint.rs index 3a9bb28b7e..5e4f478a0b 100644 --- a/pallets/common/src/traits/checkpoint.rs +++ b/pallets/common/src/traits/checkpoint.rs @@ -3,18 +3,20 @@ use frame_support::decl_event; use frame_support::weights::Weight; use polymesh_primitives::calendar::{CheckpointId, CheckpointSchedule}; use polymesh_primitives::{impl_checked_inc, Balance, EventDid, IdentityId, Moment, Ticker}; +use scale_info::TypeInfo; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; /// ID of a `StoredSchedule`. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct ScheduleId(pub u64); impl_checked_inc!(ScheduleId); /// One or more scheduled checkpoints in the future. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, Debug, PartialEq, Eq)] pub struct StoredSchedule { /// A series of checkpoints in the future defined by the schedule. pub schedule: CheckpointSchedule, diff --git a/pallets/common/src/traits/external_agents.rs b/pallets/common/src/traits/external_agents.rs index c424928125..1294bea73d 100644 --- a/pallets/common/src/traits/external_agents.rs +++ b/pallets/common/src/traits/external_agents.rs @@ -4,6 +4,8 @@ use polymesh_primitives::{EventDid, ExtrinsicPermissions, IdentityId, Ticker}; pub trait WeightInfo { fn create_group(p: u32) -> Weight; + fn create_group_and_add_auth(p: u32) -> Weight; + fn create_and_change_custom_group(p: u32) -> Weight; fn set_group_permissions(p: u32) -> Weight; fn remove_agent() -> Weight; fn abdicate() -> Weight; diff --git a/pallets/common/src/traits/group.rs b/pallets/common/src/traits/group.rs index 43964c73b8..4bc67c4052 100644 --- a/pallets/common/src/traits/group.rs +++ b/pallets/common/src/traits/group.rs @@ -24,6 +24,7 @@ use frame_support::{ traits::{ChangeMembers, EnsureOrigin, InitializeMembers}, weights::Weight, }; +use scale_info::TypeInfo; use sp_std::{ cmp::{Eq, Ordering, PartialEq}, vec::Vec, @@ -32,7 +33,7 @@ use sp_std::{ /// The number of group members. pub type MemberCount = u32; -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, Debug)] pub struct InactiveMember { pub id: IdentityId, pub deactivated_at: Moment, diff --git a/pallets/common/src/traits/identity.rs b/pallets/common/src/traits/identity.rs index d6f609b4f9..965e4fca87 100644 --- a/pallets/common/src/traits/identity.rs +++ b/pallets/common/src/traits/identity.rs @@ -33,11 +33,13 @@ use frame_support::{ Parameter, }; use polymesh_primitives::{ - secondary_key::api::{LegacyPermissions, SecondaryKey}, - AuthorizationData, IdentityClaim, IdentityId, InvestorUid, Permissions, Signatory, Ticker, + secondary_key::{v1, SecondaryKey}, + AuthorizationData, Balance, IdentityClaim, IdentityId, Permissions, Signatory, Ticker, }; +use scale_info::TypeInfo; use sp_core::H512; use sp_runtime::traits::{Dispatchable, IdentifyAccount, Member, Verify}; +use sp_std::convert::TryFrom; use sp_std::vec::Vec; pub type AuthorizationNonce = u64; @@ -51,7 +53,7 @@ pub type AuthorizationNonce = u64; /// value of nonce of primary key of `target_id`. See `System::account_nonce`. /// In this way, the authorization is delimited to an specific transaction (usually the next one) /// of primary key of target identity. -#[derive(codec::Encode, codec::Decode, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] pub struct TargetIdAuthorization { /// Target identity which is authorized to make an operation. pub target_id: IdentityId, @@ -67,7 +69,7 @@ pub struct TargetIdAuthorization { /// # TODO /// - Replace `H512` type by a template type which represents explicitly the relation with /// `TargetIdAuthorization`. -#[derive(codec::Encode, codec::Decode, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug)] pub struct SecondaryKeyWithAuth { /// Secondary key to be added. pub secondary_key: SecondaryKey, @@ -75,6 +77,32 @@ pub struct SecondaryKeyWithAuth { pub auth_signature: H512, } +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct SecondaryKeyWithAuthV1 { + secondary_key: v1::SecondaryKey, + auth_signature: H512, +} + +impl TryFrom> for SecondaryKeyWithAuth { + type Error = (); + fn try_from(auth: SecondaryKeyWithAuthV1) -> Result { + match auth.secondary_key.signer { + Signatory::Account(key) => Ok(Self { + secondary_key: SecondaryKey { + key, + permissions: auth.secondary_key.permissions, + }, + auth_signature: auth.auth_signature, + }), + _ => { + // Unsupported `Signatory::Identity`. + Err(()) + } + } + } +} + pub trait WeightInfo { fn cdd_register_did(i: u32) -> Weight; fn invalidate_cdd_claims() -> Weight; @@ -86,13 +114,19 @@ pub trait WeightInfo { fn leave_identity_as_key() -> Weight; fn add_claim() -> Weight; fn revoke_claim() -> Weight; - fn set_permission_to_signer() -> Weight; + fn set_secondary_key_permissions() -> Weight; /// Complexity Parameters: /// `a` = Number of (A)ssets /// `p` = Number of (P)ortfolios /// `l` = Number of pa(L)lets /// `e` = Number of (E)xtrinsics fn permissions_cost(a: u32, p: u32, l: u32, e: u32) -> Weight; + + fn permissions_cost_perms(perms: &Permissions) -> Weight { + let (assets, portfolios, pallets, extrinsics) = perms.counts(); + Self::permissions_cost(assets, portfolios, pallets, extrinsics) + } + fn freeze_secondary_keys() -> Weight; fn unfreeze_secondary_keys() -> Weight; fn add_authorization() -> Weight; @@ -102,46 +136,50 @@ pub trait WeightInfo { fn add_investor_uniqueness_claim_v2() -> Weight; fn revoke_claim_by_index() -> Weight; + /// Add complexity cost of Permissions to `add_secondary_keys_with_authorization` extrinsic. + fn add_secondary_keys_full_v1( + additional_keys: &[SecondaryKeyWithAuthV1], + ) -> Weight { + Self::add_secondary_keys_perms_cost( + additional_keys + .iter() + .map(|auth| &auth.secondary_key.permissions), + ) + } + /// Add complexity cost of Permissions to `add_secondary_keys_with_authorization` extrinsic. fn add_secondary_keys_full( additional_keys: &[SecondaryKeyWithAuth], ) -> Weight { - let perm_cost = additional_keys.iter().fold(0u64, |cost, key_with_auth| { - let (assets, portfolios, pallets, extrinsics) = - key_with_auth.secondary_key.permissions.counts(); - let perm_cost = Self::permissions_cost(assets, portfolios, pallets, extrinsics); - cost.saturating_add(perm_cost) - }); - perm_cost.saturating_add(Self::add_secondary_keys_with_authorization( - additional_keys.len() as u32, - )) + Self::add_secondary_keys_perms_cost( + additional_keys + .iter() + .map(|auth| &auth.secondary_key.permissions), + ) + } + + /// Add complexity cost of Permissions to `add_secondary_keys_with_authorization` extrinsic. + fn add_secondary_keys_perms_cost<'a>( + perms: impl ExactSizeIterator, + ) -> Weight { + let len_cost = Self::add_secondary_keys_with_authorization(perms.len() as u32); + perms.fold(len_cost, |cost, key| { + cost.saturating_add(Self::permissions_cost_perms(key)) + }) } /// Add complexity cost of Permissions to `add_authorization` extrinsic. fn add_authorization_full(data: &AuthorizationData) -> Weight { let perm_cost = match data { - AuthorizationData::JoinIdentity(perms) => { - let (assets, portfolios, pallets, extrinsics) = perms.counts(); - Self::permissions_cost(assets, portfolios, pallets, extrinsics) - } + AuthorizationData::JoinIdentity(perms) => Self::permissions_cost_perms(perms), _ => 0, }; - perm_cost.saturating_add(Self::add_authorization()) } - /// Add complexity cost of Permissions to `set_permission_to_signer` extrinsic. - fn set_permission_to_signer_full(perms: &Permissions) -> Weight { - let (assets, portfolios, pallets, extrinsics) = perms.counts(); - Self::permissions_cost(assets, portfolios, pallets, extrinsics) - .saturating_add(Self::set_permission_to_signer()) - } - - /// Add complexity cost of Permissions to `legacy_set_permission_to_signer` extrinsic. - fn legacy_set_permission_to_signer_full(perms: &LegacyPermissions) -> Weight { - let (assets, portfolios, pallets, extrinsics) = perms.counts(); - Self::permissions_cost(assets, portfolios, pallets, extrinsics) - .saturating_add(Self::set_permission_to_signer()) + /// Add complexity cost of Permissions to `set_secondary_key_permissions` extrinsic. + fn set_secondary_key_permissions_full(perms: &Permissions) -> Weight { + Self::permissions_cost_perms(perms).saturating_add(Self::set_secondary_key_permissions()) } } @@ -162,14 +200,14 @@ pub trait Config: CommonConfig + pallet_timestamp::Config + crate::traits::base: /// Group module type CddServiceProviders: GroupTrait; /// Balances module - type Balances: Currency; + type Balances: Currency; /// Charges fee for forwarded call type ChargeTxFeeTarget: ChargeTxFee; /// Used to check and update CDD type CddHandler: CddAndFeeDetails::Call>; type Public: IdentifyAccount; - type OffChainSignature: Verify + Member + Decode + Encode; + type OffChainSignature: Verify + Member + Decode + Encode + TypeInfo; type ProtocolFee: ChargeProtocolFee; /// Origin for Governance Committee voting majority origin. @@ -186,6 +224,10 @@ pub trait Config: CommonConfig + pallet_timestamp::Config + crate::traits::base: /// POLYX given to primary keys of all new Identities type InitialPOLYX: Get<>::Balance>; + + /// Only allow MultiSig primary/secondary keys to be removed from an identity + /// if its POLYX balance is below this limit. + type MultiSigBalanceLimit: Get<>::Balance>; } decl_event!( @@ -194,39 +236,53 @@ decl_event!( AccountId = ::AccountId, Moment = ::Moment, { - /// DID, primary key account ID, secondary keys + /// Identity created. + /// + /// (DID, primary key, secondary keys) DidCreated(IdentityId, AccountId, Vec>), - /// DID, new keys + /// Secondary keys added to identity. + /// + /// (DID, new keys) SecondaryKeysAdded(IdentityId, Vec>), - /// DID, the keys that got removed - SecondaryKeysRemoved(IdentityId, Vec>), + /// Secondary keys removed from identity. + /// + /// (DID, the keys that got removed) + SecondaryKeysRemoved(IdentityId, Vec), - /// A signer left their identity. (did, signer) - SignerLeft(IdentityId, Signatory), + /// A secondary key left their identity. + /// + /// (DID, secondary key) + SecondaryKeyLeftIdentity(IdentityId, AccountId), - /// DID, updated secondary key, previous permissions, new permissions - SecondaryKeyPermissionsUpdated( - IdentityId, - SecondaryKey, - Permissions, - Permissions, - ), + /// Secondary key permissions updated. + /// + /// (DID, updated secondary key, previous permissions, new permissions) + SecondaryKeyPermissionsUpdated(IdentityId, AccountId, Permissions, Permissions), - /// DID, old primary key account ID, new ID + /// Primary key of identity changed. + /// + /// (DID, old primary key account ID, new ID) PrimaryKeyUpdated(IdentityId, AccountId, AccountId), - /// DID, claims + /// Claim added to identity. + /// + /// (DID, claim) ClaimAdded(IdentityId, IdentityClaim), - /// DID, ClaimType, Claim Issuer + /// Claim revoked from identity. + /// + /// (DID, claim) ClaimRevoked(IdentityId, IdentityClaim), - /// Asset DID + /// Asset's identity registered. + /// + /// (Asset DID, ticker) AssetDidRegistered(IdentityId, Ticker), /// New authorization added. + /// /// (authorised_by, target_did, target_key, auth_id, authorization_data, expiry) AuthorizationAdded( IdentityId, @@ -238,36 +294,40 @@ decl_event!( ), /// Authorization revoked by the authorizer. + /// /// (authorized_identity, authorized_key, auth_id) AuthorizationRevoked(Option, Option, u64), /// Authorization rejected by the user who was authorized. + /// /// (authorized_identity, authorized_key, auth_id) AuthorizationRejected(Option, Option, u64), /// Authorization consumed. + /// /// (authorized_identity, authorized_key, auth_id) AuthorizationConsumed(Option, Option, u64), - /// Off-chain Authorization has been revoked. - /// (Target Identity, Signatory) - OffChainAuthorizationRevoked(IdentityId, Signatory), - - /// CDD requirement for updating primary key changed. (new_requirement) + /// CDD requirement for updating primary key changed. + /// + /// (new_requirement) CddRequirementForPrimaryKeyUpdated(bool), /// CDD claims generated by `IdentityId` (a CDD Provider) have been invalidated from /// `Moment`. + /// + /// (CDD provider DID, disable from date) CddClaimsInvalidated(IdentityId, Moment), /// All Secondary keys of the identity ID are frozen. + /// + /// (DID) SecondaryKeysFrozen(IdentityId), /// All Secondary keys of the identity ID are unfrozen. + /// + /// (DID) SecondaryKeysUnfrozen(IdentityId), - - /// Mocked InvestorUid created. - MockInvestorUIDCreated(IdentityId, InvestorUid), } ); diff --git a/pallets/common/src/traits/imbalances.rs b/pallets/common/src/traits/imbalances.rs index 56463f7389..e3c4e2af07 100644 --- a/pallets/common/src/traits/imbalances.rs +++ b/pallets/common/src/traits/imbalances.rs @@ -15,7 +15,7 @@ use crate::traits::CommonConfig; use core::marker::PhantomData; -use frame_support::traits::{Imbalance, TryDrop}; +use frame_support::traits::{Imbalance, SameOrOther, TryDrop}; use polymesh_primitives::traits::BlockRewardsReserveCurrency; use polymesh_primitives::Balance; use sp_arithmetic::traits::Zero; @@ -29,6 +29,12 @@ use sp_std::{mem, result}; #[must_use] pub struct PositiveImbalance(Balance, PhantomData); +impl Default for PositiveImbalance { + fn default() -> Self { + Self::new(<_>::default()) + } +} + impl PositiveImbalance { /// Create a new positive imbalance from a balance. pub fn new(amount: Balance) -> Self { @@ -77,14 +83,16 @@ impl Imbalance for PositiveImbalance { mem::forget(other); } - fn offset(self, other: Self::Opposite) -> result::Result { + fn offset(self, other: Self::Opposite) -> SameOrOther { let (a, b) = (self.0, other.0); mem::forget((self, other)); - if a >= b { - Ok(Self::new(a - b)) + if a > b { + SameOrOther::Same(Self::new(a - b)) + } else if b > a { + SameOrOther::Other(NegativeImbalance::new(b - a)) } else { - Err(NegativeImbalance::new(b - a)) + SameOrOther::None } } @@ -105,6 +113,12 @@ impl Drop for PositiveImbalance { #[must_use] pub struct NegativeImbalance(Balance, PhantomData); +impl Default for NegativeImbalance { + fn default() -> Self { + Self::new(<_>::default()) + } +} + impl NegativeImbalance { /// Create a new negative imbalance from a balance. pub fn new(amount: Balance) -> Self { @@ -153,14 +167,16 @@ impl Imbalance for NegativeImbalance { mem::forget(other); } - fn offset(self, other: Self::Opposite) -> result::Result { + fn offset(self, other: Self::Opposite) -> SameOrOther { let (a, b) = (self.0, other.0); mem::forget((self, other)); - if a >= b { - Ok(Self::new(a - b)) + if a > b { + SameOrOther::Same(Self::new(a - b)) + } else if b > a { + SameOrOther::Other(PositiveImbalance::new(b - a)) } else { - Err(PositiveImbalance::new(b - a)) + SameOrOther::None } } diff --git a/pallets/common/src/traits/mod.rs b/pallets/common/src/traits/mod.rs index c186f4530d..a96dc904c9 100644 --- a/pallets/common/src/traits/mod.rs +++ b/pallets/common/src/traits/mod.rs @@ -15,7 +15,7 @@ use frame_support::dispatch::DispatchResult; use polymesh_primitives::{ - secondary_key::api::SecondaryKey, traits::BlockRewardsReserveCurrency, InvestorUid, + secondary_key::SecondaryKey, traits::BlockRewardsReserveCurrency, InvestorUid, }; pub trait CommonConfig: frame_system::Config + permissions::Config { diff --git a/pallets/common/src/traits/multisig.rs b/pallets/common/src/traits/multisig.rs index e09cb3533d..8d32ebec9d 100644 --- a/pallets/common/src/traits/multisig.rs +++ b/pallets/common/src/traits/multisig.rs @@ -18,25 +18,11 @@ //! The interface allows to process addition of a multisig signer from modules other than the //! multisig module itself. -use sp_std::vec::Vec; - /// This trait is used to add a signer to a multisig and enable unlinking multisig from an identity pub trait MultiSigSubTrait { - /// Fetches signers of a multisig - /// - /// # Arguments - /// * `multisig` - multisig AccountId - fn get_key_signers(multisig: &AccountId) -> Vec; - /// Checks if the account is a multisig /// /// # Arguments /// * `account` - AccountId to check fn is_multisig(account: &AccountId) -> bool; - - /// Checks if the account is a multisig signer - /// - /// # Arguments - /// * `account` - AccountId to check - fn is_signer(key: &AccountId) -> bool; } diff --git a/pallets/common/src/traits/permissions.rs b/pallets/common/src/traits/permissions.rs index aa3a5527ec..5629d878a7 100644 --- a/pallets/common/src/traits/permissions.rs +++ b/pallets/common/src/traits/permissions.rs @@ -13,7 +13,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use codec::{Decode, Encode}; use polymesh_primitives::{DispatchableName, IdentityId, PalletName, SecondaryKey}; /// Permissions module configuration trait. @@ -23,7 +22,7 @@ pub trait Config: frame_system::Config { } /// Result of `CheckAccountCallPermissions::check_account_call_permissions`. -pub struct AccountCallPermissionsData { +pub struct AccountCallPermissionsData { /// The primary identity of the call. pub primary_did: IdentityId, /// The secondary key of the call, if it is defined. @@ -31,7 +30,7 @@ pub struct AccountCallPermissionsData { } /// A permission checker for calls from accounts to extrinsics. -pub trait CheckAccountCallPermissions { +pub trait CheckAccountCallPermissions { /// Checks whether `who` can call the current extrinsic represented by `pallet_name` and /// `function_name`. /// diff --git a/pallets/common/src/traits/portfolio.rs b/pallets/common/src/traits/portfolio.rs index 80c3cf09e1..8b7d7bef78 100644 --- a/pallets/common/src/traits/portfolio.rs +++ b/pallets/common/src/traits/portfolio.rs @@ -21,7 +21,6 @@ use crate::{ traits::{balances::Memo, base, identity}, CommonConfig, }; -use codec::{Decode, Encode}; use frame_support::decl_event; use frame_support::dispatch::DispatchResult; use frame_support::weights::Weight; @@ -31,7 +30,7 @@ use polymesh_primitives::{ use sp_std::vec::Vec; /// This trait is used to accept custody of a portfolio -pub trait PortfolioSubTrait { +pub trait PortfolioSubTrait { /// Checks that the custodian is authorized for the portfolio /// /// # Arguments diff --git a/pallets/common/src/traits/statistics.rs b/pallets/common/src/traits/statistics.rs index fb90055e92..9c90d96911 100644 --- a/pallets/common/src/traits/statistics.rs +++ b/pallets/common/src/traits/statistics.rs @@ -2,8 +2,11 @@ use crate::asset::AssetFnTrait; use frame_support::decl_event; use frame_support::traits::Get; use frame_support::weights::Weight; -use polymesh_primitives::statistics::TransferManager; -use polymesh_primitives::{IdentityId, ScopeId, Ticker}; +use polymesh_primitives::{ + statistics::{AssetScope, StatType, StatUpdate}, + transfer_compliance::{TransferCondition, TransferConditionExemptKey}, + IdentityId, ScopeId, +}; use sp_std::vec::Vec; /// The main trait for statistics module @@ -12,31 +15,49 @@ pub trait Config: { /// The overarching event type. type Event: From + Into<::Event>; - /// Asset module + /// Asset module. type Asset: AssetFnTrait; - /// Maximum transfer managers that can be enabled for an Asset - type MaxTransferManagersPerAsset: Get; - /// Weights for extrinsics + /// Maximum stats that can be enabled for an Asset. + type MaxStatsPerAsset: Get; + /// Maximum transfer conditions that can be enabled for an Asset. + type MaxTransferConditionsPerAsset: Get; + /// Weights for extrinsics. type WeightInfo: WeightInfo; } /// Weight info for extrinsics pub trait WeightInfo { - fn add_transfer_manager() -> Weight; - fn remove_transfer_manager() -> Weight; - fn add_exempted_entities(i: u32) -> Weight; - fn remove_exempted_entities(i: u32) -> Weight; + fn set_active_asset_stats(i: u32) -> Weight; + fn batch_update_asset_stats(i: u32) -> Weight; + fn set_asset_transfer_compliance(i: u32) -> Weight; + fn set_entities_exempt(i: u32) -> Weight; } decl_event!( pub enum Event { - /// A new transfer manager was added. - TransferManagerAdded(IdentityId, Ticker, TransferManager), - /// An existing transfer manager was removed. - TransferManagerRemoved(IdentityId, Ticker, TransferManager), - /// `ScopeId`s were added to the exemption list. - ExemptionsAdded(IdentityId, Ticker, TransferManager, Vec), - /// `ScopeId`s were removed from the exemption list. - ExemptionsRemoved(IdentityId, Ticker, TransferManager, Vec), + /// Stat types added to asset. + /// + /// (Caller DID, Asset, Stat types) + StatTypesAdded(IdentityId, AssetScope, Vec), + /// Stat types removed from asset. + /// + /// (Caller DID, Asset, Stat types) + StatTypesRemoved(IdentityId, AssetScope, Vec), + /// Asset stats updated. + /// + /// (Caller DID, Asset, Stat type, Updates) + AssetStatsUpdated(IdentityId, AssetScope, StatType, Vec), + /// Set Transfer compliance rules for asset. + /// + /// (Caller DID, Asset, Transfer conditions) + SetAssetTransferCompliance(IdentityId, AssetScope, Vec), + /// Add `ScopeId`s exempt for transfer conditions matching exempt key. + /// + /// (Caller DID, Exempt key, Entities) + TransferConditionExemptionsAdded(IdentityId, TransferConditionExemptKey, Vec), + /// Remove `ScopeId`s exempt for transfer conditions matching exempt key. + /// + /// (Caller DID, Exempt key, Entities) + TransferConditionExemptionsRemoved(IdentityId, TransferConditionExemptKey, Vec), } ); diff --git a/pallets/compliance-manager/Cargo.toml b/pallets/compliance-manager/Cargo.toml index a4b5a608d4..b508fe8257 100644 --- a/pallets/compliance-manager/Cargo.toml +++ b/pallets/compliance-manager/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-compliance-manager" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -24,19 +24,20 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false} either = { version = "1.6.1", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } -pallet-timestamp = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } [features] diff --git a/pallets/contracts/Cargo.toml b/pallets/contracts/Cargo.toml index 5d43208a08..db69868e00 100644 --- a/pallets/contracts/Cargo.toml +++ b/pallets/contracts/Cargo.toml @@ -2,53 +2,49 @@ name = "polymesh-contracts" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" [dependencies] - -# Substrate specific serde = { version = "1.0.104", default-features = false } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -pallet-contracts = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -wat = { version = "1.0", optional = true, default-features = false } -parity-wasm = { version = "0.41.0", default-features = false } + +pwasm-utils = { version = "0.18.2", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # Polymesh specific +pallet-asset = { path = "../asset", default-features = false } pallet-base = { path = "../base", default-features = false } pallet-identity = { path = "../identity", default-features = false } +pallet-permissions = { path = "../permissions", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } polymesh-common-utilities = { path = "../common", default-features = false } -pallet-protocol-fee = { path = "../protocol-fee", default-features = false } -# Only in STD env -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] default = ["std"] no_std = [] std = [ "serde/std", - "sp-io/std", "codec/std", "sp-std/std", "sp-core/std", - "parity-wasm/std", - "sp-runtime/std", "frame-system/std", "frame-support/std", "pallet-identity/std", "pallet-contracts/std", "polymesh-primitives/std", - "pallet-protocol-fee/std", "polymesh-common-utilities/std", + "pwasm-utils/std", ] runtime-benchmarks = [ "frame-benchmarking", - "wat" + "pallet-contracts/runtime-benchmarks", ] diff --git a/pallets/contracts/fixtures/dummy.wat b/pallets/contracts/fixtures/dummy.wat deleted file mode 100644 index 86a0e612ff..0000000000 --- a/pallets/contracts/fixtures/dummy.wat +++ /dev/null @@ -1,4 +0,0 @@ -(module - (func (export "call")) - (func (export "deploy")) -) \ No newline at end of file diff --git a/pallets/contracts/fixtures/ptm.wat b/pallets/contracts/fixtures/ptm.wat deleted file mode 100644 index 63767fe3e3..0000000000 --- a/pallets/contracts/fixtures/ptm.wat +++ /dev/null @@ -1,12921 +0,0 @@ -(module - (type $t0 (func (param i32 i32 i32))) - (type $t1 (func (param i32 i32 i32 i32))) - (type $t2 (func (param i32 i32))) - (type $t3 (func (param i32))) - (type $t4 (func (param i32 i32 i32) (result i32))) - (type $t5 (func (param i32 i32) (result i32))) - (type $t6 (func (param i32) (result i32))) - (type $t7 (func (param i32 i32 i64))) - (type $t8 (func (param i32 i32 i64 i64))) - (type $t9 (func (param i32 i64 i64))) - (type $t10 (func (param i32 i64) (result i32))) - (type $t11 (func (param i64 i64 i32))) - (type $t12 (func (param i64 i64))) - (type $t13 (func (result i32))) - (type $t14 (func (param i32 i32 i32 i32 i32))) - (type $t15 (func (param i32 i64 i64 i64 i64))) - (type $t16 (func (param i32 i64 i64 i32))) - (type $t17 (func (param i32 i64 i64))) - (type $t18 (func (param i32 i32 i32))) - (type $t19 (func (param i32 i32) (result i32))) - (type $t20 (func (param i32 i64 i64 i64 i64))) - (import "seal0" "seal_hash_blake2_256" (func $seal0.seal_hash_blake2_256 (type $t0))) - (import "seal0" "seal_set_storage" (func $seal0.seal_set_storage (type $t0))) - (import "seal0" "seal_deposit_event" (func $seal0.seal_deposit_event (type $t1))) - (import "seal0" "seal_caller" (func $seal0.seal_caller (type $t2))) - (import "seal0" "seal_value_transferred" (func $seal0.seal_value_transferred (type $t2))) - (import "seal0" "seal_clear_storage" (func $seal0.seal_clear_storage (type $t3))) - (import "seal0" "seal_get_storage" (func $seal0.seal_get_storage (type $t4))) - (import "seal0" "seal_input" (func $seal0.seal_input (type $t2))) - (import "seal0" "seal_return" (func $seal0.seal_return (type $t0))) - (import "env" "memory" (memory $env.memory 2 16)) - (func $f9 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i64) (local $l6 i64) (local $l7 i64) - local.get $p1 - i64.load offset=16 align=4 - local.set $l5 - local.get $p1 - local.get $p2 - i64.load offset=16 align=4 - i64.store offset=16 align=4 - local.get $p1 - i64.load offset=8 align=4 - local.set $l7 - local.get $p1 - local.get $p2 - i64.load offset=8 align=4 - i64.store offset=8 align=4 - local.get $p1 - i64.load align=4 - local.set $l6 - local.get $p1 - local.get $p2 - i64.load align=4 - i64.store align=4 - local.get $p0 - local.get $l5 - i64.store offset=16 align=4 - local.get $p0 - local.get $l7 - i64.store offset=8 align=4 - local.get $p0 - local.get $l6 - i64.store align=4 - local.get $p1 - i32.const 24 - i32.add - local.tee $l3 - i64.load align=4 - local.set $l5 - local.get $l3 - local.get $p2 - i32.const 24 - i32.add - i64.load align=4 - i64.store align=4 - local.get $p0 - i32.const 24 - i32.add - local.get $l5 - i64.store align=4 - local.get $p1 - i32.const 32 - i32.add - local.tee $l3 - i32.load - local.set $l4 - local.get $l3 - local.get $p2 - i32.const 32 - i32.add - i32.load - i32.store - local.get $p0 - i32.const 32 - i32.add - local.get $l4 - i32.store - block $B0 - local.get $p2 - i32.load8_u - i32.const 2 - i32.eq - if $I1 - local.get $l6 - i32.wrap_i64 - i32.const 255 - i32.and - i32.const 2 - i32.eq - br_if $B0 - end - local.get $p1 - i32.const 0 - i32.store8 offset=36 - end) - (func $f10 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 240 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 176 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 160 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $p1 - i64.load align=1 - i64.store offset=152 - local.get $l2 - i32.const 16 - i32.add - local.get $p0 - i32.const 40 - i32.add - local.get $l2 - i32.const 152 - i32.add - call $f11 - block $B0 - block $B1 - block $B2 (result i32) - local.get $l2 - i32.load offset=16 - i32.const 1 - i32.ne - if $I3 - local.get $l2 - i32.const 72 - i32.add - local.get $l2 - i32.const 16 - i32.add - i32.const 4 - i32.or - i32.const 48 - call $f99 - local.get $l2 - i32.const 216 - i32.add - local.get $p0 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 224 - i32.add - local.get $p0 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 232 - i32.add - local.get $p0 - i32.const 32 - i32.add - i64.load - i64.store - local.get $l2 - local.get $p0 - i64.load offset=8 - i64.store offset=208 - block $B4 - block $B5 - local.get $p0 - i64.load - i64.const 1 - i64.ne - br_if $B5 - local.get $l2 - i32.const 176 - i32.add - local.tee $p0 - local.get $l2 - i32.const 232 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.tee $l3 - local.get $l2 - i32.const 224 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 160 - i32.add - local.tee $l4 - local.get $l2 - i32.const 216 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=208 - i64.store offset=152 - local.get $l2 - i32.const 120 - i32.add - local.get $l2 - i32.const 152 - i32.add - local.get $p1 - call $f12 - local.get $p0 - local.get $l2 - i32.const 144 - i32.add - i64.load - i64.store - local.get $l3 - local.get $l2 - i32.const 136 - i32.add - i64.load - i64.store - local.get $l4 - local.get $l2 - i32.const 128 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=120 - i64.store offset=152 - local.get $l2 - i32.const 16384 - i32.store offset=204 - local.get $l2 - i32.const 65796 - i32.store offset=200 - local.get $l2 - i32.const 152 - i32.add - local.get $l2 - i32.const 200 - i32.add - call $f13 - local.tee $p0 - i32.const 3 - i32.eq - br_if $B5 - local.get $p0 - i32.const 10 - i32.ne - br_if $B1 - local.get $l2 - local.get $l2 - i64.load offset=200 - i64.store offset=208 - local.get $l2 - i32.const 208 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $p0 - i32.const 2 - i32.eq - br_if $B0 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 208 - i32.add - call $f15 - local.get $l2 - i32.load offset=8 - br_if $B0 - local.get $l2 - i32.load offset=12 - local.set $l3 - br $B4 - end - i32.const 2 - local.set $p0 - end - local.get $l2 - i32.const 152 - i32.add - local.get $l2 - i32.const 72 - i32.add - i32.const 48 - call $f99 - i32.const 12 - call $f16 - local.tee $p1 - i32.const 1 - i32.store8 offset=8 - local.get $p1 - local.get $p0 - i32.store8 offset=4 - local.get $p1 - local.get $l3 - i32.store - local.get $l2 - i32.const 152 - i32.add - local.get $p1 - call $f17 - i32.load - br $B2 - end - local.get $l2 - i32.const 24 - i32.add - i32.load - local.get $l2 - i32.const 28 - i32.add - i32.load - i32.const 2 - i32.shl - i32.add - i32.const 4 - i32.add - i32.load - end - local.get $l2 - i32.const 240 - i32.add - global.set $g0 - return - end - unreachable - end - unreachable) - (func $f11 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) - block $B0 (result i32) - local.get $p1 - i32.load - local.tee $l3 - if $I1 - local.get $p1 - i32.load offset=4 - br $B0 - end - i32.const 404 - call $f16 - local.tee $l3 - i32.const 0 - i32.store16 offset=50 - local.get $l3 - i32.const 0 - i32.store - local.get $p1 - i32.const 0 - i32.store offset=4 - local.get $p1 - local.get $l3 - i32.store - i32.const 0 - end - local.set $l5 - local.get $p0 - block $B2 (result i32) - block $B3 - loop $L4 - local.get $l3 - i32.const 52 - i32.add - local.set $l7 - local.get $l3 - i32.load16_u offset=50 - local.set $l6 - i32.const 0 - local.set $l4 - block $B5 - loop $L6 - local.get $l4 - local.get $l6 - i32.eq - br_if $B5 - local.get $p2 - local.get $l7 - call $f101 - local.set $l8 - local.get $l7 - i32.const 32 - i32.add - local.set $l7 - local.get $l4 - i32.const 1 - i32.add - local.set $l4 - block $B7 - i32.const 1 - i32.const -1 - local.get $l8 - i32.const -1 - i32.gt_s - select - i32.const 0 - local.get $l8 - select - br_table $B3 $L6 $B7 - end - end - local.get $l4 - i32.const -1 - i32.add - local.set $l6 - end - local.get $l5 - if $I8 - local.get $l5 - i32.const -1 - i32.add - local.set $l5 - local.get $l3 - local.get $l6 - i32.const 2 - i32.shl - i32.add - i32.const 404 - i32.add - i32.load - local.set $l3 - br $L4 - end - end - local.get $p0 - i32.const 0 - i32.store offset=4 - local.get $p0 - i32.const 16 - i32.add - local.get $p1 - i32.store - local.get $p0 - i32.const 12 - i32.add - local.get $l6 - i32.store - local.get $p0 - i32.const 8 - i32.add - local.get $l3 - i32.store - local.get $p0 - i32.const 20 - i32.add - local.get $p2 - i64.load align=1 - i64.store align=1 - local.get $p0 - i32.const 28 - i32.add - local.get $p2 - i32.const 8 - i32.add - i64.load align=1 - i64.store align=1 - local.get $p0 - i32.const 36 - i32.add - local.get $p2 - i32.const 16 - i32.add - i64.load align=1 - i64.store align=1 - local.get $p0 - i32.const 44 - i32.add - local.get $p2 - i32.const 24 - i32.add - i64.load align=1 - i64.store align=1 - i32.const 0 - br $B2 - end - local.get $p0 - local.get $l5 - i32.store offset=4 - local.get $p0 - i32.const 16 - i32.add - local.get $p1 - i32.store - local.get $p0 - i32.const 12 - i32.add - local.get $l4 - i32.const -1 - i32.add - i32.store - local.get $p0 - i32.const 8 - i32.add - local.get $l3 - i32.store - i32.const 1 - end - i32.store) - (func $f12 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) - global.get $g0 - i32.const 80 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - i32.const 26 - i32.add - i32.const 112 - i32.store8 - local.get $l3 - i32.const 24 - i32.add - i32.const 24941 - i32.store16 - local.get $l3 - i64.const 7526466502114635369 - i64.store offset=16 - local.get $l3 - local.get $p2 - i32.store offset=12 - local.get $l3 - local.get $p1 - i32.store offset=8 - local.get $l3 - i32.const 56 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l3 - i32.const 48 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l3 - i32.const 40 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store offset=32 - local.get $l3 - i64.const 16384 - i64.store offset=68 align=4 - local.get $l3 - i32.const 65796 - i32.store offset=64 - local.get $l3 - i32.const -64 - i32.sub - local.get $l3 - i32.const 16 - i32.add - i32.const 11 - call $f18 - local.get $l3 - i32.const -64 - i32.sub - local.get $p1 - i32.const 32 - call $f18 - local.get $p2 - local.get $l3 - i32.const -64 - i32.sub - call $f19 - local.get $l3 - i32.load offset=68 - local.get $l3 - i32.load offset=72 - local.tee $p1 - i32.lt_u - if $I0 - unreachable - end - local.get $l3 - i32.load offset=64 - local.get $p1 - local.get $l3 - i32.const 32 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $p0 - i32.const 24 - i32.add - local.get $l4 - i64.load - i64.store align=1 - local.get $p0 - i32.const 16 - i32.add - local.get $l5 - i64.load - i64.store align=1 - local.get $p0 - i32.const 8 - i32.add - local.get $l6 - i64.load - i64.store align=1 - local.get $p0 - local.get $l3 - i64.load offset=32 - i64.store align=1 - local.get $l3 - i32.const 80 - i32.add - global.set $g0) - (func $f13 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - local.get $p1 - i32.load offset=4 - i32.store offset=12 - local.get $p0 - local.get $p1 - i32.load - local.get $l2 - i32.const 12 - i32.add - call $seal0.seal_get_storage - local.set $p0 - local.get $p1 - local.get $l2 - i32.load offset=12 - call $f77 - i32.const 9 - local.set $p1 - block $B0 - block $B1 - block $B2 - block $B3 - block $B4 - block $B5 - block $B6 - block $B7 - block $B8 - block $B9 - local.get $p0 - br_table $B9 $B8 $B7 $B6 $B5 $B4 $B3 $B2 $B1 $B0 - end - i32.const 10 - local.set $p1 - br $B0 - end - i32.const 1 - local.set $p1 - br $B0 - end - i32.const 2 - local.set $p1 - br $B0 - end - i32.const 3 - local.set $p1 - br $B0 - end - i32.const 4 - local.set $p1 - br $B0 - end - i32.const 5 - local.set $p1 - br $B0 - end - i32.const 6 - local.set $p1 - br $B0 - end - i32.const 7 - local.set $p1 - br $B0 - end - i32.const 8 - local.set $p1 - end - local.get $l2 - i32.const 16 - i32.add - global.set $g0 - local.get $p1) - (func $f14 (type $t6) (param $p0 i32) (result i32) - (local $l1 i32) (local $l2 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 8 - i32.add - local.get $p0 - call $f23 - local.get $l1 - i32.load8_u offset=9 - local.set $p0 - local.get $l1 - i32.load8_u offset=8 - local.set $l2 - local.get $l1 - i32.const 16 - i32.add - global.set $g0 - i32.const 2 - i32.const 1 - i32.const 2 - local.get $p0 - i32.const 1 - i32.eq - select - i32.const 0 - local.get $p0 - select - local.get $l2 - i32.const 1 - i32.and - select) - (func $f15 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 0 - i32.store offset=12 - block $B0 - local.get $p1 - local.get $l2 - i32.const 12 - i32.add - i32.const 4 - call $f49 - i32.eqz - if $I1 - local.get $l2 - i32.load offset=12 - local.set $p1 - br $B0 - end - i32.const 1 - local.set $l3 - end - local.get $p0 - local.get $p1 - i32.store offset=4 - local.get $p0 - local.get $l3 - i32.store - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f16 (type $t6) (param $p0 i32) (result i32) - (local $l1 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 8 - i32.add - local.get $p0 - i32.const 4 - call $f57 - local.get $l1 - i32.load offset=8 - local.tee $p0 - i32.eqz - if $I0 - unreachable - end - local.get $l1 - i32.const 16 - i32.add - global.set $g0 - local.get $p0) - (func $f17 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i32) (local $l11 i32) (local $l12 i32) (local $l13 i32) (local $l14 i32) (local $l15 i32) (local $l16 i32) (local $l17 i32) (local $l18 i32) (local $l19 i32) (local $l20 i32) (local $l21 i32) (local $l22 i32) (local $l23 i32) (local $l24 i32) (local $l25 i32) (local $l26 i32) (local $l27 i32) (local $l28 i64) (local $l29 i64) (local $l30 i64) (local $l31 i64) - global.get $g0 - i32.const 192 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 152 - i32.add - local.get $p0 - i32.const 8 - i32.add - i32.load - i32.store - local.get $l2 - local.get $p0 - i64.load align=4 - i64.store offset=144 - local.get $l2 - i32.const 104 - i32.add - local.tee $l4 - local.get $p0 - i32.const 40 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 96 - i32.add - local.tee $l5 - local.get $p0 - i32.const 32 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 88 - i32.add - local.tee $l11 - local.get $p0 - i32.const 24 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $p0 - i64.load offset=16 align=1 - i64.store offset=80 - block $B0 - block $B1 - block $B2 (result i32) - local.get $l2 - i32.load offset=148 - local.tee $l3 - i32.load16_u offset=50 - i32.const 11 - i32.ge_u - if $I3 - local.get $l2 - i32.const 160 - i32.add - local.get $l2 - i32.load offset=152 - call $f50 - local.get $l2 - i32.const 168 - i32.add - local.tee $l6 - i32.load - local.set $l9 - local.get $l2 - i32.load offset=164 - local.set $l12 - local.get $l2 - i32.load offset=160 - local.set $l4 - local.get $l2 - i32.load offset=144 - local.set $l8 - i32.const 404 - call $f16 - local.tee $l7 - i32.const 0 - i32.store16 offset=50 - local.get $l7 - i32.const 0 - i32.store - local.get $l6 - local.get $l3 - i32.const 52 - i32.add - local.tee $l13 - local.get $l4 - i32.const 5 - i32.shl - i32.add - local.tee $l5 - i32.const 8 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 176 - i32.add - local.tee $l14 - local.get $l5 - i32.const 16 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 184 - i32.add - local.tee $l15 - local.get $l5 - i32.const 24 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $l5 - i64.load align=1 - i64.store offset=160 - local.get $l3 - i32.const 4 - i32.add - local.tee $l10 - local.get $l4 - i32.const 2 - i32.shl - i32.add - i32.load - local.set $l11 - local.get $l7 - i32.const 52 - i32.add - local.get $l13 - local.get $l4 - i32.const 1 - i32.add - local.tee $l16 - i32.const 5 - i32.shl - i32.add - local.get $l3 - i32.load16_u offset=50 - local.get $l4 - i32.const -1 - i32.xor - i32.add - local.tee $l5 - i32.const 5 - i32.shl - call $f99 - local.get $l7 - i32.const 4 - i32.add - local.get $l10 - local.get $l16 - i32.const 2 - i32.shl - i32.add - local.get $l5 - i32.const 2 - i32.shl - call $f99 - local.get $l3 - local.get $l4 - i32.store16 offset=50 - local.get $l7 - local.get $l5 - i32.store16 offset=50 - local.get $l2 - i32.const 136 - i32.add - local.get $l15 - i64.load - i64.store - local.get $l2 - i32.const 128 - i32.add - local.get $l14 - i64.load - i64.store - local.get $l2 - i32.const 120 - i32.add - local.get $l6 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=160 - i64.store offset=112 - block $B4 - local.get $l12 - i32.const 1 - i32.eq - if $I5 - local.get $l2 - local.get $l7 - i32.store offset=4 - local.get $l2 - i32.const 0 - i32.store - br $B4 - end - local.get $l2 - local.get $l3 - i32.store offset=4 - local.get $l2 - local.get $l8 - i32.store - end - local.get $l2 - local.get $l9 - i32.store offset=8 - local.get $l2 - i32.const 184 - i32.add - local.get $l2 - i32.const 104 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 176 - i32.add - local.get $l2 - i32.const 96 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $l2 - i32.const 88 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=80 - i64.store offset=160 - local.get $l2 - local.get $l2 - i32.const 160 - i32.add - local.get $p1 - call $f51 - local.set $l16 - local.get $l2 - i32.const 40 - i32.add - local.get $l2 - i32.const 120 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 48 - i32.add - local.get $l2 - i32.const 128 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 56 - i32.add - local.get $l2 - i32.const 136 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=112 - i64.store offset=32 - i32.const 1 - br $B2 - end - local.get $l2 - i32.const 184 - i32.add - local.get $l4 - i64.load - i64.store - local.get $l2 - i32.const 176 - i32.add - local.get $l5 - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $l11 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=80 - i64.store offset=160 - local.get $l2 - i32.const 144 - i32.add - local.get $l2 - i32.const 160 - i32.add - local.get $p1 - call $f51 - local.set $l16 - local.get $l2 - i32.load offset=152 - local.set $l11 - local.get $l2 - i32.load offset=144 - local.set $l8 - i32.const 0 - end - i32.eqz - br_if $B1 - local.get $l2 - i32.const 24 - i32.add - local.tee $l19 - local.get $l2 - i32.const 56 - i32.add - local.tee $l20 - i64.load - i64.store - local.get $l2 - i32.const 16 - i32.add - local.tee $l21 - local.get $l2 - i32.const 48 - i32.add - local.tee $l22 - i64.load - i64.store - local.get $l2 - i32.const 8 - i32.add - local.tee $l23 - local.get $l2 - i32.const 40 - i32.add - local.tee $l24 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=32 - i64.store - i32.const 0 - local.set $l9 - loop $L6 - block $B7 - block $B8 - block $B9 - local.get $l3 - i32.load - local.tee $l5 - if $I10 - local.get $l2 - local.get $l3 - i32.load16_u offset=48 - local.tee $l6 - i32.store offset=72 - local.get $l2 - local.get $l5 - i32.store offset=68 - local.get $l2 - local.get $l8 - i32.const 1 - i32.add - local.tee $l4 - i32.store offset=64 - local.get $l2 - i32.const 104 - i32.add - local.tee $l12 - local.get $l19 - i64.load - i64.store - local.get $l2 - i32.const 96 - i32.add - local.tee $l13 - local.get $l21 - i64.load - i64.store - local.get $l2 - i32.const 88 - i32.add - local.tee $l14 - local.get $l23 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load - i64.store offset=80 - local.get $l8 - local.get $l9 - i32.ne - br_if $B8 - local.get $l5 - i32.load16_u offset=50 - i32.const 11 - i32.lt_u - br_if $B9 - local.get $l2 - i32.const 160 - i32.add - local.get $l6 - call $f50 - local.get $l2 - i32.load offset=168 - local.set $l25 - local.get $l2 - i32.load offset=164 - local.set $l26 - local.get $l2 - i32.load offset=160 - local.set $l3 - i32.const 452 - call $f16 - local.tee $p1 - i32.const 0 - i32.store16 offset=50 - local.get $p1 - i32.const 0 - i32.store - local.get $l2 - i32.const 168 - i32.add - local.tee $l8 - local.get $l5 - i32.const 52 - i32.add - local.tee $l10 - local.get $l3 - i32.const 5 - i32.shl - i32.add - local.tee $l6 - i32.const 8 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 176 - i32.add - local.tee $l9 - local.get $l6 - i32.const 16 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 184 - i32.add - local.tee $l15 - local.get $l6 - i32.const 24 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $l6 - i64.load align=1 - i64.store offset=160 - local.get $l5 - i32.const 4 - i32.add - local.tee $l17 - local.get $l3 - i32.const 2 - i32.shl - i32.add - i32.load - local.set $l6 - local.get $p1 - i32.const 52 - i32.add - local.get $l10 - local.get $l3 - i32.const 1 - i32.add - local.tee $l18 - i32.const 5 - i32.shl - i32.add - local.get $l5 - i32.load16_u offset=50 - local.tee $l27 - local.get $l3 - i32.const -1 - i32.xor - i32.add - local.tee $l10 - i32.const 5 - i32.shl - call $f99 - local.get $p1 - i32.const 4 - i32.add - local.get $l17 - local.get $l18 - i32.const 2 - i32.shl - local.tee $l18 - i32.add - local.get $l10 - i32.const 2 - i32.shl - call $f99 - local.get $l5 - local.get $l3 - i32.store16 offset=50 - local.get $p1 - local.get $l10 - i32.store16 offset=50 - local.get $p1 - i32.const 404 - i32.add - local.get $l5 - local.get $l18 - i32.add - i32.const 404 - i32.add - local.get $l27 - local.get $l3 - i32.sub - i32.const 2 - i32.shl - call $f99 - local.get $l2 - local.get $p1 - i32.store offset=148 - local.get $l2 - local.get $l4 - i32.store offset=144 - local.get $l2 - i32.const 0 - i32.store8 offset=120 - local.get $l2 - local.get $l10 - i32.store offset=116 - local.get $l2 - i32.const 0 - i32.store offset=112 - local.get $l2 - i32.const 144 - i32.add - local.get $l2 - i32.const 112 - i32.add - call $f52 - local.get $l2 - i32.const 136 - i32.add - local.tee $l3 - local.get $l15 - i64.load - i64.store - local.get $l2 - i32.const 128 - i32.add - local.tee $l10 - local.get $l9 - i64.load - i64.store - local.get $l2 - i32.const 120 - i32.add - local.tee $l17 - local.get $l8 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=160 - i64.store offset=112 - block $B11 - local.get $l26 - i32.const 1 - i32.eq - if $I12 - local.get $l2 - local.get $l25 - i32.store offset=152 - local.get $l2 - local.get $p1 - i32.store offset=148 - br $B11 - end - local.get $l2 - local.get $l25 - i32.store offset=152 - local.get $l2 - local.get $l5 - i32.store offset=148 - end - local.get $l2 - local.get $l4 - i32.store offset=144 - local.get $l15 - local.get $l12 - i64.load - i64.store - local.get $l9 - local.get $l13 - i64.load - i64.store - local.get $l8 - local.get $l14 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=80 - i64.store offset=160 - local.get $l2 - i32.const 144 - i32.add - local.get $l2 - i32.const 160 - i32.add - local.get $l11 - local.get $l7 - call $f53 - local.get $l20 - local.get $l3 - i64.load - i64.store - local.get $l22 - local.get $l10 - i64.load - i64.store - local.get $l24 - local.get $l17 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=112 - i64.store offset=32 - i32.const 1 - local.set $l3 - local.get $l4 - local.set $l9 - br $B7 - end - local.get $l2 - i32.const 104 - i32.add - local.get $l2 - i32.const 24 - i32.add - i64.load - local.tee $l28 - i64.store - local.get $l2 - i32.const 96 - i32.add - local.get $l2 - i32.const 16 - i32.add - i64.load - local.tee $l29 - i64.store - local.get $l2 - i32.const 88 - i32.add - local.get $l2 - i32.const 8 - i32.add - i64.load - local.tee $l30 - i64.store - local.get $l2 - local.get $l2 - i64.load - local.tee $l31 - i64.store offset=80 - local.get $l2 - i32.const 136 - i32.add - local.tee $l3 - local.get $l28 - i64.store - local.get $l2 - i32.const 128 - i32.add - local.tee $l5 - local.get $l29 - i64.store - local.get $l2 - i32.const 120 - i32.add - local.tee $l8 - local.get $l30 - i64.store - local.get $l2 - local.get $l31 - i64.store offset=112 - local.get $p0 - i32.load offset=12 - local.tee $p1 - i32.load - local.tee $l4 - i32.eqz - br_if $B8 - i32.const 452 - call $f16 - local.tee $p0 - i32.const 0 - i32.store16 offset=50 - local.get $p0 - i32.const 0 - i32.store - local.get $p0 - local.get $p1 - i32.const 0 - local.get $l4 - select - local.tee $l4 - i32.load - i32.store offset=404 - local.get $l4 - local.get $p0 - i32.store - local.get $l4 - local.get $l4 - i32.load offset=4 - local.tee $l4 - i32.const 1 - i32.add - i32.store offset=4 - local.get $p0 - i32.load offset=404 - local.tee $l6 - i32.const 0 - i32.store16 offset=48 - local.get $l6 - local.get $p0 - i32.store - local.get $l2 - i32.const 184 - i32.add - local.get $l3 - i64.load - i64.store - local.get $l2 - i32.const 176 - i32.add - local.get $l5 - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $l8 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=112 - i64.store offset=160 - local.get $l4 - local.get $l9 - i32.ne - br_if $B8 - local.get $p0 - i32.load16_u offset=50 - local.tee $l4 - i32.const 10 - i32.gt_u - br_if $B8 - local.get $p0 - local.get $l4 - i32.const 1 - i32.add - local.tee $l5 - i32.store16 offset=50 - local.get $p0 - local.get $l4 - i32.const 5 - i32.shl - i32.add - local.tee $l3 - i32.const 52 - i32.add - local.get $l2 - i64.load offset=160 - i64.store align=1 - local.get $l3 - i32.const 60 - i32.add - local.get $l2 - i32.const 168 - i32.add - i64.load - i64.store align=1 - local.get $l3 - i32.const 68 - i32.add - local.get $l2 - i32.const 176 - i32.add - i64.load - i64.store align=1 - local.get $l3 - i32.const 76 - i32.add - local.get $l2 - i32.const 184 - i32.add - i64.load - i64.store align=1 - local.get $p0 - local.get $l4 - i32.const 2 - i32.shl - i32.add - i32.const 4 - i32.add - local.get $l11 - i32.store - local.get $p0 - local.get $l5 - i32.const 2 - i32.shl - i32.add - i32.const 404 - i32.add - local.get $l7 - i32.store - local.get $l7 - local.get $p0 - i32.store - local.get $l7 - local.get $l5 - i32.store16 offset=48 - local.get $p1 - local.get $p1 - i32.load offset=8 - i32.const 1 - i32.add - i32.store offset=8 - br $B0 - end - local.get $l2 - i32.const 184 - i32.add - local.get $l12 - i64.load - i64.store - local.get $l2 - i32.const 176 - i32.add - local.get $l13 - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $l14 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=80 - i64.store offset=160 - local.get $l2 - i32.const -64 - i32.sub - local.get $l2 - i32.const 160 - i32.add - local.get $l11 - local.get $l7 - call $f53 - i32.const 0 - local.set $l3 - br $B7 - end - unreachable - end - local.get $l3 - i32.eqz - br_if $B1 - local.get $l19 - local.get $l20 - i64.load - i64.store - local.get $l21 - local.get $l22 - i64.load - i64.store - local.get $l23 - local.get $l24 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=32 - i64.store - local.get $p1 - local.set $l7 - local.get $l6 - local.set $l11 - local.get $l5 - local.set $l3 - local.get $l4 - local.set $l8 - br $L6 - end - unreachable - end - local.get $p0 - i32.load offset=12 - local.tee $p0 - local.get $p0 - i32.load offset=8 - i32.const 1 - i32.add - i32.store offset=8 - end - local.get $l2 - i32.const 192 - i32.add - global.set $g0 - local.get $l16) - (func $f18 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - i32.const 8 - i32.add - local.get $p0 - i32.load offset=8 - local.tee $l4 - local.get $p2 - local.get $l4 - i32.add - local.get $p0 - i32.load - local.get $p0 - i32.load offset=4 - call $f90 - local.get $p2 - local.get $l3 - i32.load offset=12 - i32.ne - if $I0 - unreachable - end - local.get $l3 - i32.load offset=8 - local.get $p1 - local.get $p2 - call $f99 - local.get $p0 - local.get $p0 - i32.load offset=8 - local.get $p2 - i32.add - i32.store offset=8 - local.get $l3 - i32.const 16 - i32.add - global.set $g0) - (func $f19 (type $t2) (param $p0 i32) (param $p1 i32) - local.get $p0 - local.get $p1 - call $f48) - (func $f20 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i64) (local $l11 i64) (local $l12 i64) (local $l13 i64) - global.get $g0 - i32.const 272 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 32 - i32.add - local.get $p0 - i32.const 40 - i32.add - local.get $p1 - call $f21 - block $B0 - block $B1 (result i32) - local.get $l2 - i32.load offset=32 - i32.const 1 - i32.ne - if $I2 - local.get $l2 - i32.const 72 - i32.add - local.get $l2 - i32.const 52 - i32.add - i32.load - i32.store - local.get $l2 - i32.const -64 - i32.sub - local.get $l2 - i32.const 44 - i32.add - i64.load align=4 - i64.store - local.get $l2 - local.get $l2 - i64.load offset=36 align=4 - i64.store offset=56 - local.get $p0 - i64.load - local.set $l10 - local.get $l2 - i32.const 256 - i32.add - local.tee $l3 - local.get $p0 - i32.const 32 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 248 - i32.add - local.tee $l5 - local.get $p0 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 240 - i32.add - local.tee $l6 - local.get $p0 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - local.get $p0 - i64.load offset=8 - i64.store offset=232 - block $B3 - local.get $l10 - i64.const 1 - i64.ne - if $I4 - i32.const 3 - local.set $p1 - br $B3 - end - local.get $l2 - i32.const 136 - i32.add - local.tee $p0 - local.get $l3 - i64.load - local.tee $l10 - i64.store - local.get $l2 - i32.const 128 - i32.add - local.tee $l4 - local.get $l5 - i64.load - local.tee $l11 - i64.store - local.get $l2 - i32.const 120 - i32.add - local.tee $l7 - local.get $l6 - i64.load - local.tee $l12 - i64.store - local.get $l2 - local.get $l2 - i64.load offset=232 - local.tee $l13 - i64.store offset=112 - local.get $l3 - local.get $l10 - i64.store - local.get $l5 - local.get $l11 - i64.store - local.get $l6 - local.get $l12 - i64.store - local.get $l2 - local.get $l13 - i64.store offset=232 - local.get $l2 - i32.const 80 - i32.add - local.get $l2 - i32.const 232 - i32.add - local.get $p1 - i64.extend_i32_u - call $f22 - local.get $p0 - local.get $l2 - i32.const 104 - i32.add - i64.load - i64.store - local.get $l4 - local.get $l2 - i32.const 96 - i32.add - i64.load - i64.store - local.get $l7 - local.get $l2 - i32.const 88 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=80 - i64.store offset=112 - local.get $l2 - i32.const 16384 - i32.store offset=148 - local.get $l2 - i32.const 65796 - i32.store offset=144 - block $B5 - local.get $l2 - i32.const 112 - i32.add - local.get $l2 - i32.const 144 - i32.add - call $f13 - local.tee $p0 - i32.const 3 - i32.ne - if $I6 - local.get $p0 - i32.const 10 - i32.ne - br_if $B0 - local.get $l2 - local.get $l2 - i64.load offset=144 - i64.store offset=216 - local.get $l2 - i32.const 24 - i32.add - local.get $l2 - i32.const 216 - i32.add - call $f23 - i32.const 1 - local.set $p0 - block $B7 - block $B8 - local.get $l2 - i32.load8_u offset=24 - i32.const 1 - i32.and - br_if $B8 - i32.const 2 - local.set $p1 - block $B9 - block $B10 - local.get $l2 - i32.load8_u offset=25 - br_table $B10 $B9 $B7 - end - local.get $l2 - i32.const 16 - i32.add - local.get $l2 - i32.const 216 - i32.add - call $f15 - local.get $l2 - i32.load offset=16 - br_if $B8 - local.get $l2 - i32.load offset=20 - local.set $l5 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 216 - i32.add - call $f15 - local.get $l2 - i32.load offset=8 - br_if $B8 - local.get $l2 - i32.load offset=12 - local.set $l6 - local.get $l2 - i32.const 214 - i32.add - local.get $l2 - i32.const 230 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - i32.const 192 - i32.add - local.get $l2 - i32.const 240 - i32.add - i64.load align=4 - i64.store - local.get $l2 - i32.const 200 - i32.add - local.get $l2 - i32.const 248 - i32.add - i64.load align=4 - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=228 align=1 - i32.store16 offset=212 - local.get $l2 - local.get $l2 - i64.load offset=232 align=4 - i64.store offset=184 - i32.const 0 - local.set $p0 - i32.const 0 - local.set $p1 - br $B7 - end - local.get $l2 - i32.const 232 - i32.add - local.get $l2 - i32.const 216 - i32.add - call $f24 - i32.const 1 - local.set $p1 - local.get $l2 - i32.load8_u offset=232 - i32.const 1 - i32.ne - if $I11 - local.get $l2 - i32.const 214 - i32.add - local.get $l2 - i32.load8_u offset=235 - i32.store8 - local.get $l2 - i32.const 192 - i32.add - local.get $l2 - i32.const 252 - i32.add - i64.load align=4 - i64.store - local.get $l2 - i32.const 197 - i32.add - local.get $l2 - i32.const 257 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l2 - i32.const 207 - i32.add - local.get $l2 - i32.const 230 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - local.get $l2 - i32.load16_u offset=233 align=1 - i32.store16 offset=212 - local.get $l2 - local.get $l2 - i32.const 244 - i32.add - i64.load align=4 - i64.store offset=184 - local.get $l2 - local.get $l2 - i32.load16_u offset=228 align=1 - i32.store16 offset=205 align=1 - local.get $l2 - i32.const 240 - i32.add - i32.load - local.set $l6 - local.get $l2 - i32.load offset=236 - local.set $l5 - i32.const 0 - local.set $p0 - br $B7 - end - end - i32.const 2 - local.set $p1 - end - local.get $l2 - i32.const 182 - i32.add - local.get $l2 - i32.const 214 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - i32.const 160 - i32.add - local.tee $l3 - local.get $l2 - i32.const 192 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.tee $l4 - local.get $l2 - i32.const 200 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=212 - i32.store16 offset=180 - local.get $l2 - local.get $l2 - i64.load offset=184 - i64.store offset=152 - local.get $p0 - i32.eqz - if $I12 - local.get $l2 - i32.const 230 - i32.add - local.get $l2 - i32.const 182 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - i32.const 240 - i32.add - local.get $l3 - i64.load - i64.store - local.get $l2 - i32.const 248 - i32.add - local.get $l4 - i64.load - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=180 - i32.store16 offset=228 - local.get $l2 - local.get $l2 - i64.load offset=152 - i64.store offset=232 - br $B5 - end - unreachable - end - i32.const 2 - local.set $p1 - end - local.get $l2 - i32.const 218 - i32.add - local.tee $l4 - local.get $l2 - i32.const 230 - i32.add - local.tee $l7 - i32.load8_u - i32.store8 - local.get $l2 - i32.const 192 - i32.add - local.tee $l8 - local.get $l2 - i32.const 240 - i32.add - local.tee $p0 - i64.load - i64.store - local.get $l2 - i32.const 200 - i32.add - local.tee $l9 - local.get $l2 - i32.const 248 - i32.add - local.tee $l3 - i64.load - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=228 - i32.store16 offset=216 - local.get $l2 - local.get $l2 - i64.load offset=232 - i64.store offset=184 - local.get $p1 - i32.const 2 - i32.ne - if $I13 - local.get $l2 - i32.const 146 - i32.add - local.get $l4 - i32.load8_u - i32.store8 - local.get $p0 - local.get $l8 - i64.load - i64.store - local.get $l3 - local.get $l9 - i64.load - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=216 - i32.store16 offset=144 - local.get $l2 - local.get $l2 - i64.load offset=184 - i64.store offset=232 - end - local.get $l7 - local.get $l2 - i32.const 146 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - i32.const 160 - i32.add - local.get $p0 - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.get $l3 - i64.load - i64.store - local.get $l2 - local.get $l2 - i32.load16_u offset=144 - i32.store16 offset=228 - local.get $l2 - local.get $l2 - i64.load offset=232 - i64.store offset=152 - end - local.get $l2 - i32.const 186 - i32.add - local.tee $l4 - local.get $l2 - i32.const 80 - i32.add - local.get $l2 - i32.const 228 - i32.add - local.get $p1 - i32.const 3 - i32.eq - local.tee $l3 - select - local.tee $l7 - i32.const 2 - i32.add - i32.load8_u - i32.store8 - local.get $l2 - i32.const 120 - i32.add - local.tee $l8 - local.get $l2 - i32.const 232 - i32.add - local.get $l2 - i32.const 152 - i32.add - local.get $l3 - select - local.tee $p0 - i32.const 8 - i32.add - i64.load align=4 - i64.store - local.get $l2 - i32.const 128 - i32.add - local.tee $l9 - local.get $p0 - i32.const 16 - i32.add - i64.load align=4 - i64.store - local.get $l2 - local.get $l7 - i32.load16_u align=1 - i32.store16 offset=184 - local.get $l2 - local.get $p0 - i64.load align=4 - i64.store offset=112 - local.get $l2 - i32.const 248 - i32.add - local.get $l2 - i32.const 72 - i32.add - i32.load - i32.store - local.get $l2 - i32.const 240 - i32.add - local.get $l2 - i32.const -64 - i32.sub - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=56 - i64.store offset=232 - i32.const 40 - call $f16 - local.tee $p0 - i32.const 2 - local.get $p1 - local.get $l3 - select - i32.store8 - local.get $p0 - local.get $l6 - i32.store offset=8 - local.get $p0 - local.get $l5 - i32.store offset=4 - local.get $p0 - i32.const 1 - i32.store8 offset=36 - local.get $p0 - local.get $l2 - i32.load16_u offset=184 - i32.store16 offset=1 align=1 - local.get $p0 - i32.const 3 - i32.add - local.get $l4 - i32.load8_u - i32.store8 - local.get $p0 - local.get $l2 - i64.load offset=112 - i64.store offset=12 align=4 - local.get $p0 - i32.const 20 - i32.add - local.get $l8 - i64.load - i64.store align=4 - local.get $p0 - i32.const 28 - i32.add - local.get $l9 - i64.load - i64.store align=4 - local.get $l2 - i32.const 232 - i32.add - local.get $p0 - call $f25 - i32.load - br $B1 - end - local.get $l2 - i32.const 40 - i32.add - i32.load - local.get $l2 - i32.const 44 - i32.add - i32.load - i32.const 2 - i32.shl - i32.add - i32.const 48 - i32.add - i32.load - end - local.get $l2 - i32.const 272 - i32.add - global.set $g0 - return - end - unreachable) - (func $f21 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) - block $B0 (result i32) - local.get $p1 - i32.load - local.tee $l3 - if $I1 - local.get $p1 - i32.load offset=4 - br $B0 - end - i32.const 96 - call $f16 - local.tee $l3 - i32.const 0 - i32.store16 offset=94 - local.get $l3 - i32.const 0 - i32.store - local.get $p1 - i32.const 0 - i32.store offset=4 - local.get $p1 - local.get $l3 - i32.store - i32.const 0 - end - local.set $l6 - local.get $p0 - block $B2 (result i32) - block $B3 - loop $L4 - local.get $l3 - i32.const 4 - i32.add - local.set $l4 - local.get $l3 - i32.load16_u offset=94 - local.set $l7 - i32.const 0 - local.set $l5 - block $B5 - loop $L6 - local.get $l5 - local.get $l7 - i32.eq - br_if $B5 - local.get $l4 - i32.load - local.set $l8 - local.get $l4 - i32.const 4 - i32.add - local.set $l4 - local.get $l5 - i32.const 1 - i32.add - local.set $l5 - block $B7 - i32.const -1 - local.get $p2 - local.get $l8 - i32.ne - local.get $l8 - local.get $p2 - i32.gt_u - select - br_table $B3 $L6 $B7 - end - end - local.get $l5 - i32.const -1 - i32.add - local.set $l7 - end - local.get $l6 - if $I8 - local.get $l6 - i32.const -1 - i32.add - local.set $l6 - local.get $l3 - local.get $l7 - i32.const 2 - i32.shl - i32.add - i32.const 96 - i32.add - i32.load - local.set $l3 - br $L4 - end - end - local.get $p0 - local.get $p2 - i32.store offset=4 - local.get $p0 - i32.const 16 - i32.add - local.get $l7 - i32.store - local.get $p0 - i32.const 12 - i32.add - local.get $l3 - i32.store - local.get $p0 - i32.const 8 - i32.add - i32.const 0 - i32.store - local.get $p0 - i32.const 20 - i32.add - local.set $l4 - i32.const 0 - br $B2 - end - local.get $p0 - local.get $l6 - i32.store offset=4 - local.get $p0 - i32.const 12 - i32.add - local.get $l5 - i32.const -1 - i32.add - i32.store - local.get $p0 - i32.const 8 - i32.add - local.get $l3 - i32.store - local.get $p0 - i32.const 16 - i32.add - local.set $l4 - i32.const 1 - end - i32.store - local.get $l4 - local.get $p1 - i32.store) - (func $f22 (type $t7) (param $p0 i32) (param $p1 i32) (param $p2 i64) - (local $l3 i64) (local $l4 i64) - local.get $p1 - local.get $p1 - i64.load - local.tee $l3 - local.get $p2 - i64.add - local.tee $p2 - i64.store - local.get $p0 - local.get $p2 - i64.store - local.get $p1 - local.get $p1 - i64.load offset=8 - local.tee $l4 - local.get $p2 - local.get $l3 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $p2 - i64.store offset=8 - local.get $p0 - i32.const 8 - i32.add - local.get $p2 - i64.store - local.get $p1 - local.get $p1 - i64.load offset=16 - local.tee $l3 - local.get $p2 - local.get $l4 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $p2 - i64.store offset=16 - local.get $p0 - i32.const 16 - i32.add - local.get $p2 - i64.store - local.get $p1 - local.get $p1 - i64.load offset=24 - local.get $p2 - local.get $l3 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $p2 - i64.store offset=24 - local.get $p0 - i32.const 24 - i32.add - local.get $p2 - i64.store) - (func $f23 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 0 - i32.store8 offset=15 - block $B0 - local.get $p1 - local.get $l2 - i32.const 15 - i32.add - i32.const 1 - call $f49 - i32.eqz - if $I1 - local.get $l2 - i32.load8_u offset=15 - local.set $p1 - br $B0 - end - i32.const 1 - local.set $l3 - end - local.get $p0 - local.get $p1 - i32.store8 offset=1 - local.get $p0 - local.get $l3 - i32.store8 - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f24 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i64) (local $l4 i64) (local $l5 i64) (local $l6 i64) - global.get $g0 - i32.const 80 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 40 - i32.add - local.get $p1 - call $f71 - i32.const 1 - local.set $p1 - local.get $p0 - local.get $l2 - i32.load8_u offset=40 - i32.const 1 - i32.ne - if $I0 (result i32) - local.get $l2 - i32.const 32 - i32.add - local.get $l2 - i32.const 65 - i32.add - i64.load align=1 - local.tee $l3 - i64.store - local.get $l2 - i32.const 24 - i32.add - local.get $l2 - i32.const 57 - i32.add - i64.load align=1 - local.tee $l4 - i64.store - local.get $l2 - i32.const 16 - i32.add - local.get $l2 - i32.const 49 - i32.add - i64.load align=1 - local.tee $l5 - i64.store - local.get $l2 - local.get $l2 - i64.load offset=41 align=1 - local.tee $l6 - i64.store offset=8 - local.get $p0 - i32.const 25 - i32.add - local.get $l3 - i64.store align=1 - local.get $p0 - i32.const 17 - i32.add - local.get $l4 - i64.store align=1 - local.get $p0 - i32.const 9 - i32.add - local.get $l5 - i64.store align=1 - local.get $p0 - local.get $l6 - i64.store offset=1 align=1 - i32.const 0 - else - i32.const 1 - end - i32.store8 - local.get $l2 - i32.const 80 - i32.add - global.set $g0) - (func $f25 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i32) (local $l11 i32) (local $l12 i32) (local $l13 i32) (local $l14 i32) (local $l15 i32) (local $l16 i32) (local $l17 i32) (local $l18 i32) - global.get $g0 - i32.const 48 - i32.sub - local.tee $l2 - global.set $g0 - local.get $p0 - i32.load - local.set $l6 - local.get $l2 - i32.const 16 - i32.add - local.get $p0 - i32.const 12 - i32.add - i32.load - i32.store - local.get $l2 - local.get $p0 - i64.load offset=4 align=4 - i64.store offset=8 - block $B0 - block $B1 - block $B2 - local.get $l2 - i32.load offset=12 - local.tee $l3 - i32.load16_u offset=94 - i32.const 11 - i32.ge_u - if $I3 - local.get $l2 - i32.const 32 - i32.add - local.get $l2 - i32.load offset=16 - call $f50 - local.get $l2 - i32.const 40 - i32.add - i32.load - local.set $l13 - local.get $l2 - i32.load offset=36 - local.set $l14 - local.get $l2 - i32.load offset=32 - local.set $l4 - local.get $l2 - i32.load offset=8 - local.set $l9 - i32.const 96 - call $f16 - local.tee $l5 - i32.const 0 - i32.store16 offset=94 - local.get $l5 - i32.const 0 - i32.store - local.get $l3 - i32.const 48 - i32.add - local.tee $l8 - local.get $l4 - i32.const 2 - i32.shl - local.tee $l10 - i32.add - i32.load - local.set $l11 - local.get $l3 - i32.const 4 - i32.add - local.tee $l7 - local.get $l10 - i32.add - i32.load - local.set $l12 - local.get $l5 - i32.const 4 - i32.add - local.get $l7 - local.get $l10 - i32.const 4 - i32.add - local.tee $l10 - i32.add - local.get $l3 - i32.load16_u offset=94 - local.get $l4 - i32.const -1 - i32.xor - i32.add - local.tee $l7 - i32.const 2 - i32.shl - local.tee $l15 - call $f99 - local.get $l5 - i32.const 48 - i32.add - local.get $l8 - local.get $l10 - i32.add - local.get $l15 - call $f99 - local.get $l3 - local.get $l4 - i32.store16 offset=94 - local.get $l5 - local.get $l7 - i32.store16 offset=94 - block $B4 - local.get $l14 - i32.const 1 - i32.eq - if $I5 - local.get $l2 - local.get $l5 - i32.store offset=36 - local.get $l2 - i32.const 0 - i32.store offset=32 - br $B4 - end - local.get $l2 - local.get $l3 - i32.store offset=36 - local.get $l2 - local.get $l9 - i32.store offset=32 - end - local.get $l2 - local.get $l13 - i32.store offset=40 - local.get $l2 - i32.const 32 - i32.add - local.get $l6 - local.get $p1 - call $f54 - local.set $l13 - i32.const 0 - local.set $l4 - block $B6 - loop $L7 - local.get $l3 - i32.load - local.tee $p1 - i32.eqz - br_if $B6 - local.get $l2 - local.get $l3 - i32.load16_u offset=92 - local.tee $l3 - i32.store offset=16 - local.get $l2 - local.get $p1 - i32.store offset=12 - local.get $l2 - local.get $l9 - i32.const 1 - i32.add - local.tee $l6 - i32.store offset=8 - local.get $l4 - local.get $l9 - i32.ne - br_if $B0 - local.get $p1 - i32.load16_u offset=94 - i32.const 11 - i32.ge_u - if $I8 - local.get $l2 - i32.const 32 - i32.add - local.get $l3 - call $f50 - local.get $l2 - i32.load offset=40 - local.set $l14 - local.get $l2 - i32.load offset=36 - local.set $l15 - local.get $l2 - i32.load offset=32 - local.set $l4 - i32.const 144 - call $f16 - local.tee $l3 - i32.const 0 - i32.store16 offset=94 - local.get $l3 - i32.const 0 - i32.store - local.get $p1 - i32.const 48 - i32.add - local.tee $l16 - local.get $l4 - i32.const 2 - i32.shl - local.tee $l8 - i32.add - i32.load - local.get $p1 - i32.const 4 - i32.add - local.tee $l7 - local.get $l8 - i32.add - i32.load - local.set $l10 - local.get $l3 - i32.const 4 - i32.add - local.get $l7 - local.get $l8 - i32.const 4 - i32.add - local.tee $l8 - i32.add - local.get $p1 - i32.load16_u offset=94 - local.tee $l17 - local.get $l4 - i32.const -1 - i32.xor - i32.add - local.tee $l7 - i32.const 2 - i32.shl - local.tee $l18 - call $f99 - local.get $l3 - i32.const 48 - i32.add - local.get $l8 - local.get $l16 - i32.add - local.get $l18 - call $f99 - local.get $p1 - local.get $l4 - i32.store16 offset=94 - local.get $l3 - local.get $l7 - i32.store16 offset=94 - local.get $l3 - i32.const 96 - i32.add - local.get $p1 - local.get $l8 - i32.add - i32.const 96 - i32.add - local.get $l17 - local.get $l4 - i32.sub - i32.const 2 - i32.shl - call $f99 - local.get $l2 - local.get $l3 - i32.store offset=28 - local.get $l2 - local.get $l6 - i32.store offset=24 - local.get $l2 - i32.const 0 - i32.store8 offset=40 - local.get $l2 - local.get $l7 - i32.store offset=36 - local.get $l2 - i32.const 0 - i32.store offset=32 - local.get $l2 - i32.const 24 - i32.add - local.get $l2 - i32.const 32 - i32.add - call $f55 - block $B9 - local.get $l15 - i32.const 1 - i32.eq - if $I10 - local.get $l2 - local.get $l14 - i32.store offset=40 - local.get $l2 - local.get $l3 - i32.store offset=36 - br $B9 - end - local.get $l2 - local.get $l14 - i32.store offset=40 - local.get $l2 - local.get $p1 - i32.store offset=36 - end - local.get $l2 - local.get $l6 - i32.store offset=32 - local.get $l2 - i32.const 32 - i32.add - local.get $l12 - local.get $l11 - local.get $l5 - call $f56 - local.get $l3 - local.set $l5 - local.set $l11 - local.get $l10 - local.set $l12 - local.get $p1 - local.set $l3 - local.get $l6 - local.tee $l4 - local.set $l9 - br $L7 - end - end - local.get $l2 - i32.const 8 - i32.add - local.get $l12 - local.get $l11 - local.get $l5 - call $f56 - br $B2 - end - local.get $p0 - i32.load offset=16 - local.tee $p1 - i32.load - local.tee $l3 - i32.eqz - br_if $B0 - i32.const 144 - call $f16 - local.tee $p0 - i32.const 0 - i32.store16 offset=94 - local.get $p0 - i32.const 0 - i32.store - local.get $p0 - local.get $p1 - i32.const 0 - local.get $l3 - select - local.tee $l3 - i32.load - i32.store offset=96 - local.get $l3 - local.get $p0 - i32.store - local.get $l3 - local.get $l3 - i32.load offset=4 - local.tee $l3 - i32.const 1 - i32.add - i32.store offset=4 - local.get $p0 - i32.load offset=96 - local.tee $l6 - i32.const 0 - i32.store16 offset=92 - local.get $l6 - local.get $p0 - i32.store - local.get $l3 - local.get $l4 - i32.ne - br_if $B0 - local.get $p0 - i32.load16_u offset=94 - local.tee $l4 - i32.const 10 - i32.gt_u - br_if $B0 - local.get $p0 - local.get $l4 - i32.const 1 - i32.add - local.tee $l3 - i32.store16 offset=94 - local.get $p0 - local.get $l4 - i32.const 2 - i32.shl - i32.add - local.tee $l4 - i32.const 48 - i32.add - local.get $l11 - i32.store - local.get $l4 - i32.const 4 - i32.add - local.get $l12 - i32.store - local.get $p0 - local.get $l3 - i32.const 2 - i32.shl - i32.add - i32.const 96 - i32.add - local.get $l5 - i32.store - local.get $l5 - local.get $l3 - i32.store16 offset=92 - local.get $l5 - local.get $p0 - i32.store - br $B1 - end - local.get $l2 - i32.const 8 - i32.add - local.get $l6 - local.get $p1 - call $f54 - local.set $l13 - end - local.get $p0 - i32.load offset=16 - local.set $p1 - end - local.get $p1 - local.get $p1 - i32.load offset=8 - i32.const 1 - i32.add - i32.store offset=8 - local.get $l2 - i32.const 48 - i32.add - global.set $g0 - local.get $l13 - return - end - unreachable) - (func $f26 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) - local.get $p0 - local.get $p1 - call $f20 - local.tee $p0 - i32.load8_u - i32.const 2 - i32.ne - if $I0 (result i32) - local.get $p0 - i32.const 0 - i32.store8 offset=36 - local.get $p0 - else - i32.const 0 - end) - (func $f27 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i64) (local $l11 i64) - global.get $g0 - i32.const 208 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 72 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const -64 - i32.sub - local.get $p1 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 56 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load - i64.store - local.get $l2 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p1 - i64.load - i64.store offset=48 - local.get $l2 - i32.const 48 - i32.add - call $f28 - local.set $p1 - local.get $l2 - i32.const 16384 - i32.store offset=124 - local.get $l2 - i32.const 65796 - i32.store offset=120 - block $B0 - block $B1 - local.get $p1 - local.get $l2 - i32.const 120 - i32.add - call $f13 - local.tee $p1 - i32.const 10 - i32.ne - if $I2 - local.get $p1 - i32.const 3 - i32.eq - br_if $B1 - br $B0 - end - local.get $l2 - local.get $l2 - i64.load offset=120 - i64.store offset=200 - local.get $l2 - i32.const 160 - i32.add - local.get $l2 - i32.const 200 - i32.add - call $f24 - local.get $l2 - i32.const 136 - i32.add - local.get $l2 - i32.const 169 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 144 - i32.add - local.get $l2 - i32.const 177 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 152 - i32.add - local.get $l2 - i32.const 185 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $l2 - i64.load offset=161 align=1 - i64.store offset=128 - block $B3 - local.get $l2 - i32.load8_u offset=160 - i32.const 1 - i32.eq - br_if $B3 - local.get $l2 - i32.const 112 - i32.add - local.get $l2 - i32.const 152 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 104 - i32.add - local.get $l2 - i32.const 144 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 96 - i32.add - local.get $l2 - i32.const 136 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=128 - i64.store offset=88 - local.get $l2 - i32.const 48 - i32.add - call $f28 - local.get $l2 - i32.const 16384 - i32.store offset=132 - local.get $l2 - i32.const 65796 - i32.store offset=128 - local.get $l2 - i32.const 128 - i32.add - call $f13 - local.tee $p1 - i32.const 10 - i32.ne - if $I4 - local.get $p1 - i32.const 3 - i32.ne - br_if $B0 - br $B1 - end - local.get $l2 - local.get $l2 - i64.load offset=128 - i64.store offset=160 - local.get $l2 - i32.const 24 - i32.add - local.get $l2 - i32.const 160 - i32.add - call $f29 - local.get $l2 - i64.load offset=24 - i32.wrap_i64 - br_if $B3 - local.get $l2 - i32.const 40 - i32.add - i64.load - local.set $l10 - local.get $l2 - i64.load offset=32 - local.set $l11 - local.get $l2 - i32.const 48 - i32.add - call $f28 - local.get $l2 - i32.const 16384 - i32.store offset=132 - local.get $l2 - i32.const 65796 - i32.store offset=128 - local.get $l2 - i32.const 128 - i32.add - call $f13 - local.tee $p1 - i32.const 10 - i32.ne - if $I5 - local.get $p1 - i32.const 3 - i32.ne - br_if $B0 - br $B1 - end - local.get $l2 - local.get $l2 - i64.load offset=128 - i64.store offset=160 - local.get $l2 - i32.const 160 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $l3 - i32.const 2 - i32.eq - br_if $B3 - local.get $l2 - i32.const 48 - i32.add - call $f30 - local.get $l2 - i32.const 16384 - i32.store offset=132 - local.get $l2 - i32.const 65796 - i32.store offset=128 - local.get $l2 - i32.const 128 - i32.add - call $f13 - local.tee $p1 - i32.const 10 - i32.ne - if $I6 - local.get $p1 - i32.const 3 - i32.ne - br_if $B0 - br $B1 - end - local.get $l2 - local.get $l2 - i64.load offset=128 - i64.store offset=160 - local.get $l2 - i32.const 16 - i32.add - local.get $l2 - i32.const 160 - i32.add - call $f15 - i32.const 1 - local.set $p1 - local.get $l2 - i32.load offset=20 - local.set $l4 - block $B7 - local.get $l2 - i32.load offset=16 - br_if $B7 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 160 - i32.add - call $f15 - local.get $l2 - i32.load offset=8 - br_if $B7 - local.get $l2 - i32.load offset=12 - local.set $l5 - local.get $l2 - local.get $l2 - i32.const 160 - i32.add - call $f15 - local.get $l2 - i32.load - i32.const 0 - i32.ne - local.set $p1 - local.get $l2 - i32.load offset=4 - local.set $l6 - end - local.get $p1 - br_if $B3 - local.get $l2 - i32.const 184 - i32.add - local.tee $l7 - local.get $l2 - i32.const 48 - i32.add - call $f31 - local.tee $p1 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 176 - i32.add - local.tee $l8 - local.get $p1 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 168 - i32.add - local.tee $l9 - local.get $p1 - i32.const 8 - i32.add - i64.load - i64.store - local.get $l2 - local.get $p1 - i64.load - i64.store offset=160 - local.get $l2 - i32.const 48 - i32.add - call $f28 - local.set $p1 - local.get $p0 - local.get $l10 - i64.store offset=8 - local.get $p0 - local.get $l11 - i64.store - local.get $p0 - local.get $l3 - i32.const 0 - i32.ne - i32.store8 offset=176 - local.get $p0 - i64.const 1 - i64.store offset=16 - local.get $p0 - i32.const 168 - i32.add - local.get $l2 - i32.const 112 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 160 - i32.add - local.get $l2 - i32.const 104 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 152 - i32.add - local.get $l2 - i32.const 96 - i32.add - i64.load - i64.store align=1 - local.get $p0 - local.get $l2 - i64.load offset=88 - i64.store offset=144 align=1 - local.get $p0 - i32.const 24 - i32.add - local.get $l2 - i64.load offset=160 - i64.store - local.get $p0 - i32.const 32 - i32.add - local.get $l9 - i64.load - i64.store - local.get $p0 - i32.const 40 - i32.add - local.get $l8 - i64.load - i64.store - local.get $p0 - i32.const 48 - i32.add - local.get $l7 - i64.load - i64.store - local.get $p0 - i32.const 88 - i32.add - i64.const 1 - i64.store - local.get $p0 - i32.const 80 - i32.add - local.get $l6 - i32.store - local.get $p0 - i32.const 76 - i32.add - local.get $l5 - i32.store - local.get $p0 - i32.const 72 - i32.add - local.get $l4 - i32.store - local.get $p0 - i32.const -64 - i32.sub - i32.const 0 - i32.store - local.get $p0 - i32.const 56 - i32.add - i32.const 0 - i32.store - local.get $p0 - i32.const 128 - i32.add - i32.const 0 - i32.store - local.get $p0 - i32.const 136 - i32.add - i32.const 0 - i32.store - local.get $p0 - i32.const 96 - i32.add - local.get $p1 - i64.load - i64.store - local.get $p0 - i32.const 104 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load - i64.store - local.get $p0 - i32.const 112 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load - i64.store - local.get $p0 - i32.const 120 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 208 - i32.add - global.set $g0 - return - end - unreachable - end - unreachable - end - unreachable) - (func $f28 (type $t6) (param $p0 i32) (result i32) - local.get $p0 - i64.const 1 - call $f43) - (func $f29 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i64) (local $l5 i64) (local $l6 i64) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 8 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l2 - i64.const 0 - i64.store - block $B0 - local.get $p1 - local.get $l2 - i32.const 16 - call $f49 - i32.eqz - if $I1 - local.get $l3 - i64.load - local.set $l5 - local.get $l2 - i64.load - local.set $l6 - br $B0 - end - i64.const 1 - local.set $l4 - end - local.get $p0 - local.get $l6 - i64.store offset=8 - local.get $p0 - local.get $l4 - i64.store - local.get $p0 - i32.const 16 - i32.add - local.get $l5 - i64.store - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f30 (type $t6) (param $p0 i32) (result i32) - (local $l1 i64) (local $l2 i64) (local $l3 i64) - local.get $p0 - i64.load offset=32 - local.set $l1 - local.get $p0 - i64.const 1 - i64.store offset=32 - local.get $p0 - local.get $l1 - local.get $p0 - i64.load - local.tee $l2 - i64.add - local.tee $l1 - i64.store - local.get $p0 - local.get $p0 - i64.load offset=8 - local.tee $l3 - local.get $l1 - local.get $l2 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $l1 - i64.store offset=8 - local.get $p0 - local.get $p0 - i64.load offset=16 - local.tee $l2 - local.get $l1 - local.get $l3 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $l1 - i64.store offset=16 - local.get $p0 - local.get $p0 - i64.load offset=24 - local.get $l1 - local.get $l2 - i64.lt_u - i64.extend_i32_u - i64.add - i64.store offset=24 - local.get $p0) - (func $f31 (type $t6) (param $p0 i32) (result i32) - local.get $p0 - i64.const 4294967296 - call $f43) - (func $f32 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i64) - global.get $g0 - i32.const 160 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 48 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 40 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 32 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load - i64.store - local.get $l2 - i64.const 0 - i64.store offset=56 - local.get $l2 - local.get $p1 - i64.load - i64.store offset=24 - local.get $l2 - i32.const 24 - i32.add - call $f28 - local.get $l2 - i32.const 136 - i32.add - local.tee $p1 - i32.const 16384 - i32.store - local.get $l2 - i32.const 65796 - i32.store offset=132 - local.get $l2 - i32.const 0 - i32.store offset=128 - local.get $l2 - i32.const 16 - i32.add - local.get $l2 - i32.const 128 - i32.add - local.get $p0 - i32.const 144 - i32.add - call $f33 - local.get $l2 - i32.load offset=16 - local.get $l2 - i32.load offset=20 - call $seal0.seal_set_storage - local.get $l2 - i32.const 24 - i32.add - call $f28 - local.get $p1 - i32.const 16384 - i32.store - local.get $l2 - i32.const 65796 - i32.store offset=132 - local.get $l2 - i32.const 0 - i32.store offset=128 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 128 - i32.add - local.get $p0 - i64.load - local.get $p0 - i32.const 8 - i32.add - i64.load - call $f34 - local.get $l2 - i32.load offset=8 - local.get $l2 - i32.load offset=12 - call $seal0.seal_set_storage - local.get $l2 - i32.const 24 - i32.add - call $f28 - local.get $p1 - i32.const 16384 - i32.store - local.get $l2 - i32.const 65796 - i32.store offset=132 - local.get $l2 - i32.const 0 - i32.store offset=128 - local.get $l2 - local.get $l2 - i32.const 128 - i32.add - local.get $p0 - i32.load8_u offset=176 - call $f35 - local.get $l2 - i32.load - local.get $l2 - i32.load offset=4 - call $seal0.seal_set_storage - local.get $l2 - i32.const 24 - i32.add - call $f30 - local.set $p1 - local.get $l2 - i64.const 16384 - i64.store offset=132 align=4 - local.get $l2 - i32.const 65796 - i32.store offset=128 - local.get $p0 - i32.const 72 - i32.add - i32.load - local.get $l2 - i32.const 128 - i32.add - call $f36 - local.get $p0 - i32.const 76 - i32.add - i32.load - local.get $l2 - i32.const 128 - i32.add - call $f36 - local.get $p0 - i32.const 80 - i32.add - i32.load - local.get $l2 - i32.const 128 - i32.add - call $f36 - block $B0 - block $B1 - local.get $l2 - i32.load offset=132 - local.get $l2 - i32.load offset=136 - local.tee $l3 - i32.lt_u - br_if $B1 - local.get $p1 - local.get $l2 - i32.load offset=128 - local.get $l3 - call $seal0.seal_set_storage - local.get $l2 - i32.const 24 - i32.add - call $f31 - local.set $l8 - block $B2 (result i32) - local.get $p0 - i32.const 56 - i32.add - i32.load - local.tee $l4 - i32.eqz - if $I3 - i32.const 0 - local.set $l3 - i32.const 0 - br $B2 - end - local.get $p0 - i32.const 60 - i32.add - i32.load - local.set $p1 - local.get $l4 - local.set $l3 - loop $L4 - local.get $l4 - i32.load16_u offset=94 - local.set $l5 - local.get $p1 - if $I5 - local.get $p1 - i32.const -1 - i32.add - local.set $p1 - local.get $l4 - local.get $l5 - i32.const 2 - i32.shl - i32.add - i32.const 96 - i32.add - i32.load - local.set $l4 - local.get $l3 - i32.load offset=96 - local.set $l3 - br $L4 - end - end - local.get $l4 - local.set $l6 - local.get $p0 - i32.const -64 - i32.sub - i32.load - end - local.set $p1 - local.get $l2 - i32.const 84 - i32.add - local.get $l5 - i32.store - local.get $l2 - i32.const 80 - i32.add - local.get $l6 - i32.store - local.get $l2 - local.get $p1 - i32.store offset=88 - local.get $l2 - i64.const 0 - i64.store offset=72 - local.get $l2 - local.get $l3 - i32.store offset=68 - local.get $l2 - i32.const 0 - i32.store offset=64 - loop $L6 - local.get $p1 - if $I7 - local.get $l2 - local.get $p1 - i32.const -1 - i32.add - i32.store offset=88 - local.get $l2 - i32.const -64 - i32.sub - i32.const 0 - local.get $l2 - i32.load offset=68 - select - local.tee $l7 - i32.load - local.set $l5 - local.get $l7 - i32.load offset=8 - local.set $l6 - local.get $l7 - i32.load offset=4 - local.set $p1 - loop $L8 - block $B9 - local.get $l6 - local.get $p1 - i32.load16_u offset=94 - i32.ge_u - if $I10 - local.get $p1 - i32.load - local.tee $l3 - br_if $B9 - i32.const 0 - local.set $p1 - end - local.get $l6 - i32.const 1 - i32.add - local.set $l4 - block $B11 - local.get $l5 - i32.eqz - if $I12 - local.get $p1 - local.set $l3 - br $B11 - end - local.get $p1 - local.get $l4 - i32.const 2 - i32.shl - i32.add - i32.const 96 - i32.add - local.set $l3 - i32.const 1 - local.set $l4 - loop $L13 - local.get $l3 - i32.load - local.set $l3 - local.get $l4 - local.get $l5 - i32.ne - if $I14 - local.get $l4 - i32.const 1 - i32.add - local.set $l4 - local.get $l3 - i32.const 96 - i32.add - local.set $l3 - br $L13 - end - end - i32.const 0 - local.set $l4 - end - local.get $l7 - local.get $l3 - i32.store offset=4 - local.get $l7 - i32.const 0 - i32.store - local.get $l7 - local.get $l4 - i32.store offset=8 - local.get $p1 - local.get $l6 - i32.const 2 - i32.shl - i32.add - local.tee $p1 - i32.const 4 - i32.add - i64.load32_u - local.set $l9 - local.get $l2 - i32.const 152 - i32.add - local.get $l8 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 144 - i32.add - local.get $l8 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l2 - i32.const 136 - i32.add - local.get $l8 - i32.const 8 - i32.add - i64.load - i64.store - local.get $l2 - local.get $l8 - i64.load - i64.store offset=128 - local.get $l2 - i32.const 96 - i32.add - local.get $l2 - i32.const 128 - i32.add - local.get $l9 - call $f22 - local.get $p1 - i32.const 48 - i32.add - i32.load - local.tee $p1 - i32.load8_u offset=36 - local.set $l3 - local.get $p1 - i32.const 1 - i32.store8 offset=36 - block $B15 - local.get $l3 - i32.const 1 - i32.and - br_if $B15 - local.get $p1 - i32.load8_u - local.tee $l3 - i32.const 2 - i32.eq - if $I16 - local.get $l2 - i32.const 96 - i32.add - call $seal0.seal_clear_storage - br $B15 - end - local.get $l2 - i64.const 16384 - i64.store offset=132 align=4 - local.get $l2 - i32.const 65796 - i32.store offset=128 - block $B17 - i32.const 0 - local.get $p1 - local.get $l3 - i32.const 2 - i32.eq - select - local.tee $p1 - i32.load8_u - i32.const 1 - i32.ne - if $I18 - local.get $l2 - i32.const 1 - i32.store offset=136 - i32.const 65796 - i32.const 0 - i32.store8 - local.get $p1 - i32.load offset=4 - local.get $l2 - i32.const 128 - i32.add - call $f36 - local.get $p1 - i32.load offset=8 - local.get $l2 - i32.const 128 - i32.add - call $f36 - br $B17 - end - i32.const 65796 - i32.const 1 - i32.store8 - local.get $l2 - i32.const 1 - i32.store offset=136 - local.get $p1 - i32.const 1 - i32.add - local.get $l2 - i32.const 128 - i32.add - call $f19 - end - local.get $l2 - i32.load offset=132 - local.get $l2 - i32.load offset=136 - local.tee $p1 - i32.lt_u - br_if $B1 - local.get $l2 - i32.const 96 - i32.add - local.get $l2 - i32.load offset=128 - local.get $p1 - call $seal0.seal_set_storage - end - local.get $l2 - i32.load offset=88 - local.set $p1 - br $L6 - end - local.get $l5 - i32.const 1 - i32.add - local.set $l5 - local.get $p1 - i32.load16_u offset=92 - local.set $l6 - local.get $l3 - local.set $p1 - br $L8 - end - unreachable - end - end - local.get $l2 - i32.const 24 - i32.add - call $f28 - local.set $l8 - block $B19 (result i32) - local.get $p0 - i32.const 128 - i32.add - i32.load - local.tee $l4 - i32.eqz - if $I20 - i32.const 0 - local.set $l4 - i32.const 0 - local.set $l3 - i32.const 0 - br $B19 - end - local.get $p0 - i32.const 132 - i32.add - i32.load - local.set $p1 - local.get $l4 - local.set $l3 - loop $L21 - local.get $l4 - i32.load16_u offset=50 - local.set $l5 - local.get $p1 - if $I22 - local.get $p1 - i32.const -1 - i32.add - local.set $p1 - local.get $l4 - local.get $l5 - i32.const 2 - i32.shl - i32.add - i32.const 404 - i32.add - i32.load - local.set $l4 - local.get $l3 - i32.load offset=404 - local.set $l3 - br $L21 - end - end - local.get $p0 - i32.const 136 - i32.add - i32.load - end - local.set $p1 - local.get $l2 - i32.const 116 - i32.add - local.get $l5 - i32.store - local.get $l2 - i32.const 112 - i32.add - local.get $l4 - i32.store - local.get $l2 - local.get $p1 - i32.store offset=120 - local.get $l2 - i64.const 0 - i64.store offset=104 - local.get $l2 - local.get $l3 - i32.store offset=100 - local.get $l2 - i32.const 0 - i32.store offset=96 - loop $L23 - local.get $p1 - i32.eqz - br_if $B0 - local.get $l2 - local.get $p1 - i32.const -1 - i32.add - i32.store offset=120 - local.get $l2 - i32.const 96 - i32.add - i32.const 0 - local.get $l2 - i32.load offset=100 - select - local.tee $l7 - i32.load - local.set $l5 - local.get $l7 - i32.load offset=8 - local.set $l6 - local.get $l7 - i32.load offset=4 - local.set $p1 - loop $L24 - block $B25 - local.get $l6 - local.get $p1 - i32.load16_u offset=50 - i32.ge_u - if $I26 - local.get $p1 - i32.load - local.tee $p0 - br_if $B25 - i32.const 0 - local.set $p1 - end - local.get $l6 - i32.const 1 - i32.add - local.set $l4 - block $B27 - local.get $l5 - i32.eqz - if $I28 - local.get $p1 - local.set $l3 - br $B27 - end - local.get $p1 - local.get $l4 - i32.const 2 - i32.shl - i32.add - i32.const 404 - i32.add - local.set $l3 - i32.const 1 - local.set $l4 - loop $L29 - local.get $l3 - i32.load - local.set $l3 - local.get $l4 - local.get $l5 - i32.ne - if $I30 - local.get $l4 - i32.const 1 - i32.add - local.set $l4 - local.get $l3 - i32.const 404 - i32.add - local.set $l3 - br $L29 - end - end - i32.const 0 - local.set $l4 - end - local.get $l7 - local.get $l3 - i32.store offset=4 - local.get $l7 - i32.const 0 - i32.store - local.get $l7 - local.get $l4 - i32.store offset=8 - local.get $l2 - i32.const 128 - i32.add - local.get $l8 - local.get $p1 - local.get $l6 - i32.const 5 - i32.shl - i32.add - i32.const 52 - i32.add - call $f12 - local.get $p1 - local.get $l6 - i32.const 2 - i32.shl - i32.add - i32.const 4 - i32.add - i32.load - local.tee $p0 - i32.load8_u offset=8 - local.set $p1 - local.get $p0 - i32.const 1 - i32.store8 offset=8 - block $B31 - local.get $p1 - i32.const 1 - i32.and - br_if $B31 - local.get $p0 - i32.load8_u offset=4 - local.tee $p1 - i32.const 2 - i32.eq - if $I32 - local.get $l2 - i32.const 128 - i32.add - call $seal0.seal_clear_storage - br $B31 - end - local.get $l2 - i64.const 16384 - i64.store offset=68 align=4 - local.get $l2 - i32.const 65796 - i32.store offset=64 - i32.const 0 - local.get $p0 - local.get $p1 - i32.const 2 - i32.eq - select - local.tee $p0 - i32.load8_u offset=4 - local.get $l2 - i32.const -64 - i32.sub - call $f37 - local.get $p0 - i32.load - local.get $l2 - i32.const -64 - i32.sub - call $f36 - local.get $l2 - i32.load offset=68 - local.get $l2 - i32.load offset=72 - local.tee $p0 - i32.lt_u - br_if $B1 - local.get $l2 - i32.const 128 - i32.add - local.get $l2 - i32.load offset=64 - local.get $p0 - call $seal0.seal_set_storage - end - local.get $l2 - i32.load offset=120 - local.set $p1 - br $L23 - end - local.get $l5 - i32.const 1 - i32.add - local.set $l5 - local.get $p1 - i32.load16_u offset=48 - local.set $l6 - local.get $p0 - local.set $p1 - br $L24 - end - unreachable - end - unreachable - end - unreachable - end - local.get $l2 - i32.const 160 - i32.add - global.set $g0) - (func $f33 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i64) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l3 - global.set $g0 - local.get $p1 - i64.load offset=4 align=4 - local.set $l4 - local.get $p1 - i32.const 8 - i32.add - i32.const 0 - i32.store - local.get $p1 - i32.const 65792 - i32.store offset=4 - local.get $l3 - i32.const 0 - i32.store offset=24 - local.get $l3 - local.get $l4 - i64.store offset=16 - local.get $p2 - local.get $l3 - i32.const 16 - i32.add - call $f19 - local.get $p1 - local.get $l3 - i64.load offset=16 - i64.store offset=4 align=4 - local.get $l3 - i32.const 8 - i32.add - local.get $p1 - local.get $l3 - i32.load offset=24 - call $f74 - local.get $p0 - local.get $l3 - i64.load offset=8 - i64.store - local.get $l3 - i32.const 32 - i32.add - global.set $g0) - (func $f34 (type $t8) (param $p0 i32) (param $p1 i32) (param $p2 i64) (param $p3 i64) - (local $l4 i32) (local $l5 i64) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l4 - global.set $g0 - local.get $p1 - i64.load offset=4 align=4 - local.set $l5 - local.get $p1 - i32.const 8 - i32.add - i32.const 0 - i32.store - local.get $p1 - i32.const 65792 - i32.store offset=4 - local.get $l4 - i32.const 0 - i32.store offset=24 - local.get $l4 - local.get $l5 - i64.store offset=16 - local.get $p2 - local.get $p3 - local.get $l4 - i32.const 16 - i32.add - call $f44 - local.get $p1 - local.get $l4 - i64.load offset=16 - i64.store offset=4 align=4 - local.get $l4 - i32.const 8 - i32.add - local.get $p1 - local.get $l4 - i32.load offset=24 - call $f74 - local.get $p0 - local.get $l4 - i64.load offset=8 - i64.store - local.get $l4 - i32.const 32 - i32.add - global.set $g0) - (func $f35 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i64) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l3 - global.set $g0 - local.get $p1 - i64.load offset=4 align=4 - local.set $l4 - local.get $p1 - i32.const 8 - i32.add - i32.const 0 - i32.store - local.get $p1 - i32.const 65792 - i32.store offset=4 - local.get $l3 - i32.const 0 - i32.store offset=24 - local.get $l3 - local.get $l4 - i64.store offset=16 - local.get $p2 - local.get $l3 - i32.const 16 - i32.add - call $f37 - local.get $p1 - local.get $l3 - i64.load offset=16 - i64.store offset=4 align=4 - local.get $l3 - i32.const 8 - i32.add - local.get $p1 - local.get $l3 - i32.load offset=24 - call $f74 - local.get $p0 - local.get $l3 - i64.load offset=8 - i64.store - local.get $l3 - i32.const 32 - i32.add - global.set $g0) - (func $f36 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - local.get $p0 - i32.store offset=12 - local.get $p1 - local.get $l2 - i32.const 12 - i32.add - i32.const 4 - call $f18 - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f37 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - local.get $p0 - i32.store8 offset=15 - local.get $p1 - local.get $l2 - i32.const 15 - i32.add - i32.const 1 - call $f18 - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f38 (type $t9) (param $p0 i32) (param $p1 i64) (param $p2 i64) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i32) (local $l11 i32) - global.get $g0 - i32.const 96 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - i32.const 16 - i32.add - local.get $p0 - i32.load - local.get $p0 - i32.const 4 - i32.add - i32.load - local.get $p0 - i32.const 8 - i32.add - i32.load - call $f39 - local.get $l3 - i32.const 8 - i32.add - local.get $l3 - i32.const 16 - i32.add - local.get $p1 - local.get $p2 - call $f34 - local.get $l3 - i32.load offset=8 - local.set $l5 - local.get $l3 - i32.load offset=12 - local.set $l4 - local.get $l3 - i32.const 56 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l3 - i32.const 48 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l3 - i32.const 40 - i32.add - local.tee $l8 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store offset=32 - block $B0 - local.get $l4 - i32.const 33 - i32.ge_u - if $I1 - local.get $l3 - i32.const 88 - i32.add - local.tee $l9 - i64.const 0 - i64.store - local.get $l3 - i32.const 80 - i32.add - local.tee $l10 - i64.const 0 - i64.store - local.get $l3 - i32.const 72 - i32.add - local.tee $l11 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store offset=64 - local.get $l5 - local.get $l4 - local.get $l3 - i32.const -64 - i32.sub - call $seal0.seal_hash_blake2_256 - local.get $l6 - local.get $l9 - i64.load - i64.store - local.get $l7 - local.get $l10 - i64.load - i64.store - local.get $l8 - local.get $l11 - i64.load - i64.store - local.get $l3 - local.get $l3 - i64.load offset=64 - i64.store offset=32 - br $B0 - end - local.get $l3 - i32.const 32 - i32.add - local.get $l5 - local.get $l4 - call $f99 - end - local.get $p0 - local.get $l3 - i32.const 32 - i32.add - call $f40 - local.get $l3 - i32.const 96 - i32.add - global.set $g0) - (func $f39 (type $t1) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) - local.get $p3 - local.get $p1 - i32.lt_u - if $I0 - unreachable - end - local.get $p0 - i32.const 0 - i32.store - local.get $p0 - i32.const 8 - i32.add - local.get $p3 - local.get $p1 - i32.sub - i32.store - local.get $p0 - local.get $p1 - local.get $p2 - i32.add - i32.store offset=4) - (func $f40 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l2 - global.set $g0 - local.get $p0 - i32.load offset=4 - local.set $l4 - local.get $p0 - i32.const 65792 - i32.store offset=4 - local.get $p0 - i32.const 8 - i32.add - local.tee $l5 - i32.load - local.set $l3 - local.get $l5 - i32.const 0 - i32.store - local.get $l2 - i32.const 8 - i32.add - local.set $l6 - local.get $l3 - local.get $p0 - i32.load - local.tee $l7 - i32.lt_u - if $I0 - unreachable - end - local.get $l6 - local.get $l3 - local.get $l7 - i32.sub - i32.store offset=4 - local.get $l6 - local.get $l4 - local.get $l7 - i32.add - i32.store - local.get $l2 - i32.const 0 - i32.store offset=24 - local.get $l2 - local.get $l2 - i64.load offset=8 - i64.store offset=16 - local.get $p1 - local.get $l2 - i32.const 16 - i32.add - call $f48 - local.get $l5 - local.get $l3 - i32.store - local.get $p0 - local.get $l4 - i32.store offset=4 - local.get $p0 - local.get $p0 - i32.load - local.get $l2 - i32.load offset=24 - i32.add - i32.store - local.get $l2 - i32.const 32 - i32.add - global.set $g0) - (func $f41 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) - global.get $g0 - i32.const 96 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 16 - i32.add - local.get $p0 - i32.load - local.get $p0 - i32.const 4 - i32.add - i32.load - local.get $p0 - i32.const 8 - i32.add - i32.load - call $f39 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 16 - i32.add - local.get $p1 - call $f33 - local.get $l2 - i32.load offset=8 - local.set $l3 - local.get $l2 - i32.load offset=12 - local.set $p1 - local.get $l2 - i32.const 56 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l2 - i32.const 48 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l2 - i32.const 40 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l2 - i64.const 0 - i64.store offset=32 - block $B0 - local.get $p1 - i32.const 33 - i32.ge_u - if $I1 - local.get $l2 - i32.const 88 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l2 - i32.const 80 - i32.add - local.tee $l8 - i64.const 0 - i64.store - local.get $l2 - i32.const 72 - i32.add - local.tee $l9 - i64.const 0 - i64.store - local.get $l2 - i64.const 0 - i64.store offset=64 - local.get $l3 - local.get $p1 - local.get $l2 - i32.const -64 - i32.sub - call $seal0.seal_hash_blake2_256 - local.get $l4 - local.get $l7 - i64.load - i64.store - local.get $l5 - local.get $l8 - i64.load - i64.store - local.get $l6 - local.get $l9 - i64.load - i64.store - local.get $l2 - local.get $l2 - i64.load offset=64 - i64.store offset=32 - br $B0 - end - local.get $l2 - i32.const 32 - i32.add - local.get $l3 - local.get $p1 - call $f99 - end - local.get $p0 - local.get $l2 - i32.const 32 - i32.add - call $f40 - local.get $l2 - i32.const 96 - i32.add - global.set $g0) - (func $f42 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $p0 - i32.load offset=4 - local.set $l5 - local.get $p0 - i32.const 65792 - i32.store offset=4 - local.get $p0 - i32.const 8 - i32.add - local.tee $l3 - i32.load - local.set $l4 - local.get $l3 - i32.const 0 - i32.store - local.get $l2 - i32.const 8 - i32.add - local.set $l6 - local.get $l4 - local.get $p0 - i32.load - local.tee $l3 - i32.lt_u - if $I0 - unreachable - end - local.get $l6 - local.get $l4 - local.get $l3 - i32.sub - i32.store offset=4 - local.get $l6 - local.get $l3 - local.get $l5 - i32.add - i32.store - local.get $l2 - i32.load offset=12 - i32.eqz - if $I1 - unreachable - end - local.get $l2 - i32.load offset=8 - local.get $p1 - i32.const 2 - i32.shl - i32.store8 - local.get $p0 - local.get $l4 - i32.store offset=8 - local.get $p0 - local.get $l5 - i32.store offset=4 - local.get $p0 - local.get $p0 - i32.load - i32.const 1 - i32.add - i32.store - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f43 (type $t10) (param $p0 i32) (param $p1 i64) (result i32) - (local $l2 i64) (local $l3 i64) - local.get $p0 - i64.load offset=32 - local.set $l2 - local.get $p0 - local.get $p1 - i64.store offset=32 - local.get $p0 - local.get $l2 - local.get $p0 - i64.load - local.tee $p1 - i64.add - local.tee $l2 - i64.store - local.get $p0 - local.get $p0 - i64.load offset=8 - local.tee $l3 - local.get $l2 - local.get $p1 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $p1 - i64.store offset=8 - local.get $p0 - local.get $p0 - i64.load offset=16 - local.tee $l2 - local.get $p1 - local.get $l3 - i64.lt_u - i64.extend_i32_u - i64.add - local.tee $p1 - i64.store offset=16 - local.get $p0 - local.get $p0 - i64.load offset=24 - local.get $p1 - local.get $l2 - i64.lt_u - i64.extend_i32_u - i64.add - i64.store offset=24 - local.get $p0) - (func $f44 (type $t11) (param $p0 i64) (param $p1 i64) (param $p2 i32) - (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - local.get $p1 - i64.store offset=8 - local.get $l3 - local.get $p0 - i64.store - local.get $p2 - local.get $l3 - i32.const 16 - call $f18 - local.get $l3 - i32.const 16 - i32.add - global.set $g0) - (func $f45 (type $t3) (param $p0 i32) - (local $l1 i32) (local $l2 i32) (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $p0 - i32.load8_u offset=4 - local.tee $l2 - if $I0 - local.get $l1 - i32.const 8 - i32.add - local.set $l3 - local.get $l2 - i32.const 0 - i32.lt_u - if $I1 - unreachable - end - local.get $l3 - local.get $l2 - i32.store offset=4 - local.get $l3 - local.get $p0 - i32.store - local.get $p0 - i32.const 0 - i32.store8 offset=4 - end - local.get $l1 - i32.const 16 - i32.add - global.set $g0) - (func $f46 (type $t3) (param $p0 i32) - (local $l1 i32) - block $B0 - local.get $p0 - i32.load offset=4 - local.tee $l1 - i32.eqz - br_if $B0 - local.get $p0 - i32.load - local.tee $p0 - i32.eqz - br_if $B0 - local.get $l1 - i32.const 33 - i32.mul - i32.eqz - br_if $B0 - local.get $p0 - call $f89 - end) - (func $f47 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - local.get $p1 - i32.load - local.set $l2 - block $B0 - local.get $p1 - i32.load8_u offset=8 - br_if $B0 - local.get $l2 - local.get $p1 - i32.load offset=4 - local.tee $l4 - i32.gt_u - br_if $B0 - local.get $l2 - local.get $l4 - i32.ge_u - if $I1 - i32.const 1 - local.set $l3 - local.get $p1 - i32.const 1 - i32.store8 offset=8 - br $B0 - end - i32.const 1 - local.set $l3 - local.get $p1 - local.get $l2 - i32.const 1 - i32.add - i32.store - end - local.get $p0 - local.get $l2 - i32.store offset=4 - local.get $p0 - local.get $l3 - i32.store) - (func $f48 (type $t2) (param $p0 i32) (param $p1 i32) - local.get $p1 - local.get $p0 - i32.const 32 - call $f18) - (func $f49 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - block $B0 - local.get $p0 - i32.load offset=4 - local.get $p2 - i32.ge_u - if $I1 (result i32) - local.get $p1 - local.get $p0 - i32.load - local.get $p2 - call $f99 - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p2 - i32.lt_u - br_if $B0 - local.get $p0 - local.get $p1 - local.get $p2 - i32.sub - i32.store offset=4 - local.get $p0 - local.get $p0 - i32.load - local.get $p2 - i32.add - i32.store - i32.const 0 - else - i32.const 1 - end - return - end - unreachable) - (func $f50 (type $t2) (param $p0 i32) (param $p1 i32) - block $B0 - block $B1 - local.get $p1 - i32.const 5 - i32.ge_u - if $I2 - block $B3 - local.get $p1 - i32.const -5 - i32.add - br_table $B1 $B0 $B3 - end - local.get $p0 - i64.const 4294967302 - i64.store align=4 - local.get $p0 - i32.const 8 - i32.add - local.get $p1 - i32.const -7 - i32.add - i32.store - return - end - local.get $p0 - i64.const 4 - i64.store align=4 - local.get $p0 - i32.const 8 - i32.add - local.get $p1 - i32.store - return - end - local.get $p0 - i64.const 5 - i64.store align=4 - local.get $p0 - i32.const 8 - i32.add - i32.const 5 - i32.store - return - end - local.get $p0 - i64.const 4294967301 - i64.store align=4 - local.get $p0 - i32.const 8 - i32.add - i32.const 0 - i32.store) - (func $f51 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) - local.get $p0 - i32.load offset=4 - local.tee $l4 - local.get $p0 - i32.load offset=8 - local.tee $l5 - i32.const 5 - i32.shl - i32.add - local.tee $l3 - i32.const 84 - i32.add - local.get $l3 - i32.const 52 - i32.add - local.tee $l6 - local.get $l4 - i32.load16_u offset=50 - local.get $l5 - i32.sub - i32.const 5 - i32.shl - call $f100 - local.get $l3 - i32.const 76 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l3 - i32.const 68 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l3 - i32.const 60 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l6 - local.get $p1 - i64.load align=1 - i64.store align=1 - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p0 - i32.load offset=8 - local.tee $l3 - i32.const 2 - i32.shl - i32.add - local.tee $l4 - i32.const 8 - i32.add - local.get $l4 - i32.const 4 - i32.add - local.tee $l4 - local.get $p1 - i32.load16_u offset=50 - local.get $l3 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l4 - local.get $p2 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p1 - i32.load16_u offset=50 - i32.const 1 - i32.add - i32.store16 offset=50 - local.get $p0 - i32.load offset=4 - local.get $p0 - i32.load offset=8 - i32.const 2 - i32.shl - i32.add - i32.const 4 - i32.add) - (func $f52 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 48 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 40 - i32.add - local.tee $l3 - local.get $p1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $l2 - local.get $p1 - i64.load align=4 - i64.store offset=32 - local.get $l2 - i32.const 16 - i32.add - local.tee $p1 - local.get $l2 - i32.const 32 - i32.add - local.tee $l4 - i64.load align=4 - i64.store align=4 - local.get $p1 - i32.const 8 - i32.add - local.get $l4 - i32.const 8 - i32.add - i32.load - i32.store - local.get $l3 - local.get $l2 - i32.const 24 - i32.add - i32.load - i32.store - local.get $l2 - local.get $l2 - i64.load offset=16 - i64.store offset=32 - loop $L0 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 32 - i32.add - call $f47 - local.get $l2 - i32.load offset=8 - if $I1 - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $l2 - i32.load offset=12 - local.tee $l3 - i32.const 2 - i32.shl - i32.add - i32.const 404 - i32.add - i32.load - local.tee $l4 - local.get $l3 - i32.store16 offset=48 - local.get $l4 - local.get $p1 - i32.store - br $L0 - else - local.get $l2 - i32.const 48 - i32.add - global.set $g0 - end - end) - (func $f53 (type $t1) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) - (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l5 - global.set $g0 - local.get $p0 - i32.load offset=4 - local.tee $l4 - local.get $p0 - i32.load offset=8 - local.tee $l7 - i32.const 2 - i32.shl - i32.add - local.tee $l6 - i32.const 412 - i32.add - local.get $l6 - i32.const 408 - i32.add - local.tee $l6 - local.get $l4 - i32.load16_u offset=50 - local.get $l7 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l6 - local.get $p3 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $l4 - local.get $p0 - i32.load offset=8 - local.tee $l7 - i32.const 5 - i32.shl - i32.add - local.tee $p3 - i32.const 84 - i32.add - local.get $p3 - i32.const 52 - i32.add - local.tee $l6 - local.get $l4 - i32.load16_u offset=50 - local.get $l7 - i32.sub - i32.const 5 - i32.shl - call $f100 - local.get $p3 - i32.const 76 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load align=1 - i64.store align=1 - local.get $p3 - i32.const 68 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load align=1 - i64.store align=1 - local.get $p3 - i32.const 60 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l6 - local.get $p1 - i64.load align=1 - i64.store align=1 - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p0 - i32.load offset=8 - local.tee $p3 - i32.const 2 - i32.shl - i32.add - local.tee $l4 - i32.const 8 - i32.add - local.get $l4 - i32.const 4 - i32.add - local.tee $l4 - local.get $p1 - i32.load16_u offset=50 - local.get $p3 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l4 - local.get $p2 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p1 - i32.load16_u offset=50 - i32.const 1 - i32.add - i32.store16 offset=50 - local.get $l5 - i32.const 0 - i32.store8 offset=8 - local.get $l5 - local.get $p0 - i32.load offset=4 - i32.load16_u offset=50 - i32.store offset=4 - local.get $l5 - local.get $p0 - i32.load offset=8 - i32.const 1 - i32.add - i32.store - local.get $p0 - local.get $l5 - call $f52 - local.get $l5 - i32.const 16 - i32.add - global.set $g0) - (func $f54 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) - local.get $p0 - i32.load offset=4 - local.tee $l4 - local.get $p0 - i32.load offset=8 - local.tee $l3 - i32.const 2 - i32.shl - i32.add - local.tee $l5 - i32.const 8 - i32.add - local.get $l5 - i32.const 4 - i32.add - local.tee $l5 - local.get $l4 - i32.load16_u offset=94 - local.get $l3 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l5 - local.get $p1 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p0 - i32.load offset=8 - local.tee $l4 - i32.const 2 - i32.shl - i32.add - local.tee $l3 - i32.const 52 - i32.add - local.get $l3 - i32.const 48 - i32.add - local.tee $l3 - local.get $p1 - i32.load16_u offset=94 - local.get $l4 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l3 - local.get $p2 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p1 - i32.load16_u offset=94 - i32.const 1 - i32.add - i32.store16 offset=94 - local.get $p0 - i32.load offset=4 - local.get $p0 - i32.load offset=8 - i32.const 2 - i32.shl - i32.add - i32.const 48 - i32.add) - (func $f55 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 48 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 40 - i32.add - local.tee $l3 - local.get $p1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $l2 - local.get $p1 - i64.load align=4 - i64.store offset=32 - local.get $l2 - i32.const 16 - i32.add - local.tee $p1 - local.get $l2 - i32.const 32 - i32.add - local.tee $l4 - i64.load align=4 - i64.store align=4 - local.get $p1 - i32.const 8 - i32.add - local.get $l4 - i32.const 8 - i32.add - i32.load - i32.store - local.get $l3 - local.get $l2 - i32.const 24 - i32.add - i32.load - i32.store - local.get $l2 - local.get $l2 - i64.load offset=16 - i64.store offset=32 - loop $L0 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 32 - i32.add - call $f47 - local.get $l2 - i32.load offset=8 - if $I1 - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $l2 - i32.load offset=12 - local.tee $l3 - i32.const 2 - i32.shl - i32.add - i32.const 96 - i32.add - i32.load - local.tee $l4 - local.get $l3 - i32.store16 offset=92 - local.get $l4 - local.get $p1 - i32.store - br $L0 - else - local.get $l2 - i32.const 48 - i32.add - global.set $g0 - end - end) - (func $f56 (type $t1) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) - (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l5 - global.set $g0 - local.get $p0 - i32.load offset=4 - local.tee $l4 - local.get $p0 - i32.load offset=8 - local.tee $l6 - i32.const 2 - i32.shl - i32.add - local.tee $l7 - i32.const 104 - i32.add - local.get $l7 - i32.const 100 - i32.add - local.tee $l7 - local.get $l4 - i32.load16_u offset=94 - local.get $l6 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l7 - local.get $p3 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p3 - local.get $p0 - i32.load offset=8 - local.tee $l4 - i32.const 2 - i32.shl - i32.add - local.tee $l6 - i32.const 8 - i32.add - local.get $l6 - i32.const 4 - i32.add - local.tee $l6 - local.get $p3 - i32.load16_u offset=94 - local.get $l4 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l6 - local.get $p1 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p0 - i32.load offset=8 - local.tee $p3 - i32.const 2 - i32.shl - i32.add - local.tee $l4 - i32.const 52 - i32.add - local.get $l4 - i32.const 48 - i32.add - local.tee $l4 - local.get $p1 - i32.load16_u offset=94 - local.get $p3 - i32.sub - i32.const 2 - i32.shl - call $f100 - local.get $l4 - local.get $p2 - i32.store - local.get $p0 - i32.load offset=4 - local.tee $p1 - local.get $p1 - i32.load16_u offset=94 - i32.const 1 - i32.add - i32.store16 offset=94 - local.get $l5 - i32.const 0 - i32.store8 offset=8 - local.get $l5 - local.get $p0 - i32.load offset=4 - i32.load16_u offset=94 - i32.store offset=4 - local.get $l5 - local.get $p0 - i32.load offset=8 - i32.const 1 - i32.add - i32.store - local.get $p0 - local.get $l5 - call $f55 - local.get $l5 - i32.const 16 - i32.add - global.set $g0) - (func $f57 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - block $B0 - local.get $p1 - i32.eqz - if $I1 - i32.const 0 - local.set $p1 - br $B0 - end - local.get $p1 - local.get $p2 - call $f58 - local.set $p2 - end - local.get $p0 - local.get $p1 - i32.store offset=4 - local.get $p0 - local.get $p2 - i32.store) - (func $f58 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - local.get $p0 - local.get $p1 - call $f88) - (func $f59 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - block $B0 - block $B1 - loop $L2 - local.get $l2 - local.get $l4 - i32.store8 offset=12 - local.get $l3 - i32.const 4 - i32.eq - br_if $B1 - local.get $l2 - local.get $p1 - call $f60 - local.get $l2 - i32.load8_u - i32.const 1 - i32.and - i32.eqz - if $I3 - local.get $l2 - i32.const 8 - i32.add - local.get $l3 - i32.add - local.get $l2 - i32.load8_u offset=1 - i32.store8 - local.get $l4 - i32.const 1 - i32.add - local.set $l4 - local.get $l3 - i32.const 1 - i32.add - local.set $l3 - br $L2 - end - end - local.get $p0 - i32.const 1 - i32.store8 - local.get $l2 - i32.const 8 - i32.add - call $f45 - br $B0 - end - local.get $p0 - local.get $l2 - i32.load offset=8 - i32.store offset=1 align=1 - local.get $p0 - i32.const 0 - i32.store8 - end - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f60 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 8 - i32.add - local.get $p1 - call $f23 - local.get $l2 - i32.load8_u offset=8 - local.set $p1 - local.get $p0 - local.get $l2 - i32.load8_u offset=9 - i32.store8 offset=1 - local.get $p0 - local.get $p1 - i32.const 1 - i32.and - i32.store8 - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $f61 (type $t3) (param $p0 i32) - (local $l1 i32) (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i64) - global.get $g0 - i32.const 192 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 8 - i32.add - local.get $p0 - i32.const 72 - call $f99 - block $B0 - block $B1 - block $B2 - block $B3 - block $B4 - block $B5 - local.get $l1 - i32.load8_u offset=8 - local.tee $l9 - i32.const 1 - i32.sub - br_table $B3 $B2 $B5 $B4 - end - local.get $l1 - i32.const 168 - i32.add - local.tee $l3 - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=164 - local.get $l1 - i32.const 0 - i32.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 3 - call $f42 - local.get $l1 - i32.const 136 - i32.add - local.get $l3 - i32.load - local.tee $p0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - local.tee $l10 - i64.store offset=128 - local.get $l1 - i32.const 144 - i32.add - local.get $l10 - i32.wrap_i64 - local.get $l1 - i32.load offset=132 - local.get $p0 - call $f39 - local.get $l1 - i64.load offset=148 align=4 - local.set $l10 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $l10 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 65701 - i32.const 51 - call $f18 - local.get $l1 - i32.const 152 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 65792 - i32.store offset=148 - local.get $l1 - i32.load offset=164 - local.tee $l4 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l1 - i32.const 8 - i32.add - i32.const 1 - i32.or - local.set $l5 - local.get $l1 - i32.load offset=160 - local.set $l2 - local.get $l1 - local.get $l4 - local.get $p0 - i32.sub - i32.store offset=152 - local.get $l1 - local.get $p0 - local.get $l2 - i32.add - i32.store offset=148 - local.get $l1 - i32.const 184 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l1 - i32.const 176 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=160 - block $B6 - local.get $p0 - i32.const 33 - i32.ge_u - if $I7 - local.get $l1 - i32.const 104 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l1 - i32.const 96 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l1 - i32.const 88 - i32.add - local.tee $l8 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p0 - local.get $l1 - i32.const 80 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $l4 - local.get $l3 - i64.load - i64.store - local.get $l6 - local.get $l7 - i64.load - i64.store - local.get $l1 - i32.const 168 - i32.add - local.get $l8 - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - br $B6 - end - local.get $l1 - i32.const 160 - i32.add - local.get $l2 - local.get $p0 - call $f99 - end - local.get $l1 - i32.const 128 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f40 - local.get $l1 - i32.const 88 - i32.add - local.tee $p0 - local.get $l1 - i32.const 136 - i32.add - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=128 - i64.store offset=80 - local.get $l1 - i32.const 80 - i32.add - local.get $l5 - call $f41 - local.get $l1 - i32.const 168 - i32.add - local.tee $l2 - local.get $p0 - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 41 - i32.add - call $f41 - local.get $p0 - local.get $l2 - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - i64.store offset=80 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 80 - i32.add - call $f62 - br $B1 - end - local.get $l1 - i32.const 168 - i32.add - local.tee $l3 - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=164 - local.get $l1 - i32.const 0 - i32.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 3 - call $f42 - local.get $l1 - i32.const 136 - i32.add - local.get $l3 - i32.load - local.tee $p0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - local.tee $l10 - i64.store offset=128 - local.get $l1 - i32.const 144 - i32.add - local.get $l10 - i32.wrap_i64 - local.get $l1 - i32.load offset=132 - local.get $p0 - call $f39 - local.get $l1 - i64.load offset=148 align=4 - local.set $l10 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $l10 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 65536 - i32.const 57 - call $f18 - local.get $l1 - i32.const 152 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 65792 - i32.store offset=148 - local.get $l1 - i32.load offset=164 - local.tee $l4 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l1 - i32.load offset=160 - local.set $l2 - local.get $l1 - local.get $l4 - local.get $p0 - i32.sub - i32.store offset=152 - local.get $l1 - local.get $p0 - local.get $l2 - i32.add - i32.store offset=148 - local.get $l1 - i32.const 184 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l1 - i32.const 176 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=160 - block $B8 - local.get $p0 - i32.const 33 - i32.ge_u - if $I9 - local.get $l1 - i32.const 104 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l1 - i32.const 96 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l1 - i32.const 88 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p0 - local.get $l1 - i32.const 80 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $l4 - local.get $l3 - i64.load - i64.store - local.get $l5 - local.get $l6 - i64.load - i64.store - local.get $l1 - i32.const 168 - i32.add - local.get $l7 - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - br $B8 - end - local.get $l1 - i32.const 160 - i32.add - local.get $l2 - local.get $p0 - call $f99 - end - local.get $l1 - i32.const 128 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f40 - local.get $l1 - i32.const 88 - i32.add - local.tee $p0 - local.get $l1 - i32.const 136 - i32.add - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=128 - i64.store offset=80 - local.get $l1 - i32.const 80 - i32.add - local.get $l1 - i64.load offset=16 - local.get $l1 - i32.const 24 - i32.add - i64.load - call $f38 - local.get $l1 - i32.const 168 - i32.add - local.tee $l2 - local.get $p0 - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 32 - i32.add - i64.load - local.get $l1 - i32.const 40 - i32.add - i64.load - call $f38 - local.get $p0 - local.get $l2 - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - i64.store offset=80 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 80 - i32.add - call $f62 - br $B1 - end - local.get $l1 - i32.const 168 - i32.add - local.tee $l3 - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=164 - local.get $l1 - i32.const 0 - i32.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 2 - call $f42 - local.get $l1 - i32.const 136 - i32.add - local.get $l3 - i32.load - local.tee $p0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - local.tee $l10 - i64.store offset=128 - local.get $l1 - i32.const 144 - i32.add - local.get $l10 - i32.wrap_i64 - local.get $l1 - i32.load offset=132 - local.get $p0 - call $f39 - local.get $l1 - i64.load offset=148 align=4 - local.set $l10 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $l10 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 65593 - i32.const 55 - call $f18 - local.get $l1 - i32.const 152 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 65792 - i32.store offset=148 - local.get $l1 - i32.load offset=164 - local.tee $l4 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l1 - i32.load offset=160 - local.set $l2 - local.get $l1 - local.get $l4 - local.get $p0 - i32.sub - i32.store offset=152 - local.get $l1 - local.get $p0 - local.get $l2 - i32.add - i32.store offset=148 - local.get $l1 - i32.const 184 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l1 - i32.const 176 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=160 - block $B10 - local.get $p0 - i32.const 33 - i32.ge_u - if $I11 - local.get $l1 - i32.const 104 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l1 - i32.const 96 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l1 - i32.const 88 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p0 - local.get $l1 - i32.const 80 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $l4 - local.get $l3 - i64.load - i64.store - local.get $l5 - local.get $l6 - i64.load - i64.store - local.get $l1 - i32.const 168 - i32.add - local.get $l7 - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - br $B10 - end - local.get $l1 - i32.const 160 - i32.add - local.get $l2 - local.get $p0 - call $f99 - end - local.get $l1 - i32.const 128 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f40 - local.get $l1 - i32.const 88 - i32.add - local.get $l1 - i32.const 136 - i32.add - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=128 - i64.store offset=80 - local.get $l1 - i32.const 144 - i32.add - local.get $l1 - i32.const 80 - i32.add - local.get $l1 - i32.load8_u offset=9 - call $f63 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 144 - i32.add - call $f62 - br $B1 - end - local.get $l1 - i32.const 168 - i32.add - local.tee $l3 - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=164 - local.get $l1 - i32.const 0 - i32.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 3 - call $f42 - local.get $l1 - i32.const 136 - i32.add - local.get $l3 - i32.load - local.tee $p0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=160 - local.tee $l10 - i64.store offset=128 - local.get $l1 - i32.const 144 - i32.add - local.get $l10 - i32.wrap_i64 - local.get $l1 - i32.load offset=132 - local.get $p0 - call $f39 - local.get $l1 - i64.load offset=148 align=4 - local.set $l10 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $l10 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - i32.const 65648 - i32.const 53 - call $f18 - local.get $l1 - i32.const 152 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 65792 - i32.store offset=148 - local.get $l1 - i32.load offset=164 - local.tee $l4 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l1 - i32.const 8 - i32.add - i32.const 1 - i32.or - local.get $l1 - i32.load offset=160 - local.set $l2 - local.get $l1 - local.get $l4 - local.get $p0 - i32.sub - i32.store offset=152 - local.get $l1 - local.get $p0 - local.get $l2 - i32.add - i32.store offset=148 - local.get $l1 - i32.const 184 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l1 - i32.const 176 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=160 - block $B12 - local.get $p0 - i32.const 33 - i32.ge_u - if $I13 - local.get $l1 - i32.const 104 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l1 - i32.const 96 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l1 - i32.const 88 - i32.add - local.tee $l8 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p0 - local.get $l1 - i32.const 80 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $l4 - local.get $l3 - i64.load - i64.store - local.get $l6 - local.get $l7 - i64.load - i64.store - local.get $l1 - i32.const 168 - i32.add - local.get $l8 - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - br $B12 - end - local.get $l1 - i32.const 160 - i32.add - local.get $l2 - local.get $p0 - call $f99 - end - local.get $l1 - i32.const 128 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f40 - local.get $l1 - i32.const 120 - i32.add - local.get $l1 - i32.const 136 - i32.add - i32.load - local.tee $p0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=128 - local.tee $l10 - i64.store offset=112 - local.get $l1 - i32.const 144 - i32.add - local.get $l10 - i32.wrap_i64 - local.get $l1 - i32.load offset=116 - local.get $p0 - call $f39 - local.get $l1 - i64.load offset=148 align=4 - local.set $l10 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $l10 - i64.store offset=160 - local.get $l1 - i32.const 160 - i32.add - call $f19 - local.get $l1 - i32.const 152 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 65792 - i32.store offset=148 - local.get $l1 - i32.load offset=164 - local.tee $l3 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l1 - i32.load offset=160 - local.set $l2 - local.get $l1 - local.get $l3 - local.get $p0 - i32.sub - i32.store offset=152 - local.get $l1 - local.get $p0 - local.get $l2 - i32.add - i32.store offset=148 - local.get $l1 - i32.const 184 - i32.add - local.tee $l3 - i64.const 0 - i64.store - local.get $l1 - i32.const 176 - i32.add - local.tee $l4 - i64.const 0 - i64.store - local.get $l1 - i32.const 168 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=160 - block $B14 - local.get $p0 - i32.const 33 - i32.ge_u - if $I15 - local.get $l1 - i32.const 104 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l1 - i32.const 96 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l1 - i32.const 88 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=80 - local.get $l2 - local.get $p0 - local.get $l1 - i32.const 80 - i32.add - call $seal0.seal_hash_blake2_256 - local.get $l3 - local.get $l5 - i64.load - i64.store - local.get $l4 - local.get $l6 - i64.load - i64.store - local.get $l1 - i32.const 168 - i32.add - local.get $l7 - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=80 - i64.store offset=160 - br $B14 - end - local.get $l1 - i32.const 160 - i32.add - local.get $l2 - local.get $p0 - call $f99 - end - local.get $l1 - i32.const 112 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f40 - local.get $l1 - i32.const 88 - i32.add - local.get $l1 - i32.const 120 - i32.add - i32.load - i32.store - local.get $l1 - local.get $l1 - i64.load offset=112 - i64.store offset=80 - local.get $l1 - i32.const 144 - i32.add - local.get $l1 - i32.const 80 - i32.add - local.get $l1 - i32.const 41 - i32.add - i32.load8_u - call $f63 - local.get $l1 - i32.const 160 - i32.add - local.get $l1 - i32.const 144 - i32.add - call $f62 - end - local.get $l1 - i32.const 176 - i32.add - i32.load - local.set $l3 - local.get $l1 - i32.const 168 - i32.add - i32.load - local.set $p0 - local.get $l1 - i32.load offset=172 - local.get $l1 - i32.load offset=164 - local.set $l2 - local.get $l1 - i32.const 0 - i32.store offset=168 - local.get $l1 - local.get $p0 - i32.store offset=164 - local.get $l1 - local.get $l2 - i32.store offset=160 - block $B16 - block $B17 - block $B18 - block $B19 - block $B20 - local.get $l9 - i32.const 1 - i32.sub - br_table $B19 $B18 $B17 $B20 - end - local.get $p0 - i32.eqz - br_if $B0 - local.get $l2 - i32.const 0 - i32.store8 - local.get $l1 - local.get $l1 - i32.load offset=168 - i32.const 1 - i32.add - i32.store offset=168 - local.get $l1 - i32.const 16 - i32.add - i64.load - local.get $l1 - i32.const 24 - i32.add - i64.load - local.get $l1 - i32.const 160 - i32.add - call $f44 - local.get $l1 - i32.const 32 - i32.add - i64.load - local.get $l1 - i32.const 40 - i32.add - i64.load - local.get $l1 - i32.const 160 - i32.add - call $f44 - br $B16 - end - local.get $p0 - i32.eqz - br_if $B0 - local.get $l2 - i32.const 1 - i32.store8 - local.get $l1 - local.get $l1 - i32.load offset=168 - i32.const 1 - i32.add - i32.store offset=168 - local.get $l1 - i32.load8_u offset=9 - local.get $l1 - i32.const 160 - i32.add - call $f37 - br $B16 - end - local.get $p0 - i32.eqz - br_if $B0 - local.get $l2 - i32.const 2 - i32.store8 - local.get $l1 - local.get $l1 - i32.load offset=168 - i32.const 1 - i32.add - i32.store offset=168 - local.get $l1 - i32.const 8 - i32.add - i32.const 1 - i32.or - local.get $l1 - i32.const 160 - i32.add - call $f19 - local.get $l1 - i32.const 41 - i32.add - i32.load8_u - local.get $l1 - i32.const 160 - i32.add - call $f37 - br $B16 - end - local.get $p0 - i32.eqz - br_if $B0 - local.get $l2 - i32.const 3 - i32.store8 - local.get $l1 - local.get $l1 - i32.load offset=168 - i32.const 1 - i32.add - i32.store offset=168 - local.get $l1 - i32.const 8 - i32.add - i32.const 1 - i32.or - local.get $l1 - i32.const 160 - i32.add - call $f19 - local.get $l1 - i32.const 41 - i32.add - local.get $l1 - i32.const 160 - i32.add - call $f19 - end - local.get $l1 - i32.load offset=164 - local.get $l1 - i32.load offset=168 - local.tee $p0 - i32.lt_u - br_if $B0 - local.get $l3 - local.get $l1 - i32.load offset=160 - local.get $p0 - call $seal0.seal_deposit_event - local.get $l1 - i32.const 192 - i32.add - global.set $g0 - return - end - unreachable) - (func $f62 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) - local.get $p1 - i32.const 8 - i32.add - i32.load - local.tee $l3 - local.get $p1 - i32.load - local.tee $l2 - i32.lt_u - if $I0 - unreachable - end - local.get $p0 - local.get $p1 - i32.load offset=4 - local.tee $p1 - i32.store offset=12 - local.get $p0 - i32.const 0 - i32.store - local.get $p0 - i32.const 16 - i32.add - local.get $l2 - i32.store - local.get $p0 - i32.const 8 - i32.add - local.get $l3 - local.get $l2 - i32.sub - i32.store - local.get $p0 - local.get $p1 - local.get $l2 - i32.add - i32.store offset=4) - (func $f63 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i32) - global.get $g0 - i32.const 96 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - i32.const 16 - i32.add - local.get $p1 - i32.load - local.get $p1 - i32.const 4 - i32.add - i32.load - local.get $p1 - i32.const 8 - i32.add - i32.load - call $f39 - local.get $l3 - i32.const 8 - i32.add - local.get $l3 - i32.const 16 - i32.add - local.get $p2 - call $f35 - local.get $l3 - i32.load offset=8 - local.set $l4 - local.get $l3 - i32.load offset=12 - local.set $p2 - local.get $l3 - i32.const 56 - i32.add - local.tee $l5 - i64.const 0 - i64.store - local.get $l3 - i32.const 48 - i32.add - local.tee $l6 - i64.const 0 - i64.store - local.get $l3 - i32.const 40 - i32.add - local.tee $l7 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store offset=32 - block $B0 - local.get $p2 - i32.const 33 - i32.ge_u - if $I1 - local.get $l3 - i32.const 88 - i32.add - local.tee $l8 - i64.const 0 - i64.store - local.get $l3 - i32.const 80 - i32.add - local.tee $l9 - i64.const 0 - i64.store - local.get $l3 - i32.const 72 - i32.add - local.tee $l10 - i64.const 0 - i64.store - local.get $l3 - i64.const 0 - i64.store offset=64 - local.get $l4 - local.get $p2 - local.get $l3 - i32.const -64 - i32.sub - call $seal0.seal_hash_blake2_256 - local.get $l5 - local.get $l8 - i64.load - i64.store - local.get $l6 - local.get $l9 - i64.load - i64.store - local.get $l7 - local.get $l10 - i64.load - i64.store - local.get $l3 - local.get $l3 - i64.load offset=64 - i64.store offset=32 - br $B0 - end - local.get $l3 - i32.const 32 - i32.add - local.get $l4 - local.get $p2 - call $f99 - end - local.get $p1 - local.get $l3 - i32.const 32 - i32.add - call $f40 - local.get $p0 - i32.const 8 - i32.add - local.get $p1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $p0 - local.get $p1 - i64.load align=4 - i64.store align=4 - local.get $l3 - i32.const 96 - i32.add - global.set $g0) - (func $f64 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - local.get $p0 - i32.store offset=12 - local.get $l1 - i32.const 12 - i32.add - i32.load - i32.load8_u - call $f69 - unreachable) - (func $f65 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - local.get $p0 - i32.store offset=12 - local.get $l1 - i32.const 12 - i32.add - i32.load - i32.load8_u - call $f68 - unreachable) - (func $f66 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - local.get $p0 - i32.store offset=12 - local.get $l1 - i32.const 12 - i32.add - i32.load - local.tee $p0 - i64.load - local.get $p0 - i32.const 8 - i32.add - i64.load - call $f67 - unreachable) - (func $f67 (type $t12) (param $p0 i64) (param $p1 i64) - (local $l2 i32) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 24 - i32.add - i32.const 16384 - i32.store - local.get $l2 - i32.const 65796 - i32.store offset=20 - local.get $l2 - i32.const 0 - i32.store offset=16 - local.get $l2 - i32.const 8 - i32.add - local.get $l2 - i32.const 16 - i32.add - local.get $p0 - local.get $p1 - call $f34 - local.get $l2 - i32.load offset=8 - local.get $l2 - i32.load offset=12 - call $f73 - unreachable) - (func $f68 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 24 - i32.add - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=20 - local.get $l1 - i32.const 0 - i32.store offset=16 - local.get $l1 - i32.const 8 - i32.add - local.get $l1 - i32.const 16 - i32.add - local.get $p0 - call $f72 - local.get $l1 - i32.load offset=8 - local.get $l1 - i32.load offset=12 - call $f73 - unreachable) - (func $f69 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 24 - i32.add - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=20 - local.get $l1 - i32.const 0 - i32.store offset=16 - local.get $l1 - i32.const 8 - i32.add - local.get $l1 - i32.const 16 - i32.add - local.get $p0 - call $f35 - local.get $l1 - i32.load offset=8 - local.get $l1 - i32.load offset=12 - call $f73 - unreachable) - (func $f70 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 32 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 24 - i32.add - i32.const 16384 - i32.store - local.get $l1 - i32.const 65796 - i32.store offset=20 - local.get $l1 - i32.const 0 - i32.store offset=16 - local.get $l1 - i32.const 8 - i32.add - local.get $l1 - i32.const 16 - i32.add - local.get $p0 - call $f33 - local.get $l1 - i32.load offset=8 - local.get $l1 - i32.load offset=12 - call $f73 - unreachable) - (func $f71 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) - global.get $g0 - i32.const 80 - i32.sub - local.tee $l2 - global.set $g0 - block $B0 - loop $L1 - local.get $l2 - local.get $l3 - i32.store8 offset=40 - local.get $l3 - i32.const 32 - i32.eq - if $I2 - local.get $p0 - local.get $l2 - i64.load offset=8 - i64.store offset=1 align=1 - local.get $p0 - i32.const 0 - i32.store8 - local.get $p0 - i32.const 9 - i32.add - local.get $l2 - i32.const 16 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 17 - i32.add - local.get $l2 - i32.const 24 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 25 - i32.add - local.get $l2 - i32.const 32 - i32.add - i64.load - i64.store align=1 - br $B0 - end - local.get $l2 - local.get $p1 - call $f60 - local.get $l2 - i32.load8_u - i32.const 1 - i32.and - i32.eqz - if $I3 - local.get $l2 - i32.const 8 - i32.add - local.get $l3 - i32.add - local.get $l2 - i32.load8_u offset=1 - i32.store8 - local.get $l3 - i32.const 1 - i32.add - local.set $l3 - br $L1 - end - end - local.get $p0 - i32.const 1 - i32.store8 - local.get $l3 - i32.const 255 - i32.and - i32.eqz - br_if $B0 - local.get $l2 - i32.const 0 - i32.store8 offset=40 - end - local.get $l2 - i32.const 80 - i32.add - global.set $g0) - (func $f72 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l3 - global.set $g0 - local.get $p1 - i32.const 8 - i32.add - local.tee $l4 - i32.load - local.set $l5 - local.get $l4 - i32.const 0 - i32.store - local.get $p1 - i32.load offset=4 - local.set $l4 - local.get $p1 - i32.const 65792 - i32.store offset=4 - local.get $l5 - i32.eqz - if $I0 - unreachable - end - local.get $l4 - local.get $p2 - i32.store8 - local.get $p1 - local.get $l5 - i32.store offset=8 - local.get $p1 - local.get $l4 - i32.store offset=4 - local.get $l3 - i32.const 8 - i32.add - local.get $p1 - i32.const 1 - call $f74 - local.get $p0 - local.get $l3 - i32.load offset=8 - i32.store - local.get $p0 - local.get $l3 - i32.load offset=12 - i32.store offset=4 - local.get $l3 - i32.const 16 - i32.add - global.set $g0) - (func $f73 (type $t2) (param $p0 i32) (param $p1 i32) - i32.const 0 - local.get $p0 - local.get $p1 - call $seal0.seal_return - unreachable) - (func $f74 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) - local.get $p1 - i32.const 8 - i32.add - local.tee $l3 - i32.load - local.set $l4 - local.get $l3 - i32.const 0 - i32.store - local.get $p1 - i32.load offset=4 - local.set $l3 - local.get $p1 - i32.const 65792 - i32.store offset=4 - local.get $l4 - local.get $p2 - i32.lt_u - if $I0 - unreachable - end - local.get $p1 - local.get $l4 - local.get $p2 - i32.sub - i32.store offset=8 - local.get $p1 - local.get $p2 - local.get $l3 - i32.add - i32.store offset=4 - local.get $p0 - local.get $p2 - i32.store offset=4 - local.get $p0 - local.get $l3 - i32.store) - (func $f75 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 80 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - local.get $p1 - call $f23 - block $B0 - block $B1 - block $B2 - block $B3 - local.get $l2 - i32.load8_u - i32.const 1 - i32.and - i32.eqz - if $I4 - local.get $l2 - i32.load8_u offset=1 - br_table $B2 $B1 $B3 - end - local.get $p0 - i32.const 2 - i32.store8 - br $B0 - end - local.get $p0 - i32.const 2 - i32.store8 - br $B0 - end - local.get $p0 - i32.const 0 - i32.store8 - br $B0 - end - local.get $l2 - i32.const 40 - i32.add - local.get $p1 - call $f24 - local.get $l2 - i32.const 16 - i32.add - local.tee $p1 - local.get $l2 - i32.const 49 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 24 - i32.add - local.tee $l3 - local.get $l2 - i32.const 57 - i32.add - i64.load align=1 - i64.store - local.get $l2 - i32.const 32 - i32.add - local.tee $l4 - local.get $l2 - i32.const 65 - i32.add - i64.load align=1 - i64.store - local.get $l2 - local.get $l2 - i64.load offset=41 align=1 - i64.store offset=8 - local.get $l2 - i32.load8_u offset=40 - i32.const 1 - i32.ne - if $I5 - local.get $p0 - i32.const 1 - i32.store8 - local.get $p0 - local.get $l2 - i64.load offset=8 - i64.store offset=1 align=1 - local.get $p0 - i32.const 9 - i32.add - local.get $p1 - i64.load - i64.store align=1 - local.get $p0 - i32.const 17 - i32.add - local.get $l3 - i64.load - i64.store align=1 - local.get $p0 - i32.const 25 - i32.add - local.get $l4 - i64.load - i64.store align=1 - br $B0 - end - local.get $p0 - i32.const 2 - i32.store8 - end - local.get $l2 - i32.const 80 - i32.add - global.set $g0) - (func $f76 (type $t3) (param $p0 i32) - (local $l1 i32) (local $l2 i32) - global.get $g0 - i32.const 96 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - i32.const 16384 - i32.store offset=44 - local.get $l1 - i32.const 65796 - i32.store offset=40 - local.get $l1 - i32.const 16384 - i32.store offset=48 - i32.const 65796 - local.get $l1 - i32.const 48 - i32.add - call $seal0.seal_caller - local.get $l1 - i32.const 40 - i32.add - local.get $l1 - i32.load offset=48 - call $f77 - local.get $l1 - local.get $l1 - i64.load offset=40 - i64.store offset=88 - local.get $l1 - i32.const 48 - i32.add - local.get $l1 - i32.const 88 - i32.add - call $f24 - local.get $l1 - i32.load8_u offset=48 - i32.const 1 - i32.ne - if $I0 (result i32) - local.get $l1 - i32.const 16 - i32.add - local.get $l1 - i32.const 58 - i32.add - i64.load align=2 - i64.store - local.get $l1 - i32.const 24 - i32.add - local.get $l1 - i32.const 66 - i32.add - i64.load align=2 - i64.store - local.get $l1 - i32.const 31 - i32.add - local.get $l1 - i32.const 73 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l1 - local.get $l1 - i64.load offset=50 align=2 - i64.store offset=8 - local.get $l1 - i32.load8_u offset=49 - local.set $l2 - i32.const 0 - else - i32.const 1 - end - if $I1 - unreachable - end - local.get $p0 - local.get $l2 - i32.store8 - local.get $p0 - local.get $l1 - i64.load offset=8 - i64.store offset=1 align=1 - local.get $p0 - i32.const 9 - i32.add - local.get $l1 - i32.const 16 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 17 - i32.add - local.get $l1 - i32.const 24 - i32.add - i64.load - i64.store align=1 - local.get $p0 - i32.const 24 - i32.add - local.get $l1 - i32.const 31 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l1 - i32.const 96 - i32.add - global.set $g0) - (func $f77 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $p0 - i32.load offset=4 - local.set $l3 - local.get $p0 - i32.const 0 - i32.store offset=4 - local.get $p0 - i32.load - local.set $l4 - local.get $p0 - i32.const 65792 - i32.store - local.get $l2 - i32.const 8 - i32.add - i32.const 0 - local.get $p1 - local.get $l4 - local.get $l3 - call $f90 - local.get $p0 - local.get $l2 - i64.load offset=8 - i64.store align=4 - local.get $l2 - i32.const 16 - i32.add - global.set $g0) - (func $deploy (type $t13) (result i32) - i32.const 0 - call $f79 - i32.const 255 - i32.and - i32.const 2 - i32.shl - i32.const 65756 - i32.add - i32.load) - (func $f79 (type $t6) (param $p0 i32) (result i32) - (local $l1 i32) (local $l2 i32) (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) (local $l10 i32) (local $l11 i32) (local $l12 i32) (local $l13 i32) (local $l14 i32) (local $l15 i32) (local $l16 i64) (local $l17 i64) (local $l18 i64) (local $l19 i64) (local $l20 i64) (local $l21 i64) (local $l22 i64) (local $l23 i64) (local $l24 i64) (local $l25 i64) (local $l26 i64) - global.get $g0 - i32.const 704 - i32.sub - local.tee $l1 - global.set $g0 - block $B0 - block $B1 - block $B2 - block $B3 - block $B4 - block $B5 - local.get $p0 - if $I6 - local.get $l1 - i32.const 16384 - i32.store offset=292 - local.get $l1 - i32.const 65796 - i32.store offset=288 - local.get $l1 - i32.const 288 - i32.add - call $f81 - local.get $l1 - local.get $l1 - i64.load offset=288 - i64.store offset=312 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f59 - i32.const 1 - local.set $p0 - local.get $l1 - i32.load8_u offset=520 - i32.const 1 - i32.eq - br_if $B4 - local.get $l1 - i32.load8_u offset=524 - local.set $l6 - local.get $l1 - i32.load8_u offset=523 - local.set $l4 - local.get $l1 - i32.load8_u offset=522 - local.set $l2 - block $B7 - block $B8 - block $B9 - block $B10 - block $B11 - block $B12 - block $B13 - block $B14 - block $B15 - block $B16 - block $B17 - block $B18 - local.get $l1 - i32.load8_u offset=521 - local.tee $l3 - i32.const -101 - i32.add - br_table $B17 $B14 $B18 - end - block $B19 - block $B20 - block $B21 - local.get $l3 - i32.const 112 - i32.ne - if $I22 - local.get $l3 - i32.const 118 - i32.eq - br_if $B19 - local.get $l3 - i32.const 176 - i32.eq - br_if $B13 - local.get $l3 - i32.const 187 - i32.eq - br_if $B21 - local.get $l3 - i32.const 194 - i32.eq - br_if $B20 - local.get $l3 - i32.const 251 - i32.eq - br_if $B16 - local.get $l3 - i32.const 243 - i32.eq - br_if $B15 - local.get $l3 - i32.const 209 - i32.ne - br_if $B4 - local.get $l2 - i32.const 20 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 10 - i32.ne - br_if $B3 - local.get $l6 - i32.const 201 - i32.ne - br_if $B3 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f75 - local.get $l1 - i32.const 392 - i32.add - local.tee $l6 - local.get $l1 - i32.const 551 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i32.const 543 - i32.add - i64.load align=1 - i64.store offset=384 - local.get $l1 - i32.load8_u offset=520 - local.tee $l3 - i32.const 2 - i32.eq - br_if $B4 - local.get $l1 - i32.const 535 - i32.add - i64.load align=1 - local.get $l1 - i32.const 552 - i32.add - local.tee $l2 - i32.load8_u - local.set $l10 - local.get $l1 - i64.load offset=527 align=1 - local.set $l20 - local.get $l1 - i32.load offset=523 align=1 - local.set $l8 - local.get $l1 - i32.load16_u offset=521 align=1 - local.set $l4 - local.get $l1 - i32.const 376 - i32.add - local.get $l6 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=384 - i64.store offset=368 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f75 - local.get $l1 - i32.const 424 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i32.const 544 - i32.add - i64.load - i64.store offset=416 - local.get $l1 - i32.load8_u offset=520 - local.tee $l7 - i32.const 2 - i32.eq - br_if $B4 - local.get $l1 - i32.const 536 - i32.add - i64.load - local.set $l18 - local.get $l1 - i32.const 528 - i32.add - i64.load - local.set $l21 - local.get $l1 - i32.load offset=524 - local.set $l12 - local.get $l1 - i32.load16_u offset=522 - local.set $l13 - local.get $l1 - i32.load8_u offset=521 - local.set $l14 - local.get $l1 - i32.const 496 - i32.add - local.get $l1 - i32.const 424 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=416 - i64.store offset=488 - local.get $l1 - i32.const 112 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f29 - local.get $l1 - i32.load offset=112 - br_if $B4 - local.get $l1 - i32.const 128 - i32.add - i64.load - local.set $l17 - local.get $l1 - i64.load offset=120 - local.set $l22 - local.get $l1 - i32.const 88 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f29 - local.get $l1 - i32.load offset=88 - br_if $B4 - local.get $l1 - i32.const -64 - i32.sub - local.get $l1 - i32.const 312 - i32.add - call $f29 - local.get $l1 - i32.load offset=64 - br_if $B4 - local.get $l1 - i32.const 80 - i32.add - i64.load - local.set $l25 - local.get $l1 - i64.load offset=72 - local.set $l26 - local.get $l1 - i32.const 40 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f29 - local.get $l1 - i32.load offset=40 - br_if $B4 - local.get $l1 - i32.const 56 - i32.add - i64.load - local.set $l23 - local.get $l1 - i64.load offset=48 - local.set $l24 - local.get $l1 - i64.const 0 - i64.store offset=520 - local.get $l1 - i32.const 312 - i32.add - local.get $l1 - i32.const 520 - i32.add - i32.const 8 - call $f49 - br_if $B4 - local.get $l1 - i32.const 360 - i32.add - local.get $l1 - i32.const 376 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 496 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=368 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=488 - i64.store offset=296 - local.set $l16 - br $B5 - end - local.get $l2 - i32.const 87 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 77 - i32.ne - br_if $B3 - local.get $l6 - i32.const 226 - i32.ne - br_if $B3 - local.get $l1 - i32.const 136 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f29 - local.get $l1 - i64.load offset=136 - i32.wrap_i64 - br_if $B4 - local.get $l1 - i32.const 152 - i32.add - i64.load - local.set $l16 - local.get $l1 - i64.load offset=144 - local.set $l20 - local.get $l1 - i32.const 360 - i32.add - local.get $l1 - i32.const 528 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 424 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=520 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=416 align=1 - i64.store offset=296 - i32.const 1 - local.set $l5 - br $B5 - end - local.get $l2 - i32.const 199 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 99 - i32.ne - br_if $B3 - local.get $l6 - i32.const 66 - i32.ne - br_if $B3 - i32.const 2 - local.set $l5 - local.get $l1 - i32.const 312 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $l3 - i32.const 2 - i32.eq - br_if $B4 - local.get $l1 - i32.const 360 - i32.add - local.get $l1 - i32.const 528 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 424 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=520 align=2 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=416 align=1 - i64.store offset=296 - local.get $l3 - i32.const 0 - i32.ne - local.set $l3 - br $B5 - end - local.get $l2 - i32.const 33 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 229 - i32.ne - br_if $B3 - local.get $l6 - i32.const 60 - i32.ne - br_if $B3 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f24 - local.get $l1 - i32.const 424 - i32.add - local.tee $l2 - local.get $l1 - i32.const 552 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i32.const 544 - i32.add - i64.load - i64.store offset=416 - local.get $l1 - i32.load8_u offset=520 - i32.const 1 - i32.eq - br_if $B4 - local.get $l1 - i32.const 536 - i32.add - i64.load - local.set $l17 - local.get $l1 - i32.const 528 - i32.add - i64.load - local.set $l20 - local.get $l1 - i32.load offset=524 - local.set $l8 - local.get $l1 - i32.load16_u offset=522 - local.set $l4 - local.get $l1 - i32.load8_u offset=521 - local.set $l3 - local.get $l1 - i32.const 496 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=416 - i64.store offset=488 - local.get $l1 - i32.const 312 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $p0 - i32.const 2 - i32.eq - br_if $B12 - local.get $l1 - i32.const 360 - i32.add - local.get $l1 - i32.const 496 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 392 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=488 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=384 align=1 - i64.store offset=296 - local.get $p0 - i32.const 0 - i32.ne - local.set $l10 - i32.const 3 - local.set $l5 - local.get $l17 - local.set $l16 - br $B5 - end - local.get $l2 - i32.const 11 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 252 - i32.ne - br_if $B3 - local.get $l6 - i32.const 88 - i32.ne - br_if $B3 - local.get $l1 - i32.const 192 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f23 - local.get $l1 - i32.load8_u offset=192 - i32.const 1 - i32.and - br_if $B4 - local.get $l1 - i32.load8_u offset=193 - local.tee $l3 - i32.const 3 - i32.and - local.tee $l2 - i32.const 3 - i32.eq - br_if $B8 - local.get $l2 - i32.const 1 - i32.sub - br_table $B10 $B9 $B11 - end - local.get $l2 - i32.const 36 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 134 - i32.ne - br_if $B3 - local.get $l6 - i32.const 253 - i32.ne - br_if $B3 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f24 - local.get $l1 - i32.const 424 - i32.add - local.tee $l2 - local.get $l1 - i32.const 552 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i32.const 544 - i32.add - i64.load - i64.store offset=416 - local.get $l1 - i32.load8_u offset=520 - i32.const 1 - i32.eq - br_if $B4 - local.get $l1 - i32.const 536 - i32.add - i64.load - local.set $l16 - local.get $l1 - i32.const 528 - i32.add - i64.load - local.set $l20 - local.get $l1 - i32.load offset=524 - local.set $l8 - local.get $l1 - i32.load16_u offset=522 - local.set $l4 - local.get $l1 - i32.load8_u offset=521 - local.set $l3 - local.get $l1 - i32.const 360 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 496 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=416 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=488 align=1 - i64.store offset=296 - i32.const 5 - local.set $l5 - br $B5 - end - local.get $l2 - i32.const 107 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 76 - i32.ne - br_if $B3 - local.get $l6 - i32.const 230 - i32.ne - br_if $B2 - i32.const 6 - local.set $l5 - br $B5 - end - local.get $l2 - i32.const 14 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 173 - i32.ne - br_if $B3 - local.get $l6 - i32.const 135 - i32.ne - br_if $B2 - i32.const 7 - local.set $l5 - br $B5 - end - local.get $l2 - i32.const 21 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 69 - i32.ne - br_if $B3 - local.get $l6 - i32.const 57 - i32.ne - br_if $B2 - i32.const 8 - local.set $l5 - br $B5 - end - local.get $l2 - i32.const 61 - i32.ne - br_if $B3 - local.get $l4 - i32.const 255 - i32.and - i32.const 214 - i32.ne - br_if $B3 - local.get $l6 - i32.const 159 - i32.ne - br_if $B3 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f24 - local.get $l1 - i32.const 424 - i32.add - local.tee $l2 - local.get $l1 - i32.const 552 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i32.const 544 - i32.add - i64.load - i64.store offset=416 - local.get $l1 - i32.load8_u offset=520 - i32.const 1 - i32.eq - br_if $B4 - local.get $l1 - i32.const 536 - i32.add - i64.load - local.set $l16 - local.get $l1 - i32.const 528 - i32.add - i64.load - local.set $l20 - local.get $l1 - i32.load offset=524 - local.set $l8 - local.get $l1 - i32.load16_u offset=522 - local.set $l4 - local.get $l1 - i32.load8_u offset=521 - local.set $l3 - local.get $l1 - i32.const 360 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 496 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=416 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=488 align=1 - i64.store offset=296 - i32.const 9 - local.set $l5 - br $B5 - end - i32.const 1 - local.set $p0 - br $B4 - end - local.get $l3 - i32.const 252 - i32.and - i32.const 2 - i32.shr_u - local.set $l5 - br $B7 - end - local.get $l1 - local.get $l3 - i32.store8 offset=525 - local.get $l1 - i32.const 1 - i32.store8 offset=524 - local.get $l1 - local.get $l1 - i32.const 312 - i32.add - i32.store offset=520 - local.get $l1 - i32.const 0 - i32.store16 offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - i32.const 2 - call $f82 - br_if $B4 - local.get $l1 - i32.load16_u offset=416 - local.tee $l3 - i32.const 255 - i32.le_u - br_if $B4 - local.get $l3 - i32.const 2 - i32.shr_u - local.set $l5 - br $B7 - end - local.get $l1 - local.get $l3 - i32.store8 offset=525 - local.get $l1 - i32.const 1 - i32.store8 offset=524 - local.get $l1 - local.get $l1 - i32.const 312 - i32.add - i32.store offset=520 - local.get $l1 - i32.const 0 - i32.store offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - i32.const 4 - call $f82 - br_if $B4 - local.get $l1 - i32.load offset=416 - local.tee $l3 - i32.const 65536 - i32.lt_u - br_if $B4 - local.get $l3 - i32.const 2 - i32.shr_u - local.set $l5 - br $B7 - end - local.get $l3 - i32.const 255 - i32.and - i32.const 3 - i32.gt_u - br_if $B4 - local.get $l1 - i32.const 184 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f15 - local.get $l1 - i32.load offset=184 - br_if $B4 - local.get $l1 - i32.load offset=188 - local.tee $l5 - i32.const 1073741824 - i32.lt_u - br_if $B4 - end - local.get $l5 - local.get $l1 - i32.load offset=316 - i32.const 33 - i32.div_u - local.tee $l2 - local.get $l2 - local.get $l5 - i32.gt_u - select - i64.extend_i32_u - i64.const 33 - i64.mul - local.tee $l18 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if $B1 - local.get $l18 - i32.wrap_i64 - local.tee $l2 - i32.const -1 - i32.le_s - br_if $B1 - local.get $l1 - i32.const 176 - i32.add - local.get $l2 - i32.const 1 - call $f57 - local.get $l1 - i32.load offset=176 - local.tee $l6 - i32.eqz - br_if $B1 - local.get $l1 - i32.load offset=180 - local.set $l2 - local.get $l1 - i32.const 0 - i32.store offset=424 - local.get $l1 - local.get $l6 - i32.store offset=416 - local.get $l1 - local.get $l2 - i32.const 33 - i32.div_u - i32.store offset=420 - local.get $l1 - i32.const 544 - i32.add - local.set $l14 - local.get $l1 - i32.const 536 - i32.add - local.set $l15 - i32.const 0 - local.set $l3 - loop $L23 - block $B24 - block $B25 - local.get $l5 - if $I26 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 312 - i32.add - call $f24 - local.get $l1 - i32.load8_u offset=520 - i32.const 1 - i32.eq - br_if $B25 - local.get $l1 - i32.const 376 - i32.add - local.tee $l6 - local.get $l14 - i32.const 8 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l14 - i64.load align=1 - i64.store offset=368 - local.get $l15 - i64.load - local.set $l18 - local.get $l1 - i64.load offset=528 - local.set $l22 - local.get $l1 - i32.load offset=524 - local.set $l10 - local.get $l1 - i32.load16_u offset=522 - local.set $l7 - local.get $l1 - i32.load8_u offset=521 - local.get $l1 - i32.const 312 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $l9 - i32.const 2 - i32.eq - br_if $B25 - local.get $l1 - i32.const 392 - i32.add - local.get $l6 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=368 - i64.store offset=384 - local.set $l8 - local.get $l7 - local.set $l11 - local.get $l10 - local.set $l13 - local.get $l22 - local.set $l21 - local.get $l18 - local.set $l17 - br $B24 - end - local.get $l1 - i32.load offset=416 - local.tee $l8 - i32.eqz - br_if $B4 - local.get $l1 - i64.load offset=420 align=4 - local.set $l20 - local.get $l1 - i32.const 360 - i32.add - local.get $l1 - i32.const 344 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 304 - i32.add - local.get $l1 - i32.const 335 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=336 - i64.store offset=352 - local.get $l1 - local.get $l1 - i64.load offset=327 align=1 - i64.store offset=296 - i32.const 4 - local.set $l5 - br $B5 - end - i32.const 2 - local.set $l9 - end - local.get $l1 - i32.const 360 - i32.add - local.tee $l4 - local.get $l1 - i32.const 392 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=384 - i64.store offset=352 - local.get $l9 - i32.const 2 - i32.ne - if $I27 - local.get $l1 - i32.const 496 - i32.add - local.tee $l10 - local.get $l4 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=352 - i64.store offset=488 - block $B28 - local.get $l1 - i32.load offset=420 - local.get $l3 - i32.ne - if $I29 - local.get $l1 - i32.load offset=416 - local.set $l7 - br $B28 - end - local.get $l3 - i32.const 1 - i32.add - local.tee $l7 - local.get $l3 - i32.lt_u - br_if $B1 - local.get $l3 - i32.const 1 - i32.shl - local.tee $l2 - local.get $l7 - local.get $l2 - local.get $l7 - i32.gt_u - select - local.tee $l2 - i32.const 4 - local.get $l2 - i32.const 4 - i32.gt_u - select - i64.extend_i32_u - i64.const 33 - i64.mul - local.tee $l19 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if $B1 - local.get $l19 - i32.wrap_i64 - local.tee $l7 - i32.const 0 - i32.lt_s - br_if $B1 - local.get $l3 - i32.const 33 - i32.mul - local.get $l12 - local.get $l3 - select - local.set $l12 - block $B30 (result i32) - local.get $l1 - i32.load offset=416 - i32.const 0 - local.get $l3 - select - local.tee $l2 - i32.eqz - if $I31 - local.get $l1 - i32.const 160 - i32.add - local.get $l7 - call $f83 - local.get $l1 - i32.load offset=160 - local.set $l4 - local.get $l1 - i32.load offset=164 - br $B30 - end - local.get $l12 - i32.eqz - if $I32 - local.get $l1 - i32.const 168 - i32.add - local.get $l7 - call $f83 - local.get $l1 - i32.load offset=168 - local.set $l4 - local.get $l1 - i32.load offset=172 - br $B30 - end - local.get $l2 - local.get $l12 - local.get $l7 - call $f87 - local.set $l4 - local.get $l7 - end - local.set $l2 - local.get $l4 - i32.eqz - br_if $B1 - local.get $l1 - local.get $l4 - local.get $l7 - local.get $l4 - select - local.tee $l7 - i32.store offset=416 - local.get $l1 - local.get $l2 - i32.const 1 - local.get $l4 - select - i32.const 33 - i32.div_u - i32.store offset=420 - end - local.get $l7 - local.get $l3 - i32.const 33 - i32.mul - i32.add - local.tee $l2 - local.get $l13 - i32.store offset=3 align=1 - local.get $l2 - local.get $l11 - i32.store16 offset=1 align=1 - local.get $l2 - local.get $l8 - i32.store8 - local.get $l10 - i32.load8_u - local.set $l4 - local.get $l1 - i64.load offset=488 - local.set $l18 - local.get $l2 - local.get $l9 - i32.store8 offset=32 - local.get $l2 - local.get $l18 - i64.store offset=23 align=1 - local.get $l2 - i32.const 31 - i32.add - local.get $l4 - i32.store8 - local.get $l2 - local.get $l21 - i64.store offset=7 align=1 - local.get $l2 - i32.const 15 - i32.add - local.get $l17 - i64.store align=1 - local.get $l1 - local.get $l1 - i32.load offset=424 - i32.const 1 - i32.add - local.tee $l3 - i32.store offset=424 - local.get $l5 - i32.const -1 - i32.add - local.set $l5 - br $L23 - end - end - local.get $l1 - i32.const 416 - i32.add - call $f46 - br $B4 - end - local.get $l1 - i32.const 16384 - i32.store offset=420 - local.get $l1 - i32.const 65796 - i32.store offset=416 - local.get $l1 - i32.const 416 - i32.add - call $f81 - local.get $l1 - local.get $l1 - i64.load offset=416 - i64.store offset=520 - local.get $l1 - i32.const 488 - i32.add - local.get $l1 - i32.const 520 - i32.add - call $f59 - i32.const 1 - local.set $l3 - block $B33 - local.get $l1 - i32.load8_u offset=488 - i32.const 1 - i32.eq - br_if $B33 - local.get $l1 - i32.load8_u offset=489 - i32.const 209 - i32.ne - br_if $B33 - local.get $l1 - i32.load8_u offset=490 - i32.const 131 - i32.ne - br_if $B33 - local.get $l1 - i32.load8_u offset=491 - i32.const 81 - i32.ne - br_if $B33 - local.get $l1 - i32.load8_u offset=492 - i32.const 43 - i32.ne - br_if $B33 - local.get $l1 - i32.const 200 - i32.add - local.get $l1 - i32.const 520 - i32.add - call $f29 - local.get $l1 - i32.load offset=200 - br_if $B33 - local.get $l1 - i32.const 216 - i32.add - i64.load - local.set $l18 - local.get $l1 - i64.load offset=208 - local.set $l16 - local.get $l1 - i32.const 520 - i32.add - call $f14 - i32.const 255 - i32.and - local.tee $p0 - i32.const 2 - i32.eq - br_if $B33 - i32.const 0 - local.set $l3 - local.get $p0 - i32.const 0 - i32.ne - local.set $l9 - end - i32.const 6 - local.set $p0 - local.get $l3 - br_if $B0 - local.get $l1 - i32.const 488 - i32.add - call $f76 - local.get $l1 - i32.const 444 - i32.add - local.get $l1 - i32.const 512 - i32.add - i64.load - i64.store align=4 - local.get $l1 - i32.const 436 - i32.add - local.get $l1 - i32.const 504 - i32.add - i64.load - i64.store align=4 - i32.const 8 - local.set $p0 - local.get $l1 - i32.const 428 - i32.add - local.get $l1 - i32.const 496 - i32.add - i64.load - i64.store align=4 - local.get $l1 - i32.const 656 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 648 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 608 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 600 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 592 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 584 - i32.add - i32.const 0 - i32.store - local.get $l1 - i32.const 576 - i32.add - i32.const 0 - i32.store - local.get $l1 - local.get $l1 - i64.load offset=488 - i64.store offset=420 align=4 - local.get $l1 - local.get $l18 - i64.store offset=528 - local.get $l1 - local.get $l16 - i64.store offset=520 - local.get $l1 - i64.const 0 - i64.store offset=536 - local.get $l1 - i32.const 660 - i32.add - local.get $l1 - i32.const 416 - i32.add - i32.const 36 - call $f99 - local.get $l1 - local.get $l9 - i32.const 255 - i32.and - i32.const 0 - i32.ne - i32.store8 offset=696 - local.get $l1 - i32.const 440 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 432 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 424 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f32 - br $B0 - end - local.get $l1 - i32.const 280 - i32.add - local.get $l1 - i32.const 360 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 264 - i32.add - local.get $l1 - i32.const 304 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=352 - i64.store offset=272 - local.get $l1 - local.get $l1 - i64.load offset=296 - i64.store offset=256 - local.get $l20 - i64.const 32 - i64.shr_u - i32.wrap_i64 - local.set $l9 - local.get $l20 - i32.wrap_i64 - local.set $l11 - i32.const 0 - local.set $p0 - br $B2 - end - i32.const 0 - local.set $l9 - end - i32.const 0 - local.set $l5 - end - local.get $l1 - block $B34 (result i32) - block $B35 - block $B36 - local.get $p0 - i32.eqz - if $I37 - local.get $l1 - i32.const 248 - i32.add - local.tee $l2 - local.get $l1 - i32.const 280 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - i32.const 232 - i32.add - local.tee $p0 - local.get $l1 - i32.const 264 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=272 - i64.store offset=240 - local.get $l1 - local.get $l1 - i64.load offset=256 - i64.store offset=224 - block $B38 - block $B39 - block $B40 - block $B41 - block $B42 - block $B43 - block $B44 - block $B45 - block $B46 - block $B47 - block $B48 - local.get $l5 - i32.const 1 - i32.sub - br_table $B46 $B45 $B39 $B44 $B43 $B42 $B41 $B40 $B48 $B47 - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 431 - i32.add - local.get $l16 - i64.store align=1 - local.get $l1 - i32.const 447 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l11 - i64.extend_i32_u - local.get $l9 - i64.extend_i32_u - i64.const 32 - i64.shl - i64.or - i64.store offset=423 align=1 - local.get $l1 - local.get $l8 - i32.store offset=419 align=1 - local.get $l1 - local.get $l4 - i32.store16 offset=417 align=1 - local.get $l1 - local.get $l3 - i32.store8 offset=416 - local.get $l1 - local.get $l1 - i64.load offset=240 - i64.store offset=439 align=1 - local.get $l1 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f84 - i32.store8 offset=384 - local.get $l1 - i32.const 384 - i32.add - call $f64 - unreachable - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 392 - i32.add - local.get $p0 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=224 - i64.store offset=384 - local.get $l3 - i32.const 255 - i32.and - br_if $B36 - local.get $l1 - i32.load8_u offset=696 - br_if $B35 - br $B36 - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 416 - i32.add - call $f76 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f85 - local.get $l1 - i64.load offset=520 - local.tee $l19 - local.get $l11 - i64.extend_i32_u - local.get $l9 - i64.extend_i32_u - i64.const 32 - i64.shl - i64.or - local.tee $l21 - i64.xor - local.get $l1 - i32.const 528 - i32.add - i64.load - local.tee $l17 - local.get $l16 - i64.xor - i64.or - i64.const 0 - i64.eq - br_if $B1 - local.get $l1 - i32.const 448 - i32.add - local.get $l16 - i64.store - local.get $l1 - i32.const 440 - i32.add - local.get $l21 - i64.store - local.get $l1 - i32.const 432 - i32.add - local.get $l17 - i64.store - local.get $l1 - i32.const 424 - i32.add - local.get $l19 - i64.store - local.get $l1 - i32.const 0 - i32.store8 offset=416 - local.get $l1 - i32.const 416 - i32.add - call $f61 - local.get $l1 - local.get $l16 - i64.store offset=528 - local.get $l1 - local.get $l21 - i64.store offset=520 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f32 - br $B38 - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 416 - i32.add - call $f76 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f85 - local.get $l1 - i32.load8_u offset=696 - i32.eqz - local.get $l3 - i32.const 255 - i32.and - i32.const 0 - i32.ne - i32.ne - br_if $B1 - local.get $l1 - local.get $l3 - i32.store8 offset=696 - local.get $l1 - i32.const 1 - i32.store8 offset=416 - local.get $l1 - local.get $l3 - i32.store8 offset=417 - local.get $l1 - i32.const 416 - i32.add - call $f61 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f32 - br $B38 - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l9 - i32.const 33 - i32.mul - local.set $l3 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 439 - i32.add - local.set $l15 - local.get $l8 - local.set $p0 - loop $L49 - block $B50 - local.get $l3 - i32.eqz - br_if $B50 - local.get $p0 - i32.load offset=3 align=1 - local.set $l6 - local.get $p0 - i32.load16_u offset=1 align=1 - local.set $l10 - local.get $p0 - i32.load8_u - local.set $l7 - local.get $l1 - i32.const 376 - i32.add - local.tee $l2 - local.get $p0 - i32.const 31 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $p0 - i64.load offset=23 align=1 - i64.store offset=368 - local.get $p0 - i32.load8_u offset=32 - local.tee $l13 - i32.const 2 - i32.eq - br_if $B50 - local.get $p0 - i32.const 15 - i32.add - i64.load align=1 - local.set $l19 - local.get $p0 - i64.load offset=7 align=1 - local.set $l16 - local.get $l1 - i32.const 392 - i32.add - local.get $l2 - i32.load8_u - local.tee $l2 - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=368 - local.tee $l17 - i64.store offset=384 - local.get $l1 - i32.const 431 - i32.add - local.get $l19 - i64.store align=1 - local.get $l15 - local.get $l17 - i64.store align=1 - local.get $l15 - i32.const 8 - i32.add - local.get $l2 - i32.store8 - local.get $l1 - local.get $l16 - i64.store offset=423 align=1 - local.get $l1 - local.get $l6 - i32.store offset=419 align=1 - local.get $l1 - local.get $l10 - i32.store16 offset=417 align=1 - local.get $l1 - local.get $l7 - i32.store8 offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - local.get $l13 - i32.const 1 - i32.and - call $f86 - local.get $l3 - i32.const -33 - i32.add - local.set $l3 - local.get $p0 - i32.const 33 - i32.add - local.set $p0 - br $L49 - end - end - local.get $l1 - local.get $l11 - i32.store offset=420 - local.get $l1 - local.get $l8 - i32.store offset=416 - local.get $l1 - i32.const 416 - i32.add - call $f46 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f32 - br $B38 - end - local.get $l1 - i32.const 360 - i32.add - local.tee $p0 - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=240 - i64.store offset=352 - local.get $l1 - i32.const 408 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 400 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 392 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=384 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 384 - i32.add - call $f27 - local.get $l1 - i32.const 416 - i32.add - call $f76 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f85 - local.get $l1 - i32.const 488 - i32.add - call $f76 - local.get $l1 - i32.const 432 - i32.add - local.get $l16 - i64.store - local.get $l1 - i32.const 424 - i32.add - local.get $l11 - i64.extend_i32_u - local.get $l9 - i64.extend_i32_u - i64.const 32 - i64.shl - i64.or - local.tee $l17 - i64.store - local.get $l1 - i32.const 440 - i32.add - local.get $l1 - i64.load offset=240 - i64.store - local.get $l1 - i32.const 448 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - i32.const 449 - i32.add - local.get $l1 - i64.load offset=488 align=1 - i64.store align=1 - local.get $l1 - i32.const 457 - i32.add - local.get $l1 - i32.const 496 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l1 - i32.const 465 - i32.add - local.get $l1 - i32.const 504 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l1 - i32.const 473 - i32.add - local.get $l1 - i32.const 512 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l1 - local.get $l8 - i32.store offset=420 - local.get $l1 - local.get $l4 - i32.store16 offset=418 - local.get $l1 - local.get $l3 - i32.store8 offset=417 - local.get $l1 - i32.const 3 - i32.store8 offset=416 - local.get $l1 - i32.const 416 - i32.add - call $f61 - local.get $l1 - i32.const 679 - i32.add - local.get $l16 - i64.store align=1 - local.get $l1 - i32.const 671 - i32.add - local.get $l17 - i64.store align=1 - local.get $l1 - i32.const 667 - i32.add - local.get $l8 - i32.store align=1 - local.get $l1 - i32.const 665 - i32.add - local.get $l4 - i32.store16 align=1 - local.get $l1 - i32.const 687 - i32.add - local.get $l1 - i64.load offset=352 - i64.store align=1 - local.get $l1 - i32.const 695 - i32.add - local.get $p0 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l3 - i32.store8 offset=664 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 384 - i32.add - call $f32 - br $B38 - end - local.get $l1 - i32.const 440 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 432 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 424 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f27 - local.get $l1 - i64.load offset=520 - local.set $l17 - local.get $l1 - local.get $l1 - i32.const 528 - i32.add - i64.load - i64.store offset=528 - local.get $l1 - local.get $l17 - i64.store offset=520 - local.get $l1 - i32.const 520 - i32.add - call $f66 - unreachable - end - local.get $l1 - i32.const 440 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 432 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 424 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=416 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f27 - local.get $l1 - local.get $l1 - i32.load8_u offset=696 - i32.const 0 - i32.ne - i32.store8 offset=520 - local.get $l1 - i32.const 520 - i32.add - call $f64 - unreachable - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 440 - i32.add - local.get $l1 - i32.const 688 - i32.add - i64.load - i64.store - local.get $l1 - i32.const 432 - i32.add - local.get $l1 - i32.const 680 - i32.add - i64.load - i64.store - local.get $l1 - i32.const 424 - i32.add - local.get $l1 - i32.const 672 - i32.add - i64.load - i64.store - local.get $l1 - local.get $l1 - i64.load offset=664 - i64.store offset=416 - global.get $g0 - i32.const 16 - i32.sub - local.tee $p0 - global.set $g0 - local.get $p0 - local.get $l1 - i32.const 416 - i32.add - i32.store offset=12 - local.get $p0 - i32.const 12 - i32.add - i32.load - call $f70 - unreachable - end - local.get $l1 - i32.const 512 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 504 - i32.add - i64.const 0 - i64.store - local.get $l1 - i32.const 496 - i32.add - i64.const 0 - i64.store - local.get $l1 - i64.const 0 - i64.store offset=488 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f27 - local.get $l1 - i32.const 431 - i32.add - local.get $l16 - i64.store align=1 - local.get $l1 - i32.const 447 - i32.add - local.get $l2 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l11 - i64.extend_i32_u - local.get $l9 - i64.extend_i32_u - i64.const 32 - i64.shl - i64.or - i64.store offset=423 align=1 - local.get $l1 - local.get $l8 - i32.store offset=419 align=1 - local.get $l1 - local.get $l4 - i32.store16 offset=417 align=1 - local.get $l1 - local.get $l3 - i32.store8 offset=416 - local.get $l1 - local.get $l1 - i64.load offset=240 - i64.store offset=439 align=1 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - local.get $l10 - i32.const 255 - i32.and - i32.const 0 - i32.ne - call $f86 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 488 - i32.add - call $f32 - end - i32.const 8 - local.set $p0 - br $B0 - end - i32.const 6 - local.set $p0 - br $B0 - end - local.get $l1 - i32.const 376 - i32.add - local.tee $p0 - local.get $l1 - i32.const 392 - i32.add - i32.load8_u - i32.store8 - local.get $l1 - local.get $l1 - i64.load offset=384 - i64.store offset=368 - local.get $l7 - i32.const 255 - i32.and - i32.const 1 - i32.eq - if $I51 - local.get $l1 - i32.const 431 - i32.add - local.get $l18 - i64.store align=1 - local.get $l1 - i32.const 447 - i32.add - local.get $p0 - i32.load8_u - i32.store8 - local.get $l1 - local.get $l21 - i64.store offset=423 align=1 - local.get $l1 - local.get $l12 - i32.store offset=419 align=1 - local.get $l1 - local.get $l13 - i32.store16 offset=417 align=1 - local.get $l1 - local.get $l14 - i32.store8 offset=416 - local.get $l1 - local.get $l1 - i64.load offset=368 - i64.store offset=439 align=1 - local.get $l1 - i32.const 520 - i32.add - local.get $l1 - i32.const 416 - i32.add - call $f84 - br_if $B35 - end - local.get $l23 - local.get $l24 - i64.or - i64.eqz - br_if $B1 - local.get $l1 - i32.const 24 - i32.add - local.get $l22 - local.get $l26 - i64.add - local.tee $l16 - local.get $l16 - local.get $l22 - i64.lt_u - i64.extend_i32_u - local.get $l17 - local.get $l25 - i64.add - i64.add - call $f96 - local.get $l1 - i32.const 8 - i32.add - local.get $l1 - i64.load offset=24 - local.get $l1 - i32.const 32 - i32.add - i64.load - local.get $l24 - local.get $l23 - call $f95 - i32.const 1 - local.get $l1 - i64.load offset=8 - local.get $l1 - i64.load offset=520 - i64.gt_u - local.get $l1 - i32.const 16 - i32.add - i64.load - local.tee $l16 - local.get $l1 - i32.const 528 - i32.add - i64.load - local.tee $l17 - i64.gt_u - local.get $l16 - local.get $l17 - i64.eq - select - br_if $B34 - drop - end - i32.const 0 - end - i32.store8 offset=416 - local.get $l1 - i32.const 416 - i32.add - call $f65 - unreachable - end - unreachable - end - local.get $l1 - i32.const 704 - i32.add - global.set $g0 - local.get $p0) - (func $call (type $t13) (result i32) - (local $l0 i32) (local $l1 i32) - global.get $g0 - i32.const 48 - i32.sub - local.tee $l0 - global.set $g0 - local.get $l0 - i32.const 16384 - i32.store offset=36 - local.get $l0 - i32.const 65796 - i32.store offset=32 - local.get $l0 - i32.const 16384 - i32.store offset=40 - i32.const 65796 - local.get $l0 - i32.const 40 - i32.add - call $seal0.seal_value_transferred - local.get $l0 - i32.const 32 - i32.add - local.get $l0 - i32.load offset=40 - call $f77 - local.get $l0 - local.get $l0 - i64.load offset=32 - i64.store offset=40 - local.get $l0 - i32.const 8 - i32.add - local.get $l0 - i32.const 40 - i32.add - call $f29 - block $B0 - local.get $l0 - i64.load offset=8 - i32.wrap_i64 - br_if $B0 - local.get $l0 - i64.load offset=16 - local.get $l0 - i32.const 24 - i32.add - i64.load - i64.or - i64.eqz - i32.eqz - br_if $B0 - i32.const 1 - call $f79 - local.get $l0 - i32.const 48 - i32.add - global.set $g0 - i32.const 255 - i32.and - i32.const 2 - i32.shl - i32.const 65756 - i32.add - i32.load - return - end - unreachable) - (func $f81 (type $t3) (param $p0 i32) - (local $l1 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l1 - global.set $g0 - local.get $l1 - local.get $p0 - i32.load offset=4 - i32.store offset=12 - local.get $p0 - i32.load - local.get $l1 - i32.const 12 - i32.add - call $seal0.seal_input - local.get $p0 - local.get $l1 - i32.load offset=12 - call $f77 - local.get $l1 - i32.const 16 - i32.add - global.set $g0) - (func $f82 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - (local $l3 i32) - local.get $p0 - i32.load16_u offset=4 - local.set $l3 - local.get $p0 - i32.const 0 - i32.store16 offset=4 - local.get $l3 - i32.const 1 - i32.and - i32.eqz - if $I0 - local.get $p0 - i32.load - local.get $p1 - local.get $p2 - call $f49 - return - end - local.get $p1 - local.get $l3 - i32.const 8 - i32.shr_u - i32.store8 - local.get $p0 - i32.load - local.get $p1 - i32.const 1 - i32.add - local.get $p2 - i32.const -1 - i32.add - call $f49) - (func $f83 (type $t2) (param $p0 i32) (param $p1 i32) - (local $l2 i32) - local.get $p1 - if $I0 (result i32) - local.get $p1 - i32.const 1 - call $f58 - else - i32.const 1 - end - local.set $l2 - local.get $p0 - local.get $p1 - i32.store offset=4 - local.get $p0 - local.get $l2 - i32.store) - (func $f84 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - i32.const 65752 - i32.const 0 - local.get $p0 - i32.const 88 - i32.add - local.get $p1 - call $f10 - local.tee $p0 - local.get $p0 - i32.load8_u offset=4 - i32.const 2 - i32.eq - local.tee $p0 - select - i32.const 4 - i32.add - local.get $p0 - select - i32.load8_u) - (func $f85 (type $t2) (param $p0 i32) (param $p1 i32) - block $B0 (result i32) - i32.const 1 - local.get $p0 - i32.const 144 - i32.add - local.tee $p0 - local.get $p1 - i32.eq - br_if $B0 - drop - local.get $p1 - local.get $p0 - call $f101 - i32.eqz - end - if $I1 - return - end - unreachable) - (func $f86 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) (local $l9 i32) - global.get $g0 - i32.const 256 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - i32.const 32 - i32.add - call $f76 - local.get $p0 - local.get $l3 - i32.const 32 - i32.add - call $f85 - block $B0 - block $B1 - block $B2 - block $B3 - local.get $p0 - local.get $p1 - call $f84 - local.get $p2 - i32.eq - br_if $B3 - local.get $l3 - i32.const 24 - i32.add - local.tee $l7 - local.get $p1 - i32.const 24 - i32.add - i64.load align=1 - i64.store - local.get $l3 - i32.const 16 - i32.add - local.tee $l6 - local.get $p1 - i32.const 16 - i32.add - i64.load align=1 - i64.store - local.get $l3 - i32.const 8 - i32.add - local.tee $l5 - local.get $p1 - i32.const 8 - i32.add - i64.load align=1 - i64.store - local.get $l3 - local.get $p1 - i64.load align=1 - i64.store - local.get $p0 - i32.const 88 - i32.add - local.get $l3 - call $f10 - local.tee $l4 - i32.load8_u offset=4 - i32.const 2 - i32.ne - if $I4 - local.get $l4 - local.get $p2 - i32.store8 offset=4 - local.get $l4 - i32.const 0 - i32.store8 offset=8 - br $B0 - end - local.get $l3 - i32.const 120 - i32.add - local.get $l5 - i64.load - i64.store - local.get $l3 - i32.const 128 - i32.add - local.get $l6 - i64.load - i64.store - local.get $l3 - i32.const 136 - i32.add - local.get $l7 - i64.load - i64.store - local.get $l3 - local.get $l3 - i64.load - i64.store offset=112 - local.get $p0 - i32.const 76 - i32.add - i32.load - local.tee $l7 - local.get $p0 - i32.const 80 - i32.add - i32.load - i32.eq - if $I5 - local.get $l3 - i32.const 160 - i32.add - local.tee $l6 - local.get $l3 - i32.const 120 - i32.add - i64.load - i64.store - local.get $l3 - i32.const 168 - i32.add - local.tee $l5 - local.get $l3 - i32.const 128 - i32.add - i64.load - i64.store - local.get $l3 - i32.const 176 - i32.add - local.tee $l8 - local.get $l3 - i32.const 136 - i32.add - i64.load - i64.store - local.get $l3 - i32.const 150 - i32.add - local.tee $l9 - local.get $l3 - i32.const 111 - i32.add - i32.load8_u - i32.store8 - local.get $l3 - local.get $l3 - i64.load offset=112 - i64.store offset=152 - local.get $l3 - local.get $l3 - i32.load16_u offset=109 align=1 - i32.store16 offset=148 - local.get $l3 - i32.const 184 - i32.add - local.get $p0 - i32.const 56 - i32.add - local.get $l7 - call $f21 - block $B6 - local.get $l3 - i32.load offset=184 - i32.const 1 - i32.ne - if $I7 - local.get $l3 - i32.const 48 - i32.add - local.get $l3 - i32.const 204 - i32.add - i32.load - i32.store - local.get $l3 - i32.const 40 - i32.add - local.get $l3 - i32.const 196 - i32.add - i64.load align=4 - i64.store - local.get $l3 - local.get $l3 - i64.load offset=188 align=4 - i64.store offset=32 - i32.const 40 - call $f16 - local.tee $l4 - i32.const 1 - i32.store8 - local.get $l4 - i32.const 0 - i32.store8 offset=36 - local.get $l4 - local.get $l3 - i64.load offset=152 - i64.store offset=1 align=1 - local.get $l4 - i32.const 9 - i32.add - local.get $l6 - i64.load - i64.store align=1 - local.get $l4 - i32.const 17 - i32.add - local.get $l5 - i64.load - i64.store align=1 - local.get $l4 - i32.const 25 - i32.add - local.get $l8 - i64.load - i64.store align=1 - local.get $l4 - local.get $l3 - i32.load16_u offset=148 - i32.store16 offset=33 align=1 - local.get $l4 - i32.const 35 - i32.add - local.get $l9 - i32.load8_u - i32.store8 - local.get $l3 - i32.const 32 - i32.add - local.get $l4 - call $f25 - drop - br $B6 - end - local.get $l3 - i32.const 192 - i32.add - i32.load - local.get $l3 - i32.const 196 - i32.add - i32.load - i32.const 2 - i32.shl - i32.add - i32.const 48 - i32.add - i32.load - local.set $l4 - local.get $l3 - i32.const 41 - i32.add - local.get $l6 - i64.load - i64.store align=1 - local.get $l3 - i32.const 49 - i32.add - local.get $l5 - i64.load - i64.store align=1 - local.get $l3 - i32.const 57 - i32.add - local.get $l8 - i64.load - i64.store align=1 - local.get $l3 - i32.const 65 - i32.add - local.get $l3 - i32.load16_u offset=148 - i32.store16 align=1 - local.get $l3 - i32.const 67 - i32.add - local.get $l9 - i32.load8_u - i32.store8 - local.get $l3 - i32.const 1 - i32.store8 offset=32 - local.get $l3 - local.get $l3 - i64.load offset=152 - i64.store offset=33 align=1 - local.get $l3 - i32.const 208 - i32.add - local.get $l4 - local.get $l3 - i32.const 32 - i32.add - call $f9 - end - local.get $p0 - local.get $p0 - i32.load offset=72 - i32.const 1 - i32.add - i32.store offset=72 - local.get $p0 - local.get $p0 - i32.load offset=80 - i32.const 1 - i32.add - i32.store offset=80 - br $B1 - end - local.get $p0 - i32.const 16 - i32.add - local.tee $l8 - local.get $p0 - i32.const 72 - i32.add - i32.load - local.tee $l7 - call $f20 - local.set $l4 - local.get $l3 - i32.const 41 - i32.add - local.get $l3 - i32.const 120 - i32.add - i64.load - i64.store align=1 - local.get $l3 - i32.const 49 - i32.add - local.get $l3 - i32.const 128 - i32.add - i64.load - i64.store align=1 - local.get $l3 - i32.const 57 - i32.add - local.get $l3 - i32.const 136 - i32.add - i64.load - i64.store align=1 - local.get $l3 - i32.const 65 - i32.add - local.get $l3 - i32.load16_u offset=109 align=1 - i32.store16 align=1 - local.get $l3 - i32.const 67 - i32.add - local.get $l3 - i32.const 111 - i32.add - i32.load8_u - i32.store8 - local.get $l3 - i32.const 1 - i32.store8 offset=32 - local.get $l3 - local.get $l3 - i64.load offset=112 - i64.store offset=33 align=1 - local.get $l3 - i32.const 208 - i32.add - local.get $l4 - local.get $l3 - i32.const 32 - i32.add - call $f9 - local.get $l3 - i32.load8_u offset=208 - local.tee $l4 - i32.const 2 - i32.ne - if $I8 - local.get $l4 - i32.const 1 - i32.eq - br_if $B3 - local.get $l3 - i32.const 216 - i32.add - i32.load - local.set $l6 - local.get $l7 - local.get $l3 - i32.load offset=212 - local.tee $l4 - i32.eq - if $I9 - local.get $l6 - local.get $l7 - i32.eq - br_if $B2 - end - block $B10 (result i32) - i32.const 0 - local.get $l8 - local.get $l6 - call $f26 - local.tee $l5 - i32.eqz - br_if $B10 - drop - i32.const 0 - local.get $l5 - i32.const 4 - i32.add - local.get $l5 - i32.load8_u - i32.const 1 - i32.eq - select - end - local.tee $l5 - i32.eqz - if $I11 - unreachable - end - block $B12 - local.get $l4 - local.get $l6 - i32.eq - if $I13 - local.get $l5 - local.get $l4 - i32.store - local.get $l5 - local.get $l4 - i32.store offset=4 - br $B12 - end - local.get $l5 - local.get $l4 - i32.store - block $B14 (result i32) - i32.const 0 - local.get $l8 - local.get $l4 - call $f26 - local.tee $l5 - i32.eqz - br_if $B14 - drop - i32.const 0 - local.get $l5 - i32.const 4 - i32.add - local.get $l5 - i32.load8_u - i32.const 1 - i32.eq - select - end - local.tee $l5 - i32.eqz - if $I15 - unreachable - end - local.get $l5 - local.get $l6 - i32.store offset=4 - end - local.get $p0 - i32.load offset=72 - local.get $l7 - i32.ne - br_if $B1 - local.get $p0 - local.get $l4 - local.get $l6 - local.get $l6 - local.get $l4 - i32.gt_u - select - i32.store offset=72 - br $B1 - end - unreachable - end - unreachable - end - local.get $p0 - local.get $p0 - i32.load offset=76 - i32.store offset=72 - end - local.get $p0 - local.get $p0 - i32.load offset=76 - i32.const 1 - i32.add - i32.store offset=76 - local.get $l3 - i32.const 176 - i32.add - local.tee $l6 - local.get $l3 - i32.const 24 - i32.add - i64.load - i64.store - local.get $l3 - i32.const 168 - i32.add - local.tee $l5 - local.get $l3 - i32.const 16 - i32.add - i64.load - i64.store - local.get $l3 - i32.const 160 - i32.add - local.tee $l8 - local.get $l3 - i32.const 8 - i32.add - i64.load - i64.store - local.get $l3 - local.get $l3 - i64.load - i64.store offset=152 - i32.const 12 - call $f16 - local.tee $l4 - i32.const 0 - i32.store8 offset=8 - local.get $l4 - local.get $p2 - i32.store8 offset=4 - local.get $l4 - local.get $l7 - i32.store - local.get $l3 - i32.const 232 - i32.add - local.get $l6 - i64.load - i64.store - local.get $l3 - i32.const 224 - i32.add - local.get $l5 - i64.load - i64.store - local.get $l3 - i32.const 216 - i32.add - local.get $l8 - i64.load - i64.store - local.get $l3 - local.get $l3 - i64.load offset=152 - i64.store offset=208 - local.get $l3 - i32.const 32 - i32.add - local.get $p0 - i32.const 128 - i32.add - local.get $l3 - i32.const 208 - i32.add - call $f11 - local.get $l3 - i32.load offset=32 - i32.const 1 - i32.ne - if $I16 - local.get $l3 - i32.const 208 - i32.add - local.get $l3 - i32.const 32 - i32.add - i32.const 4 - i32.or - i32.const 48 - call $f99 - local.get $l3 - i32.const 208 - i32.add - local.get $l4 - call $f17 - drop - br $B0 - end - local.get $l3 - i32.const 40 - i32.add - i32.load - local.get $l3 - i32.const 44 - i32.add - i32.load - i32.const 2 - i32.shl - i32.add - i32.const 4 - i32.add - local.tee $l7 - i32.load - local.set $p0 - local.get $l7 - local.get $l4 - i32.store - local.get $p0 - i32.eqz - br_if $B0 - local.get $p0 - call $f89 - end - local.get $l3 - i32.const 65 - i32.add - local.get $p2 - i32.store8 - local.get $l3 - i32.const 57 - i32.add - local.get $p1 - i32.const 24 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l3 - i32.const 49 - i32.add - local.get $p1 - i32.const 16 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l3 - i32.const 41 - i32.add - local.get $p1 - i32.const 8 - i32.add - i64.load align=1 - i64.store align=1 - local.get $l3 - i32.const 2 - i32.store8 offset=32 - local.get $l3 - local.get $p1 - i64.load align=1 - i64.store offset=33 align=1 - local.get $l3 - i32.const 32 - i32.add - call $f61 - local.get $l3 - i32.const 256 - i32.add - global.set $g0) - (func $f87 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - (local $l3 i32) - local.get $p2 - i32.const 1 - call $f88 - local.tee $l3 - if $I0 - local.get $l3 - local.get $p0 - local.get $p2 - local.get $p1 - local.get $p1 - local.get $p2 - i32.gt_u - select - call $f99 - local.get $p0 - call $f89 - end - local.get $l3) - (func $f88 (type $t5) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l2 - global.set $g0 - local.get $l2 - i32.const 65792 - i32.load - i32.store offset=12 - block $B0 - local.get $p0 - i32.const 3 - i32.add - i32.const 2 - i32.shr_u - local.tee $l3 - local.get $p1 - local.get $l2 - i32.const 12 - i32.add - call $f92 - local.tee $p0 - br_if $B0 - local.get $l2 - local.get $l3 - local.get $p1 - call $f91 - i32.const 0 - local.set $p0 - local.get $l2 - i32.load - br_if $B0 - local.get $l2 - i32.load offset=4 - local.tee $p0 - local.get $l2 - i32.load offset=12 - i32.store offset=8 - local.get $l2 - local.get $p0 - i32.store offset=12 - local.get $l3 - local.get $p1 - local.get $l2 - i32.const 12 - i32.add - call $f92 - local.set $p0 - end - i32.const 65792 - local.get $l2 - i32.load offset=12 - i32.store - local.get $l2 - i32.const 16 - i32.add - global.set $g0 - local.get $p0) - (func $f89 (type $t3) (param $p0 i32) - (local $l1 i32) (local $l2 i32) (local $l3 i32) (local $l4 i32) - local.get $p0 - if $I0 - i32.const 65792 - i32.load - local.set $l3 - local.get $p0 - i32.const 0 - i32.store - local.get $p0 - i32.const -8 - i32.add - local.tee $l2 - local.get $l2 - i32.load - local.tee $l4 - i32.const -2 - i32.and - i32.store - block $B1 - block $B2 - block $B3 - block $B4 - local.get $p0 - i32.const -4 - i32.add - i32.load - i32.const -4 - i32.and - local.tee $l1 - if $I5 - local.get $l1 - i32.load8_u - i32.const 1 - i32.and - i32.eqz - br_if $B4 - end - local.get $l4 - i32.const -4 - i32.and - local.tee $l1 - i32.eqz - br_if $B3 - i32.const 0 - local.get $l1 - local.get $l4 - i32.const 2 - i32.and - select - local.tee $l1 - i32.eqz - br_if $B3 - local.get $l1 - i32.load8_u - i32.const 1 - i32.and - br_if $B3 - local.get $p0 - local.get $l1 - i32.load offset=8 - i32.const -4 - i32.and - i32.store - local.get $l1 - local.get $l2 - i32.const 1 - i32.or - i32.store offset=8 - br $B2 - end - local.get $l2 - call $f93 - local.get $l2 - i32.load8_u - i32.const 2 - i32.and - i32.eqz - br_if $B2 - local.get $l1 - local.get $l1 - i32.load - i32.const 2 - i32.or - i32.store - br $B2 - end - local.get $p0 - local.get $l3 - i32.store - br $B1 - end - local.get $l3 - local.set $l2 - end - i32.const 65792 - local.get $l2 - i32.store - end) - (func $f90 (type $t14) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) (param $p4 i32) - block $B0 - local.get $p2 - local.get $p1 - i32.ge_u - if $I1 - local.get $p4 - local.get $p2 - i32.ge_u - br_if $B0 - unreachable - end - unreachable - end - local.get $p0 - local.get $p2 - local.get $p1 - i32.sub - i32.store offset=4 - local.get $p0 - local.get $p1 - local.get $p3 - i32.add - i32.store) - (func $f91 (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) - block $B0 (result i32) - i32.const 1 - local.get $p1 - i32.const 2 - i32.shl - local.tee $p1 - local.get $p2 - i32.const 3 - i32.shl - i32.const 512 - i32.add - local.tee $p2 - local.get $p1 - local.get $p2 - i32.gt_u - select - i32.const 65543 - i32.add - local.tee $p1 - i32.const 16 - i32.shr_u - memory.grow - local.tee $p2 - i32.const -1 - i32.eq - br_if $B0 - drop - local.get $p2 - i32.const 16 - i32.shl - local.tee $p2 - i64.const 0 - i64.store - local.get $p2 - i32.const 0 - i32.store offset=8 - local.get $p2 - local.get $p2 - local.get $p1 - i32.const -65536 - i32.and - i32.add - i32.const 2 - i32.or - i32.store - i32.const 0 - end - local.set $p1 - local.get $p0 - local.get $p2 - i32.store offset=4 - local.get $p0 - local.get $p1 - i32.store) - (func $f92 (type $t4) (param $p0 i32) (param $p1 i32) (param $p2 i32) (result i32) - (local $l3 i32) (local $l4 i32) (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i32) - local.get $p1 - i32.const -1 - i32.add - local.set $l7 - i32.const 0 - local.get $p1 - i32.sub - local.set $l8 - local.get $p0 - i32.const 2 - i32.shl - local.set $l5 - local.get $p2 - i32.load - local.set $p0 - loop $L0 - block $B1 - local.get $p0 - i32.eqz - br_if $B1 - local.get $p0 - local.set $p1 - loop $L2 - block $B3 - local.get $p1 - i32.load offset=8 - local.tee $p0 - i32.const 1 - i32.and - i32.eqz - if $I4 - local.get $p1 - i32.load - i32.const -4 - i32.and - local.tee $l4 - local.get $p1 - i32.const 8 - i32.add - local.tee $l6 - i32.sub - local.get $l5 - i32.lt_u - br_if $B3 - block $B5 - local.get $l6 - i32.const 72 - i32.add - local.get $l4 - local.get $l5 - i32.sub - local.get $l8 - i32.and - local.tee $l4 - i32.gt_u - if $I6 - local.get $l6 - local.get $l7 - i32.and - br_if $B3 - local.get $p2 - local.get $p0 - i32.const -4 - i32.and - i32.store - local.get $p1 - local.get $p1 - i32.load - i32.const 1 - i32.or - i32.store - local.get $p1 - local.set $p0 - br $B5 - end - local.get $l4 - i32.const 0 - i32.store - local.get $l4 - i32.const -8 - i32.add - local.tee $p0 - i64.const 0 - i64.store align=4 - local.get $p0 - local.get $p1 - i32.load - i32.const -4 - i32.and - i32.store - block $B7 - local.get $p1 - i32.load - local.tee $p2 - i32.const -4 - i32.and - local.tee $l3 - i32.eqz - br_if $B7 - i32.const 0 - local.get $l3 - local.get $p2 - i32.const 2 - i32.and - select - local.tee $p2 - i32.eqz - br_if $B7 - local.get $p2 - local.get $p2 - i32.load offset=4 - i32.const 3 - i32.and - local.get $p0 - i32.or - i32.store offset=4 - end - local.get $p0 - local.get $p0 - i32.load offset=4 - i32.const 3 - i32.and - local.get $p1 - i32.or - i32.store offset=4 - local.get $p1 - local.get $p1 - i32.load offset=8 - i32.const -2 - i32.and - i32.store offset=8 - local.get $p1 - local.get $p1 - i32.load - local.tee $p2 - i32.const 3 - i32.and - local.get $p0 - i32.or - local.tee $l3 - i32.store - local.get $p2 - i32.const 2 - i32.and - if $I8 - local.get $p1 - local.get $l3 - i32.const -3 - i32.and - i32.store - local.get $p0 - local.get $p0 - i32.load - i32.const 2 - i32.or - i32.store - end - local.get $p0 - local.get $p0 - i32.load - i32.const 1 - i32.or - i32.store - end - local.get $p0 - i32.const 8 - i32.add - local.set $l3 - br $B1 - end - local.get $p1 - local.get $p0 - i32.const -2 - i32.and - i32.store offset=8 - block $B9 (result i32) - i32.const 0 - local.get $p1 - i32.load offset=4 - i32.const -4 - i32.and - local.tee $p0 - i32.eqz - br_if $B9 - drop - i32.const 0 - local.get $p0 - local.get $p0 - i32.load8_u - i32.const 1 - i32.and - select - end - local.set $p0 - local.get $p1 - call $f93 - local.get $p1 - i32.load8_u - i32.const 2 - i32.and - if $I10 - local.get $p0 - local.get $p0 - i32.load - i32.const 2 - i32.or - i32.store - end - local.get $p2 - local.get $p0 - i32.store - local.get $p0 - local.set $p1 - br $L2 - end - end - local.get $p2 - local.get $p0 - i32.store - br $L0 - end - end - local.get $l3) - (func $f93 (type $t3) (param $p0 i32) - (local $l1 i32) (local $l2 i32) - block $B0 - local.get $p0 - i32.load - local.tee $l1 - i32.const -4 - i32.and - local.tee $l2 - i32.eqz - br_if $B0 - i32.const 0 - local.get $l2 - local.get $l1 - i32.const 2 - i32.and - select - local.tee $l1 - i32.eqz - br_if $B0 - local.get $l1 - local.get $l1 - i32.load offset=4 - i32.const 3 - i32.and - local.get $p0 - i32.load offset=4 - i32.const -4 - i32.and - i32.or - i32.store offset=4 - end - local.get $p0 - local.get $p0 - i32.load offset=4 - local.tee $l1 - i32.const -4 - i32.and - local.tee $l2 - if $I1 (result i32) - local.get $l2 - local.get $l2 - i32.load - i32.const 3 - i32.and - local.get $p0 - i32.load - i32.const -4 - i32.and - i32.or - i32.store - local.get $p0 - i32.load offset=4 - else - local.get $l1 - end - i32.const 3 - i32.and - i32.store offset=4 - local.get $p0 - local.get $p0 - i32.load - i32.const 3 - i32.and - i32.store) - (func $f94 (type $t17) (param $p0 i32) (param $p1 i64) (param $p2 i64) - (local $l3 i64) - local.get $p0 - local.get $p1 - i64.const 32 - i64.shr_u - local.tee $l3 - i64.const 0 - i64.mul - local.get $p2 - i64.const 1000000 - i64.mul - i64.add - i64.const 0 - i64.add - local.get $l3 - i64.const 1000000 - i64.mul - local.get $p1 - i64.const 4294967295 - i64.and - i64.const 1000000 - i64.mul - local.tee $p1 - i64.const 32 - i64.shr_u - i64.add - local.tee $p2 - i64.const 32 - i64.shr_u - i64.add - local.get $p2 - i64.const 4294967295 - i64.and - i64.const 0 - i64.add - local.tee $p2 - i64.const 32 - i64.shr_u - i64.add - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.const 4294967295 - i64.and - local.get $p2 - i64.const 32 - i64.shl - i64.or - i64.store) - (func $f95 (type $t15) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i64) (param $p4 i64) - (local $l5 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l5 - global.set $g0 - local.get $l5 - local.get $p1 - local.get $p2 - local.get $p3 - local.get $p4 - call $f104 - local.get $l5 - i64.load - local.set $p1 - local.get $p0 - local.get $l5 - i32.const 8 - i32.add - i64.load - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.store - local.get $l5 - i32.const 16 - i32.add - global.set $g0) - (func $f96 (type $t17) (param $p0 i32) (param $p1 i64) (param $p2 i64) - (local $l3 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l3 - global.set $g0 - local.get $l3 - local.get $p1 - local.get $p2 - call $f94 - local.get $l3 - i64.load - local.set $p1 - local.get $p0 - local.get $l3 - i32.const 8 - i32.add - i64.load - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.store - local.get $l3 - i32.const 16 - i32.add - global.set $g0) - (func $f97 (type $t16) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i32) - (local $l4 i64) - block $B0 - local.get $p3 - i32.const 64 - i32.and - i32.eqz - if $I1 - local.get $p3 - i32.eqz - br_if $B0 - local.get $p2 - local.get $p3 - i32.const 63 - i32.and - i64.extend_i32_u - local.tee $l4 - i64.shl - local.get $p1 - i32.const 0 - local.get $p3 - i32.sub - i32.const 63 - i32.and - i64.extend_i32_u - i64.shr_u - i64.or - local.set $p2 - local.get $p1 - local.get $l4 - i64.shl - local.set $p1 - br $B0 - end - local.get $p1 - local.get $p3 - i32.const 63 - i32.and - i64.extend_i32_u - i64.shl - local.set $p2 - i64.const 0 - local.set $p1 - end - local.get $p0 - local.get $p1 - i64.store - local.get $p0 - local.get $p2 - i64.store offset=8) - (func $f98 (type $t16) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i32) - (local $l4 i64) - block $B0 - local.get $p3 - i32.const 64 - i32.and - i32.eqz - if $I1 - local.get $p3 - i32.eqz - br_if $B0 - local.get $p2 - i32.const 0 - local.get $p3 - i32.sub - i32.const 63 - i32.and - i64.extend_i32_u - i64.shl - local.get $p1 - local.get $p3 - i32.const 63 - i32.and - i64.extend_i32_u - local.tee $l4 - i64.shr_u - i64.or - local.set $p1 - local.get $p2 - local.get $l4 - i64.shr_u - local.set $p2 - br $B0 - end - local.get $p2 - local.get $p3 - i32.const 63 - i32.and - i64.extend_i32_u - i64.shr_u - local.set $p1 - i64.const 0 - local.set $p2 - end - local.get $p0 - local.get $p1 - i64.store - local.get $p0 - local.get $p2 - i64.store offset=8) - (func $f99 (type $t18) (param $p0 i32) (param $p1 i32) (param $p2 i32) - (local $l3 i32) - loop $L0 (result i32) - local.get $p2 - local.get $l3 - i32.eq - if $I1 (result i32) - local.get $p0 - else - local.get $p0 - local.get $l3 - i32.add - local.get $p1 - local.get $l3 - i32.add - i32.load8_u - i32.store8 - local.get $l3 - i32.const 1 - i32.add - local.set $l3 - br $L0 - end - end - drop) - (func $f100 (type $t18) (param $p0 i32) (param $p1 i32) (param $p2 i32) - block $B0 - local.get $p1 - local.get $p0 - i32.ge_u - if $I1 - loop $L2 - local.get $p2 - i32.eqz - br_if $B0 - local.get $p0 - local.get $p1 - i32.load8_u - i32.store8 - local.get $p0 - i32.const 1 - i32.add - local.set $p0 - local.get $p1 - i32.const 1 - i32.add - local.set $p1 - local.get $p2 - i32.const -1 - i32.add - local.set $p2 - br $L2 - end - unreachable - end - local.get $p1 - i32.const -1 - i32.add - local.set $p1 - local.get $p0 - i32.const -1 - i32.add - local.set $p0 - loop $L3 - local.get $p2 - i32.eqz - br_if $B0 - local.get $p0 - local.get $p2 - i32.add - local.get $p1 - local.get $p2 - i32.add - i32.load8_u - i32.store8 - local.get $p2 - i32.const -1 - i32.add - local.set $p2 - br $L3 - end - unreachable - end) - (func $f101 (type $t19) (param $p0 i32) (param $p1 i32) (result i32) - (local $l2 i32) (local $l3 i32) (local $l4 i32) - i32.const 32 - local.set $l2 - loop $L0 - local.get $l2 - i32.eqz - if $I1 - i32.const 0 - return - end - local.get $l2 - i32.const -1 - i32.add - local.set $l2 - local.get $p1 - i32.load8_u - local.set $l3 - local.get $p0 - i32.load8_u - local.set $l4 - local.get $p0 - i32.const 1 - i32.add - local.set $p0 - local.get $p1 - i32.const 1 - i32.add - local.set $p1 - local.get $l3 - local.get $l4 - i32.eq - br_if $L0 - end - local.get $l4 - local.get $l3 - i32.sub) - (func $f102 (type $t16) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i32) - (local $l4 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l4 - global.set $g0 - local.get $l4 - local.get $p1 - local.get $p2 - local.get $p3 - call $f97 - local.get $l4 - i64.load - local.set $p1 - local.get $p0 - local.get $l4 - i32.const 8 - i32.add - i64.load - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.store - local.get $l4 - i32.const 16 - i32.add - global.set $g0) - (func $f103 (type $t16) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i32) - (local $l4 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l4 - global.set $g0 - local.get $l4 - local.get $p1 - local.get $p2 - local.get $p3 - call $f98 - local.get $l4 - i64.load - local.set $p1 - local.get $p0 - local.get $l4 - i32.const 8 - i32.add - i64.load - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.store - local.get $l4 - i32.const 16 - i32.add - global.set $g0) - (func $f104 (type $t15) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i64) (param $p4 i64) - (local $l5 i32) - global.get $g0 - i32.const 16 - i32.sub - local.tee $l5 - global.set $g0 - local.get $l5 - local.get $p1 - local.get $p2 - local.get $p3 - local.get $p4 - call $f105 - local.get $l5 - i64.load - local.set $p1 - local.get $p0 - local.get $l5 - i32.const 8 - i32.add - i64.load - i64.store offset=8 - local.get $p0 - local.get $p1 - i64.store - local.get $l5 - i32.const 16 - i32.add - global.set $g0) - (func $f105 (type $t20) (param $p0 i32) (param $p1 i64) (param $p2 i64) (param $p3 i64) (param $p4 i64) - (local $l5 i32) (local $l6 i32) (local $l7 i32) (local $l8 i64) (local $l9 i64) (local $l10 i64) (local $l11 i64) (local $l12 i64) - global.get $g0 - i32.const 48 - i32.sub - local.tee $l6 - global.set $g0 - block $B0 - block $B1 - block $B2 (result i64) - block $B3 - block $B4 - block $B5 - block $B6 - local.get $p2 - i64.eqz - i32.eqz - if $I7 - local.get $p3 - i64.eqz - br_if $B6 - local.get $p4 - i64.eqz - br_if $B5 - local.get $p4 - i64.clz - i32.wrap_i64 - local.get $p2 - i64.clz - i32.wrap_i64 - i32.sub - local.tee $l5 - i32.const 63 - i32.gt_u - br_if $B3 - i32.const 127 - local.get $l5 - i32.sub - local.set $l7 - local.get $l5 - i32.const 1 - i32.add - local.set $l5 - br $B1 - end - local.get $p4 - i64.eqz - i32.eqz - br_if $B3 - local.get $p3 - i64.const 0 - i64.eq - br_if $B4 - local.get $p1 - local.get $p3 - i64.div_u - br $B2 - end - local.get $p4 - i64.eqz - br_if $B4 - block $B8 - local.get $p1 - i64.eqz - i32.eqz - if $I9 - local.get $p4 - i64.popcnt - i64.const 1 - i64.eq - br_if $B8 - local.get $p4 - i64.clz - i32.wrap_i64 - local.get $p2 - i64.clz - i32.wrap_i64 - i32.sub - local.tee $l5 - i32.const 62 - i32.gt_u - br_if $B3 - i32.const 127 - local.get $l5 - i32.sub - local.set $l7 - local.get $l5 - i32.const 1 - i32.add - local.set $l5 - br $B1 - end - local.get $p2 - local.get $p4 - i64.div_u - br $B2 - end - local.get $p2 - local.get $p4 - i64.ctz - i64.shr_u - br $B2 - end - local.get $p3 - i64.popcnt - i64.const 1 - i64.ne - if $I10 - i32.const -65 - local.get $p3 - i64.clz - i32.wrap_i64 - local.get $p2 - i64.clz - i32.wrap_i64 - i32.sub - local.tee $l5 - i32.sub - local.set $l7 - local.get $l5 - i32.const 65 - i32.add - local.set $l5 - br $B1 - end - local.get $p3 - i64.const 1 - i64.eq - br_if $B0 - local.get $l6 - i32.const 32 - i32.add - local.get $p1 - local.get $p2 - local.get $p3 - i64.ctz - i32.wrap_i64 - call $f103 - local.get $l6 - i32.const 40 - i32.add - i64.load - local.set $p2 - local.get $l6 - i64.load offset=32 - local.set $p1 - br $B0 - end - unreachable - end - i64.const 0 - end - local.set $p1 - i64.const 0 - local.set $p2 - br $B0 - end - local.get $l6 - i32.const 16 - i32.add - local.get $p1 - local.get $p2 - local.get $l5 - i32.const 127 - i32.and - call $f103 - local.get $l6 - local.get $p1 - local.get $p2 - local.get $l7 - i32.const 127 - i32.and - call $f102 - local.get $l6 - i32.const 8 - i32.add - i64.load - local.set $p2 - local.get $l6 - i32.const 24 - i32.add - i64.load - local.set $l9 - local.get $l6 - i64.load - local.set $p1 - local.get $l6 - i64.load offset=16 - local.set $l8 - loop $L11 - local.get $l5 - if $I12 - local.get $l9 - i64.const 1 - i64.shl - local.get $l8 - i64.const 63 - i64.shr_u - i64.or - local.tee $l9 - local.get $l8 - i64.const 1 - i64.shl - local.get $p2 - i64.const 63 - i64.shr_u - i64.or - local.tee $l8 - i64.const -1 - i64.xor - local.tee $l10 - local.get $p3 - i64.add - local.get $l10 - i64.lt_u - i64.extend_i32_u - local.get $l9 - i64.const -1 - i64.xor - local.get $p4 - i64.add - i64.add - i64.const 63 - i64.shr_s - local.tee $l10 - local.get $p4 - i64.and - i64.sub - local.get $l8 - local.get $p3 - local.get $l10 - i64.and - local.tee $l12 - i64.lt_u - i64.extend_i32_u - i64.sub - local.set $l9 - local.get $l8 - local.get $l12 - i64.sub - local.set $l8 - local.get $p2 - i64.const 1 - i64.shl - local.get $p1 - i64.const 63 - i64.shr_u - i64.or - local.set $p2 - local.get $l5 - i32.const -1 - i32.add - local.set $l5 - local.get $p1 - i64.const 1 - i64.shl - local.get $l11 - i64.or - local.set $p1 - local.get $l10 - i64.const 1 - i64.and - local.set $l11 - br $L11 - end - end - local.get $p2 - i64.const 1 - i64.shl - local.get $p1 - i64.const 63 - i64.shr_u - i64.or - local.set $p2 - local.get $p1 - i64.const 1 - i64.shl - local.get $l11 - i64.or - local.set $p1 - end - local.get $p0 - local.get $p1 - i64.store - local.get $p0 - local.get $p2 - i64.store offset=8 - local.get $l6 - i32.const 48 - i32.add - global.set $g0) - (global $g0 (mut i32) (i32.const 65536)) - (export "deploy" (func $deploy)) - (export "call" (func $call)) - (data $d0 (i32.const 65536) "PercentageTransferManagerStorage::ChangeAllowedPercentagePercentageTransferManagerStorage::ChangePrimaryIssuancePercentageTransferManagerStorage::ModifyExemptionListPercentageTransferManagerStorage::TransferOwnership\00\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00\04\00\00\00\05\00\00\00\06\00\00\00\07\00\00\00\08")) diff --git a/pallets/contracts/src/benchmarking.rs b/pallets/contracts/src/benchmarking.rs index 4b50e2aa09..98a060a40f 100644 --- a/pallets/contracts/src/benchmarking.rs +++ b/pallets/contracts/src/benchmarking.rs @@ -15,249 +15,270 @@ use crate::*; +use codec::Encode; use frame_benchmarking::benchmarks; -use frame_support::storage::IterableStorageMap; -use frame_support::weights::Weight; -use frame_system::RawOrigin; -use pallet_contracts::PristineCode; -use parity_wasm::elements::FuncBody; +use frame_support::traits::{tokens::currency::Currency, ReservableCurrency}; +use pallet_asset::Pallet as Asset; +use pallet_contracts::benchmarking::code::{ + body, max_pages, DataSegment, ImportedFunction, ImportedMemory, Location, ModuleDefinition, + WasmModule, +}; +use pallet_contracts::Pallet as FrameContracts; use polymesh_common_utilities::{ - benchs::{AccountIdOf, UserBuilder}, - constants::ENSURED_MAX_LEN, + benchs::{user, AccountIdOf, User}, + constants::currency::POLY, TestUtilsFn, }; -use polymesh_primitives::{MetaDescription, MetaUrl, SmartExtensionType, TemplateMetadata}; -use sp_runtime::traits::Hash; +use polymesh_primitives::{Balance, Permissions}; +use pwasm_utils::parity_wasm::elements::{Instruction, ValueType}; +use sp_runtime::Perbill; +use sp_std::prelude::*; + +pub(crate) const SEED: u32 = 0; -type BaseContracts = pallet_contracts::Module; +const ENDOWMENT: Balance = 1_000 * POLY; -const MAX_URL_LENGTH: u32 = ENSURED_MAX_LEN; -const MAX_DESCRIPTION_LENGTH: u32 = ENSURED_MAX_LEN; +const SALT_BYTE: u8 = 0xFF; -// Copied from - https://github.com/PolymathNetwork/substrate/blob/v2.0.0/frame/contracts/src/benchmarking.rs#L30 -macro_rules! load_module { - ($name:expr) => {{ - let code = include_bytes!(concat!("../fixtures/", $name, ".wat")); - compile_module::(code) - }}; +/// Construct the default salt used for most benchmarks. +fn salt() -> Vec { + vec![SALT_BYTE] } -// Copied from - https://github.com/PolymathNetwork/substrate/blob/v2.0.0/frame/contracts/src/benchmarking.rs#L37 -pub fn compile_module(code: &[u8]) -> (Vec, ::Output) { - let code = sp_std::str::from_utf8(code).expect("Invalid utf8 in wat file."); - let binary = wat::parse_str(code).expect("Failed to compile wat file."); - let hash = T::Hashing::hash(&binary); - (binary, hash) +/// Create a funded user used by all benchmarks. +fn funded_user>>() -> User { + let user = user::("actor", SEED); + T::Currency::make_free_balance_be(&user.account(), 1_000_000 * POLY); + user } -// Copied from - https://github.com/PolymathNetwork/substrate/blob/v2.0.0/frame/contracts/src/benchmarking.rs#L54 -fn contract_with_call_body(body: FuncBody) -> (Vec, ::Output) { - use parity_wasm::elements::{Instruction::End, Instructions}; - let contract = parity_wasm::builder::ModuleBuilder::new() - // deploy function (idx 0) - .function() - .signature() - .with_params(vec![]) - .with_return_type(None) - .build() - .body() - .with_instructions(Instructions::new(vec![End])) - .build() - .build() - // call function (idx 1) - .function() - .signature() - .with_params(vec![]) - .with_return_type(None) - .build() - .with_body(body) - .build() - .export() - .field("deploy") - .internal() - .func(0) - .build() - .export() - .field("call") - .internal() - .func(1) - .build() - .build(); - let bytes = contract.to_bytes().unwrap(); - let hash = T::Hashing::hash(&bytes); - (bytes, hash) +/// Returns the free balance of `acc`. +fn free_balance(acc: &T::AccountId) -> Balance { + T::Currency::free_balance(&acc) } -// Copied from - https://github.com/PolymathNetwork/substrate/blob/v2.0.0/frame/contracts/src/benchmarking.rs#L77 -fn expanded_contract(target_bytes: u32) -> (Vec, ::Output) { - use parity_wasm::elements::{ - BlockType, - Instruction::{self, End, I32Const, If, Return}, - Instructions, - }; - // Base size of a contract is 47 bytes and each expansion adds 6 bytes. - // We do one expansion less to account for the code section and function body - // size fields inside the binary wasm module representation which are leb128 encoded - // and therefore grow in size when the contract grows. We are not allowed to overshoot - // because of the maximum code size that is enforced by `put_code`. - let expansions = (target_bytes.saturating_sub(47) / 6).saturating_sub(1) as usize; - const EXPANSION: [Instruction; 4] = [I32Const(0), If(BlockType::NoResult), Return, End]; - let instructions = Instructions::new( - EXPANSION - .iter() - .cycle() - .take(EXPANSION.len() * expansions) - .cloned() - .chain(sp_std::iter::once(End)) - .collect(), - ); - contract_with_call_body::(FuncBody::new(Vec::new(), instructions)) +/// Returns the reserved balance of `acc`. +fn reserved_balance(acc: &T::AccountId) -> Balance +where + T::Currency: ReservableCurrency, +{ + T::Currency::reserved_balance(&acc) } -pub fn emulate_blueprint_in_storage( - instantiation_fee: u32, - origin: RawOrigin, - expanded: &'static str, -) -> Result<::Output, DispatchError> { - let url = Some(MetaUrl::from( - vec![b'U'; MAX_URL_LENGTH as usize].as_slice(), - )); - let description = MetaDescription::from(vec![b'D'; MAX_DESCRIPTION_LENGTH as usize].as_slice()); - let meta_info = TemplateMetadata { - url, - se_type: SmartExtensionType::TransferManager, - usage_fee: 100u32.into(), - description, - version: 5000, - }; - let (wasm_blob, code_hash) = if expanded == "" { - expanded_contract::(BaseContracts::::current_schedule().max_code_size) - } else { - if expanded == "dummy" { - load_module!("dummy") - } else { - load_module!("ptm") - } - }; - Module::::set_put_code_flag(RawOrigin::Root.into(), true).unwrap(); - Module::::put_code( - origin.into(), - meta_info, - instantiation_fee.into(), - wasm_blob, +/// The `user` instantiates `wasm.code` as the contract with `salt`. +/// Returns the address of the new contract. +fn instantiate(user: &User, wasm: WasmModule, salt: Vec) -> T::AccountId { + let callee = FrameContracts::::contract_address(&user.account(), &wasm.hash, &salt); + Pallet::::instantiate_with_code_perms( + user.origin().into(), + ENDOWMENT, // endowment + Weight::MAX, // gas limit + None, + wasm.code, + vec![], // data + salt, + Permissions::default(), // Full perms necessary for calling into the runtime. ) - .unwrap(); - Ok(code_hash) + .expect("could not create contract"); + callee } -benchmarks! { - where_clause { where T: TestUtilsFn> } - - _{} - - put_code { - // Catalyst for the code size length - let l in 1 .. BaseContracts::::current_schedule().max_code_size; - // Catalyst for the MetaUrl length. - let u in 1 .. MAX_URL_LENGTH; - // Catalyst for the MetaDescription length. - let d in 1 .. MAX_DESCRIPTION_LENGTH; - - let url = Some(MetaUrl::from(vec![b'U'; u as usize].as_slice())); - let description = MetaDescription::from(vec![b'D'; d as usize].as_slice()); - let meta_info = TemplateMetadata { - url, - se_type: SmartExtensionType::TransferManager, - usage_fee: 100u32.into(), - description, - version: 5000 - }; - let (wasm_blob, code_hash) = expanded_contract::(l); - let user = UserBuilder::::default().generate_did().build("creator"); - Module::::set_put_code_flag(RawOrigin::Root.into(), true).unwrap(); - - }: _(user.origin, meta_info, 1000u32.into(), wasm_blob) - verify { - assert!(matches!(Module::::get_metadata_of(code_hash), meta_info), "Contracts_putCode: Meta info set incorrect"); - assert!(PristineCode::::get(code_hash).is_some(), "Contracts_putCode: Base contract doesn't get updated with given code hash"); +/// Returns a module definition that will import and call `seal_call_chain_extension`. +fn chain_extension_module_def(func_id: i32, in_ptr: i32, in_len: i32) -> ModuleDefinition { + ModuleDefinition { + // Import `seal_call_chain_extension`. + imported_functions: vec![ImportedFunction { + module: "seal0", + name: "seal_call_chain_extension", + params: vec![ValueType::I32; 5], + return_type: Some(ValueType::I32), + }], + // Call `seal_call_chain_extension` with the given `func_id`, `in_ptr`, and `in_len`. + call_body: Some(body::plain(vec![ + Instruction::I32Const(func_id), + Instruction::I32Const(in_ptr), + Instruction::I32Const(in_len), + Instruction::I32Const(0), // `output_ptr` + Instruction::I32Const(0), // `output_len` + Instruction::Call(0), // Call `seal_call_chain_extension`, assumed to be at `0`. + Instruction::Drop, + Instruction::End, + ])), + ..Default::default() } +} - // No catalyst. - instantiate { - let data = vec![0u8; 128]; - let max_fee = 100; - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(max_fee, creator.origin, "dummy").unwrap(); - let deployer = UserBuilder::::default().generate_did().build("deployer"); - }: _(deployer.origin, 1_000_000u32.into(), Weight::max_value(), code_hash, data, max_fee.into()) - verify { - let (key, value) = ExtensionInfo::::iter().next().unwrap(); - let attributes = Module::::ext_details(&code_hash); - assert!(matches!(value, attributes), "Contracts_instantiate: Storage doesn't set correctly"); +/// Make the `prepare_instantiate` input. +fn prepare_input(n: u32) -> Vec { + // For simplicity, we assume the salt is `n` long and the rest is 0 long. + let hash = Vec::::new(); + let salt = vec![b'A'; n as usize]; + let perms = Permissions::default(); + (hash, salt, perms).encode() +} + +benchmarks! { + where_clause { where + T: pallet_asset::Config, + ::Currency: ReservableCurrency, + T: TestUtilsFn>, } - // No catalyst. - freeze_instantiation { - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "dummy").unwrap(); - }: _(creator.origin, code_hash) - verify { - assert!(Module::::get_template_details(code_hash).is_instantiation_frozen(), "Contracts_freeze_instantiation: Failed to freeze instantiation"); + prepare_instantiate_full { + let n in 1 .. T::MaxLen::get().saturating_sub(prepare_input(0).len() as u32); + + // Construct a user doing everything. + let user = funded_user::(); + + // Construct our contract. + let input = prepare_input(n); + let def = chain_extension_module_def(0x_00_00_00_00u32 as i32, 0, input.len() as i32); + let wasm = WasmModule::::from(ModuleDefinition { + memory: Some(ImportedMemory::max::()), + data_segments: vec![DataSegment { offset: 0, value: input }], + ..def + }); + + // Instantiate the contract. + let callee = instantiate::(&user, wasm, salt()); + }: call(user.origin(), callee.clone(), 0, Weight::MAX, None, vec![]) + + chain_extension_full { + let n in 1 .. T::MaxLen::get() as u32; + + // Construct a user doing everything. + let user = funded_user::(); + + // Construct our contract. + let input = vec![b'A'; n as usize].encode(); + let def = chain_extension_module_def(0x_00_01_11_00, 0, input.len() as i32); + let wasm = WasmModule::::from(ModuleDefinition { + memory: Some(ImportedMemory::max::()), + data_segments: vec![DataSegment { offset: 0, value: input }], + ..def + }); + + // Instantiate the contract. + let callee = instantiate::(&user, wasm, salt()); + }: call(user.origin(), callee.clone(), 0, Weight::MAX, None, vec![]) + + chain_extension_early_exit { + // Construct a user doing everything. + let user = funded_user::(); + + // Construct our contract. + let wasm = WasmModule::::from(chain_extension_module_def(0, 0, 0)); + + // Instantiate the contract. + let callee = instantiate::(&user, wasm, salt()); + }: call(user.origin(), callee.clone(), 0, Weight::MAX, None, vec![]) + + basic_runtime_call { + let n in 1 .. T::MaxLen::get() as u32; + + let user = funded_user::(); + let custom_type = vec![b'A'; n as usize]; + let origin = user.origin().into(); + }: { + Asset::::register_custom_asset_type(origin, custom_type).unwrap(); } - // No catalyst. - unfreeze_instantiation { - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "dummy").unwrap(); - Module::::freeze_instantiation(creator.origin.clone().into(), code_hash).unwrap(); - }: _(creator.origin, code_hash) + call { + // Construct a user doing everything. + let user = funded_user::(); + + // Instantiate a dummy contract. + let callee = instantiate::(&user, WasmModule::::dummy(), salt()); + let before = free_balance::(&callee); + + // Arguments to pass to contract call. + let data = vec![42u8; 1024]; + }: _(user.origin(), callee.clone(), ENDOWMENT, Weight::MAX, None, data) verify { - assert!(!Module::::get_template_details(code_hash).is_instantiation_frozen(), "Contracts_unfreeze_instantiation: Failed to unfreeze instantiation"); + // Contract should have received the value. + assert_eq!(free_balance::(&callee), before + ENDOWMENT); } - // No catalyst. - transfer_template_ownership { - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "dummy").unwrap(); - let new_owner = UserBuilder::::default().generate_did().build("newOwner"); - }: _(creator.origin, code_hash, new_owner.did()) + // Use a dummy contract constructor to measure the overhead. + // `s`: Size of the salt in kilobytes. + instantiate_with_hash { + let s in 0 .. max_pages::() * 64 * 1024; + let other_salt = vec![42u8; s as usize]; + + // Construct a user doing everything. + let user = funded_user::(); + + // Have the user instantiate a dummy contract. + let wasm = WasmModule::::dummy(); + let hash = wasm.hash.clone(); + let addr = FrameContracts::::contract_address(&user.account(), &hash, &other_salt); + + // Pre-instantiate a contract so that one with the hash exists. + let _ = instantiate::(&user, wasm, salt()); + }: instantiate(user.origin(), ENDOWMENT, Weight::MAX, None, hash, vec![], other_salt) verify { - assert_eq!(Module::::get_template_details(code_hash).owner, new_owner.did(), "Contracts_transfer_template_ownership: Failed to transfer ownership"); + // Ensure contract has the full value. + assert_eq!(free_balance::(&addr), ENDOWMENT); } - // No catalyst. - change_template_fees { - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "").unwrap(); - }: _(creator.origin, code_hash, Some(500u32.into()), Some(650u32.into())) + // This constructs a contract that is maximal expensive to instrument. + // It creates a maximum number of metering blocks per byte. + // The size of the salt influences the runtime because is is hashed in order to + // determine the contract address. All code is generated to the `call` function so that + // we don't benchmark the actual execution of this code but merely what it takes to load + // a code of that size into the sandbox. + // + // `c`: Size of the code in kilobytes. + // `s`: Size of the salt in kilobytes. + // + // # Note + // + // We cannot let `c` grow to the maximum code size because the code is not allowed + // to be larger than the maximum size **after instrumentation**. + instantiate_with_code { + let c in 0 .. Perbill::from_percent(50).mul_ceil(T::Schedule::get().limits.code_len); + let s in 0 .. max_pages::() * 64 * 1024; + let salt = vec![42u8; s as usize]; + + // Construct a user doing everything. + let user = funded_user::(); + + // Construct the contract code + get addr. + let wasm = WasmModule::::sized(c, Location::Deploy); + let addr = FrameContracts::::contract_address(&user.account(), &wasm.hash, &salt); + }: _(user.origin(), ENDOWMENT, Weight::MAX, None, wasm.code, vec![], salt) verify { - assert_eq!(Module::::get_template_details(code_hash).get_instantiation_fee(), 500u32.into(), "Contracts_change_template_fees: Failed to change the instantiation fees"); - assert_eq!(Module::::get_metadata_of(code_hash).usage_fee, 650u32.into(), "Contracts_change_template_fees: Failed to change the usage fees"); + // Ensure contract has the full value. + assert_eq!(free_balance::(&addr), ENDOWMENT); } - change_template_meta_url { - // Catalyst for the MetaUrl length. - let u in 1 .. MAX_URL_LENGTH; - let url = Some(MetaUrl::from(vec![b'U'; u as usize].as_slice())); - let creator = UserBuilder::::default().generate_did().build("creator"); - let code_hash = emulate_blueprint_in_storage::(100, creator.origin.clone(), "").unwrap(); - }: _(creator.origin, code_hash, url.clone()) + upload_code { + let c in 0 .. Perbill::from_percent(50).mul_ceil(T::Schedule::get().limits.code_len); + // Construct a user doing everything. + let user = funded_user::(); + + let WasmModule { code, hash, .. } = WasmModule::::sized(c, Location::Call); + }: _(user.origin(), code, None) verify { - assert_eq!(Module::::get_metadata_of(code_hash).url, url, "Contracts_change_template_meta_url: Failed to change the url of template"); + // Uploading code reserves some balance in the callers account. + assert!(reserved_balance::(&user.account) > 0u32.into()); + //assert!(>::code_exists(&hash)); } - // No catalyst. - update_schedule { - let schedule = Schedule { - version: 1, - .. Default::default() - }; - }: _(RawOrigin::Root, schedule) - - set_put_code_flag { - assert!(!Module::::is_put_code_enabled(), "Contracts_set_put_code_flag: Unexpected initial state"); - }: _(RawOrigin::Root, true) + remove_code { + // Construct a user doing everything. + let user = funded_user::(); + + // Upload a dummy contract. + let WasmModule { code, hash, .. } = WasmModule::::dummy(); + let uploaded = >::bare_upload_code(user.account(), code, None)?; + assert_eq!(uploaded.code_hash, hash); + assert_eq!(uploaded.deposit, reserved_balance::(&user.account())); + //assert!(>::code_exists(&hash)); + }: _(user.origin(), hash) verify { - assert!(Module::::is_put_code_enabled(), "Contracts_set_put_code_flag: Failed to change the flag"); + // Removing the code should have unreserved the deposit. + assert_eq!(reserved_balance::(&user.account), 0u32.into()); + //assert!(>::code_removed(&hash)); } } diff --git a/pallets/contracts/src/lib.rs b/pallets/contracts/src/lib.rs index a80c022933..8c9a6e3cce 100644 --- a/pallets/contracts/src/lib.rs +++ b/pallets/contracts/src/lib.rs @@ -13,441 +13,926 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// Ensure we're `no_std` when compiling for Wasm. +//! # Contracts Module +//! +//! The contracts module provides the Layer 2 solution for Polymesh. +//! These smart contracts are defined using WASM, +//! and facilitated by the `ink!` DSL provided by Parity. +//! +//! With this module, you or Alice can instantiate such a contract, +//! through `instantiate_with_code` or `instantiate_with_hash`, +//! attaching its key as a secondary key of the signer's identity. +//! Anyone can then call this smart contract, e.g., Bob, +//! which may call back into the runtime to e.g., `create_asset`. +//! However, during the execution of `create_asset`, +//! the current identity will be Alice, as opposed to `Bob`. +//! +//! ## Overview +//! +//! The Contracts module provides functions for: +//! +//! - Instantiating contracts +//! - Calling contracts +//! +//! ## Interface +//! +//! ### Dispatchable Functions +//! +//! - `instantiate_with_code` instantiates a contract with the code provided. +//! - `instantiate_with_hash` instantiates a contract by hash, +//! assuming that a contract with the same code already was uploaded. +//! - `call` dispatches to the smart contract code, acting as the identity who made the contract. + #![cfg_attr(not(feature = "std"), no_std)] +#![feature(associated_type_bounds)] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; -use core::mem; +use codec::Decode; use frame_support::{ - decl_error, decl_module, decl_storage, - dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo}, + decl_error, decl_event, decl_module, decl_storage, + dispatch::{ + DispatchError, DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, + Dispatchable, GetDispatchInfo, + }, ensure, - traits::Get, - weights::DispatchClass::Operational, -}; -use frame_system::ensure_root; -use pallet_base::{ensure_opt_string_limited, ensure_string_limited}; -use pallet_contracts::{weights::WeightInfo as _, BalanceOf, CodeHash, Schedule}; -use pallet_identity as identity; -pub use polymesh_common_utilities::traits::contracts::{Event, Trait, WeightInfo}; -use polymesh_common_utilities::{ - protocol_fee::{ChargeProtocolFee, ProtocolOp}, - traits::contracts::ContractsFn, - with_transaction, -}; -use polymesh_primitives::{ - ExtensionAttributes, Gas, IdentityId, MetaUrl, SmartExtensionType, TemplateDetails, - TemplateMetadata, + traits::{Get, GetCallMetadata}, + weights::Weight, }; +use frame_system::RawOrigin; +use pallet_contracts::chain_extension as ce; +use pallet_contracts::Config as BConfig; +use pallet_contracts_primitives::{Code, ContractInstantiateResult, ContractResult}; +use pallet_identity::PermissionedCallOriginData; +use pallet_identity::WeightInfo as _; +use pallet_permissions::with_call_metadata; +use polymesh_common_utilities::traits::identity::Config as IdentityConfig; +use polymesh_common_utilities::{with_transaction, Context}; +use polymesh_primitives::{Balance, IdentityId, Permissions}; use sp_core::crypto::UncheckedFrom; -use sp_runtime::{ - traits::{Hash, StaticLookup}, - Perbill, SaturatedConversion, -}; -use sp_std::prelude::*; +use sp_core::Bytes; +use sp_runtime::traits::Hash; +use sp_std::borrow::Cow; +use sp_std::vec::Vec; + +type Identity = pallet_identity::Module; +type FrameContracts = pallet_contracts::Pallet; +type CodeHash = ::Hash; + +pub trait WeightInfo { + fn call() -> Weight; + fn upload_code(code_len: u32) -> Weight; + fn remove_code() -> Weight; + + /// Computes the cost of instantiating where `code_len` + /// and `salt_len` are specified in kilobytes. + fn instantiate_with_code(code_len: u32, salt_len: u32) -> Weight; + + /// Computes the cost of instantiating for `code` and `salt`. + /// + /// Permissions are not accounted for here. + fn instantiate_with_code_bytes(code: &[u8], salt: &[u8]) -> Weight { + Self::instantiate_with_code(code.len() as u32, salt.len() as u32) + } -type Identity = identity::Module; -type Contracts = pallet_contracts::Module; + /// Computes the cost of instantiating where `salt_len` is specified in kilobytes. + fn instantiate_with_hash(salt_len: u32) -> Weight; -pub const INSTANTIATE_WITH_CODE_EXTRA: u64 = 50_000_000; -const INSTANTIATE_EXTRA: u64 = 500_000_000; + /// Computes the cost of instantiating for `salt`. + /// + /// Permissions are not accounted for here. + fn instantiate_with_hash_bytes(salt: &[u8]) -> Weight { + Self::instantiate_with_hash((salt.len()) as u32) + } -decl_storage! { - trait Store for Module as ContractsWrapper - where - T::AccountId: UncheckedFrom + AsRef<[u8]> - { - /// Store the meta details of the smart extension template. - pub MetadataOfTemplate get(fn get_metadata_of): map hasher(identity) CodeHash => TemplateMetadata>; - /// Store the details of the template (Ex- owner, frozen etc). - pub TemplateInfo get(fn get_template_details): map hasher(identity) CodeHash => TemplateDetails>; - /// Details of extension get updated. - pub ExtensionInfo get(fn extension_info): map hasher(identity) T::AccountId => ExtensionAttributes>; - /// Nonce for the smart extension account id generation. - /// Using explicit nonce as in batch transaction accounts nonce doesn't get incremented. - pub ExtensionNonce get(fn extension_nonce): u64; - /// Store if `put_code` extrinsic is enabled or disabled. - pub EnablePutCode get(fn is_put_code_enabled) config(enable_put_code): bool; + /// Computes the cost just for executing the chain extension, + /// subtracting costs for `call` itself and runtime callbacks. + fn chain_extension(in_len: u32) -> Weight { + Self::chain_extension_full(in_len) + .saturating_sub(Self::chain_extension_early_exit()) + .saturating_sub(Self::basic_runtime_call(in_len)) } + + /// Returns the weight for a full execution of a smart contract `call` that + /// calls `register_custom_asset_type` in the runtime via a chain extension. + /// The asset type is `in_len` characters long. + fn chain_extension_full(in_len: u32) -> Weight; + + /// Returns the weight for a smart contract `call` that enters the chain extension + /// but then immediately returns. + fn chain_extension_early_exit() -> Weight; + + /// Returns the weight of executing `Asset::register_custom_asset_type` + /// with an asset type that is `in_len` characters long. + fn basic_runtime_call(in_len: u32) -> Weight; + + /// Computes the cost of executing the special `prepare_instantiate` func_id + /// with `in_len` as the length in bytes of the code hash, salt, and permissions taken together. + fn prepare_instantiate(in_len: u32) -> Weight { + Self::prepare_instantiate_full(in_len).saturating_sub(Self::chain_extension_early_exit()) + } + + /// Returns the weight for a full execution of a smart contract `call` + /// that uses the special `prepare_instantiate` func_id with `in_len` + /// as the length in bytes of the code hash, salt, and permissions taken together. + fn prepare_instantiate_full(in_len: u32) -> Weight; } -decl_error! { - pub enum Error for Module - where - T::AccountId: UncheckedFrom, - T::AccountId: AsRef<[u8]>, - { - /// Instantiation is not allowed. - InstantiationIsNotAllowed, - /// Smart extension template not exist in the storage. - TemplateNotExists, - /// When instantiation of the template is already frozen. - InstantiationAlreadyFrozen, - /// When instantiation of the template is already un-frozen. - InstantiationAlreadyUnFrozen, - /// When un-authorized personnel try to access the un-authorized extrinsic. - UnAuthorizedOrigin, - /// Given identityId is not CDD. - NewOwnerIsNotCDD, - /// Insufficient max_fee provided by the user to instantiate the SE. - InsufficientMaxFee, - /// `put_code` extrinsic is disabled. See `set_put_code_flag` extrinsic. - PutCodeIsNotAllowed, +/// The `Config` trait for the smart contracts pallet. +pub trait Config: + IdentityConfig + + BConfig + + frame_system::Config< + AccountId: AsRef<[u8]> + UncheckedFrom<::Hash>, + > +{ + /// The overarching event type. + type Event: From + Into<::Event>; + + /// Max value that `in_len` can take, that is, + /// the length of the data sent from a contract when making a runtime call. + type MaxInLen: Get; + + /// The weight configuration for the pallet. + type WeightInfo: WeightInfo; +} + +decl_event! { + pub enum Event { + // This pallet does not directly define custom events. + // See `pallet_contracts` and `pallet_identity` + // for events currently emitted by extrinsics of this pallet. } } -decl_module! { - // Wrap dispatchable functions for contracts so that we can add additional gating logic. - pub struct Module for enum Call - where - origin: T::Origin, - T::AccountId: UncheckedFrom, - T::AccountId: AsRef<[u8]>, - { +decl_error! { + pub enum Error for Module { + /// The given `func_id: u32` did not translate into a known runtime call. + RuntimeCallNotFound, + /// Data left in input when decoding arguments of a call. + DataLeftAfterDecoding, + /// Input data that a contract passed when making a runtime call was too large. + InLenTooLarge, + /// A contract was attempted to be instantiated, + /// but no identity was given to associate the new contract's key with. + InstantiatorWithNoIdentity, + } +} - /// Initialize the default event for this module. - fn deposit_event() = default; +decl_storage! { + trait Store for Module as Contracts { + // Storage items defined in `pallet_contracts` and `pallet_identity`. + } +} - /// Error type. +decl_module! { + pub struct Module for enum Call where origin: T::Origin { type Error = Error; + fn deposit_event() = default; - /// The minimum amount required to generate a tombstone. - const NetworkShareInInstantiationFee: Perbill = T::NetworkShareInFee::get(); + fn on_initialize(block: T::BlockNumber) -> Weight { + // Does he know what I do and... 🎶 + pallet_contracts::Pallet::::on_initialize(block) + } - // Simply forwards to the `update_schedule` function in the Contract module. - #[weight = ::WeightInfo::update_schedule()] - pub fn update_schedule(origin, schedule: Schedule) -> DispatchResultWithPostInfo { - Contracts::::update_schedule(origin, schedule) + fn on_runtime_upgrade() -> Weight { + // 🎶 ...You'll pass this on, won't you and? + pallet_contracts::Pallet::::on_runtime_upgrade() } - /// Enable or disable the extrinsic `put_code` in this module. + /// Calls the `contract` through its address with the given `data`. /// - /// ## Arguments - /// - `origin` which must be root. - /// - `is_enabled` is the new value for this flag. + /// The contract is endowed with `value` POLYX, + /// but note that this is distinct from gas fees which are limited with `gas_limit`. /// - /// ## Errors - /// - `BadOrigin` if caller is not root. + /// The contract may optionally call back into the runtime, + /// executing extrinsics such as e.g., `create_asset`. + /// During such runtime calls, the current identity will be the one that instantiate the `contract`. + /// This restriction exists for security purposes. /// - /// ## Permissions - /// None - #[weight = (::WeightInfo::set_put_code_flag(), Operational)] - pub fn set_put_code_flag(origin, is_enabled: bool) -> DispatchResult { - Self::base_set_put_code_flag(origin, is_enabled) + /// # Arguments + /// - `contract` to call. + /// - `value` in POLYX to transfer to the contract. + /// - `gas_limit` that limits how much gas execution can consume, erroring above it. + /// - `storage_deposit_limit` The maximum amount of balance that can be charged from the + /// caller to pay for the storage consumed. + /// - `data` The input data to pass to the contract. + /// + /// # Errors + /// - All the errors in `pallet_contracts::Call::call` can also happen here. + /// - `ContractNotFound` if `contract` doesn't exist or isn't a contract. + /// - CDD/Permissions are checked, unlike in `pallet_contracts`. + #[weight = ::WeightInfo::call().saturating_add(*gas_limit)] + pub fn call( + origin, + contract: T::AccountId, + value: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, + data: Vec, + ) -> DispatchResultWithPostInfo { + Self::base_call(origin, contract, value, gas_limit, storage_deposit_limit, data) } - /// Simply forwards to the `put_code` function in the Contract module. + /// Instantiates a smart contract defining it with the given `code` and `salt`. + /// + /// The contract will be attached as a secondary key, + /// with empty permissions, to `origin`'s identity. /// - /// # Additional functionality - /// 1. Allow origin to pass some meta-details related to template code. - /// 2. Charge protocol fee for deploying the template. + /// The contract is transferred `endowment` amount of POLYX. + /// This is distinct from the `gas_limit`, + /// which controls how much gas the deployment code may at most consume. + /// + /// # Arguments + /// - `endowment` amount of POLYX to transfer to the contract. + /// - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + /// - `storage_deposit_limit` The maximum amount of balance that can be charged/reserved + /// from the caller to pay for the storage consumed. + /// - `code` with the WASM binary defining the smart contract. + /// - `data` The input data to pass to the contract constructor. + /// - `salt` used for contract address derivation. + /// By varying this, the same `code` can be used under the same identity. /// /// # Errors - /// - `PutCodeIsNotAllowed` if the `put_code` flag is false. See `set_put_code_flag()`. - /// - `frame_system::BadOrigin` if `origin` is not signed. - /// - `pallet_permission::Error::::UnAutorizedCaller` if `origin` does not have a valid - /// IdentityId. - /// - `TooLong` if the strings embedded in `meta_info` are too long. - /// - `pallet_contrats::Error::::CodeTooLarge` if `code` length is grater than the chain - /// setting for `pallet_contrats::max_code_size`. - /// - Before `code` is inserted, some checks are performed on it, and them could raise up - /// some errors. Please see `pallet_contracts::wasm::prepare_contract` for details. - #[weight = - ::WeightInfo::instantiate_with_code( - code.len() as u32 / 1024, - salt.len() as u32 / 1024, - ) - .saturating_add(*gas_limit) - .saturating_add(INSTANTIATE_WITH_CODE_EXTRA) - ] + /// - All the errors in `pallet_contracts::Call::instantiate_with_code` can also happen here. + /// - CDD/Permissions are checked, unlike in `pallet_contracts`. + /// - Errors that arise when adding a new secondary key can also occur here. + #[weight = Module::::weight_instantiate_with_code(&code, &salt, &Permissions::empty()).saturating_add(*gas_limit)] pub fn instantiate_with_code( origin, - #[compact] endowment: BalanceOf, - #[compact] gas_limit: Gas, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, code: Vec, data: Vec, - salt: Vec, - meta_info: TemplateMetadata>, - instantiation_fee: BalanceOf, + salt: Vec ) -> DispatchResultWithPostInfo { - ensure!(Self::is_put_code_enabled(), Error::::PutCodeIsNotAllowed); - let p_origin = Identity::::ensure_origin_call_permissions(origin.clone())?; - - // Ensure strings are limited in length. - ensure_string_limited::(&meta_info.description)?; - ensure_opt_string_limited::(meta_info.url.as_deref())?; - if let SmartExtensionType::Custom(ty) = &meta_info.se_type { - ensure_string_limited::(ty)?; - } - - // Save metadata related to the SE template - // Generate the code_hash here as well because there is no way - // to read it directly from the upstream `pallet-contracts` module. - let code_hash = T::Hashing::hash(&code); - let contract_address = Contracts::::contract_address(&p_origin.sender, &code_hash, &salt); - - // Rollback the `put_code()` if user is not able to pay the protocol-fee. - let post_info = with_transaction(|| -> DispatchResultWithPostInfo { - // Charge the protocol fee, update nonce, and instantiate the code. - - T::ProtocolFee::charge_fee(ProtocolOp::ContractsPutCode)?; - ExtensionNonce::mutate(|n| *n = *n + 1u64); - Contracts::::instantiate_with_code(origin, endowment, gas_limit, code, data, salt) - })?; - - // Update the storage. - >::insert(&code_hash, TemplateDetails { - instantiation_fee, - owner: p_origin.primary_did.clone(), - frozen: false - }); - >::insert(&code_hash, meta_info); - - // Update the usage fee for the extension instance. - >::insert(contract_address, Self::ext_details(&code_hash)); - - Ok(post_info) + Self::base_instantiate_with_code(origin, endowment, gas_limit, storage_deposit_limit, code, data, salt, Permissions::empty()) } - // Simply forwards to the `call` function in the Contract module. - #[weight = ::WeightInfo::call( - ::MaxCodeSize::get() / 1024 - ).saturating_add(*gas_limit)] - pub fn call( - origin, - dest: ::Source, - #[compact] value: BalanceOf, - #[compact] gas_limit: Gas, - data: Vec - ) -> DispatchResultWithPostInfo { - Contracts::::call(origin, dest, value, gas_limit, data) - } - - /// Simply forwards to the `instantiate` function in the Contract module. + /// Instantiates a smart contract defining using the given `code_hash` and `salt`. + /// + /// Unlike `instantiate_with_code`, + /// this assumes that at least one contract with the same WASM code has already been uploaded. + /// + /// The contract will be attached as a secondary key, + /// with empty permissions, to `origin`'s identity. /// - /// # Additional functionality - /// 1. Check whether instantiation of given code_hash is allowed or not. - /// 2. Charge instantiation fee. + /// The contract is transferred `endowment` amount of POLYX. + /// This is distinct from the `gas_limit`, + /// which controls how much gas the deployment code may at most consume. + /// + /// # Arguments + /// - `endowment` amount of POLYX to transfer to the contract. + /// - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + /// - `storage_deposit_limit` The maximum amount of balance that can be charged/reserved + /// from the caller to pay for the storage consumed. + /// - `code_hash` of an already uploaded WASM binary. + /// - `data` The input data to pass to the contract constructor. + /// - `salt` used for contract address derivation. + /// By varying this, the same `code` can be used under the same identity. /// /// # Errors - /// InstantiationIsNotAllowed - It occurred when instantiation of the template is frozen. - /// InsufficientMaxFee - Provided max_fee is less than required. - #[weight = ::WeightInfo::instantiate().saturating_add(*gas_limit)] + /// - All the errors in `pallet_contracts::Call::instantiate` can also happen here. + /// - CDD/Permissions are checked, unlike in `pallet_contracts`. + /// - Errors that arise when adding a new secondary key can also occur here. + #[weight = Module::::weight_instantiate_with_hash(&salt, &Permissions::empty()).saturating_add(*gas_limit)] pub fn instantiate( origin, - #[compact] endowment: BalanceOf, - #[compact] gas_limit: Gas, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, code_hash: CodeHash, data: Vec, - salt: Vec, - max_fee: BalanceOf + salt: Vec ) -> DispatchResultWithPostInfo { - let sender = Identity::::ensure_origin_call_permissions(origin.clone())?.sender; - // Access the meta details of SE template - let template_details = Self::get_template_details(code_hash); - - // Check whether instantiation is allowed or not. - ensure!(!template_details.is_instantiation_frozen(), Error::::InstantiationIsNotAllowed); - - // Check instantiation fee should be <= max_fee. - let instantiation_fee = template_details.get_instantiation_fee(); - ensure!(instantiation_fee <= max_fee, Error::::InsufficientMaxFee); - - let contract_address = Contracts::::contract_address(&sender, &code_hash, &salt); - let mut post_info = with_transaction(|| { - // Update the extension nonce. - ExtensionNonce::mutate(|n| *n = *n + 1u64); - // Charge instantiation fee - let fee = (instantiation_fee.saturated_into::()).into(); - let owner_pk = Self::get_primary_key(&template_details.owner); - T::ProtocolFee::charge_extension_instantiation_fee(fee, owner_pk, T::NetworkShareInFee::get())?; - T::ProtocolFee::charge_fee(ProtocolOp::ContractsPutCode)?; - - // Generate the contract address. Generating here to avoid cloning of the vec. - // transmit the call to the base `pallet-contracts` module. - Contracts::::instantiate(origin, endowment, gas_limit, code_hash, data, salt) - })?; - if let Some(ref mut actual_weight) = post_info.actual_weight { - *actual_weight = actual_weight.saturating_add(INSTANTIATE_EXTRA); - } - - // Update the usage fee for the extension instance. - >::insert(contract_address, Self::ext_details(&code_hash)); - - // Update the actual weight of the extrinsic. - Ok(post_info) + Self::base_instantiate_with_hash(origin, endowment, gas_limit, storage_deposit_limit, code_hash, data, salt, Permissions::empty()) } - /// Allows a smart extension template owner to freeze the instantiation. + /// Upload new `code` without instantiating a contract from it. /// - /// # Arguments - /// * origin - Only owner of the template is allowed to execute the dispatchable. - /// * code_hash - Unique hash of the smart extension template. - #[weight = ::WeightInfo::freeze_instantiation()] - pub fn freeze_instantiation(origin, code_hash: CodeHash) -> DispatchResult { - // Ensure whether the extrinsic is signed & validate the `code_hash`. - let (did, template_details) = Self::ensure_signed_and_template_exists(origin, code_hash)?; - - // If instantiation is already frozen then there is no point of changing the storage value. - ensure!(!template_details.is_instantiation_frozen(), Error::::InstantiationAlreadyFrozen); - // Change the `frozen` variable to `true`. - >::mutate(&code_hash, |template_details| template_details.frozen = true); - - // Emit event. - Self::deposit_event(Event::::InstantiationFreezed(did, code_hash)); - Ok(()) - } - - /// Allows a smart extension template owner to un freeze the instantiation. + /// If the code does not already exist a deposit is reserved from the caller + /// and unreserved only when [`Self::remove_code`] is called. The size of the reserve + /// depends on the instrumented size of the the supplied `code`. /// - /// # Arguments - /// * origin - Only owner of the template is allowed to execute the dispatchable. - /// * code_hash - Unique hash of the smart extension template. - #[weight = ::WeightInfo::unfreeze_instantiation()] - pub fn unfreeze_instantiation(origin, code_hash: CodeHash) -> DispatchResult { - // Ensure whether the extrinsic is signed & validate the `code_hash`. - let (did, template_details) = Self::ensure_signed_and_template_exists(origin, code_hash)?; - - // If instantiation is already un-frozen then there is no point of changing the storage value. - ensure!(template_details.is_instantiation_frozen(), Error::::InstantiationAlreadyUnFrozen); - // Change the `frozen` variable to `false`. - >::mutate(&code_hash, |template_details| template_details.frozen = false); - - // Emit event. - Self::deposit_event(Event::::InstantiationUnFreezed(did, code_hash)); - Ok(()) + /// If the code already exists in storage it will still return `Ok` and upgrades + /// the in storage version to the current + /// [`InstructionWeights::version`](InstructionWeights). + /// + /// # Note + /// + /// Anyone can instantiate a contract from any uploaded code and thus prevent its removal. + /// To avoid this situation a constructor could employ access control so that it can + /// only be instantiated by permissioned entities. The same is true when uploading + /// through [`Self::instantiate_with_code`]. + #[weight = ::WeightInfo::upload_code(code.len() as u32)] + pub fn upload_code( + origin, + code: Vec, + storage_deposit_limit: Option, + ) -> DispatchResult { + Self::base_upload_code(origin, code, storage_deposit_limit) } - /// Transfer ownership of the template, Can only be called by the owner of template. - /// `new_owner` should posses the valid CDD claim. + /// Remove the code stored under `code_hash` and refund the deposit to its owner. /// - /// # Arguments - /// * origin Owner of the provided code_hash. - /// * code_hash Unique identifer of the template. - /// * new_owner Identity that will be the new owner of the provided code_hash. - #[weight = ::WeightInfo::transfer_template_ownership()] - pub fn transfer_template_ownership(origin, code_hash: CodeHash, new_owner: IdentityId) -> DispatchResult { - // Ensure whether the extrinsic is signed & validate the `code_hash`. - let (did, _) = Self::ensure_signed_and_template_exists(origin, code_hash)?; - - // Ensuring the `new_owner` is CDD or not. - ensure!(Identity::::has_valid_cdd(new_owner), Error::::NewOwnerIsNotCDD); - - // Change the `owner` variable value to the given did. - >::mutate(&code_hash, |template_details| template_details.owner = new_owner); - - // Emit event. - Self::deposit_event(Event::::TemplateOwnershipTransferred(did, code_hash, new_owner)); - Ok(()) + /// A code can only be removed by its original uploader (its owner) and only if it is + /// not used by any contract. + #[weight = ::WeightInfo::remove_code()] + pub fn remove_code( + origin, + code_hash: CodeHash, + ) -> DispatchResultWithPostInfo { + Self::base_remove_code(origin, code_hash) } - /// Change the usage fee & the instantiation fee of the smart extension template + /// Instantiates a smart contract defining it with the given `code` and `salt`. + /// + /// The contract will be attached as a secondary key, + /// with `perms` as its permissions, to `origin`'s identity. + /// + /// The contract is transferred `endowment` amount of POLYX. + /// This is distinct from the `gas_limit`, + /// which controls how much gas the deployment code may at most consume. /// /// # Arguments - /// * origin - Only owner of template is allowed to execute the dispatchable. - /// * code_hash - Unique hash of the smart extension template. - /// * new_instantiation_fee - New value of instantiation fee for the smart extension template. - /// * new_usage_fee - New value of usage fee for the smart extension template. - #[weight = ::WeightInfo::change_template_fees()] - pub fn change_template_fees(origin, code_hash: CodeHash, new_instantiation_fee: Option>, new_usage_fee: Option>) -> DispatchResult { - // Ensure whether the extrinsic is signed & validate the `code_hash`. - let (did, _) = Self::ensure_signed_and_template_exists(origin, code_hash)?; - - // Update the fees - if let Some(usage_fee) = new_usage_fee { - // Update the usage fee for a given code hash. - let old_usage_fee = >::mutate(&code_hash, |metadata| mem::replace(&mut metadata.usage_fee, usage_fee)); - // Emit event with the old & new usage fee. - Self::deposit_event(Event::::TemplateUsageFeeChanged(did, code_hash, old_usage_fee, usage_fee)); - } - if let Some(instantiation_fee) = new_instantiation_fee { - // Update the instantiation fee for a given code_hash. - let old_instantiation_fee = >::mutate(&code_hash, |template_details| mem::replace(&mut template_details.instantiation_fee, instantiation_fee)); - // Emit event with the old & new instantiation fee. - Self::deposit_event(Event::::TemplateInstantiationFeeChanged(did, code_hash, old_instantiation_fee, instantiation_fee)); - } - Ok(()) + /// - `endowment` amount of POLYX to transfer to the contract. + /// - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + /// - `storage_deposit_limit` The maximum amount of balance that can be charged/reserved + /// from the caller to pay for the storage consumed. + /// - `code` with the WASM binary defining the smart contract. + /// - `data` The input data to pass to the contract constructor. + /// - `salt` used for contract address derivation. + /// By varying this, the same `code` can be used under the same identity. + /// - `perms` that the new secondary key will have. + /// + /// # Errors + /// - All the errors in `pallet_contracts::Call::instantiate_with_code` can also happen here. + /// - CDD/Permissions are checked, unlike in `pallet_contracts`. + /// - Errors that arise when adding a new secondary key can also occur here. + #[weight = Module::::weight_instantiate_with_code(&code, &salt, &perms).saturating_add(*gas_limit)] + pub fn instantiate_with_code_perms( + origin, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, + code: Vec, + data: Vec, + salt: Vec, + perms: Permissions + ) -> DispatchResultWithPostInfo { + Self::base_instantiate_with_code(origin, endowment, gas_limit, storage_deposit_limit, code, data, salt, perms) } - /// Change the template meta url. + /// Instantiates a smart contract defining using the given `code_hash` and `salt`. + /// + /// Unlike `instantiate_with_code`, + /// this assumes that at least one contract with the same WASM code has already been uploaded. + /// + /// The contract will be attached as a secondary key, + /// with `perms` as its permissions, to `origin`'s identity. + /// + /// The contract is transferred `endowment` amount of POLYX. + /// This is distinct from the `gas_limit`, + /// which controls how much gas the deployment code may at most consume. /// /// # Arguments - /// * origin - Only owner of template is allowed to execute the dispatchable. - /// * code_hash - Unique hash of the smart extension template. - /// * new_url - New meta url that need to replace with old url. - #[weight = ::WeightInfo::change_template_meta_url(new_url.as_ref().map_or(0, |u| u.0.len()) as u32 )] - pub fn change_template_meta_url(origin, code_hash: CodeHash, new_url: Option) -> DispatchResult { - // Ensure whether the extrinsic is signed & validate the `code_hash`. - let (did, _) = Self::ensure_signed_and_template_exists(origin, code_hash)?; - // Ensure URL is limited in length. - ensure_opt_string_limited::(new_url.as_deref())?; - // Update the usage fee for a given code hash. - let old_url = >::mutate(&code_hash, |metadata| mem::replace(&mut metadata.url, new_url.clone())); - // Emit event with old and new url. - Self::deposit_event(Event::::TemplateMetaUrlChanged(did, code_hash, old_url, new_url)); - Ok(()) + /// - `endowment` amount of POLYX to transfer to the contract. + /// - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + /// - `storage_deposit_limit` The maximum amount of balance that can be charged/reserved + /// from the caller to pay for the storage consumed. + /// - `code_hash` of an already uploaded WASM binary. + /// - `data` The input data to pass to the contract constructor. + /// - `salt` used for contract address derivation. + /// By varying this, the same `code` can be used under the same identity. + /// - `perms` that the new secondary key will have. + /// + /// # Errors + /// - All the errors in `pallet_contracts::Call::instantiate` can also happen here. + /// - CDD/Permissions are checked, unlike in `pallet_contracts`. + /// - Errors that arise when adding a new secondary key can also occur here. + #[weight = Module::::weight_instantiate_with_hash(&salt, &perms).saturating_add(*gas_limit)] + pub fn instantiate_with_hash_perms( + origin, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, + code_hash: CodeHash, + data: Vec, + salt: Vec, + perms: Permissions + ) -> DispatchResultWithPostInfo { + Self::base_instantiate_with_hash(origin, endowment, gas_limit, storage_deposit_limit, code_hash, data, salt, perms) } } } -impl Module -where - T::AccountId: UncheckedFrom, - T::AccountId: AsRef<[u8]>, -{ - // Internal function - // Perform some basic sanity checks - fn ensure_signed_and_template_exists( +impl Module { + /// Calls `contract` with `data`, gas limits, etc. + /// The call is made as the DID the contract is a key of and not `origin`'s DID. + fn base_call( origin: T::Origin, + contract: T::AccountId, + value: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, + data: Vec, + ) -> DispatchResultWithPostInfo { + // Ensure contract caller has perms. + let sender = Identity::::ensure_origin_call_permissions(origin)?.sender; + + // Execute contract. + Self::handle_error( + ::WeightInfo::call(), + FrameContracts::::bare_call( + sender, + contract, + value, + gas_limit, + storage_deposit_limit, + data, + false, + ), + ) + } + + /// Instantiates a contract using `code` as the WASM code blob. + fn base_instantiate_with_code( + origin: T::Origin, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, + code: Vec, + inst_data: Vec, + salt: Vec, + perms: Permissions, + ) -> DispatchResultWithPostInfo { + Self::general_instantiate( + origin, + endowment, + // Compute the base weight of roughly `base_instantiate`. + Self::weight_instantiate_with_code(&code, &salt, &perms), + gas_limit, + storage_deposit_limit, + Code::Upload(Bytes(code)), + inst_data, + salt, + perms, + ) + } + + /// Computes weight of `instantiate_with_code(code, salt, perms)`. + fn weight_instantiate_with_code(code: &[u8], salt: &[u8], perms: &Permissions) -> Weight { + ::WeightInfo::instantiate_with_code_bytes(&code, &salt).saturating_add( + ::WeightInfo::permissions_cost_perms(perms), + ) + } + + /// Instantiates a contract using an existing WASM code blob with `code_hash` as its code. + fn base_instantiate_with_hash( + origin: T::Origin, + endowment: Balance, + gas_limit: Weight, + storage_deposit_limit: Option, code_hash: CodeHash, - ) -> Result<(IdentityId, TemplateDetails>), DispatchError> { - // Ensure the transaction is signed and ensure `origin` has the required permission to - // execute the dispatchable. - let did = Identity::::ensure_perms(origin)?; - // Validate whether the template exists or not for a given code_hash. - ensure!( - >::contains_key(code_hash), - Error::::TemplateNotExists - ); + inst_data: Vec, + salt: Vec, + perms: Permissions, + ) -> DispatchResultWithPostInfo { + Self::general_instantiate( + origin, + endowment, + // Compute the base weight of roughly `base_instantiate`. + Self::weight_instantiate_with_hash(&salt, &perms), + gas_limit, + storage_deposit_limit, + Code::Existing(code_hash), + inst_data, + salt, + perms, + ) + } - // Access the meta details of SE template - let template_details = Self::get_template_details(code_hash); - // Ensure sender's DID is the owner of the template. - ensure!( - did == template_details.owner, - Error::::UnAuthorizedOrigin - ); - // Return the DID and the template details. - Ok((did, template_details)) + /// Computes weight of `instantiate_with_hash(code, salt, perms)`. + fn weight_instantiate_with_hash(salt: &[u8], perms: &Permissions) -> Weight { + ::WeightInfo::instantiate_with_hash_bytes(&salt).saturating_add( + ::WeightInfo::permissions_cost_perms(perms), + ) + } + + /// Upload new code without instantiating a contract from it. + fn base_upload_code( + origin: T::Origin, + code: Vec, + storage_deposit_limit: Option, + ) -> DispatchResult { + // Ensure contract caller has perms. + let sender = Identity::::ensure_origin_call_permissions(origin)?.sender; + FrameContracts::::bare_upload_code(sender, code, storage_deposit_limit.map(Into::into)) + .map(|_| ()) + } + + /// Remove the code stored under `code_hash` and refund the deposit to its owner. + fn base_remove_code(origin: T::Origin, code_hash: CodeHash) -> DispatchResultWithPostInfo { + // Ensure contract caller has perms. + Identity::::ensure_origin_call_permissions(origin.clone())?; + // Remove the contract code if the caller is the owner and the code is unused. + FrameContracts::::remove_code(origin, code_hash) } - fn get_primary_key(id: &IdentityId) -> T::AccountId { - Identity::::did_records(id).primary_key + /// General logic for contract instantiation both when the code or code hash is given. + /// + /// The interesting parameters here are: + /// - `base_weight` assigns a base non-variable weight to the full extrinsic. + /// - `code_hash` specifies the hash to use to derive the contract's key. + /// - `code` specifies the code for the contract, either as a code blob or an existing hash. + /// The hash of `code` in either case is assumed to correspond to `code_hash`. + fn general_instantiate( + origin: T::Origin, + endowment: Balance, + base_weight: Weight, + gas_limit: Weight, + storage_deposit_limit: Option, + code: Code>, + inst_data: Vec, + salt: Vec, + perms: Permissions, + ) -> DispatchResultWithPostInfo { + // Ensure we have perms + we'll need sender & DID. + let PermissionedCallOriginData { + primary_did: did, + sender, + .. + } = Identity::::ensure_origin_call_permissions(origin)?; + + with_transaction(|| { + // Roll back `prepare_instantiate` if contract was not instantiated. + Self::prepare_instantiate(did, &sender, &Self::code_hash(&code), &salt, perms)?; + + // Now we can finally instantiate the contract. + Self::handle_error( + base_weight, + FrameContracts::::bare_instantiate( + sender.clone(), + endowment, + gas_limit, + storage_deposit_limit, + code, + inst_data, + salt, + false, + ), + ) + }) + } + + /// Logic used by RPC to instantiate a contract `code`. + /// + /// N.B. on pre-instantiation errors, required and consumed gases will be zeroed. + pub fn rpc_instantiate( + sender: T::AccountId, + endowment: Balance, + gas_limit: u64, + storage_deposit_limit: Option, + code: Code>, + data: Vec, + salt: Vec, + ) -> ContractInstantiateResult { + match (|| { + // Ensure we have perms + we'll need DID. + let did = + pallet_permissions::Module::::ensure_call_permissions(&sender)?.primary_did; + + // Add a secondary key. Deployment contract code might need this. + let code_hash = Self::code_hash(&code); + Self::prepare_instantiate(did, &sender, &code_hash, &salt, Permissions::empty())?; + + Ok(FrameContracts::::bare_instantiate( + sender, + endowment, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + false, + )) + })() { + Ok(r) => r, + Err(e) => ContractResult { + debug_message: Vec::new(), + result: Err(e), + // Never entered contract execution, + // so no gas related to the limit has yet been consumed. + gas_consumed: 0, + gas_required: 0, + storage_deposit: Default::default(), + }, + } } - fn ext_details(code_hash: &CodeHash) -> ExtensionAttributes> { - let meta_info = Self::get_metadata_of(code_hash); - ExtensionAttributes { - usage_fee: meta_info.usage_fee, - version: meta_info.version, + /// Computes the code hash of `code`. + fn code_hash(code: &Code>) -> Cow<'_, CodeHash> { + match &code { + Code::Existing(h) => Cow::Borrowed(h), + Code::Upload(c) => Cow::Owned(T::Hashing::hash(c)), } } - fn base_set_put_code_flag(origin: T::Origin, is_enabled: bool) -> DispatchResult { - ensure_root(origin)?; - EnablePutCode::put(is_enabled); - Self::deposit_event(Event::::PutCodeFlagChanged(is_enabled)); + /// Prepare instantiation of a contract by trying to add it as a secondary key. + fn prepare_instantiate( + did: IdentityId, + sender: &T::AccountId, + code_hash: &T::Hash, + salt: &[u8], + perms: Permissions, + ) -> DispatchResult { + // Pre-compute what contract's key will be... + let contract_key = FrameContracts::::contract_address(sender, code_hash, salt); + + // ...and ensure that key can be a secondary-key of DID... + Identity::::ensure_perms_length_limited(&perms)?; + Identity::::ensure_key_did_unlinked(&contract_key)?; + + // ...so that the CDD due to `endowment` passes. + Identity::::unsafe_join_identity(did, perms, contract_key); Ok(()) } + + /// Enriches `result` of executing a smart contract with actual weight, + /// accounting for the consumed gas. + fn handle_error( + base_weight: Weight, + result: ContractResult, Balance>, + ) -> DispatchResultWithPostInfo { + let post_info = Some(result.gas_consumed.saturating_add(base_weight)).into(); + match result.result { + Ok(_) => Ok(post_info), + Err(error) => Err(DispatchErrorWithPostInfo { post_info, error }), + } + } +} + +/// The `Call` enums of various pallets that the contracts pallet wants to know about. +pub enum CommonCall +where + T: Config + pallet_asset::Config, +{ + Asset(pallet_asset::Call), + Contracts(Call), +} + +/// An encoding of `func_id` into the encoding `0x_S_P_E_V`, +/// with each letter being a byte. +#[derive(Clone, Copy, Debug)] +struct FuncId { + /// Decides the version of the `extrinsic`. + version: u8, + /// Decides the `extrinsic` within the `pallet`. + /// This isn't necessarily the same as the index within the pallet. + extrinsic: u8, + /// Decides the `pallet` within the runtime. + /// This isn't necessarily the same as the index within the runtime. + pallet: u8, + /// Decides the scheme to use when interpreting `(extrinsic, pallet, version)`. + scheme: u8, +} + +/// Splits the `func_id` given from a smart contract into +/// the encoding `(scheme: u8, pallet: u8, extrinsic: u8, version: u8)`. +fn split_func_id(func_id: u32) -> FuncId { + let extract = |which| (func_id >> which * 8) as u8; + FuncId { + version: extract(0), + extrinsic: extract(1), + pallet: extract(2), + scheme: extract(3), + } +} + +/// Returns the `contract`'s DID or errors. +fn contract_did(contract: &T::AccountId) -> Result { + // N.B. it might be the case that the contract is a primary key due to rotation. + Ok(Identity::::get_identity(&contract).ok_or(Error::::InstantiatorWithNoIdentity)?) +} + +/// Run `with` while the current DID is temporarily set to the given one. +fn with_did_as_current R, R>(did: IdentityId, with: W) -> R { + let old_did = Context::current_identity::>(); + Context::set_current_identity::>(Some(did)); + let result = with(); + Context::set_current_identity::>(old_did); + result } -impl ContractsFn> for Module +/// Ensure that `input.is_empty()` or error. +fn ensure_consumed(input: &[u8]) -> DispatchResult { + ensure!(input.is_empty(), Error::::DataLeftAfterDecoding); + Ok(()) +} + +/// Advance `input` and decode a `V` from it, or error. +fn decode(input: &mut &[u8]) -> Result { + <_>::decode(input).map_err(|_| pallet_contracts::Error::::DecodingFailed.into()) +} + +/// Constructs a call description from a `func_id` and associated `input`. +fn construct_call(func_id: FuncId, input: &mut &[u8]) -> Result, DispatchError> where - T::AccountId: UncheckedFrom + AsRef<[u8]>, + T: Config + pallet_asset::Config, { - fn extension_info(acc: T::AccountId) -> ExtensionAttributes> { - Self::extension_info(acc) + /// Decode type from `input`. + macro_rules! decode { + () => { + decode::<_, T>(input)? + }; + } + + /// Pattern match on functions `0x00_pp_ee_00`. + macro_rules! on { + ($p:pat, $e:pat) => { + FuncId { + scheme: 0, + pallet: $p, + extrinsic: $e, + version: 0, + } + }; + } + + Ok(match func_id { + on!(0, 0) => CommonCall::Contracts(Call::call { + contract: decode!(), + value: decode!(), + gas_limit: decode!(), + storage_deposit_limit: decode!(), + data: decode!(), + }), + on!(0, 1) => CommonCall::Contracts(Call::instantiate_with_code { + endowment: decode!(), + gas_limit: decode!(), + storage_deposit_limit: decode!(), + code: decode!(), + data: decode!(), + salt: decode!(), + }), + on!(0, 2) => CommonCall::Contracts(Call::instantiate_with_code_perms { + endowment: decode!(), + gas_limit: decode!(), + storage_deposit_limit: decode!(), + code: decode!(), + data: decode!(), + salt: decode!(), + perms: decode!(), + }), + on!(0, 3) => CommonCall::Contracts(Call::instantiate { + endowment: decode!(), + gas_limit: decode!(), + storage_deposit_limit: decode!(), + code_hash: decode!(), + data: decode!(), + salt: decode!(), + }), + on!(0, 4) => CommonCall::Contracts(Call::instantiate_with_hash_perms { + endowment: decode!(), + gas_limit: decode!(), + storage_deposit_limit: decode!(), + code_hash: decode!(), + data: decode!(), + salt: decode!(), + perms: decode!(), + }), + on!(1, 0) => CommonCall::Asset(pallet_asset::Call::register_ticker { ticker: decode!() }), + on!(1, 1) => { + CommonCall::Asset(pallet_asset::Call::accept_ticker_transfer { auth_id: decode!() }) + } + on!(1, 2) => CommonCall::Asset(pallet_asset::Call::accept_asset_ownership_transfer { + auth_id: decode!(), + }), + on!(1, 3) => CommonCall::Asset(pallet_asset::Call::create_asset { + name: decode!(), + ticker: decode!(), + divisible: decode!(), + asset_type: decode!(), + identifiers: decode!(), + funding_round: decode!(), + disable_iu: decode!(), + }), + on!(1, 0x11) => { + CommonCall::Asset(pallet_asset::Call::register_custom_asset_type { ty: decode!() }) + } + _ => return Err(Error::::RuntimeCallNotFound.into()), + }) +} + +/// Prepare for the instantiation of a contract as a chain extension. +/// +/// The `sender` is expected to be the smart contract's address, +/// from which the DID-to-attach-to is derived. +/// The `input` contains all the data needed for instantiation. +fn prepare_instantiate_ce( + input: &mut &[u8], + sender: T::AccountId, +) -> ce::Result { + // Decode the hash, salt, and permissions. + let (code_hash, salt, perms): (_, Vec, _) = decode::<_, T>(input)?; + ensure_consumed::(input)?; + + // The DID is that of `sender`. + let did = contract_did::(&sender)?; + + // Now that we've got all the data we need, instantiate! + Module::::prepare_instantiate(did, &sender, &code_hash, &salt, perms)?; + + // Done; continue with smart contract execution when returning. + Ok(ce::RetVal::Converging(0)) +} + +/// A chain extension allowing calls to polymesh pallets +/// and using the contract's DID instead of the caller's DID. +impl ce::ChainExtension for Module +where + ::Call: From> + GetDispatchInfo, + T: Config + pallet_asset::Config, +{ + fn enabled() -> bool { + true + } + + fn call>( + func_id: u32, + env: ce::Environment, + ) -> ce::Result { + // Used for benchmarking `chain_extension_early_exit`, + // so we can remove the cost of the call + overhead of using any chain extension. + // That is, we want to subtract costs not directly arising from *this* function body. + // Caveat: This `if` imposes a minor cost during benchmarking but we'll live with that. + #[cfg(feature = "runtime-benchmarks")] + if func_id == 0 { + return Ok(ce::RetVal::Converging(0)); + } + + let mut env = env.buf_in_buf_out(); + + // Limit `in_len` to a maximum. + let in_len = env.in_len(); + ensure!( + in_len <= ::MaxInLen::get(), + Error::::InLenTooLarge + ); + + // Special case: we provide a "prepare_instantiate" "runtime function" + // that will add a secondary key with the address of the contract + // to the running contract's identity. + let func_id = split_func_id(func_id); + let addr = env.ext().address().clone(); + if let FuncId { + scheme: 0xFF, + version: 0, + pallet: 0, + extrinsic: 0, + } = func_id + { + // Charge weight, read input, and run the logic to add a secondary key. + env.charge_weight(::WeightInfo::prepare_instantiate(in_len))?; + let input = &mut &*env.read(in_len)?; + return prepare_instantiate_ce::(input, addr); + } + + // Charge weight as a linear function of `in_len`. + env.charge_weight(::WeightInfo::chain_extension(in_len))?; + + // Decide what to call in the runtime. + let input = &mut &*env.read(in_len)?; + let call: ::Call = construct_call::(func_id, input)?.into(); + ensure_consumed::(input)?; + + // Charge weight for the call. + let di = call.get_dispatch_info(); + let charged_amount = env.charge_weight(di.weight)?; + + // Execute call requested by contract, with current DID set to the contract owner. + let result = with_did_as_current::(contract_did::(&addr)?, || { + with_call_metadata(call.get_call_metadata(), || { + // Dispatch the call, avoiding use of `ext.call_runtime()`, + // as that uses `CallFilter = Nothing`, which would case a problem for us. + call.dispatch(RawOrigin::Signed(addr).into()) + }) + }); + + // Refund unspent weight. + let post_di = result.unwrap_or_else(|e| e.post_info); + // This check isn't necessary but avoids some work. + if post_di.actual_weight.is_some() { + let actual_weight = post_di.calc_actual_weight(&di); + env.adjust_weight(charged_amount, actual_weight); + } + + // Ensure the call was successful. + result.map_err(|e| e.error)?; + + // Done; continue with smart contract execution when returning. + Ok(ce::RetVal::Converging(0)) } } diff --git a/pallets/corporate-actions/Cargo.toml b/pallets/corporate-actions/Cargo.toml index db48d620e5..72333d2749 100644 --- a/pallets/corporate-actions/Cargo.toml +++ b/pallets/corporate-actions/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-corporate-actions" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -23,19 +23,20 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } pallet-compliance-manager = { path = "../compliance-manager", default-features = false, optional = true } diff --git a/pallets/corporate-actions/src/ballot/mod.rs b/pallets/corporate-actions/src/ballot/mod.rs index 835aad5a7c..42784f525b 100644 --- a/pallets/corporate-actions/src/ballot/mod.rs +++ b/pallets/corporate-actions/src/ballot/mod.rs @@ -95,6 +95,7 @@ use pallet_identity as identity; use polymesh_common_utilities::protocol_fee::{ChargeProtocolFee, ProtocolOp}; use polymesh_primitives::{Balance, EventDid, IdentityId, Moment}; use polymesh_primitives_derive::VecU8StrongTyped; +use scale_info::TypeInfo; use sp_runtime::traits::Zero; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; @@ -107,22 +108,25 @@ type ExternalAgents = pallet_external_agents::Module; /// A wrapper for a motion title. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, VecU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)] pub struct MotionTitle(pub Vec); /// A wrapper for a motion info link. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, VecU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)] pub struct MotionInfoLink(pub Vec); /// A wrapper for a choice's title. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Hash, Default, Debug, Decode, Encode, VecU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, PartialEq, Eq, Hash, Default, Debug)] pub struct ChoiceTitle(pub Vec); /// Details about motions #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Default, Debug, Encode, Decode)] +#[derive(Clone, PartialEq, Eq, Default, Debug, Encode, Decode, TypeInfo)] pub struct Motion { /// Title of the motion pub title: MotionTitle, @@ -137,7 +141,8 @@ pub struct Motion { /// A wrapper for a ballot's title. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Hash, Debug, Default, Decode, Encode, VecU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, PartialEq, Eq, Hash, Debug, Default)] pub struct BallotTitle(pub Vec); /// Metadata about a ballot. @@ -148,7 +153,7 @@ pub struct BallotTitle(pub Vec); /// the needed numbers aforementioned are cached away, /// and the metadata is not read on-chain again. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, Default)] +#[derive(Clone, PartialEq, Eq, Debug, Encode, TypeInfo, Decode, Default)] pub struct BallotMeta { /// The ballot's title. pub title: BallotTitle, @@ -167,7 +172,7 @@ impl BallotMeta { /// Timestamp range details about vote start / end. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Default, Debug, Encode, Decode)] +#[derive(Copy, Clone, PartialEq, Eq, Default, Debug, Encode, Decode, TypeInfo)] pub struct BallotTimeRange { /// Timestamp at which voting starts. pub start: Moment, @@ -178,7 +183,7 @@ pub struct BallotTimeRange { /// A vote cast on some choice in some motion in a ballot. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Default, Debug, Encode, Decode)] +#[derive(Copy, Clone, PartialEq, Eq, Default, Debug, Encode, Decode, TypeInfo)] pub struct BallotVote { /// The weight / voting power assigned to this vote. pub power: Balance, diff --git a/pallets/corporate-actions/src/distribution/mod.rs b/pallets/corporate-actions/src/distribution/mod.rs index 920926b065..06b746d33b 100644 --- a/pallets/corporate-actions/src/distribution/mod.rs +++ b/pallets/corporate-actions/src/distribution/mod.rs @@ -84,8 +84,10 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::{ storage_migration_ver, Balance, EventDid, IdentityId, Moment, PortfolioId, PortfolioNumber, - Ticker, + SecondaryKey, Ticker, }; +use scale_info::TypeInfo; +use sp_runtime::traits::Zero; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; use sp_std::prelude::*; @@ -104,7 +106,7 @@ pub const PER_SHARE_PRECISION: Balance = 1_000_000; /// /// All information contained is used by on-chain logic. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo)] pub struct Distribution { /// The portfolio to distribute from. pub from: PortfolioId, @@ -193,7 +195,6 @@ decl_module! { /// /// # Errors /// - `UnauthorizedAgent` if `origin` is not agent-permissioned for `ticker`. - /// - `DistributingAsset` if `ca_id.ticker == currency`. /// - `ExpiryBeforePayment` if `expires_at.unwrap() <= payment_at`. /// - `NoSuchCA` if `ca_id` does not identify an existing CA. /// - `NoRecordDate` if CA has no record date. @@ -202,6 +203,8 @@ decl_module! { /// - `InsufficientPortfolioBalance` if `portfolio` has less than `amount` of `currency`. /// - `InsufficientBalance` if the protocol fee couldn't be charged. /// - `CANotBenefit` if the CA is not of kind PredictableBenefit/UnpredictableBenefit + /// - `DistributionAmountIsZero` if the `amount` is zero. + /// - `DistributionPerShareIsZero` if the `per_share` is zero. /// /// # Permissions /// * Asset @@ -216,62 +219,17 @@ decl_module! { amount: Balance, payment_at: Moment, expires_at: Option, - ) { - // Ensure CA's asset is distinct from the distributed currency. - ensure!(ca_id.ticker != currency, Error::::DistributingAsset); - - // Ensure that any expiry date doesn't come before the payment date. - ensure!(!expired(expires_at, payment_at), Error::::ExpiryBeforePayment); - - // Ensure CA doesn't have a distribution yet. - ensure!(!Distributions::contains_key(ca_id), Error::::AlreadyExists); - - // Ensure origin is a permissioned agent and that they have custody over `from`. - // Also ensure secondary key has perms for `from` + portfolio is valid. - let PermissionedCallOriginData { - primary_did: agent, - secondary_key, - .. - } = >::ensure_agent_asset_perms(origin, ca_id.ticker)?; - let from = PortfolioId { did: agent, kind: portfolio.into() }; - >::ensure_portfolio_custody_and_permission(from, agent, secondary_key.as_ref())?; - >::ensure_portfolio_validity(&from)?; - - // Ensure that `ca_id` exists, that its a benefit. - let agent = agent.for_event(); - let ca = >::ensure_ca_exists(ca_id)?; - ensure!(ca.kind.is_benefit(), Error::::CANotBenefit); - - // Ensure CA has a record `date <= payment_at`. - // If we cannot, deriving a checkpoint, - // used to determine each holder's allotment of the total `amount`, - // is not possible. - >::ensure_record_date_before_start(&ca, payment_at)?; - - // Ensure `from` has at least `amount` to later lock (1). - >::ensure_sufficient_balance(&from, ¤cy, amount)?; - - // Charge the protocol fee. Last check; we are in commit phase after this. - T::ProtocolFee::charge_fee(ProtocolOp::CapitalDistributionDistribute)?; - - // (1) Lock `amount` in `from`. - >::unchecked_lock_tokens(&from, ¤cy, amount); - - // Commit to storage. - let distribution = Distribution { - from, + ) -> DispatchResult { + Self::base_distribute( + origin, + ca_id, + portfolio, currency, per_share, amount, - remaining: amount, - reclaimed: false, payment_at, expires_at, - }; - Distributions::insert(ca_id, distribution); - - // Emit event. - Self::deposit_event(Event::Created(agent, ca_id, distribution)); + ) } /// Claim a benefit of the capital distribution attached to `ca_id`. @@ -299,8 +257,7 @@ decl_module! { /// - Other errors can occur if the compliance manager rejects the transfer. #[weight = ::DistWeightInfo::claim(T::MaxTargetIds::get(), T::MaxDidWhts::get())] pub fn claim(origin, ca_id: CAId) { - let did = >::ensure_perms(origin)?; - Self::transfer_benefit(did.for_event(), did, ca_id)?; + Self::base_claim(origin, ca_id)?; } /// Push benefit of an ongoing distribution to the given `holder`. @@ -329,8 +286,7 @@ decl_module! { /// - Other errors can occur if the compliance manager rejects the transfer. #[weight = ::DistWeightInfo::push_benefit(T::MaxTargetIds::get(), T::MaxDidWhts::get())] pub fn push_benefit(origin, ca_id: CAId, holder: IdentityId) { - let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); - Self::transfer_benefit(agent, holder, ca_id)?; + Self::base_push_benefit(origin, ca_id, holder)?; } /// Assuming a distribution has expired, @@ -346,27 +302,7 @@ decl_module! { /// - `NotExpired` if `now < expiry`. #[weight = ::DistWeightInfo::reclaim()] pub fn reclaim(origin, ca_id: CAId) { - // Ensure distribution is created, they haven't reclaimed, and that expiry has passed. - // CA must be authorized and be the custodian. - let PermissionedCallOriginData { - primary_did: agent, - secondary_key, - .. - } = >::ensure_agent_asset_perms(origin.clone(), ca_id.ticker)?; - let dist = Self::ensure_distribution_exists(ca_id)?; - ensure!(!dist.reclaimed, Error::::AlreadyReclaimed); - ensure!(expired(dist.expires_at, >::now_unix()), Error::::NotExpired); - >::ensure_portfolio_custody_and_permission(dist.from, agent, secondary_key.as_ref())?; - - // Unlock `remaining` of `currency` from DID's portfolio. - // This won't fail, as we've already locked the requisite amount prior. - Self::unlock(&dist, dist.remaining)?; - - // Zero `remaining` + note that we've reclaimed. - Distributions::insert(ca_id, Distribution { reclaimed: true, remaining:0u32.into(), ..dist }); - - // Emit event. - Self::deposit_event(Event::Reclaimed(agent.for_event(), ca_id, dist.remaining)); + Self::base_reclaim(origin, ca_id)?; } /// Removes a distribution that hasn't started yet, @@ -382,9 +318,7 @@ decl_module! { /// - `DistributionStarted` if `payment_at <= now`. #[weight = ::DistWeightInfo::remove_distribution()] pub fn remove_distribution(origin, ca_id: CAId) { - let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); - let dist = Self::ensure_distribution_exists(ca_id)?; - Self::remove_distribution_base(agent, ca_id, &dist)?; + Self::base_remove_distribution(origin, ca_id)?; } } } @@ -423,9 +357,6 @@ decl_error! { /// A distributions provided expiry date was strictly before its payment date. /// In other words, everything to distribute would immediately be forfeited. ExpiryBeforePayment, - /// Currency that is distributed is the same as the CA's ticker. - /// Calling agent is attempting a form of stock split, which is not what the extrinsic is for. - DistributingAsset, /// The token holder has already been paid their benefit. HolderAlreadyPaid, /// A capital distribution doesn't exist for this CA. @@ -446,12 +377,107 @@ decl_error! { DistributionStarted, /// A distribution has insufficient remaining amount of currency to distribute. InsufficientRemainingAmount, + /// Distribution `amount` cannot be zero. + DistributionAmountIsZero, + /// Distribution `per_share` cannot be zero. + DistributionPerShareIsZero, } } impl Module { + fn base_distribute( + origin: T::Origin, + ca_id: CAId, + portfolio: Option, + currency: Ticker, + per_share: Balance, + amount: Balance, + payment_at: Moment, + expires_at: Option, + ) -> DispatchResult { + let PermissionedCallOriginData { + primary_did: agent, + secondary_key, + .. + } = >::ensure_agent_asset_perms(origin, ca_id.ticker)?; + + Self::unverified_distribute( + agent, + secondary_key, + ca_id, + portfolio, + currency, + per_share, + amount, + payment_at, + expires_at, + ) + } + + fn base_claim(origin: T::Origin, ca_id: CAId) -> DispatchResult { + let did = >::ensure_perms(origin)?; + Self::transfer_benefit(did.for_event(), did, ca_id)?; + Ok(()) + } + + fn base_push_benefit(origin: T::Origin, ca_id: CAId, holder: IdentityId) -> DispatchResult { + let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); + Self::transfer_benefit(agent, holder, ca_id)?; + Ok(()) + } + + fn base_reclaim(origin: T::Origin, ca_id: CAId) -> DispatchResult { + // Ensure distribution is created, they haven't reclaimed, and that expiry has passed. + // CA must be authorized and be the custodian. + let PermissionedCallOriginData { + primary_did: agent, + secondary_key, + .. + } = >::ensure_agent_asset_perms(origin.clone(), ca_id.ticker)?; + let dist = Self::ensure_distribution_exists(ca_id)?; + ensure!(!dist.reclaimed, Error::::AlreadyReclaimed); + ensure!( + expired(dist.expires_at, >::now_unix()), + Error::::NotExpired + ); + >::ensure_portfolio_custody_and_permission( + dist.from, + agent, + secondary_key.as_ref(), + )?; + + // Unlock `remaining` of `currency` from DID's portfolio. + // This won't fail, as we've already locked the requisite amount prior. + Self::unlock(&dist, dist.remaining)?; + + // Zero `remaining` + note that we've reclaimed. + Distributions::insert( + ca_id, + Distribution { + reclaimed: true, + remaining: 0u32.into(), + ..dist + }, + ); + + // Emit event. + Self::deposit_event(Event::Reclaimed(agent.for_event(), ca_id, dist.remaining)); + + Ok(()) + } + + fn base_remove_distribution(origin: T::Origin, ca_id: CAId) -> DispatchResult { + let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); + let dist = Self::ensure_distribution_exists(ca_id)?; + Self::unverified_remove_distribution(agent, ca_id, &dist)?; + + Ok(()) + } + /// Kill the distribution identified by `ca_id`. - crate fn remove_distribution_base( + /// + /// Unlike `base_remove_distribution`, this won't check permissions and that the dist exists. + crate fn unverified_remove_distribution( agent: EventDid, ca_id: CAId, dist: &Distribution, @@ -571,4 +597,85 @@ impl Module { ); Ok(dist) } + + /// Create a capital distribution. + /// + /// Unlike `base_distribute`, this won't check permissions. + crate fn unverified_distribute( + agent: IdentityId, + secondary_key: Option>, + ca_id: CAId, + portfolio: Option, + currency: Ticker, + per_share: Balance, + amount: Balance, + payment_at: Moment, + expires_at: Option, + ) -> DispatchResult { + // Ensure valid `amount` and `per_share`. + ensure!(!amount.is_zero(), Error::::DistributionAmountIsZero); + ensure!(!per_share.is_zero(), Error::::DistributionPerShareIsZero); + + // Ensure that any expiry date doesn't come before the payment date. + ensure!( + !expired(expires_at, payment_at), + Error::::ExpiryBeforePayment + ); + + // Ensure CA doesn't have a distribution yet. + ensure!( + !Distributions::contains_key(ca_id), + Error::::AlreadyExists + ); + + // Ensure secondary key has perms for `from` + portfolio is valid. + let from = PortfolioId { + did: agent, + kind: portfolio.into(), + }; + >::ensure_portfolio_custody_and_permission( + from, + agent, + secondary_key.as_ref(), + )?; + >::ensure_portfolio_validity(&from)?; + + // Ensure that `ca_id` exists, that its a benefit. + let agent = agent.for_event(); + let ca = >::ensure_ca_exists(ca_id)?; + ensure!(ca.kind.is_benefit(), Error::::CANotBenefit); + + // Ensure CA has a record `date <= payment_at`. + // If we cannot, deriving a checkpoint, + // used to determine each holder's allotment of the total `amount`, + // is not possible. + >::ensure_record_date_before_start(&ca, payment_at)?; + + // Ensure `from` has at least `amount` to later lock (1). + >::ensure_sufficient_balance(&from, ¤cy, amount)?; + + // Charge the protocol fee. Last check; we are in commit phase after this. + T::ProtocolFee::charge_fee(ProtocolOp::CapitalDistributionDistribute)?; + + // (1) Lock `amount` in `from`. + >::unchecked_lock_tokens(&from, ¤cy, amount); + + // Commit to storage. + let distribution = Distribution { + from, + currency, + per_share, + amount, + remaining: amount, + reclaimed: false, + payment_at, + expires_at, + }; + Distributions::insert(ca_id, distribution); + + // Emit event. + Self::deposit_event(Event::Created(agent, ca_id, distribution)); + + Ok(()) + } } diff --git a/pallets/corporate-actions/src/lib.rs b/pallets/corporate-actions/src/lib.rs index b771facd89..c5be4ebdd1 100644 --- a/pallets/corporate-actions/src/lib.rs +++ b/pallets/corporate-actions/src/lib.rs @@ -84,7 +84,6 @@ //! - `remove_ca(origin, id)` removes the CA identified by `id`. #![cfg_attr(not(feature = "std"), no_std)] -#![feature(bool_to_option)] #![feature(crate_visibility_modifier)] #![feature(const_option)] @@ -95,7 +94,7 @@ pub mod ballot; pub mod distribution; use codec::{Decode, Encode}; -use core::convert::TryInto; +use distribution::WeightInfo as DistWeightInfoTrait; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult}, @@ -106,15 +105,17 @@ use frame_support::{ use frame_system::ensure_root; use pallet_asset::checkpoint::{self, SchedulePoints, ScheduleRefCount}; use pallet_base::try_next_post; +use pallet_identity::PermissionedCallOriginData; use polymesh_common_utilities::{ balances::Config as BalancesConfig, identity::Config as IdentityConfig, traits::asset, traits::checkpoint::ScheduleId, with_transaction, GC_DID, }; use polymesh_primitives::{ calendar::CheckpointId, impl_checked_inc, storage_migration_ver, Balance, DocumentId, EventDid, - IdentityId, Moment, Ticker, + IdentityId, Moment, PortfolioNumber, Ticker, }; use polymesh_primitives_derive::VecU8StrongTyped; +use scale_info::TypeInfo; use sp_arithmetic::Permill; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; @@ -125,7 +126,7 @@ pub type Tax = Permill; /// How should `identities` in `TargetIdentities` be used? #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub enum TargetTreatment { /// Only those identities should be included. Include, @@ -152,7 +153,7 @@ impl TargetTreatment { /// A description of which identities that a CA will apply to. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Encode, Decode, Default, Debug)] +#[derive(Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Default, Debug)] pub struct TargetIdentities { /// The specified identities either relevant or irrelevant, depending on `treatment`, for CAs. pub identities: Vec, @@ -178,7 +179,7 @@ impl TargetIdentities { /// The kind of a `CorporateAction`. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub enum CAKind { /// A predictable benefit. /// These are known at the time the asset is created. @@ -210,12 +211,13 @@ impl CAKind { } #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Encode, Decode, Default, Debug, VecU8StrongTyped)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, PartialEq, Eq, Default, Debug)] pub struct CADetails(pub Vec); /// Defines how to identify a CA's associated checkpoint, if any. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub enum CACheckpoint { /// CA uses a record date scheduled to occur in the future. /// Checkpoint ID will be taken after the record date. @@ -231,7 +233,7 @@ pub enum CACheckpoint { /// Defines the record date, at which impact should be calculated, /// along with checkpoint info to assess the impact at the date. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub struct RecordDate { /// When the impact should be calculated, or already has. pub date: Moment, @@ -241,7 +243,7 @@ pub struct RecordDate { /// Input specification of the record date used to derive impact for a CA. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub enum RecordDateSpec { /// Record date is in the future. /// A checkpoint should be created. @@ -255,7 +257,7 @@ pub enum RecordDateSpec { /// Details of a generic CA. /// The `(Ticker, ID)` denoting a unique identifier for the CA is stored as a key outside. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub struct CorporateAction { /// The kind of CA that this is. pub kind: CAKind, @@ -287,13 +289,13 @@ impl CorporateAction { /// By *local*, we mean that the same number might be used for a different `Ticker` /// to uniquely identify a different CA. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Default, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Default, Debug)] pub struct LocalCAId(pub u32); impl_checked_inc!(LocalCAId); /// A unique global identifier for a CA. #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] pub struct CAId { /// The `Ticker` component used to disambiguate the `local` one. pub ticker: Ticker, @@ -301,6 +303,19 @@ pub struct CAId { pub local_id: LocalCAId, } +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive(Clone, PartialEq, Eq, Encode, Decode, TypeInfo, Debug)] +pub struct InitiateCorporateActionArgs { + ticker: Ticker, + kind: CAKind, + decl_date: Moment, + record_date: Option, + details: CADetails, + targets: Option, + default_withholding_tax: Option, + withholding_tax: Option>, +} + /// Weight abstraction for the corporate actions module. pub trait WeightInfo { fn set_max_details_length() -> Weight; @@ -541,15 +556,7 @@ decl_module! { /// /// # Permissions /// * Asset - #[weight = ::WeightInfo::initiate_corporate_action_use_defaults( - T::MaxDidWhts::get(), - T::MaxTargetIds::get(), - ) - .max(::WeightInfo::initiate_corporate_action_provided( - withholding_tax.as_ref().map_or(0, |whts| whts.len() as u32), - targets.as_ref().map_or(0, |t| t.identities.len() as u32), - )) - ] + #[weight = initiate_corporate_action_weight::(targets, withholding_tax)] pub fn initiate_corporate_action( origin, ticker: Ticker, @@ -560,77 +567,21 @@ decl_module! { targets: Option, default_withholding_tax: Option, withholding_tax: Option>, - ) { - // Ensure that `details` is short enough. - details - .len() - .try_into() - .ok() - .filter(|&len: &u32| len <= Self::max_details_length()) - .ok_or(Error::::DetailsTooLong)?; - + ) -> DispatchResult { // Ensure that a permissioned agent is calling. let agent = >::ensure_perms(origin, ticker)?.for_event(); - // Ensure that the next local CA ID doesn't overflow. - let mut next_id = CAIdSequence::get(ticker); - let local_id = try_next_post::(&mut next_id)?; - let id = CAId { ticker, local_id }; - - // Ensure there are no duplicates in withholding tax overrides - // and that we're within the limit. - let mut withholding_tax = withholding_tax; - if let Some(wt) = &mut withholding_tax { - let before = wt.len(); - Self::ensure_did_whts_limited(before)?; - wt.sort_unstable_by_key(|&(did, _)| did); - wt.dedup_by_key(|&mut (did, _)| did); - ensure!(before == wt.len(), Error::::DuplicateDidTax); - } - - // Ensure target ids are limited in number if provided. - if let Some(ref targets) = targets { - Self::ensure_target_ids_limited(targets)?; - } - - // Declaration date must be <= now. - ensure!(decl_date <= >::now_unix(), Error::::DeclDateInFuture); - - // If provided, either use the existing CP ID or schedule one to be made. - let record_date = record_date - .map(|date| with_transaction(|| -> Result<_, DispatchError> { - let rd = Self::handle_record_date(agent, ticker, date)?; - ensure!(decl_date <= rd.date, Error::::DeclDateAfterRecordDate); - Ok(rd) - })) - .transpose()?; - - // Commit the next local CA ID. - CAIdSequence::insert(ticker, next_id); - - // Use asset level defaults if data not provided here. - let targets = targets - .map(|t| t.dedup()) - .unwrap_or_else(|| Self::default_target_identities(ticker)); - let default_withholding_tax = default_withholding_tax - .unwrap_or_else(|| Self::default_withholding_tax(ticker)); - let withholding_tax = withholding_tax - .unwrap_or_else(|| Self::did_withholding_tax(ticker)); - - // Commit CA to storage. - let ca = CorporateAction { + Self::unsafe_initiate_corporate_action( + agent, + ticker, kind, decl_date, record_date, + details, targets, default_withholding_tax, withholding_tax, - }; - CorporateActions::insert(ticker, id.local_id, ca.clone()); - Details::insert(id, details.clone()); - - // Emit event. - Self::deposit_event(Event::CAInitiated(agent, id, ca, details)); + ).map(drop) } /// Link the given CA `id` to the given `docs`. @@ -700,7 +651,7 @@ decl_module! { } CAKind::PredictableBenefit | CAKind::UnpredictableBenefit => { if let Some(dist) = >::distributions(ca_id) { - >::remove_distribution_base(agent, ca_id, &dist)?; + >::unverified_remove_distribution(agent, ca_id, &dist)?; } } } @@ -765,6 +716,63 @@ decl_module! { CorporateActions::insert(ca_id.ticker, ca_id.local_id, ca.clone()); Self::deposit_event(Event::RecordDateChanged(agent, ca_id, ca)); } + + /// Utility extrinsic to batch `initiate_corporate_action` and `distribute` + #[weight = initiate_corporate_action_weight::(&ca_args.targets, &ca_args.withholding_tax) + .saturating_add(::DistWeightInfo::distribute())] + pub fn initiate_corporate_action_and_distribute( + origin, + ca_args: InitiateCorporateActionArgs, + portfolio: Option, + currency: Ticker, + per_share: Balance, + amount: Balance, + payment_at: Moment, + expires_at: Option, + ) -> DispatchResult { + let InitiateCorporateActionArgs { + ticker, + kind, + decl_date, + record_date, + details, + targets, + default_withholding_tax, + withholding_tax + } = ca_args; + + let PermissionedCallOriginData { + primary_did: agent, + secondary_key, + .. + } = >::ensure_agent_asset_perms(origin, ticker)?; + + with_transaction(|| { + let ca_id = Self::unsafe_initiate_corporate_action( + agent.for_event(), + ticker, + kind, + decl_date, + record_date, + details, + targets, + default_withholding_tax, + withholding_tax + )?; + + >::unverified_distribute( + agent, + secondary_key, + ca_id, + portfolio, + currency, + per_share, + amount, + payment_at, + expires_at, + ) + }) + } } } @@ -832,6 +840,89 @@ decl_error! { } impl Module { + fn unsafe_initiate_corporate_action( + agent: EventDid, + ticker: Ticker, + kind: CAKind, + decl_date: Moment, + record_date: Option, + details: CADetails, + targets: Option, + default_withholding_tax: Option, + withholding_tax: Option>, + ) -> Result { + // Ensure that `details` is short enough. + ensure!( + details.len() <= Self::max_details_length() as usize, + Error::::DetailsTooLong + ); + + // Ensure that the next local CA ID doesn't overflow. + let mut next_id = CAIdSequence::get(ticker); + let local_id = try_next_post::(&mut next_id)?; + let id = CAId { ticker, local_id }; + + // Ensure there are no duplicates in withholding tax overrides + // and that we're within the limit. + let mut withholding_tax = withholding_tax; + if let Some(wt) = &mut withholding_tax { + let before = wt.len(); + Self::ensure_did_whts_limited(before)?; + wt.sort_unstable_by_key(|&(did, _)| did); + wt.dedup_by_key(|&mut (did, _)| did); + ensure!(before == wt.len(), Error::::DuplicateDidTax); + } + + // Ensure target ids are limited in number if provided. + if let Some(ref targets) = targets { + Self::ensure_target_ids_limited(targets)?; + } + + // Declaration date must be <= now. + ensure!( + decl_date <= >::now_unix(), + Error::::DeclDateInFuture + ); + + // If provided, either use the existing CP ID or schedule one to be made. + let record_date = record_date + .map(|date| { + with_transaction(|| -> Result<_, DispatchError> { + let rd = Self::handle_record_date(agent, ticker, date)?; + ensure!(decl_date <= rd.date, Error::::DeclDateAfterRecordDate); + Ok(rd) + }) + }) + .transpose()?; + + // Commit the next local CA ID. + CAIdSequence::insert(ticker, next_id); + + // Use asset level defaults if data not provided here. + let targets = targets + .map(|t| t.dedup()) + .unwrap_or_else(|| Self::default_target_identities(ticker)); + let default_withholding_tax = + default_withholding_tax.unwrap_or_else(|| Self::default_withholding_tax(ticker)); + let withholding_tax = withholding_tax.unwrap_or_else(|| Self::did_withholding_tax(ticker)); + + // Commit CA to storage. + let ca = CorporateAction { + kind, + decl_date, + record_date, + targets, + default_withholding_tax, + withholding_tax, + }; + CorporateActions::insert(ticker, id.local_id, ca.clone()); + Details::insert(id, details.clone()); + + // Emit event. + Self::deposit_event(Event::CAInitiated(agent, id, ca, details)); + Ok(id) + } + /// Ensure number of identities in `TargetIdentities` are limited. fn ensure_target_ids_limited(targets: &TargetIdentities) -> DispatchResult { ensure!( @@ -956,3 +1047,19 @@ impl Module { CorporateActions::get(id.ticker, id.local_id).ok_or_else(|| Error::::NoSuchCA.into()) } } + +fn initiate_corporate_action_weight( + targets: &Option, + withholding_tax: &Option>, +) -> Weight { + ::WeightInfo::initiate_corporate_action_use_defaults( + T::MaxDidWhts::get(), + T::MaxTargetIds::get(), + ) + .max( + ::WeightInfo::initiate_corporate_action_provided( + withholding_tax.as_ref().map_or(0, |whts| whts.len() as u32), + targets.as_ref().map_or(0, |t| t.identities.len() as u32), + ), + ) +} diff --git a/pallets/external-agents/Cargo.toml b/pallets/external-agents/Cargo.toml index 5c87b689bd..1fa4543637 100644 --- a/pallets/external-agents/Cargo.toml +++ b/pallets/external-agents/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-external-agents" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -20,13 +20,14 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-std = { version = "4.0.0", default-features = false } # Only in STD -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] default = ["std"] diff --git a/pallets/external-agents/src/benchmarking.rs b/pallets/external-agents/src/benchmarking.rs index b38cf72995..c7124956e7 100644 --- a/pallets/external-agents/src/benchmarking.rs +++ b/pallets/external-agents/src/benchmarking.rs @@ -125,4 +125,15 @@ benchmarks! { verify { assert!(GroupOfAgent::get(ticker, other.did()).is_some()); } + + create_group_and_add_auth { + let p in 0..MAX_PALLETS; + + let perms = perms(p); + let (owner, ticker) = setup::(); + assert_eq!(AGId(0), AGIdSequence::get(ticker)); + }: _(owner.origin, ticker, perms, Signatory::Identity(owner.did())) + verify { + assert_eq!(AGId(1), AGIdSequence::get(ticker)); + } } diff --git a/pallets/external-agents/src/lib.rs b/pallets/external-agents/src/lib.rs index 4b3e071952..d55e07e991 100644 --- a/pallets/external-agents/src/lib.rs +++ b/pallets/external-agents/src/lib.rs @@ -53,7 +53,6 @@ #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; -use core::array::IntoIter; use frame_support::{ decl_error, decl_module, decl_storage, dispatch::{DispatchError, DispatchResult}, @@ -62,9 +61,11 @@ use frame_support::{ use pallet_base::{try_next_post, try_next_pre}; use pallet_identity::PermissionedCallOriginData; pub use polymesh_common_utilities::traits::external_agents::{Config, Event, WeightInfo}; +use polymesh_common_utilities::with_transaction; use polymesh_primitives::agent::{AGId, AgentGroup}; use polymesh_primitives::{ - extract_auth, ExtrinsicPermissions, IdentityId, PalletPermissions, SubsetRestriction, Ticker, + extract_auth, AuthorizationData, EventDid, ExtrinsicPermissions, IdentityId, PalletPermissions, + Signatory, SubsetRestriction, Ticker, }; use sp_std::prelude::*; @@ -135,7 +136,7 @@ decl_module! { /// * Agent #[weight = ::WeightInfo::create_group(perms.complexity() as u32)] pub fn create_group(origin, ticker: Ticker, perms: ExtrinsicPermissions) -> DispatchResult { - Self::base_create_group(origin, ticker, perms) + Self::base_create_group(origin, ticker, perms).map(drop) } /// Updates the permissions of the custom AG identified by `id`, for the given `ticker`. @@ -237,6 +238,26 @@ decl_module! { pub fn accept_become_agent(origin, auth_id: u64) -> DispatchResult { Self::base_accept_become_agent(origin, auth_id) } + + /// Utility extrinsic to batch `create_group` and `add_auth`. + /// + /// # Permissions + /// * Asset + /// * Agent + #[weight = ::WeightInfo::create_group_and_add_auth(perms.complexity() as u32)] + pub fn create_group_and_add_auth(origin, ticker: Ticker, perms: ExtrinsicPermissions, target: Signatory) -> DispatchResult { + Self::base_create_group_and_add_auth(origin, ticker, perms, target) + } + + /// Utility extrinsic to batch `create_group` and `change_group` for custom groups only. + /// + /// # Permissions + /// * Asset + /// * Agent + #[weight = ::WeightInfo::create_and_change_custom_group(perms.complexity() as u32)] + pub fn create_and_change_custom_group(origin, ticker: Ticker, perms: ExtrinsicPermissions, agent: IdentityId) -> DispatchResult { + with_transaction(|| Self::base_create_and_change_custom_group(origin, ticker, perms, agent)) + } } } @@ -280,16 +301,30 @@ impl Module { origin: T::Origin, ticker: Ticker, perms: ExtrinsicPermissions, - ) -> DispatchResult { - let did = Self::ensure_perms(origin, ticker)?.for_event(); + ) -> Result<(IdentityId, AGId), DispatchError> { + let did = Self::ensure_perms(origin, ticker)?; >::ensure_extrinsic_perms_length_limited(&perms)?; - // Fetch the AG id & advance the sequence. let id = AGIdSequence::try_mutate(ticker, try_next_pre::)?; - // Commit & emit. GroupPermissions::insert(ticker, id, perms.clone()); - Self::deposit_event(Event::GroupCreated(did, ticker, id, perms)); + Self::deposit_event(Event::GroupCreated(did.for_event(), ticker, id, perms)); + Ok((did, id)) + } + + fn base_create_group_and_add_auth( + origin: T::Origin, + ticker: Ticker, + perms: ExtrinsicPermissions, + target: Signatory, + ) -> DispatchResult { + let (did, ag_id) = Self::base_create_group(origin, ticker, perms)?; + >::add_auth( + did, + target, + AuthorizationData::BecomeAgent(ticker, AgentGroup::Custom(ag_id)), + None, + ); Ok(()) } @@ -323,6 +358,16 @@ impl Module { Ok(()) } + fn base_create_and_change_custom_group( + origin: T::Origin, + ticker: Ticker, + perms: ExtrinsicPermissions, + agent: IdentityId, + ) -> DispatchResult { + let (did, ag_id) = Self::base_create_group(origin, ticker, perms)?; + Self::unsafe_change_group(did.for_event(), ticker, agent, AgentGroup::Custom(ag_id)) + } + fn base_change_group( origin: T::Origin, ticker: Ticker, @@ -330,6 +375,15 @@ impl Module { group: AgentGroup, ) -> DispatchResult { let did = Self::ensure_perms(origin, ticker)?.for_event(); + Self::unsafe_change_group(did, ticker, agent, group) + } + + fn unsafe_change_group( + did: EventDid, + ticker: Ticker, + agent: IdentityId, + group: AgentGroup, + ) -> DispatchResult { Self::ensure_agent_group_valid(ticker, group)?; Self::try_mutate_agents_group(ticker, agent, Some(group))?; Self::deposit_event(Event::GroupChanged(did, ticker, agent, group)); @@ -465,7 +519,7 @@ impl Module { let pallet = |p: &str| PalletPermissions::entire_pallet(p.into()); let in_pallet = |p: &str, dns| PalletPermissions::new(p.into(), dns); fn elems(elems: [T; N]) -> SubsetRestriction { - SubsetRestriction::elems(IntoIter::new(elems)) + SubsetRestriction::elems(elems) } match GroupOfAgent::get(ticker, agent) { None => ExtrinsicPermissions::empty(), diff --git a/pallets/group/Cargo.toml b/pallets/group/Cargo.toml index 9c7bcc5df2..b9effabc5b 100644 --- a/pallets/group/Cargo.toml +++ b/pallets/group/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-group" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false} @@ -14,20 +14,21 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } # Only for benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/group/rpc/Cargo.toml b/pallets/group/rpc/Cargo.toml index 0454914668..b93462e523 100644 --- a/pallets/group/rpc/Cargo.toml +++ b/pallets/group/rpc/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-group-rpc" version = "2.0.0" authors = ["Anonymous"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -15,16 +15,16 @@ pallet-group-rpc-runtime-api = { version = "2.0.0", path = "./runtime-api" } serde = { version = "1.0.104", features = ["derive"] } # Json RPC -jsonrpc-core = "15.0.0" -jsonrpc-core-client = "15.0.0" -jsonrpc-derive = "15.0.0" +jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-derive = "18.0.0" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0" } -sp-runtime = { version = "3.0.0", default-features = false } -sp-blockchain = { version = "3.0.0", default_features = false} -sp-std = {version = "3.0.0", default_features = false } -sp-api = {version = "3.0.0", default_features = false } +codec = { package = "parity-scale-codec", version = "3.0.0" } +sp-runtime = { version = "6.0.0", default-features = false } +sp-blockchain = { version = "4.0.0-dev", default_features = false} +sp-std = {version = "4.0.0", default_features = false } +sp-api = {version = "4.0.0-dev", default_features = false } [dev-dependencies] -substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2"} +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05"} diff --git a/pallets/group/rpc/runtime-api/Cargo.toml b/pallets/group/rpc/runtime-api/Cargo.toml index f2883206e6..8fbbf90556 100644 --- a/pallets/group/rpc/runtime-api/Cargo.toml +++ b/pallets/group/rpc/runtime-api/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-group-rpc-runtime-api" version = "2.0.0" authors = ["Anonymous"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -13,10 +13,10 @@ polymesh-common-utilities = { path = "../../../common", default-features = false serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-api = { version = "3.0.0", default_features = false } -sp-std = { version = "3.0.0", default_features = false } -sp-runtime = { version = "3.0.0", default_features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default_features = false } +sp-std = { version = "4.0.0", default_features = false } +sp-runtime = { version = "6.0.0", default_features = false } [dev-dependencies] serde_json = "1.0.41" diff --git a/pallets/group/src/lib.rs b/pallets/group/src/lib.rs index 6941139309..10a7292c73 100644 --- a/pallets/group/src/lib.rs +++ b/pallets/group/src/lib.rs @@ -313,7 +313,7 @@ impl, I: Instance> Module { /// Returns the current "active members" and any "valid member" whose revocation time-stamp is /// in the future. pub fn get_valid_members() -> Vec { - let now = >::get(); + let now = >::get(); Self::get_valid_members_at(now) } @@ -379,7 +379,7 @@ impl, I: Instance> GroupTrait for Module { /// Returns inactive members who are not expired yet. #[inline] fn get_inactive_members() -> Vec> { - let now = >::get(); + let now = >::get(); Self::inactive_members() .into_iter() .filter(|member| !Self::is_member_expired(member, now)) @@ -402,7 +402,7 @@ impl, I: Instance> GroupTrait for Module { Self::base_remove_active_member(who)?; let current_did = Context::current_identity::>().unwrap_or(GC_DID); - let deactivated_at = at.unwrap_or_else(>::get); + let deactivated_at = at.unwrap_or_else(>::get); let inactive_member = InactiveMember { id: who, expiry, @@ -411,7 +411,7 @@ impl, I: Instance> GroupTrait for Module { >::mutate(|members| { // Remove expired members. - let now = >::get(); + let now = >::get(); members.retain(|m| { if !Self::is_member_expired(m, now) { true diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml index 0c37b61d3e..0a26a5a1ef 100644 --- a/pallets/identity/Cargo.toml +++ b/pallets/identity/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-identity" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] pallet-balances = { path = "../balances", default-features = false } @@ -12,29 +12,31 @@ polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } # Others +log = "0.4.8" serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } either = { version = "1.6.1", default-features = false } # Cryptography -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v2.0.0" } -confidential_identity_v1 = { package = "confidential_identity", git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v2" } +confidential_identity_v1 = { package = "confidential_identity", git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } schnorrkel = { version = "0.10.1", default-features = false, optional = true } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +frame-system = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } # Only Benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } hex = { version = "^0.4.0", default-features = false, features = ["alloc"], optional = true } [features] diff --git a/pallets/identity/src/auth.rs b/pallets/identity/src/auth.rs index 3a58013406..74a9999aaa 100644 --- a/pallets/identity/src/auth.rs +++ b/pallets/identity/src/auth.rs @@ -14,8 +14,8 @@ // along with this program. If not, see . use crate::{ - AuthorizationType, Authorizations, AuthorizationsGiven, Config, Error, KeyToIdentityIds, - Module, MultiPurposeNonce, RawEvent, + AuthorizationType, Authorizations, AuthorizationsGiven, Config, Error, KeyRecords, Module, + MultiPurposeNonce, RawEvent, }; use frame_support::dispatch::DispatchResult; use frame_support::{ensure, StorageDoubleMap, StorageMap, StorageValue}; @@ -84,7 +84,7 @@ impl Module { auth_id: u64, ) -> DispatchResult { let sender = ensure_signed(origin)?; - let from_did = if >::contains_key(&sender) { + let from_did = if >::contains_key(&sender) { // If the sender is linked to an identity, ensure that it has relevant permissions pallet_permissions::Module::::ensure_call_permissions(&sender)?.primary_did } else { @@ -125,9 +125,9 @@ impl Module { crate fn auths_of( signer: &Signatory, did: IdentityId, - ) -> impl Iterator, u64)> { + ) -> impl Iterator { >::iter_prefix_values(signer) - .filter_map(move |auth| (auth.authorized_by == did).then_some((signer, auth.auth_id))) + .filter_map(move |auth| (auth.authorized_by == did).then_some(auth.auth_id)) } /// Use to get the filtered authorization data for a given signatory @@ -139,7 +139,7 @@ impl Module { allow_expired: bool, auth_type: Option, ) -> Vec> { - let now = >::get(); + let now = >::get(); let auths = >::iter_prefix_values(signatory) .filter(|auth| allow_expired || auth.expiry.filter(|&e| e < now).is_none()); if let Some(auth_type) = auth_type { @@ -158,7 +158,7 @@ impl Module { ) -> Option> { Self::authorizations(target, *auth_id).filter(|auth| { auth.expiry - .filter(|&expiry| >::get() > expiry) + .filter(|&expiry| >::get() > expiry) .is_none() }) } @@ -182,7 +182,7 @@ impl Module { // Ensure that `auth.expiry`, if provided, is in the future. if let Some(expiry) = auth.expiry { - let now = >::get(); + let now = >::get(); ensure!(expiry > now, AuthorizationError::Expired); } diff --git a/pallets/identity/src/benchmarking.rs b/pallets/identity/src/benchmarking.rs index 7092c22515..19e2fba2a5 100644 --- a/pallets/identity/src/benchmarking.rs +++ b/pallets/identity/src/benchmarking.rs @@ -124,7 +124,7 @@ pub fn generate_secondary_keys(n: usize) -> Vec::unsafe_join_identity(target.did(), Permissions::default(), key); } }: _(target.origin, signatories.clone()) @@ -274,7 +274,7 @@ benchmarks! { }: _(key.origin()) verify { assert!( - !KeyToIdentityIds::::contains_key(key.account), + !KeyRecords::::contains_key(key.account), "Key was not removed from its identity" ); } @@ -297,13 +297,13 @@ benchmarks! { Module::::add_investor_uniqueness_claim_v2(caller.origin.clone().into(), caller.did(), scope.clone(), claim, proof.0, Some(666u32.into())).unwrap(); }: _(caller.origin, caller.did(), claim_type, Some(scope)) - set_permission_to_signer { + set_secondary_key_permissions { let target = user::("target", 0); let key = UserBuilder::::default().build("key"); - let signatory = Signatory::Account(key.account()); + let account_id = key.account(); - Module::::unsafe_join_identity(target.did(), Permissions::empty(), key.account()); - }: _(target.origin, signatory, Permissions::default().into()) + Module::::unsafe_join_identity(target.did(), Permissions::empty(), account_id.clone()); + }: _(target.origin, account_id, Permissions::default().into()) // Benchmark the memory/cpu complexity of Permissions. permissions_cost { diff --git a/pallets/identity/src/claims.rs b/pallets/identity/src/claims.rs index fd0c81af3d..b5344fb4ef 100644 --- a/pallets/identity/src/claims.rs +++ b/pallets/identity/src/claims.rs @@ -65,7 +65,7 @@ impl Module { issuer: IdentityId, scope: Option, ) -> Option { - let now = >::get(); + let now = >::get(); Self::fetch_base_claim_with_issuer(id, claim_type, issuer, scope) .into_iter() @@ -112,7 +112,7 @@ impl Module { leeway: T::Moment, filter_cdd_id: Option, ) -> impl Iterator { - let exp_with_leeway = >::get() + let exp_with_leeway = >::get() .checked_add(&leeway) .unwrap_or_default(); @@ -217,7 +217,7 @@ impl Module { expiry: Option, ) { let claim_type = claim.claim_type(); - let last_update_date = >::get().saturated_into::(); + let last_update_date = >::get().saturated_into::(); let issuance_date = Self::fetch_claim(target, claim_type, issuer, scope.clone()) .map_or(last_update_date, |id_claim| id_claim.issuance_date); @@ -322,8 +322,8 @@ impl Module { /// # Errors /// - 'ConfidentialScopeClaimNotAllowed` if : /// - Sender is not the issuer. That claim can be only added by your-self. - /// - You are not the owner of that CDD_ID. /// - If claim is not valid. + /// - 'InvalidCDDId' if you are not the owner of that CDD_ID. /// crate fn base_add_investor_uniqueness_claim( origin: T::Origin, @@ -348,7 +348,7 @@ impl Module { // Verify the owner of that CDD_ID. ensure!( Self::base_fetch_cdd(target, T::Moment::zero(), Some(*cdd_id)).is_some(), - Error::::ConfidentialScopeClaimNotAllowed + Error::::InvalidCDDId ); // Verify the confidential claim. @@ -417,7 +417,7 @@ impl Module { ) -> Result { let primary_did = Self::ensure_perms(origin)?; ensure!( - >::contains_key(target), + DidRecords::::contains_key(target), Error::::DidMustAlreadyExist ); Ok(primary_did) @@ -481,6 +481,11 @@ impl Module { // Sender has to be part of CDDProviders Self::ensure_authorized_cdd_provider(cdd_did)?; + // Check limit for the SK's permissions. + for sk in &secondary_keys { + Self::ensure_perms_length_limited(&sk.permissions)?; + } + // Register Identity let target_did = Self::_register_did( target_account, @@ -500,7 +505,7 @@ impl Module { ) -> DispatchResult { ensure_root(origin)?; - let now = >::get(); + let now = >::get(); ensure!( T::CddServiceProviders::get_valid_members_at(now).contains(&cdd), Error::::UnAuthorizedCddProvider diff --git a/pallets/identity/src/keys.rs b/pallets/identity/src/keys.rs index b3d47b37e4..d002e278b9 100644 --- a/pallets/identity/src/keys.rs +++ b/pallets/identity/src/keys.rs @@ -14,15 +14,17 @@ // along with this program. If not, see . use crate::{ - types, AccountKeyRefCount, Config, DidRecord, DidRecords, Error, IsDidFrozen, KeyToIdentityIds, - Module, MultiPurposeNonce, OffChainAuthorizationNonce, PermissionedCallOriginData, RawEvent, + types, AccountKeyRefCount, Config, DidKeys, DidRecords, Error, IsDidFrozen, KeyRecords, Module, + MultiPurposeNonce, OffChainAuthorizationNonce, PermissionedCallOriginData, RawEvent, RpcDidRecords, }; use codec::{Decode, Encode as _}; -use core::{iter, mem}; +use core::mem; use frame_support::dispatch::DispatchResult; use frame_support::traits::{Currency as _, Get as _}; -use frame_support::{debug, ensure, StorageMap as _, StorageValue as _}; +use frame_support::{ + ensure, IterableStorageDoubleMap, StorageDoubleMap, StorageMap as _, StorageValue as _, +}; use frame_system::ensure_signed; use pallet_base::{ensure_custom_length_ok, ensure_custom_string_limited}; use polymesh_common_utilities::constants::did::USER; @@ -35,31 +37,33 @@ use polymesh_common_utilities::traits::{ }; use polymesh_common_utilities::{Context, SystematicIssuers}; use polymesh_primitives::{ - extract_auth, secondary_key, AuthorizationData, DispatchableName, ExtrinsicPermissions, - IdentityId, PalletName, Permissions, SecondaryKey, Signatory, + extract_auth, AuthorizationData, DidRecord, DispatchableName, ExtrinsicPermissions, IdentityId, + KeyRecord, PalletName, Permissions, SecondaryKey, Signatory, }; use sp_core::sr25519::Signature; use sp_io::hashing::blake2_256; -use sp_runtime::traits::{AccountIdConversion as _, IdentifyAccount, Verify, Zero as _}; +use sp_runtime::traits::{AccountIdConversion as _, IdentifyAccount, Verify}; use sp_runtime::{AnySignature, DispatchError}; use sp_std::{vec, vec::Vec}; -const MAX_KEYS: usize = 200; -const MAX_ASSETS: usize = 200; -const MAX_PORTFOLIOS: usize = 200; -const MAX_PALLETS: usize = 50; -const MAX_EXTRINSICS: usize = 40; -const MAX_NAME_LEN: usize = 50; +// Maximum secondary keys to return from RPC `identity_getDidRecords`. +const RPC_MAX_KEYS: usize = 200; + +const MAX_ASSETS: usize = 2000; +const MAX_PORTFOLIOS: usize = 2000; +const MAX_PALLETS: usize = 80; +const MAX_EXTRINSICS: usize = 80; +const MAX_NAME_LEN: usize = 60; -// Limit the maximum memory/cpu cost of an identities `DidRecord`. -const MAX_DIDRECORD_SIZE: usize = 1_000_000; +// Limit the maximum memory/cpu cost of a key's permissions. +const MAX_PERMISSION_COMPLEXITY: usize = 1_000_000; -type System = frame_system::Module; +type System = frame_system::Pallet; impl Module { /// Does the identity given by `did` exist? pub fn is_identity_exists(did: &IdentityId) -> bool { - >::contains_key(did) + DidRecords::::contains_key(did) } pub fn ensure_no_id_record(id: IdentityId) -> DispatchResult { @@ -76,9 +80,12 @@ impl Module { /// Returns the DID associated with `key`, if any, /// assuming it is either the primary key or isn't frozen. pub fn get_identity(key: &T::AccountId) -> Option { - >::try_get(key) - .ok() - .filter(|did| !Self::is_did_frozen(did) || Self::is_primary_key(&did, key)) + match KeyRecords::::get(key)? { + KeyRecord::PrimaryKey(did) => Some(did), + KeyRecord::SecondaryKey(did, _) if !Self::is_did_frozen(did) => Some(did), + // Is a multisig signer, or frozen secondary key. + _ => None, + } } /// It checks if `key` is a secondary key of `did` identity. @@ -86,52 +93,70 @@ impl Module { /// If secondary keys are frozen this function always returns false. /// A primary key cannot be frozen. pub fn is_key_authorized(did: IdentityId, key: &T::AccountId) -> bool { - let record = >::get(did); + // `key_did` will be `None` if the key is frozen. + let key_did = Self::get_identity(key); - // Check primary id or key. - &record.primary_key == key - // Check secondary items if DID is not frozen. - || !Self::is_did_frozen(did) && record.secondary_keys.iter().any(|si| si.signer.as_account().contains(&key)) + // Make sure the key's identity matches. + key_did == Some(did) } /// It checks if `key` is a secondary key of `did` identity. - pub fn is_signer(did: IdentityId, signer: &Signatory) -> bool { - let record = >::get(did); - record.secondary_keys.iter().any(|si| si.signer == *signer) + pub fn is_secondary_key(did: IdentityId, key: &T::AccountId) -> bool { + Self::ensure_secondary_key(did, key).is_ok() + } + + /// Get the identity's primary key. + pub fn get_primary_key(did: IdentityId) -> Option { + DidRecords::::get(did).and_then(|d| d.primary_key) } /// Use `did` as reference. pub fn is_primary_key(did: &IdentityId, key: &T::AccountId) -> bool { - key == &>::get(did).primary_key + let primary_key = DidRecords::::get(did).and_then(|d| d.primary_key); + primary_key.as_ref() == Some(key) } /// RPC call to fetch some aggregate account data for fewer round trips. pub fn get_key_identity_data(acc: T::AccountId) -> Option> { - let identity = Self::get_identity(&acc)?; - let record = >::get(identity); - let permissions = if acc == record.primary_key { - None - } else { - Some(record.secondary_keys.into_iter().find_map(|sk| { - sk.signer.as_account().filter(|&a| a == &acc)?; - Some(sk.permissions) - })?) - }; - + let (identity, permissions) = match KeyRecords::::get(acc)? { + KeyRecord::PrimaryKey(did) => Some((did, None)), + KeyRecord::SecondaryKey(did, perms) => Some((did, Some(perms))), + // Is a multisig signer. + _ => None, + }?; Some(types::KeyIdentityData { identity, permissions, }) } + /// Check if the key is linked to an identity or MultiSig. + /// (linked_to_did, linked_to_multsig) + pub fn is_key_linked(acc: &T::AccountId) -> (bool, bool) { + match KeyRecords::::get(acc) { + // Linked to an identity. + Some(KeyRecord::PrimaryKey(_)) | Some(KeyRecord::SecondaryKey(_, _)) => (true, false), + // Is a multisig signer. + Some(KeyRecord::MultiSigSignerKey(_)) => (false, true), + None => (false, false), + } + } + /// Retrieve DidRecords for `did` - pub fn get_did_records( - did: IdentityId, - ) -> RpcDidRecords> { - if let Ok(record) = >::try_get(did) { + /// + /// Results limited to `RPC_MAX_KEYS` secondary keys. + pub fn get_did_records(did: IdentityId) -> RpcDidRecords { + if let Some(record) = DidRecords::::get(&did) { + let secondary_keys = DidKeys::::iter_key_prefix(&did) + .take(RPC_MAX_KEYS) + .filter_map(|key| { + // Lookup the key's permissions and convert that into a `SecondaryKey` type. + KeyRecords::::get(&key).and_then(|r| r.into_secondary_key(key)) + }) + .collect(); RpcDidRecords::Success { - primary_key: record.primary_key, - secondary_keys: record.secondary_keys, + primary_key: record.primary_key.unwrap_or_default(), + secondary_keys, } } else { RpcDidRecords::IdNotFound @@ -154,38 +179,83 @@ impl Module { >::get(key) == 0, Error::::AccountKeyIsBeingUsed ); + // Do not allow unlinking MultiSig keys with balance >= 1 POLYX. + if T::MultiSig::is_multisig(key) { + ensure!( + T::Balances::total_balance(key) < T::MultiSigBalanceLimit::get().into(), + Error::::MultiSigHasBalance + ); + } Ok(()) } /// Ensure `key` isn't linked to a DID. pub fn ensure_key_did_unlinked(key: &T::AccountId) -> DispatchResult { - ensure!( - Self::can_link_account_key_to_did(key), - Error::::AlreadyLinked - ); + ensure!(Self::can_add_key_record(key), Error::::AlreadyLinked); Ok(()) } - /// Checks that a key is not linked to any identity or multisig. - pub fn can_link_account_key_to_did(key: &T::AccountId) -> bool { - !>::contains_key(key) && !T::MultiSig::is_signer(key) + /// Checks that a key doesn't already exists (i.e. not linked to an Identity or a MultiSig). + pub fn can_add_key_record(key: &T::AccountId) -> bool { + !KeyRecords::::contains_key(key) } - /// Links a primary or secondary `AccountId` key `key` to an identity `did`. + /// Add a `KeyRecord` for an `AccountId` key, if it doesn't exist. + /// + /// The `key` can be: + /// * An Identity's Primary key. (The identity can only have one) + /// * A Secondary key linked to an Identity. (Can have multiple) + /// * A signer key for a MultiSig account. /// - /// This function applies the change if `can_link_account_key_to_did` returns `true`. + /// This function applies the change if `can_add_key_record` returns `true`. /// Otherwise, it does nothing. - pub fn link_account_key_to_did(key: &T::AccountId, did: IdentityId) { - if !>::contains_key(key) { + pub fn add_key_record(key: &T::AccountId, record: KeyRecord) { + if Self::can_add_key_record(key) { // `key` is not yet linked to any identity, so no constraints. - >::insert(key, did); + KeyRecords::::insert(key, &record); + // For primary/secondary keys add to `DidKeys`. + if let Some((did, is_primary_key)) = record.get_did_key_type() { + DidKeys::::insert(did, key, true); + // For primary keys also set the DID record. + if is_primary_key { + DidRecords::::insert(did, DidRecord::new(key.clone())); + } + } } } - /// Unlinks an `AccountId` key `key` from an identity `did`. - fn unlink_account_key_from_did(key: &T::AccountId, did: IdentityId) { - if >::contains_key(key) && >::get(key) == did { - >::remove(key) + /// Remove a key's record if the `did` matches. + pub fn remove_key_record(key: &T::AccountId, did: Option) { + let remove_key = match KeyRecords::::get(key) { + Some(KeyRecord::PrimaryKey(did1)) if Some(did1) == did => { + // `did` must match the key's `did`. + DidRecords::::mutate(did1, |d| { + match d { + Some(ref mut d) if d.primary_key.as_ref() == Some(key) => { + // Only clear the Identities primary key if it matches. + d.primary_key = None; + } + _ => (), + } + }); + // Remove the key from the Identity's list of keys. + DidKeys::::remove(did1, key); + true + } + Some(KeyRecord::SecondaryKey(did1, _)) if Some(did1) == did => { + // `did` must match the key's `did`. + // Remove the key from the Identity's list of keys. + DidKeys::::remove(did1, key); + true + } + Some(KeyRecord::MultiSigSignerKey(_)) if did.is_none() => { + // `did` must be `None` when removing a MultiSig signer key. + true + } + Some(_) | None => false, + }; + if remove_key { + KeyRecords::::remove(key); } } @@ -214,20 +284,28 @@ impl Module { new_permissions: Option, optional_cdd_auth_id: Option, ) -> DispatchResult { - let mut record = >::get(target_did); - - let is_linked = >::contains_key(&new_primary_key); - let is_secondary_key = - is_linked && >::get(&new_primary_key) == target_did; - let is_primary_key = record.primary_key == new_primary_key; - let is_multisig_signer = T::MultiSig::is_signer(&new_primary_key); + let old_primary_key = Self::get_primary_key(target_did).unwrap_or_default(); - ensure!( - (!is_linked || is_secondary_key) && !is_primary_key && !is_multisig_signer, - Error::::AlreadyLinked - ); - - let old_primary_key = record.primary_key.clone(); + let key_record = KeyRecords::::get(&new_primary_key); + let (is_linked, is_secondary_key) = match key_record { + Some(KeyRecord::PrimaryKey(_)) => { + // Already linked as a primary key. + (true, false) + } + Some(KeyRecord::SecondaryKey(did, _)) => { + // Only allow if it is a secondary key of the `target_did` + (true, did == target_did) + } + Some(KeyRecord::MultiSigSignerKey(_)) => { + // MultiSig signer key can't be linked. + (true, false) + } + None => { + // Key is not linked. + (false, false) + } + }; + ensure!((!is_linked || is_secondary_key), Error::::AlreadyLinked); if new_permissions.is_none() { Self::ensure_key_unlinkable_from_did(&old_primary_key)?; @@ -256,17 +334,18 @@ impl Module { })?; } - // Remove old secondary key + // Replace primary key of the owner that initiated key rotation. + let key_record = KeyRecord::PrimaryKey(target_did); if is_secondary_key { - let removed_signers = vec![signer]; - record.remove_secondary_keys(&removed_signers); - Self::deposit_event(RawEvent::SecondaryKeysRemoved(target_did, removed_signers)); + // Convert secondary key to primary key. + KeyRecords::::insert(&new_primary_key, key_record); + DidRecords::::insert(target_did, DidRecord::new(new_primary_key.clone())); + + let removed_keys = vec![new_primary_key.clone()]; + Self::deposit_event(RawEvent::SecondaryKeysRemoved(target_did, removed_keys)); } else { - Self::link_account_key_to_did(&new_primary_key, target_did) + Self::add_key_record(&new_primary_key, key_record); } - - // Replace primary key of the owner that initiated key rotation. - record.primary_key = new_primary_key.clone(); Self::deposit_event(RawEvent::PrimaryKeyUpdated( target_did, old_primary_key.clone(), @@ -274,14 +353,17 @@ impl Module { )); if let Some(perms) = new_permissions { - let sk = SecondaryKey::new(Signatory::Account(old_primary_key), perms); - record.add_secondary_keys(iter::once(sk.clone())); + // Convert old primary key to secondary key. + KeyRecords::::insert( + &old_primary_key, + KeyRecord::SecondaryKey(target_did, perms.clone()), + ); + + let sk = SecondaryKey::new(old_primary_key, perms); Self::deposit_event(RawEvent::SecondaryKeysAdded(target_did, vec![sk.into()])); } else { - Self::unlink_account_key_from_did(&old_primary_key, target_did); + Self::remove_key_record(&old_primary_key, Some(target_did)); } - - DidRecords::::insert(target_did, record); Ok(()) } @@ -312,33 +394,27 @@ impl Module { ) } - /// Set permissions for the specific `target_key`. + /// Set permissions for the specific `key`. /// Only the primary key of an identity is able to set secondary key permissions. - crate fn base_set_permission_to_signer( + crate fn base_set_secondary_key_permissions( origin: T::Origin, - signer: Signatory, + key: T::AccountId, permissions: Permissions, ) -> DispatchResult { - let (_, did, record) = Self::ensure_primary_key(origin)?; + let (_, did) = Self::ensure_primary_key(origin)?; - // Ensure that the signer is a secondary key of the caller's Identity - ensure!( - record.secondary_keys.iter().any(|si| si.signer == signer), - Error::::NotASigner - ); + // Ensure that the `key` is a secondary key of the caller's Identity + Self::ensure_secondary_key(did, &key)?; Self::ensure_perms_length_limited(&permissions)?; - >::mutate(did, |record| { - if let Some(secondary_key) = record - .secondary_keys - .iter_mut() - .find(|si| si.signer == signer) - { - let old_perms = mem::replace(&mut secondary_key.permissions, permissions.clone()); + // Update secondary key's permissions. + KeyRecords::::mutate(&key, |record| { + if let Some(KeyRecord::SecondaryKey(_, perms)) = record { + let old_perms = mem::replace(perms, permissions.clone()); Self::deposit_event(RawEvent::SecondaryKeyPermissionsUpdated( did, - secondary_key.clone().into(), + key.clone(), old_perms, permissions, )); @@ -350,52 +426,32 @@ impl Module { /// Removes specified secondary keys of a DID if present. crate fn base_remove_secondary_keys( origin: T::Origin, - signers: Vec>, + keys: Vec, ) -> DispatchResult { - let (_, did, _) = Self::ensure_primary_key(origin)?; + let (_, did) = Self::ensure_primary_key(origin)?; // Ensure that it is safe to unlink the secondary keys from the did. - for signer in &signers { - if let Signatory::Account(key) = &signer { - Self::ensure_key_unlinkable_from_did(key)?; - } + for key in &keys { + // Ensure that the key is a secondary key. + Self::ensure_secondary_key(did, &key)?; + // Ensure that the key can be unlinked. + Self::ensure_key_unlinkable_from_did(key)?; } // Remove links and get all authorization IDs per signer. - signers - .iter() - .flat_map(|signer| { - use either::Either::{Left, Right}; - - // Unlink each of the given secondary keys from `did`. - if let Signatory::Account(key) = &signer { - // Unlink multisig signers. - if T::MultiSig::is_multisig(key) { - if !T::Balances::total_balance(key).is_zero() { - return Left(iter::empty()); - } - // Unlink multisig signers from the identity. - Self::unlink_multisig_signers_from_did( - T::MultiSig::get_key_signers(key), - did, - ); - } - // Unlink the secondary account key. - Self::unlink_account_key_from_did(key, did); - } - - // All `auth_id`s for `signer` authorized by `did`. - Right(Self::auths_of(signer, did)) - }) - // Remove authorizations. - .for_each(|(signer, auth_id)| Self::unsafe_remove_auth(signer, auth_id, &did, true)); - - // Update secondary keys at Identity. - >::mutate(did, |record| { - record.remove_secondary_keys(&signers); - }); + for key in &keys { + // Unlink the secondary account key. + Self::remove_key_record(key, Some(did)); + + // All `auth_id`s for `signer` authorized by `did`. + let signer = Signatory::Account(key.clone()); + for auth_id in Self::auths_of(&signer, did) { + // Remove authorizations. + Self::unsafe_remove_auth(&signer, auth_id, &did, true); + } + } - Self::deposit_event(RawEvent::SecondaryKeysRemoved(did, signers)); + Self::deposit_event(RawEvent::SecondaryKeysRemoved(did, keys)); Ok(()) } @@ -406,10 +462,10 @@ impl Module { keys: Vec>, expires_at: T::Moment, ) -> DispatchResult { - let (_, did, _) = Self::ensure_primary_key(origin)?; + let (_, did) = Self::ensure_primary_key(origin)?; // 0. Check expiration - let now = >::get(); + let now = >::get(); ensure!(now < expires_at, Error::::AuthorizationExpired); let authorization = TargetIdAuthorization { target_id: did, @@ -418,33 +474,19 @@ impl Module { }; let auth_encoded = authorization.encode(); - let mut record = >::get(did); - - // Ensure we won't have too many keys. - let cost = keys.iter().fold(0usize, |cost, auth| { - cost.saturating_add(auth.secondary_key.permissions.complexity()) - }); - Self::ensure_secondary_keys_limited(&record, keys.len(), cost)?; - // 1. Verify signatures. for si_with_auth in keys.iter() { let si: SecondaryKey = si_with_auth.secondary_key.clone().into(); Self::ensure_perms_length_limited(&si.permissions)?; - // Get account_id from signer. - let account_id = si - .signer - .as_account() - .ok_or(Error::::InvalidAccountKey)?; - // 1.1. Constraint 1-to-1 account to DID. - Self::ensure_key_did_unlinked(account_id)?; + Self::ensure_key_did_unlinked(&si.key)?; // 1.2. Verify the signature. let signature = AnySignature::from(Signature::from_h512(si_with_auth.auth_signature)); let signer: <::Signer as IdentifyAccount>::AccountId = - Decode::decode(&mut &account_id.encode()[..]) + Decode::decode(&mut &si.key.encode()[..]) .map_err(|_| Error::::CannotDecodeSignerAccountId)?; ensure!( signature.verify(auth_encoded.as_slice(), &signer), @@ -463,13 +505,12 @@ impl Module { .collect(); additional_keys_si.iter().for_each(|sk| { - if let Signatory::Account(key) = &sk.signer { - Self::link_account_key_to_did(key, did); - } + Self::add_key_record( + &sk.key, + KeyRecord::SecondaryKey(did, sk.permissions.clone()), + ); }); - // 2.2. Update that identity information and its offchain authorization nonce. - record.add_secondary_keys(additional_keys_si.iter().map(|sk| sk.clone().into())); - >::insert(did, record); + // 2.2. Update that identity's offchain authorization nonce. OffChainAuthorizationNonce::mutate(did, |nonce| *nonce = authorization.nonce + 1); Self::deposit_event(RawEvent::SecondaryKeysAdded(did, additional_keys_si)); @@ -485,8 +526,8 @@ impl Module { // Not really needed unless we allow identities to be deleted. Self::ensure_id_record_exists(target_did)?; - // Check that the secondary key can be linked. - Self::ensure_secondary_key_can_be_added(&target_did, &key, &permissions)?; + // Ensure that the key is unlinked. + Self::ensure_key_did_unlinked(&key)?; // Check that the new Identity has a valid CDD claim. ensure!(Self::has_valid_cdd(target_did), Error::::TargetHasNoCdd); @@ -502,90 +543,44 @@ impl Module { }) } - /// Ensure that the identity can add a new secondary key - /// without going over it's complexity budget. - pub fn ensure_secondary_key_can_be_added( - did: &IdentityId, - key: &T::AccountId, - perms: &Permissions, - ) -> DispatchResult { - let record = >::get(did); - Self::ensure_secondary_keys_limited(&record, 1, perms.complexity())?; - - Self::ensure_key_did_unlinked(&key)?; - Ok(()) - } - - /// Ensure that multiple secondary keys with `cost` complexity can be - /// added to the identitie's `DidRecords` without going over the complexity budget. - /// - /// `keys` - The number of secondary keys to add. - /// `cost` - The complexity cost for the new keys permissions. - pub fn ensure_secondary_keys_limited( - record: &DidRecord, - keys: usize, - cost: usize, - ) -> DispatchResult { - ensure_custom_length_ok::(record.secondary_keys.len().saturating_add(keys), MAX_KEYS)?; - ensure_custom_length_ok::(record.complexity().saturating_add(cost), MAX_DIDRECORD_SIZE)?; - Ok(()) - } - /// Joins a DID as an account based secondary key. pub fn unsafe_join_identity( target_did: IdentityId, permissions: Permissions, key: T::AccountId, ) { - Self::link_account_key_to_did(&key, target_did); - // Link the secondary key. - let sk = SecondaryKey::new(Signatory::Account(key), permissions); - >::mutate(target_did, |identity| { - identity.add_secondary_keys(iter::once(sk.clone())); - }); - Self::deposit_event(RawEvent::SecondaryKeysAdded(target_did, vec![sk.into()])); + Self::add_key_record( + &key, + KeyRecord::SecondaryKey(target_did, permissions.clone()), + ); + + let sk = SecondaryKey { key, permissions }; + Self::deposit_event(RawEvent::SecondaryKeysAdded(target_did, vec![sk])); } crate fn leave_identity(origin: T::Origin) -> DispatchResult { let (key, did) = Self::ensure_did(origin)?; - let signer = Signatory::Account(key.clone()); - ensure!(Self::is_signer(did, &signer), Error::::NotASigner); + + // Ensure that the caller is a secondary key. + Self::ensure_secondary_key(did, &key)?; // Ensure that it is safe to unlink the account key from the did. Self::ensure_key_unlinkable_from_did(&key)?; - // Unlink multisig signers. - if T::MultiSig::is_multisig(&key) { - ensure!( - T::Balances::total_balance(&key).is_zero(), - Error::::MultiSigHasBalance - ); - // Unlink multisig signers from the identity. - Self::unlink_multisig_signers_from_did(T::MultiSig::get_key_signers(&key), did); - } - Self::unlink_account_key_from_did(&key, did); + // Unlink secondary key from the identity. + Self::remove_key_record(&key, Some(did)); - // Update secondary keys at Identity. - >::mutate(did, |record| { - record.remove_secondary_keys(&[signer.clone()]); - }); - Self::deposit_event(RawEvent::SignerLeft(did, signer)); + Self::deposit_event(RawEvent::SecondaryKeyLeftIdentity(did, key)); Ok(()) } - fn unlink_multisig_signers_from_did(signers: Vec, did: IdentityId) { - for signer in signers { - Self::unlink_account_key_from_did(&signer, did) - } - } - /// Freezes/unfreezes the target `did` identity. /// /// # Errors /// Only primary key can freeze/unfreeze an identity. crate fn set_frozen_secondary_key_flags(origin: T::Origin, freeze: bool) -> DispatchResult { - let (_, did, _) = Self::ensure_primary_key(origin)?; + let (_, did) = Self::ensure_primary_key(origin)?; if freeze { IsDidFrozen::insert(&did, true); Self::deposit_event(RawEvent::SecondaryKeysFrozen(did)) @@ -620,9 +615,7 @@ impl Module { Self::ensure_key_did_unlinked(&sender)?; // Primary key is not part of secondary keys. ensure!( - !secondary_keys - .iter() - .any(|sk| sk.signer.as_account() == Some(&sender)), + !secondary_keys.iter().any(|sk| sk.key == sender), Error::::SecondaryKeysContainPrimaryKey ); @@ -634,9 +627,7 @@ impl Module { // Secondary keys can be linked to the new identity. for sk in &secondary_keys { - if let Signatory::Account(ref key) = sk.signer { - Self::ensure_key_did_unlinked(key)?; - } + Self::ensure_key_did_unlinked(&sk.key)?; } // Charge the given fee. @@ -645,31 +636,19 @@ impl Module { } // 2. Apply changes to our extrinsic. - // 2.1. Link primary key and add pre-authorized secondary keys. - Self::link_account_key_to_did(&sender, did); + // 2.1. Create a new identity record and link the primary key. + Self::add_key_record(&sender, KeyRecord::PrimaryKey(did)); + // 2.2. add pre-authorized secondary keys. secondary_keys.iter().for_each(|sk| { - let data = AuthorizationData::JoinIdentity(sk.permissions.clone().into()); - Self::add_auth(did, sk.signer.clone(), data, None); + let signer = Signatory::Account(sk.key.clone()); + let data = AuthorizationData::JoinIdentity(sk.permissions.clone()); + Self::add_auth(did, signer, data, None); }); - // 2.2. Create a new identity record. - let record = DidRecord { - primary_key: sender.clone(), - ..Default::default() - }; - >::insert(&did, record); - // 2.3. Give `InitialPOLYX` to the primary key for testing. T::Balances::deposit_creating(&sender, T::InitialPOLYX::get().into()); - Self::deposit_event(RawEvent::DidCreated( - did, - sender, - secondary_keys - .into_iter() - .map(secondary_key::api::SecondaryKey::from) - .collect(), - )); + Self::deposit_event(RawEvent::DidCreated(did, sender, secondary_keys)); Ok(did) } @@ -679,9 +658,9 @@ impl Module { where T::AccountId: core::fmt::Display, { - let acc = issuer.as_module_id().into_account(); + let acc = issuer.as_pallet_id().into_account(); let id = issuer.as_id(); - debug::info!( + log::info!( "Register Systematic id {} with account {} as {}", issuer, acc, @@ -698,39 +677,30 @@ impl Module { id: IdentityId, secondary_keys: Vec>, ) { - >::link_account_key_to_did(&primary_key, id); + // Link primary key. + >::add_key_record(&primary_key, KeyRecord::PrimaryKey(id)); + // Link secondary keys. for sk in &secondary_keys { - if let Signatory::Account(key) = &sk.signer { - Self::link_account_key_to_did(key, id); - } + Self::add_key_record(&sk.key, KeyRecord::SecondaryKey(id, sk.permissions.clone())); } - let record = DidRecord { - primary_key: primary_key.clone(), - secondary_keys, - ..Default::default() - }; - >::insert(&id, record); + Self::deposit_event(RawEvent::DidCreated(id, primary_key, secondary_keys)); + } - Self::deposit_event(RawEvent::DidCreated(id, primary_key, vec![])); + /// Ensure the `key` is a secondary key of the identity `did`. + fn ensure_secondary_key(did: IdentityId, key: &T::AccountId) -> DispatchResult { + let key_did = Self::key_records(key).and_then(|rec| rec.is_secondary_key()); + ensure!(key_did == Some(did), Error::::NotASigner); + Ok(()) } /// Ensures that `origin`'s key is the primary key of a DID. - fn ensure_primary_key( - origin: T::Origin, - ) -> Result<(T::AccountId, IdentityId, DidRecord), DispatchError> { + fn ensure_primary_key(origin: T::Origin) -> Result<(T::AccountId, IdentityId), DispatchError> { let sender = ensure_signed(origin)?; - let (did, record) = Self::did_record_of(&sender) - .ok_or(pallet_permissions::Error::::UnauthorizedCaller)?; - ensure!(sender == record.primary_key, Error::::KeyNotAllowed); - Ok((sender, did, record)) - } - - /// Returns `Some((did, record))` if the DID record is present for the DID of `who` - fn did_record_of(who: &T::AccountId) -> Option<(IdentityId, DidRecord)> { - let did = >::try_get(who).ok()?; - let record = >::try_get(&did).ok()?; - Some((did, record)) + let key_rec = + Self::key_records(&sender).ok_or(pallet_permissions::Error::::UnauthorizedCaller)?; + let did = key_rec.is_primary_key().ok_or(Error::::KeyNotAllowed)?; + Ok((sender, did)) } /// Ensures that `origin`'s key is linked to a DID and returns both. @@ -762,7 +732,8 @@ impl Module { } /// Ensures length limits are enforced in `perms`. - crate fn ensure_perms_length_limited(perms: &Permissions) -> DispatchResult { + pub fn ensure_perms_length_limited(perms: &Permissions) -> DispatchResult { + ensure_custom_length_ok::(perms.complexity(), MAX_PERMISSION_COMPLEXITY)?; ensure_custom_length_ok::(perms.asset.complexity(), MAX_ASSETS)?; ensure_custom_length_ok::(perms.portfolio.complexity(), MAX_PORTFOLIOS)?; Self::ensure_extrinsic_perms_length_limited(&perms.extrinsic) @@ -793,28 +764,25 @@ impl CheckAccountCallPermissions for Module { pallet_name: impl FnOnce() -> PalletName, function_name: impl FnOnce() -> DispatchableName, ) -> Option> { - let (did, record) = Self::did_record_of(who)?; - let data = |secondary_key| AccountCallPermissionsData { + let data = |did, secondary_key| AccountCallPermissionsData { primary_did: did, secondary_key, }; - if who == &record.primary_key { - // It is a direct call and `who` is the primary key. - return Some(data(None)); - } - - // DIDs with frozen secondary keys, AKA frozen DIDs, are not permitted to call extrinsics. - if Self::is_did_frozen(&did) { - return None; + match KeyRecords::::get(who)? { + // Primary keys do not have / require further permission checks. + KeyRecord::PrimaryKey(did) => Some(data(did, None)), + // Secondary Key. Ensure DID isn't frozen + key has sufficient permissions. + KeyRecord::SecondaryKey(did, permissions) if !Self::is_did_frozen(&did) => { + let sk = SecondaryKey { + key: who.clone(), + permissions, + }; + sk.has_extrinsic_permission(&pallet_name(), &function_name()) + .then(|| data(did, Some(sk))) + } + // DIDs with frozen secondary keys, AKA frozen DIDs, are not permitted to call extrinsics. + _ => None, } - - // Find the secondary key matching `who` and ensure it has sufficient permissions. - record - .secondary_keys - .into_iter() - .find(|sk| sk.signer.as_account().contains(&who)) - .filter(|sk| sk.has_extrinsic_permission(&pallet_name(), &function_name())) - .map(|sk| data(Some(sk))) } } diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 67574725e7..6fcacf7faa 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -68,7 +68,7 @@ //! - `add_claim` - Adds a new claim record or edits an existing one. //! - `revoke_claim` - Marks the specified claim as revoked. //! - `revoke_claim_by_index` - Revoke a claim identified by its index. -//! - `set_permission_to_signer` - Sets permissions for an specific `target_key` key. +//! - `set_secondary_key_permissions` - Sets permissions for a secondary key. //! - `freeze_secondary_keys` - Disables all secondary keys at `did` identity. //! - `unfreeze_secondary_keys` - Re-enables all secondary keys of the caller's identity. //! - `add_authorization` - Adds an authorization. @@ -79,21 +79,14 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] -#![feature( - const_option, - bool_to_option, - option_result_contains, - crate_visibility_modifier -)] +#![feature(const_option, option_result_contains, crate_visibility_modifier)] mod auth; mod claims; mod keys; pub mod types; -pub use types::{ - Claim1stKey, Claim2ndKey, DidRecords as RpcDidRecords, DidStatus, PermissionedCallOriginData, -}; +pub use types::{Claim1stKey, Claim2ndKey, DidStatus, PermissionedCallOriginData, RpcDidRecords}; #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -107,7 +100,7 @@ use frame_support::{ traits::{ChangeMembers, Currency, EnsureOrigin, Get, InitializeMembers}, weights::{ DispatchClass::{Normal, Operational}, - Pays, + Pays, Weight, }, }; use frame_system::ensure_root; @@ -117,27 +110,28 @@ use polymesh_common_utilities::{ protocol_fee::{ChargeProtocolFee, ProtocolOp}, traits::identity::{ AuthorizationNonce, Config, IdentityFnTrait, RawEvent, SecondaryKeyWithAuth, + SecondaryKeyWithAuthV1, }, - SystematicIssuers, GC_DID, SYSTEMATIC_ISSUERS, + SystematicIssuers, GC_DID, }; use polymesh_primitives::{ - investor_zkproof_data::v1::InvestorZKProofData, secondary_key::api::LegacyPermissions, - storage_migration_ver, Authorization, AuthorizationData, AuthorizationType, CddId, Claim, - ClaimType, Identity as DidRecord, IdentityClaim, IdentityId, Permissions, Scope, SecondaryKey, - Signatory, Ticker, + investor_zkproof_data::v1::InvestorZKProofData, storage_migrate_on, storage_migration_ver, + Authorization, AuthorizationData, AuthorizationType, CddId, Claim, ClaimType, DidRecord, + IdentityClaim, IdentityId, KeyRecord, Permissions, Scope, SecondaryKey, Signatory, Ticker, }; use sp_runtime::traits::Hash; -use sp_std::{convert::TryFrom, iter, prelude::*, vec}; +use sp_std::{convert::TryFrom, prelude::*}; pub type Event = polymesh_common_utilities::traits::identity::Event; -storage_migration_ver!(0); +storage_migration_ver!(1); decl_storage! { trait Store for Module as Identity { /// DID -> identity info - pub DidRecords get(fn did_records) config(): map hasher(identity) IdentityId => DidRecord; + pub DidRecords get(fn did_records): + map hasher(identity) IdentityId => Option>; /// DID -> bool that indicates if secondary keys are frozen. pub IsDidFrozen get(fn is_did_frozen): map hasher(identity) IdentityId => bool; @@ -151,10 +145,13 @@ decl_storage! { /// (Target ID, claim type) (issuer,scope) -> Associated claims pub Claims: double_map hasher(twox_64_concat) Claim1stKey, hasher(blake2_128_concat) Claim2ndKey => IdentityClaim; - // A map from AccountId primary or secondary keys to DIDs. - // Account keys map to at most one identity. - pub KeyToIdentityIds get(fn key_to_identity_dids) config(): - map hasher(twox_64_concat) T::AccountId => IdentityId; + /// Map from AccountId to `KeyRecord` that holds the key's identity and permissions. + pub KeyRecords get(fn key_records): + map hasher(twox_64_concat) T::AccountId => Option>; + + /// A reverse double map to allow finding all keys for an identity. + pub DidKeys get(fn did_keys): + double_map hasher(identity) IdentityId, hasher(twox_64_concat) T::AccountId => bool; /// Nonce to ensure unique actions. starts from 1. pub MultiPurposeNonce get(fn multi_purpose_nonce) build(|_| 1u64): u64; @@ -179,7 +176,7 @@ decl_storage! { pub CddAuthForPrimaryKeyRotation get(fn cdd_auth_for_primary_key_rotation): bool; /// Storage version. - StorageVersion get(fn storage_version) build(|_| Version::new(0).unwrap()): Version; + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; /// How many "strong" references to the account key. /// @@ -197,7 +194,7 @@ decl_storage! { // Secondary keys of identities at genesis. `identities` have to be initialised. config(secondary_keys): Vec<(T::AccountId, IdentityId)>; build(|config: &GenesisConfig| { - SYSTEMATIC_ISSUERS + polymesh_common_utilities::SYSTEMATIC_ISSUERS .iter() .copied() .for_each(>::register_systematic_id); @@ -227,15 +224,12 @@ decl_storage! { // Direct storage change for attaching some secondary keys to identities >::ensure_id_record_exists(did).unwrap(); assert!( - >::can_link_account_key_to_did(secondary_account_id), + >::can_add_key_record(secondary_account_id), "Secondary key already linked" ); ::mutate(|n| *n += 1_u64); - >::link_account_key_to_did(secondary_account_id, did); let sk = SecondaryKey::from_account_id(secondary_account_id.clone()); - >::mutate(did, |record| { - (*record).add_secondary_keys(iter::once(sk.clone())); - }); + >::add_key_record(secondary_account_id, sk.make_key_record(did)); >::deposit_event(RawEvent::SecondaryKeysAdded(did, vec![sk.into()])); } }); @@ -254,6 +248,14 @@ decl_module! { const InitialPOLYX: >::Balance = T::InitialPOLYX::get().into(); + fn on_runtime_upgrade() -> Weight { + storage_migrate_on!(StorageVersion::get(), 1, { + migration::migrate_v1::(); + }); + + 0 + } + /// Register `target_account` with a new Identity. /// /// # Failure @@ -288,16 +290,16 @@ decl_module! { Self::base_invalidate_cdd_claims(origin, cdd, disable_from, expiry)?; } - /// Removes specified secondary keys of a DID if present. - /// - /// # Failure - /// It can only called by primary key owner. - /// - /// # Weight - /// `950_000_000 + 60_000 * signers_to_remove.len()` - #[weight = ::WeightInfo::remove_secondary_keys(signers_to_remove.len() as u32)] - pub fn remove_secondary_keys(origin, signers_to_remove: Vec>) { - Self::base_remove_secondary_keys(origin, signers_to_remove)?; + /// Deprecated. Use `remove_secondary_keys` instead. + #[weight = ::WeightInfo::remove_secondary_keys(keys_to_remove.len() as u32)] + pub fn remove_secondary_keys_old(origin, keys_to_remove: Vec>) { + let keys_to_remove = keys_to_remove.into_iter() + .map(|key| match key { + Signatory::Account(key) => Ok(key), + _ => Err(Error::::NotASigner), + }) + .collect::, _>>()?; + Self::base_remove_secondary_keys(origin, keys_to_remove)?; } /// Call this with the new primary key. By invoking this method, caller accepts authorization @@ -375,24 +377,18 @@ decl_module! { Self::base_revoke_claim(target, claim_type, issuer, scope) } - /// Sets permissions for an specific `target_key` key. - /// - /// Only the primary key of an identity is able to set secondary key permissions. - #[weight = ::WeightInfo::set_permission_to_signer_full(&perms)] - pub fn set_permission_to_signer(origin, signer: Signatory, perms: Permissions) { - Self::base_set_permission_to_signer(origin, signer, perms)?; + /// Deprecated. Use `set_secondary_key_permissions` instead. + #[weight = ::WeightInfo::set_secondary_key_permissions_full(&perms)] + pub fn set_permission_to_signer(origin, key: Signatory, perms: Permissions) { + match key { + Signatory::Account(key) => Self::base_set_secondary_key_permissions(origin, key, perms)?, + _ => Err(Error::::NotASigner)?, + } } - /// This function is a workaround for https://github.com/polkadot-js/apps/issues/3632 - /// It sets permissions for an specific `target_key` key. - /// Only the primary key of an identity is able to set secondary key permissions. - #[weight = ::WeightInfo::legacy_set_permission_to_signer_full(&permissions)] - pub fn legacy_set_permission_to_signer( - origin, - signer: Signatory, - permissions: LegacyPermissions - ) -> DispatchResult { - Self::set_permission_to_signer(origin, signer, permissions.into()) + /// Placeholder for removed `legacy_set_permission_to_signer`. + #[weight = 1_000] + pub fn placeholder_legacy_set_permission_to_signer(_origin) { } /// It disables all secondary keys at `did` identity. @@ -434,24 +430,17 @@ decl_module! { Self::base_remove_authorization(origin, target, auth_id)?; } - /// It adds secondary keys to target identity `id`. - /// Keys are directly added to identity because each of them has an authorization. - /// - /// Arguments: - /// - `origin` Primary key of `id` identity. - /// - `id` Identity where new secondary keys will be added. - /// - `additional_keys` New secondary items (and their authorization data) to add to target - /// identity. - /// - /// Failure - /// - It can only called by primary key owner. - /// - Keys should be able to linked to any identity. - #[weight = ::WeightInfo::add_secondary_keys_full::(&additional_keys)] - pub fn add_secondary_keys_with_authorization( + /// Deprecated. Use `add_secondary_keys_with_authorization` instead. + #[weight = ::WeightInfo::add_secondary_keys_full_v1::(&additional_keys)] + pub fn add_secondary_keys_with_authorization_old( origin, - additional_keys: Vec>, + additional_keys: Vec>, expires_at: T::Moment ) { + let additional_keys = additional_keys.into_iter() + .map(SecondaryKeyWithAuth::::try_from) + .collect::, _>>() + .map_err(|_| Error::::NotASigner)?; Self::base_add_secondary_keys_with_authorization(origin, additional_keys, expires_at)?; } @@ -474,6 +463,7 @@ decl_module! { /// * `ClaimVariantNotAllowed` When origin trying to pass claim variant other than `InvestorUniqueness`. /// * `ConfidentialScopeClaimNotAllowed` When issuer is different from target or CDD_ID is invalid for given user. /// * `InvalidScopeClaim When proof is invalid. + /// * `InvalidCDDId` when you are not the owner of that CDD_ID. #[weight = ::WeightInfo::add_investor_uniqueness_claim()] pub fn add_investor_uniqueness_claim(origin, target: IdentityId, claim: Claim, proof: InvestorZKProofData, expiry: Option) -> DispatchResult { Self::base_add_investor_uniqueness_claim(origin, target, claim, None, proof.into(), expiry) @@ -533,6 +523,46 @@ decl_module! { pub fn rotate_primary_key_to_secondary(origin, auth_id:u64, optional_cdd_auth_id: Option) -> DispatchResult { Self::base_rotate_primary_key_to_secondary(origin, auth_id, optional_cdd_auth_id) } + + /// Adds secondary keys to target identity `id`. + /// + /// Keys are directly added to identity because each of them has an authorization. + /// + /// # Arguments: + /// - `origin` which must be the primary key of the identity `id`. + /// - `id` to which new secondary keys will be added. + /// - `additional_keys` which includes secondary keys, + /// coupled with authorization data, to add to target identity. + /// + /// # Errors + /// - Can only called by primary key owner. + /// - Keys should be able to linked to any identity. + #[weight = ::WeightInfo::add_secondary_keys_full::(&additional_keys)] + pub fn add_secondary_keys_with_authorization( + origin, + additional_keys: Vec>, + expires_at: T::Moment + ) { + Self::base_add_secondary_keys_with_authorization(origin, additional_keys, expires_at)?; + } + + /// Sets permissions for an specific `target_key` key. + /// + /// Only the primary key of an identity is able to set secondary key permissions. + #[weight = ::WeightInfo::set_secondary_key_permissions_full(&perms)] + pub fn set_secondary_key_permissions(origin, key: T::AccountId, perms: Permissions) { + Self::base_set_secondary_key_permissions(origin, key, perms)?; + } + + /// Removes specified secondary keys of a DID if present. + /// + /// # Errors + /// + /// The extrinsic can only called by primary key owner. + #[weight = ::WeightInfo::remove_secondary_keys(keys_to_remove.len() as u32)] + pub fn remove_secondary_keys(origin, keys_to_remove: Vec) { + Self::base_remove_secondary_keys(origin, keys_to_remove)?; + } } } @@ -611,7 +641,7 @@ decl_error! { impl Module { /// Only used by `create_asset` since `AssetDidRegistered` is defined here instead of there. pub fn commit_token_did(did: IdentityId, ticker: Ticker) { - >::insert(did, DidRecord::default()); + DidRecords::::insert(did, DidRecord::default()); Self::deposit_event(RawEvent::AssetDidRegistered(did, ticker)); } @@ -628,7 +658,7 @@ impl Module { dids.into_iter() .map(|did| { // Does DID exist in the ecosystem? - if !>::contains_key(did) { + if !DidRecords::::contains_key(did) { DidStatus::Unknown } // DID exists, but does it have a valid CDD? @@ -644,12 +674,7 @@ impl Module { #[cfg(feature = "runtime-benchmarks")] /// Links a did with an identity pub fn link_did(account: T::AccountId, did: IdentityId) { - let record = DidRecord { - primary_key: account.clone(), - ..Default::default() - }; - KeyToIdentityIds::::insert(&account, did); - DidRecords::::insert(&did, record); + Self::add_key_record(&account, KeyRecord::PrimaryKey(did)); } #[cfg(feature = "runtime-benchmarks")] @@ -728,3 +753,91 @@ fn revoke_claim_class(claim_type: ClaimType) -> frame_support::weights::Dispatch _ => Normal, } } + +pub mod migration { + use super::*; + + mod v1 { + use super::*; + use polymesh_primitives::secondary_key::v1; + use scale_info::TypeInfo; + + /// Old v1 Identity information. + #[derive(Encode, Decode, TypeInfo)] + #[derive(Clone, Default, PartialEq)] + pub struct IdentityRecord { + pub primary_key: AccountId, + pub secondary_keys: Vec>, + } + + decl_storage! { + trait Store for Module as Identity { + pub DidRecords get(fn did_records): map hasher(identity) IdentityId => IdentityRecord; + pub KeyToIdentityIds get(fn key_to_identity_dids): + map hasher(twox_64_concat) T::AccountId => IdentityId; + } + } + + decl_module! { + pub struct Module for enum Call where origin: T::Origin { } + } + } + + pub fn migrate_v1_key(key: T::AccountId, record: KeyRecord) { + // Add key to record mapping. + KeyRecords::::insert(&key, &record); + // For primary/secondary keys add to `DidKeys`. + if let Some((did, is_primary_key)) = record.get_did_key_type() { + DidKeys::::insert(did, &key, true); + // For primary keys also set the DID record. + if is_primary_key { + DidRecords::::insert(did, DidRecord::new(key)); + } + } + } + + pub fn migrate_v1() { + sp_runtime::runtime_logger::RuntimeLogger::init(); + + log::info!(" >>> Updating Identity storage. Migrating DidRecords..."); + let (total_dids, total_sks) = v1::DidRecords::::drain().fold( + (0usize, 0usize), + |(total_dids, total_sks), (did, mut record)| { + // Migrate primary key. + if record.primary_key == Default::default() { + // Asset identities don't have primary keys. + DidRecords::::insert(did, DidRecord::default()); + } else { + migrate_v1_key::(record.primary_key, KeyRecord::PrimaryKey(did)); + } + + // Migrate secondary keys. + let sk_count = record.secondary_keys.drain(..).fold(0usize, |total, sk| { + if let Some((key, key_record)) = sk.into_key_record(did) { + migrate_v1_key::(key, key_record); + } + total + 1 + }); + + (total_dids + 1, total_sks + sk_count) + }, + ); + log::info!( + " >>> Migrated {} Identities and {} secondary keys.", + total_dids, + total_sks + ); + + log::info!(" >>> Removing KeyToIdentityIds..."); + use frame_support::storage::child::KillStorageResult::*; + let (num_removed, all_removed) = match v1::KeyToIdentityIds::::remove_all(None) { + AllRemoved(removed) => (removed, true), + SomeRemaining(removed) => (removed, false), + }; + log::info!( + " >>> Removed {} KeyToIdentityIds, removed all: {}.", + num_removed, + all_removed + ); + } +} diff --git a/pallets/identity/src/types.rs b/pallets/identity/src/types.rs index abf4b040aa..dcf96d7516 100644 --- a/pallets/identity/src/types.rs +++ b/pallets/identity/src/types.rs @@ -2,6 +2,7 @@ use codec::{Decode, Encode}; use polymesh_primitives::{ClaimType, IdentityId, Permissions, Scope, SecondaryKey}; +use scale_info::TypeInfo; use sp_std::{prelude::*, vec::Vec}; #[cfg(feature = "std")] @@ -15,16 +16,53 @@ pub type AssetDidResult = Result; #[derive(Eq, PartialEq, Encode, Decode)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] -pub enum DidRecords { +pub enum RpcDidRecords { /// Id was found and has the following primary key and secondary keys. Success { primary_key: AccountId, - secondary_keys: Vec, + secondary_keys: Vec>, }, /// Error. IdNotFound, } +impl From> for RpcDidRecords { + fn from(old: v1::RpcDidRecords) -> Self { + match old { + v1::RpcDidRecords::Success { + primary_key, + secondary_keys, + } => Self::Success { + primary_key, + secondary_keys: secondary_keys + .into_iter() + .filter_map(SecondaryKey::from_v1) + .collect(), + }, + v1::RpcDidRecords::IdNotFound => Self::IdNotFound, + } + } +} + +pub mod v1 { + use super::*; + use polymesh_primitives::secondary_key::v1; + + /// A result of execution of get_votes. + #[derive(Eq, PartialEq, Encode, Decode)] + #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] + #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] + pub enum RpcDidRecords { + /// Id was found and has the following primary key and secondary keys. + Success { + primary_key: AccountId, + secondary_keys: Vec>, + }, + /// Error. + IdNotFound, + } +} + #[derive(Encode, Decode, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] pub enum DidStatus { @@ -46,7 +84,7 @@ pub struct KeyIdentityData { /// Result of a successful call permission check. #[derive(Clone, Eq, PartialEq)] -pub struct PermissionedCallOriginData { +pub struct PermissionedCallOriginData { /// The origin account. pub sender: AccountId, /// The primary identity associated with the call. @@ -58,13 +96,13 @@ pub struct PermissionedCallOriginData { pub secondary_key: Option>, } -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct Claim1stKey { pub target: IdentityId, pub claim_type: ClaimType, } -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct Claim2ndKey { pub issuer: IdentityId, pub scope: Option, diff --git a/pallets/multisig/Cargo.toml b/pallets/multisig/Cargo.toml index 8f97a71fec..a9603d08a6 100644 --- a/pallets/multisig/Cargo.toml +++ b/pallets/multisig/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-multisig" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,20 +13,22 @@ polymesh-common-utilities = {path = "../common", default-features = false} polymesh-primitives = { path = "../../primitives", default-features = false} # General +log = "0.4.8" serde = { version = "1.0.104", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } -pallet-timestamp = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } [features] equalize = [] diff --git a/pallets/multisig/src/benchmarking.rs b/pallets/multisig/src/benchmarking.rs index 1eff32a1c6..b56b00407b 100644 --- a/pallets/multisig/src/benchmarking.rs +++ b/pallets/multisig/src/benchmarking.rs @@ -23,7 +23,7 @@ use polymesh_common_utilities::{ pub type MultiSig = crate::Module; pub type Identity = identity::Module; -pub type Timestamp = pallet_timestamp::Module; +pub type Timestamp = pallet_timestamp::Pallet; fn generate_signers>>( signers: &mut Vec>, @@ -134,7 +134,7 @@ fn generate_multisig_and_proposal_for_alice(total_signers, signers_required).unwrap(); let proposal_id = >::ms_tx_done(multisig.clone()); - let proposal = Box::new(frame_system::Call::::remark(vec![]).into()); + let proposal = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); Ok(( alice, multisig.clone(), @@ -342,21 +342,18 @@ benchmarks! { assert!(>::get(&multisig) == 1); } - make_multisig_signer { + make_multisig_secondary { let (alice, multisig, _, _, _) = generate_multisig_for_alice::(1, 1).unwrap(); - let ephemeral_multisig = multisig.clone(); - let ms_signer = Signatory::Account(multisig); - }: _(alice.origin(), ephemeral_multisig) + }: _(alice.origin(), multisig.clone()) verify { - assert!(>::did_records(alice.did()).secondary_keys.iter().any(|sk| sk.signer == ms_signer)); + assert!(>::is_secondary_key(alice.did(), &multisig)); } make_multisig_primary { let (alice, multisig, _, _, _) = generate_multisig_for_alice::(1, 1).unwrap(); - let ephemeral_multisig = multisig.clone(); - }: _(alice.origin(), ephemeral_multisig, None) + }: _(alice.origin(), multisig.clone(), None) verify { - assert!(>::did_records(alice.did()).primary_key == multisig); + assert!(>::get_primary_key(alice.did()) == Some(multisig)); } execute_scheduled_proposal { diff --git a/pallets/multisig/src/lib.rs b/pallets/multisig/src/lib.rs index d898eefc4a..8b9101ff66 100644 --- a/pallets/multisig/src/lib.rs +++ b/pallets/multisig/src/lib.rs @@ -59,7 +59,7 @@ //! - `remove_multisig_signers_via_creator` - Removes a signer from the multisig when called by the //! creator of the multisig. //! - `change_sigs_required` - Changes the number of signatures required to execute a transaction. -//! - `make_multisig_signer` - Adds a multisig as a signer of the current DID if the current DID is +//! - `make_multisig_secondary` - Adds a multisig as a secondary key of the current DID if the current DID is //! the creator of the multisig. //! - `make_multisig_primary` - Adds a multisig as the primary key of the current DID if the current DID //! is the creator of the multisig. @@ -79,6 +79,7 @@ //! multisig. #![cfg_attr(not(feature = "std"), no_std)] +#![feature(const_option)] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -104,12 +105,18 @@ use polymesh_common_utilities::{ identity::Config as IdentityConfig, multisig::MultiSigSubTrait, transaction_payment::CddAndFeeDetails, Context, }; -use polymesh_primitives::{extract_auth, AuthorizationData, IdentityId, Permissions, Signatory}; +use polymesh_primitives::{ + extract_auth, storage_migrate_on, storage_migration_ver, AuthorizationData, IdentityId, + KeyRecord, Permissions, Signatory, +}; +use scale_info::TypeInfo; use sp_runtime::traits::{Dispatchable, Hash, One}; use sp_std::{convert::TryFrom, prelude::*}; type Identity = identity::Module; +storage_migration_ver!(1); + pub const NAME: &[u8] = b"MultiSig"; /// Either the ID of a successfully created multisig account or an error. @@ -131,7 +138,7 @@ pub trait Config: frame_system::Config + IdentityConfig { } /// Details of a multisig proposal -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Default, Clone, PartialEq, Eq, Debug)] pub struct ProposalDetails { /// Number of yes votes pub approvals: u64, @@ -157,7 +164,7 @@ impl ProposalDetails { } } -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq)] /// Status of a multisig proposal pub enum ProposalStatus { /// Proposal does not exist @@ -201,7 +208,7 @@ pub trait WeightInfo { fn add_multisig_signers_via_creator(signers: u32) -> Weight; fn remove_multisig_signers_via_creator(signers: u32) -> Weight; fn change_sigs_required() -> Weight; - fn make_multisig_signer() -> Weight; + fn make_multisig_secondary() -> Weight; fn make_multisig_primary() -> Weight; fn execute_scheduled_proposal() -> Weight; } @@ -225,14 +232,14 @@ decl_storage! { double_map hasher(identity) T::AccountId, hasher(blake2_128_concat) T::Proposal => Option; /// Individual multisig signer votes. (multi sig, signer, proposal) => vote. pub Votes get(fn votes): map hasher(twox_64_concat) (T::AccountId, Signatory, u64) => bool; - /// Maps a multisig signer key to a multisig address. - pub KeyToMultiSig get(fn key_to_ms): map hasher(twox_64_concat) T::AccountId => T::AccountId; /// Maps a multisig account to its identity. pub MultiSigToIdentity get(fn ms_to_identity): map hasher(identity) T::AccountId => IdentityId; /// Details of a multisig proposal pub ProposalDetail get(fn proposal_detail): map hasher(twox_64_concat) (T::AccountId, u64) => ProposalDetails; /// The last transaction version, used for `on_runtime_upgrade`. TransactionVersion get(fn transaction_version) config(): u32; + /// Storage version. + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } } @@ -256,6 +263,10 @@ decl_module! { } } + storage_migrate_on!(StorageVersion::get(), 1, { + migration::migrate_v1::(); + }); + //TODO placeholder weight 1_000 } @@ -338,7 +349,7 @@ decl_module! { auto_close: bool ) { let signer = Self::ensure_perms_signed_did(origin)?; - Self::create_proposal(multisig, signer, proposal, expiry, auto_close)?; + Self::create_proposal(multisig, signer, proposal, expiry, auto_close, false)?; } /// Creates a multisig proposal @@ -358,7 +369,7 @@ decl_module! { auto_close: bool ) { let signer = Self::ensure_signed_acc(origin)?; - Self::create_proposal(multisig, signer, proposal, expiry, auto_close)?; + Self::create_proposal(multisig, signer, proposal, expiry, auto_close, false)?; } /// Approves a multisig proposal using the caller's identity. @@ -527,22 +538,22 @@ decl_module! { Self::unsafe_change_sigs_required(sender, sigs_required); } - /// Adds a multisig as a signer of current did if the current did is the creator of the + /// Adds a multisig as a secondary key of current did if the current did is the creator of the /// multisig. /// /// # Arguments /// * `multisig` - multi sig address - #[weight = ::WeightInfo::make_multisig_signer()] - pub fn make_multisig_signer(origin, multisig: T::AccountId) { + #[weight = ::WeightInfo::make_multisig_secondary()] + pub fn make_multisig_secondary(origin, multisig: T::AccountId) { let did = >::ensure_perms(origin)?; Self::ensure_ms(&multisig)?; Self::verify_sender_is_creator(did, &multisig)?; - let perms = Permissions::empty(); - >::ensure_secondary_key_can_be_added(&did, &multisig, &perms)?; + // Ensure the key is unlinked. + >::ensure_key_did_unlinked(&multisig)?; // Add the multisig as a secondary key with no permissions. - >::unsafe_join_identity(did, perms, multisig); + >::unsafe_join_identity(did, Permissions::empty(), multisig); } /// Adds a multisig as the primary key of the current did if the current DID is the creator @@ -652,7 +663,11 @@ decl_error! { /// Changing multisig parameters not allowed since multisig is a primary key. ChangeNotAllowed, /// Signer is an account key that is already associated with a multisig. - SignerAlreadyLinked, + SignerAlreadyLinkedToMultisig, + /// Signer is an account key that is already associated with an identity. + SignerAlreadyLinkedToIdentity, + /// Multisig not allowed to add itself as a signer. + MultisigNotAllowedToLinkToItself, /// Current DID is missing MissingCurrentIdentity, /// The function can only be called by the primary key of the did @@ -749,7 +764,7 @@ impl Module { /// Removes a signer from the valid signer list for a given multisig. fn unsafe_signer_removal(multisig: T::AccountId, signer: Signatory) { if let Signatory::Account(signer_key) = &signer { - >::remove(signer_key); + Identity::::remove_key_record(signer_key, None); } >::remove(&multisig, &signer); Self::deposit_event(RawEvent::MultiSigSignerRemoved( @@ -802,6 +817,7 @@ impl Module { proposal: Box, expiry: Option, auto_close: bool, + proposal_to_id: bool, ) -> CreateProposalResult { Self::ensure_ms_signer(&multisig, &sender_signer)?; let caller_did = match sender_signer { @@ -811,7 +827,10 @@ impl Module { }; let proposal_id = Self::ms_tx_done(multisig.clone()); >::insert((multisig.clone(), proposal_id), proposal.clone()); - >::insert(multisig.clone(), *proposal, proposal_id); + if proposal_to_id { + // Only use the `Proposal` -> id map for `create_or_approve_proposal` calls. + >::insert(multisig.clone(), *proposal, proposal_id); + } >::insert( (multisig.clone(), proposal_id), ProposalDetails::new(expiry, auto_close), @@ -841,7 +860,7 @@ impl Module { Self::unsafe_approve(multisig, sender_signer, proposal_id)?; } else { // The proposal is new. - Self::create_proposal(multisig, sender_signer, proposal, expiry, auto_close)?; + Self::create_proposal(multisig, sender_signer, proposal, expiry, auto_close, true)?; } Ok(()) } @@ -877,19 +896,19 @@ impl Module { // Ensure proposal is not expired if let Some(expiry) = proposal_details.expiry { ensure!( - expiry > >::get(), + expiry > >::get(), Error::::ProposalExpired ); } if proposal_details.approvals >= Self::ms_signs_required(&multisig) { if let Some(proposal) = Self::proposals((multisig.clone(), proposal_id)) { - let execution_at = system::Module::::block_number() + One::one(); - let call = Call::::execute_scheduled_proposal( - multisig.clone(), + let execution_at = system::Pallet::::block_number() + One::one(); + let call = Call::::execute_scheduled_proposal { + multisig: multisig.clone(), proposal_id, multisig_did, - proposal.get_dispatch_info().weight, - ) + _proposal_weight: proposal.get_dispatch_info().weight, + } .into(); // Scheduling will fail when it's already scheduled (had enough votes already). @@ -986,7 +1005,7 @@ impl Module { // Ensure proposal is not expired if let Some(expiry) = proposal_details.expiry { ensure!( - expiry > >::get(), + expiry > >::get(), Error::::ProposalExpired ); } @@ -1038,19 +1057,17 @@ impl Module { ); if let Signatory::Account(key) = &signer { - // Don't allow a signer key that is already a secondary key on another multisig - ensure!( - !>::contains_key(key), - Error::::SignerAlreadyLinked - ); - // Don't allow a signer key that is already a secondary key on another identity - ensure!( - !>::contains_key(key), - Error::::SignerAlreadyLinked - ); + let (to_identity, to_multisig) = Identity::::is_key_linked(key); + // Don't allow a signer key that is a primary key, secondary key. + ensure!(!to_identity, Error::::SignerAlreadyLinkedToIdentity); + // Don't allow a signer key that is already a signer to another multisig. + ensure!(!to_multisig, Error::::SignerAlreadyLinkedToMultisig); // Don't allow a multisig to add itself as a signer to itself // NB - you can add a multisig as a signer to a different multisig - ensure!(key != &multisig, Error::::SignerAlreadyLinked); + ensure!( + key != &multisig, + Error::::MultisigNotAllowedToLinkToItself + ); } let ms_identity = >::get(&multisig); @@ -1060,7 +1077,7 @@ impl Module { >::mutate(&multisig, |x| *x += 1u64); if let Signatory::Account(key) = &signer { - >::insert(key, multisig.clone()); + Identity::::add_key_record(key, KeyRecord::MultiSigSignerKey(multisig.clone())); } Self::deposit_event(RawEvent::MultiSigSignerAdded( ms_identity, @@ -1097,7 +1114,7 @@ impl Module { pub fn is_changing_signers_allowed(multisig: &T::AccountId) -> bool { if >::cdd_auth_for_primary_key_rotation() { if let Some(did) = >::get_identity(multisig) { - if multisig == &>::did_records(&did).primary_key { + if >::is_primary_key(&did, multisig) { return false; } } @@ -1120,23 +1137,40 @@ impl Module { } impl MultiSigSubTrait for Module { - fn get_key_signers(multisig: &T::AccountId) -> Vec { - >::iter_prefix_values(multisig) - .filter_map(|signer| { - if let Signatory::Account(key) = signer { - Some(key) - } else { - None - } - }) - .collect() - } - fn is_multisig(account: &T::AccountId) -> bool { >::contains_key(account) } +} + +mod migration { + use super::*; + use pallet_identity::migration::migrate_v1_key; + + mod v1 { + use super::*; + + decl_storage! { + trait Store for Module as MultiSig { + pub KeyToMultiSig get(fn key_to_ms): map hasher(twox_64_concat) T::AccountId => T::AccountId; + } + } + + decl_module! { + pub struct Module for enum Call where origin: T::Origin { } + } + } + + pub fn migrate_v1() { + sp_runtime::runtime_logger::RuntimeLogger::init(); + + log::info!(" >>> Updating MultiSig storage. Migrating KeyToMultiSig.."); + let total_ms_signers = + v1::KeyToMultiSig::::drain().fold(0usize, |total_ms_signers, (signer, ms)| { + // Migrate MS Signer to `Identity::KeyRecords` storage. + migrate_v1_key::(signer, KeyRecord::MultiSigSignerKey(ms)); - fn is_signer(key: &T::AccountId) -> bool { - >::contains_key(key) + total_ms_signers + 1 + }); + log::info!(" >>> Migrated {} MultiSig Signers.", total_ms_signers); } } diff --git a/pallets/permissions/Cargo.toml b/pallets/permissions/Cargo.toml index 4df87da6ef..f2ab4cde79 100644 --- a/pallets/permissions/Cargo.toml +++ b/pallets/permissions/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-permissions" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -13,14 +13,15 @@ polymesh-primitives = { path = "../../primitives", default-features = false } serde = { version = "1.0.104", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # Only for benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/permissions/src/lib.rs b/pallets/permissions/src/lib.rs index ee6eb874dd..fe2edb14be 100644 --- a/pallets/permissions/src/lib.rs +++ b/pallets/permissions/src/lib.rs @@ -32,6 +32,7 @@ use frame_support::{ }; use polymesh_common_utilities::traits::{AccountCallPermissionsData, CheckAccountCallPermissions}; use polymesh_primitives::{DispatchableName, PalletName}; +use scale_info::TypeInfo; use sp_runtime::{ traits::{DispatchInfoOf, PostDispatchInfoOf, SignedExtension}, transaction_validity::{TransactionValidity, TransactionValidityError, ValidTransaction}, @@ -81,7 +82,8 @@ impl Module { } /// A signed extension used in checking call permissions. -#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)] +#[derive(Encode, Decode, TypeInfo, Clone, Eq, PartialEq, Default)] +#[scale_info(skip_type_params(T))] pub struct StoreCallMetadata(PhantomData); impl fmt::Debug for StoreCallMetadata { @@ -156,7 +158,7 @@ where } fn post_dispatch( - _: Self::Pre, + _: Option, _: &DispatchInfoOf, _: &PostDispatchInfoOf, _: usize, diff --git a/pallets/pips/Cargo.toml b/pallets/pips/Cargo.toml index 9a10030a58..64b60b80a6 100644 --- a/pallets/pips/Cargo.toml +++ b/pallets/pips/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-pips" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -22,21 +22,22 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } -frame-system = { package = "frame-system", version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } +frame-system = { package = "frame-system", version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } # Benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } rand = { version = "0.8.2", default-features = false, optional = true } rand_chacha = { version = "0.3.0", default-features = false, optional = true } pallet-committee = { path = "../committee", default-features = false, optional = true } diff --git a/pallets/pips/src/benchmarking.rs b/pallets/pips/src/benchmarking.rs index 57aea37c12..9c7e7cc3b8 100644 --- a/pallets/pips/src/benchmarking.rs +++ b/pallets/pips/src/benchmarking.rs @@ -64,7 +64,7 @@ fn zeroize_deposit() { /// Makes a proposal. fn make_proposal() -> (Box, Url, PipDescription) { let content = vec![b'X'; PROPOSAL_PADDING_LEN]; - let proposal = Box::new(frame_system::Call::::remark(content).into()); + let proposal = Box::new(frame_system::Call::::remark { remark: content }.into()); let url = Url::try_from(vec![b'X'; URL_LEN].as_slice()).unwrap(); let description = PipDescription::try_from(vec![b'X'; DESCRIPTION_LEN].as_slice()).unwrap(); (proposal, url, description) @@ -151,14 +151,13 @@ fn enact_call(num_approves: usize, num_rejects: usize, num_skips: usi .chain(iter::repeat(SnapshotResult::Skip).take(num_skips)) .collect(); snapshot_results.shuffle(&mut rng); - Call::::enact_snapshot_results( - Module::::snapshot_queue() - .iter() - .rev() - .map(|s| s.id) - .zip(snapshot_results.into_iter()) - .collect(), - ) + let results = Module::::snapshot_queue() + .iter() + .rev() + .map(|s| s.id) + .zip(snapshot_results.into_iter()) + .collect(); + Call::::enact_snapshot_results { results } } fn propose_verify(url: Url, description: PipDescription) -> DispatchResult { @@ -257,7 +256,7 @@ benchmarks! { zeroize_deposit::(); let some_url = Some(url.clone()); let some_desc = Some(description.clone()); - let call = Call::::propose(proposal, 0u32.into(), some_url, some_desc); + let call = Call::::propose { proposal, deposit: 0u32.into(), url: some_url, description: some_desc }; }: { call.dispatch_bypass_filter(origin).unwrap(); } @@ -301,11 +300,16 @@ benchmarks! { let proposer_did = SystematicIssuers::Committee.as_id(); identity::CurrentDid::put(proposer_did); zeroize_deposit::(); - let propose_call = Call::::propose(proposal, 0u32.into(), Some(url.clone()), Some(description.clone())); + let propose_call = Call::::propose { + proposal, + deposit: 0u32.into(), + url: Some(url.clone()), + description: Some(description.clone()) + }; propose_call.dispatch_bypass_filter(proposer_origin).unwrap(); let origin = T::VotingMajorityOrigin::successful_origin(); let id = PipId(0); - let call = Call::::approve_committee_proposal(id); + let call = Call::::approve_committee_proposal { id }; }: { call.dispatch_bypass_filter(origin).unwrap(); } @@ -330,7 +334,7 @@ benchmarks! { let id = PipId(0); assert_eq!(deposit, Deposits::::get(id, &user.account()).amount, "incorrect deposit in reject_proposal"); let vmo_origin = T::VotingMajorityOrigin::successful_origin(); - let call = Call::::reject_proposal(id); + let call = Call::::reject_proposal { id }; }: { call.dispatch_bypass_filter(vmo_origin).unwrap(); } @@ -353,9 +357,9 @@ benchmarks! { ).unwrap(); let id = PipId(0); let vmo_origin = T::VotingMajorityOrigin::successful_origin(); - let reject_call = Call::::reject_proposal(id); + let reject_call = Call::::reject_proposal { id }; reject_call.dispatch_bypass_filter(vmo_origin.clone()).unwrap(); - let call = Call::::prune_proposal(id); + let call = Call::::prune_proposal { id }; }: { call.dispatch_bypass_filter(vmo_origin).unwrap(); } @@ -380,9 +384,9 @@ benchmarks! { T::GovernanceCommittee::bench_set_release_coordinator(user.did()); Module::::snapshot(user.origin().into()).unwrap(); let vmo_origin = T::VotingMajorityOrigin::successful_origin(); - let enact_call = Call::::enact_snapshot_results(vec![(id, SnapshotResult::Approve)]); + let enact_call = Call::::enact_snapshot_results { results: vec![(id, SnapshotResult::Approve)] }; enact_call.dispatch_bypass_filter(vmo_origin).unwrap(); - let future_block = frame_system::Module::::block_number() + 100u32.into(); + let future_block = frame_system::Pallet::::block_number() + 100u32.into(); let origin = user.origin(); }: _(origin, id, Some(future_block)) verify { diff --git a/pallets/pips/src/lib.rs b/pallets/pips/src/lib.rs index 75ae930fbd..2958a97a40 100644 --- a/pallets/pips/src/lib.rs +++ b/pallets/pips/src/lib.rs @@ -84,7 +84,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![feature(const_option)] -#![feature(bool_to_option)] #![feature(associated_type_bounds)] #[cfg(feature = "runtime-benchmarks")] @@ -117,10 +116,11 @@ use polymesh_common_utilities::{ with_transaction, CommonConfig, Context, MaybeBlock, GC_DID, }; use polymesh_primitives::{ - impl_checked_inc, storage_migrate_on, storage_migration_ver, Balance, IdentityId, + impl_checked_inc, storage_migrate_on, storage_migration_ver, Balance, IdentityId, Url, }; use polymesh_primitives_derive::VecU8StrongTyped; use polymesh_runtime_common::PipsEnactSnapshotMaximumWeight; +use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::H256; @@ -163,20 +163,14 @@ pub trait WeightInfo { fn expire_scheduled_pip() -> Weight; } -/// A wrapper for a proposal url. -#[derive( - Decode, Encode, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] -pub struct Url(pub Vec); - /// A wrapper for a proposal description. -#[derive( - Decode, Encode, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] +#[derive(Decode, Encode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct PipDescription(pub Vec); /// The global and unique identitifer of a Polymesh Improvement Proposal (PIP). -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct PipId(pub u32); impl_checked_inc!(PipId); @@ -196,17 +190,17 @@ impl PipId { } /// Represents a proposal -#[derive(Encode, Decode, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct Pip { +pub struct Pip { /// The proposal's unique id. pub id: PipId, /// The proposal being voted on. - pub proposal: T::Proposal, + pub proposal: Proposal, /// The latest state pub state: ProposalState, /// The issuer of `propose`. - pub proposer: Proposer, + pub proposer: Proposer, } /// A result of execution of get_votes. @@ -226,7 +220,8 @@ pub enum VoteCount { /// Either the entire proposal encoded as a byte vector or its hash. The latter represents large /// proposals. -#[derive(Encode, Decode, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] pub enum ProposalData { /// The hash of the proposal. Hash(H256), @@ -235,7 +230,7 @@ pub enum ProposalData { } /// The various sorts of committees that can make a PIP. -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug)] pub enum Committee { /// The technical committee. Technical, @@ -244,7 +239,7 @@ pub enum Committee { } /// The proposer of a certain PIP. -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug)] pub enum Proposer { /// The proposer is of the community. Community(AccountId), @@ -253,9 +248,9 @@ pub enum Proposer { } /// Represents a proposal metadata -#[derive(Encode, Decode, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct PipsMetadata { +pub struct PipsMetadata { /// The proposal's unique id. pub id: PipId, /// The proposal url for proposal discussion. @@ -263,7 +258,7 @@ pub struct PipsMetadata { /// The proposal description. pub description: Option, /// The block when the PIP was made. - pub created_at: T::BlockNumber, + pub created_at: BlockNumber, /// Assuming the runtime has a given `rv: RuntimeVersion` at the point of `Pips::propose`, /// then this field contains `rv.transaction_version`. /// @@ -275,11 +270,11 @@ pub struct PipsMetadata { /// /// This field has no operational on-chain effect and is provided for UI purposes only. /// On-chain effects are instead handled via scheduling. - pub expiry: MaybeBlock, + pub expiry: MaybeBlock, } /// For keeping track of proposal being voted on. -#[derive(PartialEq, Eq, Clone, Encode, Decode, Default)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Default)] #[cfg_attr(feature = "std", derive(Debug))] pub struct VotingResult { /// The current set of voters that approved with their stake. @@ -291,7 +286,7 @@ pub struct VotingResult { } /// A "vote" or "signal" on a PIP to move it up or down the review queue. -#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode)] +#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, TypeInfo)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] pub struct Vote( /// `true` if there's agreement. @@ -308,7 +303,7 @@ pub struct VoteByPip { } /// The state a PIP is in. -#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, Eq, PartialEq, Debug)] pub enum ProposalState { /// Initial state. Proposal is open to voting. Pending, @@ -331,7 +326,7 @@ impl Default for ProposalState { } /// Information about deposit. -#[derive(Encode, Decode, Clone, PartialEq, Eq, Default)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Default)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DepositInfo { /// Owner of the deposit. @@ -341,26 +336,27 @@ pub struct DepositInfo { } /// ID of the taken snapshot in a sequence. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct SnapshotId(pub u32); impl_checked_inc!(SnapshotId); /// A snapshot's metadata, containing when it was created and who triggered it. /// The priority queue is stored separately (see `SnapshottedPip`). -#[derive(Encode, Decode, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct SnapshotMetadata { +pub struct SnapshotMetadata { /// The block when the snapshot was made. - pub created_at: T::BlockNumber, + pub created_at: BlockNumber, /// Who triggered this snapshot? Should refer to someone in the GC. - pub made_by: T::AccountId, + pub made_by: AccountId, /// Unique ID of this snapshot. pub id: SnapshotId, } /// A PIP in the snapshot's priority queue for consideration by the GC. -#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct SnapshottedPip { /// Identifies the PIP this refers to. @@ -391,7 +387,7 @@ fn compare_spip(l: &SnapshottedPip, r: &SnapshottedPip) -> Ordering { /// A result to enact for one or many PIPs in the snapshot queue. // This type is only here due to `enact_snapshot_results`. -#[derive(codec::Encode, codec::Decode, Copy, Clone, PartialEq, Eq, Debug)] +#[derive(Encode, Decode, TypeInfo, Copy, Clone, PartialEq, Eq, Debug)] pub enum SnapshotResult { /// Approve the PIP and move it to the execution queue. Approve, @@ -407,6 +403,7 @@ pub type SkippedCount = u8; type Identity = identity::Module; type CallPermissions = pallet_permissions::Module; +type System = frame_system::Pallet; /// The module's configuration trait. pub trait Config: @@ -479,7 +476,7 @@ decl_storage! { ActivePipCount get(fn active_pip_count): u32; /// The metadata of the active proposals. - pub ProposalMetadata get(fn proposal_metadata): map hasher(twox_64_concat) PipId => Option>; + pub ProposalMetadata get(fn proposal_metadata): map hasher(twox_64_concat) PipId => Option>; /// Those who have locked a deposit. /// proposal (id, proposer) -> deposit @@ -487,7 +484,7 @@ decl_storage! { /// Actual proposal for a given id, if it's current. /// proposal id -> proposal - pub Proposals get(fn proposals): map hasher(twox_64_concat) PipId => Option>; + pub Proposals get(fn proposals): map hasher(twox_64_concat) PipId => Option>; /// PolymeshVotes on a given proposal, if it is ongoing. /// proposal id -> vote count @@ -516,7 +513,7 @@ decl_storage! { pub SnapshotQueue get(fn snapshot_queue): Vec; /// The metadata of the snapshot, if there is one. - pub SnapshotMeta get(fn snapshot_metadata): Option>; + pub SnapshotMeta get(fn snapshot_metadata): Option>; /// The number of times a certain PIP has been skipped. /// Once a (configurable) threshhold is exceeded, a PIP cannot be skipped again. @@ -780,7 +777,7 @@ decl_module! { } // Construct and add PIP to storage. - let created_at = >::block_number(); + let created_at = System::::block_number(); let expiry = Self::pending_pip_expiry() + created_at; let transaction_version = >::get().transaction_version; let proposal_data = Self::reportable_proposal_data(&*proposal); @@ -986,7 +983,7 @@ decl_module! { Self::is_proposal_state(id, ProposalState::Scheduled)?; // Ensure new `until` is a valid block number. - let next_block = >::block_number() + 1u32.into(); + let next_block = System::::block_number() + 1u32.into(); let new_until = until.unwrap_or(next_block); ensure!(new_until >= next_block, Error::::InvalidFutureBlockNumber); @@ -1036,7 +1033,7 @@ decl_module! { // Commit the new snapshot. let id = SnapshotIdSequence::try_mutate(try_next_post::)?; - let created_at = >::block_number(); + let created_at = System::::block_number(); >::set(Some(SnapshotMetadata { created_at, made_by, id })); let queue = LiveQueue::get(); SnapshotQueue::set(queue.clone()); @@ -1209,7 +1206,7 @@ impl Module { Self::reduce_lock(&depo_info.owner, depo_info.amount).unwrap(); depo_info.amount.saturating_add(acc) }); - >::remove_prefix(id); + >::remove_prefix(id, None); Self::deposit_event(RawEvent::ProposalRefund(did, id, total_refund)); } @@ -1252,7 +1249,7 @@ impl Module { Self::decrement_count_if_active(state); if prune { ProposalResult::remove(id); - ProposalVotes::::remove_prefix(id); + ProposalVotes::::remove_prefix(id, None); >::remove(id); if let Some(Proposer::Committee(_)) = Self::proposals(id).map(|p| p.proposer) { CommitteePips::mutate(|list| list.retain(|&i| i != id)); @@ -1276,10 +1273,10 @@ impl Module { // as you can only schedule calls for future blocks. let at = Self::default_enactment_period() .max(One::one()) - .saturating_add(>::block_number()); + .saturating_add(System::::block_number()); // Add to schedule. - let call = Call::::execute_scheduled_pip(id).into(); + let call = Call::::execute_scheduled_pip { id }.into(); let res = T::Scheduler::schedule_named( id.execution_name(), DispatchTime::At(at), @@ -1308,7 +1305,7 @@ impl Module { /// Adds a PIP expiry call to the PIP expiry schedule. fn schedule_pip_for_expiry(id: PipId, at: T::BlockNumber) { let did = GC_DID; - let call = Call::::expire_scheduled_pip(did, id).into(); + let call = Call::::expire_scheduled_pip { did, id }.into(); let event = match T::Scheduler::schedule_named( id.expiry_name(), DispatchTime::At(at), diff --git a/pallets/portfolio/Cargo.toml b/pallets/portfolio/Cargo.toml index 9b18e9b7c2..cc052326d6 100644 --- a/pallets/portfolio/Cargo.toml +++ b/pallets/portfolio/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-portfolio" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # Common @@ -19,14 +19,15 @@ pallet-permissions = { path = "../permissions", default-features = false } serde = { version = "1.0.104", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # Only in STD -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/portfolio/src/lib.rs b/pallets/portfolio/src/lib.rs index 98cf6e201d..21e0f8e472 100644 --- a/pallets/portfolio/src/lib.rs +++ b/pallets/portfolio/src/lib.rs @@ -48,7 +48,11 @@ pub mod benchmarking; use codec::{Decode, Encode}; use core::{iter, mem}; -use frame_support::{decl_error, decl_module, decl_storage, dispatch::DispatchResult, ensure}; +use frame_support::{ + decl_error, decl_module, decl_storage, + dispatch::{DispatchResult, Weight}, + ensure, +}; use pallet_identity::{self as identity, PermissionedCallOriginData}; use polymesh_common_utilities::traits::balances::Memo; use polymesh_common_utilities::traits::portfolio::PortfolioSubTrait; @@ -57,13 +61,15 @@ use polymesh_primitives::{ extract_auth, identity_id::PortfolioValidityResult, storage_migration_ver, Balance, IdentityId, PortfolioId, PortfolioKind, PortfolioName, PortfolioNumber, SecondaryKey, Ticker, }; +use scale_info::TypeInfo; use sp_arithmetic::traits::Zero; use sp_std::prelude::Vec; type Identity = identity::Module; /// The ticker and balance of an asset to be moved from one portfolio to another. -#[derive(Encode, Decode, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct MovePortfolioItem { /// The ticker of the asset to be moved. pub ticker: Ticker, @@ -117,11 +123,11 @@ decl_storage! { double_map hasher(identity) IdentityId, hasher(twox_64_concat) PortfolioId => bool; /// Storage version. - StorageVersion get(fn storage_version) build(|_| Version::new(0).unwrap()): Version; + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } } -storage_migration_ver!(0); +storage_migration_ver!(1); decl_error! { pub enum Error for Module { @@ -191,10 +197,12 @@ decl_module! { Self::ensure_portfolio_custody_and_permission(pid, primary_did, secondary_key.as_ref())?; // Delete from storage. + let portfolio = Portfolios::get(&primary_did, &num); Portfolios::remove(&primary_did, &num); + NameToNumber::remove(&primary_did, &portfolio); PortfolioAssetCount::remove(&pid); - PortfolioAssetBalances::remove_prefix(&pid); - PortfolioLockedAssets::remove_prefix(&pid); + PortfolioAssetBalances::remove_prefix(&pid, None); + PortfolioLockedAssets::remove_prefix(&pid, None); PortfoliosInCustody::remove(&Self::custodian(&pid), &pid); PortfolioCustodian::remove(&pid); @@ -330,6 +338,23 @@ decl_module! { pub fn accept_portfolio_custody(origin, auth_id: u64) -> DispatchResult { Self::base_accept_portfolio_custody(origin, auth_id) } + + fn on_runtime_upgrade() -> Weight { + use polymesh_primitives::storage_migrate_on; + + // Remove old name to number mappings. + // In version 4.0.0 (first mainnet deployment) when a portfolio was removed + // the NameToNumber mapping was left out of date, this upgrade removes dangling + // NameToNumber mappings. + // https://github.com/PolymathNetwork/Polymesh/pull/1200 + storage_migrate_on!(StorageVersion::get(), 1, { + NameToNumber::iter() + .filter(|(identity, _, number)| !Portfolios::contains_key(identity, number)) + .for_each(|(identity, name, _)| NameToNumber::remove(identity, name)); + }); + + 0 + } } } diff --git a/pallets/protocol-fee/Cargo.toml b/pallets/protocol-fee/Cargo.toml index 80e2b1ecce..9146023d48 100644 --- a/pallets/protocol-fee/Cargo.toml +++ b/pallets/protocol-fee/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-protocol-fee" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } @@ -13,16 +13,17 @@ pallet-identity = { path = "../identity", default-features = false } serde = { version = "1.0.104", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # benchmark-only -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] default = ["std"] diff --git a/pallets/protocol-fee/rpc/Cargo.toml b/pallets/protocol-fee/rpc/Cargo.toml index b1327c5147..8a63d6f63c 100644 --- a/pallets/protocol-fee/rpc/Cargo.toml +++ b/pallets/protocol-fee/rpc/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-protocol-fee-rpc" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../../common", default-features = false } @@ -10,12 +10,12 @@ pallet-protocol-fee-rpc-runtime-api = { path = "./runtime-api" } # General serde = { version = "1.0.104", features = ["derive"] } -jsonrpc-core = "15.0.0" -jsonrpc-core-client = "15.0.0" -jsonrpc-derive = "15.0.0" +jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-derive = "18.0.0" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0" } -sp-runtime = { version = "3.0.0", default_features = false } -sp-blockchain = { version = "3.0.0", default_features = false} -sp-api = { version = "3.0.0", default_features = false} +codec = { package = "parity-scale-codec", version = "3.0.0" } +sp-runtime = { version = "6.0.0", default_features = false } +sp-blockchain = { version = "4.0.0-dev", default_features = false} +sp-api = { version = "4.0.0-dev", default_features = false} diff --git a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml index a16adbc7cb..090e077f40 100644 --- a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml +++ b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-protocol-fee-rpc-runtime-api" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../../../common", default-features = false } @@ -11,10 +11,10 @@ polymesh-common-utilities = { path = "../../../common", default-features = false serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-api = { version = "3.0.0", default_features = false} -sp-runtime = { version = "3.0.0", default_features = false} -frame-support = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default_features = false} +sp-runtime = { version = "6.0.0", default_features = false} +frame-support = { version = "4.0.0-dev", default-features = false } [dev-dependencies] serde_json = "1.0.48" diff --git a/pallets/protocol-fee/src/benchmarking.rs b/pallets/protocol-fee/src/benchmarking.rs index be77ec302d..32a3d39fb7 100644 --- a/pallets/protocol-fee/src/benchmarking.rs +++ b/pallets/protocol-fee/src/benchmarking.rs @@ -18,7 +18,6 @@ use frame_benchmarking::benchmarks; use frame_system::RawOrigin; use polymesh_common_utilities::protocol_fee::ProtocolOp; use polymesh_primitives::PosRatio; -use sp_std::prelude::*; benchmarks! { change_coefficient { diff --git a/pallets/protocol-fee/src/lib.rs b/pallets/protocol-fee/src/lib.rs index 7724c4edee..5ec33c8aa2 100644 --- a/pallets/protocol-fee/src/lib.rs +++ b/pallets/protocol-fee/src/lib.rs @@ -152,8 +152,10 @@ impl Module { /// Computes the fee of the operation as `(base_fee * coefficient.0) / coefficient.1`. pub fn compute_fee(ops: &[ProtocolOp]) -> Balance { let coefficient = Self::coefficient(); - let ratio = Perbill::from_rational_approximation(coefficient.0, coefficient.1); - let base = ops.iter().fold(Zero::zero(), |a, e| a + Self::base_fees(e)); + let ratio = Perbill::from_rational(coefficient.0, coefficient.1); + let base = ops + .iter() + .fold(Zero::zero(), |a: Balance, e| a + Self::base_fees(e)); ratio * base } @@ -190,6 +192,7 @@ impl Module { // It always return the negative imbalance as negative_imbalance always >= positive_imbalance. let imbalance = negative_imbalance .offset(positive_imbalance) + .same() .map_err(|_| Error::::UnHandledImbalances)?; T::OnProtocolFeePayment::on_unbalanced(imbalance); } diff --git a/pallets/relayer/Cargo.toml b/pallets/relayer/Cargo.toml index c4f883f6c4..2f45344ab8 100644 --- a/pallets/relayer/Cargo.toml +++ b/pallets/relayer/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-relayer" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] pallet-identity = { path = "../identity", default-features = false} @@ -10,14 +10,15 @@ polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false} # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-runtime = { version = "6.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-std = { version = "4.0.0", default-features = false } # Only Benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] default = ["std"] diff --git a/pallets/relayer/src/benchmarking.rs b/pallets/relayer/src/benchmarking.rs index 9f1321b763..ebd97dc8bc 100644 --- a/pallets/relayer/src/benchmarking.rs +++ b/pallets/relayer/src/benchmarking.rs @@ -20,7 +20,6 @@ use polymesh_common_utilities::{ benchs::{user, AccountIdOf, User}, traits::{relayer::Config, TestUtilsFn}, }; -use sp_std::prelude::*; type Relayer = crate::Module; diff --git a/pallets/relayer/src/lib.rs b/pallets/relayer/src/lib.rs index 1557b44030..4361877740 100644 --- a/pallets/relayer/src/lib.rs +++ b/pallets/relayer/src/lib.rs @@ -57,6 +57,7 @@ pub use polymesh_common_utilities::traits::relayer::{ use polymesh_primitives::{ extract_auth, AuthorizationData, Balance, IdentityId, Signatory, TransactionError, }; +use scale_info::TypeInfo; use sp_runtime::transaction_validity::InvalidTransaction; type Identity = pallet_identity::Module; @@ -65,7 +66,8 @@ type Identity = pallet_identity::Module; /// /// This holds the subsidiser's paying key and the remaining POLYX balance /// available for subsidising transaction and protocol fees. -#[derive(Encode, Decode, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct Subsidy { /// The subsidiser's paying key. pub paying_key: Acc, diff --git a/pallets/rewards/Cargo.toml b/pallets/rewards/Cargo.toml index be5890124e..1bb91fe85b 100644 --- a/pallets/rewards/Cargo.toml +++ b/pallets/rewards/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-rewards" version = "1.0.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -12,14 +12,15 @@ pallet-identity = { path = "../identity", default-features = false } pallet-staking = { path = "../staking", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } # Other serde = { version = "1.0.104", default-features = false } diff --git a/pallets/rewards/src/lib.rs b/pallets/rewards/src/lib.rs index 222871bbbf..a253eb5b9a 100644 --- a/pallets/rewards/src/lib.rs +++ b/pallets/rewards/src/lib.rs @@ -46,18 +46,19 @@ use frame_support::{ use frame_system::{ensure_none, ensure_root, RawOrigin}; use pallet_staking::{self as staking, RewardDestination}; use polymesh_common_utilities::{ - constants::{currency::POLY, REWARDS_MODULE_ID}, + constants::{currency::POLY, REWARDS_PALLET_ID}, traits::identity::Config as IdentityConfig, with_transaction, }; use polymesh_primitives::Balance; +use scale_info::TypeInfo; use sp_runtime::transaction_validity::{InvalidTransaction, TransactionLongevity}; use sp_runtime::{ traits::{AccountIdConversion, StaticLookup, Verify}, transaction_validity::ValidTransaction, DispatchError, }; -use sp_std::{convert::TryInto, prelude::*}; +use sp_std::{convert::TryInto, prelude::*, vec}; #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -80,7 +81,7 @@ pub trait WeightInfo { } /// Represents an Itn reward's status. -#[derive(Decode, Encode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Decode, Encode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum ItnRewardStatus { Unclaimed(Balance), Claimed, @@ -160,7 +161,7 @@ decl_module! { impl Module { /// The account ID of the rewards pot. pub fn account_id() -> T::AccountId { - REWARDS_MODULE_ID.into_account() + REWARDS_PALLET_ID.into_account() } /// Converts `polymesh_primitive::Balance` balances into (`bonded_amount`, `deposit_amount`). @@ -278,7 +279,12 @@ impl sp_runtime::traits::ValidateUnsigned for Module { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { const PRIORITY: u64 = 100; - if let Call::claim_itn_reward(reward_address, itn_address, signature) = call { + if let Call::claim_itn_reward { + reward_address, + itn_address, + signature, + } = call + { if Self::valid_claim(reward_address, itn_address, signature) { return Ok(ValidTransaction { priority: PRIORITY, diff --git a/pallets/runtime/build_tool/Cargo.toml b/pallets/runtime/build_tool/Cargo.toml index 408291c902..4f89505a81 100644 --- a/pallets/runtime/build_tool/Cargo.toml +++ b/pallets/runtime/build_tool/Cargo.toml @@ -2,12 +2,12 @@ name = "polymesh-build-tool" version = "0.1.0" authors = ["miguel "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -substrate-wasm-builder = { version = "3.0.0", default-features = false} +substrate-wasm-builder = { version = "5.0.0-dev", default-features = false} [features] default = ["std"] diff --git a/pallets/runtime/ci/Cargo.toml b/pallets/runtime/ci/Cargo.toml index fb5592d454..589663ce20 100644 --- a/pallets/runtime/ci/Cargo.toml +++ b/pallets/runtime/ci/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-runtime-ci" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -41,7 +41,7 @@ pallet-statistics = { path = "../../statistics", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } -#polymesh-contracts = { path = "../../contracts", default-features = false } +polymesh-contracts = { path = "../../contracts", default-features = false } pallet-sudo = { path = "../../sudo", default-features = false } pallet-test-utils = { path = "../../test-utils", default-features = false } @@ -49,53 +49,56 @@ pallet-test-utils = { path = "../../test-utils", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -#pallet-contracts-rpc-runtime-api = { version = "3.0.0", default-features = false } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } # Crypto -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } # Others lazy_static = { version = "1.4.0", default-features = false } +log = "0.4.8" serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-inherents = { version = "3.0.0", default-features = false } -sp-offchain = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -sp-consensus-babe = { version = "0.9.0", default-features = false } -sp-session = { version = "3.0.0", default-features = false } -sp-authority-discovery = { version = "3.0.0", default-features = false } -sp-transaction-pool = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-inherents = { version = "4.0.0-dev", default-features = false } +sp-offchain = { version = "4.0.0-dev", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false } +sp-session = { version = "4.0.0-dev", default-features = false } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -#pallet-contracts-primitives = { version = "3.0.0", default-features = false} -pallet-executive = { package = "frame-executive", version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-offences = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -pallet-authority-discovery = { version = "3.0.0", default-features = false } -pallet-randomness-collective-flip = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false} +pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-offences = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } smallvec = "1.4.0" [build-dependencies] @@ -127,9 +130,8 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - #"pallet-contracts-primitives/std", - #"pallet-contracts-rpc-runtime-api/std", - #"pallet-contracts/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-contracts/std", "pallet-executive/std", "pallet-external-agents/std", "pallet-grandpa/std", @@ -141,6 +143,7 @@ std = [ "pallet-multisig/std", "pallet-offences/std", "pallet-permissions/std", + "pallet-preimage/std", "pallet-pips/std", "pallet-portfolio/std", "pallet-protocol-fee-rpc-runtime-api/std", @@ -180,7 +183,7 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", - #"polymesh-contracts/std" + "polymesh-contracts/std" ] runtime-benchmarks = [ diff --git a/pallets/runtime/ci/src/fee_details.rs b/pallets/runtime/ci/src/fee_details.rs deleted file mode 100644 index 0fa6904435..0000000000 --- a/pallets/runtime/ci/src/fee_details.rs +++ /dev/null @@ -1,174 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{runtime, Runtime}; -use codec::{Decode, Encode}; -use frame_support::{StorageDoubleMap, StorageMap}; -use polymesh_common_utilities::{traits::transaction_payment::CddAndFeeDetails, Context}; -use polymesh_primitives::{AccountId, AuthorizationData, Hash, IdentityId, Signatory}; -use polymesh_runtime_common::fee_details::{ - CallType, ValidPayerResult, CDD_REQUIRED, INVALID_AUTH, MISSING_ID, -}; -use sp_core::crypto::UncheckedFrom; - -type Identity = pallet_identity::Module; -type Bridge = pallet_bridge::Module; -type Call = runtime::Call; - -#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)] -pub struct CddHandler; - -impl CddAndFeeDetails for CddHandler -where - AccountId: UncheckedFrom + AsRef<[u8]>, -{ - /// Check if there's an eligible payer with valid CDD. - /// Return the payer if found or else an error. - /// Can also return Ok(none) to represent the case where - /// CDD is valid but no payer should pay fee for this tx - /// This also sets the identity in the context to the identity that was checked for CDD - /// However, this does not set the payer context since that is meant to remain constant - /// throughout the transaction. This function can also be used to simply check CDD and update identity context. - fn get_valid_payer(call: &Call, caller: &AccountId) -> ValidPayerResult { - let handle_multisig = |multisig, caller: &AccountId| { - let sig = Signatory::Account(caller.clone()); - if >::contains_key(multisig, sig) { - check_cdd(&>::get( - multisig, - )) - } else { - MISSING_ID - } - }; - - // The CDD check and fee payer varies depending on the transaction. - // This match covers all possible scenarios. - match call { - // Register did call. - // all did registration should go through CDD - Call::TestUtils(pallet_test_utils::Call::register_did(..)) => Ok(Some(caller.clone())), - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing multisig that has a valid CDD. The auth should be valid. - Call::MultiSig(pallet_multisig::Call::accept_multisig_signer_as_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptMultiSigSigner) - } - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::join_identity_as_key(auth_id, ..)) => { - is_auth_valid(caller, auth_id, CallType::AcceptIdentitySecondary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::accept_primary_key(rotation_auth_id, ..)) => { - is_auth_valid(caller, rotation_auth_id, CallType::AcceptIdentityPrimary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::rotate_primary_key_to_secondary( - rotation_auth_id, - .., - )) => is_auth_valid(caller, rotation_auth_id, CallType::RotatePrimaryToSecondary), - // Call made by a new Account key to remove invitation for certain authorizations - // in an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::remove_authorization(_, auth_id, true)) => { - is_auth_valid(caller, auth_id, CallType::RemoveAuthorization) - } - // Call made by a user key to accept subsidy from a paying key. The auth should be valid. - Call::Relayer(pallet_relayer::Call::accept_paying_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptRelayerPayingKey) - } - // Call made by an Account key to propose, reject or approve a multisig transaction. - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::MultiSig( - pallet_multisig::Call::create_or_approve_proposal_as_key(multisig, ..) - | pallet_multisig::Call::create_proposal_as_key(multisig, ..) - | pallet_multisig::Call::approve_as_key(multisig, ..) - | pallet_multisig::Call::reject_as_key(multisig, ..), - ) => handle_multisig(multisig, caller), - // Call made by an Account key to propose or approve a multisig transaction via the bridge helper - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::Bridge( - pallet_bridge::Call::propose_bridge_tx(..) - | pallet_bridge::Call::batch_propose_bridge_tx(..), - ) => handle_multisig(&Bridge::controller_key(), caller), - // All other calls. - // - // The external account must directly be linked to an identity with valid CDD. - _ => match Identity::get_identity(caller) { - Some(did) if Identity::has_valid_cdd(did) => { - Context::set_current_identity::(Some(did)); - Ok(Some(caller.clone())) - } - Some(_) => CDD_REQUIRED, - // Return if there's no DID. - None => MISSING_ID, - }, - } - } - - /// Clears context. Should be called in post_dispatch - fn clear_context() { - Context::set_current_identity::(None); - Context::set_current_payer::(None); - } - - /// Sets payer in context. Should be called by the signed extension that first charges fee. - fn set_payer_context(payer: Option) { - Context::set_current_payer::(payer); - } - - /// Fetches fee payer for further payments (forwarded calls) - fn get_payer_from_context() -> Option { - Context::current_payer::() - } - - fn set_current_identity(did: &IdentityId) { - Context::set_current_identity::(Some(*did)); - } -} - -/// Returns signatory to charge fee if auth is valid. -fn is_auth_valid(acc: &AccountId, auth_id: &u64, call_type: CallType) -> ValidPayerResult { - // Fetch the auth if it exists and has not expired. - match Identity::get_non_expired_auth(&Signatory::Account(acc.clone()), auth_id) - .map(|auth| (auth.authorized_by, (auth.authorization_data, call_type))) - { - // Different auths have different authorization data requirements. - // Hence we match call type to ensure proper authorization data is present. - // We only need to check that there's a payer with a valid CDD. - // Business logic for authorisations can be checked post-Signed Extension. - Some(( - by, - (AuthorizationData::AddMultiSigSigner(_), CallType::AcceptMultiSigSigner) - | (AuthorizationData::JoinIdentity(_), CallType::AcceptIdentitySecondary) - | (AuthorizationData::RotatePrimaryKey, CallType::AcceptIdentityPrimary) - | (AuthorizationData::RotatePrimaryKeyToSecondary(_), CallType::RotatePrimaryToSecondary) - | (AuthorizationData::AddRelayerPayingKey(..), CallType::AcceptRelayerPayingKey) - | (_, CallType::RemoveAuthorization), - )) => check_cdd(&by), - // None of the above apply, so error. - _ => INVALID_AUTH, - } -} - -/// Returns signatory to charge fee if cdd is valid. -fn check_cdd(did: &IdentityId) -> ValidPayerResult { - if Identity::has_valid_cdd(*did) { - Context::set_current_identity::(Some(*did)); - Ok(Some(Identity::did_records(&did).primary_key)) - } else { - CDD_REQUIRED - } -} diff --git a/pallets/runtime/ci/src/lib.rs b/pallets/runtime/ci/src/lib.rs index 6bd4b72330..f069b153b4 100644 --- a/pallets/runtime/ci/src/lib.rs +++ b/pallets/runtime/ci/src/lib.rs @@ -2,10 +2,8 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -pub mod fee_details; -pub mod runtime; -pub use fee_details::CddHandler; pub mod constants; +pub mod runtime; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; diff --git a/pallets/runtime/ci/src/runtime.rs b/pallets/runtime/ci/src/runtime.rs index 5a99e28f7a..0167006654 100644 --- a/pallets/runtime/ci/src/runtime.rs +++ b/pallets/runtime/ci/src/runtime.rs @@ -1,17 +1,17 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{constants::time::*, fee_details::CddHandler}; +use crate::constants::time::*; use codec::Encode; #[cfg(feature = "migration-dry-run")] use frame_support::traits::OnRuntimeUpgrade; +use core::convert::TryFrom; use frame_support::{ - construct_runtime, debug, parameter_types, - traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, + construct_runtime, parameter_types, + traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem}, weights::Weight, }; -//use pallet_contracts::weights::WeightInfo; use pallet_asset::checkpoint as pallet_checkpoint; use pallet_corporate_actions::ballot as pallet_corporate_ballot; use pallet_corporate_actions::distribution as pallet_capital_distribution; @@ -24,10 +24,9 @@ use polymesh_primitives::{Balance, BlockNumber, Moment}; use polymesh_runtime_common::{ impls::Author, merge_active_and_inactive, - runtime::{GovernanceCommittee, VMO}, + runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO}, AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance, }; -use sp_core::u32_trait::{_1, _4}; use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::{ create_runtime_str, @@ -57,14 +56,12 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("polymesh_ci"), impl_name: create_runtime_str!("polymesh_ci"), authoring_version: 1, - // Per convention: if the runtime behavior changes, increment spec_version - // and set impl_version to 0. If only runtime - // implementation changes and behavior does not, then leave spec_version as - // is and increment impl_version. - spec_version: 3010, + // `spec_version: aaa_bbb_ccc` should match node version v`aaa.bbb.ccc` + spec_version: 5_000_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 2, + transaction_version: 3, + state_version: 1, }; parameter_types! { @@ -95,15 +92,6 @@ parameter_types! { // Authorship: pub const UncleGenerations: BlockNumber = 0; - // Session: - // NOTE: `SessionHandler` and `SessionKeys` are co-dependent: - // One key will be used for each handler. - // The number and order of items in `SessionHandler` *MUST* be the same number - // and order of keys in `SessionKeys`. - // TODO: Introduce some structure to tie these together to make it a bit less of a footgun. - // This should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858 - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); - // Contracts: pub const NetworkShareInFee: Perbill = Perbill::from_percent(60); pub const TombstoneDeposit: Balance = 0; @@ -116,17 +104,21 @@ parameter_types! { // Settlement: pub const MaxLegsInInstruction: u32 = 10; - // Offences: - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); - // I'm online: - pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; + // Assets: pub const MaxNumberOfTMExtensionForAsset: u32 = 5; pub const AssetNameMaxLength: u32 = 128; pub const FundingRoundNameMaxLength: u32 = 128; + pub const AssetMetadataNameMaxLength: u32 = 256; + pub const AssetMetadataValueMaxLength: u32 = 8 * 1024; + pub const AssetMetadataTypeDefMaxLength: u32 = 8 * 1024; // Compliance manager: pub const MaxConditionComplexity: u32 = 50; @@ -136,38 +128,32 @@ parameter_types! { pub const MaxDidWhts: u32 = 1000; // Statistics: - pub const MaxTransferManagersPerAsset: u32 = 3; + pub const MaxStatsPerAsset: u32 = 10 + BENCHMARK_MAX_INCREASE; + pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 0; - /* - /// The fraction of the deposit that should be used as rent per block. - pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS); - // The lazy deletion runs inside on_initialize. - pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * - RuntimeBlockWeights::get().max_block; - // The weight needed for decoding the queue should be less or equal than a fifth - // of the overall weight dedicated to the lazy deletion. - pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / ( - ::WeightInfo::on_initialize_per_queue_item(1) - - ::WeightInfo::on_initialize_per_queue_item(0) - )) / 5) as u32; - */ + // Contracts: + pub Schedule: pallet_contracts::Schedule = Default::default(); + pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionQueueDepth: u32 = 1024; + pub MaxInLen: u32 = 8 * 1024; } /// Splits fees 80/20 between treasury and block author. pub type DealWithFees = SplitTwoWays< Balance, NegativeImbalance, - _4, - Treasury, // 4 parts (80%) goes to the treasury. - _1, + Treasury, // 4 parts (80%) goes to the treasury. Author, // 1 part (20%) goes to the block author. + 4, + 1, >; // Staking: @@ -191,7 +177,7 @@ parameter_types! { pub const MaxIterations: u32 = 10; pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33); // 0.05%. The higher the value, the more strict solution acceptance becomes. - pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); + pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 140_000_000 * POLY; pub const MinimumBond: Balance = 1 * POLY; @@ -204,6 +190,18 @@ parameter_types! { polymesh_runtime_common::misc_pallet_impls!(); +type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler; + +impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call { + type Error = (); + fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call, ()> { + match call { + Call::TestUtils(x) => Ok(x), + _ => Err(()), + } + } +} + impl polymesh_common_utilities::traits::identity::Config for Runtime { type Event = Event; type Proposal = Call; @@ -221,6 +219,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } impl pallet_committee::Config for Runtime { @@ -301,7 +300,7 @@ impl pallet_test_utils::Config for Runtime { type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; } -pub type AllModulesExported = AllModules; +pub type AllModulesExported = AllPalletsWithSystem; construct_runtime!( pub enum Runtime where @@ -309,88 +308,90 @@ construct_runtime!( NodeBlock = polymesh_primitives::Block, UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Module, Call, Config, Storage, Event}, - Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Indices: pallet_indices::{Module, Call, Storage, Config, Event}, - Authorship: pallet_authorship::{Module, Call, Storage, Inherent}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, + Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, // Balance: Genesis config dependencies: System. - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Module, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, // Identity: Genesis config deps: Timestamp. - Identity: pallet_identity::{Module, Call, Storage, Event, Config}, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, // Polymesh Committees // CddServiceProviders (group only): Genesis config deps: Identity - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config}, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Governance Council (committee) - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. - CommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + CommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Technical Committee - TechnicalCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + TechnicalCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity - TechnicalCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + TechnicalCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Upgrade Committee - UpgradeCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + UpgradeCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee, Identity - UpgradeCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + UpgradeCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, - MultiSig: pallet_multisig::{Module, Call, Config, Storage, Event}, + MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event}, // Bridge: Genesis config deps: Multisig, Identity, Committees - Bridge: pallet_bridge::{Module, Call, Storage, Config, Event}, + Bridge: pallet_bridge::{Pallet, Call, Storage, Config, Event}, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees - Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned}, - Offences: pallet_offences::{Module, Call, Storage, Event}, + Staking: pallet_staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned}, + Offences: pallet_offences::{Pallet, Storage, Event}, // Session: Genesis config deps: System. - Session: pallet_session::{Module, Call, Storage, Event, Config}, - AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config}, - Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event}, - Historical: pallet_session_historical::{Module}, - ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, + Historical: pallet_session_historical::{Pallet}, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // Sudo. Usable initially. - Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, + + // Asset: Genesis config deps: Timestamp, + Asset: pallet_asset::{Pallet, Call, Storage, Config, Event}, + CapitalDistribution: pallet_capital_distribution::{Pallet, Call, Storage, Event}, + Checkpoint: pallet_checkpoint::{Pallet, Call, Storage, Event, Config}, + ComplianceManager: pallet_compliance_manager::{Pallet, Call, Storage, Event}, + CorporateAction: pallet_corporate_actions::{Pallet, Call, Storage, Event, Config}, + CorporateBallot: pallet_corporate_ballot::{Pallet, Call, Storage, Event}, + Permissions: pallet_permissions::{Pallet}, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config}, + Portfolio: pallet_portfolio::{Pallet, Call, Storage, Event}, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config}, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, + Settlement: pallet_settlement::{Pallet, Call, Storage, Event, Config}, + Statistics: pallet_statistics::{Pallet, Call, Storage, Event}, + Sto: pallet_sto::{Pallet, Call, Storage, Event}, + Treasury: pallet_treasury::{Pallet, Call, Event}, + Utility: pallet_utility::{Pallet, Call, Storage, Event}, + Base: pallet_base::{Pallet, Call, Event}, + ExternalAgents: pallet_external_agents::{Pallet, Call, Storage, Event}, + Relayer: pallet_relayer::{Pallet, Call, Storage, Event}, + Rewards: pallet_rewards::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, - /* // Contracts - BaseContracts: pallet_contracts::{Module, Config, Storage, Event}, - Contracts: polymesh_contracts::{Module, Call, Storage, Event}, - */ + Contracts: pallet_contracts::{Pallet, Storage, Event}, + PolymeshContracts: polymesh_contracts::{Pallet, Call, Storage, Event}, - // Asset: Genesis config deps: Timestamp, - Asset: pallet_asset::{Module, Call, Storage, Config, Event}, - CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event}, - Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config}, - ComplianceManager: pallet_compliance_manager::{Module, Call, Storage, Event}, - CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config}, - CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event}, - Permissions: pallet_permissions::{Module}, - Pips: pallet_pips::{Module, Call, Storage, Event, Config}, - Portfolio: pallet_portfolio::{Module, Call, Storage, Event}, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Settlement: pallet_settlement::{Module, Call, Storage, Event, Config}, - Statistics: pallet_statistics::{Module, Call, Storage, Event}, - Sto: pallet_sto::{Module, Call, Storage, Event}, - Treasury: pallet_treasury::{Module, Call, Event}, - Utility: pallet_utility::{Module, Call, Storage, Event}, - Base: pallet_base::{Module, Call, Event}, - ExternalAgents: pallet_external_agents::{Module, Call, Storage, Event}, - Relayer: pallet_relayer::{Module, Call, Storage, Event}, - Rewards: pallet_rewards::{Module, Call, Storage, Event, Config, ValidateUnsigned}, - TestUtils: pallet_test_utils::{Module, Call, Storage, Event } = 50, + // Preimage register. Used by `pallet_scheduler`. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event}, + + TestUtils: pallet_test_utils::{Pallet, Call, Storage, Event } = 50, } ); @@ -407,6 +408,6 @@ pub trait DryRunRuntimeUpgrade { #[cfg(feature = "migration-dry-run")] impl DryRunRuntimeUpgrade for Runtime { fn dry_run_runtime_upgrade() -> Weight { - ::on_runtime_upgrade() + ::on_runtime_upgrade() } } diff --git a/pallets/runtime/common/Cargo.toml b/pallets/runtime/common/Cargo.toml index 04f8fdb415..709b38da06 100644 --- a/pallets/runtime/common/Cargo.toml +++ b/pallets/runtime/common/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-runtime-common" version = "1.0.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../../common", default-features = false } @@ -10,12 +10,15 @@ polymesh-primitives = { path = "../../../primitives", default-features = false } pallet-asset = { path = "../../asset", default-features = false } pallet-balances = { path = "../../balances", default-features = false } +pallet-bridge = { path = "../../bridge", default-features = false } pallet-committee = { path = "../../committee", default-features = false } pallet-compliance-manager = { path = "../../compliance-manager", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } +#pallet-contracts = { version = "4.0.0-dev", default-features = false } pallet-identity = { path = "../../identity", default-features = false } -pallet-multisig = { path = "../../multisig", default-features = false} +pallet-multisig = { path = "../../multisig", default-features = false } pallet-portfolio = { path = "../../portfolio", default-features = false } +pallet-relayer = { path = "../../relayer", default-features = false } +pallet-test-utils = { path = "../../test-utils", default-features = false } # RPC pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false} @@ -26,19 +29,19 @@ rand = { version = "0.7.3", default-features = false } smallvec = "1.4.0" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } # Only benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/runtime/common/src/fee_details.rs b/pallets/runtime/common/src/fee_details.rs index c1c0757f01..8590d6c139 100644 --- a/pallets/runtime/common/src/fee_details.rs +++ b/pallets/runtime/common/src/fee_details.rs @@ -1,9 +1,220 @@ use codec::{Decode, Encode}; -use polymesh_primitives::{AccountId, TransactionError}; +use core::convert::{TryFrom, TryInto}; +use core::marker::PhantomData; +use frame_support::{StorageDoubleMap, StorageMap}; +use pallet_identity::Module; +use polymesh_common_utilities::traits::identity::Config; +use polymesh_common_utilities::{traits::transaction_payment::CddAndFeeDetails, Context}; +use polymesh_primitives::{AccountId, AuthorizationData, IdentityId, Signatory, TransactionError}; use sp_runtime::transaction_validity::InvalidTransaction; +/// A `CddHandler` that considers `TestUtils`. +pub type DevCddHandler = CddHandler>; + +/// Hook for `CddHandler`'s `get_valid_payer`. +pub trait GetValidPayerHook { + /// Gets called by `CddHandler::get_valid_payer` as a pre-processing step. + fn get_valid_payer(call: &C, caller: &AccountId) -> Option; +} + +/// Provides a hook to deal with `TestUtils::register_did`. +pub struct WithTestUtils(PhantomData); + +impl GetValidPayerHook for WithTestUtils +where + for<'a> &'a pallet_test_utils::Call: TryFrom<&'a C>, + A: pallet_test_utils::Config, +{ + fn get_valid_payer(call: &C, caller: &AccountId) -> Option { + match <&pallet_test_utils::Call>::try_from(call) { + // Register did call. + // all did registration should go through CDD + Ok(pallet_test_utils::Call::register_did { .. }) => Some(Ok(Some(caller.clone()))), + _ => None, + } + } +} + +/// Provides a hook that does nothing. +pub struct Noop; + +impl GetValidPayerHook for Noop { + fn get_valid_payer(_: &C, _: &AccountId) -> Option { + None + } +} + +/// The set of `Call`s from pallets that `CddHandler` recognizes specially. +pub enum Call<'a, R> +where + R: Config + pallet_multisig::Config + pallet_relayer::Config + pallet_bridge::Config, +{ + MultiSig(&'a pallet_multisig::Call), + Identity(&'a pallet_identity::Call), + Relayer(&'a pallet_relayer::Call), + Bridge(&'a pallet_bridge::Call), +} + +/// The implementation of `CddAndFeeDetails` for the chain. +#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)] +pub struct CddHandler(PhantomData<(A, H)>); + +impl CddAndFeeDetails for CddHandler +where + H: GetValidPayerHook, + for<'a> Call<'a, A>: TryFrom<&'a C>, + A: Config + + pallet_multisig::Config + + pallet_relayer::Config + + pallet_bridge::Config, +{ + /// Check if there's an eligible payer with valid CDD. + /// Return the payer if found or else an error. + /// Can also return Ok(none) to represent the case where + /// CDD is valid but no payer should pay fee for this tx + /// This also sets the identity in the context to the identity that was checked for CDD + /// However, this does not set the payer context since that is meant to remain constant + /// throughout the transaction. This function can also be used to simply check CDD and update identity context. + fn get_valid_payer(call: &C, caller: &AccountId) -> ValidPayerResult { + match H::get_valid_payer(call, caller) { + Some(r) => return r, + None => {} + } + + // Returns signatory to charge fee if cdd is valid. + let check_cdd = |did: &IdentityId| { + if Module::::has_valid_cdd(*did) { + Context::set_current_identity::>(Some(*did)); + Ok(Module::::get_primary_key(*did)) + } else { + CDD_REQUIRED + } + }; + + let handle_multisig = |multisig: &AccountId, caller: &AccountId| { + let sig = Signatory::Account(caller.clone()); + if >::contains_key(multisig, sig) { + check_cdd(&>::get(multisig)) + } else { + MISSING_ID + } + }; + + // Returns signatory to charge fee if auth is valid. + let is_auth_valid = |acc: &AccountId, auth_id: &u64, call_type: CallType| { + // Fetch the auth if it exists and has not expired. + match Module::::get_non_expired_auth(&Signatory::Account(acc.clone()), auth_id) + .map(|auth| (auth.authorized_by, (auth.authorization_data, call_type))) + { + // Different auths have different authorization data requirements. + // Hence we match call type to ensure proper authorization data is present. + // We only need to check that there's a payer with a valid CDD. + // Business logic for authorisations can be checked post-Signed Extension. + Some(( + by, + (AuthorizationData::AddMultiSigSigner(_), CallType::AcceptMultiSigSigner) + | (AuthorizationData::JoinIdentity(_), CallType::AcceptIdentitySecondary) + | (AuthorizationData::RotatePrimaryKey, CallType::AcceptIdentityPrimary) + | ( + AuthorizationData::RotatePrimaryKeyToSecondary(_), + CallType::RotatePrimaryToSecondary, + ) + | (AuthorizationData::AddRelayerPayingKey(..), CallType::AcceptRelayerPayingKey) + | (_, CallType::RemoveAuthorization), + )) => check_cdd(&by), + // None of the above apply, so error. + _ => INVALID_AUTH, + } + }; + + // The CDD check and fee payer varies depending on the transaction. + // This match covers all possible scenarios. + match call.try_into() { + // Call made by a new Account key to accept invitation to become a secondary key + // of an existing multisig that has a valid CDD. The auth should be valid. + Ok(Call::MultiSig(pallet_multisig::Call::accept_multisig_signer_as_key { + auth_id, + })) => is_auth_valid(caller, auth_id, CallType::AcceptMultiSigSigner), + // Call made by a new Account key to accept invitation to become a secondary key + // of an existing identity that has a valid CDD. The auth should be valid. + Ok(Call::Identity(pallet_identity::Call::join_identity_as_key { auth_id })) => { + is_auth_valid(caller, auth_id, CallType::AcceptIdentitySecondary) + } + // Call made by a new Account key to accept invitation to become the primary key + // of an existing identity that has a valid CDD. The auth should be valid. + Ok(Call::Identity(pallet_identity::Call::accept_primary_key { + rotation_auth_id, + .. + })) => is_auth_valid(caller, rotation_auth_id, CallType::AcceptIdentityPrimary), + // Call made by a new Account key to accept invitation to become the primary key + // of an existing identity that has a valid CDD. The auth should be valid. + Ok(Call::Identity(pallet_identity::Call::rotate_primary_key_to_secondary { + auth_id, + .. + })) => is_auth_valid(caller, auth_id, CallType::RotatePrimaryToSecondary), + // Call made by a new Account key to remove invitation for certain authorizations + // in an existing identity that has a valid CDD. The auth should be valid. + Ok(Call::Identity(pallet_identity::Call::remove_authorization { + auth_id, + _auth_issuer_pays: true, + .. + })) => is_auth_valid(caller, auth_id, CallType::RemoveAuthorization), + // Call made by a user key to accept subsidy from a paying key. The auth should be valid. + Ok(Call::Relayer(pallet_relayer::Call::accept_paying_key { auth_id })) => { + is_auth_valid(caller, auth_id, CallType::AcceptRelayerPayingKey) + } + // Call made by an Account key to propose, reject or approve a multisig transaction. + // The multisig must have valid CDD and the caller must be a signer of the multisig. + Ok(Call::MultiSig( + pallet_multisig::Call::create_or_approve_proposal_as_key { multisig, .. } + | pallet_multisig::Call::create_proposal_as_key { multisig, .. } + | pallet_multisig::Call::approve_as_key { multisig, .. } + | pallet_multisig::Call::reject_as_key { multisig, .. }, + )) => handle_multisig(multisig, caller), + // Call made by an Account key to propose or approve a multisig transaction via the bridge helper + // The multisig must have valid CDD and the caller must be a signer of the multisig. + Ok(Call::Bridge( + pallet_bridge::Call::propose_bridge_tx { .. } + | pallet_bridge::Call::batch_propose_bridge_tx { .. }, + )) => handle_multisig(&pallet_bridge::Module::::controller_key(), caller), + // All other calls. + // + // The external account must directly be linked to an identity with valid CDD. + _ => match pallet_identity::Module::::get_identity(caller) { + Some(did) if pallet_identity::Module::::has_valid_cdd(did) => { + Self::set_current_identity(&did); + Ok(Some(caller.clone())) + } + Some(_) => CDD_REQUIRED, + // Return if there's no DID. + None => MISSING_ID, + }, + } + } + + /// Clears context. Should be called in post_dispatch + fn clear_context() { + Context::set_current_identity::>(None); + Self::set_payer_context(None); + } + + /// Sets payer in context. Should be called by the signed extension that first charges fee. + fn set_payer_context(payer: Option) { + Context::set_current_payer::>(payer); + } + + /// Fetches fee payer for further payments (forwarded calls) + fn get_payer_from_context() -> Option { + Context::current_payer::>() + } + + fn set_current_identity(did: &IdentityId) { + Context::set_current_identity::>(Some(*did)); + } +} + #[derive(Encode, Decode)] -pub enum CallType { +enum CallType { AcceptMultiSigSigner, AcceptRelayerPayingKey, AcceptIdentitySecondary, @@ -14,16 +225,16 @@ pub enum CallType { RemoveAuthorization, } -pub type ValidPayerResult = Result, InvalidTransaction>; +type ValidPayerResult = Result, InvalidTransaction>; -pub const CDD_REQUIRED: ValidPayerResult = Err(InvalidTransaction::Custom( +const CDD_REQUIRED: ValidPayerResult = Err(InvalidTransaction::Custom( TransactionError::CddRequired as u8, )); -pub const MISSING_ID: ValidPayerResult = Err(InvalidTransaction::Custom( +const MISSING_ID: ValidPayerResult = Err(InvalidTransaction::Custom( TransactionError::MissingIdentity as u8, )); -pub const INVALID_AUTH: ValidPayerResult = Err(InvalidTransaction::Custom( +const INVALID_AUTH: ValidPayerResult = Err(InvalidTransaction::Custom( TransactionError::InvalidAuthorization as u8, )); diff --git a/pallets/runtime/common/src/impls.rs b/pallets/runtime/common/src/impls.rs index 908a2f81b6..d5792e21ad 100644 --- a/pallets/runtime/common/src/impls.rs +++ b/pallets/runtime/common/src/impls.rs @@ -50,7 +50,9 @@ where ::AccountId: Into, { fn on_nonzero_unbalanced(amount: NegativeImbalance) { - >::resolve_creating(&>::author(), amount); + if let Some(author) = authorship::Pallet::::author() { + >::resolve_creating(&author, amount); + } } } diff --git a/pallets/runtime/common/src/lib.rs b/pallets/runtime/common/src/lib.rs index b2dacf33db..a0f5a32905 100644 --- a/pallets/runtime/common/src/lib.rs +++ b/pallets/runtime/common/src/lib.rs @@ -87,6 +87,8 @@ parameter_types! { pub const TransactionByteFee: Balance = 10 * MILLICENTS; /// We want the noop transaction to cost 0.03 POLYX pub const PolyXBaseFee: Balance = 3 * CENTS; + /// MultiSig balance limit: 1 POLYX + pub const MultiSigBalanceLimit: Balance = POLY; /// The maximum weight of the pips extrinsic `enact_snapshot_results` which equals to /// `MaximumBlockWeight * AvailableBlockRatio`. pub const PipsEnactSnapshotMaximumWeight: Weight = MAXIMUM_BLOCK_WEIGHT * 75 / 100; @@ -94,10 +96,10 @@ parameter_types! { pub const SignedClaimHandicap: u32 = 2; /// The balance every contract needs to deposit to stay alive indefinitely. pub const DepositPerContract: u128 = 10 * CENTS; - /// The balance a contract needs to deposit per storage byte to stay alive indefinitely. - pub const DepositPerStorageByte: u128 = deposit(0, 1); /// The balance a contract needs to deposit per storage item to stay alive indefinitely. - pub const DepositPerStorageItem: u128 = deposit(1, 0); + pub const DepositPerItem: u128 = deposit(1, 0); + /// The balance a contract needs to deposit per storage byte to stay alive indefinitely. + pub const DepositPerByte: u128 = deposit(0, 1); /// The maximum nesting level of a call/instantiate stack. pub const ContractsMaxDepth: u32 = 32; /// The maximum size of a storage value and event payload in bytes. @@ -144,7 +146,7 @@ impl WeightToFeePolynomial for WeightToFee { fn polynomial() -> WeightToFeeCoefficients { smallvec![WeightToFeeCoefficient { degree: 1, - coeff_frac: Perbill::from_rational_approximation( + coeff_frac: Perbill::from_rational( PolyXBaseFee::get().into(), ExtrinsicBaseWeight::get() as u128 ), diff --git a/pallets/runtime/common/src/runtime.rs b/pallets/runtime/common/src/runtime.rs index e47dd7a7cf..6fa104716e 100644 --- a/pallets/runtime/common/src/runtime.rs +++ b/pallets/runtime/common/src/runtime.rs @@ -4,6 +4,15 @@ pub type VMO = pub type GovernanceCommittee = pallet_committee::Instance1; +// Allow benchmarks to run with larger inputs. +// This is needed for extrinsics that have a `Vec<_>` parameter +// and need to make sure that the cost function is correct for +// large inputs. +#[cfg(feature = "runtime-benchmarks")] +pub const BENCHMARK_MAX_INCREASE: u32 = 1000; +#[cfg(not(feature = "runtime-benchmarks"))] +pub const BENCHMARK_MAX_INCREASE: u32 = 0; + /// Provides miscellaneous and common pallet-`Config` implementations for a `Runtime`. #[macro_export] macro_rules! misc_pallet_impls { @@ -25,7 +34,7 @@ macro_rules! misc_pallet_impls { impl frame_system::Config for Runtime { /// The basic call filter to use in dispatchable. - type BaseCallFilter = (); + type BaseCallFilter = frame_support::traits::Everything; /// Block & extrinsics weights: base values and limits. type BlockWeights = polymesh_runtime_common::RuntimeBlockWeights; /// The maximum length of a block (in bytes). @@ -74,6 +83,8 @@ macro_rules! misc_pallet_impls { /// The data to be stored in an account. type AccountData = polymesh_common_utilities::traits::balances::AccountData; type SystemWeightInfo = polymesh_weights::frame_system::WeightInfo; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_base::Config for Runtime { @@ -86,6 +97,7 @@ macro_rules! misc_pallet_impls { type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type DisabledValidators = Session; type KeyOwnerProofSystem = Historical; @@ -104,6 +116,7 @@ macro_rules! misc_pallet_impls { Offences, ReportLongevity, >; + type MaxAuthorities = MaxAuthorities; } impl pallet_indices::Config for Runtime { @@ -114,6 +127,22 @@ macro_rules! misc_pallet_impls { type WeightInfo = polymesh_weights::pallet_indices::WeightInfo; } + impl<'a> core::convert::TryFrom<&'a Call> + for polymesh_runtime_common::fee_details::Call<'a, Runtime> + { + type Error = (); + fn try_from(call: &'a Call) -> Result { + use polymesh_runtime_common::fee_details::Call::*; + Ok(match call { + Call::Identity(x) => Identity(x), + Call::Bridge(x) => Bridge(x), + Call::MultiSig(x) => MultiSig(x), + Call::Relayer(x) => Relayer(x), + _ => return Err(()), + }) + } + } + impl pallet_transaction_payment::Config for Runtime { type Currency = Balances; type OnChargeTransaction = @@ -130,7 +159,7 @@ macro_rules! misc_pallet_impls { impl polymesh_common_utilities::traits::CommonConfig for Runtime { type AssetSubTraitTarget = Asset; - type BlockRewardsReserve = pallet_balances::Module; + type BlockRewardsReserve = pallet_balances::Pallet; } impl pallet_balances::Config for Runtime { @@ -138,7 +167,7 @@ macro_rules! misc_pallet_impls { type DustRemoval = (); type Event = Event; type ExistentialDeposit = ExistentialDeposit; - type AccountStore = frame_system::Module; + type AccountStore = frame_system::Pallet; type CddChecker = polymesh_runtime_common::cdd_check::CddChecker; type WeightInfo = polymesh_weights::pallet_balances::WeightInfo; } @@ -184,7 +213,6 @@ macro_rules! misc_pallet_impls { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type WeightInfo = polymesh_weights::pallet_session::WeightInfo; } @@ -197,6 +225,7 @@ macro_rules! misc_pallet_impls { } impl pallet_staking::Config for Runtime { + const MAX_NOMINATIONS: u32 = pallet_staking::MAX_NOMINATIONS; type Currency = Balances; type UnixTime = Timestamp; type CurrencyToVote = frame_support::traits::U128CurrencyToVote; @@ -232,7 +261,9 @@ macro_rules! misc_pallet_impls { type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; } - impl pallet_authority_discovery::Config for Runtime {} + impl pallet_authority_discovery::Config for Runtime { + type MaxAuthorities = MaxAuthorities; + } impl pallet_sudo::Config for Runtime { type Event = Event; @@ -277,19 +308,20 @@ macro_rules! misc_pallet_impls { type Currency = Balances; type ComplianceManager = pallet_compliance_manager::Module; type MaxNumberOfTMExtensionForAsset = MaxNumberOfTMExtensionForAsset; - type UnixTime = pallet_timestamp::Module; + type UnixTime = pallet_timestamp::Pallet; type AssetNameMaxLength = AssetNameMaxLength; type FundingRoundNameMaxLength = FundingRoundNameMaxLength; + type AssetMetadataNameMaxLength = AssetMetadataNameMaxLength; + type AssetMetadataValueMaxLength = AssetMetadataValueMaxLength; + type AssetMetadataTypeDefMaxLength = AssetMetadataTypeDefMaxLength; type AssetFn = Asset; type WeightInfo = polymesh_weights::pallet_asset::WeightInfo; type CPWeightInfo = polymesh_weights::pallet_checkpoint::WeightInfo; - //type ContractsFn = polymesh_contracts::Module; } - /* impl polymesh_contracts::Config for Runtime { type Event = Event; - type NetworkShareInFee = NetworkShareInFee; + type MaxInLen = MaxInLen; type WeightInfo = polymesh_weights::polymesh_contracts::WeightInfo; } impl pallet_contracts::Config for Runtime { @@ -297,24 +329,32 @@ macro_rules! misc_pallet_impls { type Randomness = RandomnessCollectiveFlip; type Currency = Balances; type Event = Event; - type RentPayment = (); - type SignedClaimHandicap = polymesh_runtime_common::SignedClaimHandicap; - type TombstoneDeposit = TombstoneDeposit; - type DepositPerContract = polymesh_runtime_common::DepositPerContract; - type DepositPerStorageByte = polymesh_runtime_common::DepositPerStorageByte; - type DepositPerStorageItem = polymesh_runtime_common::DepositPerStorageItem; - type RentFraction = RentFraction; - type SurchargeReward = SurchargeReward; - type MaxDepth = polymesh_runtime_common::ContractsMaxDepth; - type MaxValueSize = polymesh_runtime_common::ContractsMaxValueSize; - type WeightPrice = pallet_transaction_payment::Module; + type Call = Call; + // The `CallFilter` ends up being used in `ext.call_runtime()`, + // via the `seal_call_runtime` feature, + // which won't swap the current identity, + // so we need `Nothing` to basically disable that feature. + type CallFilter = frame_support::traits::Nothing; + type DepositPerItem = polymesh_runtime_common::DepositPerItem; + type DepositPerByte = polymesh_runtime_common::DepositPerByte; + type CallStack = [pallet_contracts::Frame; 31]; + type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_contracts::weights::SubstrateWeight; - type ChainExtension = (); + type ChainExtension = polymesh_contracts::Pallet; + type Schedule = Schedule; type DeletionQueueDepth = DeletionQueueDepth; type DeletionWeightLimit = DeletionWeightLimit; - type MaxCodeSize = polymesh_runtime_common::ContractsMaxCodeSize; + type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + } + impl From> for Call { + fn from(call: polymesh_contracts::CommonCall) -> Self { + use polymesh_contracts::CommonCall::*; + match call { + Asset(x) => Self::Asset(x), + Contracts(x) => Self::PolymeshContracts(x), + } + } } - */ impl pallet_compliance_manager::Config for Runtime { type Event = Event; @@ -335,7 +375,8 @@ macro_rules! misc_pallet_impls { impl pallet_statistics::Config for Runtime { type Event = Event; type Asset = Asset; - type MaxTransferManagersPerAsset = MaxTransferManagersPerAsset; + type MaxStatsPerAsset = MaxStatsPerAsset; + type MaxTransferConditionsPerAsset = MaxTransferConditionsPerAsset; type WeightInfo = polymesh_weights::pallet_statistics::WeightInfo; } @@ -354,13 +395,31 @@ macro_rules! misc_pallet_impls { type ScheduleOrigin = polymesh_primitives::EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = polymesh_weights::pallet_scheduler::WeightInfo; + type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly; + type PreimageProvider = Preimage; + type NoPreimagePostponement = NoPreimagePostponement; + } + + parameter_types! { + pub const PreimageMaxSize: u32 = 4096 * 1024; + pub const PreimageBaseDeposit: Balance = polymesh_runtime_common::deposit(2, 64); + pub const PreimageByteDeposit: Balance = polymesh_runtime_common::deposit(0, 1); + } + + impl pallet_preimage::Config for Runtime { + type WeightInfo = polymesh_weights::pallet_preimage::WeightInfo; + type Event = Event; + type Currency = Balances; + type ManagerOrigin = polymesh_primitives::EnsureRoot; + type MaxSize = PreimageMaxSize; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; } impl pallet_offences::Config for Runtime { type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; - type WeightSoftLimit = OffencesWeightSoftLimit; } type GrandpaKey = (sp_core::crypto::KeyTypeId, pallet_grandpa::AuthorityId); @@ -368,11 +427,14 @@ macro_rules! misc_pallet_impls { impl pallet_im_online::Config for Runtime { type AuthorityId = pallet_im_online::sr25519::AuthorityId; type Event = Event; + type NextSessionRotation = Babe; type ValidatorSet = Historical; type UnsignedPriority = ImOnlineUnsignedPriority; type ReportUnresponsiveness = Offences; - type SessionDuration = SessionDuration; type WeightInfo = polymesh_weights::pallet_im_online::WeightInfo; + type MaxKeys = MaxKeys; + type MaxPeerInHeartbeats = MaxPeerInHeartbeats; + type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } impl pallet_grandpa::Config for Runtime { @@ -393,8 +455,11 @@ macro_rules! misc_pallet_impls { Offences, ReportLongevity, >; + type MaxAuthorities = MaxAuthorities; } + impl pallet_randomness_collective_flip::Config for Runtime {} + impl pallet_treasury::Config for Runtime { type Event = Event; type Currency = Balances; @@ -452,7 +517,7 @@ macro_rules! misc_pallet_impls { ); let raw_payload = SignedPayload::new(call, extra) .map_err(|e| { - debug::warn!("Unable to create signed payload: {:?}", e); + log::warn!("Unable to create signed payload: {:?}", e); }) .ok()?; let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; @@ -483,11 +548,10 @@ macro_rules! runtime_apis { ($($extra:item)*) => { use node_rpc_runtime_api::asset as rpc_api_asset; use sp_inherents::{CheckInherentsResult, InherentData}; - //use pallet_contracts_primitives::ContractExecResult; - use pallet_identity::types::{AssetDidResult, CddStatus, DidRecords, DidStatus, KeyIdentityData}; + use pallet_identity::types::{AssetDidResult, CddStatus, RpcDidRecords, DidStatus, KeyIdentityData}; use pallet_pips::{Vote, VoteCount}; use pallet_protocol_fee_rpc_runtime_api::CappedFee; - use polymesh_primitives::{calendar::CheckpointId, compliance_manager::AssetComplianceResult, IdentityId, Index, PortfolioId, SecondaryKey, Signatory, Ticker}; + use polymesh_primitives::{calendar::CheckpointId, compliance_manager::AssetComplianceResult, IdentityId, Index, PortfolioId, Signatory, Ticker}; /// The address format for describing accounts. pub type Address = ::Source; @@ -522,9 +586,29 @@ macro_rules! runtime_apis { Block, frame_system::ChainContext, Runtime, - AllModules, + AllPalletsWithSystem, + MigrationV4toV5, >; + // Trait needed for frame-system migration. + impl frame_system::migrations::V2ToV3 for Runtime { + type Pallet = frame_system::Pallet; + type AccountId = polymesh_primitives::AccountId; + type Index = polymesh_primitives::Index; + type AccountData = polymesh_common_utilities::traits::balances::AccountData; + } + + // Polymesh V4 -> V5 runtime migrations. + pub struct MigrationV4toV5; + impl frame_support::traits::OnRuntimeUpgrade for MigrationV4toV5 { + fn on_runtime_upgrade() -> Weight { + // System migration. + frame_system::migrations::migrate_from_dual_to_triple_ref_count::() + // Scheduler migration. + .saturating_add(Scheduler::migrate_v2_to_v3()) + } + } + sp_api::impl_runtime_apis! { impl sp_api::Core for Runtime { fn version() -> RuntimeVersion { @@ -542,7 +626,7 @@ macro_rules! runtime_apis { impl sp_api::Metadata for Runtime { fn metadata() -> sp_core::OpaqueMetadata { - Runtime::metadata().into() + sp_core::OpaqueMetadata::new(Runtime::metadata().into()) } } @@ -562,18 +646,15 @@ macro_rules! runtime_apis { fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { data.check_extrinsics(&block) } - - fn random_seed() -> ::Hash { - RandomnessCollectiveFlip::random_seed() - } } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( source: sp_runtime::transaction_validity::TransactionSource, tx: ::Extrinsic, + block_hash: ::Hash, ) -> sp_runtime::transaction_validity::TransactionValidity { - Executive::validate_transaction(source, tx) + Executive::validate_transaction(source, tx, block_hash) } } @@ -613,6 +694,10 @@ macro_rules! runtime_apis { .map(|p| p.encode()) .map(pallet_grandpa::fg_primitives::OpaqueKeyOwnershipProof::new) } + + fn current_set_id() -> pallet_grandpa::fg_primitives::SetId { + Grandpa::current_set_id() + } } impl sp_consensus_babe::BabeApi for Runtime { @@ -626,7 +711,7 @@ macro_rules! runtime_apis { slot_duration: Babe::slot_duration(), epoch_length: EpochDuration::get(), c: PRIMARY_PROBABILITY, - genesis_authorities: Babe::authorities(), + genesis_authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots, } @@ -680,34 +765,51 @@ macro_rules! runtime_apis { } } - /* - impl pallet_contracts_rpc_runtime_api::ContractsApi - for Runtime - { + impl pallet_contracts_rpc_runtime_api::ContractsApi< + Block, + polymesh_primitives::AccountId, + Balance, + BlockNumber, + polymesh_primitives::Hash, + > for Runtime { fn call( origin: polymesh_primitives::AccountId, dest: polymesh_primitives::AccountId, value: Balance, gas_limit: u64, + storage_deposit_limit: Option, input_data: Vec, - ) -> ContractExecResult { - BaseContracts::bare_call(origin, dest.into(), value, gas_limit, input_data) + ) -> pallet_contracts_primitives::ContractExecResult { + Contracts::bare_call(origin, dest, value, gas_limit, storage_deposit_limit, input_data, false) + } + + fn instantiate( + origin: polymesh_primitives::AccountId, + value: Balance, + gas_limit: u64, + storage_deposit_limit: Option, + code: pallet_contracts_primitives::Code, + data: Vec, + salt: Vec, + ) -> pallet_contracts_primitives::ContractInstantiateResult { + PolymeshContracts::rpc_instantiate(origin, value, gas_limit, storage_deposit_limit, code, data, salt) + } + + fn upload_code( + origin: polymesh_primitives::AccountId, + code: Vec, + storage_deposit_limit: Option, + ) -> pallet_contracts_primitives::CodeUploadResult { + Contracts::bare_upload_code(origin, code, storage_deposit_limit) } fn get_storage( address: polymesh_primitives::AccountId, key: [u8; 32], ) -> pallet_contracts_primitives::GetStorageResult { - BaseContracts::get_storage(address, key) - } - - fn rent_projection( - address: polymesh_primitives::AccountId, - ) -> pallet_contracts_primitives::RentProjectionResult { - BaseContracts::rent_projection(address) + Contracts::get_storage(address, key) } } - */ impl node_rpc_runtime_api::transaction_payment::TransactionPaymentApi< Block, @@ -769,8 +871,6 @@ macro_rules! runtime_apis { IdentityId, Ticker, polymesh_primitives::AccountId, - SecondaryKey, - Signatory, Moment > for Runtime { @@ -787,7 +887,7 @@ macro_rules! runtime_apis { } /// Retrieve primary key and secondary keys for a given IdentityId - fn get_did_records(did: IdentityId) -> DidRecords> { + fn get_did_records(did: IdentityId) -> RpcDidRecords { Identity::get_did_records(did) } diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index 546707b8d0..93548da382 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-runtime-develop" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -36,70 +36,76 @@ pallet-relayer = { path = "../../relayer", default-features = false } pallet-sto = { path = "../../sto", default-features = false } pallet-settlement = { path = "../../settlement", default-features = false } pallet-staking = { path = "../../staking", default-features = false } -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } pallet-statistics = { path = "../../statistics", default-features = false } pallet-test-utils = { path = "../../test-utils", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } -#polymesh-contracts = { path = "../../contracts", default-features = false } pallet-sudo = { path = "../../sudo", default-features = false } +polymesh-contracts = { path = "../../contracts", default-features = false } # Others serde = { version = "1.0.104", default-features = false } +log = "0.4.8" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-inherents = { version = "3.0.0", default-features = false } -sp-offchain = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -sp-consensus-babe = { version = "0.9.0", default-features = false } -sp-session = { version = "3.0.0", default-features = false } -sp-authority-discovery = { version = "3.0.0", default-features = false } -sp-transaction-pool = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-inherents = { version = "4.0.0-dev", default-features = false } +sp-offchain = { version = "4.0.0-dev", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false } +sp-session = { version = "4.0.0-dev", default-features = false } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } # -pallet-authorship = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -#pallet-contracts-primitives = { version = "3.0.0", default-features = false } -pallet-executive = { package = "frame-executive", version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-offences = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -pallet-authority-discovery = { version = "3.0.0", default-features = false } -pallet-randomness-collective-flip = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false } +pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-offences = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } # Crypto -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } # RPC -frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { path = "../../protocol-fee/rpc/runtime-api", default-features = false } -#pallet-contracts-rpc-runtime-api = { version = "3.0.0", default-features = false } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } pallet-staking-rpc-runtime-api = { path = "../../staking/rpc/runtime-api", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } # Used for runtime benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } -frame-system-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } +frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } hex-literal = { version = "0.3.1", optional = true } +# Import 'getrandom' here to enable feature `getrandom/js` for wasm builds. +getrandom = { version = "0.2.6", default-features = false, optional = true } + [build-dependencies] polymesh-build-tool = { path = "../build_tool", default-features = false } @@ -121,7 +127,6 @@ std = [ "codec/std", "frame-benchmarking/std", "frame-support/std", - "frame-system-benchmarking/std", "frame-system-rpc-runtime-api/std", "frame-system/std", "node-rpc-runtime-api/std", @@ -135,9 +140,8 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - #"pallet-contracts-primitives/std", - #"pallet-contracts-rpc-runtime-api/std", - #"pallet-contracts/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-contracts/std", "pallet-corporate-actions/std", "pallet-executive/std", "pallet-external-agents/std", @@ -150,6 +154,7 @@ std = [ "pallet-multisig/std", "pallet-offences/std", "pallet-permissions/std", + "pallet-preimage/std", "pallet-pips/std", "pallet-portfolio/std", "pallet-protocol-fee-rpc-runtime-api/std", @@ -189,23 +194,26 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", - #"polymesh-contracts/std", + "polymesh-contracts/std", "polymesh-extensions/std", ] runtime-benchmarks = [ - "frame-benchmarking", + "getrandom/js", + "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking", "frame-system/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", "hex-literal", "pallet-asset/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-committee/runtime-benchmarks", "pallet-compliance-manager/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", "pallet-corporate-actions/runtime-benchmarks", "pallet-external-agents/runtime-benchmarks", "pallet-group/runtime-benchmarks", @@ -228,7 +236,7 @@ runtime-benchmarks = [ "pallet-test-utils/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "polymesh-common-utilities/runtime-benchmarks", - #"polymesh-contracts/runtime-benchmarks", + "polymesh-contracts/runtime-benchmarks", "polymesh-primitives/runtime-benchmarks", "polymesh-runtime-common/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/pallets/runtime/develop/src/benchmarks/pallet_session.rs b/pallets/runtime/develop/src/benchmarks/pallet_session.rs index 65ae51f0d8..44c398b355 100644 --- a/pallets/runtime/develop/src/benchmarks/pallet_session.rs +++ b/pallets/runtime/develop/src/benchmarks/pallet_session.rs @@ -21,13 +21,11 @@ // Modified by Polymath Inc - 4th January 2021 // - It uses our Staking pallet. -#![cfg_attr(not(feature = "std"), no_std)] - use core::convert::TryInto; use frame_benchmarking::benchmarks; use frame_support::traits::{Currency, OnInitialize}; use frame_system::RawOrigin; -use pallet_session::{Module as Session, *}; +use pallet_session::{Call, Pallet as Session}; use pallet_staking::{ benchmarking::create_validator_with_nominators_with_balance, MAX_NOMINATIONS, }; @@ -37,15 +35,15 @@ use sp_std::vec; use polymesh_common_utilities::constants::currency::POLY; -pub struct Module(pallet_session::Module); +pub struct Pallet(Session); pub trait Config: pallet_session::Config + pallet_session::historical::Config + pallet_staking::Config { } -impl OnInitialize for Module { +impl OnInitialize for Pallet { fn on_initialize(n: T::BlockNumber) -> frame_support::weights::Weight { - pallet_session::Module::::on_initialize(n) + Session::::on_initialize(n) } } @@ -99,8 +97,10 @@ benchmarks! { set_keys { let n = MAX_NOMINATIONS as u32; let validator = ValidatorInfo::::build(n).unwrap(); + let proof = validator.proof.clone(); + let keys = validator.keys.clone(); - }: _(RawOrigin::Signed(validator.controller), validator.keys, validator.proof) + }: _(RawOrigin::Signed(validator.controller), keys, proof) purge_keys { let n = MAX_NOMINATIONS as u32; diff --git a/pallets/runtime/develop/src/fee_details.rs b/pallets/runtime/develop/src/fee_details.rs deleted file mode 100644 index 0fa6904435..0000000000 --- a/pallets/runtime/develop/src/fee_details.rs +++ /dev/null @@ -1,174 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{runtime, Runtime}; -use codec::{Decode, Encode}; -use frame_support::{StorageDoubleMap, StorageMap}; -use polymesh_common_utilities::{traits::transaction_payment::CddAndFeeDetails, Context}; -use polymesh_primitives::{AccountId, AuthorizationData, Hash, IdentityId, Signatory}; -use polymesh_runtime_common::fee_details::{ - CallType, ValidPayerResult, CDD_REQUIRED, INVALID_AUTH, MISSING_ID, -}; -use sp_core::crypto::UncheckedFrom; - -type Identity = pallet_identity::Module; -type Bridge = pallet_bridge::Module; -type Call = runtime::Call; - -#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)] -pub struct CddHandler; - -impl CddAndFeeDetails for CddHandler -where - AccountId: UncheckedFrom + AsRef<[u8]>, -{ - /// Check if there's an eligible payer with valid CDD. - /// Return the payer if found or else an error. - /// Can also return Ok(none) to represent the case where - /// CDD is valid but no payer should pay fee for this tx - /// This also sets the identity in the context to the identity that was checked for CDD - /// However, this does not set the payer context since that is meant to remain constant - /// throughout the transaction. This function can also be used to simply check CDD and update identity context. - fn get_valid_payer(call: &Call, caller: &AccountId) -> ValidPayerResult { - let handle_multisig = |multisig, caller: &AccountId| { - let sig = Signatory::Account(caller.clone()); - if >::contains_key(multisig, sig) { - check_cdd(&>::get( - multisig, - )) - } else { - MISSING_ID - } - }; - - // The CDD check and fee payer varies depending on the transaction. - // This match covers all possible scenarios. - match call { - // Register did call. - // all did registration should go through CDD - Call::TestUtils(pallet_test_utils::Call::register_did(..)) => Ok(Some(caller.clone())), - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing multisig that has a valid CDD. The auth should be valid. - Call::MultiSig(pallet_multisig::Call::accept_multisig_signer_as_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptMultiSigSigner) - } - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::join_identity_as_key(auth_id, ..)) => { - is_auth_valid(caller, auth_id, CallType::AcceptIdentitySecondary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::accept_primary_key(rotation_auth_id, ..)) => { - is_auth_valid(caller, rotation_auth_id, CallType::AcceptIdentityPrimary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::rotate_primary_key_to_secondary( - rotation_auth_id, - .., - )) => is_auth_valid(caller, rotation_auth_id, CallType::RotatePrimaryToSecondary), - // Call made by a new Account key to remove invitation for certain authorizations - // in an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::remove_authorization(_, auth_id, true)) => { - is_auth_valid(caller, auth_id, CallType::RemoveAuthorization) - } - // Call made by a user key to accept subsidy from a paying key. The auth should be valid. - Call::Relayer(pallet_relayer::Call::accept_paying_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptRelayerPayingKey) - } - // Call made by an Account key to propose, reject or approve a multisig transaction. - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::MultiSig( - pallet_multisig::Call::create_or_approve_proposal_as_key(multisig, ..) - | pallet_multisig::Call::create_proposal_as_key(multisig, ..) - | pallet_multisig::Call::approve_as_key(multisig, ..) - | pallet_multisig::Call::reject_as_key(multisig, ..), - ) => handle_multisig(multisig, caller), - // Call made by an Account key to propose or approve a multisig transaction via the bridge helper - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::Bridge( - pallet_bridge::Call::propose_bridge_tx(..) - | pallet_bridge::Call::batch_propose_bridge_tx(..), - ) => handle_multisig(&Bridge::controller_key(), caller), - // All other calls. - // - // The external account must directly be linked to an identity with valid CDD. - _ => match Identity::get_identity(caller) { - Some(did) if Identity::has_valid_cdd(did) => { - Context::set_current_identity::(Some(did)); - Ok(Some(caller.clone())) - } - Some(_) => CDD_REQUIRED, - // Return if there's no DID. - None => MISSING_ID, - }, - } - } - - /// Clears context. Should be called in post_dispatch - fn clear_context() { - Context::set_current_identity::(None); - Context::set_current_payer::(None); - } - - /// Sets payer in context. Should be called by the signed extension that first charges fee. - fn set_payer_context(payer: Option) { - Context::set_current_payer::(payer); - } - - /// Fetches fee payer for further payments (forwarded calls) - fn get_payer_from_context() -> Option { - Context::current_payer::() - } - - fn set_current_identity(did: &IdentityId) { - Context::set_current_identity::(Some(*did)); - } -} - -/// Returns signatory to charge fee if auth is valid. -fn is_auth_valid(acc: &AccountId, auth_id: &u64, call_type: CallType) -> ValidPayerResult { - // Fetch the auth if it exists and has not expired. - match Identity::get_non_expired_auth(&Signatory::Account(acc.clone()), auth_id) - .map(|auth| (auth.authorized_by, (auth.authorization_data, call_type))) - { - // Different auths have different authorization data requirements. - // Hence we match call type to ensure proper authorization data is present. - // We only need to check that there's a payer with a valid CDD. - // Business logic for authorisations can be checked post-Signed Extension. - Some(( - by, - (AuthorizationData::AddMultiSigSigner(_), CallType::AcceptMultiSigSigner) - | (AuthorizationData::JoinIdentity(_), CallType::AcceptIdentitySecondary) - | (AuthorizationData::RotatePrimaryKey, CallType::AcceptIdentityPrimary) - | (AuthorizationData::RotatePrimaryKeyToSecondary(_), CallType::RotatePrimaryToSecondary) - | (AuthorizationData::AddRelayerPayingKey(..), CallType::AcceptRelayerPayingKey) - | (_, CallType::RemoveAuthorization), - )) => check_cdd(&by), - // None of the above apply, so error. - _ => INVALID_AUTH, - } -} - -/// Returns signatory to charge fee if cdd is valid. -fn check_cdd(did: &IdentityId) -> ValidPayerResult { - if Identity::has_valid_cdd(*did) { - Context::set_current_identity::(Some(*did)); - Ok(Some(Identity::did_records(&did).primary_key)) - } else { - CDD_REQUIRED - } -} diff --git a/pallets/runtime/develop/src/lib.rs b/pallets/runtime/develop/src/lib.rs index 30499efb6e..693f26b38b 100644 --- a/pallets/runtime/develop/src/lib.rs +++ b/pallets/runtime/develop/src/lib.rs @@ -2,10 +2,8 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -pub mod fee_details; -pub mod runtime; -pub use fee_details::CddHandler; pub mod constants; +pub mod runtime; #[cfg(feature = "runtime-benchmarks")] pub mod benchmarks; diff --git a/pallets/runtime/develop/src/runtime.rs b/pallets/runtime/develop/src/runtime.rs index 93564de6ca..eb1826c0ac 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -1,16 +1,16 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{constants::time::*, fee_details::CddHandler}; +use crate::constants::time::*; use codec::Encode; +use core::convert::TryFrom; use frame_support::{ - construct_runtime, debug, + construct_runtime, dispatch::DispatchResult, parameter_types, - traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, + traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem}, weights::Weight, }; use pallet_asset::checkpoint as pallet_checkpoint; -//use pallet_contracts::weights::WeightInfo; use pallet_corporate_actions::ballot as pallet_corporate_ballot; use pallet_corporate_actions::distribution as pallet_capital_distribution; use pallet_session::historical as pallet_session_historical; @@ -22,10 +22,9 @@ use polymesh_primitives::{AccountId, Balance, BlockNumber, InvestorUid, Moment}; use polymesh_runtime_common::{ impls::Author, merge_active_and_inactive, - runtime::{GovernanceCommittee, VMO}, + runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO}, AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance, }; -use sp_core::u32_trait::{_1, _4}; use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::{ create_runtime_str, @@ -55,14 +54,12 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("polymesh_dev"), impl_name: create_runtime_str!("polymesh_dev"), authoring_version: 1, - // Per convention: if the runtime behavior changes, increment spec_version - // and set impl_version to 0. If only runtime - // implementation changes and behavior does not, then leave spec_version as - // is and increment impl_version. - spec_version: 3010, + // `spec_version: aaa_bbb_ccc` should match node version v`aaa.bbb.ccc` + spec_version: 5_000_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 2, + transaction_version: 3, + state_version: 1, }; parameter_types! { @@ -92,15 +89,6 @@ parameter_types! { // Authorship: pub const UncleGenerations: BlockNumber = 0; - // Session: - // NOTE: `SessionHandler` and `SessionKeys` are co-dependent: - // One key will be used for each handler. - // The number and order of items in `SessionHandler` *MUST* be the same number - // and order of keys in `SessionKeys`. - // TODO: Introduce some structure to tie these together to make it a bit less of a footgun. - // This should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858 - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); - // Contracts: pub const NetworkShareInFee: Perbill = Perbill::from_percent(60); pub const TombstoneDeposit: Balance = 0; @@ -112,17 +100,21 @@ parameter_types! { // Settlement: pub const MaxLegsInInstruction: u32 = 10; - // Offences: - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); - // I'm online: - pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; + // Assets: pub const MaxNumberOfTMExtensionForAsset: u32 = 5; pub const AssetNameMaxLength: u32 = 128; pub const FundingRoundNameMaxLength: u32 = 128; + pub const AssetMetadataNameMaxLength: u32 = 256; + pub const AssetMetadataValueMaxLength: u32 = 8 * 1024; + pub const AssetMetadataTypeDefMaxLength: u32 = 8 * 1024; // Compliance manager: pub const MaxConditionComplexity: u32 = 50; @@ -132,38 +124,32 @@ parameter_types! { pub const MaxDidWhts: u32 = 1000; // Statistics: - pub const MaxTransferManagersPerAsset: u32 = 3; + pub const MaxStatsPerAsset: u32 = 10 + BENCHMARK_MAX_INCREASE; + pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 0 * POLY; - /* - /// The fraction of the deposit that should be used as rent per block. - pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS); - // The lazy deletion runs inside on_initialize. - pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * - RuntimeBlockWeights::get().max_block; - // The weight needed for decoding the queue should be less or equal than a fifth - // of the overall weight dedicated to the lazy deletion. - pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / ( - ::WeightInfo::on_initialize_per_queue_item(1) - - ::WeightInfo::on_initialize_per_queue_item(0) - )) / 5) as u32; - */ + // Contracts: + pub Schedule: pallet_contracts::Schedule = Default::default(); + pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionQueueDepth: u32 = 1024; + pub MaxInLen: u32 = 8 * 1024; } /// Splits fees 80/20 between treasury and block author. pub type DealWithFees = SplitTwoWays< Balance, NegativeImbalance, - _4, - Treasury, // 4 parts (80%) goes to the treasury. - _1, + Treasury, // 4 parts (80%) goes to the treasury. Author, // 1 part (20%) goes to the block author. + 4, + 1, >; // Staking: @@ -187,7 +173,7 @@ parameter_types! { pub const MaxIterations: u32 = 10; pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33); // 0.05%. The higher the value, the more strict solution acceptance becomes. - pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); + pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 140_000_000 * POLY; pub const MinimumBond: Balance = 1 * POLY; @@ -200,6 +186,18 @@ parameter_types! { polymesh_runtime_common::misc_pallet_impls!(); +pub type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler; + +impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call { + type Error = (); + fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call, ()> { + match call { + Call::TestUtils(x) => Ok(x), + _ => Err(()), + } + } +} + impl polymesh_common_utilities::traits::identity::Config for Runtime { type Event = Event; type Proposal = Call; @@ -217,6 +215,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } impl pallet_committee::Config for Runtime { @@ -303,7 +302,7 @@ impl TestUtilsFn for Runtime { fn register_did( target: AccountId, investor: InvestorUid, - secondary_keys: Vec>, + secondary_keys: Vec>, ) -> DispatchResult { >::register_did(target, investor, secondary_keys) } @@ -315,88 +314,90 @@ construct_runtime!( NodeBlock = polymesh_primitives::Block, UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Module, Call, Config, Storage, Event}, - Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Indices: pallet_indices::{Module, Call, Storage, Config, Event}, - Authorship: pallet_authorship::{Module, Call, Storage, Inherent}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, + Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, // Balance: Genesis config dependencies: System. - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Module, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, // Identity: Genesis config deps: Timestamp. - Identity: pallet_identity::{Module, Call, Storage, Event, Config}, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, // Polymesh Committees // CddServiceProviders (group only): Genesis config deps: Identity - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config}, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Governance Council (committee) - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. - CommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + CommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Technical Committee - TechnicalCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + TechnicalCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity - TechnicalCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + TechnicalCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Upgrade Committee - UpgradeCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + UpgradeCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee, Identity - UpgradeCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + UpgradeCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, - MultiSig: pallet_multisig::{Module, Call, Config, Storage, Event}, + MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event}, // Bridge: Genesis config deps: Multisig, Identity, Committees - Bridge: pallet_bridge::{Module, Call, Storage, Config, Event}, + Bridge: pallet_bridge::{Pallet, Call, Storage, Config, Event}, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees - Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned}, - Offences: pallet_offences::{Module, Call, Storage, Event}, + Staking: pallet_staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned}, + Offences: pallet_offences::{Pallet, Storage, Event}, // Session: Genesis config deps: System. - Session: pallet_session::{Module, Call, Storage, Event, Config}, - AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config}, - Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event}, - Historical: pallet_session_historical::{Module}, - ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, + Historical: pallet_session_historical::{Pallet}, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // Sudo. Usable initially. - Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, + + // Asset: Genesis config deps: Timestamp, + Asset: pallet_asset::{Pallet, Call, Storage, Config, Event}, + CapitalDistribution: pallet_capital_distribution::{Pallet, Call, Storage, Event}, + Checkpoint: pallet_checkpoint::{Pallet, Call, Storage, Event, Config}, + ComplianceManager: pallet_compliance_manager::{Pallet, Call, Storage, Event}, + CorporateAction: pallet_corporate_actions::{Pallet, Call, Storage, Event, Config}, + CorporateBallot: pallet_corporate_ballot::{Pallet, Call, Storage, Event}, + Permissions: pallet_permissions::{Pallet}, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config}, + Portfolio: pallet_portfolio::{Pallet, Call, Storage, Event}, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config}, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, + Settlement: pallet_settlement::{Pallet, Call, Storage, Event, Config}, + Statistics: pallet_statistics::{Pallet, Call, Storage, Event}, + Sto: pallet_sto::{Pallet, Call, Storage, Event}, + Treasury: pallet_treasury::{Pallet, Call, Event}, + Utility: pallet_utility::{Pallet, Call, Storage, Event}, + Base: pallet_base::{Pallet, Call, Event}, + ExternalAgents: pallet_external_agents::{Pallet, Call, Storage, Event}, + Relayer: pallet_relayer::{Pallet, Call, Storage, Event}, + Rewards: pallet_rewards::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, - /* // Contracts - BaseContracts: pallet_contracts::{Module, Config, Storage, Event}, - Contracts: polymesh_contracts::{Module, Call, Storage, Event}, - */ + Contracts: pallet_contracts::{Pallet, Storage, Event}, + PolymeshContracts: polymesh_contracts::{Pallet, Call, Storage, Event}, - // Asset: Genesis config deps: Timestamp, - Asset: pallet_asset::{Module, Call, Storage, Config, Event}, - CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event}, - Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config}, - ComplianceManager: pallet_compliance_manager::{Module, Call, Storage, Event}, - CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config}, - CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event}, - Permissions: pallet_permissions::{Module}, - Pips: pallet_pips::{Module, Call, Storage, Event, Config}, - Portfolio: pallet_portfolio::{Module, Call, Storage, Event}, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Settlement: pallet_settlement::{Module, Call, Storage, Event, Config}, - Statistics: pallet_statistics::{Module, Call, Storage, Event}, - Sto: pallet_sto::{Module, Call, Storage, Event}, - Treasury: pallet_treasury::{Module, Call, Event}, - Utility: pallet_utility::{Module, Call, Storage, Event}, - Base: pallet_base::{Module, Call, Event}, - ExternalAgents: pallet_external_agents::{Module, Call, Storage, Event}, - Relayer: pallet_relayer::{Module, Call, Storage, Event}, - Rewards: pallet_rewards::{Module, Call, Storage, Event, Config, ValidateUnsigned}, - TestUtils: pallet_test_utils::{Module, Call, Storage, Event } = 50, + // Preimage register. Used by `pallet_scheduler`. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event}, + + TestUtils: pallet_test_utils::{Pallet, Call, Storage, Event } = 50, } ); @@ -408,10 +409,10 @@ polymesh_runtime_common::runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; - type SystemBench = frame_system_benchmarking::Module; - impl frame_system_benchmarking::Config for Runtime {} + type SystemBench = frame_system_benchmarking::Pallet; + type SessionBench = crate::benchmarks::pallet_session::Pallet; - type SessionBench = crate::benchmarks::pallet_session::Module; + impl frame_system_benchmarking::Config for Runtime {} impl crate::benchmarks::pallet_session::Config for Runtime {} let whitelist: Vec = vec![ @@ -451,7 +452,6 @@ polymesh_runtime_common::runtime_apis! { add_benchmark!(params, batches, pallet_external_agents, ExternalAgents); add_benchmark!(params, batches, pallet_relayer, Relayer); add_benchmark!(params, batches, pallet_rewards, Rewards); - //add_benchmark!(params, batches, polymesh_contracts, Contracts); add_benchmark!(params, batches, pallet_committee, PolymeshCommittee); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_treasury, Treasury); @@ -459,6 +459,7 @@ polymesh_runtime_common::runtime_apis! { add_benchmark!(params, batches, pallet_group, CddServiceProviders); add_benchmark!(params, batches, pallet_statistics, Statistics); add_benchmark!(params, batches, pallet_permissions, Permissions); + add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, pallet_babe, Babe); add_benchmark!(params, batches, pallet_indices, Indices); add_benchmark!(params, batches, pallet_session, SessionBench); @@ -466,9 +467,62 @@ polymesh_runtime_common::runtime_apis! { add_benchmark!(params, batches, pallet_scheduler, Scheduler); add_benchmark!(params, batches, pallet_staking, Staking); add_benchmark!(params, batches, pallet_test_utils, TestUtils); + add_benchmark!(params, batches, polymesh_contracts, PolymeshContracts); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) } + + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + use frame_support::traits::StorageInfoTrait; + use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList}; + type SystemBench = frame_system_benchmarking::Pallet; + use crate::benchmarks::pallet_session::Pallet as SessionBench; + + let mut list = Vec::::new(); + + list_benchmark!(list, extra, pallet_asset, Asset); + list_benchmark!(list, extra, pallet_balances, Balances); + list_benchmark!(list, extra, pallet_identity, Identity); + list_benchmark!(list, extra, pallet_pips, Pips); + list_benchmark!(list, extra, pallet_multisig, MultiSig); + list_benchmark!(list, extra, pallet_portfolio, Portfolio); + list_benchmark!(list, extra, pallet_protocol_fee, ProtocolFee); + list_benchmark!(list, extra, frame_system, SystemBench); + list_benchmark!(list, extra, pallet_timestamp, Timestamp); + list_benchmark!(list, extra, pallet_settlement, Settlement); + list_benchmark!(list, extra, pallet_sto, Sto); + list_benchmark!(list, extra, pallet_checkpoint, Checkpoint); + list_benchmark!(list, extra, pallet_compliance_manager, ComplianceManager); + list_benchmark!(list, extra, pallet_corporate_actions, CorporateAction); + list_benchmark!(list, extra, pallet_corporate_ballot, CorporateBallot); + list_benchmark!(list, extra, pallet_capital_distribution, CapitalDistribution); + list_benchmark!(list, extra, pallet_external_agents, ExternalAgents); + list_benchmark!(list, extra, pallet_relayer, Relayer); + list_benchmark!(list, extra, pallet_rewards, Rewards); + list_benchmark!(list, extra, pallet_committee, PolymeshCommittee); + list_benchmark!(list, extra, pallet_utility, Utility); + list_benchmark!(list, extra, pallet_treasury, Treasury); + list_benchmark!(list, extra, pallet_im_online, ImOnline); + list_benchmark!(list, extra, pallet_group, CddServiceProviders); + list_benchmark!(list, extra, pallet_statistics, Statistics); + list_benchmark!(list, extra, pallet_permissions, Permissions); + list_benchmark!(list, extra, pallet_preimage, Preimage); + list_benchmark!(list, extra, pallet_babe, Babe); + list_benchmark!(list, extra, pallet_indices, Indices); + list_benchmark!(list, extra, pallet_session, SessionBench::); + list_benchmark!(list, extra, pallet_grandpa, Grandpa); + list_benchmark!(list, extra, pallet_scheduler, Scheduler); + list_benchmark!(list, extra, pallet_staking, Staking); + list_benchmark!(list, extra, pallet_test_utils, TestUtils); + list_benchmark!(list, extra, polymesh_contracts, PolymeshContracts); + + let storage_info = AllPalletsWithSystem::storage_info(); + + return (list, storage_info) + } } } diff --git a/pallets/runtime/extensions/Cargo.toml b/pallets/runtime/extensions/Cargo.toml index 4936b1a3a4..2f7efaec35 100644 --- a/pallets/runtime/extensions/Cargo.toml +++ b/pallets/runtime/extensions/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-extensions" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,11 +14,12 @@ pallet-transaction-payment = { path = "../../transaction-payment", default-featu pallet-permissions = { path = "../../permissions", default-features = false } # Substrate -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } [features] default = ["std"] @@ -32,4 +33,3 @@ std = [ "sp-runtime/std", "sp-std/std", ] - diff --git a/pallets/runtime/extensions/src/check_weight.rs b/pallets/runtime/extensions/src/check_weight.rs index 49c68bc57c..48841909ba 100644 --- a/pallets/runtime/extensions/src/check_weight.rs +++ b/pallets/runtime/extensions/src/check_weight.rs @@ -21,6 +21,7 @@ use codec::{Decode, Encode}; use frame_support::weights::{DispatchClass, DispatchInfo, PostDispatchInfo}; use frame_system::{CheckWeight as CW, Config}; +use scale_info::TypeInfo; use sp_runtime::{ traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SignedExtension}, transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError}, @@ -28,7 +29,8 @@ use sp_runtime::{ }; /// Block resource (weight) limit check. -#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)] +#[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] +#[scale_info(skip_type_params(T))] pub struct CheckWeight(CW); impl CheckWeight @@ -105,7 +107,7 @@ where } fn post_dispatch( - pre: Self::Pre, + pre: Option, info: &DispatchInfoOf, post_info: &PostDispatchInfoOf, len: usize, diff --git a/pallets/runtime/mainnet/Cargo.toml b/pallets/runtime/mainnet/Cargo.toml index 36cd059822..47619ff312 100644 --- a/pallets/runtime/mainnet/Cargo.toml +++ b/pallets/runtime/mainnet/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-runtime-mainnet" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -42,58 +42,61 @@ pallet-sudo = { path = "../../sudo", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } -#polymesh-contracts = { path = "../../contracts", default-features = false } +polymesh-contracts = { path = "../../contracts", default-features = false } # RPC node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -#pallet-contracts-rpc-runtime-api = { version = "3.0.0", default-features = false } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } # Others +log = "0.4.8" lazy_static = { version = "1.4.0", default-features = false } serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true } smallvec = "1.4.0" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false } -pallet-authority-discovery = { version = "3.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -#pallet-contracts-primitives = { version = "3.0.0", default-features = false} -pallet-executive = { package = "frame-executive", version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-offences = { version = "3.0.0", default-features = false } -pallet-randomness-collective-flip = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-authority-discovery = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0", default-features = false } -sp-consensus-babe = { version = "0.9.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-inherents = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-offchain = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-session = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-transaction-pool = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false} +pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-offences = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev", default-features = false } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-inherents = { version = "4.0.0-dev", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-offchain = { version = "4.0.0-dev", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-session = { version = "4.0.0-dev", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false } +sp-version = { version = "5.0.0", default-features = false } # Crypto -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } [build-dependencies] polymesh-build-tool = { path = "../build_tool", default-features = false } @@ -126,9 +129,8 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - #"pallet-contracts-primitives/std", - #"pallet-contracts-rpc-runtime-api/std", - #"pallet-contracts/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-contracts/std", "pallet-executive/std", "pallet-external-agents/std", "pallet-grandpa/std", @@ -140,6 +142,7 @@ std = [ "pallet-multisig/std", "pallet-offences/std", "pallet-permissions/std", + "pallet-preimage/std", "pallet-pips/std", "pallet-portfolio/std", "pallet-protocol-fee-rpc-runtime-api/std", @@ -160,7 +163,7 @@ std = [ "pallet-treasury/std", "pallet-utility/std", "polymesh-common-utilities/std", - #"polymesh-contracts/std", + "polymesh-contracts/std", "polymesh-primitives/std", "polymesh-runtime-common/std", "polymesh-weights/std", diff --git a/pallets/runtime/mainnet/src/fee_details.rs b/pallets/runtime/mainnet/src/fee_details.rs deleted file mode 100644 index e4385ae334..0000000000 --- a/pallets/runtime/mainnet/src/fee_details.rs +++ /dev/null @@ -1,171 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{runtime, Runtime}; -use codec::{Decode, Encode}; -use frame_support::{StorageDoubleMap, StorageMap}; -use polymesh_common_utilities::{traits::transaction_payment::CddAndFeeDetails, Context}; -use polymesh_primitives::{AccountId, AuthorizationData, Hash, IdentityId, Signatory}; -use polymesh_runtime_common::fee_details::{ - CallType, ValidPayerResult, CDD_REQUIRED, INVALID_AUTH, MISSING_ID, -}; -use sp_core::crypto::UncheckedFrom; - -type Identity = pallet_identity::Module; -type Bridge = pallet_bridge::Module; -type Call = runtime::Call; - -#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)] -pub struct CddHandler; - -impl CddAndFeeDetails for CddHandler -where - AccountId: UncheckedFrom + AsRef<[u8]>, -{ - /// Check if there's an eligible payer with valid CDD. - /// Return the payer if found or else an error. - /// Can also return Ok(none) to represent the case where - /// CDD is valid but no payer should pay fee for this tx - /// This also sets the identity in the context to the identity that was checked for CDD - /// However, this does not set the payer context since that is meant to remain constant - /// throughout the transaction. This function can also be used to simply check CDD and update identity context. - fn get_valid_payer(call: &Call, caller: &AccountId) -> ValidPayerResult { - let handle_multisig = |multisig, caller: &AccountId| { - let sig = Signatory::Account(caller.clone()); - if >::contains_key(multisig, sig) { - check_cdd(&>::get( - multisig, - )) - } else { - MISSING_ID - } - }; - - // The CDD check and fee payer varies depending on the transaction. - // This match covers all possible scenarios. - match call { - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing multisig that has a valid CDD. The auth should be valid. - Call::MultiSig(pallet_multisig::Call::accept_multisig_signer_as_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptMultiSigSigner) - } - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::join_identity_as_key(auth_id, ..)) => { - is_auth_valid(caller, auth_id, CallType::AcceptIdentitySecondary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::accept_primary_key(rotation_auth_id, ..)) => { - is_auth_valid(caller, rotation_auth_id, CallType::AcceptIdentityPrimary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::rotate_primary_key_to_secondary( - rotation_auth_id, - .., - )) => is_auth_valid(caller, rotation_auth_id, CallType::RotatePrimaryToSecondary), - // Call made by a new Account key to remove invitation for certain authorizations - // in an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::remove_authorization(_, auth_id, true)) => { - is_auth_valid(caller, auth_id, CallType::RemoveAuthorization) - } - // Call made by a user key to accept subsidy from a paying key. The auth should be valid. - Call::Relayer(pallet_relayer::Call::accept_paying_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptRelayerPayingKey) - } - // Call made by an Account key to propose, reject or approve a multisig transaction. - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::MultiSig( - pallet_multisig::Call::create_or_approve_proposal_as_key(multisig, ..) - | pallet_multisig::Call::create_proposal_as_key(multisig, ..) - | pallet_multisig::Call::approve_as_key(multisig, ..) - | pallet_multisig::Call::reject_as_key(multisig, ..), - ) => handle_multisig(multisig, caller), - // Call made by an Account key to propose or approve a multisig transaction via the bridge helper - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::Bridge( - pallet_bridge::Call::propose_bridge_tx(..) - | pallet_bridge::Call::batch_propose_bridge_tx(..), - ) => handle_multisig(&Bridge::controller_key(), caller), - // All other calls. - // - // The external account must directly be linked to an identity with valid CDD. - _ => match Identity::get_identity(caller) { - Some(did) if Identity::has_valid_cdd(did) => { - Context::set_current_identity::(Some(did)); - Ok(Some(caller.clone())) - } - Some(_) => CDD_REQUIRED, - // Return if there's no DID. - None => MISSING_ID, - }, - } - } - - /// Clears context. Should be called in post_dispatch - fn clear_context() { - Context::set_current_identity::(None); - Context::set_current_payer::(None); - } - - /// Sets payer in context. Should be called by the signed extension that first charges fee. - fn set_payer_context(payer: Option) { - Context::set_current_payer::(payer); - } - - /// Fetches fee payer for further payments (forwarded calls) - fn get_payer_from_context() -> Option { - Context::current_payer::() - } - - fn set_current_identity(did: &IdentityId) { - Context::set_current_identity::(Some(*did)); - } -} - -/// Returns signatory to charge fee if auth is valid. -fn is_auth_valid(acc: &AccountId, auth_id: &u64, call_type: CallType) -> ValidPayerResult { - // Fetch the auth if it exists and has not expired. - match Identity::get_non_expired_auth(&Signatory::Account(acc.clone()), auth_id) - .map(|auth| (auth.authorized_by, (auth.authorization_data, call_type))) - { - // Different auths have different authorization data requirements. - // Hence we match call type to ensure proper authorization data is present. - // We only need to check that there's a payer with a valid CDD. - // Business logic for authorisations can be checked post-Signed Extension. - Some(( - by, - (AuthorizationData::AddMultiSigSigner(_), CallType::AcceptMultiSigSigner) - | (AuthorizationData::JoinIdentity(_), CallType::AcceptIdentitySecondary) - | (AuthorizationData::RotatePrimaryKey, CallType::AcceptIdentityPrimary) - | (AuthorizationData::RotatePrimaryKeyToSecondary(_), CallType::RotatePrimaryToSecondary) - | (AuthorizationData::AddRelayerPayingKey(..), CallType::AcceptRelayerPayingKey) - | (_, CallType::RemoveAuthorization), - )) => check_cdd(&by), - // None of the above apply, so error. - _ => INVALID_AUTH, - } -} - -/// Returns signatory to charge fee if cdd is valid. -fn check_cdd(did: &IdentityId) -> ValidPayerResult { - if Identity::has_valid_cdd(*did) { - Context::set_current_identity::(Some(*did)); - Ok(Some(Identity::did_records(&did).primary_key)) - } else { - CDD_REQUIRED - } -} diff --git a/pallets/runtime/mainnet/src/lib.rs b/pallets/runtime/mainnet/src/lib.rs index 03fb6baef1..4633c8acb0 100644 --- a/pallets/runtime/mainnet/src/lib.rs +++ b/pallets/runtime/mainnet/src/lib.rs @@ -2,10 +2,8 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -pub mod fee_details; -pub mod runtime; -pub use fee_details::CddHandler; pub mod constants; +pub mod runtime; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; diff --git a/pallets/runtime/mainnet/src/runtime.rs b/pallets/runtime/mainnet/src/runtime.rs index 43074622dc..b7b744a7f7 100644 --- a/pallets/runtime/mainnet/src/runtime.rs +++ b/pallets/runtime/mainnet/src/runtime.rs @@ -1,13 +1,12 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{constants::time::*, fee_details::CddHandler}; +use crate::constants::time::*; use codec::Encode; use frame_support::{ - construct_runtime, debug, parameter_types, - traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, + construct_runtime, parameter_types, + traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem}, weights::Weight, }; -//use pallet_contracts::weights::WeightInfo; use pallet_asset::checkpoint as pallet_checkpoint; use pallet_corporate_actions::ballot as pallet_corporate_ballot; use pallet_corporate_actions::distribution as pallet_capital_distribution; @@ -20,10 +19,9 @@ use polymesh_primitives::{Balance, BlockNumber, Moment}; use polymesh_runtime_common::{ impls::Author, merge_active_and_inactive, - runtime::{GovernanceCommittee, VMO}, + runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO}, AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance, }; -use sp_core::u32_trait::{_1, _4}; use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::{ create_runtime_str, @@ -53,14 +51,12 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("polymesh_mainnet"), impl_name: create_runtime_str!("polymesh_mainnet"), authoring_version: 1, - // Per convention: if the runtime behavior changes, increment spec_version - // and set impl_version to 0. If only runtime - // implementation changes and behavior does not, then leave spec_version as - // is and increment impl_version. - spec_version: 3010, + // `spec_version: aaa_bbb_ccc` should match node version v`aaa.bbb.ccc` + spec_version: 5_000_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 2, + transaction_version: 3, + state_version: 1, }; parameter_types! { @@ -90,40 +86,24 @@ parameter_types! { // Authorship: pub const UncleGenerations: BlockNumber = 0; - // Session: - // NOTE: `SessionHandler` and `SessionKeys` are co-dependent: - // One key will be used for each handler. - // The number and order of items in `SessionHandler` *MUST* be the same number - // and order of keys in `SessionKeys`. - // TODO: Introduce some structure to tie these together to make it a bit less of a footgun. - // This should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858 - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); - - /* - // Contracts: - pub const NetworkShareInFee: Perbill = Perbill::from_percent(60); - pub const TombstoneDeposit: Balance = 0; - pub const RentByteFee: Balance = 0; // Assigning zero to switch off the rent logic in the contracts; - pub const RentDepositOffset: Balance = 300 * DOLLARS; - /// Reward that is received by the party whose touch has led - /// to removal of a contract. - pub const SurchargeReward: Balance = 150 * DOLLARS; - */ - // Settlement: pub const MaxLegsInInstruction: u32 = 10; - // Offences: - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); - // I'm online: - pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; + // Assets: pub const MaxNumberOfTMExtensionForAsset: u32 = 5; pub const AssetNameMaxLength: u32 = 128; pub const FundingRoundNameMaxLength: u32 = 128; + pub const AssetMetadataNameMaxLength: u32 = 256; + pub const AssetMetadataValueMaxLength: u32 = 8 * 1024; + pub const AssetMetadataTypeDefMaxLength: u32 = 8 * 1024; // Compliance manager: pub const MaxConditionComplexity: u32 = 50; @@ -133,38 +113,32 @@ parameter_types! { pub const MaxDidWhts: u32 = 1000; // Statistics: - pub const MaxTransferManagersPerAsset: u32 = 3; + pub const MaxStatsPerAsset: u32 = 10 + BENCHMARK_MAX_INCREASE; + pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 0; - /* - /// The fraction of the deposit that should be used as rent per block. - pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS); - // The lazy deletion runs inside on_initialize. - pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * - RuntimeBlockWeights::get().max_block; - // The weight needed for decoding the queue should be less or equal than a fifth - // of the overall weight dedicated to the lazy deletion. - pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / ( - ::WeightInfo::on_initialize_per_queue_item(1) - - ::WeightInfo::on_initialize_per_queue_item(0) - )) / 5) as u32; - */ + // Contracts: + pub Schedule: pallet_contracts::Schedule = Default::default(); + pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionQueueDepth: u32 = 1024; + pub MaxInLen: u32 = 8 * 1024; } /// Splits fees 80/20 between treasury and block author. pub type DealWithFees = SplitTwoWays< Balance, NegativeImbalance, - _4, - Treasury, // 4 parts (80%) goes to the treasury. - _1, + Treasury, // 4 parts (80%) goes to the treasury. Author, // 1 part (20%) goes to the block author. + 4, + 1, >; // Staking: @@ -188,7 +162,7 @@ parameter_types! { pub const MaxIterations: u32 = 10; pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33); // 0.05%. The higher the value, the more strict solution acceptance becomes. - pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); + pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 140_000_000 * POLY; pub const MinimumBond: Balance = 1 * POLY; @@ -201,6 +175,11 @@ parameter_types! { polymesh_runtime_common::misc_pallet_impls!(); +type CddHandler = polymesh_runtime_common::fee_details::CddHandler< + Runtime, + polymesh_runtime_common::fee_details::Noop, +>; + impl polymesh_common_utilities::traits::identity::Config for Runtime { type Event = Event; type Proposal = Call; @@ -218,6 +197,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } impl pallet_committee::Config for Runtime { @@ -299,87 +279,88 @@ construct_runtime!( NodeBlock = polymesh_primitives::Block, UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Module, Call, Config, Storage, Event}, - Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Indices: pallet_indices::{Module, Call, Storage, Config, Event}, - Authorship: pallet_authorship::{Module, Call, Storage, Inherent}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, + Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, // Balance: Genesis config dependencies: System. - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Module, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, // Identity: Genesis config deps: Timestamp. - Identity: pallet_identity::{Module, Call, Storage, Event, Config}, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, // Polymesh Committees // CddServiceProviders (group only): Genesis config deps: Identity - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config}, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Governance Council (committee) - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. - CommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + CommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Technical Committee - TechnicalCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + TechnicalCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity - TechnicalCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + TechnicalCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Upgrade Committee - UpgradeCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + UpgradeCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee, Identity - UpgradeCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + UpgradeCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, - MultiSig: pallet_multisig::{Module, Call, Config, Storage, Event}, + MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event}, // Bridge: Genesis config deps: Multisig, Identity, Committees - Bridge: pallet_bridge::{Module, Call, Storage, Config, Event}, + Bridge: pallet_bridge::{Pallet, Call, Storage, Config, Event}, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees - Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned}, - Offences: pallet_offences::{Module, Call, Storage, Event}, + Staking: pallet_staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned}, + Offences: pallet_offences::{Pallet, Storage, Event}, // Session: Genesis config deps: System. - Session: pallet_session::{Module, Call, Storage, Event, Config}, - AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config}, - Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event}, - Historical: pallet_session_historical::{Module}, - ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, + Historical: pallet_session_historical::{Pallet}, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // Sudo. Usable initially. - Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, + + // Asset: Genesis config deps: Timestamp, + Asset: pallet_asset::{Pallet, Call, Storage, Config, Event}, + CapitalDistribution: pallet_capital_distribution::{Pallet, Call, Storage, Event}, + Checkpoint: pallet_checkpoint::{Pallet, Call, Storage, Event, Config}, + ComplianceManager: pallet_compliance_manager::{Pallet, Call, Storage, Event}, + CorporateAction: pallet_corporate_actions::{Pallet, Call, Storage, Event, Config}, + CorporateBallot: pallet_corporate_ballot::{Pallet, Call, Storage, Event}, + Permissions: pallet_permissions::{Pallet}, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config}, + Portfolio: pallet_portfolio::{Pallet, Call, Storage, Event}, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config}, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, + Settlement: pallet_settlement::{Pallet, Call, Storage, Event, Config}, + Statistics: pallet_statistics::{Pallet, Call, Storage, Event}, + Sto: pallet_sto::{Pallet, Call, Storage, Event}, + Treasury: pallet_treasury::{Pallet, Call, Event}, + Utility: pallet_utility::{Pallet, Call, Storage, Event}, + Base: pallet_base::{Pallet, Call, Event}, + ExternalAgents: pallet_external_agents::{Pallet, Call, Storage, Event}, + Relayer: pallet_relayer::{Pallet, Call, Storage, Event}, + Rewards: pallet_rewards::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, - /* // Contracts - BaseContracts: pallet_contracts::{Module, Config, Storage, Event}, - Contracts: polymesh_contracts::{Module, Call, Storage, Event}, - */ + Contracts: pallet_contracts::{Pallet, Storage, Event}, + PolymeshContracts: polymesh_contracts::{Pallet, Call, Storage, Event}, - // Asset: Genesis config deps: Timestamp, - Asset: pallet_asset::{Module, Call, Storage, Config, Event}, - CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event}, - Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config}, - ComplianceManager: pallet_compliance_manager::{Module, Call, Storage, Event}, - CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config}, - CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event}, - Permissions: pallet_permissions::{Module}, - Pips: pallet_pips::{Module, Call, Storage, Event, Config}, - Portfolio: pallet_portfolio::{Module, Call, Storage, Event}, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Settlement: pallet_settlement::{Module, Call, Storage, Event, Config}, - Statistics: pallet_statistics::{Module, Call, Storage, Event}, - Sto: pallet_sto::{Module, Call, Storage, Event}, - Treasury: pallet_treasury::{Module, Call, Event}, - Utility: pallet_utility::{Module, Call, Storage, Event}, - Base: pallet_base::{Module, Call, Event}, - ExternalAgents: pallet_external_agents::{Module, Call, Storage, Event}, - Relayer: pallet_relayer::{Module, Call, Storage, Event}, - Rewards: pallet_rewards::{Module, Call, Storage, Event, Config, ValidateUnsigned}, + // Preimage register. Used by `pallet_scheduler`. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event}, } ); diff --git a/pallets/runtime/testnet/Cargo.toml b/pallets/runtime/testnet/Cargo.toml index eca27c081c..ffd9004190 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/Cargo.toml @@ -2,7 +2,7 @@ name = "polymesh-runtime-testnet" version = "0.1.0" authors = ["Polymath Inc."] -edition = "2018" +edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -41,61 +41,64 @@ pallet-statistics = { path = "../../statistics", default-features = false } pallet-transaction-payment = { path = "../../transaction-payment", default-features = false } pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } -#polymesh-contracts = { path = "../../contracts", default-features = false } pallet-sudo = { path = "../../sudo", default-features = false } pallet-test-utils = { path = "../../test-utils", default-features = false } +polymesh-contracts = { path = "../../contracts", default-features = false } # RPC node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -#pallet-contracts-rpc-runtime-api = { version = "3.0.0", default-features = false } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } # Crypto -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } # Others lazy_static = { version = "1.4.0", default-features = false } +log = "0.4.8" serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-inherents = { version = "3.0.0", default-features = false } -sp-offchain = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -sp-consensus-babe = { version = "0.9.0", default-features = false } -sp-session = { version = "3.0.0", default-features = false } -sp-authority-discovery = { version = "3.0.0", default-features = false } -sp-transaction-pool = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-inherents = { version = "4.0.0-dev", default-features = false } +sp-offchain = { version = "4.0.0-dev", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false } +sp-session = { version = "4.0.0-dev", default-features = false } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -#pallet-contracts-primitives = { version = "3.0.0", default-features = false} -pallet-executive = { package = "frame-executive", version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-offences = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -pallet-authority-discovery = { version = "3.0.0", default-features = false } -pallet-randomness-collective-flip = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false} +pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-offences = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } smallvec = "1.4.0" [build-dependencies] @@ -127,9 +130,8 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - #"pallet-contracts-primitives/std", - #"pallet-contracts-rpc-runtime-api/std", - #"pallet-contracts/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-contracts/std", "pallet-executive/std", "pallet-external-agents/std", "pallet-grandpa/std", @@ -141,6 +143,7 @@ std = [ "pallet-multisig/std", "pallet-offences/std", "pallet-permissions/std", + "pallet-preimage/std", "pallet-pips/std", "pallet-portfolio/std", "pallet-protocol-fee-rpc-runtime-api/std", @@ -180,7 +183,7 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", - #"polymesh-contracts/std" + "polymesh-contracts/std" ] runtime-benchmarks = [ diff --git a/pallets/runtime/testnet/src/fee_details.rs b/pallets/runtime/testnet/src/fee_details.rs deleted file mode 100644 index 0fa6904435..0000000000 --- a/pallets/runtime/testnet/src/fee_details.rs +++ /dev/null @@ -1,174 +0,0 @@ -// This file is part of the Polymesh distribution (https://github.com/PolymathNetwork/Polymesh). -// Copyright (c) 2020 Polymath - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. - -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{runtime, Runtime}; -use codec::{Decode, Encode}; -use frame_support::{StorageDoubleMap, StorageMap}; -use polymesh_common_utilities::{traits::transaction_payment::CddAndFeeDetails, Context}; -use polymesh_primitives::{AccountId, AuthorizationData, Hash, IdentityId, Signatory}; -use polymesh_runtime_common::fee_details::{ - CallType, ValidPayerResult, CDD_REQUIRED, INVALID_AUTH, MISSING_ID, -}; -use sp_core::crypto::UncheckedFrom; - -type Identity = pallet_identity::Module; -type Bridge = pallet_bridge::Module; -type Call = runtime::Call; - -#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)] -pub struct CddHandler; - -impl CddAndFeeDetails for CddHandler -where - AccountId: UncheckedFrom + AsRef<[u8]>, -{ - /// Check if there's an eligible payer with valid CDD. - /// Return the payer if found or else an error. - /// Can also return Ok(none) to represent the case where - /// CDD is valid but no payer should pay fee for this tx - /// This also sets the identity in the context to the identity that was checked for CDD - /// However, this does not set the payer context since that is meant to remain constant - /// throughout the transaction. This function can also be used to simply check CDD and update identity context. - fn get_valid_payer(call: &Call, caller: &AccountId) -> ValidPayerResult { - let handle_multisig = |multisig, caller: &AccountId| { - let sig = Signatory::Account(caller.clone()); - if >::contains_key(multisig, sig) { - check_cdd(&>::get( - multisig, - )) - } else { - MISSING_ID - } - }; - - // The CDD check and fee payer varies depending on the transaction. - // This match covers all possible scenarios. - match call { - // Register did call. - // all did registration should go through CDD - Call::TestUtils(pallet_test_utils::Call::register_did(..)) => Ok(Some(caller.clone())), - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing multisig that has a valid CDD. The auth should be valid. - Call::MultiSig(pallet_multisig::Call::accept_multisig_signer_as_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptMultiSigSigner) - } - // Call made by a new Account key to accept invitation to become a secondary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::join_identity_as_key(auth_id, ..)) => { - is_auth_valid(caller, auth_id, CallType::AcceptIdentitySecondary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::accept_primary_key(rotation_auth_id, ..)) => { - is_auth_valid(caller, rotation_auth_id, CallType::AcceptIdentityPrimary) - } - // Call made by a new Account key to accept invitation to become the primary key - // of an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::rotate_primary_key_to_secondary( - rotation_auth_id, - .., - )) => is_auth_valid(caller, rotation_auth_id, CallType::RotatePrimaryToSecondary), - // Call made by a new Account key to remove invitation for certain authorizations - // in an existing identity that has a valid CDD. The auth should be valid. - Call::Identity(pallet_identity::Call::remove_authorization(_, auth_id, true)) => { - is_auth_valid(caller, auth_id, CallType::RemoveAuthorization) - } - // Call made by a user key to accept subsidy from a paying key. The auth should be valid. - Call::Relayer(pallet_relayer::Call::accept_paying_key(auth_id)) => { - is_auth_valid(caller, auth_id, CallType::AcceptRelayerPayingKey) - } - // Call made by an Account key to propose, reject or approve a multisig transaction. - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::MultiSig( - pallet_multisig::Call::create_or_approve_proposal_as_key(multisig, ..) - | pallet_multisig::Call::create_proposal_as_key(multisig, ..) - | pallet_multisig::Call::approve_as_key(multisig, ..) - | pallet_multisig::Call::reject_as_key(multisig, ..), - ) => handle_multisig(multisig, caller), - // Call made by an Account key to propose or approve a multisig transaction via the bridge helper - // The multisig must have valid CDD and the caller must be a signer of the multisig. - Call::Bridge( - pallet_bridge::Call::propose_bridge_tx(..) - | pallet_bridge::Call::batch_propose_bridge_tx(..), - ) => handle_multisig(&Bridge::controller_key(), caller), - // All other calls. - // - // The external account must directly be linked to an identity with valid CDD. - _ => match Identity::get_identity(caller) { - Some(did) if Identity::has_valid_cdd(did) => { - Context::set_current_identity::(Some(did)); - Ok(Some(caller.clone())) - } - Some(_) => CDD_REQUIRED, - // Return if there's no DID. - None => MISSING_ID, - }, - } - } - - /// Clears context. Should be called in post_dispatch - fn clear_context() { - Context::set_current_identity::(None); - Context::set_current_payer::(None); - } - - /// Sets payer in context. Should be called by the signed extension that first charges fee. - fn set_payer_context(payer: Option) { - Context::set_current_payer::(payer); - } - - /// Fetches fee payer for further payments (forwarded calls) - fn get_payer_from_context() -> Option { - Context::current_payer::() - } - - fn set_current_identity(did: &IdentityId) { - Context::set_current_identity::(Some(*did)); - } -} - -/// Returns signatory to charge fee if auth is valid. -fn is_auth_valid(acc: &AccountId, auth_id: &u64, call_type: CallType) -> ValidPayerResult { - // Fetch the auth if it exists and has not expired. - match Identity::get_non_expired_auth(&Signatory::Account(acc.clone()), auth_id) - .map(|auth| (auth.authorized_by, (auth.authorization_data, call_type))) - { - // Different auths have different authorization data requirements. - // Hence we match call type to ensure proper authorization data is present. - // We only need to check that there's a payer with a valid CDD. - // Business logic for authorisations can be checked post-Signed Extension. - Some(( - by, - (AuthorizationData::AddMultiSigSigner(_), CallType::AcceptMultiSigSigner) - | (AuthorizationData::JoinIdentity(_), CallType::AcceptIdentitySecondary) - | (AuthorizationData::RotatePrimaryKey, CallType::AcceptIdentityPrimary) - | (AuthorizationData::RotatePrimaryKeyToSecondary(_), CallType::RotatePrimaryToSecondary) - | (AuthorizationData::AddRelayerPayingKey(..), CallType::AcceptRelayerPayingKey) - | (_, CallType::RemoveAuthorization), - )) => check_cdd(&by), - // None of the above apply, so error. - _ => INVALID_AUTH, - } -} - -/// Returns signatory to charge fee if cdd is valid. -fn check_cdd(did: &IdentityId) -> ValidPayerResult { - if Identity::has_valid_cdd(*did) { - Context::set_current_identity::(Some(*did)); - Ok(Some(Identity::did_records(&did).primary_key)) - } else { - CDD_REQUIRED - } -} diff --git a/pallets/runtime/testnet/src/lib.rs b/pallets/runtime/testnet/src/lib.rs index 6bd4b72330..f069b153b4 100644 --- a/pallets/runtime/testnet/src/lib.rs +++ b/pallets/runtime/testnet/src/lib.rs @@ -2,10 +2,8 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -pub mod fee_details; -pub mod runtime; -pub use fee_details::CddHandler; pub mod constants; +pub mod runtime; #[cfg(feature = "std")] pub use pallet_staking::StakerStatus; diff --git a/pallets/runtime/testnet/src/runtime.rs b/pallets/runtime/testnet/src/runtime.rs index 7ce9953b43..4851046c72 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -1,18 +1,18 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -use crate::{constants::time::*, fee_details::CddHandler}; +use crate::constants::time::*; use codec::Encode; #[cfg(feature = "migration-dry-run")] use frame_support::traits::OnRuntimeUpgrade; +use core::convert::TryFrom; use frame_support::{ - construct_runtime, debug, parameter_types, - traits::{KeyOwnerProofSystem, Randomness, SplitTwoWays}, + construct_runtime, parameter_types, + traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem}, weights::Weight, }; use pallet_asset::checkpoint as pallet_checkpoint; -//use pallet_contracts::weights::WeightInfo; use pallet_corporate_actions::ballot as pallet_corporate_ballot; use pallet_corporate_actions::distribution as pallet_capital_distribution; use pallet_session::historical as pallet_session_historical; @@ -24,10 +24,9 @@ use polymesh_primitives::{Balance, BlockNumber, Moment}; use polymesh_runtime_common::{ impls::Author, merge_active_and_inactive, - runtime::{GovernanceCommittee, VMO}, + runtime::{GovernanceCommittee, BENCHMARK_MAX_INCREASE, VMO}, AvailableBlockRatio, MaximumBlockWeight, NegativeImbalance, }; -use sp_core::u32_trait::{_1, _4}; use sp_runtime::transaction_validity::TransactionPriority; use sp_runtime::{ create_runtime_str, @@ -57,14 +56,12 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("polymesh_testnet"), impl_name: create_runtime_str!("polymesh_testnet"), authoring_version: 1, - // Per convention: if the runtime behavior changes, increment spec_version - // and set impl_version to 0. If only runtime - // implementation changes and behavior does not, then leave spec_version as - // is and increment impl_version. - spec_version: 3010, + // `spec_version: aaa_bbb_ccc` should match node version v`aaa.bbb.ccc` + spec_version: 5_000_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 2, + transaction_version: 3, + state_version: 1, }; parameter_types! { @@ -95,15 +92,6 @@ parameter_types! { // Authorship: pub const UncleGenerations: BlockNumber = 0; - // Session: - // NOTE: `SessionHandler` and `SessionKeys` are co-dependent: - // One key will be used for each handler. - // The number and order of items in `SessionHandler` *MUST* be the same number - // and order of keys in `SessionKeys`. - // TODO: Introduce some structure to tie these together to make it a bit less of a footgun. - // This should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858 - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17); - // Contracts: pub const NetworkShareInFee: Perbill = Perbill::from_percent(60); pub const TombstoneDeposit: Balance = 0; @@ -116,17 +104,21 @@ parameter_types! { // Settlement: pub const MaxLegsInInstruction: u32 = 10; - // Offences: - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); - // I'm online: - pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; + // Assets: pub const MaxNumberOfTMExtensionForAsset: u32 = 5; pub const AssetNameMaxLength: u32 = 128; pub const FundingRoundNameMaxLength: u32 = 128; + pub const AssetMetadataNameMaxLength: u32 = 256; + pub const AssetMetadataValueMaxLength: u32 = 8 * 1024; + pub const AssetMetadataTypeDefMaxLength: u32 = 8 * 1024; // Compliance manager: pub const MaxConditionComplexity: u32 = 50; @@ -136,38 +128,32 @@ parameter_types! { pub const MaxDidWhts: u32 = 1000; // Statistics: - pub const MaxTransferManagersPerAsset: u32 = 3; + pub const MaxStatsPerAsset: u32 = 10 + BENCHMARK_MAX_INCREASE; + pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 100_000 * POLY; - /* - /// The fraction of the deposit that should be used as rent per block. - pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS); - // The lazy deletion runs inside on_initialize. - pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * - RuntimeBlockWeights::get().max_block; - // The weight needed for decoding the queue should be less or equal than a fifth - // of the overall weight dedicated to the lazy deletion. - pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / ( - ::WeightInfo::on_initialize_per_queue_item(1) - - ::WeightInfo::on_initialize_per_queue_item(0) - )) / 5) as u32; - */ + // Contracts: + pub Schedule: pallet_contracts::Schedule = Default::default(); + pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionQueueDepth: u32 = 1024; + pub MaxInLen: u32 = 8 * 1024; } /// Splits fees 80/20 between treasury and block author. pub type DealWithFees = SplitTwoWays< Balance, NegativeImbalance, - _4, - Treasury, // 4 parts (80%) goes to the treasury. - _1, + Treasury, // 4 parts (80%) goes to the treasury. Author, // 1 part (20%) goes to the block author. + 4, + 1, >; // Staking: @@ -191,7 +177,7 @@ parameter_types! { pub const MaxIterations: u32 = 10; pub const MaxValidatorPerIdentity: Permill = Permill::from_percent(33); // 0.05%. The higher the value, the more strict solution acceptance becomes. - pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); + pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000); pub const MaxVariableInflationTotalIssuance: Balance = 1_000_000_000 * POLY; pub const FixedYearlyReward: Balance = 140_000_000 * POLY; pub const MinimumBond: Balance = 1 * POLY; @@ -204,6 +190,18 @@ parameter_types! { polymesh_runtime_common::misc_pallet_impls!(); +type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler; + +impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call { + type Error = (); + fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call, ()> { + match call { + Call::TestUtils(x) => Ok(x), + _ => Err(()), + } + } +} + impl polymesh_common_utilities::traits::identity::Config for Runtime { type Event = Event; type Proposal = Call; @@ -221,6 +219,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } impl pallet_committee::Config for Runtime { @@ -301,7 +300,7 @@ impl pallet_test_utils::Config for Runtime { type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; } -pub type AllModulesExported = AllModules; +pub type AllModulesExported = AllPalletsWithSystem; construct_runtime!( pub enum Runtime where @@ -310,88 +309,90 @@ construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Module, Call, Config, Storage, Event}, - Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Indices: pallet_indices::{Module, Call, Storage, Config, Event}, - Authorship: pallet_authorship::{Module, Call, Storage, Inherent}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event}, + Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, // Balance: Genesis config dependencies: System. - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Module, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, // Identity: Genesis config deps: Timestamp. - Identity: pallet_identity::{Module, Call, Storage, Event, Config}, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, // Polymesh Committees // CddServiceProviders (group only): Genesis config deps: Identity - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config}, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Governance Council (committee) - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. - CommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + CommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Technical Committee - TechnicalCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + TechnicalCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity - TechnicalCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + TechnicalCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, // Upgrade Committee - UpgradeCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, + UpgradeCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee, Identity - UpgradeCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config}, + UpgradeCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config}, - MultiSig: pallet_multisig::{Module, Call, Config, Storage, Event}, + MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event}, // Bridge: Genesis config deps: Multisig, Identity, Committees - Bridge: pallet_bridge::{Module, Call, Storage, Config, Event}, + Bridge: pallet_bridge::{Pallet, Call, Storage, Config, Event}, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees - Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned}, - Offences: pallet_offences::{Module, Call, Storage, Event}, + Staking: pallet_staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned}, + Offences: pallet_offences::{Pallet, Storage, Event}, // Session: Genesis config deps: System. - Session: pallet_session::{Module, Call, Storage, Event, Config}, - AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config}, - Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event}, - Historical: pallet_session_historical::{Module}, - ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, + Historical: pallet_session_historical::{Pallet}, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, // Sudo. Usable initially. - Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, + + // Asset: Genesis config deps: Timestamp, + Asset: pallet_asset::{Pallet, Call, Storage, Config, Event}, + CapitalDistribution: pallet_capital_distribution::{Pallet, Call, Storage, Event}, + Checkpoint: pallet_checkpoint::{Pallet, Call, Storage, Event, Config}, + ComplianceManager: pallet_compliance_manager::{Pallet, Call, Storage, Event}, + CorporateAction: pallet_corporate_actions::{Pallet, Call, Storage, Event, Config}, + CorporateBallot: pallet_corporate_ballot::{Pallet, Call, Storage, Event}, + Permissions: pallet_permissions::{Pallet}, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config}, + Portfolio: pallet_portfolio::{Pallet, Call, Storage, Event}, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config}, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, + Settlement: pallet_settlement::{Pallet, Call, Storage, Event, Config}, + Statistics: pallet_statistics::{Pallet, Call, Storage, Event}, + Sto: pallet_sto::{Pallet, Call, Storage, Event}, + Treasury: pallet_treasury::{Pallet, Call, Event}, + Utility: pallet_utility::{Pallet, Call, Storage, Event}, + Base: pallet_base::{Pallet, Call, Event}, + ExternalAgents: pallet_external_agents::{Pallet, Call, Storage, Event}, + Relayer: pallet_relayer::{Pallet, Call, Storage, Event}, + Rewards: pallet_rewards::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, - /* // Contracts - BaseContracts: pallet_contracts::{Module, Config, Storage, Event}, - Contracts: polymesh_contracts::{Module, Call, Storage, Event}, - */ + Contracts: pallet_contracts::{Pallet, Storage, Event}, + PolymeshContracts: polymesh_contracts::{Pallet, Call, Storage, Event}, - // Asset: Genesis config deps: Timestamp, - Asset: pallet_asset::{Module, Call, Storage, Config, Event}, - CapitalDistribution: pallet_capital_distribution::{Module, Call, Storage, Event}, - Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config}, - ComplianceManager: pallet_compliance_manager::{Module, Call, Storage, Event}, - CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config}, - CorporateBallot: pallet_corporate_ballot::{Module, Call, Storage, Event}, - Permissions: pallet_permissions::{Module}, - Pips: pallet_pips::{Module, Call, Storage, Event, Config}, - Portfolio: pallet_portfolio::{Module, Call, Storage, Event}, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Settlement: pallet_settlement::{Module, Call, Storage, Event, Config}, - Statistics: pallet_statistics::{Module, Call, Storage, Event}, - Sto: pallet_sto::{Module, Call, Storage, Event}, - Treasury: pallet_treasury::{Module, Call, Event}, - Utility: pallet_utility::{Module, Call, Storage, Event}, - Base: pallet_base::{Module, Call, Event}, - ExternalAgents: pallet_external_agents::{Module, Call, Storage, Event}, - Relayer: pallet_relayer::{Module, Call, Storage, Event}, - Rewards: pallet_rewards::{Module, Call, Storage, Event, Config, ValidateUnsigned}, - TestUtils: pallet_test_utils::{Module, Call, Storage, Event } = 50, + // Preimage register. Used by `pallet_scheduler`. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event}, + + TestUtils: pallet_test_utils::{Pallet, Call, Storage, Event } = 50, } ); @@ -408,6 +409,6 @@ pub trait DryRunRuntimeUpgrade { #[cfg(feature = "migration-dry-run")] impl DryRunRuntimeUpgrade for Runtime { fn dry_run_runtime_upgrade() -> Weight { - ::on_runtime_upgrade() + ::on_runtime_upgrade() } } diff --git a/pallets/runtime/tests/Cargo.toml b/pallets/runtime/tests/Cargo.toml index c9b8681b22..1eeceb1562 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -2,11 +2,11 @@ name = "polymesh-runtime-tests" version = "1.0.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } -cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } +cryptography_core = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-asset = { path = "../../asset", default-features = false } pallet-balances = { path = "../../balances", default-features = false } @@ -38,12 +38,13 @@ pallet-transaction-payment = { path = "../../transaction-payment", default-featu pallet-treasury = { path = "../../treasury", default-features = false } pallet-utility = { path = "../../utility", default-features = false } polymesh-common-utilities = { path = "../../common", default-features = false } -#polymesh-contracts = { path = "../../contracts", default-features = false } +polymesh-contracts = { path = "../../contracts", default-features = false } polymesh-extensions = { path = "../extensions", default-features = false } polymesh-primitives = { path = "../../../primitives", default-features = false } polymesh-runtime-common = { path = "../common", default-features = false } polymesh-runtime-develop = { path = "../develop" } polymesh-weights = { path = "../../weights", default-features = false } +polymesh-exec-macro = { path = "exec_macro" } # General serde = { version = "1.0.104", default-features = false } @@ -52,61 +53,67 @@ chrono = "0.4" hex-literal = "0.3.0" smallvec = "1.4.1" lazy_static = "1.4.0" -parking_lot = "0.11.1" +parking_lot = "0.12.0" env_logger = "0.7" serde_json = '1.0.48' +log = "0.4.8" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "3.0.0", optional = true } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-benchmarking = { version = "4.0.0-dev", optional = true } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false } ink_primitives = { git = "https://github.com/paritytech/ink", tag = "v2.1.0", default-features = false } -pallet-authority-discovery = { version = "3.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -#pallet-contracts-primitives = { version = "3.0.0", default-features = false } -#pallet-contracts-rpc-runtime-api = { version = "3.0.0", default-features = false } -pallet-executive = { package = "frame-executive", version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-offences = { version = "3.0.0", default-features = false } -pallet-randomness-collective-flip = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false, features = ["historical"] } -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-authority-discovery = { version = "3.0.0", default-features = false } -sp-block-builder = { version = "3.0.0", default-features = false } -sp-consensus-babe = { version = "0.9.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-inherents = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-npos-elections = { version = "3.0.0", default-features = false} -sp-offchain = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-session = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-transaction-pool = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "6.0.0", default-features = false } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } +pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-offences = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false, features = ["historical"] } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false } +sp-block-builder = { version = "4.0.0-dev", default-features = false } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-inherents = { version = "4.0.0-dev", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-npos-elections = { version = "4.0.0-dev", default-features = false } +sp-offchain = { version = "4.0.0-dev", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-session = { version = "4.0.0-dev", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false } +sp-version = { version = "5.0.0", default-features = false } -test_client = { package = "substrate-test-runtime-client", git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2", optional = true } -substrate-test-utils = { version = "3.0.0", optional = true } +test_client = { package = "substrate-test-runtime-client", git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05", optional = true } +substrate-test-utils = { version = "4.0.0-dev", optional = true } [dev-dependencies] libsecp256k1 = { version = "0.6", default-features = false } wat = "1.0" -sp-tracing = { version = "3.0.0", default-features = false } +sp-tracing = { version = "5.0.0", default-features = false } [features] default = ["std", "equalize"] +default_identity = [ "polymesh-common-utilities/default_identity" ] + equalize = [] only-staking = [] @@ -123,9 +130,9 @@ std = [ "avx2_backend", "cryptography_core/std", "confidential_identity/std", - "frame-benchmarking/std", "frame-support/std", "frame-system/std", + "frame-election-provider-support/std", "ink_primitives/std", "pallet-asset/std", "pallet-authorship/std", @@ -135,7 +142,7 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - #"pallet-contracts/std", + "pallet-contracts/std", "pallet-corporate-actions/std", "pallet-external-agents/std", "polymesh-weights/std", @@ -144,6 +151,7 @@ std = [ "pallet-identity/std", "pallet-multisig/std", "pallet-permissions/std", + "pallet-preimage/std", "pallet-pips/std", "pallet-portfolio/std", "pallet-relayer/std", @@ -159,7 +167,7 @@ std = [ "polymesh-common-utilities/std", "polymesh-primitives/std", "polymesh-runtime-common/std", - #"polymesh-contracts/std", + "polymesh-contracts/std", "polymesh-weights/std", "serde/std", "sp-arithmetic/std", @@ -173,5 +181,5 @@ std = [ "test_client", ] runtime-benchmarks = [ - "frame-benchmarking", + "frame-benchmarking/runtime-benchmarks", ] diff --git a/pallets/runtime/tests/exec_macro/Cargo.toml b/pallets/runtime/tests/exec_macro/Cargo.toml new file mode 100644 index 0000000000..9e7d1f465b --- /dev/null +++ b/pallets/runtime/tests/exec_macro/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "polymesh-exec-macro" +version = "1.0.0" +authors = ["Polymath"] +edition = "2021" + +[lib] +proc-macro = true + +[dependencies] +syn = { version = "1.0", features = ["full", "extra-traits"] } +quote = "1.0" +proc-macro2 = "1.0" diff --git a/pallets/runtime/tests/exec_macro/src/lib.rs b/pallets/runtime/tests/exec_macro/src/lib.rs new file mode 100644 index 0000000000..c06c40ce02 --- /dev/null +++ b/pallets/runtime/tests/exec_macro/src/lib.rs @@ -0,0 +1,74 @@ +use proc_macro::TokenStream; +use proc_macro2::Span; +use quote::quote; +use std::iter::FromIterator; +use syn::{ + parenthesized, + parse::{Parse, ParseStream, Result}, + parse_macro_input, + punctuated::Punctuated, + Expr, Ident, Token, +}; + +#[derive(Debug)] +struct Exec { + pallet: Ident, + extrinsic: Ident, + origin: Expr, + params: Punctuated, +} + +impl Parse for Exec { + fn parse(input: ParseStream) -> Result { + let pallet: Ident = input.parse()?; + input.parse::()?; + let extrinsic: Ident = input.parse()?; + + let paren_content; + parenthesized!(paren_content in input); + let mut params = paren_content + .parse_terminated::(Expr::parse)? + .into_iter(); + let origin = params.next().unwrap(); + let params = Punctuated::from_iter(params); + + Ok(Exec { + pallet, + extrinsic, + origin, + params, + }) + } +} + +/// Convert a direct module call to an extrinsic execution. +/// Syntax: `::(,*)` +#[proc_macro] +pub fn exec(item: TokenStream) -> TokenStream { + let Exec { + pallet, + extrinsic, + origin, + params, + } = parse_macro_input!(item as Exec); + + let call_variant = Ident::new( + &format!("new_call_variant_{}", extrinsic.to_string()), + Span::call_site(), + ); + + let token_stream = quote! { + if *crate::storage::INTEGRATION_TEST { + crate::storage::exec( + #origin, + >::Call::#call_variant( + #params + ) + ) + } else { + #pallet::#extrinsic(#origin, #params) + } + }; + + TokenStream::from(token_stream) +} diff --git a/pallets/runtime/tests/fixtures/chain_extension.wat b/pallets/runtime/tests/fixtures/chain_extension.wat new file mode 100644 index 0000000000..b7813b8779 --- /dev/null +++ b/pallets/runtime/tests/fixtures/chain_extension.wat @@ -0,0 +1,32 @@ +;; Call chain extension by passing through input and output of this contract +(module + (import "seal0" "seal_call_chain_extension" + (func $seal_call_chain_extension (param i32 i32 i32 i32 i32) (result i32)) + ) + (import "seal0" "seal_input" (func $seal_input (param i32 i32))) + (import "env" "memory" (memory 16 16)) + + ;; [0, 4) len of input output + (data (i32.const 0) "10000") + + (func (export "deploy")) + + (func (export "call") + ;; Read input into memory at offset 4 and length at offset 0. + (call $seal_input (i32.const 4) (i32.const 0)) + + ;; Input is expected to be `func_id` followed by arbitrary data. + (call $seal_call_chain_extension + ;; func_id is first 4 bytes of input. + (i32.load (i32.const 4)) + ;; input_ptr, starts at offset 8 since func_id takes up 4 initial. + (i32.const 8) + ;; input_len stored at 0 per above, but we need to discount func_id from length. + (i32.sub (i32.load (i32.const 0)) (i32.const 4)) + (i32.const 0) ;; output_ptr -- ignored + (i32.const 0) ;; output_len_ptr -- ignored + ) + + drop + ) +) diff --git a/pallets/runtime/tests/src/asset_metadata_test.rs b/pallets/runtime/tests/src/asset_metadata_test.rs new file mode 100644 index 0000000000..7314eb1832 --- /dev/null +++ b/pallets/runtime/tests/src/asset_metadata_test.rs @@ -0,0 +1,505 @@ +use super::{ + asset_test::create_token, + exec_noop, exec_ok, + storage::{TestStorage, User}, + ExtBuilder, +}; +use frame_support::{assert_noop, assert_ok, dispatch::DispatchError}; +use polymesh_primitives::{ + asset_metadata::{ + AssetMetadataKey, AssetMetadataLockStatus, AssetMetadataName, AssetMetadataSpec, + AssetMetadataValue, AssetMetadataValueDetail, + }, + Ticker, +}; +use test_client::AccountKeyring; + +type Origin = ::Origin; +type Moment = ::Moment; + +type MaxLen = ::MaxLen; +type AssetMetadataNameMaxLength = ::AssetMetadataNameMaxLength; +type AssetMetadataValueMaxLength = + ::AssetMetadataValueMaxLength; +type AssetMetadataTypeDefMaxLength = + ::AssetMetadataTypeDefMaxLength; + +type Asset = pallet_asset::Module; + +type BaseError = pallet_base::Error; +type EAError = pallet_external_agents::Error; +type AssetError = pallet_asset::Error; + +/// Make metadata name & specs using the requested lengths. +fn make_metadata_type_sizes( + name_len: u32, + url_len: u32, + desc_len: u32, + type_def_len: u32, +) -> (AssetMetadataName, AssetMetadataSpec) { + let spec = AssetMetadataSpec { + url: Some(vec![b'u'; url_len as usize].into()), + description: Some(vec![b'd'; desc_len as usize].into()), + type_def: Some(vec![b't'; type_def_len as usize]), + }; + let name = AssetMetadataName(vec![b'n'; name_len as usize]); + + (name, spec) +} + +/// Helper for creating metadata value details. +fn make_metadata_value_details( + expire: Option, + locked: bool, +) -> AssetMetadataValueDetail { + AssetMetadataValueDetail { + expire, + lock_status: if locked { + AssetMetadataLockStatus::Locked + } else { + AssetMetadataLockStatus::Unlocked + }, + } +} + +/// Make metadata name & spec for the given name. +fn make_metadata_type(name: &str) -> (AssetMetadataName, AssetMetadataSpec) { + let spec = AssetMetadataSpec { + url: Some(b"http://example.com/test_specs".into()), + description: Some(format!("{} metadata type", name).as_bytes().into()), + type_def: Some(vec![]), + }; + let name: AssetMetadataName = name.as_bytes().into(); + + (name, spec) +} + +/// Helper to register metadata type with the give name. +fn register_metadata_type(owner: User, ticker: Option, name: &str) -> AssetMetadataKey { + let (name, spec) = make_metadata_type(name); + + if let Some(ticker) = ticker { + // Register local metadata type with asset owner. + exec_ok!(Asset::register_asset_metadata_local_type( + owner.origin(), + ticker, + name.clone(), + spec, + )); + + Asset::asset_metadata_local_name_to_key(ticker, name) + .map(AssetMetadataKey::from) + .expect("Failed to register metadata") + } else { + let root = frame_system::RawOrigin::Root; + // Register global metadata type with root. + assert_ok!(Asset::register_asset_metadata_global_type( + root.into(), + name.clone(), + spec, + )); + + Asset::asset_metadata_global_name_to_key(name) + .map(AssetMetadataKey::from) + .expect("Failed to register metadata") + } +} + +#[test] +fn set_asset_metadata_local_type() { + ExtBuilder::default().build().execute_with(|| { + let owner = User::new(AccountKeyring::Dave); + let other = User::new(AccountKeyring::Alice); + + // Create asset. + let (ticker, _) = create_token(owner); + + let global_key = register_metadata_type(owner, None, "TEST"); + let local_key = register_metadata_type(owner, Some(ticker), "TEST"); + + let value = AssetMetadataValue("cow".as_bytes().into()); + let details = Some(make_metadata_value_details(None, false)); + + // Try adding global metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata( + other.origin(), + ticker, + global_key, + value.clone(), + details.clone() + ), + EAError::UnauthorizedAgent + ); + + // Try adding local metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata( + other.origin(), + ticker, + local_key, + value.clone(), + details.clone() + ), + EAError::UnauthorizedAgent + ); + + // Make value that exceeds the maximum limit. + let value_len = AssetMetadataValueMaxLength::get() + 1; + let over_sized_value = AssetMetadataValue(vec![b'v'; value_len as usize]); + + // Try to set a global key with a value that exceeds the maximum limit. + exec_noop!( + Asset::set_asset_metadata( + owner.origin(), + ticker, + global_key, + over_sized_value.clone(), + details.clone() + ), + AssetError::AssetMetadataValueMaxLengthExceeded + ); + + // Try to set a local key with a value that exceeds the maximum limit. + exec_noop!( + Asset::set_asset_metadata( + owner.origin(), + ticker, + local_key, + over_sized_value.clone(), + details.clone() + ), + AssetError::AssetMetadataValueMaxLengthExceeded + ); + + // Set metadata value for global key. + exec_ok!(Asset::set_asset_metadata( + owner.origin(), + ticker, + global_key, + value.clone(), + details.clone() + )); + + // Set metadata value for local key. + exec_ok!(Asset::set_asset_metadata( + owner.origin(), + ticker, + local_key, + value.clone(), + details.clone() + )); + + let value2 = AssetMetadataValue("beef".as_bytes().into()); + let details2 = Some(make_metadata_value_details(Some(1), false)); + + // Try updating global metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata( + other.origin(), + ticker, + global_key, + value2.clone(), + details2.clone() + ), + EAError::UnauthorizedAgent + ); + + // Try updating local metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata( + other.origin(), + ticker, + local_key, + value2.clone(), + details2.clone() + ), + EAError::UnauthorizedAgent + ); + + // Update metadata value for global key. + exec_ok!(Asset::set_asset_metadata( + owner.origin(), + ticker, + global_key, + value2.clone(), + details2.clone(), + )); + + // Update metadata value for local key. + exec_ok!(Asset::set_asset_metadata( + owner.origin(), + ticker, + local_key, + value2.clone(), + details2.clone(), + )); + + let details_locked = make_metadata_value_details(None, true); + // Try locking global metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata_details( + other.origin(), + ticker, + global_key, + details_locked.clone() + ), + EAError::UnauthorizedAgent + ); + + // Try locking local metadata value with user that doesn't have permissions for this asset. + exec_noop!( + Asset::set_asset_metadata_details( + other.origin(), + ticker, + local_key, + details_locked.clone() + ), + EAError::UnauthorizedAgent + ); + + // Lock metadata value for global key. + exec_ok!(Asset::set_asset_metadata_details( + owner.origin(), + ticker, + global_key, + details_locked.clone(), + )); + + // Lock metadata value for local key. + exec_ok!(Asset::set_asset_metadata_details( + owner.origin(), + ticker, + local_key, + details_locked.clone(), + )); + + let value3 = AssetMetadataValue("deadbeef".as_bytes().into()); + let details3 = Some(make_metadata_value_details(Some(3), false)); + + // Try updating locked metadata value for global key. + exec_noop!( + Asset::set_asset_metadata( + owner.origin(), + ticker, + global_key, + value3.clone(), + details3.clone(), + ), + AssetError::AssetMetadataValueIsLocked + ); + + // Try updating locked metadata value for local key. + exec_noop!( + Asset::set_asset_metadata( + owner.origin(), + ticker, + local_key, + value3.clone(), + details3.clone(), + ), + AssetError::AssetMetadataValueIsLocked + ); + }); +} + +#[test] +fn register_and_set_local_asset_metadata() { + ExtBuilder::default().build().execute_with(|| { + let owner = User::new(AccountKeyring::Dave); + let other = User::new(AccountKeyring::Alice); + + // Create asset. + let (ticker, _) = create_token(owner); + + let (name, spec) = make_metadata_type("TEST"); + let value = AssetMetadataValue("cow".as_bytes().into()); + let details = Some(make_metadata_value_details(None, false)); + + // Try registering local metadata type with user that doesn't have permissions for this asset. + exec_noop!( + Asset::register_and_set_local_asset_metadata( + other.origin(), + ticker, + name.clone(), + spec.clone(), + value.clone(), + details.clone(), + ), + EAError::UnauthorizedAgent + ); + + // Register and set local metadata type with asset owner. + exec_ok!(Asset::register_and_set_local_asset_metadata( + owner.origin(), + ticker, + name.clone(), + spec.clone(), + value.clone(), + details.clone(), + )); + + // Try registering and setting metadata with the same name. + exec_noop!( + Asset::register_and_set_local_asset_metadata( + owner.origin(), + ticker, + name, + spec, + value, + details + ), + AssetError::AssetMetadataLocalKeyAlreadyExists + ); + }); +} + +#[test] +fn register_asset_metadata_local_type() { + ExtBuilder::default().build().execute_with(|| { + let owner = User::new(AccountKeyring::Dave); + let other = User::new(AccountKeyring::Alice); + + // Create asset. + let (ticker, _) = create_token(owner); + + let (name, spec) = make_metadata_type("TEST"); + + // Try registering local metadata type with user that doesn't have permissions for this asset. + exec_noop!( + Asset::register_asset_metadata_local_type( + other.origin(), + ticker, + name.clone(), + spec.clone(), + ), + EAError::UnauthorizedAgent + ); + + // Register local metadata type with asset owner. + exec_ok!(Asset::register_asset_metadata_local_type( + owner.origin(), + ticker, + name.clone(), + spec.clone(), + )); + + // Try registering metadata with the same name. + exec_noop!( + Asset::register_asset_metadata_local_type(owner.origin(), ticker, name, spec,), + AssetError::AssetMetadataLocalKeyAlreadyExists + ); + }); +} + +#[test] +fn register_asset_metadata_global_type() { + ExtBuilder::default().build().execute_with(|| { + let alice = User::new(AccountKeyring::Alice); + let root = Origin::from(frame_system::RawOrigin::Root); + + let (name, spec) = make_metadata_type("TEST"); + + // Try registering global metadata type with non-root. + exec_noop!( + Asset::register_asset_metadata_global_type(alice.origin(), name.clone(), spec.clone(),), + DispatchError::BadOrigin + ); + + // Register global metadata type with root. + assert_ok!(Asset::register_asset_metadata_global_type( + root.clone(), + name.clone(), + spec.clone(), + )); + + // Try registering metadata with the same name. + assert_noop!( + Asset::register_asset_metadata_global_type(root, name, spec,), + AssetError::AssetMetadataGlobalKeyAlreadyExists + ); + }); +} + +#[test] +fn register_asset_metadata_local_type_limits() { + ExtBuilder::default().build().execute_with(|| { + let owner = User::new(AccountKeyring::Dave); + + // Create asset. + let (ticker, _) = create_token(owner); + + // Try registering metadata with over-sized values. + let register_type = |name, url, desc, type_def, err: DispatchError| { + let (name, spec) = make_metadata_type_sizes(name, url, desc, type_def); + exec_noop!( + Asset::register_asset_metadata_local_type(owner.origin(), ticker, name, spec,), + err + ); + }; + + // Oversized metadata name. + register_type( + AssetMetadataNameMaxLength::get() + 1, + 10, + 10, + 10, + AssetError::AssetMetadataNameMaxLengthExceeded.into(), + ); + + // Oversized metadata url. + register_type(10, MaxLen::get() + 1, 10, 10, BaseError::TooLong.into()); + + // Oversized metadata description. + register_type(10, 10, MaxLen::get() + 1, 10, BaseError::TooLong.into()); + + // Oversized metadata type definition. + register_type( + 10, + 10, + 10, + AssetMetadataTypeDefMaxLength::get() + 1, + AssetError::AssetMetadataTypeDefMaxLengthExceeded.into(), + ); + }); +} + +#[test] +fn register_asset_metadata_global_type_limits() { + ExtBuilder::default().build().execute_with(|| { + let root = Origin::from(frame_system::RawOrigin::Root); + + // Try registering metadata with over-sized values. + let register_type = |name, url, desc, type_def, err: DispatchError| { + let (name, spec) = make_metadata_type_sizes(name, url, desc, type_def); + assert_noop!( + Asset::register_asset_metadata_global_type(root.clone(), name, spec,), + err + ); + }; + + // Oversized metadata name. + register_type( + AssetMetadataNameMaxLength::get() + 1, + 10, + 10, + 10, + AssetError::AssetMetadataNameMaxLengthExceeded.into(), + ); + + // Oversized metadata url. + register_type(10, MaxLen::get() + 1, 10, 10, BaseError::TooLong.into()); + + // Oversized metadata description. + register_type(10, 10, MaxLen::get() + 1, 10, BaseError::TooLong.into()); + + // Oversized metadata type definition. + register_type( + 10, + 10, + 10, + AssetMetadataTypeDefMaxLength::get() + 1, + AssetError::AssetMetadataTypeDefMaxLengthExceeded.into(), + ); + }); +} diff --git a/pallets/runtime/tests/src/asset_test.rs b/pallets/runtime/tests/src/asset_test.rs index 7e3131abbf..1da9de43fe 100644 --- a/pallets/runtime/tests/src/asset_test.rs +++ b/pallets/runtime/tests/src/asset_test.rs @@ -1,6 +1,5 @@ use crate::{ - //contract_test::{create_se_template, flipper}, - ext_builder::{ExtBuilder, MockProtocolBaseFees}, + ext_builder::{ExtBuilder, IdentityRecord, MockProtocolBaseFees}, pips_test::assert_balance, storage::{ add_secondary_key, make_account_without_cdd, provide_scope_claim, @@ -41,6 +40,7 @@ use polymesh_primitives::{ calendar::{ CalendarPeriod, CalendarUnit, CheckpointId, CheckpointSchedule, FixedOrVariableCalendarUnit, }, + statistics::StatType, AccountId, AssetIdentifier, AssetPermissions, AuthorizationData, AuthorizationError, Document, DocumentId, IdentityId, InvestorUid, Moment, Permissions, PortfolioId, PortfolioName, SecondaryKey, Signatory, Ticker, @@ -57,9 +57,8 @@ use test_client::AccountKeyring; type BaseError = pallet_base::Error; type Identity = identity::Module; type Balances = balances::Module; -//type Contracts = pallet_contracts::Module; type Asset = asset::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; type ComplianceManager = compliance_manager::Module; type Portfolio = pallet_portfolio::Module; type AssetError = asset::Error; @@ -68,7 +67,7 @@ type Origin = ::Origin; type DidRecords = identity::DidRecords; type Statistics = statistics::Module; type AssetGenesis = asset::GenesisConfig; -type System = frame_system::Module; +type System = frame_system::Pallet; type ExternalAgents = pallet_external_agents::Module; type EAError = pallet_external_agents::Error; type FeeError = pallet_protocol_fee::Error; @@ -141,6 +140,7 @@ fn asset_with_ids( None, false, )?; + enable_investor_count(ticker, owner); Asset::issue(owner.origin(), ticker, token.total_supply)?; assert_eq!(Asset::balance_of(&ticker, owner.did), token.total_supply); Ok(()) @@ -165,18 +165,13 @@ crate fn allow_all_transfers(ticker: Ticker, owner: User) { )); } -/* -fn setup_se_template(creator: User, create_instance: bool) -> AccountId { - let (code_hash, wasm) = flipper(); - - // Create SE template and instantiate with empty salt. - if create_instance { - create_se_template(creator.acc(), creator.did, 0, code_hash, wasm); - } - - Contracts::contract_address(&creator.acc(), &code_hash, &[]) +fn enable_investor_count(ticker: Ticker, owner: User) { + assert_ok!(Statistics::set_active_asset_stats( + owner.origin(), + ticker.into(), + [StatType::investor_count()].iter().cloned().collect(), + )); } -*/ crate fn transfer(ticker: Ticker, from: User, to: User, amount: u128) -> DispatchResult { Asset::base_transfer( @@ -198,7 +193,7 @@ const TOTAL_SUPPLY: u128 = 1_000_000_000u128; /// Generates a new portfolio for `owner` using the given `name`. fn new_portfolio(owner: AccountId, name: &str) -> PortfolioId { let portfolio_name = PortfolioName::from(name); - let did = Identity::key_to_identity_dids(owner.clone()); + let did = Identity::get_identity(&owner).expect("User missing identity"); Portfolio::create_portfolio(Origin::signed(owner), portfolio_name.clone()) .expect("New portfolio cannot be created"); @@ -255,6 +250,7 @@ fn issuers_can_create_and_rename_tokens() { Some(funding_round_name.clone()), false, )); + enable_investor_count(ticker, owner); let issue = |supply| Asset::issue(owner.origin(), ticker, supply); assert_noop!( @@ -838,182 +834,6 @@ fn adding_removing_documents() { }); } -/* -fn add_smart_ext( - owner: User, - ticker: Ticker, - ty: SmartExtensionType, -) -> (AccountId, SmartExtension) { - let id = setup_se_template(owner, true); - let details = SmartExtension { - extension_type: ty.clone(), - extension_name: b"EXT".into(), - extension_id: id.clone(), - is_archive: false, - }; - assert_ok!(Asset::add_extension( - owner.origin(), - ticker, - details.clone(), - )); - assert_eq!(Asset::extension_details((ticker, id.clone())), details); - assert_eq!(Asset::extensions((ticker, ty)), [id.clone()]); - (id, details) -} - -#[track_caller] -fn smart_ext_test(logic: impl FnOnce(User, Ticker)) { - ExtBuilder::default() - .set_max_tms_allowed(10) - .set_contracts_put_code(true) - .build() - .execute_with(|| { - let owner = User::new(AccountKeyring::Dave); - let (ticker, token) = a_token(owner.did); - assert!(!has_ticker_record(ticker)); - assert_ok!(asset_with_ids(owner, ticker, &token, vec![cusip()])); - logic(owner, ticker) - }); -} - -#[test] -fn add_extension_limited() { - smart_ext_test(|owner, ticker| { - let id = setup_se_template(owner, true); - let add_ext = |ty: &Vec, name: &Vec| { - let details = SmartExtension { - extension_type: SmartExtensionType::Custom(ty.clone().into()), - extension_name: name.clone().into(), - extension_id: id.clone().into(), - is_archive: false, - }; - Asset::add_extension(owner.origin(), ticker.clone(), details) - }; - let id: Vec = max_len_bytes(0); - let invalid_id: Vec = max_len_bytes(1); - - assert_too_long!(add_ext(&invalid_id, &id)); - assert_too_long!(add_ext(&id, &invalid_id)); - pallet_asset::CompatibleSmartExtVersion::insert( - SmartExtensionType::Custom(id.clone().into()), - 5000, - ); - assert_ok!(add_ext(&id, &id)); - }); -} - -#[test] -fn add_extension_successfully() { - smart_ext_test(|owner, ticker| { - add_smart_ext(owner, ticker, SmartExtensionType::TransferManager); - }); -} - -#[test] -fn add_same_extension_should_fail() { - smart_ext_test(|owner, ticker| { - // Add it. - let (_, details) = add_smart_ext(owner, ticker, SmartExtensionType::TransferManager); - - // And again, unsuccessfully. - assert_noop!( - Asset::add_extension(owner.origin(), ticker, details), - AssetError::ExtensionAlreadyPresent - ); - }); -} - -#[test] -fn should_successfully_archive_extension() { - smart_ext_test(|owner, ticker| { - // Add it. - let (id, _) = add_smart_ext(owner, ticker, SmartExtensionType::Offerings); - - // Archive it. - assert_ok!(Asset::archive_extension(owner.origin(), ticker, id.clone())); - assert_eq!(Asset::extension_details((ticker, id)).is_archive, true); - }); -} - -#[test] -fn should_fail_to_archive_an_already_archived_extension() { - smart_ext_test(|owner, ticker| { - // Add it. - let (id, _) = add_smart_ext(owner, ticker, SmartExtensionType::Offerings); - - // Archive it. - let archive = || Asset::archive_extension(owner.origin(), ticker, id.clone()); - assert_ok!(archive()); - assert_eq!( - Asset::extension_details((ticker, id.clone())).is_archive, - true - ); - - // And again, unsuccessfully. - assert_noop!(archive(), AssetError::AlreadyArchived); - }); -} - -#[test] -fn should_fail_to_archive_a_non_existent_extension() { - smart_ext_test(|owner, ticker| { - // Archive that which doesn't exist. - assert_noop!( - Asset::archive_extension(owner.origin(), ticker, AccountKeyring::Bob.to_account_id()), - AssetError::NoSuchSmartExtension - ); - }); -} - -#[test] -fn should_successfully_unarchive_an_extension() { - smart_ext_test(|owner, ticker| { - // Add it. - let (id, _) = add_smart_ext(owner, ticker, SmartExtensionType::Offerings); - - // Archive it. - let is_archive = || Asset::extension_details((ticker, id.clone())).is_archive; - let archive = || { - assert_ok!(Asset::archive_extension(owner.origin(), ticker, id.clone())); - assert_eq!(is_archive(), true); - }; - archive(); - - // Unarchive it. - assert_ok!(Asset::unarchive_extension( - owner.origin(), - ticker, - id.clone() - )); - assert_eq!(is_archive(), false); - - // Roundtrip. - archive(); - }); -} - -#[test] -fn should_fail_to_unarchive_an_already_unarchived_extension() { - smart_ext_test(|owner, ticker| { - // Add it. - let (id, _) = add_smart_ext(owner, ticker, SmartExtensionType::Offerings); - - // Archive it. - assert_ok!(Asset::archive_extension(owner.origin(), ticker, id.clone())); - let is_archive = || Asset::extension_details((ticker, id.clone())).is_archive; - assert_eq!(is_archive(), true); - - // Unarchive it. - let unarchive = || Asset::unarchive_extension(owner.origin(), ticker, id.clone()); - assert_ok!(unarchive()); - assert_eq!(is_archive(), false); - - // And again, unsuccessfully. - assert_noop!(unarchive(), AssetError::AlreadyUnArchived); - }); -} -*/ - #[test] fn freeze_unfreeze_asset() { ExtBuilder::default().build().execute_with(|| { @@ -1725,7 +1545,7 @@ fn classic_ticker_claim_works() { [ .., frame_system::EventRecord { - event: super::storage::EventTest::pallet_asset( + event: super::storage::EventTest::Asset( pallet_asset::RawEvent::ClassicTickerClaimed(..) ), .. @@ -1833,7 +1653,7 @@ fn check_unique_investor_count() { // Verify the balance of the alice and the investor count for the asset. assert_eq!(Asset::balance_of(&ticker, alice.did), total_supply); // It should be equal to total supply. // Alice act as the unique investor but not on the basis of ScopeId as alice doesn't posses the claim yet. - assert_eq!(Statistics::investor_count(&ticker), 1); + assert_eq!(Statistics::investor_count(ticker), 1); assert!(!ScopeIdOf::contains_key(&ticker, alice.did)); // 1. Transfer some funds to bob_1.did. @@ -1878,7 +1698,7 @@ fn check_unique_investor_count() { assert_eq!(Asset::aggregate_balance_of(&ticker, &bob_scope_id), 1000); assert_eq!(Asset::balance_of_at_scope(&bob_scope_id, &bob_1.did), 1000); assert_eq!(Asset::balance_of(&ticker, &bob_1.did), 1000); - assert_eq!(Statistics::investor_count(&ticker), 2); + assert_eq!(Statistics::investor_count(ticker), 2); // validate the storage changes for Alice. assert_eq!( @@ -1890,7 +1710,7 @@ fn check_unique_investor_count() { total_supply - 1000 ); assert_eq!(Asset::balance_of(&ticker, &alice.did), total_supply - 1000); - assert_eq!(Statistics::investor_count(&ticker), 2); + assert_eq!(Statistics::investor_count(ticker), 2); // Provide scope claim to bob_2.did provide_scope_claim(bob_2.did, ticker, bob_uid, cdd_provider, None).0; @@ -1902,7 +1722,7 @@ fn check_unique_investor_count() { assert_eq!(Asset::aggregate_balance_of(&ticker, &bob_scope_id), 2000); assert_eq!(Asset::balance_of_at_scope(&bob_scope_id, &bob_2.did), 1000); assert_eq!(Asset::balance_of(&ticker, &bob_2.did), 1000); - assert_eq!(Statistics::investor_count(&ticker), 2); + assert_eq!(Statistics::investor_count(ticker), 2); }); } @@ -2184,22 +2004,19 @@ fn secondary_key_not_authorized_for_asset_test() { let secondary_keys = vec![ SecondaryKey { - signer: Signatory::Account(not.to_account_id()), + key: not.to_account_id(), permissions: Permissions { asset: AssetPermissions::elems(invalid_tickers), ..Default::default() }, }, SecondaryKey { - signer: Signatory::Account(all.to_account_id()), + key: all.to_account_id(), permissions: Permissions::default(), }, ]; - let owner = polymesh_primitives::Identity { - primary_key: owner.to_account_id(), - secondary_keys, - }; + let owner = IdentityRecord::new(owner.to_account_id(), secondary_keys); ExtBuilder::default() .add_regular_users(&[owner]) @@ -2236,10 +2053,9 @@ fn invalid_ticker_registry_test() { (&b"YOUR"[..], false), ] .iter() - .map(|(name, exp)| (Ticker::try_from(name.as_ref()).unwrap(), exp)) + .map(|(name, exp)| ((*name).try_into().unwrap(), exp)) .for_each(|(ticker, exp)| { - let valid = Asset::is_ticker_registry_valid(&ticker, owner.did); - assert_eq!(*exp, valid) + assert_eq!(*exp, Asset::is_ticker_registry_valid(&ticker, owner.did)) }); }); } diff --git a/pallets/runtime/tests/src/balances_test.rs b/pallets/runtime/tests/src/balances_test.rs index 514f434a0c..9a3c20b4fb 100644 --- a/pallets/runtime/tests/src/balances_test.rs +++ b/pallets/runtime/tests/src/balances_test.rs @@ -20,7 +20,7 @@ use sp_runtime::traits::SignedExtension; use test_client::AccountKeyring; pub type Balances = balances::Module; -pub type System = frame_system::Module; +pub type System = frame_system::Pallet; type Identity = identity::Module; type Origin = ::Origin; type Error = balances::Error; @@ -46,10 +46,10 @@ fn signed_extension_charge_transaction_payment_work() { let alice_pub = AccountKeyring::Alice.to_account_id(); let alice_id = AccountKeyring::Alice.to_account_id(); - let call = runtime::Call::TestUtils(test_utils::Call::register_did( - InvestorUid::default(), - vec![], - )); + let call = runtime::Call::TestUtils(test_utils::Call::register_did { + uid: InvestorUid::default(), + secondary_keys: vec![], + }); assert!( as SignedExtension>::pre_dispatch( @@ -84,10 +84,10 @@ fn tipping_fails() { .monied(true) .build() .execute_with(|| { - let call = runtime::Call::TestUtils(test_utils::Call::register_did( - InvestorUid::default(), - vec![], - )); + let call = runtime::Call::TestUtils(test_utils::Call::register_did { + uid: InvestorUid::default(), + secondary_keys: vec![], + }); let len = 10; let alice_id = AccountKeyring::Alice.to_account_id(); assert!( @@ -299,7 +299,7 @@ fn transfer_with_memo_we() { let expected_events = vec![ EventRecord { phase: Phase::Initialization, - event: EventTest::pallet_balances(BalancesRawEvent::Transfer( + event: EventTest::Balances(BalancesRawEvent::Transfer( Some(alice_id), alice.clone(), Some(bob_id), @@ -311,7 +311,7 @@ fn transfer_with_memo_we() { }, EventRecord { phase: Phase::Initialization, - event: EventTest::pallet_balances(BalancesRawEvent::Transfer( + event: EventTest::Balances(BalancesRawEvent::Transfer( Some(alice_id), alice, Some(bob_id), diff --git a/pallets/runtime/tests/src/bridge.rs b/pallets/runtime/tests/src/bridge.rs index 38ee7eb327..3aa6f21d00 100644 --- a/pallets/runtime/tests/src/bridge.rs +++ b/pallets/runtime/tests/src/bridge.rs @@ -20,15 +20,16 @@ type Identity = pallet_identity::Module; type Balances = pallet_balances::Module; type MultiSig = pallet_multisig::Module; type Origin = ::Origin; -type System = frame_system::Module; -type Scheduler = pallet_scheduler::Module; +type System = frame_system::Pallet; +type Scheduler = pallet_scheduler::Pallet; type BridgeTx = GBridgeTx; type BridgeTxDetail = GBridgeTxDetail; const AMOUNT: u128 = 1_000_000_000; const AMOUNT_OVER_LIMIT: u128 = 1_000_000_000_000_000_000_000; -const WEIGHT_EXPECTED: u64 = 950000000; +const WEIGHT_EXPECTED_1: u64 = 766606000; +const WEIGHT_EXPECTED_2: u64 = 1556059000; const MIN_SIGNS_REQUIRED: u64 = 2; fn test_with_controller(test: &dyn Fn(&[AccountId])) { @@ -74,7 +75,9 @@ fn alice_bridge_tx(amount: u128) -> BridgeTx { } fn bridge_tx_to_proposal(tx: &BridgeTx) -> Call { - Call::Bridge(bridge::Call::handle_bridge_tx(tx.clone())) + Call::Bridge(bridge::Call::handle_bridge_tx { + bridge_tx: tx.clone(), + }) } fn alice_make_bridge_tx(amount: u128) -> BridgeTx { @@ -227,7 +230,7 @@ fn do_admin_freeze_and_unfreeze_bridge(signers: &[AccountId]) { // Weight calculation when bridge is freezed. ensure_tx_status(alice.clone(), 1, BridgeTxStatus::Timelocked); - assert_eq!(next_block(), WEIGHT_EXPECTED); + assert_eq!(next_block(), WEIGHT_EXPECTED_1); // Unfreeze the bridge. assert_ok!(Bridge::unfreeze(admin)); @@ -244,7 +247,7 @@ fn do_admin_freeze_and_unfreeze_bridge(signers: &[AccountId]) { execution_block - System::block_number() - 1, starting_alices_balance ), - WEIGHT_EXPECTED + WEIGHT_EXPECTED_2 ); // Now the tokens are issued. @@ -399,7 +402,7 @@ fn is_exempted() { fn do_exempted(signers: &[AccountId]) { let alice = Alice.to_account_id(); - let alice_did = Identity::key_to_identity_dids(alice.clone()); + let alice_did = Identity::get_identity(&alice).expect("Alice missing identity"); let tx = alice_make_bridge_tx(AMOUNT_OVER_LIMIT); let starting_alices_balance = alice_balance(); diff --git a/pallets/runtime/tests/src/committee_test.rs b/pallets/runtime/tests/src/committee_test.rs index db7092408c..936f2dba2c 100644 --- a/pallets/runtime/tests/src/committee_test.rs +++ b/pallets/runtime/tests/src/committee_test.rs @@ -23,7 +23,7 @@ use test_client::AccountKeyring; type Committee = committee::Module; type CommitteeGroup = group::Module; -type System = frame_system::Module; +type System = frame_system::Pallet; type Identity = identity::Module; type Pips = pallet_pips::Module; type Origin = ::Origin; @@ -54,7 +54,10 @@ fn motions_basic_environment_works_we() { } fn make_proposal(value: u64) -> Call { - Call::Identity(identity::Call::accept_primary_key(value, Some(value))) + Call::Identity(identity::Call::accept_primary_key { + rotation_auth_id: value, + optional_cdd_auth_id: Some(value), + }) } const APPROVE_0: &[(PipId, SnapshotResult)] = &[(PipId(0), SnapshotResult::Approve)]; @@ -97,7 +100,9 @@ fn check_scheduled(id: PipId) { } fn enact_snapshot_results_call() -> Call { - Call::Pips(pallet_pips::Call::enact_snapshot_results(APPROVE_0.into())) + Call::Pips(pallet_pips::Call::enact_snapshot_results { + results: APPROVE_0.into(), + }) } fn hash_enact_snapshot_results() -> H256 { @@ -139,11 +144,7 @@ fn single_member_committee_works_we() { let hash = hash_enact_snapshot_results(); let expected_event = EventRecord { phase: Phase::Initialization, - event: EventTest::pallet_committee_Instance1(CommitteeRawEvent::Executed( - alice_did, - hash, - Ok(()), - )), + event: EventTest::PolymeshCommittee(CommitteeRawEvent::Executed(alice_did, hash, Ok(()))), topics: vec![], }; assert_eq!(System::events().contains(&expected_event), true); @@ -301,7 +302,7 @@ fn changing_vote_threshold_works_we() { assert_eq!(Committee::vote_threshold(), (1, 1)); let call_svt = Box::new(Call::PolymeshCommittee( - pallet_committee::Call::set_vote_threshold(4, 17), + pallet_committee::Call::set_vote_threshold { n: 4, d: 17 }, )); assert_ok!(Committee::vote_or_propose( alice_signer, @@ -433,11 +434,7 @@ fn rage_quit_we() { let did = IdentityId::default(); let expected_event = EventRecord { phase: Phase::Initialization, - event: EventTest::pallet_committee_Instance1(CommitteeRawEvent::Executed( - did, - hash, - Ok(()), - )), + event: EventTest::PolymeshCommittee(CommitteeRawEvent::Executed(did, hash, Ok(()))), topics: vec![], }; assert_eq!(System::events().contains(&expected_event), true); @@ -515,7 +512,8 @@ fn release_coordinator_majority_we() { ); // Vote to change RC => bob. - let call = Call::PolymeshCommittee(pallet_committee::Call::set_release_coordinator(bob_id)); + let call = + Call::PolymeshCommittee(pallet_committee::Call::set_release_coordinator { id: bob_id }); assert_ok!(Committee::vote_or_propose( alice.clone(), true, diff --git a/pallets/runtime/tests/src/compliance_manager_test.rs b/pallets/runtime/tests/src/compliance_manager_test.rs index 2b29a290b8..369c87d6f1 100644 --- a/pallets/runtime/tests/src/compliance_manager_test.rs +++ b/pallets/runtime/tests/src/compliance_manager_test.rs @@ -1,8 +1,8 @@ use super::{ asset_test::{allow_all_transfers, create_token}, storage::{ - create_cdd_id, create_investor_uid, provide_scope_claim_to_multiple_parties, set_curr_did, - TestStorage, User, + create_cdd_id, create_investor_uid, get_primary_key, + provide_scope_claim_to_multiple_parties, set_curr_did, TestStorage, User, }, ExtBuilder, }; @@ -30,7 +30,7 @@ use test_client::AccountKeyring; type Identity = identity::Module; type IdError = identity::Error; type Balances = balances::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; type Asset = pallet_asset::Module; type ComplianceManager = compliance_manager::Module; type CDDGroup = group::Module; @@ -544,7 +544,7 @@ fn should_successfully_add_and_use_default_issuers_we() { let (cdd_id, _) = create_cdd_id( receiver.did, Ticker::default(), - create_investor_uid(Identity::did_records(receiver.did).primary_key), + create_investor_uid(get_primary_key(receiver.did)), ); assert_ok!(Identity::add_claim( trusted_issuer.origin(), diff --git a/pallets/runtime/tests/src/contracts_test.rs b/pallets/runtime/tests/src/contracts_test.rs new file mode 100644 index 0000000000..2f241a7726 --- /dev/null +++ b/pallets/runtime/tests/src/contracts_test.rs @@ -0,0 +1,162 @@ +use crate::{ + ext_builder::ExtBuilder, + storage::{TestStorage, User}, +}; +use codec::Encode; +use frame_support::{assert_err_ignore_postinfo, assert_noop, assert_ok, assert_storage_noop}; +use polymesh_common_utilities::constants::currency::POLY; +use polymesh_primitives::{AccountId, Gas, Permissions, PortfolioPermissions, Ticker}; +use polymesh_runtime_common::Currency; +use sp_runtime::traits::Hash; +use std::convert::TryFrom; +use test_client::AccountKeyring; + +// We leave it to tests in the substrate to ensure that `pallet-contracts` +// is functioning correctly, so we do not add such redundant tests +// and instead focus on the particulars of our contracts pallet. +// This includes testing CDD, permissions, and what the chain extension does. + +const GAS_LIMIT: Gas = 10_000_000_000; + +type Asset = pallet_asset::Module; +type FrameContracts = pallet_contracts::Pallet; +type BaseContractsError = pallet_contracts::Error; +type CodeHash = ::Output; +type Hashing = ::Hashing; +type Contracts = polymesh_contracts::Pallet; +type ContractsError = polymesh_contracts::Error; +type MaxInLen = ::MaxInLen; +type Balances = pallet_balances::Pallet; +type Identity = pallet_identity::Module; +type IdentityError = pallet_identity::Error; + +/// Load a given wasm module represented by a .wat file +/// and returns a wasm binary contents along with it's hash. +/// +/// The fixture files are located under the `fixtures/` directory. +fn compile_module(fixture_name: &str) -> wat::Result<(Vec, CodeHash)> { + let fixture_path = ["fixtures/", fixture_name, ".wat"].concat(); + let wasm_binary = wat::parse_file(fixture_path)?; + let code_hash = Hashing::hash(&wasm_binary); + Ok((wasm_binary, code_hash)) +} + +fn chain_extension() -> (Vec, CodeHash) { + compile_module("chain_extension").unwrap() +} + +#[test] +fn misc_polymesh_extensions() { + let eve = AccountKeyring::Eve.to_account_id(); + ExtBuilder::default() + .cdd_providers(vec![eve.clone()]) + .build() + .execute_with(|| { + let owner = User::new(AccountKeyring::Alice); + let user = User::new(AccountKeyring::Bob); + Balances::make_free_balance_be(&owner.acc(), 1_000_000 * POLY); + + let (code, _) = chain_extension(); + let hash = Hashing::hash(&code); + let salt = vec![0xFF]; + + let perms = Permissions { + portfolio: PortfolioPermissions::Whole, + ..Permissions::empty() + }; + let instantiate = || { + Contracts::instantiate_with_code_perms( + owner.origin(), + Balances::minimum_balance(), + GAS_LIMIT, + None, + code.clone(), + vec![], + salt.clone(), + perms.clone(), + ) + }; + let derive_key = |key, salt| FrameContracts::contract_address(&key, &hash, salt); + let call = |key, data| Contracts::call(user.origin(), key, 0, GAS_LIMIT, None, data); + let assert_has_secondary_key = |key: AccountId| { + let data = Identity::get_key_identity_data(key).unwrap(); + assert_eq!(data.identity, owner.did); + assert_eq!(data.permissions.unwrap(), perms); + }; + + // Instantiate contract. + // Next time, a secondary key with that key already exists. + assert_ok!(instantiate()); + assert_noop!(instantiate(), IdentityError::AlreadyLinked); + + // Ensure contract is now a secondary key of Alice. + let key_first_contract = derive_key(owner.acc(), &salt); + assert_has_secondary_key(key_first_contract.clone()); + + // Ensure a call different non-existent instantiation results in "contract not found". + assert_storage_noop!(assert_err_ignore_postinfo!( + call(derive_key(owner.acc(), &[0x00]), vec![]), + BaseContractsError::ContractNotFound, + )); + + // Execute a chain extension with too long data. + let call = |data| call(key_first_contract.clone(), data); + let mut too_long_data = 0x00_00_00_00.encode(); + too_long_data.extend(vec![b'X'; MaxInLen::get() as usize + 1]); + assert_storage_noop!(assert_err_ignore_postinfo!( + call(too_long_data), + ContractsError::InLenTooLarge, + )); + + // Execute a func_id that isn't recognized. + assert_storage_noop!(assert_err_ignore_postinfo!( + call(0x04_00_00_00.encode()), + ContractsError::RuntimeCallNotFound, + )); + + // Input for registering ticker AAAAAAAAAAAA. + let ticker = Ticker::try_from(b"A" as &[u8]).unwrap(); + let mut register_ticker_data = 0x00_01_00_00.encode(); + register_ticker_data.extend(ticker.encode()); + + // Leave too much data left in the input. + let mut register_ticker_extra_data = register_ticker_data.clone(); + register_ticker_extra_data.extend(b"X"); // Adding this leaves too much data. + assert_storage_noop!(assert_err_ignore_postinfo!( + call(register_ticker_extra_data), + ContractsError::DataLeftAfterDecoding, + )); + + // Execute `register_ticker` but fail due to lacking permissions. + assert_storage_noop!(assert_err_ignore_postinfo!( + call(register_ticker_data.clone()), + pallet_permissions::Error::::UnauthorizedCaller, + )); + + // Grant permissions to `key_first_contract`, and so registration should go through. + assert_ok!(Identity::set_secondary_key_permissions( + owner.origin(), + key_first_contract.clone(), + Permissions::default(), + )); + + // Successfully execute `register_ticker`, + // ensuring that it was Alice who registered it. + assert_ok!(call(register_ticker_data)); + assert_ok!(Asset::ensure_owner(&ticker, owner.did)); + + // Prepare instantiation with a different salt. + // Make sure that fails with additional 'X' and then succeeds. + let mut prepare_instantiate_data = 0xFF_00_00_00u32.encode(); + let salt = vec![0xEEu8]; + prepare_instantiate_data.extend((hash, salt.clone(), perms.clone()).encode()); + prepare_instantiate_data.extend(b"X"); + assert_storage_noop!(assert_err_ignore_postinfo!( + call(prepare_instantiate_data.clone()), + ContractsError::DataLeftAfterDecoding, + )); + prepare_instantiate_data.pop().unwrap(); + assert_ok!(call(prepare_instantiate_data)); + assert_has_secondary_key(derive_key(key_first_contract, &salt)); + }) +} diff --git a/pallets/runtime/tests/src/corporate_actions_test.rs b/pallets/runtime/tests/src/corporate_actions_test.rs index e5d52f62cd..626b4b54c0 100644 --- a/pallets/runtime/tests/src/corporate_actions_test.rs +++ b/pallets/runtime/tests/src/corporate_actions_test.rs @@ -36,12 +36,12 @@ use sp_arithmetic::Permill; use std::convert::TryInto; use test_client::AccountKeyring; -type System = frame_system::Module; +type System = frame_system::Pallet; type Origin = ::Origin; type Asset = pallet_asset::Module; type AssetError = pallet_asset::Error; type ExternalAgents = pallet_external_agents::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; type Identity = pallet_identity::Module; type Authorizations = pallet_identity::Authorizations; type ComplianceManager = pallet_compliance_manager::Module; @@ -253,6 +253,7 @@ fn only_caa_authorized() { transfer(&ticker, owner, other); let currency = create_asset(b"BETA", owner); + transfer(¤cy, owner, caa); macro_rules! checks { ($user:expr, $assert:ident $(, $tail:expr)?) => { @@ -301,7 +302,7 @@ fn only_caa_authorized() { // ..., `distribute`, let id = next_ca_id(ticker); $assert!(mk_ca(CAKind::UnpredictableBenefit) $(, $tail)?); - $assert!(Dist::distribute($user.origin(), id, None, currency, 0, 0, 3000, None) $(, $tail)?); + $assert!(Dist::distribute($user.origin(), id, None, currency, 1, 1, 3000, None) $(, $tail)?); // ..., and `remove_distribution`. $assert!(Dist::remove_distribution($user.origin(), id) $(, $tail)?); }; @@ -837,7 +838,7 @@ fn remove_ca_works() { None, currency, 2, - 0, + 2, 3000, None, )); @@ -851,8 +852,8 @@ fn remove_ca_works() { from: PortfolioId::default_portfolio(owner.did), currency, per_share: 2, - amount: 0, - remaining: 0, + amount: 2, + remaining: 2, reclaimed: false, payment_at: 3000, expires_at: None, @@ -1013,8 +1014,8 @@ fn change_record_date_works() { id, None, create_asset(b"BETA", owner), - 0, - 0, + 1, + 2, 5000, None, )); @@ -1756,7 +1757,7 @@ fn dist_distribute_works() { // Test no CA at id. let id = next_ca_id(ticker); assert_noop!( - Dist::distribute(owner.origin(), id, None, currency, 0, 0, 1, None), + Dist::distribute(owner.origin(), id, None, currency, 1, 1, 1, None), Error::NoSuchCA ); @@ -1765,34 +1766,53 @@ fn dist_distribute_works() { Timestamp::set_timestamp(2); let id2 = dist_ca(owner, ticker, Some(2)).unwrap(); - // Test same-asset logic. - assert_noop!( - Dist::distribute(owner.origin(), id2, None, ticker, 0, 0, 0, None), - DistError::DistributingAsset - ); + // Test same-asset. + let id3 = dist_ca(owner, ticker, Some(2)).unwrap(); + assert_ok!(Dist::distribute( + owner.origin(), + id3, + None, + ticker, + 1, + 1, + 5, + None + )); // Test expiry. for &(pay, expiry) in &[(5, 5), (6, 5)] { assert_noop!( - Dist::distribute(owner.origin(), id2, None, currency, 0, 0, pay, Some(expiry)), + Dist::distribute(owner.origin(), id2, None, currency, 1, 1, pay, Some(expiry)), DistError::ExpiryBeforePayment ); } Timestamp::set_timestamp(5); + + // Test `amount == 0`. + assert_noop!( + Dist::distribute(owner.origin(), id2, None, currency, 1, 0, 5, Some(6)), + DistError::DistributionAmountIsZero + ); + // Test `per_share == 0`. + assert_noop!( + Dist::distribute(owner.origin(), id2, None, currency, 0, 1, 5, Some(6)), + DistError::DistributionPerShareIsZero + ); + assert_ok!(Dist::distribute( owner.origin(), id2, None, currency, - 0, - 0, + 1, + 1, 5, Some(6) )); // Distribution already exists. assert_noop!( - Dist::distribute(owner.origin(), id2, None, currency, 0, 0, 5, None), + Dist::distribute(owner.origin(), id2, None, currency, 1, 1, 5, None), DistError::AlreadyExists ); @@ -1802,8 +1822,8 @@ fn dist_distribute_works() { id1, None, currency, - 0, - 0, + 1, + 1, 4, None )); @@ -1812,14 +1832,14 @@ fn dist_distribute_works() { let id = dist_ca(owner, ticker, Some(5)).unwrap(); let num = PortfolioNumber(42); assert_noop!( - Dist::distribute(owner.origin(), id, Some(num), currency, 0, 0, 5, None), + Dist::distribute(owner.origin(), id, Some(num), currency, 1, 1, 5, None), PError::PortfolioDoesNotExist ); // No custody over portfolio. let custody = |who: User| Custodian::insert(PortfolioId::default_portfolio(owner.did), who.did); - let dist = |id| Dist::distribute(owner.origin(), id, None, currency, 0, 0, 6, None); + let dist = |id| Dist::distribute(owner.origin(), id, None, currency, 1, 1, 6, None); custody(other); assert_noop!(dist(id), PError::UnauthorizedCustodian); custody(owner); @@ -1841,7 +1861,7 @@ fn dist_distribute_works() { // Record date after start. let dist = - |id, start| Dist::distribute(owner.origin(), id, None, currency, 0, 0, start, None); + |id, start| Dist::distribute(owner.origin(), id, None, currency, 1, 1, start, None); let id = dist_ca(owner, ticker, Some(5000)).unwrap(); assert_noop!(dist(id, 4999), Error::RecordDateAfterStart); assert_ok!(dist(id, 5000)); @@ -1888,8 +1908,8 @@ fn dist_remove_works() { id, None, create_asset(b"BETA", owner), - 0, - 0, + 1, + 1, 5, Some(6) )); @@ -1926,7 +1946,7 @@ fn dist_reclaim_works() { id, None, currency, - 0, + 1, AMOUNT, 5, Some(6) @@ -1998,8 +2018,8 @@ fn dist_claim_misc_bad() { id, None, create_asset(b"BETA", owner), - 0, - 0, + 1, + 1, 5, Some(6) )); @@ -2028,8 +2048,8 @@ fn dist_claim_not_targeted() { id, None, currency, - 0, - 0, + 1, + 1, 1, None, )); @@ -2070,7 +2090,7 @@ fn dist_claim_works() { CorporateActions::mutate(ticker, id.local_id, |ca| { let ca = ca.as_mut().unwrap(); ca.default_withholding_tax = P25; - ca.withholding_tax = vec![(bar.did, Tax::from_rational_approximation(1u32, 3u32))]; + ca.withholding_tax = vec![(bar.did, Tax::from_rational(1u32, 3u32))]; }); // Ensures that holder cannot claim or be pushed to again. @@ -2202,7 +2222,7 @@ fn dist_claim_no_remaining() { // One has sufficient tokens but we'll claim from the other. // Previously, this would cause `remaining -= benefit` underflow. mk_dist(1_000_000); - let id = mk_dist(0); + let id = mk_dist(1); Timestamp::set_timestamp(5); assert_noop!( diff --git a/pallets/runtime/tests/src/ext_builder.rs b/pallets/runtime/tests/src/ext_builder.rs index 96e964acc6..b4fdcdbdf9 100644 --- a/pallets/runtime/tests/src/ext_builder.rs +++ b/pallets/runtime/tests/src/ext_builder.rs @@ -11,14 +11,31 @@ use polymesh_common_utilities::{ constants::currency::POLY, protocol_fee::ProtocolOp, SystematicIssuers, GC_DID, }; use polymesh_primitives::{ - cdd_id::InvestorUid, identity_id::GenesisIdentityRecord, AccountId, Identity, IdentityId, - PosRatio, Signatory, + cdd_id::InvestorUid, identity_id::GenesisIdentityRecord, AccountId, IdentityId, PosRatio, + SecondaryKey, Signatory, }; use sp_io::TestExternalities; use sp_runtime::{Perbill, Storage}; +use sp_std::prelude::Vec; use sp_std::{cell::RefCell, convert::From, iter}; use test_client::AccountKeyring; +/// Identity information. +#[derive(Default, Clone, PartialEq, Debug)] +pub struct IdentityRecord { + primary_key: AccountId, + secondary_keys: Vec>, +} + +impl IdentityRecord { + pub fn new(primary_key: AccountId, secondary_keys: Vec>) -> Self { + Self { + primary_key, + secondary_keys, + } + } +} + /// A prime number fee to test the split between multiple recipients. pub const PROTOCOL_OP_BASE_FEE: u128 = 41; @@ -106,7 +123,7 @@ pub struct ExtBuilder { governance_committee_members: Vec, governance_committee_vote_threshold: BuilderVoteThreshold, /// Regular users. Their DID will be generated. - regular_users: Vec>, + regular_users: Vec, protocol_base_fees: MockProtocolBaseFees, protocol_coefficient: PosRatio, @@ -209,7 +226,7 @@ impl ExtBuilder { } /// Adds DID to `users` accounts. - pub fn add_regular_users(mut self, users: &[Identity]) -> Self { + pub fn add_regular_users(mut self, users: &[IdentityRecord]) -> Self { self.regular_users.extend_from_slice(users); self } @@ -217,7 +234,10 @@ impl ExtBuilder { pub fn add_regular_users_from_accounts(mut self, accounts: &[AccountId]) -> Self { let identities = accounts .iter() - .map(|acc: &AccountId| Identity::new(acc.clone())) + .map(|acc: &AccountId| IdentityRecord { + primary_key: acc.clone(), + ..Default::default() + }) .collect::>(); self.regular_users.extend(identities); diff --git a/pallets/runtime/tests/src/fee_details.rs b/pallets/runtime/tests/src/fee_details.rs index fd43b9b5a8..4a02a2a7d2 100644 --- a/pallets/runtime/tests/src/fee_details.rs +++ b/pallets/runtime/tests/src/fee_details.rs @@ -10,7 +10,7 @@ use pallet_test_utils as test_utils; use polymesh_common_utilities::traits::transaction_payment::CddAndFeeDetails; use polymesh_common_utilities::Context; use polymesh_primitives::{InvestorUid, Signatory, TransactionError}; -use polymesh_runtime_develop::{fee_details::CddHandler, runtime::Call}; +use polymesh_runtime_develop::runtime::{Call, CddHandler}; use sp_runtime::transaction_validity::InvalidTransaction; use test_client::AccountKeyring; @@ -43,10 +43,10 @@ fn cdd_checks() { // register did bypasses cdd checks assert_eq!( CddHandler::get_valid_payer( - &Call::TestUtils(test_utils::Call::register_did( - InvestorUid::default(), - Default::default() - )), + &Call::TestUtils(test_utils::Call::register_did { + uid: InvestorUid::default(), + secondary_keys: Default::default() + }), &alice_account ), Ok(Some(AccountKeyring::Alice.to_account_id())) @@ -58,7 +58,7 @@ fn cdd_checks() { // normal tx without cdd should fail assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::change_sigs_required(1)), + &Call::MultiSig(multisig::Call::change_sigs_required { sigs_required: 1 }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -70,7 +70,7 @@ fn cdd_checks() { // call to accept being a multisig signer should fail when invalid auth assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key(0)), + &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { auth_id: 0 }), &alice_account ), InvalidTransaction::Custom(TransactionError::InvalidAuthorization as u8) @@ -86,7 +86,9 @@ fn cdd_checks() { let alice_auth_id = get_last_auth_id(&alice_key_signatory); assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key(alice_auth_id)), + &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { + auth_id: alice_auth_id + }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -98,11 +100,11 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should fail if issuer does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - alice_account_signatory.clone(), - alice_auth_id, - true - )), + &Call::Identity(identity::Call::remove_authorization { + target: alice_account_signatory.clone(), + auth_id: alice_auth_id, + _auth_issuer_pays: true + }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -111,11 +113,11 @@ fn cdd_checks() { // call to remove authorisation with caller paying should fail if caller does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - alice_account_signatory.clone(), - alice_auth_id, - false - )), + &Call::Identity(identity::Call::remove_authorization { + target: alice_account_signatory.clone(), + auth_id: alice_auth_id, + _auth_issuer_pays: false + }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -132,11 +134,11 @@ fn cdd_checks() { // call to remove authorisation with caller paying should fail if caller does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - alice_account_signatory.clone(), - alice_auth_id, - false - )), + &Call::Identity(identity::Call::remove_authorization { + target: alice_account_signatory.clone(), + auth_id: alice_auth_id, + _auth_issuer_pays: false + }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -145,11 +147,11 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should succeed as issuer has CDD assert_eq!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - alice_account_signatory, - alice_auth_id, - true - )), + &Call::Identity(identity::Call::remove_authorization { + target: alice_account_signatory, + auth_id: alice_auth_id, + _auth_issuer_pays: true + }), &alice_account ), Ok(Some(AccountKeyring::Charlie.to_account_id())) @@ -169,11 +171,11 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should fail if issuer does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - charlie_account_signatory.clone(), - charlie_auth_id, - true - )), + &Call::Identity(identity::Call::remove_authorization { + target: charlie_account_signatory.clone(), + auth_id: charlie_auth_id, + _auth_issuer_pays: true + }), &charlie_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -182,11 +184,11 @@ fn cdd_checks() { // call to remove authorisation with caller paying should succeed as caller has CDD assert_eq!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization( - charlie_account_signatory, - charlie_auth_id, - false - )), + &Call::Identity(identity::Call::remove_authorization { + target: charlie_account_signatory, + auth_id: charlie_auth_id, + _auth_issuer_pays: false + }), &charlie_account ), Ok(Some(AccountKeyring::Charlie.to_account_id())) @@ -206,7 +208,9 @@ fn cdd_checks() { assert_eq!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key(alice_auth_id)), + &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { + auth_id: alice_auth_id + }), &alice_account ), Ok(Some(AccountKeyring::Charlie.to_account_id())) @@ -215,7 +219,7 @@ fn cdd_checks() { // normal tx with cdd should succeed assert_eq!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::change_sigs_required(1)), + &Call::MultiSig(multisig::Call::change_sigs_required { sigs_required: 1 }), &charlie_account ), Ok(Some(AccountKeyring::Charlie.to_account_id())) diff --git a/pallets/runtime/tests/src/identity_test.rs b/pallets/runtime/tests/src/identity_test.rs index 4a607e3c75..93edf9e206 100644 --- a/pallets/runtime/tests/src/identity_test.rs +++ b/pallets/runtime/tests/src/identity_test.rs @@ -3,25 +3,23 @@ use super::{ committee_test::gc_vmo, ext_builder::PROTOCOL_OP_BASE_FEE, storage::{ - add_secondary_key, add_secondary_key_with_perms, create_cdd_id_and_investor_uid, - get_identity_id, get_last_auth_id, provide_scope_claim, register_keyring_account, + account_from, add_secondary_key, add_secondary_key_with_perms, + create_cdd_id_and_investor_uid, get_identity_id, get_last_auth_id, get_primary_key, + get_secondary_keys, provide_scope_claim, register_keyring_account, register_keyring_account_with_balance, GovernanceCommittee, TestStorage, User, }, ExtBuilder, }; use codec::Encode; use confidential_identity::mocked::make_investor_uid as make_investor_uid_v2; -use core::iter; use frame_support::{ assert_noop, assert_ok, dispatch::DispatchResult, traits::Currency, StorageDoubleMap, - StorageMap, }; use pallet_asset::SecurityToken; use pallet_balances as balances; -use pallet_identity::types::DidRecords as RpcDidRecords; -use pallet_identity::{self as identity, DidRecords}; use polymesh_common_utilities::{ asset::AssetSubTrait, + constants::currency::POLY, protocol_fee::ProtocolOp, traits::{ group::GroupTrait, @@ -33,28 +31,31 @@ use polymesh_common_utilities::{ use polymesh_primitives::{ investor_zkproof_data::v2, AccountId, AssetPermissions, AuthorizationData, AuthorizationType, CddId, Claim, ClaimType, DispatchableName, ExtrinsicPermissions, IdentityClaim, IdentityId, - InvestorUid, PalletName, PalletPermissions, Permissions, PortfolioId, PortfolioNumber, Scope, - SecondaryKey, Signatory, SubsetRestriction, Ticker, TransactionError, + InvestorUid, KeyRecord, PalletName, PalletPermissions, Permissions, PortfolioId, + PortfolioNumber, Scope, SecondaryKey, Signatory, SubsetRestriction, Ticker, TransactionError, }; -use polymesh_runtime_develop::{fee_details::CddHandler, runtime::Call}; +use polymesh_runtime_develop::runtime::{Call, CddHandler}; use sp_core::H512; use sp_runtime::transaction_validity::InvalidTransaction; use std::convert::{From, TryFrom}; use test_client::AccountKeyring; -type AuthorizationsGiven = identity::AuthorizationsGiven; +type AuthorizationsGiven = pallet_identity::AuthorizationsGiven; type Asset = pallet_asset::Module; type Balances = balances::Module; -type Identity = identity::Module; +type Identity = pallet_identity::Module; type MultiSig = pallet_multisig::Module; -type System = frame_system::Module; -type Timestamp = pallet_timestamp::Module; +type System = frame_system::Pallet; +type Timestamp = pallet_timestamp::Pallet; type Origin = ::Origin; type CddServiceProviders = ::CddServiceProviders; type Error = pallet_identity::Error; type PError = pallet_permissions::Error; +const MAX_ASSETS: u64 = 2000; +const MAX_PORTFOLIOS: u64 = 2000; + // Identity Test Helper functions // ======================================= @@ -80,13 +81,6 @@ fn fetch_systematic_cdd(target: IdentityId) -> Option { ) } -fn get_secondary_keys(target: IdentityId) -> Vec> { - match Identity::get_did_records(target) { - RpcDidRecords::Success { secondary_keys, .. } => secondary_keys, - _ => vec![], - } -} - fn target_id_auth(user: User) -> (TargetIdAuthorization, u64) { let expires_at = 100u64; ( @@ -129,15 +123,15 @@ fn only_primary_or_secondary_keys_can_authenticate_as_an_identity() { let charlie = User::new_with(bob.did, AccountKeyring::Charlie); add_secondary_key(bob.did, charlie.acc()); - // Check primary key. `Signatory::Account` + // Check primary key. assert!(Identity::is_key_authorized(alice.did, &alice.acc())); - // Check secondary_keys. `Signatory::Account` + // Check secondary_keys. assert!(Identity::is_key_authorized(bob.did, &charlie.acc())); // Remove charlie's key from the secondary keys of bob. assert_ok!(Identity::remove_secondary_keys( bob.origin(), - vec![charlie.signatory_acc()] + vec![charlie.acc()] )); // Verify the secondary key was removed. @@ -255,7 +249,7 @@ fn only_primary_key_can_add_secondary_key_permissions_with_externalities() { add_secondary_key(alice.did, bob.acc()); let set = |by: User, to: User, perms| { - Identity::set_permission_to_signer(by.origin(), to.signatory_acc(), perms) + Identity::set_secondary_key_permissions(by.origin(), to.acc(), perms) }; // Only `alice` is able to update `bob`'s permissions and `charlie`'s permissions. @@ -300,9 +294,9 @@ fn do_add_permissions_to_multiple_tokens() { .collect(); let test_set_perms = |asset| { - assert_ok!(Identity::set_permission_to_signer( + assert_ok!(Identity::set_secondary_key_permissions( alice.origin(), - bob.signatory_acc(), + bob.acc(), Permissions { asset, ..Default::default() @@ -325,15 +319,15 @@ fn do_add_permissions_to_multiple_tokens() { } #[test] -fn set_permission_to_signer_with_bad_perms() { +fn set_secondary_key_permissions_with_bad_perms() { ExtBuilder::default().build().execute_with(|| { let alice = User::new(AccountKeyring::Alice); let bob = User::new_with(alice.did, AccountKeyring::Bob); add_secondary_key(alice.did, bob.acc()); test_with_bad_perms(alice.did, |perms| { - assert_too_long!(Identity::set_permission_to_signer( + assert_too_long!(Identity::set_secondary_key_permissions( alice.origin(), - bob.signatory_acc(), + bob.acc(), perms, )); }); @@ -378,9 +372,9 @@ fn freeze_secondary_keys_with_externalities() { add_secondary_key(alice.did, dave.acc()); // update permission of frozen keys. - assert_ok!(Identity::set_permission_to_signer( + assert_ok!(Identity::set_secondary_key_permissions( alice.origin(), - bob.signatory_acc(), + bob.acc(), Permissions::default().into(), )); @@ -419,15 +413,12 @@ fn remove_frozen_secondary_keys_with_externalities() { // Remove Bob's key. assert_ok!(Identity::remove_secondary_keys( alice.origin(), - vec![bob.signatory_acc()] + vec![bob.acc()] )); // Check DidRecord. assert_eq!( - Identity::did_records(alice.did).secondary_keys, - vec![SecondaryKey::new( - charlie.signatory_acc(), - Permissions::default() - )] + get_secondary_keys(alice.did), + vec![SecondaryKey::new(charlie.acc(), Permissions::default())] ); } @@ -479,11 +470,11 @@ fn frozen_secondary_keys_cdd_verification_test_we() { // 4. Bob should NOT transfer any amount. SE is simulated. // Balances::transfer_with_memo(Origin::signed(bob), charlie, 1_000, None), let payer = CddHandler::get_valid_payer( - &Call::Balances(balances::Call::transfer_with_memo( - AccountKeyring::Charlie.to_account_id().into(), - 1_000, - None, - )), + &Call::Balances(balances::Call::transfer_with_memo { + dest: AccountKeyring::Charlie.to_account_id().into(), + value: 1_000, + memo: None, + }), &AccountKeyring::Bob.to_account_id(), ); assert_noop!( @@ -597,7 +588,7 @@ fn do_add_secondary_keys_with_permissions_test() { let key_with_auth = SecondaryKeyWithAuth { auth_signature, - secondary_key: SecondaryKey::new(bob.signatory_acc(), permissions).into(), + secondary_key: SecondaryKey::new(bob.acc(), permissions).into(), }; assert_noop!( Identity::add_secondary_keys_with_authorization( @@ -608,7 +599,7 @@ fn do_add_secondary_keys_with_permissions_test() { Error::AlreadyLinked ); - // Check KeyToIdentityIds map + // Check KeyRecords map assert_eq!(Identity::get_identity(&bob.acc()), Some(alice.did)); // Check DidRecords @@ -619,7 +610,7 @@ fn do_add_secondary_keys_with_permissions_test() { TestStorage::set_current_identity(&alice.did); assert_ok!(Identity::remove_secondary_keys( alice.origin(), - vec![bob.signatory_acc()] + vec![bob.acc()] )); // Check DidRecord. @@ -648,7 +639,7 @@ fn do_remove_secondary_keys_test() { let did_of = |u: User| Identity::get_identity(&u.acc()); - // Check KeyToIdentityIds map + // Check KeyRecords map assert_eq!(did_of(bob), Some(alice.did)); assert_eq!(did_of(dave), Some(alice.did)); @@ -658,15 +649,14 @@ fn do_remove_secondary_keys_test() { // Try removing bob using alice. TestStorage::set_current_identity(&alice.did); - let remove_sk = - |u: User| Identity::remove_secondary_keys(alice.origin(), vec![u.signatory_acc()]); + let remove_sk = |u: User| Identity::remove_secondary_keys(alice.origin(), vec![u.acc()]); assert_ok!(remove_sk(bob)); // Try changing the permissions for bob's key. // This should fail. - let result = Identity::set_permission_to_signer( + let result = Identity::set_secondary_key_permissions( alice.origin(), - bob.signatory_acc(), + bob.acc(), Permissions::from_pallet_permissions(vec![PalletPermissions::entire_pallet( b"identity".into(), )]) @@ -717,7 +707,7 @@ fn do_remove_secondary_keys_test_with_externalities() { let charlie = User::new(AccountKeyring::Charlie); let dave_key = AccountKeyring::Dave.to_account_id(); - let musig_address = MultiSig::get_next_multisig_address(alice.acc()); + let ms_address = MultiSig::get_next_multisig_address(alice.acc()); assert_ok!(MultiSig::create_multisig( alice.origin(), @@ -735,82 +725,82 @@ fn do_remove_secondary_keys_test_with_externalities() { add_secondary_key(alice.did, bob.acc()); - add_secondary_key(alice.did, musig_address.clone()); + add_secondary_key(alice.did, ms_address.clone()); // Fund the multisig assert_ok!(Balances::transfer( alice.origin(), - musig_address.clone().into(), - 1 + ms_address.clone().into(), + 2 * POLY )); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), Some(alice.did)); + assert_eq!(Identity::get_identity(&ms_address), Some(alice.did)); assert_eq!(Identity::get_identity(&bob_key), Some(alice.did)); // Try removing bob using charlie TestStorage::set_current_identity(&charlie.did); - assert_ok!(Identity::remove_secondary_keys( - charlie.origin(), - vec![Signatory::Account(bob.acc())] - )); + assert_noop!( + Identity::remove_secondary_keys(charlie.origin(), vec![bob.acc()]), + Error::NotASigner + ); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), Some(alice.did)); + assert_eq!(Identity::get_identity(&ms_address), Some(alice.did)); assert_eq!(Identity::get_identity(&bob_key), Some(alice.did)); // Try remove bob using alice TestStorage::set_current_identity(&alice.did); assert_ok!(Identity::remove_secondary_keys( alice.origin(), - vec![Signatory::Account(bob.acc())] + vec![bob.acc()] )); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), Some(alice.did)); + assert_eq!(Identity::get_identity(&ms_address), Some(alice.did)); assert_eq!(Identity::get_identity(&bob_key), None); // Try removing multisig while it has funds - assert_ok!(Identity::remove_secondary_keys( - alice.origin(), - vec![Signatory::Account(musig_address.clone())] - )); + assert_noop!( + Identity::remove_secondary_keys(alice.origin(), vec![ms_address.clone()]), + Error::MultiSigHasBalance + ); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), Some(alice.did)); + assert_eq!(Identity::get_identity(&ms_address), Some(alice.did)); assert_eq!(Identity::get_identity(&bob_key), None); // Check multisig's signer assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::Account(dave_key.clone())), + MultiSig::ms_signers(ms_address.clone(), Signatory::Account(dave_key.clone())), true ); // Transfer funds back to Alice assert_ok!(Balances::transfer( - Origin::signed(musig_address.clone()), + Origin::signed(ms_address.clone()), alice.acc().into(), - 1 + 2 * POLY )); // Empty multisig's funds and remove as signer assert_ok!(Identity::remove_secondary_keys( alice.origin(), - vec![Signatory::Account(musig_address.clone())] + vec![ms_address.clone()] )); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), None); + assert_eq!(Identity::get_identity(&ms_address), None); assert_eq!(Identity::get_identity(&bob.acc()), None); // Check multisig's signer assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::Account(dave_key)), + MultiSig::ms_signers(ms_address.clone(), Signatory::Account(dave_key)), true ); } @@ -827,10 +817,10 @@ fn leave_identity_test_with_externalities() { let alice = User::new(AccountKeyring::Alice); let bob = User::new_with(alice.did, AccountKeyring::Bob); - let bob_sk = SecondaryKey::new(bob.signatory_acc(), Permissions::empty()); + let bob_sk = SecondaryKey::new(bob.acc(), Permissions::empty()); let dave_key = AccountKeyring::Dave.to_account_id(); - let musig_address = MultiSig::get_next_multisig_address(alice.acc()); + let ms_address = MultiSig::get_next_multisig_address(alice.acc()); assert_ok!(MultiSig::create_multisig( alice.origin(), @@ -849,63 +839,60 @@ fn leave_identity_test_with_externalities() { add_secondary_key_with_perms(alice.did, bob.acc(), Permissions::empty()); // Check DidRecord. - assert_eq!( - Identity::did_records(alice.did).secondary_keys, - vec![bob_sk] - ); + assert_eq!(get_secondary_keys(alice.did), vec![bob_sk]); assert_eq!(Identity::get_identity(&bob.acc()), Some(alice.did)); // Bob leaves assert_ok!(Identity::leave_identity_as_key(bob.origin())); // Check DidRecord. - assert_eq!(Identity::did_records(alice.did).secondary_keys.len(), 0); + assert_eq!(get_secondary_keys(alice.did).len(), 0); assert_eq!(Identity::get_identity(&bob.acc()), None); assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), None); + assert_eq!(Identity::get_identity(&ms_address), None); - add_secondary_key_with_perms(alice.did, musig_address.clone(), Permissions::empty()); + add_secondary_key_with_perms(alice.did, ms_address.clone(), Permissions::empty()); // send funds to multisig assert_ok!(Balances::transfer( alice.origin(), - musig_address.clone().into(), - 1 + ms_address.clone().into(), + 2 * POLY )); // multisig tries leaving identity while it has funds assert_noop!( - Identity::leave_identity_as_key(Origin::signed(musig_address.clone())), + Identity::leave_identity_as_key(Origin::signed(ms_address.clone())), Error::MultiSigHasBalance ); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), Some(alice.did)); + assert_eq!(Identity::get_identity(&ms_address), Some(alice.did)); // Check multisig's signer assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::Account(dave_key.clone())), + MultiSig::ms_signers(ms_address.clone(), Signatory::Account(dave_key.clone())), true ); // send funds back to alice from multisig assert_ok!(Balances::transfer( - Origin::signed(musig_address.clone()), + Origin::signed(ms_address.clone()), alice.acc().into(), - 1 + 2 * POLY )); // Empty multisig's funds and remove as signer assert_ok!(Identity::leave_identity_as_key(Origin::signed( - musig_address.clone() + ms_address.clone() ))); // Check DidRecord. assert_eq!(Identity::get_identity(&dave_key), None); - assert_eq!(Identity::get_identity(&musig_address), None); + assert_eq!(Identity::get_identity(&ms_address), None); // Check multisig's signer assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::Account(dave_key)), + MultiSig::ms_signers(ms_address.clone(), Signatory::Account(dave_key)), true ); } @@ -978,12 +965,8 @@ fn one_step_join_id_with_ext() { assert_ok!(add(a, secondary_keys_with_auth[..2].to_owned())); - let secondary_keys = Identity::did_records(a.did).secondary_keys; - let contains = |u: User| { - secondary_keys - .iter() - .any(|si| si.signer == u.signatory_acc()) - }; + let secondary_keys = get_secondary_keys(a.did); + let contains = |u: User| secondary_keys.iter().any(|si| si.key == u.acc()); assert_eq!(contains(b), true); assert_eq!(contains(c), true); @@ -1003,7 +986,7 @@ fn one_step_join_id_with_ext() { let f = User::new(AccountKeyring::Ferdie); let (ferdie_auth, _) = target_id_auth(a); let ferdie_secondary_key_with_auth = SecondaryKeyWithAuth { - secondary_key: SecondaryKey::from(f.did).into(), + secondary_key: SecondaryKey::from_account_id(f.acc()).into(), auth_signature: H512::from(AccountKeyring::Eve.sign(ferdie_auth.encode().as_slice())), }; @@ -1039,12 +1022,12 @@ crate fn test_with_bad_ext_perms(test: impl Fn(ExtrinsicPermissions)) { crate fn test_with_bad_perms(did: IdentityId, test: impl Fn(Permissions)) { test(Permissions { - asset: SubsetRestriction::elems((0..=max_len() as u64).map(Ticker::generate_into)), + asset: SubsetRestriction::elems((0..=MAX_ASSETS).map(Ticker::generate_into)), ..<_>::default() }); test(Permissions { portfolio: SubsetRestriction::elems( - (0..=max_len() as u64) + (0..=MAX_PORTFOLIOS) .map(|n| PortfolioId::user_portfolio(did, PortfolioNumber::from(n))), ), ..<_>::default() @@ -1061,7 +1044,7 @@ crate fn test_with_bad_perms(did: IdentityId, test: impl Fn(Permissions)) { fn add_secondary_keys_with_authorization_too_many_sks() { ExtBuilder::default().build().execute_with(|| { let user = User::new(AccountKeyring::Alice); - let bob = User::new(AccountKeyring::Bob); + let bob = User::new_with(user.did, AccountKeyring::Bob); let expires_at = 100; let auth = || { @@ -1074,11 +1057,11 @@ fn add_secondary_keys_with_authorization_too_many_sks() { }; // Test various length problems in `Permissions`. - test_with_bad_perms(bob.did, |perms| { + test_with_bad_perms(user.did, |perms| { let auth_encoded = auth(); let auth_signature = H512::from(bob.ring.sign(&auth_encoded)); - let secondary_key = SecondaryKey::new(bob.did.into(), perms).into(); + let secondary_key = SecondaryKey::new(bob.acc(), perms); let auths = vec![SecondaryKeyWithAuth { auth_signature, secondary_key, @@ -1090,18 +1073,16 @@ fn add_secondary_keys_with_authorization_too_many_sks() { )); }); - // Populate with MAX SKs. - DidRecords::::mutate(user.did, |rec| { - let sk = SecondaryKey { - signer: Signatory::Account(rec.primary_key.clone()), - permissions: Permissions::empty(), - }; - rec.secondary_keys = iter::repeat(sk).take(max_len() as usize).collect(); - }); + // Populate with MAX_LEN secondary keys. + let key_record = KeyRecord::SecondaryKey(user.did, Permissions::empty()); + for idx in 0..max_len() { + let key = account_from(idx as u64 + 100); + Identity::add_key_record(&key, key_record.clone()); + } - // Fail at adding the {MAX + 1}th SK. + // No Secondary key limit. let auth_encoded = auth(); - assert_too_long!(Identity::add_secondary_keys_with_authorization( + assert_ok!(Identity::add_secondary_keys_with_authorization( user.origin(), secondary_keys_with_auth(&[bob], &auth_encoded), expires_at @@ -1109,6 +1090,35 @@ fn add_secondary_keys_with_authorization_too_many_sks() { }); } +#[test] +fn secondary_key_with_bad_permissions() { + ExtBuilder::default() + .balance_factor(1_000) + .monied(true) + .cdd_providers(vec![ + AccountKeyring::Eve.to_account_id(), + AccountKeyring::Ferdie.to_account_id(), + ]) + .build() + .execute_with(|| { + let cdd1 = AccountKeyring::Eve.to_account_id(); + let alice = User::new(AccountKeyring::Alice); + let bob = User::new_with(alice.did, AccountKeyring::Bob); + + test_with_bad_perms(bob.did, |perms| { + let bob_sk = SecondaryKey::new(bob.acc(), perms); + assert_noop!( + Identity::cdd_register_did( + Origin::signed(cdd1.clone()), + alice.acc(), + vec![bob_sk] + ), + pallet_base::Error::::TooLong + ); + }); + }); +} + #[test] fn adding_authorizations_bad_perms() { ExtBuilder::default().build().execute_with(|| { @@ -1216,10 +1226,12 @@ fn removing_authorizations() { false, )); assert!(!AuthorizationsGiven::contains_key(alice.did, auth_id)); - assert!(!>::contains_key( - bob.signatory_did(), - auth_id - )); + assert!( + !>::contains_key( + bob.signatory_did(), + auth_id + ) + ); }); } @@ -1237,7 +1249,7 @@ fn changing_primary_key_we() { let bob = User::new(AccountKeyring::Bob); // Primary key matches Alice's key - let alice_pk = || Identity::did_records(alice.did).primary_key; + let alice_pk = || get_primary_key(alice.did); assert_eq!(alice_pk(), alice.acc()); let add = |ring: AccountKeyring| { @@ -1294,7 +1306,7 @@ fn changing_primary_key_with_cdd_auth() { fn changing_primary_key_with_cdd_auth_we() { let alice = User::new(AccountKeyring::Alice); - let alice_pk = || Identity::did_records(alice.did).primary_key; + let alice_pk = || get_primary_key(alice.did); let new = User::new_with(alice.did, AccountKeyring::Bob); let cdd_did = get_identity_id(AccountKeyring::Eve).unwrap(); @@ -1357,7 +1369,7 @@ fn rotating_primary_key_to_secondary_we() { let charlie_origin = Origin::signed(charlie.to_account_id()); // Primary key matches Alice's key - let alice_pk = || Identity::did_records(alice.did).primary_key; + let alice_pk = || get_primary_key(alice.did); assert_eq!(alice_pk(), alice.acc()); let rotate = @@ -1381,7 +1393,7 @@ fn rotating_primary_key_to_secondary_we() { ); assert_ok!(rotate(charlie_origin.clone(), charlie_rotate_auth)); assert_eq!(alice_pk(), charlie.to_account_id()); - assert!(Identity::is_signer(alice.did, &alice.signatory_acc())); + assert!(Identity::is_secondary_key(alice.did, &alice.acc())); let alice_rotate_auth = Identity::add_auth( alice.did, @@ -1391,9 +1403,9 @@ fn rotating_primary_key_to_secondary_we() { ); assert_ok!(rotate(alice.origin(), alice_rotate_auth)); assert_eq!(alice_pk(), alice.acc()); - assert!(Identity::is_signer( + assert!(Identity::is_secondary_key( alice.did, - &Signatory::Account(charlie.to_account_id()) + &charlie.to_account_id() )); } @@ -1408,7 +1420,7 @@ fn rotating_primary_key_to_secondary_with_cdd_auth() { fn rotating_primary_key_to_secondary_with_cdd_auth_we() { let alice = User::new(AccountKeyring::Alice); - let alice_pk = || Identity::did_records(alice.did).primary_key; + let alice_pk = || get_primary_key(alice.did); let charlie = AccountKeyring::Charlie; let charlie_origin = Origin::signed(charlie.to_account_id()); @@ -1519,21 +1531,15 @@ fn cdd_register_did_test_we() { Balances::make_free_balance_be(&charlie, 10_000_000_000); assert_eq!(Identity::has_valid_cdd(charlie_id), true); - assert_eq!( - Identity::did_records(charlie_id).secondary_keys.is_empty(), - true - ); + assert_eq!(get_secondary_keys(charlie_id).is_empty(), true); - let dave_auth_id = get_last_auth_id(&dave_si.signer); + let dave_auth_id = get_last_auth_id(&Signatory::Account(dave_si.key.clone())); assert_ok!(Identity::join_identity_as_key( Origin::signed(dave), dave_auth_id )); - assert_eq!( - Identity::did_records(charlie_id).secondary_keys, - vec![dave_si.clone()] - ); + assert_eq!(get_secondary_keys(charlie_id), vec![dave_si.clone()]); } #[test] @@ -1582,18 +1588,18 @@ fn add_identity_signers() { Error::AlreadyLinked ); - let alice_secondary_keys = Identity::did_records(alice.did).secondary_keys; - let charlie_secondary_keys = Identity::did_records(charlie.did).secondary_keys; + let alice_secondary_keys = get_secondary_keys(alice.did); + let charlie_secondary_keys = get_secondary_keys(charlie.did); let mut dave_sk = SecondaryKey::from_account_id(AccountKeyring::Dave.to_account_id()); // Correct the permissions to ones set by `add_secondary_key`. dave_sk.permissions = Permissions::default(); assert!(alice_secondary_keys .iter() - .find(|si| si.signer == bob.signatory_acc()) + .find(|si| si.key == bob.acc()) .is_some()); assert!(charlie_secondary_keys .iter() - .find(|si| si.signer == bob.signatory_acc()) + .find(|si| si.key == bob.acc()) .is_none()); assert!(alice_secondary_keys .iter() @@ -1850,7 +1856,7 @@ fn add_permission_with_secondary_key() { // Add secondary keys. let sk = |acc: &AccountId| SecondaryKey { - signer: Signatory::Account(acc.clone()), + key: acc.clone(), permissions: Permissions::empty(), }; let sks = vec![sk(&bob_acc), sk(&charlie_acc)]; @@ -1881,7 +1887,7 @@ fn add_permission_with_secondary_key() { )); // check for permissions. - assert_eq!(Identity::did_records(alice_did).secondary_keys, sks); + assert_eq!(get_secondary_keys(alice_did), sks); }); } @@ -2027,7 +2033,7 @@ fn add_investor_uniqueness_claim_v2_data( // Missing CDD id. ( (user_no_cdd_id, scope.clone(), claim.clone(), proof), - Err(Error::ConfidentialScopeClaimNotAllowed.into()), + Err(Error::InvalidCDDId.into()), ), // Invalid ZKProof ( diff --git a/pallets/runtime/tests/src/lib.rs b/pallets/runtime/tests/src/lib.rs index 482b8161ea..38ca847828 100644 --- a/pallets/runtime/tests/src/lib.rs +++ b/pallets/runtime/tests/src/lib.rs @@ -1,69 +1,44 @@ #![allow(dead_code)] #![feature(crate_visibility_modifier)] -#![feature(bool_to_option)] #![feature(assert_matches)] +#![cfg(test)] pub mod storage; pub use storage::{ account_from, add_secondary_key, fast_forward_blocks, fast_forward_to_block, get_identity_id, make_account, make_account_with_balance, make_account_without_cdd, next_block, - register_keyring_account_with_balance, register_keyring_account_without_cdd, TestStorage, + register_keyring_account_with_balance, TestStorage, }; pub mod ext_builder; pub use ext_builder::ExtBuilder; -#[cfg(test)] #[macro_use] mod asset_test; -#[cfg(test)] +mod asset_metadata_test; mod balances_test; -#[cfg(test)] mod bridge; -#[cfg(test)] mod committee_test; -#[cfg(test)] mod compliance_manager_test; -/* -#[cfg(test)] -mod contract_test; -*/ -#[cfg(test)] +//mod contract_test; +mod contracts_test; mod corporate_actions_test; -#[cfg(test)] #[macro_use] mod external_agents_test; -#[cfg(test)] mod fee_details; -#[cfg(test)] mod group_test; -#[cfg(test)] mod identity_test; -#[cfg(test)] mod multisig; -#[cfg(test)] mod pips_test; -#[cfg(test)] mod portfolio; -#[cfg(test)] mod protocol_fee; -#[cfg(test)] mod relayer_test; -#[cfg(test)] mod rewards_test; -#[cfg(test)] mod settlement_test; -#[cfg(test)] mod signed_extra; -#[cfg(test)] mod staking; -#[cfg(test)] -mod statistics_test; -#[cfg(test)] mod sto_test; -#[cfg(test)] mod transaction_payment_test; -#[cfg(test)] +mod transfer_compliance_test; mod treasury_test; -#[cfg(test)] mod utility_test; diff --git a/pallets/runtime/tests/src/multisig.rs b/pallets/runtime/tests/src/multisig.rs index 75ddf1959e..0fb7b12220 100644 --- a/pallets/runtime/tests/src/multisig.rs +++ b/pallets/runtime/tests/src/multisig.rs @@ -1,22 +1,26 @@ use super::{ next_block, - storage::{get_last_auth_id, register_keyring_account, set_curr_did, Call, TestStorage, User}, + storage::{ + add_secondary_key, get_last_auth_id, get_primary_key, get_secondary_keys, + register_keyring_account, set_curr_did, Call, TestStorage, User, + }, ExtBuilder, }; use frame_support::{assert_noop, assert_ok}; use pallet_multisig as multisig; -use polymesh_primitives::{AccountId, Permissions, SecondaryKey, Signatory}; +use polymesh_common_utilities::constants::currency::POLY; +use polymesh_primitives::{AccountId, AuthorizationData, Permissions, SecondaryKey, Signatory}; use test_client::AccountKeyring; type Balances = pallet_balances::Module; type Identity = pallet_identity::Module; type MultiSig = pallet_multisig::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; type Origin = ::Origin; type IdError = pallet_identity::Error; type Error = pallet_multisig::Error; -type System = frame_system::Module; -type Scheduler = pallet_scheduler::Module; +type System = frame_system::Pallet; +type Scheduler = pallet_scheduler::Pallet; #[test] fn create_multisig() { @@ -24,13 +28,13 @@ fn create_multisig() { let alice = User::new(AccountKeyring::Alice); let bob = User::new(AccountKeyring::Bob); - let musig_address = MultiSig::get_next_multisig_address(alice.acc()); + let ms_address = MultiSig::get_next_multisig_address(alice.acc()); let signers = || vec![Signatory::from(alice.did), Signatory::from(bob.did)]; let create = |signers, nsigs| MultiSig::create_multisig(alice.origin(), signers, nsigs); assert_ok!(create(signers(), 1)); - assert_eq!(MultiSig::ms_signs_required(musig_address), 1); + assert_eq!(MultiSig::ms_signs_required(ms_address), 1); assert_noop!(create(vec![], 10), Error::NoSigners); assert_noop!(create(signers(), 0), Error::RequiredSignaturesOutOfBounds); @@ -45,9 +49,13 @@ fn join_multisig() { let alice = Origin::signed(AccountKeyring::Alice.to_account_id()); let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); + let charlie = User::new(AccountKeyring::Charlie); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + // Add dave's key as a secondary key of charlie. + let dave = User::new_with(charlie.did, AccountKeyring::Dave); + add_secondary_key(charlie.did, dave.acc()); + + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -56,12 +64,12 @@ fn join_multisig() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), false ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); @@ -80,11 +88,11 @@ fn join_multisig() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), true ); @@ -99,7 +107,41 @@ fn join_multisig() { set_curr_did(Some(alice_did)); assert_noop!( MultiSig::accept_multisig_signer_as_key(bob.clone(), bob_auth_id2), - Error::SignerAlreadyLinked + Error::SignerAlreadyLinkedToMultisig + ); + + assert_ok!(MultiSig::create_multisig( + alice.clone(), + vec![Signatory::from(alice_did), dave.signatory_acc()], + 1, + )); + + // Testing signer key that is already a secondary key on another identity. + let dave_auth_id = get_last_auth_id(&dave.signatory_acc()); + set_curr_did(Some(alice_did)); + assert_noop!( + MultiSig::accept_multisig_signer_as_key(dave.origin(), dave_auth_id), + Error::SignerAlreadyLinkedToIdentity + ); + + set_curr_did(None); + assert_ok!(MultiSig::create_multisig( + alice.clone(), + vec![Signatory::Account(ms_address.clone())], + 1, + )); + + // Testing that a multisig can't add itself as a signer. + let ms_auth_id = Identity::add_auth( + alice_did, + Signatory::Account(ms_address.clone()), + AuthorizationData::AddMultiSigSigner(ms_address.clone()), + None, + ); + + assert_noop!( + MultiSig::accept_multisig_signer_as_key(Origin::signed(ms_address.clone()), ms_auth_id), + Error::MultisigNotAllowedToLinkToItself ); }); } @@ -112,8 +154,7 @@ fn change_multisig_sigs_required() { let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -137,29 +178,28 @@ fn change_multisig_sigs_required() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer), - true - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required(1))); + let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 1, + })); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_key( bob.clone(), - musig_address.clone(), + ms_address.clone(), call, None, false )); - assert_eq!(MultiSig::ms_signs_required(musig_address.clone()), 2); + assert_eq!(MultiSig::ms_signs_required(ms_address.clone()), 2); - let proposal = (musig_address.clone(), 0); + let proposal = (ms_address.clone(), 0); let proposal_details = MultiSig::proposal_detail(&proposal); assert_eq!( proposal_details.status, @@ -169,11 +209,11 @@ fn change_multisig_sigs_required() { set_curr_did(Some(alice_did)); assert_ok!(MultiSig::approve_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), 0 )); next_block(); - assert_eq!(MultiSig::ms_signs_required(musig_address), 1); + assert_eq!(MultiSig::ms_signs_required(ms_address), 1); }); } @@ -184,8 +224,7 @@ fn create_or_approve_change_multisig_sigs_required() { let alice = Origin::signed(AccountKeyring::Alice.to_account_id()); let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), vec![Signatory::from(alice_did), bob_signer.clone()], @@ -204,32 +243,31 @@ fn create_or_approve_change_multisig_sigs_required() { bob_auth_id )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), - true - ); - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required(1))); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); + let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 1, + })); assert_ok!(MultiSig::create_or_approve_proposal_as_key( bob.clone(), - musig_address.clone(), + ms_address.clone(), call.clone(), None, false )); next_block(); - assert_eq!(MultiSig::ms_signs_required(musig_address.clone()), 2); + assert_eq!(MultiSig::ms_signs_required(ms_address.clone()), 2); assert_ok!(MultiSig::create_or_approve_proposal_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), call, None, false )); next_block(); - assert_eq!(MultiSig::ms_signs_required(musig_address), 1); + assert_eq!(MultiSig::ms_signs_required(ms_address), 1); }); } @@ -242,8 +280,7 @@ fn remove_multisig_signer() { let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -251,7 +288,7 @@ fn remove_multisig_signer() { 1, )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 0); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 0); let alice_auth_id = get_last_auth_id(&alice_signer); @@ -261,7 +298,7 @@ fn remove_multisig_signer() { alice_auth_id )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 1); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 1); let bob_auth_id = get_last_auth_id(&bob_signer); @@ -270,15 +307,15 @@ fn remove_multisig_signer() { bob_auth_id )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 2); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 2); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), alice_signer.clone()), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), true ); @@ -288,15 +325,15 @@ fn remove_multisig_signer() { None ); // No identity as multisig has not been set as a secondary / primary key - assert_eq!(Identity::get_identity(&musig_address), None); + assert_eq!(Identity::get_identity(&ms_address), None); - let call = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer( - bob_signer.clone(), - ))); + let call = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer { + signer: bob_signer.clone(), + })); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), call, None, false @@ -304,17 +341,14 @@ fn remove_multisig_signer() { next_block(); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 1); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 1); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), alice_signer.clone()), true ); - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer), - false - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), false); assert_eq!( Identity::get_identity(&AccountKeyring::Bob.to_account_id()), @@ -323,13 +357,13 @@ fn remove_multisig_signer() { set_curr_did(None); - let remove_alice = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer( - alice_signer.clone(), - ))); + let remove_alice = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer { + signer: alice_signer.clone(), + })); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), remove_alice, None, false @@ -338,10 +372,7 @@ fn remove_multisig_signer() { next_block(); // Alice not removed since that would've broken the multi sig. - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer), - true - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), alice_signer), true); }); } @@ -355,8 +386,7 @@ fn add_multisig_signer() { let charlie = Origin::signed(AccountKeyring::Charlie.to_account_id()); let charlie_signer = Signatory::Account(AccountKeyring::Charlie.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -373,21 +403,21 @@ fn add_multisig_signer() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); - let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer( - bob_signer.clone(), - ))); + let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + signer: bob_signer.clone(), + })); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), call, None, false @@ -395,13 +425,13 @@ fn add_multisig_signer() { next_block(); - let call2 = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer( - charlie_signer.clone(), - ))); + let call2 = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + signer: charlie_signer.clone(), + })); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), + ms_address.clone(), call2, None, false @@ -410,12 +440,12 @@ fn add_multisig_signer() { next_block(); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); @@ -426,7 +456,7 @@ fn add_multisig_signer() { assert_ok!(MultiSig::make_multisig_primary( alice.clone(), - musig_address.clone(), + ms_address.clone(), None )); @@ -436,7 +466,7 @@ fn add_multisig_signer() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), charlie_signer), + MultiSig::ms_signers(ms_address.clone(), charlie_signer), true ); assert!(Identity::change_cdd_requirement_for_mk_rotation(root.clone(), true).is_ok()); @@ -454,10 +484,7 @@ fn add_multisig_signer() { bob_auth_id )); - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer), - true - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); }); } @@ -469,8 +496,7 @@ fn make_multisig_primary() { let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let _bob_did = register_keyring_account(AccountKeyring::Bob).unwrap(); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -479,27 +505,84 @@ fn make_multisig_primary() { )); assert_eq!( - Identity::did_records(alice_did).primary_key, + get_primary_key(alice_did), AccountKeyring::Alice.to_account_id() ); assert_noop!( - MultiSig::make_multisig_primary(bob.clone(), musig_address.clone(), None), + MultiSig::make_multisig_primary(bob.clone(), ms_address.clone(), None), Error::IdentityNotCreator ); assert_ok!(MultiSig::make_multisig_primary( alice.clone(), - musig_address.clone(), + ms_address.clone(), None )); - assert_eq!(Identity::did_records(alice_did).primary_key, musig_address); + assert_eq!(get_primary_key(alice_did), ms_address); }); } #[test] -fn make_multisig_signer() { +fn rotate_multisig_primary_key_with_balance() { + ExtBuilder::default().monied(true).build().execute_with(|| { + let alice = User::new(AccountKeyring::Alice); + let bob = User::new(AccountKeyring::Bob); + let dave_key = AccountKeyring::Dave.to_account_id(); + let charlie_key = AccountKeyring::Charlie.to_account_id(); + + let ms_address = MultiSig::get_next_multisig_address(alice.acc()); + + assert_ok!(MultiSig::create_multisig( + alice.origin(), + vec![Signatory::Account(dave_key)], + 1, + )); + + // Alice's primary key hasn't changed. + assert_eq!(get_primary_key(alice.did), alice.acc()); + + // Bob can't make the MultiSig account his primary key. + assert_noop!( + MultiSig::make_multisig_primary(bob.origin(), ms_address.clone(), None), + Error::IdentityNotCreator + ); + + // Make the MultiSig account Alice's primary key. + assert_ok!(MultiSig::make_multisig_primary( + alice.origin(), + ms_address.clone(), + None + )); + + // Alice's primary key is now the MultiSig. + assert_eq!(get_primary_key(alice.did), ms_address); + + // Fund the MultiSig. + assert_ok!(Balances::transfer( + bob.origin(), + ms_address.clone().into(), + 2 * POLY + )); + + // Add RotatePrimaryKey authorization for charlie_key to become the primary_key for Alice. + let auth_id = Identity::add_auth( + alice.did, + Signatory::Account(charlie_key.clone()), + AuthorizationData::RotatePrimaryKey, + None, + ); + // Fails because the current MultiSig primary_key has a balance. + assert_noop!( + Identity::accept_primary_key(Origin::signed(charlie_key.clone()), auth_id, None), + IdError::MultiSigHasBalance + ); + }); +} + +#[test] +fn make_multisig_secondary_key() { ExtBuilder::default().monied(true).build().execute_with(|| { let alice = User::new(AccountKeyring::Alice); let bob = User::new(AccountKeyring::Bob); @@ -512,17 +595,13 @@ fn make_multisig_signer() { 1, )); // The desired secondary key record. - let musig_secondary = - SecondaryKey::new(Signatory::Account(multisig.clone()), Permissions::empty()); - - let has_ms_sk = || { - Identity::did_records(alice.did) - .secondary_keys - .contains(&musig_secondary) - }; + let multisig_secondary = SecondaryKey::new(multisig.clone(), Permissions::empty()); + + let has_ms_sk = || get_secondary_keys(alice.did).contains(&multisig_secondary); assert!(!has_ms_sk()); - let mk_ms_signer = |u: User| MultiSig::make_multisig_signer(u.origin(), multisig.clone()); + let mk_ms_signer = + |u: User| MultiSig::make_multisig_secondary(u.origin(), multisig.clone()); assert_noop!(mk_ms_signer(bob), Error::IdentityNotCreator); assert_ok!(mk_ms_signer(alice)); @@ -541,8 +620,7 @@ fn remove_multisig_signers_via_creator() { let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -550,7 +628,7 @@ fn remove_multisig_signers_via_creator() { 1, )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 0); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 0); let alice_auth_id = get_last_auth_id(&alice_signer.clone()); @@ -559,7 +637,7 @@ fn remove_multisig_signers_via_creator() { alice_auth_id )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 1); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 1); let bob_auth_id = get_last_auth_id(&bob_signer.clone()); @@ -568,22 +646,22 @@ fn remove_multisig_signers_via_creator() { bob_auth_id )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 2); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 2); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), alice_signer.clone()), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), true ); assert_noop!( MultiSig::remove_multisig_signers_via_creator( bob.clone(), - musig_address.clone(), + ms_address.clone(), vec![bob_signer.clone()] ), Error::IdentityNotCreator @@ -591,36 +669,33 @@ fn remove_multisig_signers_via_creator() { assert_ok!(MultiSig::remove_multisig_signers_via_creator( alice.clone(), - musig_address.clone(), + ms_address.clone(), vec![bob_signer.clone()] )); - assert_eq!(MultiSig::number_of_signers(musig_address.clone()), 1); + assert_eq!(MultiSig::number_of_signers(ms_address.clone()), 1); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), alice_signer.clone()), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); assert_noop!( MultiSig::remove_multisig_signers_via_creator( alice.clone(), - musig_address.clone(), + ms_address.clone(), vec![alice_signer.clone()] ), Error::NotEnoughSigners ); // Alice not removed since that would've broken the multi sig. - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), alice_signer), - true - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), alice_signer), true); }); } @@ -632,8 +707,7 @@ fn add_multisig_signers_via_creator() { let bob = Origin::signed(AccountKeyring::Bob.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -649,18 +723,18 @@ fn add_multisig_signers_via_creator() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); assert_noop!( MultiSig::add_multisig_signers_via_creator( bob.clone(), - musig_address.clone(), + ms_address.clone(), vec![bob_signer.clone()] ), Error::IdentityNotCreator @@ -668,17 +742,17 @@ fn add_multisig_signers_via_creator() { assert_ok!(MultiSig::add_multisig_signers_via_creator( alice.clone(), - musig_address.clone(), + ms_address.clone(), vec![bob_signer.clone()] )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); @@ -689,10 +763,7 @@ fn add_multisig_signers_via_creator() { bob_auth_id )); - assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer), - true - ); + assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); }); } @@ -705,8 +776,7 @@ fn check_for_approval_closure() { let eve = Origin::signed(AccountKeyring::Eve.to_account_id()); let bob_signer = Signatory::Account(AccountKeyring::Bob.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); assert_ok!(MultiSig::create_multisig( alice.clone(), @@ -723,7 +793,7 @@ fn check_for_approval_closure() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(alice_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(alice_did)), true ); @@ -736,35 +806,35 @@ fn check_for_approval_closure() { )); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), Signatory::from(eve_did)), + MultiSig::ms_signers(ms_address.clone(), Signatory::from(eve_did)), true ); assert_eq!( - MultiSig::ms_signers(musig_address.clone(), bob_signer.clone()), + MultiSig::ms_signers(ms_address.clone(), bob_signer.clone()), false ); - let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer( - bob_signer.clone(), - ))); + let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + signer: bob_signer.clone(), + })); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), - call.clone(), + ms_address.clone(), + call, None, false )); next_block(); - let proposal_id = MultiSig::proposal_ids(musig_address.clone(), call).unwrap(); + let proposal_id = MultiSig::ms_tx_done(ms_address.clone()) - 1; let bob_auth_id = get_last_auth_id(&bob_signer.clone()); let multi_purpose_nonce = Identity::multi_purpose_nonce(); set_curr_did(Some(eve_did)); assert_noop!( - MultiSig::approve_as_identity(eve.clone(), musig_address.clone(), proposal_id), + MultiSig::approve_as_identity(eve.clone(), ms_address.clone(), proposal_id), Error::ProposalAlreadyExecuted ); @@ -778,7 +848,7 @@ fn check_for_approval_closure() { after_extra_approval_multi_purpose_nonce ); assert_eq!( - MultiSig::proposal_detail(&(musig_address.clone(), proposal_id)).approvals, + MultiSig::proposal_detail(&(ms_address.clone(), proposal_id)).approvals, 1 ); }); @@ -802,8 +872,7 @@ fn reject_proposals() { let eve_key = AccountKeyring::Eve.to_account_id(); let eve = Origin::signed(AccountKeyring::Eve.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); setup_multisig( alice.clone(), @@ -817,52 +886,55 @@ fn reject_proposals() { ], ); - let call1 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required(4))); - let call2 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required(5))); + let call1 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 4, + })); + let call2 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 5, + })); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), - call1.clone(), + ms_address.clone(), + call1, None, false )); + let proposal_id1 = MultiSig::ms_tx_done(ms_address.clone()) - 1; assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), - call2.clone(), + ms_address.clone(), + call2, None, true )); - - let proposal_id1 = MultiSig::proposal_ids(musig_address.clone(), call1).unwrap(); - let proposal_id2 = MultiSig::proposal_ids(musig_address.clone(), call2).unwrap(); + let proposal_id2 = MultiSig::ms_tx_done(ms_address.clone()) - 1; // Proposal with auto close disabled can be voted on even after rejection. set_curr_did(Some(bob_did)); assert_ok!(MultiSig::reject_as_identity( bob.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id1 )); set_curr_did(Some(charlie_did)); assert_ok!(MultiSig::reject_as_identity( charlie.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id1 )); assert_ok!(MultiSig::reject_as_key( eve.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id1 )); set_curr_did(Some(dave_did)); assert_ok!(MultiSig::approve_as_identity( dave.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id1 )); - let proposal_details1 = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id1)); + let proposal_details1 = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id1)); assert_eq!(proposal_details1.approvals, 2); assert_eq!(proposal_details1.rejections, 3); assert_eq!( @@ -875,27 +947,27 @@ fn reject_proposals() { set_curr_did(Some(bob_did)); assert_ok!(MultiSig::reject_as_identity( bob.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id2 )); set_curr_did(Some(charlie_did)); assert_ok!(MultiSig::reject_as_identity( charlie.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id2 )); assert_ok!(MultiSig::reject_as_key( eve.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id2 )); set_curr_did(Some(dave_did)); assert_noop!( - MultiSig::approve_as_identity(dave.clone(), musig_address.clone(), proposal_id2), + MultiSig::approve_as_identity(dave.clone(), ms_address.clone(), proposal_id2), Error::ProposalAlreadyRejected ); - let proposal_details2 = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id2)); + let proposal_details2 = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id2)); next_block(); assert_eq!(proposal_details2.approvals, 1); assert_eq!(proposal_details2.rejections, 3); @@ -915,8 +987,7 @@ fn expired_proposals() { let charlie_did = register_keyring_account(AccountKeyring::Charlie).unwrap(); let charlie = Origin::signed(AccountKeyring::Charlie.to_account_id()); - let musig_address = - MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); + let ms_address = MultiSig::get_next_multisig_address(AccountKeyring::Alice.to_account_id()); setup_multisig( alice.clone(), @@ -929,19 +1000,21 @@ fn expired_proposals() { ); let expires_at = 100u64; - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required(2))); + let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 2, + })); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), - musig_address.clone(), - call.clone(), + ms_address.clone(), + call, Some(100u64), false )); - let proposal_id = MultiSig::proposal_ids(musig_address.clone(), call).unwrap(); - let mut proposal_details = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id)); + let proposal_id = MultiSig::ms_tx_done(ms_address.clone()) - 1; + let mut proposal_details = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id)); assert_eq!(proposal_details.approvals, 1); assert_eq!( proposal_details.status, @@ -951,11 +1024,11 @@ fn expired_proposals() { set_curr_did(Some(bob_did)); assert_ok!(MultiSig::approve_as_identity( bob.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id )); - proposal_details = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id)); + proposal_details = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id)); assert_eq!(proposal_details.approvals, 2); assert_eq!( proposal_details.status, @@ -966,11 +1039,11 @@ fn expired_proposals() { Timestamp::set_timestamp(expires_at); set_curr_did(Some(charlie_did)); assert_noop!( - MultiSig::approve_as_identity(charlie.clone(), musig_address.clone(), proposal_id), + MultiSig::approve_as_identity(charlie.clone(), ms_address.clone(), proposal_id), Error::ProposalExpired ); - proposal_details = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id)); + proposal_details = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id)); assert_eq!(proposal_details.approvals, 2); assert_eq!( proposal_details.status, @@ -981,11 +1054,11 @@ fn expired_proposals() { Timestamp::set_timestamp(expires_at - 1); assert_ok!(MultiSig::approve_as_identity( charlie.clone(), - musig_address.clone(), + ms_address.clone(), proposal_id )); - proposal_details = MultiSig::proposal_detail(&(musig_address.clone(), proposal_id)); + proposal_details = MultiSig::proposal_detail(&(ms_address.clone(), proposal_id)); assert_eq!(proposal_details.approvals, 3); assert_eq!( proposal_details.status, diff --git a/pallets/runtime/tests/src/pips_test.rs b/pallets/runtime/tests/src/pips_test.rs index f7ee30cbca..6b30f3ce58 100644 --- a/pallets/runtime/tests/src/pips_test.rs +++ b/pallets/runtime/tests/src/pips_test.rs @@ -12,20 +12,20 @@ use frame_support::{ assert_noop, assert_ok, dispatch::{DispatchError, DispatchResult}, traits::{LockableCurrency, WithdrawReasons}, - StorageDoubleMap, StorageMap, StorageValue, + StorageDoubleMap, StorageValue, }; use frame_system::{self, EventRecord}; use pallet_pips::{ DepositInfo, LiveQueue, Pip, PipDescription, PipId, PipsMetadata, ProposalState, Proposer, - RawEvent as Event, SnapshotId, SnapshotMetadata, SnapshotResult, SnapshottedPip, Url, Vote, + RawEvent as Event, SnapshotId, SnapshotMetadata, SnapshotResult, SnapshottedPip, Vote, VoteCount, VotingResult, }; use pallet_treasury as treasury; use polymesh_common_utilities::{MaybeBlock, GC_DID}; -use polymesh_primitives::{AccountId, BlockNumber}; +use polymesh_primitives::{AccountId, BlockNumber, Url}; use test_client::AccountKeyring; -type System = frame_system::Module; +type System = frame_system::Pallet; type Balances = pallet_balances::Module; type Pips = pallet_pips::Module; type Group = pallet_group::Module; @@ -34,7 +34,7 @@ type Treasury = treasury::Module; type Error = pallet_pips::Error; type Deposits = pallet_pips::Deposits; type Votes = pallet_pips::ProposalVotes; -type Scheduler = pallet_scheduler::Module; +type Scheduler = pallet_scheduler::Pallet; type Agenda = pallet_scheduler::Agenda; type Origin = ::Origin; @@ -47,7 +47,7 @@ macro_rules! assert_last_event { assert!(matches!( &*System::events(), [.., EventRecord { - event: EventTest::pallet_pips($event), + event: EventTest::Pips($event), .. }] if $cond @@ -81,7 +81,9 @@ fn spip(id: u32, dir: bool, power: u128) -> SnapshottedPip { } fn make_proposal(value: u64) -> Call { - Call::Pips(pallet_pips::Call::set_min_proposal_deposit(value.into())) + Call::Pips(pallet_pips::Call::set_min_proposal_deposit { + deposit: value.into(), + }) } fn proposal( @@ -952,12 +954,12 @@ fn only_gc_majority_stuff() { assert_ok!(community_proposal(proposer, 0)); assert_eq!(Pips::pip_id_sequence().0, id.0 + 1); assert_eq!(Pips::active_pip_count(), 1); - consensus_call(pallet_pips::Call::reject_proposal(id)); + consensus_call(pallet_pips::Call::reject_proposal { id }); assert_eq!(Pips::pip_id_sequence().0, id.0 + 1); assert_eq!(Pips::active_pip_count(), 0); assert_state(id, false, ProposalState::Rejected); // And now they seek consensus to and do prune. - consensus_call(pallet_pips::Call::prune_proposal(id)); + consensus_call(pallet_pips::Call::prune_proposal { id }); assert_eq!(Pips::proposals(id), None); // Bob & Charlie seek consensus. @@ -967,11 +969,10 @@ fn only_gc_majority_stuff() { let id_snapshot = Pips::pip_id_sequence(); assert_ok!(community_proposal(proposer, 0)); assert_ok!(Pips::snapshot(bob.origin())); - consensus_call(pallet_pips::Call::approve_committee_proposal(id_committee)); - consensus_call(pallet_pips::Call::enact_snapshot_results(vec![( - id_snapshot, - SnapshotResult::Approve, - )])); + consensus_call(pallet_pips::Call::approve_committee_proposal { id: id_committee }); + consensus_call(pallet_pips::Call::enact_snapshot_results { + results: vec![(id_snapshot, SnapshotResult::Approve)], + }); assert_state(id_committee, false, ProposalState::Scheduled); assert_state(id_snapshot, false, ProposalState::Scheduled); }); @@ -1003,8 +1004,8 @@ fn scheduled_proposal(proposer: User, member: User, deposit: u128) -> PipId { vec![(next_id, SnapshotResult::Approve)] )); assert_event_exists!( - EventTest::pallet_scheduler(pallet_scheduler::RawEvent::Scheduled(b, ..)), - *b == System::block_number() + Pips::default_enactment_period() + EventTest::Scheduler(pallet_scheduler::Event::Scheduled { when, .. }), + *when == System::block_number() + Pips::default_enactment_period() ); assert_state(next_id, false, ProposalState::Scheduled); assert_eq!(Pips::active_pip_count(), active); @@ -1028,7 +1029,7 @@ fn failed_community_proposal(proposer: User, member: User, bad_id: PipId) -> Pip assert_ok!(proposal( &proposer.origin(), &Proposer::Community(proposer.acc()), - Call::Pips(pallet_pips::Call::reject_proposal(bad_id)), + Call::Pips(pallet_pips::Call::reject_proposal { id: bad_id }), deposit, None, None @@ -1160,7 +1161,7 @@ fn can_prune_states_that_cannot_be_rejected() { assert_ok!(proposal( &proposer.origin(), &Proposer::Community(proposer.acc()), - Call::Pips(pallet_pips::Call::reject_proposal(PipId(1337))), + Call::Pips(pallet_pips::Call::reject_proposal { id: PipId(1337) }), 300, None, None @@ -1360,7 +1361,7 @@ fn reject_proposal_will_unschedule() { assert_ok!(Pips::reject_proposal(gc_vmo(), id)); assert_eq!(Pips::pip_to_schedule(id), None); assert_event_exists!( - EventTest::pallet_scheduler(pallet_scheduler::RawEvent::Canceled(when, ..)), + EventTest::Scheduler(pallet_scheduler::Event::Canceled { when, .. }), *when == scheduled_at ); }; @@ -1407,7 +1408,7 @@ fn reschedule_execution_only_release_coordinator() { let id = scheduled_proposal(alice, alice, 0); let scheduled_at = Pips::pip_to_schedule(id); consensus_call( - pallet_pips::Call::reschedule_execution(id, None), + pallet_pips::Call::reschedule_execution { id, until: None }, &[&alice.origin(), &bob.origin(), &charlie.origin()], ); assert_eq!(scheduled_at, Pips::pip_to_schedule(id)); @@ -1498,8 +1499,8 @@ fn reschedule_execution_works() { // Regression test for . assert_eq!(Pips::active_pip_count(), 1); // Rescheduling currently works by cancelling + then scheduling again. Verify this. - assert_event_exists!(EventTest::pallet_scheduler( - pallet_scheduler::RawEvent::Canceled(..) + assert_event_exists!(EventTest::Scheduler( + pallet_scheduler::Event::Canceled { .. } )); assert_eq!(Pips::pip_to_schedule(id).unwrap(), next); assert_eq!(Agenda::get(scheduled_at), vec![None]); diff --git a/pallets/runtime/tests/src/portfolio.rs b/pallets/runtime/tests/src/portfolio.rs index 5f5c114224..cbfd631498 100644 --- a/pallets/runtime/tests/src/portfolio.rs +++ b/pallets/runtime/tests/src/portfolio.rs @@ -112,6 +112,22 @@ fn can_create_rename_delete_portfolio() { }); } +#[test] +fn can_delete_recreate_portfolio() { + ExtBuilder::default().build().execute_with(|| { + let (owner, num) = create_portfolio(); + + let name = || Portfolio::portfolios(owner.did, num); + let num_of = |name| Portfolio::name_to_number(owner.did, name); + + let first_name = name(); + assert_eq!(num_of(&first_name), num); + + assert_ok!(Portfolio::delete_portfolio(owner.origin(), num)); + assert_ok!(Portfolio::create_portfolio(owner.origin(), first_name)); + }); +} + #[test] fn cannot_delete_portfolio_with_asset() { ExtBuilder::default().build().execute_with(|| { @@ -136,7 +152,7 @@ fn cannot_delete_portfolio_with_asset() { )); // check MovedBetweenPortfolios event assert_last_event!( - EventTest::pallet_portfolio(Event::MovedBetweenPortfolios( + EventTest::Portfolio(Event::MovedBetweenPortfolios( did, from, to, i_ticker, i_amount, i_memo )), did == &owner.did @@ -301,7 +317,7 @@ fn do_move_asset_from_portfolio(memo: Option) { )); // check MovedBetweenPortfolios event assert_last_event!( - EventTest::pallet_portfolio(Event::MovedBetweenPortfolios( + EventTest::Portfolio(Event::MovedBetweenPortfolios( did, from, to, i_ticker, i_amount, i_memo )), did == &owner.did diff --git a/pallets/runtime/tests/src/relayer_test.rs b/pallets/runtime/tests/src/relayer_test.rs index 9fd10dbae0..9c841623cb 100644 --- a/pallets/runtime/tests/src/relayer_test.rs +++ b/pallets/runtime/tests/src/relayer_test.rs @@ -13,7 +13,7 @@ use polymesh_common_utilities::{ traits::transaction_payment::CddAndFeeDetails, }; use polymesh_primitives::{AccountId, Balance, Signatory, Ticker, TransactionError}; -use polymesh_runtime_develop::{fee_details::CddHandler, runtime::Call as DevCall}; +use polymesh_runtime_develop::runtime::{Call as DevCall, CddHandler}; use sp_runtime::{ traits::{Dispatchable, SignedExtension}, transaction_validity::{InvalidTransaction, TransactionValidityError}, @@ -36,24 +36,25 @@ type Error = pallet_relayer::Error; // ======================================= fn call_balance_transfer(val: Balance) -> ::Call { - Call::Balances(pallet_balances::Call::transfer( - MultiAddress::Id(AccountKeyring::Alice.to_account_id()), - val, - )) + Call::Balances(pallet_balances::Call::transfer { + dest: MultiAddress::Id(AccountKeyring::Alice.to_account_id()), + value: val, + }) } fn call_asset_register_ticker(name: &[u8]) -> ::Call { let ticker = Ticker::try_from(name).unwrap(); - Call::Asset(pallet_asset::Call::register_ticker(ticker)) + Call::Asset(pallet_asset::Call::register_ticker { ticker }) } fn call_relayer_remove_paying_key( user_key: AccountId, paying_key: AccountId, ) -> ::Call { - Call::Relayer(pallet_relayer::Call::remove_paying_key( - user_key, paying_key, - )) + Call::Relayer(pallet_relayer::Call::remove_paying_key { + user_key, + paying_key, + }) } /// create a transaction info struct from weight. Handy to avoid building the whole struct. @@ -433,7 +434,7 @@ fn do_user_remove_paying_key_transaction_fee_test() { // 3. Call `post_dispatch`. assert!(ChargeTransactionPayment::post_dispatch( - pre, + Some(pre), &call_info, &post_info_from_weight(5), len, @@ -523,7 +524,7 @@ fn do_relayer_transaction_and_protocol_fees_test() { // 3. Call `post_dispatch`. assert!(ChargeTransactionPayment::post_dispatch( - pre, + Some(pre), &call_info, &post_info_from_weight(50), len, @@ -550,12 +551,12 @@ fn do_relayer_accept_cdd_and_fees_test() { // Alice creates authoration to subsidise for Bob. assert_ok!(Relayer::set_paying_key(alice.origin(), bob.acc(), 0u128)); - let bob_auth_id = get_last_auth_id(&bob_sign); + let auth_id = get_last_auth_id(&bob_sign); // Check that Bob can accept the subsidy with Alice paying for the transaction. assert_eq!( CddHandler::get_valid_payer( - &DevCall::Relayer(pallet_relayer::Call::accept_paying_key(bob_auth_id)), + &DevCall::Relayer(pallet_relayer::Call::accept_paying_key { auth_id }), &bob.acc() ), Ok(Some(alice.acc())) diff --git a/pallets/runtime/tests/src/settlement_test.rs b/pallets/runtime/tests/src/settlement_test.rs index 6ed16e77f5..cd406c474f 100644 --- a/pallets/runtime/tests/src/settlement_test.rs +++ b/pallets/runtime/tests/src/settlement_test.rs @@ -8,7 +8,7 @@ use super::{ ExtBuilder, }; use codec::Encode; -use frame_support::{assert_noop, assert_ok, IterableStorageDoubleMap, StorageMap}; +use frame_support::{assert_noop, assert_ok, IterableStorageDoubleMap}; use pallet_asset as asset; use pallet_balances as balances; use pallet_compliance_manager as compliance_manager; @@ -38,18 +38,17 @@ type Balances = balances::Module; type Asset = asset::Module; type Portfolio = pallet_portfolio::Module; type PortfolioError = pallet_portfolio::Error; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; type ComplianceManager = compliance_manager::Module; type AssetError = asset::Error; type OffChainSignature = AnySignature; type Origin = ::Origin; type Moment = ::Moment; type BlockNumber = ::BlockNumber; -type DidRecords = identity::DidRecords; type Settlement = pallet_settlement::Module; -type System = frame_system::Module; +type System = frame_system::Pallet; type Error = pallet_settlement::Error; -type Scheduler = scheduler::Module; +type Scheduler = scheduler::Pallet; const TICKER: Ticker = Ticker::new_unchecked([b'A', b'C', b'M', b'E', 0, 0, 0, 0, 0, 0, 0, 0]); const TICKER2: Ticker = Ticker::new_unchecked([b'A', b'C', b'M', b'E', b'2', 0, 0, 0, 0, 0, 0, 0]); diff --git a/pallets/runtime/tests/src/signed_extra.rs b/pallets/runtime/tests/src/signed_extra.rs index 8278f088c3..ec56ae0c97 100644 --- a/pallets/runtime/tests/src/signed_extra.rs +++ b/pallets/runtime/tests/src/signed_extra.rs @@ -17,7 +17,10 @@ use sp_std::convert::From; use test_client::AccountKeyring; pub fn make_call() -> (::Call, usize) { - (Call::System(frame_system::Call::remark(vec![])), 10) + ( + Call::System(frame_system::Call::remark { remark: vec![] }), + 10, + ) } /// Generate a `SignedExtra` value as it is defined in `Runtime`. diff --git a/pallets/runtime/tests/src/staking/mock.rs b/pallets/runtime/tests/src/staking/mock.rs index 69bd4c2a8d..87f60e9c56 100644 --- a/pallets/runtime/tests/src/staking/mock.rs +++ b/pallets/runtime/tests/src/staking/mock.rs @@ -19,13 +19,14 @@ use crate::storage::create_cdd_id; use chrono::prelude::Utc; +use frame_election_provider_support::NposSolution; use frame_support::{ assert_ok, dispatch::DispatchResult, parameter_types, traits::{ - Contains, Currency, FindAuthor, Get, Imbalance, KeyOwnerProofSystem, OnFinalize, - OnInitialize, OnUnbalanced, OneSessionHandler, + Contains, Currency, FindAuthor, GenesisBuild as _, Get, Imbalance, KeyOwnerProofSystem, + OnFinalize, OnInitialize, OnUnbalanced, OneSessionHandler, SortedMembers, }, weights::{constants::RocksDbWeight, DispatchInfo, Weight}, IterableStorageMap, StorageDoubleMap, StorageMap, StorageValue, @@ -54,24 +55,20 @@ use polymesh_primitives::{ }; use sp_core::H256; use sp_npos_elections::{ - reduce, to_support_map, CompactSolution, ElectionScore, EvaluateSupport, ExtendedBalance, - StakedAssignment, + reduce, to_supports, ElectionScore, EvaluateSupport, ExtendedBalance, StakedAssignment, }; use sp_runtime::{ curve::PiecewiseLinear, testing::{Header, TestSignature, TestXt, UintAuthorityId}, - traits::{Convert, IdentityLookup, SaturatedConversion, Zero}, + traits::{IdentityLookup, Zero}, transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, KeyTypeId, Perbill, Permill, }; use sp_staking::{ - offence::{OffenceDetails, OnOffenceHandler}, + offence::{DisableStrategy, OffenceDetails, OnOffenceHandler}, SessionIndex, }; -use std::{ - cell::RefCell, - collections::{BTreeMap, HashSet}, -}; +use std::{cell::RefCell, collections::BTreeMap}; pub const INIT_TIMESTAMP: u64 = 30_000; pub const BLOCK_TIME: u64 = 1000; @@ -82,23 +79,6 @@ pub(crate) type AccountIndex = u64; pub(crate) type BlockNumber = u64; pub(crate) type Balance = u128; -/// Simple structure that exposes how u64 currency can be represented as... u64. -pub struct CurrencyToVoteHandler; -impl Convert for CurrencyToVoteHandler { - fn convert(x: Balance) -> u64 { - x.saturated_into() - } -} -impl Convert for CurrencyToVoteHandler { - fn convert(x: u128) -> Balance { - x - } -} - -thread_local! { - static SESSION: RefCell<(Vec, HashSet)> = RefCell::new(Default::default()); -} - /// Another session handler struct to test on_disabled. pub struct OtherSessionHandler; impl OneSessionHandler for OtherSessionHandler { @@ -111,23 +91,14 @@ impl OneSessionHandler for OtherSessionHandler { { } - fn on_new_session<'a, I: 'a>(_: bool, validators: I, _: I) + fn on_new_session<'a, I: 'a>(_: bool, _: I, _: I) where I: Iterator, AccountId: 'a, { - SESSION.with(|x| { - *x.borrow_mut() = (validators.map(|x| x.0.clone()).collect(), HashSet::new()) - }); } - fn on_disabled(validator_index: usize) { - SESSION.with(|d| { - let mut d = d.borrow_mut(); - let value = d.0[validator_index]; - d.1.insert(value); - }) - } + fn on_disabled(_validator_index: u32) {} } impl sp_runtime::BoundToRuntimeAppPublic for OtherSessionHandler { @@ -136,7 +107,12 @@ impl sp_runtime::BoundToRuntimeAppPublic for OtherSessionHandler { pub fn is_disabled(controller: AccountId) -> bool { let stash = Staking::ledger(&controller).unwrap().stash; - SESSION.with(|d| d.borrow().1.contains(&stash)) + let validator_index = match Session::validators().iter().position(|v| *v == stash) { + Some(index) => index as u32, + None => return false, + }; + + Session::disabled_validators().contains(&validator_index) } type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -148,21 +124,24 @@ frame_support::construct_runtime!( NodeBlock = Block, UncheckedExtrinsic = UncheckedExtrinsic, { - System: frame_system::{Module, Call, Config, Storage, Event}, - Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, - Staking: staking::{Module, Call, Config, Storage, Event, ValidateUnsigned}, - Session: pallet_session::{Module, Call, Storage, Event, Config}, - Identity: pallet_identity::{Module, Call, Storage, Event, Config}, - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config}, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config}, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event}, - Treasury: pallet_treasury::{Module, Call, Event}, - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config}, - Pips: pallet_pips::{Module, Call, Storage, Event, Config}, - TestUtils: pallet_test_utils::{Module, Call, Storage, Event}, - Base: pallet_base::{Module, Call, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Staking: staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned}, + Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + Historical: pallet_session::historical::{Pallet}, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config}, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config}, + Preimage: pallet_preimage::{Pallet, Call, Storage, Event}, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, + Treasury: pallet_treasury::{Pallet, Call, Event}, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config}, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config}, + TestUtils: pallet_test_utils::{Pallet, Call, Storage, Event}, + Base: pallet_base::{Pallet, Call, Event}, } ); @@ -196,7 +175,7 @@ parameter_types! { } impl frame_system::Config for Test { - type BaseCallFilter = (); + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); type DbWeight = RocksDbWeight; @@ -217,7 +196,9 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type OnSetCode = (); type SS58Prefix = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_base::Config for Test { @@ -242,7 +223,6 @@ impl pallet_balances::Config for Test { parameter_types! { pub const UncleGenerations: u64 = 0; - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(25); } sp_runtime::impl_opaque_keys! { pub struct SessionKeys { @@ -257,7 +237,6 @@ impl pallet_session::Config for Test { type Event = Event; type ValidatorId = AccountId; type ValidatorIdOf = StashOf; - type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type NextSessionRotation = pallet_session::PeriodicSessions; type WeightInfo = (); } @@ -344,12 +323,14 @@ impl polymesh_common_utilities::traits::identity::Config for Test { type IdentityFn = identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } parameter_types! { pub const InitialPOLYX: Balance = 0; pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); } impl pallet_scheduler::Config for Test { @@ -361,6 +342,25 @@ impl pallet_scheduler::Config for Test { type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = (); + type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly; + type PreimageProvider = Preimage; + type NoPreimagePostponement = NoPreimagePostponement; +} + +parameter_types! { + pub const PreimageMaxSize: u32 = 4096 * 1024; + pub const PreimageBaseDeposit: Balance = polymesh_runtime_common::deposit(2, 64); + pub const PreimageByteDeposit: Balance = polymesh_runtime_common::deposit(0, 1); +} + +impl pallet_preimage::Config for Test { + type WeightInfo = polymesh_weights::pallet_preimage::WeightInfo; + type Event = Event; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type MaxSize = PreimageMaxSize; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; } impl pallet_test_utils::Config for Test { @@ -466,16 +466,9 @@ impl AssetSubTrait for Test { } impl MultiSigSubTrait for Test { - fn get_key_signers(_multisig: &AccountId) -> Vec { - unimplemented!() - } fn is_multisig(_account: &AccountId) -> bool { unimplemented!() } - fn is_signer(_key: &AccountId) -> bool { - // Allow all keys when mocked - false - } } impl PortfolioSubTrait for Test { @@ -516,6 +509,7 @@ impl polymesh_common_utilities::traits::permissions::Config for Test { parameter_types! { pub const EpochDuration: u64 = 10; pub const ExpectedBlockTime: u64 = 1; + pub const MaxAuthorities: u32 = 100; } impl pallet_babe::Config for Test { @@ -523,6 +517,7 @@ impl pallet_babe::Config for Test { type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type DisabledValidators = Session; type KeyOwnerProofSystem = (); type KeyOwnerProof = >::IdentificationTuple; type HandleEquivocation = pallet_babe::EquivocationHandler; + + type MaxAuthorities = MaxAuthorities; } pallet_staking_reward_curve::build! { @@ -582,12 +579,19 @@ parameter_types! { } impl Contains for TwoThousand { - fn sorted_members() -> std::vec::Vec { - [2000, 3000, 4000, 5000].to_vec() + fn contains(t: &u64) -> bool { + TwoThousand::get() == *t + } +} + +impl SortedMembers for TwoThousand { + fn sorted_members() -> Vec { + vec![TwoThousand::get()] } } impl Config for Test { + const MAX_NOMINATIONS: u32 = pallet_staking::MAX_NOMINATIONS; type Currency = Balances; type UnixTime = Timestamp; type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote; @@ -895,7 +899,7 @@ impl ExtBuilder { ]; } let _ = pallet_staking::GenesisConfig:: { - stakers, + stakers: stakers.clone(), validator_count: self.validator_count, minimum_validator_count: self.minimum_validator_count, invulnerables: self.invulnerables, @@ -906,26 +910,23 @@ impl ExtBuilder { .assimilate_storage(&mut storage); let _ = pallet_session::GenesisConfig:: { - keys: validators - .iter() - .map(|x| { - ( - *x, - *x, - SessionKeys { - other: UintAuthorityId(*x as u64), - }, - ) - }) - .collect(), + keys: if self.has_stakers { + // set the keys for the first session. + stakers + .into_iter() + .map(|(_, id, ..)| (id, id, SessionKeys { other: id.into() })) + .collect() + } else { + // set some dummy validators in genesis. + validators + .into_iter() + .map(|id| (id, id, SessionKeys { other: id.into() })) + .collect() + }, } .assimilate_storage(&mut storage); let mut ext = sp_io::TestExternalities::from(storage); - ext.execute_with(|| { - let validators = Session::validators(); - SESSION.with(|x| *x.borrow_mut() = (validators.clone(), HashSet::new())); - }); if self.initialize_first_session { // We consider all test to start after timestamp is initialized This must be ensured by @@ -961,23 +962,23 @@ pub(crate) fn active_era() -> EraIndex { } pub fn provide_did_to_user(account: AccountId) -> bool { - if >::contains_key(&account) { + if >::contains_key(&account) { return false; } let cdd_account_id = 1005; let cdd = Origin::signed(cdd_account_id); assert!( - >::contains_key(&cdd_account_id), + >::contains_key(&cdd_account_id), "CDD provider account not mapped to identity" ); - let cdd_did = >::get(&cdd_account_id); + let cdd_did = Identity::get_identity(&cdd_account_id).expect("CDD provider missing identity"); assert!( >::contains_key(&cdd_did), "CDD provider identity has no DID record" ); - let cdd_did_record = >::get(&cdd_did); + let cdd_did_record = >::get(&cdd_did).unwrap_or_default(); assert!( - cdd_did_record.primary_key == cdd_account_id, + cdd_did_record.primary_key == Some(cdd_account_id), "CDD identity primary key mismatch" ); assert!( @@ -1015,7 +1016,7 @@ pub fn add_secondary_key(stash_key: AccountId, to_secondary_key: AccountId) { } pub fn get_identity(key: AccountId) -> bool { - >::contains_key(&key) + >::contains_key(&key) } fn check_ledgers() { @@ -1124,6 +1125,11 @@ pub fn bond_validator_with_intended_count( Origin::signed(ctrl), ValidatorPrefs::default() )); + assert_ok!(Session::set_keys( + Origin::signed(ctrl), + SessionKeys { other: ctrl.into() }, + vec![] + )); } pub fn bond(stash: AccountId, ctrl: AccountId, val: Balance) { @@ -1289,7 +1295,12 @@ pub(crate) fn on_offence_in_era( let bonded_eras = staking::BondedEras::get(); for &(bonded_era, start_session) in bonded_eras.iter() { if bonded_era == era { - let _ = Staking::on_offence(offenders, slash_fraction, start_session).unwrap(); + let _ = Staking::on_offence( + offenders, + slash_fraction, + start_session, + DisableStrategy::WhenSlashed, + ); return; } else if bonded_era > era { break; @@ -1301,8 +1312,8 @@ pub(crate) fn on_offence_in_era( offenders, slash_fraction, Staking::eras_start_session_index(era).unwrap(), - ) - .unwrap(); + DisableStrategy::WhenSlashed, + ); } else { panic!("cannot slash in era {}", era); } @@ -1405,14 +1416,10 @@ pub(crate) fn horrible_phragmen_with_post_processing( let score = { let (_, _, better_score) = prepare_submission_with(true, true, 0, |_| {}); - let support = to_support_map::(&winners, &staked_assignment).unwrap(); + let support = to_supports::(&staked_assignment); let score = support.evaluate(); - assert!(sp_npos_elections::is_score_better::( - better_score, - score, - MinSolutionScoreBump::get(), - )); + assert!(better_score.strict_threshold_better(score, MinSolutionScoreBump::get())); score }; @@ -1443,7 +1450,7 @@ pub(crate) fn horrible_phragmen_with_post_processing( >(staked_assignment); let compact = - CompactAssignments::from_assignment(assignments_reduced, nominator_index, validator_index) + CompactAssignments::from_assignment(&assignments_reduced, nominator_index, validator_index) .unwrap(); // winner ids to index @@ -1468,7 +1475,7 @@ pub(crate) fn prepare_submission_with( winners, assignments, } = Staking::do_phragmen::(iterations).unwrap(); - let winners = sp_npos_elections::to_without_backing(winners); + let winners = winners.into_iter().map(|(who, _)| who).collect::>(); let mut staked = sp_npos_elections::assignment_ratio_to_staked( assignments, @@ -1513,15 +1520,14 @@ pub(crate) fn prepare_submission_with( Staking::slashable_balance_of_fn(), ); - let support_map = - to_support_map::(winners.as_slice(), staked.as_slice()).unwrap(); + let support_map = to_supports::(staked.as_slice()); support_map.evaluate() } else { Default::default() }; let compact = - CompactAssignments::from_assignment(assignments_reduced, nominator_index, validator_index) + CompactAssignments::from_assignment(&assignments_reduced, nominator_index, validator_index) .expect("Failed to create compact"); // winner ids to index @@ -1557,7 +1563,7 @@ pub(crate) fn staking_events() -> Vec> { .into_iter() .map(|r| r.event) .filter_map(|e| { - if let Event::staking(inner) = e { + if let Event::Staking(inner) = e { Some(inner) } else { None @@ -1570,6 +1576,10 @@ pub(crate) fn balances(who: &AccountId) -> (Balance, Balance) { (Balances::free_balance(who), Balances::reserved_balance(who)) } +fn get_primary_key(target: IdentityId) -> AccountId { + Identity::get_primary_key(target).unwrap_or_default() +} + pub fn make_account_with_uid( id: AccountId, ) -> Result<(::Origin, IdentityId), &'static str> { @@ -1589,7 +1599,7 @@ pub fn make_account_with_balance( let cdd_providers = Group::get_members(); let did = match cdd_providers.into_iter().nth(0) { Some(cdd_provider) => { - let cdd_acc = Identity::did_records(&cdd_provider).primary_key; + let cdd_acc = get_primary_key(cdd_provider); let _ = Identity::cdd_register_did(Origin::signed(cdd_acc), id, vec![]) .map_err(|_| "CDD register DID failed")?; let did = Identity::get_identity(&id).unwrap(); @@ -1630,7 +1640,7 @@ pub fn add_nominator_claim_with_expiry( } pub fn create_cdd_id_and_investor_uid(identity_id: IdentityId) -> (CddId, InvestorUid) { - let uid = create_investor_uid(Identity::did_records(identity_id).primary_key); + let uid = create_investor_uid(get_primary_key(identity_id)); let (cdd_id, _) = create_cdd_id(identity_id, Ticker::default(), uid); (cdd_id, uid) } diff --git a/pallets/runtime/tests/src/staking/mod.rs b/pallets/runtime/tests/src/staking/mod.rs index 34babfd194..b8088b9abe 100644 --- a/pallets/runtime/tests/src/staking/mod.rs +++ b/pallets/runtime/tests/src/staking/mod.rs @@ -108,12 +108,13 @@ use pallet_staking::*; use sp_npos_elections::ElectionScore; use sp_runtime::{ assert_eq_error_rate, + offchain::storage::MutateStorageError::ValueFunctionFailed, traits::BadOrigin, transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, Perbill, }; use sp_staking::{ - offence::{OffenceDetails, OnOffenceHandler}, + offence::{DisableStrategy, OffenceDetails, OnOffenceHandler}, SessionIndex, }; @@ -337,10 +338,10 @@ fn rewards_should_work() { individual: vec![(11, 100), (21, 50)].into_iter().collect(), } ); - let part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let part_for_20 = Perbill::from_rational_approximation::(1000, 1375); - let part_for_100_from_10 = Perbill::from_rational_approximation::(125, 1125); - let part_for_100_from_20 = Perbill::from_rational_approximation::(375, 1375); + let part_for_10 = Perbill::from_rational::(1000, 1125); + let part_for_20 = Perbill::from_rational::(1000, 1375); + let part_for_100_from_10 = Perbill::from_rational::(125, 1125); + let part_for_100_from_20 = Perbill::from_rational::(375, 1375); start_session(2); start_session(3); @@ -455,6 +456,11 @@ fn staking_should_work() { Origin::signed(4), ValidatorPrefs::default() )); + assert_ok!(Session::set_keys( + Origin::signed(4), + SessionKeys { other: 4.into() }, + vec![] + )); // No effects will be seen so far. assert_eq_uvec!(validator_controllers(), vec![20, 10]); @@ -746,9 +752,9 @@ fn nominators_also_get_slashed_pro_rata() { let slash_amount = slash_percent * exposed_stake; let validator_share = - Perbill::from_rational_approximation(exposed_validator, exposed_stake) * slash_amount; + Perbill::from_rational(exposed_validator, exposed_stake) * slash_amount; let nominator_share = - Perbill::from_rational_approximation(exposed_nominator, exposed_stake) * slash_amount; + Perbill::from_rational(exposed_nominator, exposed_stake) * slash_amount; // both slash amounts need to be positive for the test to make sense. assert!(validator_share > 0); @@ -1965,6 +1971,11 @@ fn switching_roles() { Origin::signed(6), ValidatorPrefs::default() )); + assert_ok!(Session::set_keys( + Origin::signed(6), + SessionKeys { other: 6.into() }, + vec![] + )); mock::start_active_era(1); @@ -1977,6 +1988,11 @@ fn switching_roles() { Origin::signed(2), ValidatorPrefs::default() )); + assert_ok!(Session::set_keys( + Origin::signed(2), + SessionKeys { other: 2.into() }, + vec![] + )); // new stakes: // 10: 1000 self vote // 20: 1000 self vote + 250 vote @@ -2120,6 +2136,11 @@ fn bond_with_little_staked_value_bounded() { Origin::signed(2), ValidatorPrefs::default() )); + assert_ok!(Session::set_keys( + Origin::signed(2), + SessionKeys { other: 2.into() }, + vec![] + )); // 1 era worth of reward. BUT, we set the timestamp after on_initialize, so outdated by // one block. @@ -2302,7 +2323,7 @@ fn reward_from_authorship_event_handler_works() { ExtBuilder::default().build_and_execute(|| { use pallet_authorship::EventHandler; - assert_eq!(>::author(), 11); + assert_eq!(>::author(), Some(11)); >::note_author(11); >::note_uncle(21, 1); @@ -3296,7 +3317,7 @@ mod offchain_phragmen { use parking_lot::RwLock; use sp_core::offchain::{ testing::{PoolState, TestOffchainExt, TestTransactionPoolExt}, - OffchainExt, TransactionPoolExt, + OffchainDbExt, OffchainWorkerExt, TransactionPoolExt, }; use sp_io::TestExternalities; use sp_npos_elections::StakedAssignment; @@ -3338,7 +3359,8 @@ mod offchain_phragmen { seed[0..4].copy_from_slice(&iterations.to_le_bytes()); offchain_state.write().seed = seed; - ext.register_extension(OffchainExt::new(offchain)); + ext.register_extension(OffchainDbExt::new(offchain.clone())); + ext.register_extension(OffchainWorkerExt::new(offchain)); ext.register_extension(TransactionPoolExt::new(pool)); pool_state @@ -4244,6 +4266,7 @@ mod offchain_phragmen { // slash 10. This must happen outside of the election window. let offender_expo = Staking::eras_stakers(Staking::active_era().unwrap().index, 11); + on_offence_now( &[OffenceDetails { offender: (11, offender_expo.clone()), @@ -4257,7 +4280,9 @@ mod offchain_phragmen { assert_ok!(Staking::validate(Origin::signed(10), Default::default())); // open the election window and create snapshots. - run_to_block(32); + // FIXME(Centril, Neopallium): We changed this to 32. + // We're unsure as to why this was necessary and if it was entirely correct. + run_to_block(23); // a solution that has been prepared after the slash. let (compact, winners, score) = prepare_submission_with(true, false, 0, |a| { @@ -4300,7 +4325,7 @@ mod offchain_phragmen { run_to_block(12); let (compact, winners, mut score) = prepare_submission_with(true, true, 2, |_| {}); - score[0] += 1; + score.minimal_stake += 1; assert_noop!( submit_solution(Origin::signed(10), winners, compact, score,), @@ -4358,49 +4383,24 @@ mod offchain_phragmen { // re-execute after the next. not allowed. assert_eq!( offchain_election::set_check_offchain_execution_status::(13), - Err("recently executed."), + Err(ValueFunctionFailed("recently executed.")), ); // a fork like situation -- re-execute 10, 11, 12. But it won't go through. assert_eq!( offchain_election::set_check_offchain_execution_status::(10), - Err("fork."), + Err(ValueFunctionFailed("fork.")), ); assert_eq!( offchain_election::set_check_offchain_execution_status::(11), - Err("fork."), + Err(ValueFunctionFailed("fork.")), ); assert_eq!( offchain_election::set_check_offchain_execution_status::(12), - Err("recently executed."), + Err(ValueFunctionFailed("recently executed.")), ); }) } - - #[test] - #[should_panic] - fn offence_is_blocked_when_window_open() { - ExtBuilder::default() - .offchain_election_ext() - .validator_count(4) - .has_stakers(false) - .build() - .execute_with(|| { - run_to_block(12); - assert_eq!(Staking::era_election_status(), ElectionStatus::Open(12)); - - let offender_expo = Staking::eras_stakers(Staking::active_era().unwrap().index, 10); - - // panic from the impl in mock - on_offence_now( - &[OffenceDetails { - offender: (10, offender_expo.clone()), - reporters: vec![], - }], - &[Perbill::from_percent(10)], - ); - }) - } } #[test] @@ -4480,8 +4480,8 @@ fn claim_reward_at_the_last_era_and_no_double_claim_and_invalid_claim() { let init_balance_10 = Balances::total_balance(&10); let init_balance_100 = Balances::total_balance(&100); - let part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let part_for_100 = Perbill::from_rational_approximation::(125, 1125); + let part_for_10 = Perbill::from_rational::(1000, 1125); + let part_for_100 = Perbill::from_rational::(125, 1125); // Check state Payee::::insert(11, RewardDestination::Controller); @@ -4944,7 +4944,7 @@ fn offences_weight_calculated_correctly() { ExtBuilder::default().nominate(true).build_and_execute(|| { // On offence with zero offenders: 4 Reads, 1 Write let zero_offence_weight = ::DbWeight::get().reads_writes(4, 1); - assert_eq!(Staking::on_offence(&[], &[Perbill::from_percent(50)], 0), Ok(zero_offence_weight)); + assert_eq!(Staking::on_offence(&[], &[Perbill::from_percent(50)], 0, DisableStrategy::WhenSlashed), zero_offence_weight); // On Offence with N offenders, Unapplied: 4 Reads, 1 Write + 4 Reads, 5 Writes let n_offence_unapplied_weight = ::DbWeight::get().reads_writes(4, 1) @@ -4957,7 +4957,7 @@ fn offences_weight_calculated_correctly() { reporters: vec![], } ).collect(); - assert_eq!(Staking::on_offence(&offenders, &[Perbill::from_percent(50)], 0), Ok(n_offence_unapplied_weight)); + assert_eq!(Staking::on_offence(&offenders, &[Perbill::from_percent(50)], 0, DisableStrategy::WhenSlashed), n_offence_unapplied_weight); // On Offence with one offenders, Applied let one_offender = [ @@ -4975,7 +4975,7 @@ fn offences_weight_calculated_correctly() { // `reward_cost` * reporters (1) + ::DbWeight::get().reads_writes(2, 2); - assert_eq!(Staking::on_offence(&one_offender, &[Perbill::from_percent(50)], 0), Ok(one_offence_unapplied_weight)); + assert_eq!(Staking::on_offence(&one_offender, &[Perbill::from_percent(50)], 0, DisableStrategy::WhenSlashed), one_offence_unapplied_weight); }); } @@ -5342,7 +5342,9 @@ fn voting_for_pip_overlays_with_staking() { let alice_proposal = |deposit: u128| { let signer = Origin::signed(alice_acc); - let proposal = Box::new(Call::Pips(pallet_pips::Call::set_min_proposal_deposit(0))); + let proposal = Box::new(Call::Pips(pallet_pips::Call::set_min_proposal_deposit { + deposit: 0, + })); Pips::propose(signer, proposal, deposit, None, None) }; @@ -5371,7 +5373,9 @@ fn slashing_leaves_pips_untouched() { let acc = 11; let propose = |deposit| { let signer = Origin::signed(acc); - let proposal = Box::new(Call::Pips(pallet_pips::Call::set_active_pip_limit(0))); + let proposal = Box::new(Call::Pips(pallet_pips::Call::set_active_pip_limit { + limit: 0, + })); Pips::propose(signer, proposal, deposit, None, None) }; let slash = |amount| { @@ -5519,10 +5523,10 @@ fn test_reward_scheduling() { individual: vec![(11, 100), (21, 50)].into_iter().collect(), } ); - let _part_for_10 = Perbill::from_rational_approximation::(1000, 1125); - let _part_for_20 = Perbill::from_rational_approximation::(1000, 1375); - let part_for_100_from_10 = Perbill::from_rational_approximation::(125, 1125); - let part_for_100_from_20 = Perbill::from_rational_approximation::(375, 1375); + let _part_for_10 = Perbill::from_rational::(1000, 1125); + let _part_for_20 = Perbill::from_rational::(1000, 1375); + let part_for_100_from_10 = Perbill::from_rational::(125, 1125); + let part_for_100_from_20 = Perbill::from_rational::(375, 1375); start_session(2); start_session(3); diff --git a/pallets/runtime/tests/src/statistics_test.rs b/pallets/runtime/tests/src/statistics_test.rs deleted file mode 100644 index b6f1bd6eca..0000000000 --- a/pallets/runtime/tests/src/statistics_test.rs +++ /dev/null @@ -1,329 +0,0 @@ -use super::{ - storage::{add_cdd_claim, add_investor_uniqueness_claim, TestStorage, User}, - ExtBuilder, -}; -use frame_support::{assert_noop, assert_ok}; -use pallet_asset as asset; -use pallet_compliance_manager as compliance_manager; -use pallet_statistics::{self as statistics}; -use polymesh_primitives::{ - asset::AssetType, - statistics::{HashablePermill, TransferManager}, - PortfolioId, Ticker, -}; -use sp_arithmetic::Permill; -use sp_std::convert::TryFrom; -use test_client::AccountKeyring; - -type Origin = ::Origin; -type Asset = asset::Module; -type Statistic = statistics::Module; -type ComplianceManager = compliance_manager::Module; -type Error = statistics::Error; -type AssetError = asset::Error; - -fn create_token(owner: User, disable_iu: bool) -> Ticker { - let token_name = b"ACME"; - let ticker = Ticker::try_from(&token_name[..]).unwrap(); - assert_ok!(Asset::create_asset( - owner.origin(), - token_name.into(), - ticker, - true, - AssetType::default(), - vec![], - None, - disable_iu, - )); - assert_ok!(Asset::issue(owner.origin(), ticker, 1_000_000)); - assert_ok!(ComplianceManager::add_compliance_requirement( - owner.origin(), - ticker, - vec![], - vec![] - )); - ticker -} - -#[track_caller] -fn do_valid_transfer(ticker: Ticker, from: User, to: User, amount: u128) { - assert_ok!(Asset::base_transfer( - PortfolioId::default_portfolio(from.did), - PortfolioId::default_portfolio(to.did), - &ticker, - amount - )); -} - -#[track_caller] -fn ensure_invalid_transfer(ticker: Ticker, from: User, to: User, amount: u128) { - assert_noop!( - Asset::base_transfer( - PortfolioId::default_portfolio(from.did), - PortfolioId::default_portfolio(to.did), - &ticker, - amount - ), - AssetError::InvalidTransfer - ); -} - -#[test] -fn investor_count() { - ExtBuilder::default() - .cdd_providers(vec![AccountKeyring::Eve.to_account_id()]) - .build() - .execute_with(investor_count_with_ext); -} - -fn investor_count_with_ext() { - let cdd_provider = AccountKeyring::Eve.to_account_id(); - let alice = User::new(AccountKeyring::Alice); - let bob = User::new(AccountKeyring::Bob); - let charlie = User::new(AccountKeyring::Charlie); - - // 1. Create an asset with investor uniqueness. - let ticker = create_token(alice, false); - - // Each user needs an investor uniqueness claim. - alice.make_scope_claim(ticker, &cdd_provider); - bob.make_scope_claim(ticker, &cdd_provider); - charlie.make_scope_claim(ticker, &cdd_provider); - - // Alice sends some tokens to Bob. Token has only one investor. - do_valid_transfer(ticker, alice, bob, 500); - assert_eq!(Statistic::investor_count(&ticker), 2); - - // Alice sends some tokens to Charlie. Token has now two investors. - do_valid_transfer(ticker, alice, charlie, 5000); - assert_eq!(Statistic::investor_count(&ticker), 3); - - // Bob sends all his tokens to Charlie, so now we have one investor again. - do_valid_transfer(ticker, bob, charlie, 500); - assert_eq!(Statistic::investor_count(&ticker), 2); -} - -#[test] -fn investor_count_disable_iu() { - ExtBuilder::default() - .cdd_providers(vec![AccountKeyring::Eve.to_account_id()]) - .build() - .execute_with(investor_count_disable_iu_with_ext); -} - -fn investor_count_disable_iu_with_ext() { - let cdd_provider = AccountKeyring::Eve.to_account_id(); - let alice = User::new(AccountKeyring::Alice); - let bob = User::new(AccountKeyring::Bob); - let charlie = User::new(AccountKeyring::Charlie); - - // 1. Create an asset with disabled investor uniqueness. - let ticker = create_token(alice, true); - - // Add CDD claim and create scope_id. - let (scope_id, cdd_id, proof) = - add_cdd_claim(alice.did, ticker, alice.uid(), cdd_provider, None); - // Try adding an investor uniqueness claim. Should fail. - assert_noop!( - add_investor_uniqueness_claim(alice.did, ticker, scope_id, cdd_id, proof), - AssetError::InvestorUniquenessClaimNotAllowed - ); - - // Alice sends some tokens to Bob. Token has only one investor. - do_valid_transfer(ticker, alice, bob, 500); - assert_eq!(Statistic::investor_count(&ticker), 2); - - // Alice sends some tokens to Charlie. Token has now two investors. - do_valid_transfer(ticker, alice, charlie, 5000); - assert_eq!(Statistic::investor_count(&ticker), 3); - - // Bob sends all his tokens to Charlie, so now we have one investor again. - do_valid_transfer(ticker, bob, charlie, 500); - assert_eq!(Statistic::investor_count(&ticker), 2); -} - -#[test] -fn should_add_tm() { - ExtBuilder::default().build().execute_with(|| { - let alice = User::new(AccountKeyring::Alice); - - let ticker = create_token(alice, false); - - let tms = (0..3u64) - .map(TransferManager::CountTransferManager) - .collect::>(); - - let add_tm = |tm| Statistic::add_transfer_manager(alice.origin(), ticker, tm); - assert_ok!(add_tm(tms[0].clone())); - assert_eq!(Statistic::transfer_managers(ticker), [tms[0].clone()]); - - assert_noop!(add_tm(tms[0].clone()), Error::DuplicateTransferManager); - - for tm in &tms[1..3] { - assert_ok!(add_tm(tm.clone())); - } - - assert_eq!(Statistic::transfer_managers(ticker), tms); - - assert_noop!( - add_tm(TransferManager::CountTransferManager(1000000)), - Error::TransferManagersLimitReached - ); - }); -} - -#[test] -fn should_remove_tm() { - ExtBuilder::default().build().execute_with(|| { - let alice = User::new(AccountKeyring::Alice); - - let ticker = create_token(alice, false); - - let mut tms = Vec::new(); - - for i in 0..3u64 { - tms.push(TransferManager::CountTransferManager(i)); - assert_ok!(Statistic::add_transfer_manager( - alice.origin(), - ticker, - tms[i as usize].clone() - )); - assert_eq!(Statistic::transfer_managers(ticker), tms); - } - - for _ in 0..3u64 { - let tm = tms.pop().unwrap(); - assert_ok!(Statistic::remove_transfer_manager( - alice.origin(), - ticker, - tm - )); - assert_eq!(Statistic::transfer_managers(ticker), tms); - } - }); -} - -#[test] -fn should_add_remove_exempted_entities() { - ExtBuilder::default().build().execute_with(|| { - let alice = User::new(AccountKeyring::Alice); - - let ticker = create_token(alice, false); - - let tm = TransferManager::CountTransferManager(1000000); - let assert_exemption = |boolean| { - assert_eq!( - Statistic::entity_exempt((ticker, tm.clone()), alice.did), - boolean - ) - }; - assert_exemption(false); - assert_ok!(Statistic::add_exempted_entities( - alice.origin(), - ticker, - tm.clone(), - vec![alice.did] - )); - assert_exemption(true); - assert_ok!(Statistic::remove_exempted_entities( - alice.origin(), - ticker, - tm.clone(), - vec![alice.did] - )); - assert_exemption(false); - }); -} - -#[test] -fn should_verify_tms() { - ExtBuilder::default() - .cdd_providers(vec![AccountKeyring::Eve.to_account_id()]) - .build() - .execute_with(|| { - let cdd_provider = AccountKeyring::Eve.to_account_id(); - let ticker = Ticker::try_from(&b"ACME"[..]).unwrap(); - let setup_account = |keyring: AccountKeyring| { - let user = User::new(keyring); - let (scope, _) = user.make_scope_claim(ticker, &cdd_provider); - (user, scope) - }; - let (alice, alice_scope) = setup_account(AccountKeyring::Alice); - let (bob, _) = setup_account(AccountKeyring::Bob); - let (charlie, charlie_scope) = setup_account(AccountKeyring::Charlie); - let (dave, dave_scope) = setup_account(AccountKeyring::Dave); - - let ticker = create_token(alice, false); - - assert_eq!(Statistic::investor_count(&ticker), 1); - - // No TM attached, transfer should be valid - do_valid_transfer(ticker, alice, bob, 10); - assert_eq!(Statistic::investor_count(&ticker), 2); - let add_tm = |tm| Statistic::add_transfer_manager(alice.origin(), ticker, tm); - let add_ctm = |limit| { - add_tm(TransferManager::CountTransferManager(limit)).expect("Failed to add CTM") - }; - // Count TM attached with max investors limit reached already - add_ctm(2); - // Transfer that increases the investor count beyond the limit should fail - ensure_invalid_transfer(ticker, bob, charlie, 5); - // Transfer that keeps the investor count the same should succeed - do_valid_transfer(ticker, bob, alice, 1); - - let add_exemption = |tm, scopes| { - assert_ok!(Statistic::add_exempted_entities( - alice.origin(), - ticker, - tm, - scopes - )); - }; - - // Add some folks to the exemption list - add_exemption( - TransferManager::CountTransferManager(2), - vec![alice_scope, dave_scope], - ); - // Transfer should fail when receiver is exempted but not sender for CTM - ensure_invalid_transfer(ticker, bob, dave, 5); - // Transfer should succeed since sender is exempted - do_valid_transfer(ticker, alice, charlie, 5); - - // Bump CTM to 10 - assert_ok!(Statistic::remove_transfer_manager( - alice.origin(), - ticker, - TransferManager::CountTransferManager(2) - )); - add_ctm(10); - - let ptm25 = TransferManager::PercentageTransferManager(HashablePermill( - Permill::from_rational_approximation(1u32, 4u32), - )); - // Add ptm with max ownership limit of 50% - assert_ok!(add_tm(ptm25.clone())); - // Transfer should fail when receiver is breaching the limit - ensure_invalid_transfer(ticker, alice, dave, 250_001); - // Transfer should succeed when under limit - do_valid_transfer(ticker, alice, dave, 250_000); - // Transfer should fail when receiver is breaching the limit - ensure_invalid_transfer(ticker, alice, dave, 1); - - // Add charlie to exemption list - add_exemption(ptm25, vec![charlie_scope]); - // Transfer should succeed since receiver is exempted - do_valid_transfer(ticker, alice, charlie, 250_001); - - // Advanced scenario where charlie is limited at 30% but others at 25% - assert_ok!(add_tm(TransferManager::PercentageTransferManager( - HashablePermill(Permill::from_rational_approximation(3u32, 10u32)) - ))); - // Transfer should fail when dave is breaching the default limit - ensure_invalid_transfer(ticker, alice, dave, 1); - // Transfer should fail when charlie is breaching the advanced limit - ensure_invalid_transfer(ticker, alice, charlie, 50_000); - // Transfer should succeed when charlie under advanced limit - do_valid_transfer(ticker, alice, charlie, 25_000); - }); -} diff --git a/pallets/runtime/tests/src/sto_test.rs b/pallets/runtime/tests/src/sto_test.rs index 2594bc7e1c..c1819ea1b9 100644 --- a/pallets/runtime/tests/src/sto_test.rs +++ b/pallets/runtime/tests/src/sto_test.rs @@ -1,5 +1,6 @@ use super::{ asset_test::{allow_all_transfers, max_len_bytes}, + exec_noop, exec_ok, storage::{make_account_with_portfolio, TestStorage, User}, ExtBuilder, }; @@ -20,13 +21,13 @@ use test_client::AccountKeyring; type Origin = ::Origin; type Asset = asset::Module; -type STO = pallet_sto::Module; +type Sto = pallet_sto::Module; type Error = pallet_sto::Error; type EAError = pallet_external_agents::Error; type PortfolioError = pallet_portfolio::Error; type ComplianceManager = compliance_manager::Module; type Settlement = pallet_settlement::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; #[track_caller] fn test(logic: impl FnOnce()) { @@ -150,7 +151,7 @@ fn raise_happy_path() { // Register a venue let venue_counter = Settlement::venue_counter(); let instruction_id = Settlement::instruction_counter(); - assert_ok!(Settlement::create_venue( + exec_ok!(Settlement::create_venue( alice.origin(), VenueDetails::default(), vec![AccountKeyring::Alice.to_account_id()], @@ -164,9 +165,9 @@ fn raise_happy_path() { let bob_init_raise = Asset::balance_of(&raise_ticker, bob.did); // Alice starts a fundraiser - let fundraiser_id = STO::fundraiser_count(offering_ticker); + let fundraiser_id = Sto::fundraiser_count(offering_ticker); let fundraiser_name: FundraiserName = max_len_bytes(0); - assert_ok!(STO::create_fundraiser( + exec_ok!(Sto::create_fundraiser( alice.origin(), alice_portfolio, offering_ticker, @@ -174,18 +175,18 @@ fn raise_happy_path() { raise_ticker, vec![PriceTier { total: 1_000_000u128, - price: 1_000_000u128 + price: 1_000_000u128, }], venue_counter, None, None, 2, - fundraiser_name.clone() + fundraiser_name.clone(), )); let check_fundraiser = |remaining| { assert_eq!( - STO::fundraisers(offering_ticker, fundraiser_id), + Sto::fundraisers(offering_ticker, fundraiser_id), Some(Fundraiser { creator: alice.did, offering_portfolio: alice_portfolio, @@ -222,38 +223,45 @@ fn raise_happy_path() { ); assert_eq!(Asset::balance_of(&raise_ticker, bob.did), bob_init_raise); assert_eq!( - STO::fundraiser_name(offering_ticker, fundraiser_id), + Sto::fundraiser_name(offering_ticker, fundraiser_id), fundraiser_name ); - let sto_invest = |purchase_amount, max_price| { - STO::invest( - bob.origin(), - bob_portfolio, - bob_portfolio, - offering_ticker, - fundraiser_id, - purchase_amount, - max_price, - None, - ) + let sto_invest = |purchase_amount, max_price, err: Error| { + exec_noop!( + Sto::invest( + bob.origin(), + bob_portfolio, + bob_portfolio, + offering_ticker, + fundraiser_id, + purchase_amount, + max_price, + None, + ), + err + ); }; // Investment fails if the minimum investment amount is not met - assert_noop!( - sto_invest(1, Some(1_000_000u128)), - Error::InvestmentAmountTooLow - ); + sto_invest(1, Some(1_000_000u128), Error::InvestmentAmountTooLow); // Investment fails if the order is not filled - assert_noop!( - sto_invest(1_000_001u128, Some(1_000_000u128)), - Error::InsufficientTokensRemaining + sto_invest( + 1_000_001u128, + Some(1_000_000u128), + Error::InsufficientTokensRemaining, ); // Investment fails if the maximum price is breached - assert_noop!( - sto_invest(amount.into(), Some(999_999u128)), - Error::MaxPriceExceeded - ); + sto_invest(amount.into(), Some(999_999u128), Error::MaxPriceExceeded); // Bob invests in Alice's fundraiser - assert_ok!(sto_invest(amount.into(), Some(1_000_000u128))); + exec_ok!(Sto::invest( + bob.origin(), + bob_portfolio, + bob_portfolio, + offering_ticker, + fundraiser_id, + amount.into(), + Some(1_000_000u128), + None, + )); check_fundraiser(1_000_000u128 - amount); assert_eq!( Some(Settlement::instruction_counter()), @@ -295,7 +303,7 @@ fn raise_unhappy_path() { provide_scope_claim_to_multiple_parties(&[alice.did, bob.did], raise_ticker, eve); let fundraise = |tiers, venue, name| { - STO::create_fundraiser( + Sto::create_fundraiser( alice.origin(), alice_portfolio, offering_ticker, @@ -401,7 +409,7 @@ fn raise_unhappy_path() { // Invalid time window assert_noop!( - STO::create_fundraiser( + Sto::create_fundraiser( alice.origin(), alice_portfolio, offering_ticker, @@ -448,9 +456,9 @@ fn zero_price_sto() { let bob_init_balance = Asset::balance_of(&ticker, bob.did); // Alice starts a fundraiser - let fundraiser_id = STO::fundraiser_count(ticker); + let fundraiser_id = Sto::fundraiser_count(ticker); let fundraiser_name = FundraiserName::from(vec![1]); - assert_ok!(STO::create_fundraiser( + assert_ok!(Sto::create_fundraiser( alice.origin(), alice_portfolio, ticker, @@ -471,7 +479,7 @@ fn zero_price_sto() { assert_eq!(Asset::balance_of(&ticker, bob.did), bob_init_balance); // Bob invests in Alice's zero price sto - assert_ok!(STO::invest( + assert_ok!(Sto::invest( bob.origin(), bob_portfolio, bob_portfolio, @@ -510,7 +518,7 @@ fn invalid_fundraiser() { )); let create_fundraiser_fn = |tiers| { - STO::create_fundraiser( + Sto::create_fundraiser( alice.origin(), alice_portfolio, offering_ticker, @@ -571,8 +579,8 @@ fn basic_fundraiser() -> (FundraiserId, RaiseContext) { vec![AccountKeyring::Alice.to_account_id()], VenueType::Sto )); - let fundraiser_id = STO::fundraiser_count(context.offering_ticker); - assert_ok!(STO::create_fundraiser( + let fundraiser_id = Sto::fundraiser_count(context.offering_ticker); + assert_ok!(Sto::create_fundraiser( context.alice.origin(), context.alice_portfolio, context.offering_ticker, @@ -600,7 +608,7 @@ fn fundraiser_expired() { }, ) = basic_fundraiser(); - assert_ok!(STO::modify_fundraiser_window( + assert_ok!(Sto::modify_fundraiser_window( alice.origin(), offering_ticker, fundraiser_id, @@ -611,7 +619,7 @@ fn fundraiser_expired() { Timestamp::set_timestamp(Timestamp::get() + 2); assert_noop!( - STO::modify_fundraiser_window( + Sto::modify_fundraiser_window( alice.origin(), offering_ticker, fundraiser_id, @@ -622,7 +630,7 @@ fn fundraiser_expired() { ); assert_noop!( - STO::invest( + Sto::invest( bob.origin(), bob_portfolio, bob_portfolio, @@ -649,7 +657,7 @@ fn modifying_fundraiser_window() { // Wrong ticker assert_noop!( - STO::modify_fundraiser_window( + Sto::modify_fundraiser_window( alice.origin(), raise_ticker.unwrap(), fundraiser_id, @@ -661,7 +669,7 @@ fn modifying_fundraiser_window() { // Bad fundraiser id assert_noop!( - STO::modify_fundraiser_window( + Sto::modify_fundraiser_window( alice.origin(), offering_ticker, FundraiserId(u64::MAX), @@ -672,7 +680,7 @@ fn modifying_fundraiser_window() { ); let bad_modify_fundraiser_window = |start, end| { - STO::modify_fundraiser_window(alice.origin(), offering_ticker, fundraiser_id, start, end) + Sto::modify_fundraiser_window(alice.origin(), offering_ticker, fundraiser_id, start, end) }; assert_ok!(bad_modify_fundraiser_window(0, None)); @@ -704,23 +712,23 @@ fn freeze_unfreeze_fundraiser() { // Wrong ticker assert_noop!( - STO::freeze_fundraiser(alice.origin(), raise_ticker.unwrap(), fundraiser_id,), + Sto::freeze_fundraiser(alice.origin(), raise_ticker.unwrap(), fundraiser_id,), Error::FundraiserNotFound ); // Bad fundraiser id assert_noop!( - STO::freeze_fundraiser(alice.origin(), offering_ticker, FundraiserId(u64::MAX)), + Sto::freeze_fundraiser(alice.origin(), offering_ticker, FundraiserId(u64::MAX)), Error::FundraiserNotFound ); - assert_ok!(STO::freeze_fundraiser( + assert_ok!(Sto::freeze_fundraiser( alice.origin(), offering_ticker, fundraiser_id, )); - assert_ok!(STO::unfreeze_fundraiser( + assert_ok!(Sto::unfreeze_fundraiser( alice.origin(), offering_ticker, fundraiser_id, @@ -741,26 +749,26 @@ fn stop_fundraiser() { // Wrong ticker assert_noop!( - STO::stop(alice.origin(), raise_ticker.unwrap(), fundraiser_id,), + Sto::stop(alice.origin(), raise_ticker.unwrap(), fundraiser_id,), Error::FundraiserNotFound ); // Bad fundraiser id assert_noop!( - STO::stop(alice.origin(), offering_ticker, FundraiserId(u64::MAX)), + Sto::stop(alice.origin(), offering_ticker, FundraiserId(u64::MAX)), Error::FundraiserNotFound ); // Unauthorized assert_noop!( - STO::stop(bob.origin(), offering_ticker, fundraiser_id), + Sto::stop(bob.origin(), offering_ticker, fundraiser_id), EAError::UnauthorizedAgent ); - assert_ok!(STO::stop(alice.origin(), offering_ticker, fundraiser_id,)); + assert_ok!(Sto::stop(alice.origin(), offering_ticker, fundraiser_id,)); assert_noop!( - STO::stop(alice.origin(), offering_ticker, fundraiser_id,), + Sto::stop(alice.origin(), offering_ticker, fundraiser_id,), Error::FundraiserClosed ); } diff --git a/pallets/runtime/tests/src/storage.rs b/pallets/runtime/tests/src/storage.rs index ac93c61ecb..73c8ee7093 100644 --- a/pallets/runtime/tests/src/storage.rs +++ b/pallets/runtime/tests/src/storage.rs @@ -4,17 +4,18 @@ use super::ext_builder::{ }; use codec::Encode; use frame_support::{ - assert_ok, debug, + assert_ok, dispatch::DispatchResult, parameter_types, - traits::{Currency, Imbalance, KeyOwnerProofSystem, OnInitialize, OnUnbalanced, Randomness}, + traits::{Currency, Imbalance, KeyOwnerProofSystem, OnInitialize, OnUnbalanced}, weights::{ DispatchInfo, RuntimeDbWeight, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, StorageDoubleMap, }; -use frame_system::EnsureRoot; +use frame_system::{EnsureRoot, RawOrigin}; +use lazy_static::lazy_static; use pallet_asset::checkpoint as pallet_checkpoint; use pallet_balances as balances; use pallet_committee as committee; @@ -42,18 +43,20 @@ use polymesh_common_utilities::{ use polymesh_primitives::{ investor_zkproof_data::v1::InvestorZKProofData, AccountId, Authorization, AuthorizationData, BlockNumber, CddId, Claim, InvestorUid, Moment, Permissions as AuthPermissions, - PortfolioNumber, Scope, ScopeId, TrustedFor, TrustedIssuer, + PortfolioNumber, Scope, ScopeId, SecondaryKey, TrustedFor, TrustedIssuer, }; -use polymesh_runtime_common::{merge_active_and_inactive, runtime::VMO}; -use polymesh_runtime_develop::constants::time::{ - EPOCH_DURATION_IN_BLOCKS, EPOCH_DURATION_IN_SLOTS, MILLISECS_PER_BLOCK, +use polymesh_runtime_common::{ + merge_active_and_inactive, + runtime::{BENCHMARK_MAX_INCREASE, VMO}, }; +use polymesh_runtime_develop::constants::time::{EPOCH_DURATION_IN_BLOCKS, MILLISECS_PER_BLOCK}; use smallvec::smallvec; use sp_core::{ crypto::{key_types, Pair as PairTrait}, sr25519::Pair, H256, }; +use sp_runtime::generic::Era; use sp_runtime::{ create_runtime_str, curve::PiecewiseLinear, @@ -75,8 +78,41 @@ use std::cell::RefCell; use std::convert::From; use test_client::AccountKeyring; +lazy_static! { + pub static ref INTEGRATION_TEST: bool = std::env::var("INTEGRATION_TEST") + .map(|var| var.parse().unwrap_or(false)) + .unwrap_or(false); +} + +#[macro_export] +macro_rules! exec_ok { + ( $x:expr $(,)? ) => { + frame_support::assert_ok!(polymesh_exec_macro::exec!($x)) + }; + ( $x:expr, $y:expr $(,)? ) => { + frame_support::assert_ok!(polymesh_exec_macro::exec!($x), $y) + }; +} + +#[macro_export] +macro_rules! exec_noop { + ( + $x:expr, + $y:expr $(,)? + ) => { + // Use `assert_err` when running with `INTEGRATION_TEST`. + // `assert_noop` returns false positives when using full extrinsic execution. + if *crate::storage::INTEGRATION_TEST { + frame_support::assert_err!(polymesh_exec_macro::exec!($x), $y); + } else { + frame_support::assert_noop!(polymesh_exec_macro::exec!($x), $y); + } + }; +} + // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); +const GENESIS_HASH: [u8; 32] = [69u8; 32]; pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("test-storage"), impl_name: create_runtime_str!("test-storage"), @@ -89,6 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 7, + state_version: 1, }; impl_opaque_keys! { @@ -126,7 +163,7 @@ parameter_types! { pub const SlashDeferDuration: pallet_staking::EraIndex = 4; pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4; pub const MaxIterations: u32 = 10; - pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000); + pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000); pub const MaxNominatorRewardedPerValidator: u32 = 2048; pub const IndexDeposit: Balance = DOLLARS; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; @@ -137,12 +174,12 @@ parameter_types! { pub const MinimumBond: Balance = 1 * POLY; pub const MaxLegsInInstruction: u32 = 100; pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); - pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_SLOTS as _; + pub const MaxAuthorities: u32 = 100_000; + pub const MaxKeys: u32 = 10_000; + pub const MaxPeerInHeartbeats: u32 = 10_000; + pub const MaxPeerDataEncodingSize: u32 = 1_000; pub const ReportLongevity: u64 = BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get(); - - pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get(); - } frame_support::construct_runtime!( @@ -151,90 +188,91 @@ frame_support::construct_runtime!( NodeBlock = polymesh_primitives::Block, UncheckedExtrinsic = UncheckedExtrinsic, { - System: frame_system::{Module, Call, Config, Storage, Event} = 0, - Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned} = 1, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 2, - Indices: pallet_indices::{Module, Call, Storage, Config, Event} = 3, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 1, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, + Indices: pallet_indices::{Pallet, Call, Storage, Config, Event} = 3, // Balance: Genesis config dependencies: System. - Balances: pallet_balances::{Module, Call, Storage, Config, Event} = 4, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Module, Storage} = 5, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 5, // Identity: Genesis config deps: Timestamp. - Identity: pallet_identity::{Module, Call, Storage, Event, Config} = 6, - // Authorship: pallet_authorship::{Module, Call, Storage, Inherent} = 7, + Identity: pallet_identity::{Pallet, Call, Storage, Event, Config} = 6, + // Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent} = 7, // CddServiceProviders: Genesis config deps: Identity - CddServiceProviders: pallet_group::::{Module, Call, Storage, Event, Config} = 38, + CddServiceProviders: pallet_group::::{Pallet, Call, Storage, Event, Config} = 38, // Staking: Genesis config deps: Balances, Indices, Identity, Babe, Timestamp, CddServiceProviders. - Staking: pallet_staking::{Module, Call, Config, Storage, Event, ValidateUnsigned} = 8, - Offences: pallet_offences::{Module, Call, Storage, Event} = 9, + Staking: pallet_staking::{Pallet, Call, Config, Storage, Event, ValidateUnsigned} = 8, + Offences: pallet_offences::{Pallet, Storage, Event} = 9, // Session: Genesis config deps: System. - Session: pallet_session::{Module, Call, Storage, Event, Config} = 10, - Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event} = 12, - ImOnline: pallet_im_online::{Module, Call, Storage, Event, ValidateUnsigned, Config} = 13, - AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config} = 14, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage} = 15, - Historical: pallet_session_historical::{Module} = 16, + Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 10, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event} = 12, + ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 13, + AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 14, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 15, + Historical: pallet_session_historical::{Pallet} = 16, // Sudo. Usable initially. // RELEASE: remove this for release build. - Sudo: pallet_sudo::{Module, Call, Config, Storage, Event} = 17, - MultiSig: pallet_multisig::{Module, Call, Config, Storage, Event} = 18, - - /* - // Contracts - BaseContracts: pallet_contracts::{Module, Config, Storage, Event} = 19, - Contracts: polymesh_contracts::{Module, Call, Storage, Event} = 20, - */ + Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event} = 17, + MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event} = 18, // Polymesh Governance Committees - Treasury: pallet_treasury::{Module, Call, Event} = 21, - PolymeshCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config} = 22, + Treasury: pallet_treasury::{Pallet, Call, Event} = 21, + PolymeshCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config} = 22, // CommitteeMembership: Genesis config deps: PolymeshCommittee, Identity. - CommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config} = 23, - Pips: pallet_pips::{Module, Call, Storage, Event, Config} = 24, - TechnicalCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config} = 25, + CommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config} = 23, + Pips: pallet_pips::{Pallet, Call, Storage, Event, Config} = 24, + TechnicalCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config} = 25, // TechnicalCommitteeMembership: Genesis config deps: TechnicalCommittee, Identity - TechnicalCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config} = 26, - UpgradeCommittee: pallet_committee::::{Module, Call, Storage, Origin, Event, Config} = 27, + TechnicalCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config} = 26, + UpgradeCommittee: pallet_committee::::{Pallet, Call, Storage, Origin, Event, Config} = 27, // UpgradeCommitteeMembership: Genesis config deps: UpgradeCommittee - UpgradeCommitteeMembership: pallet_group::::{Module, Call, Storage, Event, Config} = 28, + UpgradeCommitteeMembership: pallet_group::::{Pallet, Call, Storage, Event, Config} = 28, //Polymesh //////////// // Asset: Genesis config deps: Timestamp, - Asset: pallet_asset::{Module, Call, Storage, Config, Event} = 29, + Asset: pallet_asset::{Pallet, Call, Storage, Config, Event} = 29, // Bridge: Genesis config deps: Multisig, Identity, - Bridge: pallet_bridge::{Module, Call, Storage, Config, Event} = 31, - ComplianceManager: pallet_compliance_manager::{Module, Call, Storage, Event} = 32, - Settlement: pallet_settlement::{Module, Call, Storage, Event, Config} = 36, - Sto: pallet_sto::{Module, Call, Storage, Event} = 37, - Statistics: pallet_statistics::{Module, Call, Storage, Event} = 39, - ProtocolFee: pallet_protocol_fee::{Module, Call, Storage, Event, Config} = 40, - Utility: pallet_utility::{Module, Call, Storage, Event} = 41, - Portfolio: pallet_portfolio::{Module, Call, Storage, Event} = 42, + Bridge: pallet_bridge::{Pallet, Call, Storage, Config, Event} = 31, + ComplianceManager: pallet_compliance_manager::{Pallet, Call, Storage, Event} = 32, + Settlement: pallet_settlement::{Pallet, Call, Storage, Event, Config} = 36, + Sto: pallet_sto::{Pallet, Call, Storage, Event} = 37, + Statistics: pallet_statistics::{Pallet, Call, Storage, Event} = 39, + ProtocolFee: pallet_protocol_fee::{Pallet, Call, Storage, Event, Config} = 40, + Utility: pallet_utility::{Pallet, Call, Storage, Event} = 41, + Portfolio: pallet_portfolio::{Pallet, Call, Storage, Event} = 42, // Removed pallet Confidential = 43, - Permissions: pallet_permissions::{Module, Storage} = 44, - Scheduler: pallet_scheduler::{Module, Call, Storage, Event} = 45, - CorporateAction: pallet_corporate_actions::{Module, Call, Storage, Event, Config} = 46, - CorporateBallot: corporate_ballots::{Module, Call, Storage, Event} = 47, - CapitalDistribution: capital_distributions::{Module, Call, Storage, Event} = 48, - Checkpoint: pallet_checkpoint::{Module, Call, Storage, Event, Config} = 49, - TestUtils: pallet_test_utils::{Module, Call, Storage, Event } = 50, - Base: pallet_base::{Module, Call, Event} = 51, - ExternalAgents: pallet_external_agents::{Module, Call, Storage, Event} = 52, - Relayer: pallet_relayer::{Module, Call, Storage, Event} = 53, - Rewards: pallet_rewards::{Module, Call, Storage, Event, Config} = 54, + Permissions: pallet_permissions::{Pallet, Storage} = 44, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 45, + CorporateAction: pallet_corporate_actions::{Pallet, Call, Storage, Event, Config} = 46, + CorporateBallot: corporate_ballots::{Pallet, Call, Storage, Event} = 47, + CapitalDistribution: capital_distributions::{Pallet, Call, Storage, Event} = 48, + Checkpoint: pallet_checkpoint::{Pallet, Call, Storage, Event, Config} = 49, + TestUtils: pallet_test_utils::{Pallet, Call, Storage, Event } = 50, + Base: pallet_base::{Pallet, Call, Event} = 51, + ExternalAgents: pallet_external_agents::{Pallet, Call, Storage, Event} = 52, + Relayer: pallet_relayer::{Pallet, Call, Storage, Event} = 53, + Rewards: pallet_rewards::{Pallet, Call, Storage, Event, Config} = 54, + + // Contracts + Contracts: pallet_contracts::{Pallet, Storage, Event} = 19, + PolymeshContracts: polymesh_contracts::{Pallet, Call, Storage, Event} = 20, + + // Preimage register. Used by `pallet_scheduler`. + Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 55, } ); @@ -355,7 +393,7 @@ impl OnUnbalanced> for DealWithFees { fn on_nonzero_unbalanced(amount: NegativeImbalance) { let target = account_from(5000); let positive_imbalance = Balances::deposit_creating(&target, amount.peek()); - let _ = amount.offset(positive_imbalance).map_err(|_| 4); // random value mapped for error + let _ = amount.offset(positive_imbalance).same().map_err(|_| 4); // random value mapped for error } } @@ -367,13 +405,18 @@ parameter_types! { pub MaxNumberOfTMExtensionForAsset: u32 = MAX_NO_OF_TM_ALLOWED.with(|v| *v.borrow()); pub const AssetNameMaxLength: u32 = 128; pub const FundingRoundNameMaxLength: u32 = 128; + pub const AssetMetadataNameMaxLength: u32 = 256; + pub const AssetMetadataValueMaxLength: u32 = 8 * 1024; + pub const AssetMetadataTypeDefMaxLength: u32 = 8 * 1024; pub const BlockRangeForTimelock: BlockNumber = 1000; pub const MaxTargetIds: u32 = 10; pub const MaxDidWhts: u32 = 10; pub const MinimumPeriod: u64 = 3; pub NetworkShareInFee: Perbill = NETWORK_FEE_SHARE.with(|v| *v.borrow()); - pub const MaxTransferManagersPerAsset: u32 = 3; + pub const MaxStatsPerAsset: u32 = 10 + BENCHMARK_MAX_INCREASE; + pub const MaxTransferConditionsPerAsset: u32 = 4 + BENCHMARK_MAX_INCREASE; + pub const MaxConditionComplexity: u32 = 50; pub const MaxDefaultTrustedClaimIssuers: usize = 10; pub const MaxTrustedIssuerPerCondition: usize = 10; @@ -381,10 +424,9 @@ parameter_types! { pub const MaxReceiverConditionsPerCompliance: usize = 30; pub const MaxCompliancePerRequirement: usize = 10; - pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(33); - pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; + pub const NoPreimagePostponement: Option = Some(10); pub const InitialPOLYX: Balance = 41; pub const SignedClaimHandicap: u64 = 2; @@ -395,6 +437,11 @@ parameter_types! { pub const SurchargeReward: Balance = 1500; pub const MaxDepth: u32 = 100; pub const MaxValueSize: u32 = 16_384; + + pub Schedule: pallet_contracts::Schedule = Default::default(); + pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionQueueDepth: u32 = 1024; + pub MaxInLen: u32 = 8 * 1024; } thread_local! { @@ -538,6 +585,7 @@ impl polymesh_common_utilities::traits::identity::Config for TestStorage { type IdentityFn = identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; + type MultiSigBalanceLimit = polymesh_runtime_common::MultiSigBalanceLimit; } pub struct TestSessionHandler; @@ -551,7 +599,7 @@ impl pallet_session::SessionHandler for TestSessionHandler { ) { } - fn on_disabled(_validator_index: usize) {} + fn on_disabled(_validator_index: u32) {} fn on_genesis_session(_validators: &[(AuthorityId, Ks)]) {} fn on_before_session_ending() {} @@ -655,7 +703,7 @@ pub fn make_account_with_balance( let cdd_providers = CddServiceProvider::get_members(); let did = match cdd_providers.into_iter().nth(0) { Some(cdd_provider) => { - let cdd_acc = Identity::did_records(&cdd_provider).primary_key; + let cdd_acc = get_primary_key(cdd_provider); let _ = Identity::cdd_register_did(Origin::signed(cdd_acc.clone()), id.clone(), vec![]) .map_err(|_| "CDD register DID failed")?; @@ -699,14 +747,19 @@ pub fn register_keyring_account_with_balance( make_account_with_balance(acc_id, uid, balance).map(|(_, id)| id) } -pub fn register_keyring_account_without_cdd( - acc: AccountKeyring, -) -> Result { - make_account_without_cdd(acc.to_account_id()).map(|(_, id)| id) +pub fn get_primary_key(target: IdentityId) -> AccountId { + Identity::get_primary_key(target).unwrap_or_default() +} + +pub fn get_secondary_keys(target: IdentityId) -> Vec> { + match Identity::get_did_records(target) { + RpcDidRecords::Success { secondary_keys, .. } => secondary_keys, + _ => vec![], + } } pub fn add_secondary_key_with_perms(did: IdentityId, acc: AccountId, perms: AuthPermissions) { - let _primary_key = Identity::did_records(&did).primary_key; + let _primary_key = get_primary_key(did); let auth_id = Identity::add_auth( did.clone(), Signatory::Account(acc.clone()), @@ -741,11 +794,11 @@ pub fn authorizations_to(to: &Signatory) -> Vec Weight { - let block_number = frame_system::Module::::block_number() + 1; - frame_system::Module::::set_block_number(block_number); + let block_number = frame_system::Pallet::::block_number() + 1; + frame_system::Pallet::::set_block_number(block_number); // Call the timelocked tx handler. - pallet_scheduler::Module::::on_initialize(block_number) + pallet_scheduler::Pallet::::on_initialize(block_number) } pub fn fast_forward_to_block(n: u32) -> Weight { @@ -855,7 +908,7 @@ pub fn add_investor_uniqueness_claim( cdd_id: CddId, proof: InvestorZKProofData, ) -> DispatchResult { - let signed_claim_to = Origin::signed(Identity::did_records(claim_to).primary_key); + let signed_claim_to = Origin::signed(get_primary_key(claim_to)); // Provide the InvestorUniqueness. Identity::add_investor_uniqueness_claim( @@ -873,7 +926,7 @@ pub fn provide_scope_claim_to_multiple_parties<'a>( cdd_provider: AccountId, ) { parties.into_iter().for_each(|id| { - let uid = create_investor_uid(Identity::did_records(id).primary_key); + let uid = create_investor_uid(get_primary_key(*id)); provide_scope_claim(*id, ticker, uid, cdd_provider.clone(), None).0; }); } @@ -883,13 +936,16 @@ pub fn root() -> Origin { } pub fn create_cdd_id_and_investor_uid(identity_id: IdentityId) -> (CddId, InvestorUid) { - let uid = create_investor_uid(Identity::did_records(identity_id).primary_key); + let uid = create_investor_uid(get_primary_key(identity_id)); let (cdd_id, _) = create_cdd_id(identity_id, Ticker::default(), uid); (cdd_id, uid) } pub fn make_remark_proposal() -> Call { - Call::System(frame_system::Call::remark(vec![b'X'; 100])).into() + Call::System(frame_system::Call::remark { + remark: vec![b'X'; 100], + }) + .into() } crate fn set_curr_did(did: Option) { @@ -950,3 +1006,65 @@ macro_rules! assert_event_doesnt_exist { })); }; } + +pub fn exec>(origin: Origin, call: C) -> DispatchResult { + let origin: Result, Origin> = origin.into(); + let signed = match origin.unwrap() { + RawOrigin::Signed(acc) => { + let info = frame_system::Account::::get(&acc); + Some((acc, signed_extra(info.nonce))) + } + _ => None, + }; + Executive::apply_extrinsic(sign(CheckedExtrinsic { + signed, + function: call.into(), + })) + .unwrap() +} + +/// Sign given `CheckedExtrinsic` returning an `UncheckedExtrinsic` +/// usable for execution. +fn sign(xt: CheckedExtrinsic) -> UncheckedExtrinsic { + let CheckedExtrinsic { + signed, function, .. + } = xt; + UncheckedExtrinsic { + signature: signed.map(|(signed, extra)| { + let payload = ( + &function, + extra.clone(), + VERSION.spec_version, + VERSION.transaction_version, + GENESIS_HASH, + GENESIS_HASH, + ); + let key = AccountKeyring::from_account_id(&signed).unwrap(); + let signature = payload + .using_encoded(|b| { + if b.len() > 256 { + key.sign(&sp_io::hashing::blake2_256(b)) + } else { + key.sign(b) + } + }) + .into(); + (Address::Id(signed), signature, extra) + }), + function, + } +} + +/// Returns transaction extra. +fn signed_extra(nonce: Index) -> SignedExtra { + ( + frame_system::CheckSpecVersion::new(), + frame_system::CheckTxVersion::new(), + frame_system::CheckGenesis::new(), + frame_system::CheckEra::from(Era::mortal(256, 0)), + frame_system::CheckNonce::from(nonce), + polymesh_extensions::CheckWeight::new(), + pallet_transaction_payment::ChargeTransactionPayment::from(0), + pallet_permissions::StoreCallMetadata::new(), + ) +} diff --git a/pallets/runtime/tests/src/transaction_payment_test.rs b/pallets/runtime/tests/src/transaction_payment_test.rs index 2062616af5..f0dd219712 100644 --- a/pallets/runtime/tests/src/transaction_payment_test.rs +++ b/pallets/runtime/tests/src/transaction_payment_test.rs @@ -12,6 +12,7 @@ use pallet_balances::Call as BalancesCall; use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier, RuntimeDispatchInfo}; use polymesh_primitives::AccountId; use polymesh_primitives::TransactionError; +use sp_arithmetic::traits::One; use sp_runtime::{ testing::TestXt, traits::SignedExtension, @@ -21,14 +22,14 @@ use sp_runtime::{ use test_client::AccountKeyring; fn call() -> ::Call { - Call::Balances(BalancesCall::transfer( - MultiAddress::Id(AccountKeyring::Alice.to_account_id()), - 69, - )) + Call::Balances(BalancesCall::transfer { + dest: MultiAddress::Id(AccountKeyring::Alice.to_account_id()), + value: 69, + }) } type Balances = pallet_balances::Module; -type System = frame_system::Module; +type System = frame_system::Pallet; type TransactionPayment = pallet_transaction_payment::Module; /// create a transaction info struct from weight. Handy to avoid building the whole struct. @@ -83,7 +84,7 @@ fn signed_extension_transaction_payment_work() { assert_eq!(Balances::free_balance(&bob), 1999969001); assert!(ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &info_from_weight(5), &default_post_info(), len, @@ -98,7 +99,7 @@ fn signed_extension_transaction_payment_work() { assert_eq!(Balances::free_balance(&alice), 999969001); assert!(ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &info_from_weight(100), &post_info_from_weight(50), len, @@ -127,7 +128,7 @@ fn signed_extension_transaction_payment_multiplied_refund_works() { assert_eq!(Balances::free_balance(&user), 999969001); assert!(ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &info_from_weight(100), &post_info_from_weight(50), len, @@ -397,7 +398,7 @@ fn actual_weight_higher_than_max_refunds_nothing() { assert_eq!(Balances::free_balance(&user), 999969001); ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &info_from_weight(100), &post_info_from_weight(101), len, @@ -430,7 +431,7 @@ fn zero_transfer_on_free_transaction() { .unwrap(); assert_eq!(Balances::total_balance(&user), bal_init); assert!(ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &dispatch_info, &default_post_info(), len, @@ -464,7 +465,7 @@ fn refund_consistent_with_actual_weight() { .unwrap(); ChargeTransactionPayment::::post_dispatch( - pre, + Some(pre), &info, &post_info, len, diff --git a/pallets/runtime/tests/src/transfer_compliance_test.rs b/pallets/runtime/tests/src/transfer_compliance_test.rs new file mode 100644 index 0000000000..f476f45ff1 --- /dev/null +++ b/pallets/runtime/tests/src/transfer_compliance_test.rs @@ -0,0 +1,1077 @@ +use super::{ + storage::{ + account_from, create_investor_uid, make_account, provide_scope_claim, TestStorage, User, + }, + ExtBuilder, +}; +use frame_support::{ + assert_noop, assert_ok, + dispatch::{DispatchError, DispatchResult}, +}; +use polymesh_primitives::{ + asset::AssetType, investor_zkproof_data::v1::InvestorZKProofData, jurisdiction::CountryCode, + statistics::*, transfer_compliance::*, AccountId, Balance, CddId, Claim, ClaimType, IdentityId, + InvestorUid, PortfolioId, Scope, ScopeId, Ticker, +}; +use sp_arithmetic::Permill; +use sp_std::convert::TryFrom; +use std::collections::{HashMap, HashSet}; +use test_client::AccountKeyring; + +type Origin = ::Origin; +type Identity = pallet_identity::Module; +type Asset = pallet_asset::Module; +type Statistics = pallet_statistics::Module; +type ComplianceManager = pallet_compliance_manager::Module; +type Error = pallet_statistics::Error; +type AssetError = pallet_asset::Error; + +const CDD_PROVIDER: AccountKeyring = AccountKeyring::Eve; + +#[derive(Clone)] +struct InvestorState { + id: u64, + did: IdentityId, + acc: AccountId, + balance: Balance, + claims: HashMap<(ClaimType, IdentityId), Claim>, +} + +impl InvestorState { + pub fn new(id: u64) -> Self { + let acc = account_from(id); + let (_, did) = make_account(acc.clone()).expect("Failed to make account."); + Self { + id, + did, + acc, + balance: Default::default(), + claims: Default::default(), + } + } + + fn origin(&self) -> Origin { + Origin::signed(self.acc.clone()) + } + + pub fn uid(&self) -> InvestorUid { + create_investor_uid(self.acc.clone()) + } + + pub fn scope_id(&self, ticker: Ticker) -> ScopeId { + InvestorZKProofData::make_scope_id(&ticker.as_slice(), &self.uid()) + } + + pub fn provide_scope_claim(&self, ticker: Ticker) -> (ScopeId, CddId) { + provide_scope_claim( + self.did, + ticker, + self.uid(), + CDD_PROVIDER.to_account_id(), + None, + ) + } + + pub fn add_issuer_claim(&mut self, did: &IdentityId, acc: &AccountId, claim: &Claim) { + assert_ok!(Identity::add_claim( + Origin::signed(acc.clone()), + self.did, + claim.clone(), + None, + )); + let claim_type = claim.claim_type(); + self.claims.insert((claim_type, *did), claim.clone()); + } + + pub fn fetch_stat_claim(&self, claim_issuer: &(ClaimType, IdentityId)) -> Stat2ndKey { + let claim = self.claims.get(claim_issuer); + Stat2ndKey::new_from(&claim_issuer.0, claim.cloned()) + } +} + +#[derive(Clone)] +struct IssuerState { + issuer: User, + trusted_for: HashSet, + claims: HashSet, +} + +impl IssuerState { + pub fn new(issuer: User, trusted_for: &[ClaimType]) -> Self { + Self { + issuer, + trusted_for: trusted_for.iter().cloned().collect(), + claims: HashSet::new(), + } + } + + pub fn is_trusted_for(&self, claim_type: &ClaimType) -> bool { + self.trusted_for.contains(claim_type) + } + + pub fn add_claim(&mut self, claim: &Claim) { + self.claims.insert(claim.clone()); + } + + pub fn fetch_claims(&self, claim_type: ClaimType) -> Vec { + self.claims + .iter() + .filter(|c| c.claim_type() == claim_type) + .cloned() + .collect() + } + + pub fn did(&self) -> IdentityId { + self.issuer.did + } +} + +#[derive(Debug, Clone)] +struct Batch { + ids: Vec, +} + +#[derive(Clone)] +struct AssetTracker { + name: String, + asset: Ticker, + total_supply: Balance, + disable_iu: bool, + asset_scope: AssetScope, + + issuers: HashMap, + + owner_id: u64, + investor_start_id: u64, + investor_next_id: u64, + investors: HashMap, + + active_stats: Vec, + transfer_conditions: Vec, +} + +impl AssetTracker { + pub fn new() -> Self { + Self::new_full(0, "ACME") + } + + pub fn new_full(owner_id: u64, name: &str) -> Self { + let asset = Ticker::try_from(name.as_bytes()).expect("Bad ticker"); + let investor_start_id = owner_id + 1000; + let mut tracker = Self { + name: name.into(), + asset, + total_supply: 0, + disable_iu: false, + asset_scope: AssetScope::from(asset), + + issuers: HashMap::new(), + + owner_id, + investor_start_id, + investor_next_id: investor_start_id, + investors: HashMap::new(), + + active_stats: Vec::new(), + transfer_conditions: Vec::new(), + }; + tracker.init(); + + tracker + } + + fn init(&mut self) { + // Create the owner investor state. + self.create_investor(self.owner_id); + + assert_ok!(Asset::create_asset( + self.owner_origin(), + format!("Token {}", self.name).into(), + self.asset, + true, + AssetType::default(), + vec![], + None, + self.disable_iu, + )); + + self.allow_all_transfers(); + } + + pub fn set_active_stats(&mut self, active_stats: Vec) { + assert_ok!(Statistics::set_active_asset_stats( + self.owner_origin(), + self.asset_scope, + active_stats.clone().into_iter().collect(), + )); + self.active_stats = active_stats; + } + + pub fn set_transfer_conditions(&mut self, conditions: Vec) { + assert_ok!(Statistics::set_asset_transfer_compliance( + self.owner_origin(), + self.asset_scope, + conditions.clone().into_iter().collect(), + )); + self.transfer_conditions = conditions; + } + + pub fn owner(&self) -> &InvestorState { + self.investors.get(&self.owner_id).expect("Missing owner") + } + + pub fn owner_mut(&mut self) -> &mut InvestorState { + self.investors + .get_mut(&self.owner_id) + .expect("Missing owner") + } + + pub fn owner_origin(&self) -> Origin { + self.owner().origin() + } + + pub fn mint(&mut self, amount: Balance) { + assert_ok!(Asset::issue(self.owner_origin(), self.asset, amount)); + self.total_supply += amount; + self.owner_mut().balance += amount; + } + + pub fn fake_sto(&mut self, amounts: &[(u64, Balance)]) -> DispatchResult { + for (id, amount) in amounts.into_iter() { + self.do_transfer(self.owner_id, *id, *amount)?; + } + Ok(()) + } + + pub fn add_issuer(&mut self, issuer: &User, trusted_for: &[ClaimType]) { + let issuer = IssuerState::new(*issuer, trusted_for); + self.issuers.insert(issuer.did(), issuer); + } + + pub fn make_claim(&self, claim_type: ClaimType, jur: Option) -> Claim { + let scope = Scope::from(self.asset); + match claim_type { + ClaimType::Accredited => Claim::Accredited(scope), + ClaimType::Affiliate => Claim::Affiliate(scope), + ClaimType::BuyLockup => Claim::BuyLockup(scope), + ClaimType::SellLockup => Claim::SellLockup(scope), + ClaimType::KnowYourCustomer => Claim::KnowYourCustomer(scope), + ClaimType::Jurisdiction => { + let jur = jur.expect("Need Jurisdiction"); + Claim::Jurisdiction(jur, scope) + } + ClaimType::Exempted => Claim::Exempted(scope), + ClaimType::Blocked => Claim::Blocked(scope), + _ => { + panic!("Asset issuers can't create {:?} claims", claim_type); + } + } + } + + pub fn make_stat_claim( + &self, + claim_type: ClaimType, + has: bool, + jur: Option, + ) -> StatClaim { + let claim = self.make_claim(claim_type, jur); + StatClaim::new_from(&claim, has).expect("Unsupported ClaimType") + } + + pub fn set_investors_exempt(&mut self, ids: &[u64], is_exempt: bool) { + println!("ids = {:?}", ids); + let investors = ids + .into_iter() + .map(|id| self.investor(*id).scope_id(self.asset)) + .collect::>(); + println!("investors = {:?}", investors); + for condition in &self.transfer_conditions { + let exempt_key = condition.get_exempt_key(self.asset_scope); + println!(" -- exempt={:?}", exempt_key); + assert_ok!(Statistics::set_entities_exempt( + self.owner_origin(), + is_exempt, + exempt_key, + investors.clone().into_iter().collect() + )); + } + } + + pub fn add_claim_to_investors( + &mut self, + ids: &[u64], + claim_type: ClaimType, + jur: Option, + ) { + let claim = self.make_claim(claim_type, jur); + + // build list of (issuer, claim) pairs. + let claims = self + .issuers + .values_mut() + .filter(|issuer| issuer.is_trusted_for(&claim_type)) + .map(|i| { + i.add_claim(&claim); + (i.issuer.did, i.issuer.acc(), &claim) + }) + .collect::>(); + + // add claims to each investor. + for id in ids.into_iter() { + for (did, acc, claim) in &claims { + self.add_claim_to_investor(*id, did, acc, claim); + } + } + } + + fn add_claim_to_investor(&mut self, id: u64, did: &IdentityId, acc: &AccountId, claim: &Claim) { + self.investor_mut(id).add_issuer_claim(did, acc, claim) + } + + pub fn investor_start_id(&self) -> u64 { + self.investor_start_id + } + + pub fn investor_count(&self) -> u64 { + self.investor_next_id - self.investor_start_id + } + + pub fn dump_investors(&self) { + self.investors.values().for_each(|i| { + println!("investor[{}]: bal={}", i.id, i.balance); + }) + } + + /// The number of investors with `balance > 0`. + pub fn active_investor_count(&self) -> u64 { + self.investors.values().filter(|i| i.balance > 0).count() as u64 + } + + /// Count the number of investors with `balance > 0` and the matching claim. + pub fn calculate_stat_count( + &self, + claim_issuer: Option<(ClaimType, IdentityId)>, + key2: &Stat2ndKey, + ) -> u64 { + if let Some(claim_issuer) = claim_issuer { + self.investors + .values() + .filter(|i| i.balance > 0 && i.fetch_stat_claim(&claim_issuer) == *key2) + .count() as u64 + } else { + // Special case, count all investors with a balance. + self.active_investor_count() + } + } + + /// Calculate the balance of all investors the matching claim. + pub fn calculate_stat_balance( + &self, + claim_issuer: Option<(ClaimType, IdentityId)>, + key2: &Stat2ndKey, + ) -> Balance { + let claim_issuer = claim_issuer.expect("Need claim issuer for Balance stats."); + self.investors + .values() + .filter(|i| i.fetch_stat_claim(&claim_issuer) == *key2) + .map(|i| i.balance) + .sum() + } + + pub fn make_investors(&mut self, count: u64) -> Batch { + let ids = (0..count).map(|_| self.new_investor()).collect(); + Batch { ids } + } + + pub fn make_batches( + &mut self, + batches: Vec<(u64, Balance, Vec<(ClaimType, Option)>)>, + ) -> Result, DispatchError> { + batches + .into_iter() + .map(|(size, sto_buy, claims)| self.new_batch(size, sto_buy, claims)) + .collect() + } + + pub fn new_batch( + &mut self, + size: u64, + sto_buy: Balance, + claims: Vec<(ClaimType, Option)>, + ) -> Result { + println!("Create batch: {:?}", (size, sto_buy, &claims)); + // Create investors for this batch. + let batch = self.make_investors(size); + + // Add claims. + for (claim_type, jur) in claims { + self.add_claim_to_investors(&batch.ids[..], claim_type, jur); + } + + // Fake STO. + let sto = batch + .ids + .iter() + .map(|id| (*id, sto_buy)) + .collect::>(); + self.fake_sto(sto.as_slice())?; + + Ok(batch) + } + + pub fn new_investor(&mut self) -> u64 { + let id = self.investor_next_id; + self.investor_next_id += 1; + self.create_investor(id); + id + } + + fn create_investor(&mut self, id: u64) { + let investor = InvestorState::new(id); + investor.provide_scope_claim(self.asset); + assert!(self.investors.insert(id, investor).is_none()); + } + + pub fn investor(&self, id: u64) -> &InvestorState { + self.investors.get(&id).expect("Missing investor") + } + + pub fn investor_mut(&mut self, id: u64) -> &mut InvestorState { + self.investors.get_mut(&id).expect("Missing investor") + } + + #[track_caller] + pub fn allow_all_transfers(&self) { + assert_ok!(ComplianceManager::add_compliance_requirement( + self.owner().origin(), + self.asset, + vec![], + vec![] + )); + } + + fn get_investor_portfolio(&self, id: u64) -> PortfolioId { + let did = self.investor(id).did; + PortfolioId::default_portfolio(did) + } + + fn do_transfer(&mut self, from: u64, to: u64, amount: u128) -> DispatchResult { + Asset::base_transfer( + self.get_investor_portfolio(from), + self.get_investor_portfolio(to), + &self.asset, + amount, + )?; + + // Update investor balances. + self.investor_mut(from).balance -= amount; + self.investor_mut(to).balance += amount; + + Ok(()) + } + + #[track_caller] + pub fn do_valid_transfer(&mut self, from: u64, to: u64, amount: u128) { + assert_ok!(self.do_transfer(from, to, amount)); + } + + #[track_caller] + pub fn ensure_invalid_transfer(&mut self, from: u64, to: u64, amount: u128) { + assert_noop!( + self.do_transfer(from, to, amount), + AssetError::InvalidTransfer + ); + } + + pub fn fetch_stats_key2(&self, stat_type: &StatType) -> Vec { + match stat_type.claim_issuer { + None => vec![Stat2ndKey::NoClaimStat], + Some((claim_type, did)) => { + if let Some(issuer) = self.issuers.get(&did) { + issuer + .fetch_claims(claim_type) + .into_iter() + .map(|claim| Stat2ndKey::new_from(&claim_type, Some(claim))) + .chain(vec![Stat2ndKey::new_from(&claim_type, None)].into_iter()) + .collect() + } else { + vec![Stat2ndKey::new_from(&claim_type, None)] + } + } + } + } + + pub fn get_claim_stats( + &self, + op: StatOpType, + claim_type: ClaimType, + has: bool, + jur: Option, + ) -> Vec<(u128, u128)> { + let key2 = if has { + Stat2ndKey::from(self.make_claim(claim_type, jur)) + } else { + Stat2ndKey::new_from(&claim_type, None) + }; + + self.issuers + .values() + .filter(|issuer| issuer.is_trusted_for(&claim_type)) + .map(|i| Stat1stKey { + asset: self.asset_scope, + stat_type: StatType { + op, + claim_issuer: Some((claim_type, i.issuer.did)), + }, + }) + .map(|key1| { + let claim_issuer = key1.stat_type.claim_issuer; + // Calculate the expected value. + let cal_value = match op { + StatOpType::Count => self.calculate_stat_count(claim_issuer, &key2) as u128, + StatOpType::Balance => self.calculate_stat_balance(claim_issuer, &key2), + }; + // Get stat from pallet. + let value = Statistics::asset_stats(key1, key2.clone()); + (cal_value, value) + }) + .collect() + } + + #[track_caller] + pub fn ensure_claim_stats( + &self, + op: StatOpType, + claim_type: ClaimType, + has: bool, + jur: Option, + ) { + let claim_name = match (has, claim_type, jur) { + (false, ClaimType::Jurisdiction, _) => "No Jurisdiction".into(), + (true, ClaimType::Jurisdiction, Some(cc)) => format!("Jurisdiction::{:?}", cc), + (false, c_type, None) => format!("non-{:?}", c_type), + (true, c_type, None) => format!("{:?}", c_type), + _ => { + unimplemented!( + "Unsupported claim stats: has={}, claim={:?}, jur={:?}", + has, + claim_type, + jur + ); + } + }; + self.get_claim_stats(op, claim_type, has, jur) + .into_iter() + .for_each(|(cal, value)| { + println!("{:?}: {} = ({}, {})", op, claim_name, cal, value); + assert_eq!(cal, value); + }); + } + + #[track_caller] + pub fn ensure_asset_stat(&self, stat_type: &StatType) { + let key1 = Stat1stKey { + asset: self.asset_scope, + stat_type: *stat_type, + }; + for key2 in self.fetch_stats_key2(stat_type).iter() { + let value = Statistics::asset_stats(key1, key2); + match (stat_type.op, stat_type.claim_issuer) { + (StatOpType::Count, claim_issuer) => { + let cal_value = self.calculate_stat_count(claim_issuer, &key2); + println!("Count[{:?}]: cal={:?}, stat={:?}", key2, cal_value, value); + assert_eq!(value, cal_value as u128); + } + (StatOpType::Balance, None) => { + // Per-investor balances are not stored in the stats. + } + (StatOpType::Balance, claim_issuer) => { + let cal_value = self.calculate_stat_balance(claim_issuer, &key2); + println!("Balance[{:?}]: cal={:?}, stat={:?}", key2, cal_value, value); + assert_eq!(value, cal_value as u128); + } + } + } + } + + #[track_caller] + pub fn ensure_asset_stats(&self) { + println!("active_stats = {}", self.active_stats.len()); + // check all active stats. + for stat_type in &self.active_stats { + self.ensure_asset_stat(stat_type); + } + } +} + +/// Create some batches of investors. +fn create_batches(tracker: &mut AssetTracker) -> Vec { + // batches + tracker + .make_batches(vec![ + // (batch_size, sto_buy, claims: Vec<(ClaimType, Option>) + ( + 1, + 100_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Affiliate, None), + (ClaimType::Jurisdiction, Some(CountryCode::US)), + ], + ), + ( + 40, + 10_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::US)), + ], + ), + ( + 10, + 2_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::GB)), + ], + ), + ( + 2, + 1_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::CA)), + ], + ), + ]) + .expect("Failed to create batches") +} + +#[test] +fn multiple_stats() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(multiple_stats_with_ext); +} + +fn multiple_stats_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let mut stats = vec![ + StatType { + op: StatOpType::Count, + claim_issuer: None, + }, + StatType { + op: StatOpType::Balance, + claim_issuer: None, + }, + ]; + let issuers = vec![User::new(AccountKeyring::Dave)]; + let claim_types = vec![ + ClaimType::Accredited, + ClaimType::Affiliate, + ClaimType::Jurisdiction, + ]; + // Add issuers. + for issuer in &issuers { + for claim_type in &claim_types { + stats.push(StatType { + op: StatOpType::Count, + claim_issuer: Some((*claim_type, issuer.did)), + }); + stats.push(StatType { + op: StatOpType::Balance, + claim_issuer: Some((*claim_type, issuer.did)), + }); + } + tracker.add_issuer(issuer, &claim_types[..]); + } + // Active stats. + tracker.set_active_stats(stats); + + // Mint + tracker.mint(100_000_000); + + // Create investor batches. + let _batches = create_batches(&mut tracker); + + tracker.ensure_asset_stats(); + + // check some stats. + tracker.ensure_claim_stats( + StatOpType::Count, + ClaimType::Jurisdiction, + true, + Some(CountryCode::US), + ); + tracker.ensure_claim_stats( + StatOpType::Balance, + ClaimType::Jurisdiction, + true, + Some(CountryCode::US), + ); + // Check a Jurisdiction with no investors (KP). + tracker.ensure_claim_stats( + StatOpType::Count, + ClaimType::Jurisdiction, + true, + Some(CountryCode::KP), + ); + tracker.ensure_claim_stats( + StatOpType::Balance, + ClaimType::Jurisdiction, + true, + Some(CountryCode::KP), + ); + + // Check Accredited. + tracker.ensure_claim_stats(StatOpType::Count, ClaimType::Accredited, true, None); + tracker.ensure_claim_stats(StatOpType::Balance, ClaimType::Accredited, true, None); + + // Check Affiliate. + tracker.ensure_claim_stats(StatOpType::Count, ClaimType::Affiliate, true, None); + tracker.ensure_claim_stats(StatOpType::Balance, ClaimType::Affiliate, true, None); + // Check non-Affiliate. + tracker.ensure_claim_stats(StatOpType::Count, ClaimType::Affiliate, false, None); + tracker.ensure_claim_stats(StatOpType::Balance, ClaimType::Affiliate, false, None); +} + +#[test] +fn max_investor_rule() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(max_investor_rule_with_ext); +} + +fn max_investor_rule_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let stats = vec![StatType { + op: StatOpType::Count, + claim_issuer: None, + }]; + // Active stats. + tracker.set_active_stats(stats); + + // Mint + tracker.mint(100_000_000); + + // Create investor batches. + let _batches = create_batches(&mut tracker); + + tracker.ensure_asset_stats(); + + // Set max investor count rule to `max == active_investor_count`. + let cur_count = tracker.active_investor_count(); + tracker.set_transfer_conditions(vec![TransferCondition::MaxInvestorCount(cur_count)]); + + // Try adding another investor. + let id = tracker.new_investor(); // No balance yet. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); +} + +#[test] +fn max_investor_ownership_rule() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(max_investor_ownership_rule_with_ext); +} + +fn max_investor_ownership_rule_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let stats = vec![StatType { + op: StatOpType::Balance, + claim_issuer: None, + }]; + // Active stats. + tracker.set_active_stats(stats); + + // Set max ownership to 25%. + let p25 = HashablePermill(Permill::from_rational(25u32, 100u32)); + tracker.set_transfer_conditions(vec![TransferCondition::MaxInvestorOwnership(p25)]); + + // Mint is not restricted by transfer rules. + tracker.mint(100_000); + + tracker.ensure_asset_stats(); + + // Add a new investor and transfer less then 25%. + let id = tracker.new_investor(); // No balance yet. + tracker.do_valid_transfer(tracker.owner_id, id, 10_000); // 10% + + tracker.ensure_asset_stats(); + + // Try transfer more so they would have >25%. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 16_000); + + tracker.ensure_asset_stats(); +} + +#[test] +fn claim_count_rule() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(claim_count_rule_with_ext); +} + +fn claim_count_rule_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let issuer = User::new(AccountKeyring::Dave); + let claim_types = vec![ClaimType::Accredited]; + // Add issuer. + tracker.add_issuer(&issuer, &claim_types[..]); + + // Make the owner Accredited. + tracker.add_claim_to_investors(&[tracker.owner_id], ClaimType::Accredited, None); + + // Active stats. + let stats = vec![StatType { + op: StatOpType::Count, + claim_issuer: Some((ClaimType::Accredited, issuer.did)), + }]; + tracker.set_active_stats(stats); + + // Set transfer conditions. max=40 Non-Accredited. + let no_claim = tracker.make_stat_claim(ClaimType::Accredited, false, None); + tracker.set_transfer_conditions(vec![TransferCondition::ClaimCount( + no_claim, + issuer.did, + 0, + Some(40), + )]); + + // Mint + tracker.mint(100_000_000); + + // Create some investor batches. 40 - Non-Accredited and 10 Accredited. + tracker + .make_batches(vec![ + // (batch_size, sto_buy, claims: Vec<(ClaimType, Option>) + ( + 40, + 10_000u128, + vec![(ClaimType::Jurisdiction, Some(CountryCode::US))], + ), + ( + 10, + 2_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::GB)), + ], + ), + ]) + .expect("Failed to create batches"); + + tracker.ensure_asset_stats(); + + // Create a new Non-Accredited investor. + let id = tracker.new_investor(); // No balance yet. + + // Try transfer some tokens to them. Should fail. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); + + // Exempt the receiver from the transfer rules. + tracker.set_investors_exempt(&[id], true); + + // Retry transfer. + // Should still fail since the sender needs to be exempt for Count rules. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); + + // Exempt the sender from the transfer rules. + tracker.set_investors_exempt(&[tracker.owner_id], true); + + // Retry transfer. + // Should pass. + tracker.do_valid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); +} + +#[test] +fn jurisdiction_count_rule() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(jurisdiction_count_rule_with_ext); +} + +fn jurisdiction_count_rule_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let issuer = User::new(AccountKeyring::Dave); + let claim_type = ClaimType::Jurisdiction; + // Add issuer. + tracker.add_issuer(&issuer, &[claim_type]); + + // Active stats. + let stats = vec![StatType { + op: StatOpType::Count, + claim_issuer: Some((claim_type, issuer.did)), + }]; + tracker.set_active_stats(stats); + + // Set transfer conditions. max=10 investors in Jurisdiction GB. + let claim = tracker.make_stat_claim(claim_type, true, Some(CountryCode::GB)); + tracker.set_transfer_conditions(vec![TransferCondition::ClaimCount( + claim, + issuer.did, + 0, + Some(10), + )]); + + // Mint + tracker.mint(100_000_000); + + // Create some investor batches. 40 - US and 10 GB. + tracker + .make_batches(vec![ + // (batch_size, sto_buy, claims: Vec<(ClaimType, Option>) + ( + 40, + 10_000u128, + vec![(ClaimType::Jurisdiction, Some(CountryCode::US))], + ), + ( + 10, + 2_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::GB)), + ], + ), + ]) + .expect("Failed to create batches"); + + tracker.ensure_asset_stats(); + + // Create a new GB investor. + let id = tracker.new_investor(); // No balance yet. + tracker.add_claim_to_investors(&[id], claim_type, Some(CountryCode::GB)); + + // Try transfer some tokens to them. Should fail. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); + + // Exempt the receiver from the transfer rules. + tracker.set_investors_exempt(&[id], true); + + // Retry transfer. + // Should still fail since the sender needs to be exempt for Count rules. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); + + // Exempt the sender from the transfer rules. + tracker.set_investors_exempt(&[tracker.owner_id], true); + + // Retry transfer. + // Should pass. + tracker.do_valid_transfer(tracker.owner_id, id, 1_000); + + tracker.ensure_asset_stats(); +} + +#[test] +fn jurisdiction_ownership_rule() { + ExtBuilder::default() + .cdd_providers(vec![CDD_PROVIDER.to_account_id()]) + .build() + .execute_with(jurisdiction_ownership_rule_with_ext); +} + +fn jurisdiction_ownership_rule_with_ext() { + // Create an asset. + let mut tracker = AssetTracker::new(); + + let issuer = User::new(AccountKeyring::Dave); + let claim_type = ClaimType::Jurisdiction; + // Add issuer. + tracker.add_issuer(&issuer, &[claim_type]); + + // Active stats. + let stats = vec![StatType { + op: StatOpType::Balance, + claim_issuer: Some((claim_type, issuer.did)), + }]; + tracker.set_active_stats(stats); + + // Set transfer conditions. max=10 investors in Jurisdiction GB. + let claim = tracker.make_stat_claim(claim_type, true, Some(CountryCode::GB)); + let p0 = HashablePermill(Permill::from_rational(0u32, 100u32)); + let p25 = HashablePermill(Permill::from_rational(25u32, 100u32)); + tracker.set_transfer_conditions(vec![TransferCondition::ClaimOwnership( + claim, issuer.did, p0, p25, + )]); + + // Mint + tracker.mint(1_000_000); + + // Create some investor batches. 40 - US and 10 GB. + tracker + .make_batches(vec![ + // (batch_size, sto_buy, claims: Vec<(ClaimType, Option>) + ( + 40, + 10_000u128, + vec![(ClaimType::Jurisdiction, Some(CountryCode::US))], + ), + ( + 10, + 2_000u128, + vec![ + (ClaimType::Accredited, None), + (ClaimType::Jurisdiction, Some(CountryCode::GB)), + ], + ), + ]) + .expect("Failed to create batches"); + + tracker.ensure_asset_stats(); + + // Create a new GB investor. + let id = tracker.new_investor(); // No balance yet. + tracker.add_claim_to_investors(&[id], claim_type, Some(CountryCode::GB)); + + // Try transfer more then 25% of the tokens to them. Should fail. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 260_000); + + tracker.ensure_asset_stats(); + + // Exempt the sender from the transfer rules. + tracker.set_investors_exempt(&[tracker.owner_id], true); + + // Retry transfer. + // Should still fail since the receiver needs to be exempt for Count rules. + tracker.ensure_invalid_transfer(tracker.owner_id, id, 260_000); + + tracker.ensure_asset_stats(); + + // Exempt the receiver from the transfer rules. + tracker.set_investors_exempt(&[id], true); + + // Retry transfer. + // Should pass. + tracker.do_valid_transfer(tracker.owner_id, id, 260_000); + + tracker.ensure_asset_stats(); +} diff --git a/pallets/runtime/tests/src/treasury_test.rs b/pallets/runtime/tests/src/treasury_test.rs index c5a6a2240a..fcbfb6ea10 100644 --- a/pallets/runtime/tests/src/treasury_test.rs +++ b/pallets/runtime/tests/src/treasury_test.rs @@ -1,18 +1,23 @@ use super::{ - storage::{root, set_curr_did, TestStorage, User}, + exec_noop, exec_ok, + storage::{make_account_without_cdd, root, TestStorage, User}, ExtBuilder, }; -use frame_support::{assert_noop, assert_ok}; -use polymesh_primitives::Beneficiary; +use polymesh_primitives::{AccountId, Beneficiary, IdentityId}; use sp_runtime::DispatchError; use test_client::AccountKeyring; pub type Balances = pallet_balances::Module; pub type Treasury = pallet_treasury::Module; +type TreasuryError = pallet_treasury::Error; type Identity = pallet_identity::Module; type Origin = ::Origin; +fn beneficiary(id: IdentityId, amount: Balance) -> Beneficiary { + Beneficiary { id, amount } +} + #[test] fn reimbursement_and_disbursement() { ExtBuilder::default() @@ -24,41 +29,115 @@ fn reimbursement_and_disbursement() { fn reimbursement_and_disbursement_we() { let alice = User::new(AccountKeyring::Alice); let bob = User::new(AccountKeyring::Bob); + let charlie_acc = AccountKeyring::Charlie.to_account_id(); + let (_, charlie_did) = make_account_without_cdd(charlie_acc.clone()).unwrap(); let total_issuance = Balances::total_issuance(); // Verify reimbursement. assert_eq!(Treasury::balance(), 0); - assert_ok!(Treasury::reimbursement(alice.origin(), 1_000)); + exec_ok!(Treasury::reimbursement(alice.origin(), 1_000)); assert_eq!(Treasury::balance(), 1_000); assert_eq!(total_issuance, Balances::total_issuance()); // Disbursement: Only root can do that. - assert_noop!( + exec_noop!( Treasury::disbursement(alice.origin(), vec![]), DispatchError::BadOrigin ); - let beneficiary = |u: User, amount| Beneficiary { id: u.did, amount }; - let beneficiaries = vec![beneficiary(alice, 100), beneficiary(bob, 500)]; + let beneficiaries = vec![ + // Valid identities. + beneficiary(alice.did, 100), + beneficiary(bob.did, 500), + // no-CDD identitiy. + beneficiary(charlie_did, 100), + ]; - // Providing a random DID to Root, In an ideal world root will have a valid DID + // Save balances before disbursement. let before_alice_balance = Balances::free_balance(&alice.acc()); let before_bob_balance = Balances::free_balance(&bob.acc()); - assert_ok!(Treasury::disbursement(root(), beneficiaries)); - set_curr_did(None); + let before_charlie_balance = Balances::free_balance(&charlie_acc); + + // Try disbursement. + exec_ok!(Treasury::disbursement(root(), beneficiaries.clone())); + + // Check balances after disbursement. assert_eq!(Treasury::balance(), 400); assert_eq!( Balances::free_balance(&alice.acc()), before_alice_balance + 100 ); assert_eq!(Balances::free_balance(&bob.acc()), before_bob_balance + 500); + assert_eq!(Balances::free_balance(&charlie_acc), before_charlie_balance); assert_eq!(total_issuance, Balances::total_issuance()); // Alice cannot make a disbursement to herself. - assert_noop!( - Treasury::disbursement(alice.origin(), vec![beneficiary(alice, 500)]), + exec_noop!( + Treasury::disbursement(alice.origin(), vec![beneficiary(alice.did, 500)]), DispatchError::BadOrigin ); assert_eq!(total_issuance, Balances::total_issuance()); + + // Repeat disbursement. This time there is not enough POLYX in the treasury. + exec_noop!( + Treasury::disbursement(root(), beneficiaries), + TreasuryError::InsufficientBalance, + ); +} + +#[test] +fn bad_disbursement_did() { + ExtBuilder::default() + .balance_factor(10) + .build() + .execute_with(bad_disbursement_did_we); +} + +fn bad_disbursement_did_we() { + let alice = User::new(AccountKeyring::Alice); + let bob = User::new(AccountKeyring::Bob); + let default_key = AccountId::default(); + + let total_issuance = Balances::total_issuance(); + let treasury_balance = 10_000; + + // Give the Treasury some POLYX. + assert_eq!(Treasury::balance(), 0); + exec_ok!(Treasury::reimbursement(alice.origin(), treasury_balance)); + assert_eq!(Treasury::balance(), treasury_balance); + assert_eq!(total_issuance, Balances::total_issuance()); + + let beneficiaries = vec![ + // Valid identities. + beneficiary(alice.did, 100), + beneficiary(bob.did, 500), + // Invalid identities. + beneficiary(0x00001u128.into(), 100), + beneficiary(0x00002u128.into(), 200), + beneficiary(0x00003u128.into(), 300), + ]; + + // Save balances before disbursement. + let before_alice_balance = Balances::free_balance(&alice.acc()); + let before_bob_balance = Balances::free_balance(&bob.acc()); + let before_default_key_balance = Balances::free_balance(&default_key); + + // Try disbursement. + exec_noop!( + Treasury::disbursement(root(), beneficiaries), + TreasuryError::InvalidIdentity, + ); + + // Check balances after disbursement. + assert_eq!(Treasury::balance(), treasury_balance); + assert_eq!(Balances::free_balance(&alice.acc()), before_alice_balance); + assert_eq!(Balances::free_balance(&bob.acc()), before_bob_balance); + assert_eq!( + Balances::free_balance(&default_key), + before_default_key_balance + ); + + // Make sure total POLYX issuance hasn't changed. + assert_eq!(total_issuance, Balances::total_issuance()); } diff --git a/pallets/runtime/tests/src/utility_test.rs b/pallets/runtime/tests/src/utility_test.rs index 7915b0e77c..ffd3154c22 100644 --- a/pallets/runtime/tests/src/utility_test.rs +++ b/pallets/runtime/tests/src/utility_test.rs @@ -2,8 +2,8 @@ use super::{ assert_event_doesnt_exist, assert_event_exists, assert_last_event, pips_test::assert_balance, storage::{ - add_secondary_key, register_keyring_account_with_balance, Call, EventTest, Identity, - Origin, Portfolio, System, TestStorage, User, Utility, + add_secondary_key, get_secondary_keys, register_keyring_account_with_balance, Call, + EventTest, Identity, Origin, Portfolio, System, TestStorage, User, Utility, }, ExtBuilder, }; @@ -23,19 +23,22 @@ use test_client::AccountKeyring; type Error = utility::Error; fn transfer(to: AccountId, amount: u128) -> Call { - Call::Balances(BalancesCall::transfer(to.into(), amount)) + Call::Balances(BalancesCall::transfer { + dest: to.into(), + value: amount, + }) } -const ERROR: DispatchError = DispatchError::Module { +const ERROR: DispatchError = DispatchError::Module(sp_runtime::ModuleError { index: 4, - error: 2, + error: [2, 0, 0, 0], message: None, -}; +}); fn assert_event(event: Event) { assert_eq!( System::events().pop().unwrap().event, - EventTest::pallet_utility(event) + EventTest::Utility(event) ) } @@ -167,7 +170,10 @@ fn _relay_happy_case() { let origin = Origin::signed(alice); let transaction = UniqueCall::new( Utility::nonce(bob.clone()), - Call::Balances(BalancesCall::transfer(charlie.clone().into(), 50)), + Call::Balances(BalancesCall::transfer { + dest: charlie.clone().into(), + value: 50, + }), ); assert_ok!(Utility::relay_tx( @@ -199,14 +205,17 @@ fn _relay_unhappy_cases() { let origin = Origin::signed(alice); let transaction = UniqueCall::new( Utility::nonce(bob.clone()), - Call::Balances(BalancesCall::transfer(charlie.clone().into(), 59)), + Call::Balances(BalancesCall::transfer { + dest: charlie.clone().into(), + value: 59, + }), ); assert_noop!( Utility::relay_tx( origin.clone(), bob.clone(), - Signature::default().into(), + Signature([0; 64]).into(), transaction.clone() ), Error::InvalidSignature @@ -226,16 +235,14 @@ fn _relay_unhappy_cases() { let transaction = UniqueCall::new( Utility::nonce(bob.clone()) + 1, - Call::Balances(BalancesCall::transfer(charlie.into(), 59)), + Call::Balances(BalancesCall::transfer { + dest: charlie.into(), + value: 59, + }), ); assert_noop!( - Utility::relay_tx( - origin.clone(), - bob, - Signature::default().into(), - transaction - ), + Utility::relay_tx(origin.clone(), bob, Signature([0; 64]).into(), transaction), Error::InvalidNonce ); } @@ -262,7 +269,7 @@ fn batch_secondary_with_permissions() { bob.origin(), low_risk_name.clone() )); - assert_last_event!(EventTest::pallet_portfolio( + assert_last_event!(EventTest::Portfolio( pallet_portfolio::Event::PortfolioCreated(_, _, _) )); check_name(low_risk_name.clone()); @@ -282,12 +289,12 @@ fn batch_secondary_with_permissions() { extrinsic: SubsetRestriction::These(bob_pallet_permissions.into_iter().collect()), ..Permissions::default() }; - assert_ok!(Identity::set_permission_to_signer( + assert_ok!(Identity::set_secondary_key_permissions( alice.origin(), - bob.signatory_acc(), + bob.acc(), bob_permissions, )); - let bob_secondary_key = &Identity::did_records(&alice.did).secondary_keys[0]; + let bob_secondary_key = &get_secondary_keys(alice.did)[0]; let check_permission = |name: &[u8], t| { assert_eq!( t, @@ -306,16 +313,18 @@ fn batch_secondary_with_permissions() { // Call one disallowed and one allowed extrinsic in a batch. let calls = vec![ - Call::Portfolio(PortfolioCall::create_portfolio(high_risk_name.clone())), - Call::Portfolio(PortfolioCall::rename_portfolio( - 1u64.into(), - high_risk_name.clone(), - )), + Call::Portfolio(PortfolioCall::create_portfolio { + name: high_risk_name.clone(), + }), + Call::Portfolio(PortfolioCall::rename_portfolio { + num: 1u64.into(), + to_name: high_risk_name.clone(), + }), ]; assert_ok!(Utility::batch(bob.origin(), calls.clone())); - assert_event_doesnt_exist!(EventTest::pallet_utility(Event::BatchCompleted(_))); + assert_event_doesnt_exist!(EventTest::Utility(Event::BatchCompleted(_))); assert_event_exists!( - EventTest::pallet_utility(Event::BatchInterrupted(events, err)), + EventTest::Utility(Event::BatchInterrupted(events, err)), events == &[0] && err.0 == 0 ); check_name(low_risk_name); @@ -323,7 +332,7 @@ fn batch_secondary_with_permissions() { // Call the same extrinsics optimistically. assert_ok!(Utility::batch_optimistic(bob.origin(), calls)); assert_event_exists!( - EventTest::pallet_utility(Event::BatchOptimisticFailed(events, errors)), + EventTest::Utility(Event::BatchOptimisticFailed(events, errors)), events == &[0, 1] && errors.len() == 1 && errors[0].0 == 0 ); check_name(high_risk_name); diff --git a/pallets/settlement/Cargo.toml b/pallets/settlement/Cargo.toml index 934763ff78..43d6ac2618 100644 --- a/pallets/settlement/Cargo.toml +++ b/pallets/settlement/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-settlement" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -20,25 +20,25 @@ pallet-statistics = { path = "../statistics", default-features = false } serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = "0.2.1" hex = { version = "0.4.2", optional = true } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-serializer = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -#pallet-contracts = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +#pallet-contracts = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } # Only in STD -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/settlement/src/benchmarking.rs b/pallets/settlement/src/benchmarking.rs index 909a548e18..fb113b70df 100644 --- a/pallets/settlement/src/benchmarking.rs +++ b/pallets/settlement/src/benchmarking.rs @@ -18,7 +18,6 @@ use crate::*; pub use frame_benchmarking::{account, benchmarks}; use frame_support::traits::Get; use frame_system::RawOrigin; -//use pallet_contracts::ContractAddressFor; use pallet_identity as identity; use pallet_portfolio::PortfolioAssetBalances; use polymesh_common_utilities::{ @@ -29,9 +28,11 @@ use polymesh_common_utilities::{ TestUtilsFn, }; use polymesh_primitives::{ - checked_inc::CheckedInc, statistics::TransferManager, Claim, Condition, ConditionType, - CountryCode, IdentityId, PortfolioId, PortfolioName, PortfolioNumber, Scope, Ticker, - TrustedIssuer, + checked_inc::CheckedInc, + statistics::{Stat2ndKey, StatType, StatUpdate}, + transfer_compliance::{TransferCondition, TransferConditionExemptKey}, + Claim, Condition, ConditionType, CountryCode, IdentityId, PortfolioId, PortfolioName, + PortfolioNumber, Scope, Ticker, TrustedIssuer, }; //use sp_runtime::traits::Hash; use sp_runtime::SaturatedConversion; @@ -63,7 +64,7 @@ impl From> for UserData { } fn set_block_number(new_block_no: u64) { - system::Module::::set_block_number(new_block_no.saturated_into::()); + frame_system::Pallet::::set_block_number(new_block_no.saturated_into::()); } fn creator>>() -> User { @@ -416,39 +417,6 @@ fn setup_affirm_instruction>>( (portfolios_to, from_data, to_data, tickers, legs) } -/* -#[allow(dead_code)] -fn add_smart_extension_to_ticker( - code_hash: ::Output, - origin: RawOrigin, - account: T::AccountId, - ticker: Ticker, -) { - let data = vec![ - 209, 131, 81, 43, 160, 134, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - ]; // Allow 100% as percentage ownership and allow primary issuance. - >::instantiate( - origin.clone().into(), - 0u32.into(), - Weight::max_value(), - code_hash, - data.clone(), - 0u32.into(), - ) - .expect("Settlement: Failed to instantiate the contract"); - let extension_id = - T::DetermineContractAddress::contract_address_for(&code_hash, &data, &account); - let extension_details = SmartExtension { - extension_type: SmartExtensionType::TransferManager, - extension_name: b"PTM".into(), - extension_id: extension_id.clone(), - is_archive: false, - }; - >::add_extension(origin.into(), ticker, extension_details) - .expect("Settlement: Fail to add the smart extension to a given asset"); -} -*/ - fn create_receipt_details>>( index: u32, leg: Leg, @@ -484,31 +452,61 @@ fn create_receipt_details>>( } } -pub fn add_transfer_managers( +pub const MAX_CONDITIONS: u32 = 3; + +pub fn add_transfer_conditions( ticker: Ticker, origin: RawOrigin, exempted_entity: IdentityId, - count: u32, + count_conditions: u32, ) { - for i in 0..count { - let tm = TransferManager::CountTransferManager(i.into()); - // Add Transfer manager - >::add_transfer_manager( - origin.clone().into(), - ticker, - tm.clone(), - ) - .expect("failed to add transfer manager"); - // Exempt the user. - >::add_exempted_entities( - origin.clone().into(), - ticker, - tm, - vec![exempted_entity], - ) - .expect("failed to add exempted entities"); - } - >::set_investor_count(&ticker, count.into()); + let stat_type = StatType::investor_count(); + // Add Investor count stat. + >::set_active_asset_stats( + origin.clone().into(), + ticker.into(), + [stat_type].iter().cloned().collect(), + ) + .expect("failed to add stats"); + + let conditions = (0..count_conditions) + .into_iter() + .map(|i| TransferCondition::MaxInvestorCount(i.into())) + .collect(); + // Add MaxInvestorCount transfer conditions. + >::set_asset_transfer_compliance( + origin.clone().into(), + ticker.into(), + conditions, + ) + .expect("failed to add transfer conditions"); + + // Exempt the user. + let exempt_key = TransferConditionExemptKey { + asset: ticker.into(), + op: stat_type.op, + claim_type: None, + }; + >::set_entities_exempt( + origin.clone().into(), + true, + exempt_key, + [exempted_entity].iter().cloned().collect(), + ) + .expect("failed to add exempted entities"); + + // Update investor count stats. + let update = StatUpdate { + key2: Stat2ndKey::NoClaimStat, + value: Some(count_conditions.into()), + }; + >::batch_update_asset_stats( + origin.clone().into(), + ticker.into(), + stat_type, + [update].iter().cloned().collect(), + ) + .expect("failed to add exempted entities"); } benchmarks! { @@ -790,7 +788,6 @@ benchmarks! { // 3. Assets have maximum no. of TMs. let l in 0 .. T::MaxLegsInInstruction::get() as u32; - let s = T::MaxTransferManagersPerAsset::get() as u32; let c = T::MaxConditionComplexity::get() as u32; // Setup affirm instruction (One party (i.e from) already affirms the instruction) @@ -814,7 +811,7 @@ benchmarks! { // for both assets also add the compliance rules as per the `MaxConditionComplexity`. for ticker in tickers { compliance_setup::(c, ticker, from_origin.clone(), from.did, to.did, trusted_issuer.clone()); - add_transfer_managers::(ticker, from_origin.clone(), from.did, s); + add_transfer_conditions::(ticker, from_origin.clone(), from.did, MAX_CONDITIONS); } // -------- Commented the smart extension integration ---------------- @@ -854,7 +851,7 @@ benchmarks! { pub fn next_block() { use frame_support::traits::OnInitialize; - let block_number = frame_system::Module::::block_number() + 1u32.into(); - frame_system::Module::::set_block_number(block_number); - pallet_scheduler::Module::::on_initialize(block_number); + let block_number = frame_system::Pallet::::block_number() + 1u32.into(); + frame_system::Pallet::::set_block_number(block_number); + pallet_scheduler::Pallet::::on_initialize(block_number); } diff --git a/pallets/settlement/src/lib.rs b/pallets/settlement/src/lib.rs index c25ffefd03..0881c5ab71 100644 --- a/pallets/settlement/src/lib.rs +++ b/pallets/settlement/src/lib.rs @@ -65,7 +65,7 @@ use frame_support::{ weights::Weight, IterableStorageDoubleMap, }; -use frame_system::{self as system, ensure_root, RawOrigin}; +use frame_system::{ensure_root, RawOrigin}; use pallet_base::{ensure_string_limited, try_next_post}; use pallet_identity::{self as identity, PermissionedCallOriginData}; use polymesh_common_utilities::{ @@ -80,11 +80,12 @@ use polymesh_primitives::{ impl_checked_inc, storage_migration_ver, Balance, IdentityId, PortfolioId, SecondaryKey, Ticker, }; use polymesh_primitives_derive::VecU8StrongTyped; +use scale_info::TypeInfo; use sp_runtime::traits::{One, Verify}; use sp_std::{collections::btree_set::BTreeSet, convert::TryFrom, prelude::*}; type Identity = identity::Module; -type System = frame_system::Module; +type System = frame_system::Pallet; type Asset = pallet_asset::Module; type ExternalAgents = pallet_external_agents::Module; @@ -111,18 +112,18 @@ pub trait Config: } /// A global and unique venue ID. -#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] pub struct VenueId(pub u64); impl_checked_inc!(VenueId); /// A wrapper for VenueDetails -#[derive( - Decode, Encode, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct VenueDetails(Vec); /// Status of an instruction -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum InstructionStatus { /// Invalid instruction or details pruned Unknown, @@ -139,7 +140,8 @@ impl Default for InstructionStatus { } /// Type of the venue. Used for offchain filtering. -#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum VenueType { /// Default type - used for mixed and unknown types Other, @@ -158,7 +160,7 @@ impl Default for VenueType { } /// Status of a leg -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum LegStatus { /// It is waiting for affirmation PendingTokenLock, @@ -175,7 +177,7 @@ impl Default for LegStatus { } /// Status of an affirmation -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum AffirmationStatus { /// Invalid affirmation Unknown, @@ -192,7 +194,8 @@ impl Default for AffirmationStatus { } /// Type of settlement -#[derive(Encode, Decode, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum SettlementType { /// Instruction should be settled in the next block as soon as all affirmations are received. SettleOnAffirmation, @@ -207,12 +210,14 @@ impl Default for SettlementType { } /// A per-Instruction leg ID. -#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] pub struct LegId(pub u64); impl_checked_inc!(LegId); /// A global and unique instruction ID. -#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] pub struct InstructionId(pub u64); impl_checked_inc!(InstructionId); @@ -223,8 +228,9 @@ impl InstructionId { } } -/// Details about an instruction -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] +/// Details about an instruction. +#[derive(Encode, Decode, TypeInfo)] +#[derive(Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct Instruction { /// Unique instruction id. It is an auto incrementing number pub instruction_id: InstructionId, @@ -242,8 +248,9 @@ pub struct Instruction { pub value_date: Option, } -/// Details of a leg including the leg id in the instruction -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] +/// Details of a leg including the leg id in the instruction. +#[derive(Encode, Decode, TypeInfo)] +#[derive(Default, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct Leg { /// Portfolio of the sender pub from: PortfolioId, @@ -255,8 +262,9 @@ pub struct Leg { pub amount: Balance, } -/// Details about a venue -#[derive(Encode, Decode, Clone, Default, PartialEq, Eq, Debug, PartialOrd, Ord)] +/// Details about a venue. +#[derive(Encode, Decode, TypeInfo)] +#[derive(Clone, Default, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct Venue { /// Identity of the venue's creator pub creator: IdentityId, @@ -280,13 +288,12 @@ pub struct Receipt { } /// A wrapper for VenueDetails -#[derive( - Decode, Encode, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct ReceiptMetadata(Vec); /// Details about an offchain transaction receipt that a user must input -#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)] pub struct ReceiptDetails { /// Unique receipt number set by the signer for their receipts pub receipt_uid: u64, @@ -871,7 +878,7 @@ decl_module! { })?; // Schedule instruction to be executed in the next block. - let execution_at = system::Module::::block_number() + One::one(); + let execution_at = System::::block_number() + One::one(); Self::schedule_instruction(id, execution_at, InstructionLegs::iter_prefix(id).count() as u32); Self::deposit_event(RawEvent::InstructionRescheduled(did, id)); @@ -971,7 +978,7 @@ impl Module { venue_id, status: InstructionStatus::Pending, settlement_type, - created_at: Some(>::get()), + created_at: Some(>::get()), trade_date, value_date, }; @@ -1083,7 +1090,7 @@ impl Module { } if let SettlementType::SettleOnBlock(block_number) = details.settlement_type { ensure!( - block_number > system::Module::::block_number(), + block_number > System::::block_number(), Error::::InstructionSettleBlockPassed ); } @@ -1136,26 +1143,29 @@ impl Module { } } - match with_transaction(|| { - Self::unchecked_release_locks(id, &legs); - - for (leg_id, leg_details) in legs.iter().filter(|(leg_id, _)| { - let status = Self::instruction_leg_status(id, leg_id); - status == LegStatus::ExecutionPending - }) { - if >::base_transfer( - leg_details.from, - leg_details.to, - &leg_details.asset, - leg_details.amount, - ) - .is_err() - { - return Err(leg_id); + use frame_support::storage::{with_transaction, TransactionOutcome}; + match with_transaction( + || -> TransactionOutcome, DispatchError>> { + Self::unchecked_release_locks(id, &legs); + + for (leg_id, leg_details) in legs.iter().filter(|(leg_id, _)| { + let status = Self::instruction_leg_status(id, leg_id); + status == LegStatus::ExecutionPending + }) { + if >::base_transfer( + leg_details.from, + leg_details.to, + &leg_details.asset, + leg_details.amount, + ) + .is_err() + { + return TransactionOutcome::Rollback(Ok(Err(*leg_id))); + } } - } - Ok(()) - }) { + TransactionOutcome::Commit(Ok(Ok(()))) + }, + )? { Ok(_) => { Self::deposit_event(RawEvent::InstructionExecuted(SettlementDID.as_id(), id)); } @@ -1179,9 +1189,9 @@ impl Module { let legs = InstructionLegs::drain_prefix(id).collect::>(); let details = >::take(id); VenueInstructions::remove(details.venue_id, id); - >::remove_prefix(id); + >::remove_prefix(id, None); InstructionAffirmsPending::remove(id); - AffirmsReceived::remove_prefix(id); + AffirmsReceived::remove_prefix(id, None); // We remove duplicates in memory before triggering storage actions let mut counter_parties = BTreeSet::new(); @@ -1343,7 +1353,7 @@ impl Module { && Self::instruction_details(id).settlement_type == SettlementType::SettleOnAffirmation { // Schedule instruction to be executed in the next block. - let execution_at = system::Module::::block_number() + One::one(); + let execution_at = System::::block_number() + One::one(); Self::schedule_instruction(id, execution_at, legs_count); } } @@ -1353,8 +1363,8 @@ impl Module { /// NB - It is expected to execute the given instruction into the given block number but /// it is not a guaranteed behavior, Scheduler may have other high priority task scheduled /// for the given block so there are chances where the instruction execution block no. may drift. - fn schedule_instruction(id: InstructionId, execution_at: T::BlockNumber, legs_count: u32) { - let call = Call::::execute_scheduled_instruction(id, legs_count).into(); + fn schedule_instruction(id: InstructionId, execution_at: T::BlockNumber, _legs_count: u32) { + let call = Call::::execute_scheduled_instruction { id, _legs_count }.into(); if let Err(_) = T::Scheduler::schedule_named( id.execution_name(), DispatchTime::At(execution_at), diff --git a/pallets/staking/Cargo.toml b/pallets/staking/Cargo.toml index 40b097ae0f..12fb710dc5 100644 --- a/pallets/staking/Cargo.toml +++ b/pallets/staking/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-staking" version = "2.0.0" authors = ["Parity Technologies "] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } @@ -12,30 +12,33 @@ pallet-identity = { path = "../identity", default-features = false} # General static_assertions = "1.1.0" serde = { version = "1.0.104", optional = true } +log = "0.4.8" # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false} -sp-runtime = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-staking = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -sp-npos-elections = { version = "3.0.0", default-features = false} +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false} +sp-runtime = { version = "6.0.0", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-staking = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false } +sp-npos-elections = { version = "4.0.0-dev", default-features = false} -pallet-session = { features = ["historical"], version = "3.0.0", default-features = false } -pallet-authorship = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } +pallet-session = { features = ["historical"], version = "4.0.0-dev", default-features = false } +pallet-authorship = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } # Optional imports for benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } rand_chacha = { version = "0.2", default-features = false, optional = true } [dev-dependencies] -pallet-staking-reward-curve = { version = "3.0.0", default-features = false } -sp-tracing = "3.0.0" +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false } +sp-tracing = "5.0.0" [features] default = ["std"] @@ -49,6 +52,7 @@ std = [ "sp-npos-elections/std", "sp-io/std", "frame-support/std", + "frame-election-provider-support/std", "sp-runtime/std", "sp-staking/std", "pallet-session/std", diff --git a/pallets/staking/rpc/Cargo.toml b/pallets/staking/rpc/Cargo.toml index 9c3de1effe..79ef2ed949 100644 --- a/pallets/staking/rpc/Cargo.toml +++ b/pallets/staking/rpc/Cargo.toml @@ -2,16 +2,16 @@ name = "pallet-staking-rpc" version = "2.0.0" authors = ["Anonymous"] -edition = "2018" +edition = "2021" [dependencies] -codec = { package = "parity-scale-codec", version = "2.0.0" } +codec = { package = "parity-scale-codec", version = "3.0.0" } serde = { version = "1.0.104", features = ["derive"] } -jsonrpc-core = "15.0.0" -jsonrpc-core-client = "15.0.0" -jsonrpc-derive = "15.0.0" -sp-runtime = { version = "3.0.0", default_features = false } -sp-blockchain = { version = "3.0.0", default_features = false} -sp-api = { version = "3.0.0", default_features = false} +jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } +jsonrpc-derive = "18.0.0" +sp-runtime = { version = "6.0.0", default_features = false } +sp-blockchain = { version = "4.0.0-dev", default_features = false} +sp-api = { version = "4.0.0-dev", default_features = false} pallet-staking-rpc-runtime-api = { version = "2.0.0", path = "./runtime-api" } diff --git a/pallets/staking/rpc/runtime-api/Cargo.toml b/pallets/staking/rpc/runtime-api/Cargo.toml index 9a95ae539f..1d17e84b83 100644 --- a/pallets/staking/rpc/runtime-api/Cargo.toml +++ b/pallets/staking/rpc/runtime-api/Cargo.toml @@ -2,12 +2,12 @@ name = "pallet-staking-rpc-runtime-api" version = "2.0.0" authors = ["Anonymous"] -edition = "2018" +edition = "2021" [dependencies] -sp-api = { version = "3.0.0", default_features = false} -sp-runtime = { version = "3.0.0", default_features = false} -frame-support = { version = "3.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default_features = false} +sp-runtime = { version = "6.0.0", default_features = false} +frame-support = { version = "4.0.0-dev", default-features = false } [dev-dependencies] serde_json = "1.0.48" diff --git a/pallets/staking/src/benchmarking.rs b/pallets/staking/src/benchmarking.rs index d84e290513..1059412341 100644 --- a/pallets/staking/src/benchmarking.rs +++ b/pallets/staking/src/benchmarking.rs @@ -556,7 +556,7 @@ benchmarks! { let v in 1 .. 10; let n in 1 .. 100; - create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None).unwrap(); + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS as usize, false, None).unwrap(); let session_index = SessionIndex::one(); }: { let validators = Staking::::new_era(session_index).ok_or("`new_era` failed")?; @@ -566,7 +566,7 @@ benchmarks! { payout_all { let v in 1 .. 10; let n in 1 .. 100; - create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None).unwrap(); + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS as usize, false, None).unwrap(); // Start a new Era let new_validators = Staking::::new_era(SessionIndex::one()).unwrap(); assert_eq!(new_validators.len(), v as usize); @@ -641,12 +641,12 @@ benchmarks! { // number of winners, also ValidatorCount let w in 16 .. 100; - assert!(w as usize >= MAX_NOMINATIONS, "doesn't support lower value"); + assert!(w as usize >= MAX_NOMINATIONS as usize, "doesn't support lower value"); let winners = create_validators_with_nominators_for_era::( v, n, - MAX_NOMINATIONS, + MAX_NOMINATIONS as usize, false, Some(w), ).unwrap(); @@ -712,12 +712,12 @@ benchmarks! { // number of winners, also ValidatorCount. let w in 16 .. 100; - assert!(w as usize >= MAX_NOMINATIONS, "doesn't support lower value"); + assert!(w as usize >= MAX_NOMINATIONS as usize, "doesn't support lower value"); let winners = create_validators_with_nominators_for_era::( v, n, - MAX_NOMINATIONS, + MAX_NOMINATIONS as usize, false, Some(w), ).unwrap(); @@ -801,7 +801,7 @@ benchmarks! { // number of nominator intent let n in 1000 .. 2000; - create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS, false, None).unwrap(); + create_validators_with_nominators_for_era::(v, n, MAX_NOMINATIONS as usize, false, None).unwrap(); // needed for the solution to be generates. assert!(>::create_stakers_snapshot().0); diff --git a/pallets/staking/src/inflation.rs b/pallets/staking/src/inflation.rs index 753ff59892..d1ffd2dc30 100644 --- a/pallets/staking/src/inflation.rs +++ b/pallets/staking/src/inflation.rs @@ -43,7 +43,7 @@ where // Milliseconds per year for the Julian year (365.25 days). const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; - let portion = Perbill::from_rational_approximation(era_duration as u64, MILLISECONDS_PER_YEAR); + let portion = Perbill::from_rational(era_duration as u64, MILLISECONDS_PER_YEAR); // Have fixed rewards kicked in? if total_tokens >= max_inflated_issuance { let payout = portion * non_inflated_yearly_reward; diff --git a/pallets/staking/src/lib.rs b/pallets/staking/src/lib.rs index ceee159692..c470843b34 100644 --- a/pallets/staking/src/lib.rs +++ b/pallets/staking/src/lib.rs @@ -295,6 +295,8 @@ pub mod offchain_election; pub mod inflation; pub mod weights; +use core::fmt; +use crate::_feps::NposSolution; use codec::{Decode, Encode, HasCompact}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, @@ -323,10 +325,15 @@ use pallet_identity as identity; use pallet_session::historical; use polymesh_common_utilities::{identity::Config as IdentityConfig, Context, GC_DID}; use polymesh_primitives::IdentityId; +use scale_info::TypeInfo; +use frame_election_provider_support::{ + generate_solution_type, +}; use sp_npos_elections::{ - generate_solution_type, is_score_better, seq_phragmen, to_support_map, Assignment, - CompactSolution, ElectionResult as PrimitiveElectionResult, ElectionScore, EvaluateSupport, - ExtendedBalance, PerThing128, SupportMap, VoteWeight, + seq_phragmen, to_support_map, + Assignment, ElectionResult as PrimitiveElectionResult, ElectionScore, + EvaluateSupport, ExtendedBalance, + PerThing128, Supports, SupportMap, VoteWeight, }; use sp_runtime::{ curve::PiecewiseLinear, @@ -338,12 +345,13 @@ use sp_runtime::{ InvalidTransaction, TransactionPriority, TransactionSource, TransactionValidity, TransactionValidityError, ValidTransaction, }, + ModuleError, DispatchError, PerU16, Perbill, Percent, Permill, RuntimeDebug, }; #[cfg(feature = "std")] use sp_runtime::{Deserialize, Serialize}; use sp_staking::{ - offence::{Offence, OffenceDetails, OffenceError, OnOffenceHandler, ReportOffence}, + offence::{DisableStrategy, Offence, OffenceDetails, OffenceError, OnOffenceHandler, ReportOffence}, SessionIndex, }; use sp_std::{ @@ -359,7 +367,6 @@ const STAKING_ID: LockIdentifier = *b"staking "; pub const MAX_UNLOCKING_CHUNKS: usize = 32; /// Maximum number of validators accounted for the weight estimation of `set_commission_cap`. pub const MAX_ALLOWED_VALIDATORS: u32 = 150; -pub const MAX_NOMINATIONS: usize = ::LIMIT; pub(crate) const LOG_TARGET: &'static str = "staking"; @@ -367,7 +374,7 @@ pub(crate) const LOG_TARGET: &'static str = "staking"; #[macro_export] macro_rules! log { ($level:tt, $patter:expr $(, $values:expr)* $(,)?) => { - frame_support::debug::$level!( + log::$level!( target: crate::LOG_TARGET, $patter $(, $values)* ) @@ -399,9 +406,16 @@ pub type RewardPoint = u32; // Note: Maximum nomination limit is set here -- 16. generate_solution_type!( #[compact] - pub struct CompactAssignments::(16) + pub struct CompactAssignments::< + VoterIndex = NominatorIndex, + TargetIndex = ValidatorIndex, + Accuracy = OffchainAccuracy, + MaxVoters = frame_support::traits::ConstU32::<10_000> + >(16) ); +pub const MAX_NOMINATIONS: u32 = ::LIMIT as u32; + /// Accuracy used for on-chain election. pub type ChainAccuracy = Perbill; @@ -431,7 +445,7 @@ impl CompactAssignments { } /// Information regarding the active era (era in used in session). -#[derive(Encode, Decode, RuntimeDebug)] +#[derive(Encode, Decode, RuntimeDebug, TypeInfo)] pub struct ActiveEraInfo { /// Index of era. pub index: EraIndex, @@ -445,7 +459,7 @@ pub struct ActiveEraInfo { /// Reward points of an era. Used to split era total payout between validators. /// /// This points will be used to reward validators and their respective nominators. -#[derive(PartialEq, Encode, Decode, Default, RuntimeDebug)] +#[derive(PartialEq, Encode, Decode, Default, RuntimeDebug, TypeInfo)] pub struct EraRewardPoints { /// Total number of points. Equals the sum of reward points for each validator. pub total: RewardPoint, @@ -454,7 +468,7 @@ pub struct EraRewardPoints { } /// Indicates the initial status of the staker. -#[derive(RuntimeDebug)] +#[derive(RuntimeDebug, TypeInfo)] #[derive(Clone)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum StakerStatus { @@ -467,7 +481,7 @@ pub enum StakerStatus { } /// A destination account for payment. -#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub enum RewardDestination { /// Pay into the stash account, increasing the amount at stake accordingly. Staked, @@ -486,7 +500,7 @@ impl Default for RewardDestination { } /// Preference of what happens regarding validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct ValidatorPrefs { /// Reward that validator takes up-front; only the rest is split between themselves and /// nominators. @@ -513,7 +527,7 @@ impl Default for ValidatorPrefs { // ----------------------------------------------------------------------------- /// Preference of an identity regarding validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct PermissionedIdentityPrefs { /// Intended number of validators an identity wants to run. /// @@ -541,7 +555,7 @@ impl PermissionedIdentityPrefs { // ----------------------------------------------------------------------------- /// Just a Balance/BlockNumber tuple to encode when a chunk of funds will be unlocked. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct UnlockChunk { /// Amount of funds to be unlocked. #[codec(compact)] @@ -552,7 +566,7 @@ pub struct UnlockChunk { } /// The ledger of a (bonded) stash. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct StakingLedger { /// The stash account whose balance is actually locked and at stake. pub stash: AccountId, @@ -681,7 +695,7 @@ impl StakingLedger where } /// A record of the nominations made by a specific account. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct Nominations { /// The targets of nomination. pub targets: Vec, @@ -697,7 +711,7 @@ pub struct Nominations { } /// The amount of exposure (to slashing) than an individual nominator has. -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct IndividualExposure { /// The stash account of the nominator in question. pub who: AccountId, @@ -707,7 +721,7 @@ pub struct IndividualExposure { } /// A snapshot of the stake backing a single validator in the system. -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, Default, RuntimeDebug)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo)] pub struct Exposure { /// The total balance backing this validator. #[codec(compact)] @@ -721,7 +735,7 @@ pub struct Exposure { /// A pending slash record. The value of the slash has been computed but not applied yet, /// rather deferred for several eras. -#[derive(Encode, Decode, Default, RuntimeDebug)] +#[derive(Encode, Decode, Default, RuntimeDebug, TypeInfo)] pub struct UnappliedSlash { /// The stash ID of the offending validator. pub validator: AccountId, @@ -736,7 +750,7 @@ pub struct UnappliedSlash { } /// Indicate how an election round was computed. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug, TypeInfo)] pub enum ElectionCompute { /// Result was forcefully computed on chain at the end of the session. OnChain, @@ -748,7 +762,7 @@ pub enum ElectionCompute { } /// The result of an election round. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub struct ElectionResult { /// Flat list of validators who have been elected. elected_stashes: Vec, @@ -760,7 +774,7 @@ pub struct ElectionResult { } /// The status of the upcoming (offchain) election. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, RuntimeDebug)] pub enum ElectionStatus { /// Nothing has and will happen for now. submission window is not open. Closed, @@ -773,7 +787,7 @@ pub enum ElectionStatus { /// Note that these values must reflect the __total__ number, not only those that are present in the /// solution. In short, these should be the same size as the size of the values dumped in /// `SnapshotValidators` and `SnapshotNominators`. -#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug, Default)] +#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, TypeInfo, RuntimeDebug, Default)] pub struct ElectionSize { /// Number of validators in the snapshot of the current election round. #[codec(compact)] @@ -835,15 +849,15 @@ impl SessionInterface<::AccountId> for T w Convert<::AccountId, Option<::AccountId>>, { fn disable_validator(validator: &::AccountId) -> Result { - >::disable(validator) + Ok(>::disable(validator)) } fn validators() -> Vec<::AccountId> { - >::validators() + >::validators() } fn prune_historical_up_to(up_to: SessionIndex) { - >::prune_up_to(up_to); + >::prune_up_to(up_to); } } @@ -868,6 +882,9 @@ pub trait Config: /// [`BalanceOf`]. type CurrencyToVote: CurrencyToVote>; + /// Maximum number of nominations per nominator. + const MAX_NOMINATIONS: u32; + /// Tokens have been minted and are unused for validator-reward. /// See [Era payout](./index.html#era-payout). type RewardRemainder: OnUnbalanced>; @@ -978,7 +995,7 @@ pub trait Config: } /// Mode of era-forcing. -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum Forcing { /// Not forcing anything - just let whatever happen. @@ -997,7 +1014,7 @@ impl Default for Forcing { /// Switch used to change the "victim" for slashing. Victims can be /// validators, both validators and nominators, or no-one. -#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] +#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, TypeInfo, RuntimeDebug)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum SlashingSwitch { /// Allow validators but not nominators to get slashed. @@ -1017,7 +1034,7 @@ impl Default for SlashingSwitch { // A value placed in storage that represents the current version of the Staking storage. This value // is used by the `on_runtime_upgrade` logic to determine whether we run storage migration logic. // This should match directly with the semantic versions of the Rust crate. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] enum Releases { V1_0_0Ancient, V2_0_0, @@ -1564,7 +1581,8 @@ decl_module! { // either current session final based on the plan, or we're forcing. (Self::is_current_session_final() || Self::will_era_be_forced()) { - if let Some(next_session_change) = T::NextNewSession::estimate_next_new_session(now) { + let (maybe_next_session_change, estimate_next_new_session_weight) = T::NextNewSession::estimate_next_new_session(now); + if let Some(next_session_change) = maybe_next_session_change { if let Some(remaining) = next_session_change.checked_sub(&now) { if remaining <= T::ElectionLookahead::get() && !remaining.is_zero() { // create snapshot. @@ -1586,7 +1604,7 @@ decl_module! { } else { log!(warn, "💸 Estimating next session change failed."); } - add_weight(0, 0, T::NextNewSession::weight(now)) + add_weight(0, 0, estimate_next_new_session_weight) } // For `era_election_status`, `is_current_session_final`, `will_era_be_forced` add_weight(3, 0, 0); @@ -1603,7 +1621,7 @@ decl_module! { if Self::era_election_status().is_open_at(now) { let offchain_status = set_check_offchain_execution_status::(now); if let Err(why) = offchain_status { - log!(warn, "💸 skipping offchain worker in open election window due to [{}]", why); + log!(warn, "💸 skipping offchain worker in open election window due to [{:?}]", why); } else { if let Err(e) = compute_offchain_election::() { log!(error, "💸 Error in election offchain worker: {:?}", e); @@ -1636,25 +1654,6 @@ decl_module! { T::BondingDuration::get(), ) ); - - use sp_runtime::UpperOf; - // see the documentation of `Assignment::try_normalize`. Now we can ensure that this - // will always return `Ok`. - // 1. Maximum sum of Vec must fit into `UpperOf`. - assert!( - >>::try_into(MAX_NOMINATIONS) - .unwrap() - .checked_mul(::one().deconstruct().try_into().unwrap()) - .is_some() - ); - - // 2. Maximum sum of Vec must fit into `UpperOf`. - assert!( - >>::try_into(MAX_NOMINATIONS) - .unwrap() - .checked_mul(::one().deconstruct().try_into().unwrap()) - .is_some() - ); } /// Take the origin account as a stash and lock up `value` of its balance. `controller` will @@ -1704,7 +1703,7 @@ decl_module! { Err(Error::::InsufficientValue)? } - system::Module::::inc_consumers(&stash).map_err(|_| Error::::BadState)?; + system::Pallet::::inc_consumers(&stash).map_err(|_| Error::::BadState)?; // You're auto-bonded forever, here. We might improve this by only bonding when // you actually validate/nominate and remove once you unbond __everything__. @@ -1962,7 +1961,7 @@ decl_module! { let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; let stash = &ledger.stash; ensure!(!targets.is_empty(), Error::::EmptyTargets); - ensure!(targets.len() <= MAX_NOMINATIONS, Error::::TooManyTargets); + ensure!(targets.len() <= T::MAX_NOMINATIONS as usize, Error::::TooManyTargets); let old = Nominators::::get(stash).map_or_else(Vec::new, |x| x.targets); @@ -2772,7 +2771,7 @@ impl Module { // This is the fraction of the total reward that the validator and the // nominators will get. - let validator_total_reward_part = Perbill::from_rational_approximation( + let validator_total_reward_part = Perbill::from_rational( validator_reward_points, total_reward_points, ); @@ -2787,7 +2786,7 @@ impl Module { let validator_leftover_payout = validator_total_payout - validator_commission_payout; // Now let's calculate how this is split to the validator. - let validator_exposure_part = Perbill::from_rational_approximation( + let validator_exposure_part = Perbill::from_rational( exposure.own, exposure.total, ); @@ -2808,7 +2807,7 @@ impl Module { // Lets now calculate how this is split to the nominators. // Reward only the clipped exposures. Note this is not necessarily sorted. for nominator in exposure.others.iter() { - let nominator_exposure_part = Perbill::from_rational_approximation( + let nominator_exposure_part = Perbill::from_rational( nominator.value, exposure.total, ); @@ -2962,7 +2961,7 @@ impl Module { // assume the given score is valid. Is it better than what we have on-chain, if we have any? if let Some(queued_score) = Self::queued_score() { ensure!( - is_score_better(score, queued_score, T::MinSolutionScoreBump::get()), + score.strict_threshold_better(queued_score, T::MinSolutionScoreBump::get()), Error::::OffchainElectionWeakSubmission.with_weight(T::DbWeight::get().reads(3)), ) } @@ -3115,15 +3114,15 @@ impl Module { ); // build the support map thereof in order to evaluate. - let supports = to_support_map::(&winners, &staked_assignments) - .map_err(|_| Error::::OffchainElectionBogusEdge)?; + let supports_map = to_support_map::(&staked_assignments); + let supports = supports_map.clone().into_iter().collect::>(); // Check if the score is the same as the claimed one. let submitted_score = (&supports).evaluate(); ensure!(submitted_score == claimed_score, Error::::OffchainElectionBogusScore); // At last, alles Ok. Exposures and store the result. - let exposures = Self::collect_exposure(supports); + let exposures = Self::collect_exposure(supports_map); log!( info, "💸 A better solution (with compute {:?} and score {:?}) has been validated and stored on chain.", @@ -3238,7 +3237,7 @@ impl Module { let rest = max_payout.saturating_sub(validator_payout); // Schedule Rewards for the validators - let next_block_no = >::block_number() + 1u32.into(); + let next_block_no = >::block_number() + 1u32.into(); for (index, validator_id) in T::SessionInterface::validators().into_iter().enumerate() { let schedule_block_no = next_block_no + index.saturated_into::(); match T::RewardScheduler::schedule( @@ -3246,7 +3245,10 @@ impl Module { None, HIGHEST_PRIORITY, RawOrigin::Root.into(), - Call::::payout_stakers_by_system(validator_id.clone(), active_era.index).into() + Call::::payout_stakers_by_system { + validator_stash: validator_id.clone(), + era: active_era.index, + }.into() ) { Ok(_) => log!( info, @@ -3405,17 +3407,7 @@ impl Module { Self::slashable_balance_of_fn(), ); - let supports = to_support_map::( - &elected_stashes, - &staked_assignments, - ) - .map_err(|_| - log!( - error, - "💸 on-chain phragmen is failing due to a problem in the result. This must be a bug." - ) - ) - .ok()?; + let supports = to_support_map::(&staked_assignments); // collect exposures let exposures = Self::collect_exposure(supports); @@ -3497,7 +3489,7 @@ impl Module { ); None } else { - seq_phragmen::<_, Accuracy>( + seq_phragmen( Self::validator_count() as usize, all_validators, all_nominators, @@ -3561,16 +3553,16 @@ impl Module { >::remove(stash); >::remove(stash); - system::Module::::dec_consumers(stash); + system::Pallet::::dec_consumers(stash); Ok(()) } /// Clear all era information for given era. fn clear_era_information(era_index: EraIndex) { - >::remove_prefix(era_index); - >::remove_prefix(era_index); - >::remove_prefix(era_index); + >::remove_prefix(era_index, None); + >::remove_prefix(era_index, None); + >::remove_prefix(era_index, None); >::remove(era_index); >::remove(era_index); >::remove(era_index); @@ -3707,37 +3699,42 @@ impl Module { /// /// Once the first new_session is planned, all session must start and then end in order, though /// some session can lag in between the newest session planned and the latest session started. -impl pallet_session::SessionManager for Module { +impl pallet_session::SessionManager for Module +where ::BlockNumber: fmt::Display +{ fn new_session(new_index: SessionIndex) -> Option> { - frame_support::debug::native::trace!( + log::trace!( target: LOG_TARGET, "[{}] planning new_session({})", - >::block_number(), + >::block_number(), new_index ); Self::new_session(new_index) } fn start_session(start_index: SessionIndex) { - frame_support::debug::native::trace!( + log::trace!( target: LOG_TARGET, "[{}] starting start_session({})", - >::block_number(), + >::block_number(), start_index ); Self::start_session(start_index) } fn end_session(end_index: SessionIndex) { - frame_support::debug::native::trace!( + log::trace!( target: LOG_TARGET, "[{}] ending end_session({})", - >::block_number(), + >::block_number(), end_index ); Self::end_session(end_index) } } -impl historical::SessionManager>> for Module { +impl historical::SessionManager>> +for Module +where ::BlockNumber: fmt::Display +{ fn new_session(new_index: SessionIndex) -> Option>)>> { @@ -3771,11 +3768,13 @@ where fn note_author(author: T::AccountId) { Self::reward_by_ids(vec![(author, 20)]) } - fn note_uncle(author: T::AccountId, _age: T::BlockNumber) { - Self::reward_by_ids(vec![ - (>::author(), 2), - (author, 1) - ]) + fn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber) { + // defensive-only: block author must exist. + if let Some(block_author) =>::author() { + Self::reward_by_ids(vec![(block_author, 2), (uncle_author, 1)]) + } else { + crate::log!(warn, "block author not set, this should never happen"); + } } } @@ -3828,11 +3827,8 @@ for Module where offenders: &[OffenceDetails>], slash_fraction: &[Perbill], slash_session: SessionIndex, - ) -> Result { - if !Self::can_report() { - return Err(()) - } - + _disable_strategy: DisableStrategy, + ) -> u64 { // Polymesh-Note: // When slashing is off or allowed for none, set slash fraction to zero. // --------------------------------------------------------------------- @@ -3856,7 +3852,7 @@ for Module where add_db_reads_writes(1, 0); if active_era.is_none() { // this offence need not be re-submitted. - return Ok(consumed_weight) + return consumed_weight } active_era.expect("value checked not to be `None`; qed").index }; @@ -3881,7 +3877,7 @@ for Module where match eras.iter().rev().filter(|&&(_, ref sesh)| sesh <= &slash_session).next() { Some(&(ref slash_era, _)) => *slash_era, // before bonding period. defensive - should be filtered out. - None => return Ok(consumed_weight), + None => return consumed_weight, } }; @@ -3949,11 +3945,7 @@ for Module where } } - Ok(consumed_weight) - } - - fn can_report() -> bool { - Self::era_election_status().is_closed() + consumed_weight } } @@ -3992,13 +3984,7 @@ impl ReportOffence impl frame_support::unsigned::ValidateUnsigned for Module { type Call = Call; fn validate_unsigned(source: TransactionSource, call: &Self::Call) -> TransactionValidity { - if let Call::submit_election_solution_unsigned( - _, - _, - score, - era, - _, - ) = call { + if let Call::submit_election_solution_unsigned { score, era, .. } = call { use offchain_election::DEFAULT_LONGEVITY; // discard solution not coming from the local OCW. @@ -4024,7 +4010,7 @@ impl frame_support::unsigned::ValidateUnsigned for Module { ValidTransaction::with_tag_prefix("StakingOffchain") // The higher the score[0], the better a solution is. - .priority(T::UnsignedPriority::get().saturating_add(score[0].saturated_into())) + .priority(T::UnsignedPriority::get().saturating_add(score.minimal_stake.saturated_into())) // Defensive only. A single solution can exist in the pool per era. Each validator // will run OCW at most once per era, hence there should never exist more than one // transaction anyhow. @@ -4046,13 +4032,7 @@ impl frame_support::unsigned::ValidateUnsigned for Module { } fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { - if let Call::submit_election_solution_unsigned( - _, - _, - score, - era, - _, - ) = call { + if let Call::submit_election_solution_unsigned { score, era, .. } = call { // IMPORTANT NOTE: These checks are performed in the dispatch call itself, yet we need // to duplicate them here to prevent a block producer from putting a previously // validated, yet no longer valid solution on chain. @@ -4080,7 +4060,7 @@ fn is_sorted_and_unique(list: &[u32]) -> bool { fn to_invalid(error_with_post_info: DispatchErrorWithPostInfo) -> InvalidTransaction { let error = error_with_post_info.error; let error_number = match error { - DispatchError::Module { error, ..} => error, + DispatchError::Module(ModuleError { error, .. }) => error[0], _ => 0, }; InvalidTransaction::Custom(error_number) diff --git a/pallets/staking/src/offchain_election.rs b/pallets/staking/src/offchain_election.rs index 5983ca5c8a..3273f56201 100644 --- a/pallets/staking/src/offchain_election.rs +++ b/pallets/staking/src/offchain_election.rs @@ -17,6 +17,7 @@ //! Helpers for offchain worker election. +use crate::_feps::NposSolution; use crate::{ Call, CompactAssignments, Config, ElectionSize, Module, NominatorIndex, Nominators, OffchainAccuracy, ValidatorIndex, @@ -25,10 +26,14 @@ use codec::Decode; use frame_support::{traits::Get, weights::Weight, IterableStorageMap}; use frame_system::offchain::SubmitTransaction; use sp_npos_elections::{ - reduce, to_support_map, Assignment, CompactSolution, ElectionResult, ElectionScore, - EvaluateSupport, ExtendedBalance, + EvaluateSupport, + reduce, to_supports, Assignment, ElectionResult, ElectionScore, ExtendedBalance, +}; +use sp_runtime::{ + offchain::storage::{StorageValueRef, MutateStorageError}, + traits::TrailingZeroInput, + RuntimeDebug, }; -use sp_runtime::{offchain::storage::StorageValueRef, traits::TrailingZeroInput, RuntimeDebug}; use sp_std::{convert::TryInto, prelude::*}; /// Error types related to the offchain election machinery. @@ -71,18 +76,18 @@ pub(crate) const DEFAULT_LONGEVITY: u64 = 25; /// Returns `Ok(())` if offchain worker should happen, `Err(reason)` otherwise. pub fn set_check_offchain_execution_status( now: T::BlockNumber, -) -> Result<(), &'static str> { +) -> Result<(), MutateStorageError<::BlockNumber, &'static str>> { let storage = StorageValueRef::persistent(&OFFCHAIN_HEAD_DB); let threshold = T::BlockNumber::from(OFFCHAIN_REPEAT); let mutate_stat = - storage.mutate::<_, &'static str, _>(|maybe_head: Option>| { + storage.mutate::<_, &'static str, _>(|maybe_head| { match maybe_head { - Some(Some(head)) if now < head => Err("fork."), - Some(Some(head)) if now >= head && now <= head + threshold => { + Ok(Some(head)) if now < head => Err("fork."), + Ok(Some(head)) if now >= head && now <= head + threshold => { Err("recently executed.") } - Some(Some(head)) if now > head + threshold => { + Ok(Some(head)) if now > head + threshold => { // we can run again now. Write the new head. Ok(now) } @@ -93,14 +98,7 @@ pub fn set_check_offchain_execution_status( } }); - match mutate_stat { - // all good - Ok(Ok(_)) => Ok(()), - // failed to write. - Ok(Err(_)) => Err("failed to write to offchain db."), - // fork etc. - Err(why) => Err(why), - } + mutate_stat.map(drop) } /// The internal logic of the offchain worker of this module. This runs the phragmen election, @@ -131,16 +129,16 @@ pub(crate) fn compute_offchain_election() -> Result<(), OffchainElect ); // defensive-only: current era can never be none except genesis. - let current_era = >::current_era().unwrap_or_default(); + let era = >::current_era().unwrap_or_default(); // send it. - let call = Call::submit_election_solution_unsigned( + let call = Call::submit_election_solution_unsigned { winners, compact, score, - current_era, + era, size, - ).into(); + }.into(); SubmitTransaction::>::submit_unsigned_transaction(call) .map_err(|_| OffchainElectionError::PoolSubmissionFailed) @@ -359,7 +357,7 @@ pub fn prepare_submission( }; // Clean winners. - let winners = sp_npos_elections::to_without_backing(winners); + let winners = winners.into_iter().map(|(who, _)| who).collect::>(); // convert into absolute value and to obtain the reduced version. let mut staked = sp_npos_elections::assignment_ratio_to_staked( @@ -378,7 +376,7 @@ pub fn prepare_submission( // compact encode the assignment. let compact = CompactAssignments::from_assignment( - low_accuracy_assignment, + &low_accuracy_assignment, nominator_index, validator_index, ) @@ -417,8 +415,7 @@ pub fn prepare_submission( >::slashable_balance_of_fn(), ); - let support_map = to_support_map::(&winners, &staked) - .map_err(|_| OffchainElectionError::ElectionFailed)?; + let support_map = to_supports::(&staked); support_map.evaluate() }; diff --git a/pallets/staking/src/slashing.rs b/pallets/staking/src/slashing.rs index 1610299221..9349f1588c 100644 --- a/pallets/staking/src/slashing.rs +++ b/pallets/staking/src/slashing.rs @@ -54,6 +54,7 @@ use super::{ NegativeImbalanceOf, UnappliedSlash, Error, SlashingSwitch, }; +use scale_info::TypeInfo; use sp_runtime::{traits::{Zero, Saturating}, RuntimeDebug, DispatchResult}; use frame_support::{ StorageMap, StorageDoubleMap, ensure, @@ -70,7 +71,7 @@ const REWARD_F1: Perbill = Perbill::from_percent(50); pub type SpanIndex = u32; // A range of start..end eras for a slashing span. -#[derive(Encode, Decode)] +#[derive(Encode, Decode, TypeInfo)] #[cfg_attr(feature = "std", derive(Debug, PartialEq))] pub struct SlashingSpan { pub index: SpanIndex, @@ -85,7 +86,7 @@ impl SlashingSpan { } /// An encoding of all of a nominator's slashing spans. -#[derive(Encode, Decode, RuntimeDebug)] +#[derive(Encode, Decode, RuntimeDebug, TypeInfo)] pub struct SlashingSpans { // the index of the current slashing span of the nominator. different for // every stash, resets when the account hits free balance 0. @@ -175,7 +176,7 @@ impl SlashingSpans { } /// A slashing-span record for a particular stash. -#[derive(Encode, Decode, Default)] +#[derive(Encode, Decode, Default, TypeInfo)] pub struct SpanRecord { slashed: Balance, paid_out: Balance, @@ -549,8 +550,8 @@ impl<'a, T: 'a + Config> Drop for InspectingSpans<'a, T> { /// Clear slashing metadata for an obsolete era. pub(crate) fn clear_era_metadata(obsolete_era: EraIndex) { - as Store>::ValidatorSlashInEra::remove_prefix(&obsolete_era); - as Store>::NominatorSlashInEra::remove_prefix(&obsolete_era); + as Store>::ValidatorSlashInEra::remove_prefix(&obsolete_era, None); + as Store>::NominatorSlashInEra::remove_prefix(&obsolete_era, None); } /// Clear slashing metadata for a dead account. diff --git a/pallets/staking/src/testing_utils.rs b/pallets/staking/src/testing_utils.rs index ef423dd513..c66c0ac96d 100644 --- a/pallets/staking/src/testing_utils.rs +++ b/pallets/staking/src/testing_utils.rs @@ -39,8 +39,8 @@ const SEED: u32 = 0; /// This function removes all validators and nominators from storage. pub fn clear_validators_and_nominators() { - Validators::::remove_all(); - Nominators::::remove_all(); + Validators::::remove_all(None); + Nominators::::remove_all(None); } /// Grab a funded user with the given balance. @@ -309,14 +309,13 @@ pub fn get_weak_solution( >::slashable_balance_of_fn(), ); - let support_map = - to_support_map::(winners.as_slice(), staked.as_slice()).unwrap(); + let support_map = to_supports::(staked.as_slice()); support_map.evaluate() }; // compact encode the assignment. let compact = CompactAssignments::from_assignment( - low_accuracy_assignment, + &low_accuracy_assignment, nominator_index, validator_index, ) @@ -405,7 +404,11 @@ pub fn get_single_winner_solution( votes1: vec![(nom_index, val_index)], ..Default::default() }; - let score = [stake, stake, stake * stake]; + let score = ElectionScore { + minimal_stake: stake, + sum_stake: stake, + sum_stake_squared: stake * stake + }; let size = ElectionSize { validators: snapshot_validators.len() as ValidatorIndex, nominators: snapshot_nominators.len() as NominatorIndex, @@ -439,7 +442,7 @@ pub fn create_assignments_for_offchain( ), &'static str, > { - let ratio = OffchainAccuracy::from_rational_approximation(1, MAX_NOMINATIONS); + let ratio = OffchainAccuracy::from_rational(1, MAX_NOMINATIONS); let assignments: Vec> = >::iter() .take(num_assignments as usize) .map(|(n, t)| Assignment { diff --git a/pallets/statistics/Cargo.toml b/pallets/statistics/Cargo.toml index e08a45659d..82d9104f3e 100644 --- a/pallets/statistics/Cargo.toml +++ b/pallets/statistics/Cargo.toml @@ -2,37 +2,39 @@ name = "pallet-statistics" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } polymesh-common-utilities = { path = "../common", default-features = false } pallet-external-agents = { path = "../external-agents", default-features = false } +pallet-identity = { path = "../identity", default-features = false } # Other +log = "0.4.8" serde = { version = "1.0.112", default-features = false } serde_derive = { version = "1.0.112", optional = true, default-features = false} # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } - -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } # Only in STD -substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-4.1.2", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymathNetwork/substrate", branch = "polymesh-monthly-2022-05", optional = true} # Only in Benchmarks -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [dev-dependencies] lazy_static = "1.4.0" diff --git a/pallets/statistics/src/benchmarking.rs b/pallets/statistics/src/benchmarking.rs index 654387a224..b4f5900f5f 100644 --- a/pallets/statistics/src/benchmarking.rs +++ b/pallets/statistics/src/benchmarking.rs @@ -4,24 +4,108 @@ use polymesh_common_utilities::{ benchs::{make_asset, AccountIdOf, User, UserBuilder}, traits::{asset::Config as Asset, TestUtilsFn}, }; -use polymesh_primitives::IdentityId; +use polymesh_primitives::{jurisdiction::*, statistics::*, ClaimType}; +use sp_std::collections::btree_set::BTreeSet; use sp_std::prelude::*; +const STAT_TYPES: &[(StatOpType, Option)] = &[ + (StatOpType::Count, None), + (StatOpType::Balance, None), + (StatOpType::Count, Some(ClaimType::Accredited)), + (StatOpType::Balance, Some(ClaimType::Accredited)), + (StatOpType::Count, Some(ClaimType::Affiliate)), + (StatOpType::Balance, Some(ClaimType::Affiliate)), + (StatOpType::Count, Some(ClaimType::Jurisdiction)), + (StatOpType::Balance, Some(ClaimType::Jurisdiction)), +]; + +fn make_stats(count: u32) -> BTreeSet { + (0..count as usize) + .into_iter() + .map(|idx| { + let (op, claim_type) = STAT_TYPES[idx % STAT_TYPES.len()]; + StatType { + op, + claim_issuer: claim_type.map(|ct| (ct, IdentityId::from(idx as u128))), + } + }) + .collect() +} + +fn make_jur_stat_updates(count: u32, value: Option) -> BTreeSet { + (0..count as usize) + .into_iter() + .map(|idx| StatUpdate { + key2: Stat2ndKey::Claim(StatClaim::Jurisdiction(Some( + COUNTRY_CODES[idx % COUNTRY_CODES.len()], + ))), + value, + }) + .collect() +} + +fn claim_type_to_stat_claim(claim_type: ClaimType) -> Option { + match claim_type { + ClaimType::Accredited => Some(StatClaim::Accredited(true)), + ClaimType::Affiliate => Some(StatClaim::Affiliate(true)), + ClaimType::Jurisdiction => Some(StatClaim::Jurisdiction(None)), + _ => None, + } +} + +fn make_transfer_conditions(stats: &BTreeSet, count: u32) -> BTreeSet { + let p0 = HashablePermill(sp_arithmetic::Permill::from_rational(0u32, 100u32)); + let p40 = HashablePermill(sp_arithmetic::Permill::from_rational(40u32, 100u32)); + (0..count as usize) + .into_iter() + .zip(stats.iter()) + .map(|(_idx, stat)| match (stat.op, stat.claim_issuer) { + (StatOpType::Count, None) => TransferCondition::MaxInvestorCount(10), + (StatOpType::Balance, None) => TransferCondition::MaxInvestorOwnership(p40), + (StatOpType::Count, Some((claim_type, issuer))) => { + let claim = claim_type_to_stat_claim(claim_type).expect("Unsupported ClaimType"); + TransferCondition::ClaimCount(claim, issuer, 0, Some(10)) + } + (StatOpType::Balance, Some((claim_type, issuer))) => { + let claim = claim_type_to_stat_claim(claim_type).expect("Unsupported ClaimType"); + TransferCondition::ClaimOwnership(claim, issuer, p0, p40) + } + }) + .collect() +} + fn init_ticker>>() -> (User, Ticker) { let owner = UserBuilder::::default().generate_did().build("OWNER"); let ticker = make_asset::(&owner, Some(b"1")); (owner, ticker) } -fn init_ctm>>( - max_transfer_manager_per_asset: u32, -) -> (User, Ticker, Vec) { +fn init_transfer_conditions>>( + count_stats: u32, + count_conditions: u32, +) -> ( + User, + Ticker, + BTreeSet, + BTreeSet, +) { let (owner, ticker) = init_ticker::(); - let tms = (0..max_transfer_manager_per_asset) - .map(|x| TransferManager::CountTransferManager(x.into())) - .collect::>(); - ActiveTransferManagers::insert(ticker, tms.clone()); - (owner, ticker, tms) + let stats = make_stats(count_stats); + let conditions = make_transfer_conditions(&stats, count_conditions); + (owner, ticker, stats, conditions) +} + +fn init_exempts>>( + count: u32, +) -> (User, TransferConditionExemptKey, BTreeSet) { + let (owner, ticker) = init_ticker::(); + let scope_ids = (0..count as u128).map(IdentityId::from).collect(); + let exempt_key = TransferConditionExemptKey { + asset: ticker.into(), + op: StatOpType::Count, + claim_type: Some(ClaimType::Accredited), + }; + (owner, exempt_key, scope_ids) } #[cfg(feature = "running-ci")] @@ -37,78 +121,47 @@ mod limits { benchmarks! { where_clause { where T: Asset, T: TestUtilsFn> } - add_transfer_manager { - let max_tm = T::MaxTransferManagersPerAsset::get().saturating_sub(1); - let (owner, ticker, mut tms) = init_ctm::(max_tm); + set_active_asset_stats { + let i in 1..T::MaxStatsPerAsset::get().saturating_sub(1); - let last_tm = TransferManager::CountTransferManager(420); - tms.push(last_tm.clone()); - }: _(owner.origin, ticker, last_tm) - verify { - assert_eq!(Module::::transfer_managers(ticker), tms); - } + let (owner, ticker, stats, _) = init_transfer_conditions::(i, 0); - remove_transfer_manager { - let (owner, ticker, mut tms) = init_ctm::(T::MaxTransferManagersPerAsset::get()); - let last_tm = tms.pop().expect("MaxTransferManagersPerAsset should be greater than zero"); - }: _(owner.origin, ticker, last_tm) - verify { - assert_eq!(Module::::transfer_managers(ticker), tms); - } + }: _(owner.origin, ticker.into(), stats) - add_exempted_entities { - // Length of the vector of Exempted identities being added. - let i in 0 .. limits::MAX_EXEMPTED_IDENTITIES; + batch_update_asset_stats { + let i in 1..COUNTRY_CODES.len() as u32; - let (owner, ticker) = init_ticker::(); - let scope_ids = (0..i as u128).map(IdentityId::from).collect::>(); - let tm = TransferManager::CountTransferManager(420); - let ephemeral_tm = tm.clone(); - }: _(owner.origin, ticker, ephemeral_tm, scope_ids) - verify { - assert!(Module::::entity_exempt((ticker, tm), IdentityId::from(0u128)) == (i != 0)); - } + let max_stats = T::MaxStatsPerAsset::get().saturating_sub(1); + let (owner, ticker, stats, _) = init_transfer_conditions::(max_stats, 0); - remove_exempted_entities { - // Length of the vector of Exempted identities being removed. - let i in 0 .. limits::MAX_EXEMPTED_IDENTITIES; + // Get a Jurisdiction stat type. + let stat_type = stats.iter().find(|s| match s.claim_issuer { + Some((ClaimType::Jurisdiction, _)) => true, + _ => false, + }).cloned().unwrap(); - let (owner, ticker) = init_ticker::(); - let tm = TransferManager::CountTransferManager(420); - let scope_ids = (0..i).map(|x| { - let scope_id = IdentityId::from(x as u128); - ExemptEntities::insert((ticker, tm.clone()), scope_id.clone(), true); - scope_id - }).collect::>(); - let ephemeral_tm = tm.clone(); - }: _(owner.origin, ticker, ephemeral_tm, scope_ids) - verify { - assert!(!Module::::entity_exempt((ticker, tm), IdentityId::from(0u128))); - } + // Set active stats. + Module::::set_active_asset_stats(owner.origin.clone().into(), ticker.into(), stats)?; - #[extra] - verify_tm_restrictions { - let t in 0 .. T::MaxTransferManagersPerAsset::get(); - - let (owner, ticker) = init_ticker::(); - let owner_did = owner.did.unwrap(); - let tms = (0..t).map(|x| { - let tm = TransferManager::CountTransferManager(x.into()); - ExemptEntities::insert((ticker, tm.clone()), owner_did, true); - tm - }).collect::>(); - ActiveTransferManagers::insert(ticker, tms.clone()); - InvestorCountPerAsset::insert(ticker, 1337); - }: { - // This will trigger the worse case (exemption) - Module::::verify_tm_restrictions( - &ticker, - owner_did, - owner_did, - 100u32.into(), - 200u32.into(), - 0u32.into(), - 500u32.into(), - ).unwrap(); - } + // Generate updates. + let updates = make_jur_stat_updates(i, Some(1000u128)); + }: _(owner.origin, ticker.into(), stat_type, updates) + + set_asset_transfer_compliance { + let i in 1..T::MaxTransferConditionsPerAsset::get().saturating_sub(1); + + let max_stats = T::MaxStatsPerAsset::get().saturating_sub(1); + let (owner, ticker, stats, conditions) = init_transfer_conditions::(max_stats, i); + + // Set active stats. + Module::::set_active_asset_stats(owner.origin.clone().into(), ticker.into(), stats)?; + + }: _(owner.origin, ticker.into(), conditions) + + set_entities_exempt { + // Number of exempt entities being added. + let i in 0 .. limits::MAX_EXEMPTED_IDENTITIES; + + let (owner, exempt_key, scope_ids) = init_exempts::(i); + }: set_entities_exempt(owner.origin, true, exempt_key, scope_ids) } diff --git a/pallets/statistics/src/lib.rs b/pallets/statistics/src/lib.rs index a03addbffe..92f297e455 100644 --- a/pallets/statistics/src/lib.rs +++ b/pallets/statistics/src/lib.rs @@ -14,36 +14,56 @@ // along with this program. If not, see . #![cfg_attr(not(feature = "std"), no_std)] +#![feature(const_option)] + #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; +use codec::{Decode, Encode}; use frame_support::{ - decl_error, decl_module, decl_storage, dispatch::DispatchResult, ensure, traits::Get, + decl_error, decl_module, decl_storage, + dispatch::{DispatchError, DispatchResult}, + ensure, + traits::Get, + weights::Weight, }; pub use polymesh_common_utilities::traits::statistics::{Config, Event, WeightInfo}; use polymesh_primitives::{ - statistics::{Counter, Percentage, TransferManager, TransferManagerResult}, - Balance, ScopeId, Ticker, + statistics::{ + AssetScope, Percentage, Stat1stKey, Stat2ndKey, StatOpType, StatType, StatUpdate, + }, + storage_migrate_on, storage_migration_ver, + transfer_compliance::*, + Balance, IdentityId, ScopeId, Ticker, }; -use sp_std::vec::Vec; +use sp_std::{collections::btree_set::BTreeSet, vec::Vec}; +type Identity = pallet_identity::Module; type ExternalAgents = pallet_external_agents::Module; +storage_migration_ver!(1); + decl_storage! { trait Store for Module as Statistics { - /// Transfer managers currently enabled for an Asset. - pub ActiveTransferManagers get(fn transfer_managers): map hasher(blake2_128_concat) Ticker => Vec; - /// Number of current investors in an asset. - pub InvestorCountPerAsset get(fn investor_count): map hasher(blake2_128_concat) Ticker => Counter; - /// Entities exempt from transfer managers. Exemptions requirements are based on TMS. - /// TMs may require just the sender, just the receiver, both or either to be exempted. - /// CTM requires sender to be exempted while PTM requires receiver to be exempted. - pub ExemptEntities get(fn entity_exempt): + /// Active stats for a ticker/company. There should be a max limit on the number of active stats for a ticker/company. + pub ActiveAssetStats get(fn active_asset_stats): map hasher(blake2_128_concat) AssetScope => BTreeSet; + /// Asset stats. + pub AssetStats get(fn asset_stats): + double_map + hasher(blake2_128_concat) Stat1stKey, + hasher(blake2_128_concat) Stat2ndKey => u128; + /// Asset transfer compliance for a ticker (AssetScope -> AssetTransferCompliance) + pub AssetTransferCompliances get(fn asset_transfer_compliance): map hasher(blake2_128_concat) AssetScope => AssetTransferCompliance; + /// Entities exempt from a Transfer Compliance rule. + pub TransferConditionExemptEntities get(fn transfer_condition_exempt_entities): double_map - hasher(blake2_128_concat) (Ticker, TransferManager), + hasher(blake2_128_concat) TransferConditionExemptKey, hasher(blake2_128_concat) ScopeId => bool; + + /// Storage migration version. + StorageVersion get(fn storage_version) build(|_| Version::new(1).unwrap()): Version; } } @@ -54,275 +74,872 @@ decl_module! { /// initialize the default event for this module fn deposit_event() = default; - const MaxTransferManagersPerAsset: u32 = T::MaxTransferManagersPerAsset::get(); + fn on_runtime_upgrade() -> Weight { + storage_migrate_on!(StorageVersion::get(), 1, { + migration::migrate_v1::(); + }); + + 0 + } + + const MaxStatsPerAsset: u32 = T::MaxStatsPerAsset::get(); + const MaxTransferConditionsPerAsset: u32 = T::MaxTransferConditionsPerAsset::get(); - /// Adds a new transfer manager. + /// Set the active asset stat_types. /// /// # Arguments - /// * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - /// * `ticker` ticker for which the transfer managers are being updated. - /// * `new_transfer_manager` Transfer manager being added. + /// - `origin` - a signer that has permissions to act as an agent of `asset`. + /// - `asset` - the asset to change the active stats on. + /// - `stat_types` - the new stat types to replace any existing types. /// /// # Errors - /// * `Unauthorized` if `origin` is not the owner of the ticker. - /// * `DuplicateTransferManager` if `new_transfer_manager` is already enabled for the ticker. - /// * `TransferManagersLimitReached` if the `ticker` already has max TMs attached + /// - `StatTypeLimitReached` - too many stat types enabled for the `asset`. + /// - `CannotRemoveStatTypeInUse` - can not remove a stat type that is in use by transfer conditions. + /// - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. /// /// # Permissions - /// * Asset - #[weight = ::WeightInfo::add_transfer_manager()] - pub fn add_transfer_manager(origin, ticker: Ticker, new_transfer_manager: TransferManager) { - let did = >::ensure_perms(origin, ticker)?; - ActiveTransferManagers::try_mutate(&ticker, |transfer_managers| { - ensure!((transfer_managers.len() as u32) < T::MaxTransferManagersPerAsset::get(), Error::::TransferManagersLimitReached); - ensure!(!transfer_managers.contains(&new_transfer_manager), Error::::DuplicateTransferManager); - transfer_managers.push(new_transfer_manager.clone()); - Ok(()) as DispatchResult - })?; - Self::deposit_event(Event::TransferManagerAdded(did, ticker, new_transfer_manager)); + /// - Agent + /// - Asset + #[weight = ::WeightInfo::set_active_asset_stats(stat_types.len() as u32)] + pub fn set_active_asset_stats(origin, asset: AssetScope, stat_types: BTreeSet) { + Self::base_set_active_asset_stats(origin, asset, stat_types)?; } - /// Removes a transfer manager. + /// Allow a trusted issuer to init/resync ticker/company stats. /// /// # Arguments - /// * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - /// * `ticker` ticker for which the transfer managers are being updated. - /// * `transfer_manager` Transfer manager being removed. + /// - `origin` - a signer that has permissions to act as an agent of `asset`. + /// - `asset` - the asset to change the active stats on. + /// - `stat_type` - stat type to update. + /// - `values` - Updated values for `stat_type`. /// /// # Errors - /// * `Unauthorized` if `origin` is not the owner of the ticker. - /// * `TransferManagerMissing` if `asset_compliance` contains multiple entries with the same `requirement_id`. + /// - `StatTypeMissing` - `stat_type` is not enabled for the `asset`. + /// - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. /// /// # Permissions - /// * Asset - #[weight = ::WeightInfo::remove_transfer_manager()] - pub fn remove_transfer_manager(origin, ticker: Ticker, transfer_manager: TransferManager) { - let did = >::ensure_perms(origin, ticker)?; - ActiveTransferManagers::try_mutate(&ticker, |transfer_managers| { - let before = transfer_managers.len(); - transfer_managers.retain(|tm| *tm != transfer_manager); - ensure!(before != transfer_managers.len(), Error::::TransferManagerMissing); - Ok(()) as DispatchResult - })?; - Self::deposit_event(Event::TransferManagerRemoved(did, ticker, transfer_manager)); + /// - Agent + /// - Asset + #[weight = ::WeightInfo::batch_update_asset_stats(values.len() as u32)] + pub fn batch_update_asset_stats(origin, asset: AssetScope, stat_type: StatType, values: BTreeSet) { + Self::base_batch_update_asset_stats(origin, asset, stat_type, values)?; } - /// Exempt entities from a transfer manager + /// Set asset transfer compliance rules. /// /// # Arguments - /// * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - /// * `ticker` ticker for which the exemption list is being modified. - /// * `transfer_manager` Transfer manager for which the exemption list is being modified. - /// * `exempted_entities` ScopeIds for which the exemption list is being modified. + /// - `origin` - a signer that has permissions to act as an agent of `asset`. + /// - `asset` - the asset to change the active stats on. + /// - `transfer_conditions` - the new transfer condition to replace any existing conditions. /// /// # Errors - /// * `Unauthorized` if `origin` is not the owner of the ticker. + /// - `TransferConditionLimitReached` - too many transfer condititon enabled for `asset`. + /// - `StatTypeMissing` - a transfer condition requires a stat type that is not enabled for the `asset`. + /// - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. /// /// # Permissions - /// * Asset - #[weight = ::WeightInfo::add_exempted_entities(exempted_entities.len() as u32)] - pub fn add_exempted_entities(origin, ticker: Ticker, transfer_manager: TransferManager, exempted_entities: Vec) { - let did = >::ensure_perms(origin, ticker)?; - let ticker_tm = (ticker, transfer_manager.clone()); - for entity in &exempted_entities { - ExemptEntities::insert(&ticker_tm, entity, true); - } - Self::deposit_event(Event::ExemptionsAdded(did, ticker, transfer_manager, exempted_entities)); + /// - Agent + /// - Asset + #[weight = ::WeightInfo::set_asset_transfer_compliance(transfer_conditions.len() as u32)] + pub fn set_asset_transfer_compliance(origin, asset: AssetScope, transfer_conditions: BTreeSet) { + Self::base_set_asset_transfer_compliance(origin, asset, transfer_conditions)?; } - /// remove entities from exemption list of a transfer manager + /// Set/unset entities exempt from an asset's transfer compliance rules. /// /// # Arguments - /// * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - /// * `ticker` ticker for which the exemption list is being modified. - /// * `transfer_manager` Transfer manager for which the exemption list is being modified. - /// * `scope_ids` ScopeIds for which the exemption list is being modified. + /// - `origin` - a signer that has permissions to act as an agent of `exempt_key.asset`. + /// - `is_exempt` - enable/disable exemption for `entities`. + /// - `exempt_key` - the asset and stat type to exempt the `entities` from. + /// - `entities` - the entities to set/unset the exemption for. /// /// # Errors - /// * `Unauthorized` if `origin` is not the owner of the ticker. + /// - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. /// /// # Permissions - /// * Asset - #[weight = ::WeightInfo::remove_exempted_entities(entities.len() as u32)] - pub fn remove_exempted_entities(origin, ticker: Ticker, transfer_manager: TransferManager, entities: Vec) { - let did = >::ensure_perms(origin, ticker)?; - let ticker_tm = (ticker, transfer_manager.clone()); - for entity in &entities { - ExemptEntities::remove(&ticker_tm, entity); - } - Self::deposit_event(Event::ExemptionsRemoved(did, ticker, transfer_manager, entities)); + /// - Agent + /// - Asset + #[weight = ::WeightInfo::set_entities_exempt(entities.len() as u32)] + pub fn set_entities_exempt(origin, is_exempt: bool, exempt_key: TransferConditionExemptKey, entities: BTreeSet) { + Self::base_set_entities_exempt(origin, is_exempt, exempt_key, entities)?; } } } impl Module { - /// It updates our statistics after transfer execution. - /// The following counters could be updated: - /// - *Investor count per asset*. + fn ensure_asset_perms( + origin: T::Origin, + asset: AssetScope, + ) -> Result { + match asset { + AssetScope::Ticker(ticker) => Ok(>::ensure_perms(origin, ticker)?), + } + } + + fn is_asset_stat_active(asset: AssetScope, stat_type: StatType) -> bool { + Self::active_asset_stats(asset).contains(&stat_type) + } + + fn base_set_active_asset_stats( + origin: T::Origin, + asset: AssetScope, + stat_types: BTreeSet, + ) -> DispatchResult { + // Check EA permissions for asset. + let did = Self::ensure_asset_perms(origin, asset)?; + + // Check StatType per Asset limit. + ensure!( + stat_types.len() < T::MaxStatsPerAsset::get() as usize, + Error::::StatTypeLimitReached + ); + + // Get list of StatTypes required by current TransferConditions. + let required_types = AssetTransferCompliances::get(&asset) + .requirements + .into_iter() + .map(|condition| condition.get_stat_type()) + .collect::>(); + + // Check if removed StatTypes are needed by TransferConditions. + let remove_types = Self::active_asset_stats(asset) + .into_iter() + // Only remove stats that are not in the new `stat_types` set. + .filter(|stat_type| !stat_types.contains(&stat_type)) + .map(|stat_type| { + if required_types.contains(&stat_type) { + // Throw an error if the user tries to remove a `StatType` required + // by the active `TransferConditions`. + Err(Error::::CannotRemoveStatTypeInUse) + } else { + Ok(stat_type) + } + }) + .collect::, Error>>()?; + + // Cleanup storage for old types to be removed. + for stat_type in &remove_types { + // Cleanup storage for this stat type, since it is being removed. + AssetStats::remove_prefix( + Stat1stKey { + asset, + stat_type: *stat_type, + }, + None, + ); + } + + // Save new stat types. + let add_types = stat_types.iter().cloned().collect::>(); + ActiveAssetStats::insert(&asset, stat_types); + + if remove_types.len() > 0 { + Self::deposit_event(Event::StatTypesRemoved(did, asset, remove_types)); + } + if add_types.len() > 0 { + Self::deposit_event(Event::StatTypesAdded(did, asset, add_types)); + } + Ok(()) + } + + fn base_batch_update_asset_stats( + origin: T::Origin, + asset: AssetScope, + stat_type: StatType, + values: BTreeSet, + ) -> DispatchResult { + // Check EA permissions for asset. + let did = Self::ensure_asset_perms(origin, asset)?; + // Check that `stat_type` is active for `asset`. + ensure!( + Self::is_asset_stat_active(asset, stat_type), + Error::::StatTypeMissing + ); + let key1 = Stat1stKey { asset, stat_type }; + // process `values` to update stats. + let updates = values + .into_iter() + .map(|update| { + let key2 = update.key2.clone(); + match update.value { + Some(value) => { + AssetStats::insert(key1, key2, value); + } + None => { + AssetStats::remove(key1, key2); + } + } + update + }) + .collect(); + + Self::deposit_event(Event::AssetStatsUpdated(did, asset, stat_type, updates)); + Ok(()) + } + + fn base_set_asset_transfer_compliance( + origin: T::Origin, + asset: AssetScope, + transfer_conditions: BTreeSet, + ) -> DispatchResult { + // Check EA permissions for asset. + let did = Self::ensure_asset_perms(origin, asset)?; + + // TODO: Use complexity instead of count to limit TransferConditions per asset. + // Check maximum TransferConditions per Asset limit. + ensure!( + transfer_conditions.len() < T::MaxTransferConditionsPerAsset::get() as usize, + Error::::TransferConditionLimitReached + ); + + // Commit changes to storage. + if transfer_conditions.len() > 0 { + // Check if required Stats are enabled. + for condition in &transfer_conditions { + let stat_type = condition.get_stat_type(); + ensure!( + Self::is_asset_stat_active(asset, stat_type), + Error::::StatTypeMissing + ); + } + + AssetTransferCompliances::mutate(&asset, |old| { + old.requirements = transfer_conditions.clone() + }); + } else { + AssetTransferCompliances::remove(&asset); + } + + Self::deposit_event(Event::SetAssetTransferCompliance( + did, + asset, + transfer_conditions.into_iter().collect(), + )); + + Ok(()) + } + + fn base_set_entities_exempt( + origin: T::Origin, + is_exempt: bool, + exempt_key: TransferConditionExemptKey, + entities: BTreeSet, + ) -> DispatchResult { + // Check EA permissions for asset. + let did = Self::ensure_asset_perms(origin, exempt_key.asset)?; + if is_exempt { + for entity in &entities { + TransferConditionExemptEntities::insert(&exempt_key, entity, true); + } + Self::deposit_event(Event::TransferConditionExemptionsAdded( + did, + exempt_key, + entities.into_iter().collect(), + )); + } else { + for entity in &entities { + TransferConditionExemptEntities::remove(&exempt_key, entity); + } + Self::deposit_event(Event::TransferConditionExemptionsRemoved( + did, + exempt_key, + entities.into_iter().collect(), + )); + } + Ok(()) + } + + /// Update asset stats. + pub fn update_asset_balance_stats( + key1: Stat1stKey, + from_key2: Stat2ndKey, + to_key2: Stat2ndKey, + from_balance: Option, + to_balance: Option, + amount: Balance, + ) { + // If 2nd keys are the same and it is not a mint/burn. + if from_key2 == to_key2 && from_balance.is_some() && to_balance.is_some() { + // Then the `amount` is transferred between investors + // with the same claim/non-claim. + // So no change is needed. + return; + } + + if from_balance.is_some() { + // Remove `amount` from `from_key2`. + AssetStats::mutate(key1, from_key2, |balance| { + *balance = balance.saturating_sub(amount) + }); + } + if to_balance.is_some() { + // Add `amount` to `to_key2`. + AssetStats::mutate(key1, to_key2, |balance| { + *balance = balance.saturating_add(amount) + }); + } + } + + /// Update unique investor count per asset per claim. /// - pub fn update_transfer_stats( + /// * `changes: (from_change, to_change)` + /// If the `from` is transfering the total balance (decreasing investor count), then `from_change == true`. + /// If the `to` has no tokens before this transfer (increasing investor count), then `to_change == true`. + fn update_asset_count_stats( + key1: Stat1stKey, + from_key2: Stat2ndKey, + to_key2: Stat2ndKey, + changes: (bool, bool), + ) { + match changes { + (true, true) if from_key2 == to_key2 => { + // Remove one investor and add another. + // Both 2nd keys match, so don't need to update the counter. + } + (false, false) => { + // No changes needed. + } + (from_change, to_change) => { + if from_change { + // Remove one investor. + AssetStats::mutate(key1, from_key2, |counter| { + *counter = counter.saturating_sub(1) + }); + } + if to_change { + // Add one investor. + AssetStats::mutate(key1, to_key2, |counter| { + *counter = counter.saturating_add(1) + }); + } + } + } + } + + /// Fetch a claim for an identity as needed by the stat type. + fn fetch_claim_as_key(did: Option<&IdentityId>, key1: &Stat1stKey) -> Stat2ndKey { + key1.stat_type + .claim_issuer + .map(|(claim_type, issuer)| { + // Get the claim. + let did_claim = did.and_then(|did| { + let claim_scope = key1.claim_scope(); + Identity::::fetch_claim(*did, claim_type, issuer, Some(claim_scope.clone())) + .map(|c| c.claim) + }); + Stat2ndKey::new_from(&claim_type, did_claim) + }) + .unwrap_or(Stat2ndKey::NoClaimStat) + } + + /// Check if an identity has a claim matching `key2`. + fn has_matching_claim(did: &IdentityId, key1: &Stat1stKey, key2: &Stat2ndKey) -> bool { + Self::fetch_claim_as_key(Some(did), key1) == *key2 + } + + fn investor_count_changes( + from_balance: Option, + to_balance: Option, + amount: Balance, + ) -> Option<(bool, bool)> { + // Check for two change conditions: + // 1. Sender transfer their total balance: `(from == Some(0))` + // 2. Receiver wasn't an investor before: `(to == Some(transfer_amount))` + // + // `from == None` - minting new tokens. + // `to == None` - burning tokens. + match (from_balance == Some(0), to_balance == Some(amount)) { + // No changes needed. + (false, false) => None, + // Some changes needed. + changes => Some(changes), + } + } + + /// Update asset stats. + pub fn update_asset_stats( ticker: &Ticker, - updated_from_balance: Option, - updated_to_balance: Option, + from_did: Option<&IdentityId>, + to_did: Option<&IdentityId>, + from_balance: Option, + to_balance: Option, amount: Balance, ) { - // 1. Unique investor count per asset. - if amount != 0u128.into() { - let counter = Self::investor_count(ticker); - let mut new_counter = counter; - - if let Some(from_balance) = updated_from_balance { - if from_balance == 0u128.into() { - new_counter = new_counter.checked_sub(1).unwrap_or(new_counter); + // No updates needed if the transfer amount is zero. + if amount == 0u128.into() { + return; + } + + // Pre-Calculate the investor count changes. + let count_changes = Self::investor_count_changes(from_balance, to_balance, amount); + + let asset = AssetScope::Ticker(*ticker); + // Update active asset stats. + for stat_type in Self::active_asset_stats(asset).into_iter() { + let key1 = Stat1stKey { asset, stat_type }; + // TODO: Avoid `fetch_claim_as_key` calls for no-claim stats. + match stat_type.op { + StatOpType::Count => { + if let Some(changes) = count_changes { + let from_key2 = Self::fetch_claim_as_key(from_did, &key1); + let to_key2 = Self::fetch_claim_as_key(to_did, &key1); + Self::update_asset_count_stats(key1, from_key2, to_key2, changes); + } + } + StatOpType::Balance => { + // TODO: no-claim case doesn't need to update balances here. + let from_key2 = Self::fetch_claim_as_key(from_did, &key1); + let to_key2 = Self::fetch_claim_as_key(to_did, &key1); + Self::update_asset_balance_stats( + key1, + from_key2, + to_key2, + from_balance, + to_balance, + amount, + ); } } + } + } - if let Some(to_balance) = updated_to_balance { - if to_balance == amount { - new_counter = new_counter.checked_add(1).unwrap_or(new_counter); - } + /// Verify asset investor count restrictions. + fn verify_asset_count_restriction( + key1: Stat1stKey, + changes: Option<(bool, bool)>, + max_count: u128, + ) -> bool { + match changes { + Some((true, true)) => { + // Remove one investor and add another. + // No count change. + true + } + Some((false, false)) | None => { + // No count change. + true + } + Some((true, false)) => { + // Remove one investor. + // Count is decreasing, no need to check max limit. + true } + Some((false, true)) => { + let current_count = AssetStats::get(key1, Stat2ndKey::NoClaimStat); + current_count < max_count + } + } + } - // Only updates extrinsics if counter has been changed. - if new_counter != counter { - InvestorCountPerAsset::insert(ticker, new_counter) + /// Verify claim count restrictions. + fn verify_claim_count_restriction( + key1: Stat1stKey, + key2: Stat2ndKey, + from_did: &IdentityId, + to_did: &IdentityId, + changes: Option<(bool, bool)>, + min: u128, + max: Option, + ) -> bool { + let changes = match changes { + Some(changes) => changes, + None => { + // No investor count changes, allow the transfer. + return true; + } + }; + // Check if the investors have the claim. + let from_matches = Self::has_matching_claim(from_did, &key1, &key2); + let to_matches = Self::has_matching_claim(to_did, &key1, &key2); + match changes { + (true, true) if from_matches == to_matches => { + // Remove one investor and add another. + // No count change. + } + (false, false) => { + // No count change. + } + (from_change, to_change) => { + // Get current investor count. + let count = AssetStats::get(key1, key2); + // Check minimum count restriction. + if min > 0 && from_change && from_matches { + // The `from` investor has the claim (`from_matches == true`) and + // is transfering the last of their tokens (`from_change == true`) + // so the investor count for the claim is decreasing. + if count <= min { + return false; + } + } + // Check the maximum count restriction. + if let Some(max) = max { + if to_change && to_matches { + // The `to` investor has the claim (`to_matches == true`) and + // has a token balance of zero (`to_change == true`) + // so the investor count for the claim is increasing. + if count >= max { + return false; + } + } + } } } + return true; } - /// Verify transfer restrictions for a transfer - pub fn verify_tm_restrictions( - ticker: &Ticker, - sender: ScopeId, - receiver: ScopeId, + /// Verify asset % ownership restrictions. + fn verify_ownership_restriction( value: Balance, - sender_balance: Balance, receiver_balance: Balance, total_supply: Balance, - ) -> DispatchResult { - Self::transfer_managers(ticker) - .into_iter() - .try_for_each(|tm| match tm { - TransferManager::CountTransferManager(max_count) => Self::ensure_ctm( - ticker, - sender, - value, - sender_balance, - receiver_balance, - max_count, - ), - TransferManager::PercentageTransferManager(max_percentage) => Self::ensure_ptm( - ticker, - receiver, - value, - receiver_balance, - total_supply, - max_percentage, - ), - }) + max_percentage: Percentage, + ) -> bool { + let new_percentage = + sp_arithmetic::Permill::from_rational(receiver_balance + value, total_supply); + new_percentage <= *max_percentage } - pub fn verify_tm_restrictions_granular( - ticker: &Ticker, - sender: ScopeId, - receiver: ScopeId, + /// Verify claim % ownership restrictions. + fn verify_claim_ownership_restriction( + key1: Stat1stKey, + key2: Stat2ndKey, + from_did: &IdentityId, + to_did: &IdentityId, value: Balance, - sender_balance: Balance, - receiver_balance: Balance, total_supply: Balance, - ) -> Vec { - Self::transfer_managers(ticker) - .into_iter() - .map(|tm| TransferManagerResult { - result: match &tm { - TransferManager::CountTransferManager(max_count) => Self::ensure_ctm( - ticker, - sender, - value, - sender_balance, - receiver_balance, - *max_count, - ) - .is_ok(), - TransferManager::PercentageTransferManager(max_percentage) => Self::ensure_ptm( - ticker, - receiver, - value, - receiver_balance, - total_supply, - max_percentage.clone(), - ) - .is_ok(), - }, - tm, - }) - .collect() + min_percentage: Percentage, + max_percentage: Percentage, + ) -> bool { + let from_maches = Self::has_matching_claim(from_did, &key1, &key2); + let to_maches = Self::has_matching_claim(to_did, &key1, &key2); + match (from_maches, to_maches) { + (true, true) => { + // Both have the claim. No % ownership change. + true + } + (false, false) => { + // Neither have the claim. No % ownership change. + true + } + (false, true) => { + // Only the receiver has the claim. + // Increasing the % ownership of the claim. + + // Calculate new claim % ownership. + let claim_balance = AssetStats::get(key1, key2); + let new_percentage = sp_arithmetic::Permill::from_rational( + claim_balance.saturating_add(value), + total_supply, + ); + // Check new % ownership is less then maximum. + new_percentage <= *max_percentage + } + (true, false) => { + // Only the sender has the claim. + // Decreasing the % ownership of the claim. + + // Calculate new claim % ownership. + let claim_balance = AssetStats::get(key1, key2); + let new_percentage = sp_arithmetic::Permill::from_rational( + claim_balance.saturating_sub(value), + total_supply, + ); + // Check new % ownership is more then the minimum. + new_percentage >= *min_percentage + } + } } - fn ensure_ctm( + /// Check transfer condition. + fn check_transfer_condition( + condition: &TransferCondition, + asset: AssetScope, + from: ScopeId, + to: ScopeId, + from_did: &IdentityId, + to_did: &IdentityId, + to_balance: Balance, + amount: Balance, + total_supply: Balance, + count_changes: Option<(bool, bool)>, + ) -> bool { + use TransferCondition::*; + + let stat_type = condition.get_stat_type(); + let key1 = Stat1stKey { asset, stat_type }; + + let passed = match &condition { + MaxInvestorCount(max_count) => { + Self::verify_asset_count_restriction(key1, count_changes, *max_count as u128) + } + MaxInvestorOwnership(max_percentage) => Self::verify_ownership_restriction( + amount, + to_balance, + total_supply, + *max_percentage, + ), + ClaimCount(claim, _, min, max) => Self::verify_claim_count_restriction( + key1, + claim.into(), + from_did, + to_did, + count_changes, + *min as u128, + max.map(|m| m as u128), + ), + ClaimOwnership(claim, _, min, max) => Self::verify_claim_ownership_restriction( + key1, + claim.into(), + from_did, + to_did, + amount, + total_supply, + *min, + *max, + ), + }; + if passed { + true + } else { + let exempt_key = condition.get_exempt_key(asset); + let id = match exempt_key.op { + // Count transfer conditions require the sender to be exempt. + StatOpType::Count => from, + // Percent ownersip transfer conditions require the receiver to be exempt. + StatOpType::Balance => to, + }; + let is_exempt = Self::transfer_condition_exempt_entities(exempt_key, id); + is_exempt + } + } + + /// Verify transfer restrictions for a transfer. + pub fn verify_transfer_restrictions( ticker: &Ticker, - sender: ScopeId, - value: Balance, - sender_balance: Balance, - receiver_balance: Balance, - max_count: Counter, + from: ScopeId, + to: ScopeId, + from_did: &IdentityId, + to_did: &IdentityId, + from_balance: Balance, + to_balance: Balance, + amount: Balance, + total_supply: Balance, ) -> DispatchResult { - let current_count = Self::investor_count(ticker); - ensure!( - current_count < max_count - || sender_balance == value - || receiver_balance > 0u32.into() - || Self::entity_exempt( - (*ticker, TransferManager::CountTransferManager(max_count)), - sender - ), - Error::::InvalidTransfer + let asset = AssetScope::Ticker(*ticker); + let tm = AssetTransferCompliances::get(&asset); + if tm.paused { + // Transfer rules are paused. + return Ok(()); + } + + // Pre-Calculate the investor count changes. + let count_changes = Self::investor_count_changes( + Some(from_balance.saturating_sub(amount)), + Some(to_balance.saturating_add(amount)), + amount, ); + + for condition in tm.requirements { + let result = Self::check_transfer_condition( + &condition, + asset, + from, + to, + from_did, + to_did, + to_balance, + amount, + total_supply, + count_changes, + ); + ensure!(result, Error::::InvalidTransfer); + } + Ok(()) } - fn ensure_ptm( + /// Get the results of all transfer restrictions for a transfer. + pub fn get_transfer_restrictions_results( ticker: &Ticker, - receiver: ScopeId, - value: Balance, - receiver_balance: Balance, + from: ScopeId, + to: ScopeId, + from_did: &IdentityId, + to_did: &IdentityId, + from_balance: Balance, + to_balance: Balance, + amount: Balance, total_supply: Balance, - max_percentage: Percentage, - ) -> DispatchResult { - let new_percentage = sp_arithmetic::Permill::from_rational_approximation( - receiver_balance + value, - total_supply, - ); - ensure!( - new_percentage <= *max_percentage - || Self::entity_exempt( - ( - *ticker, - TransferManager::PercentageTransferManager(max_percentage) - ), - receiver - ), - Error::::InvalidTransfer + ) -> Vec { + let asset = AssetScope::Ticker(*ticker); + let tm = AssetTransferCompliances::get(&asset); + + // Pre-Calculate the investor count changes. + let count_changes = Self::investor_count_changes( + Some(from_balance.saturating_sub(amount)), + Some(to_balance.saturating_add(amount)), + amount, ); - Ok(()) + + tm.requirements + .into_iter() + .map(|condition| { + let result = Self::check_transfer_condition( + &condition, + asset, + from, + to, + from_did, + to_did, + to_balance, + amount, + total_supply, + count_changes, + ); + TransferConditionResult { condition, result } + }) + .collect() + } + + /// Helper function to get investor count for tests. + pub fn investor_count(ticker: Ticker) -> u128 { + AssetStats::get(Stat1stKey::investor_count(ticker), Stat2ndKey::NoClaimStat) } + /// Helper function to set investor count for benchmarks. #[cfg(feature = "runtime-benchmarks")] - pub fn set_investor_count(ticker: &Ticker, count: Counter) { - InvestorCountPerAsset::insert(ticker, count); + pub fn set_investor_count(ticker: Ticker, count: u128) { + AssetStats::insert( + Stat1stKey::investor_count(ticker), + Stat2ndKey::NoClaimStat, + count, + ) } } decl_error! { /// Statistics module errors. pub enum Error for Module { - /// The transfer manager already exists - DuplicateTransferManager, - /// Transfer manager is not enabled - TransferManagerMissing, - /// Transfer not allowed + /// Transfer not allowed. InvalidTransfer, - /// The limit of transfer managers allowed for an asset has been reached - TransferManagersLimitReached + /// StatType is not enabled. + StatTypeMissing, + /// StatType is needed by TransferCondition. + StatTypeNeededByTransferCondition, + /// A Stattype is in use and can't be removed. + CannotRemoveStatTypeInUse, + /// The limit of StatTypes allowed for an asset has been reached. + StatTypeLimitReached, + /// The limit of TransferConditions allowed for an asset has been reached. + TransferConditionLimitReached, + } +} + +mod migration { + use super::*; + + mod v1 { + use super::*; + use scale_info::TypeInfo; + + pub type Counter = u64; + + #[derive(Decode, Encode, TypeInfo)] + #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] + pub enum TransferManager { + CountTransferManager(Counter), + PercentageTransferManager(Percentage), + } + + decl_storage! { + trait Store for Module as Statistics { + pub ActiveTransferManagers get(fn transfer_managers): map hasher(blake2_128_concat) Ticker => Vec; + pub InvestorCountPerAsset get(fn investor_count): map hasher(blake2_128_concat) Ticker => Counter; + pub ExemptEntities get(fn entity_exempt): + double_map + hasher(blake2_128_concat) (Ticker, TransferManager), + hasher(blake2_128_concat) ScopeId + => + bool; + } + } + + decl_module! { + pub struct Module for enum Call where origin: T::Origin { } + } + } + + pub fn migrate_v1() { + sp_runtime::runtime_logger::RuntimeLogger::init(); + + log::info!(" >>> Updating Statistics storage. Migrating TransferManagers..."); + let total_managers = + v1::ActiveTransferManagers::drain().fold(0usize, |total, (ticker, managers)| { + let count = managers.len(); + let asset = AssetScope::from(ticker); + + let requirements = managers + .into_iter() + .map(|manager| { + // Convert TransferManager to TransferCondition. + let condition = match manager { + v1::TransferManager::CountTransferManager(max) => { + TransferCondition::MaxInvestorCount(max) + } + v1::TransferManager::PercentageTransferManager(max) => { + TransferCondition::MaxInvestorOwnership(max) + } + }; + + // Convert Exemptions for the TransferManager. + for (entity, exempt) in v1::ExemptEntities::drain_prefix((ticker, manager)) + { + if exempt { + let exempt_key = condition.get_exempt_key(asset); + TransferConditionExemptEntities::insert(&exempt_key, entity, true); + } + } + + condition + }) + .collect(); + + let compliance = AssetTransferCompliance { + paused: false, + requirements, + }; + + // Enable stats. + let stats = compliance + .requirements + .iter() + .map(|c| c.get_stat_type()) + .collect::>(); + ActiveAssetStats::insert(asset, stats); + + // Save new transfer compliance rules. + AssetTransferCompliances::insert(asset, compliance); + + total + count + }); + log::info!(" >>> Migrated {} TransferManagers.", total_managers); + + log::info!(" >>> Migrating Investor counts..."); + let total_counts = + v1::InvestorCountPerAsset::drain().fold(0usize, |total, (ticker, count)| { + // Make sure investor count stats are enabled. + ActiveAssetStats::mutate(AssetScope::from(ticker), |stats| { + stats.insert(StatType::investor_count()); + }); + + // Save investor count to new stats storage. + AssetStats::insert( + Stat1stKey::investor_count(ticker), + Stat2ndKey::NoClaimStat, + count as u128, + ); + + total + 1 + }); + log::info!(" >>> Migrated {} Asset Investor counts.", total_counts); } } diff --git a/pallets/sto/Cargo.toml b/pallets/sto/Cargo.toml index 164a9f264c..67b2cb1ad9 100644 --- a/pallets/sto/Cargo.toml +++ b/pallets/sto/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-sto" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] pallet-asset = { path = "../asset", default-features = false } @@ -20,22 +20,22 @@ polymesh-primitives-derive = { path = "../../primitives_derive", default-feature serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-serializer = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } # Only in STD -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/sto/src/benchmarking.rs b/pallets/sto/src/benchmarking.rs index 8ed5c12e46..bfd4c20f76 100644 --- a/pallets/sto/src/benchmarking.rs +++ b/pallets/sto/src/benchmarking.rs @@ -3,7 +3,7 @@ use frame_benchmarking::benchmarks; use frame_support::dispatch::DispatchError; use frame_support::traits::Get; use pallet_settlement::{ - benchmarking::{add_transfer_managers, compliance_setup}, + benchmarking::{add_transfer_conditions, compliance_setup, MAX_CONDITIONS}, VenueDetails, }; use polymesh_common_utilities::{ @@ -18,7 +18,7 @@ const RAISE_TICKER: Ticker = Ticker::repeating(b'B'); pub type Asset = pallet_asset::Module; pub type ComplianceManager = pallet_compliance_manager::Module; pub type Identity = pallet_identity::Module; -pub type Timestamp = pallet_timestamp::Module; +pub type Timestamp = pallet_timestamp::Pallet; pub type Settlement = pallet_settlement::Module; pub type Sto = crate::Module; @@ -28,18 +28,13 @@ fn create_assets_and_compliance>>( offering_ticker: Ticker, raise_ticker: Ticker, complexity: u32, - transfer_managers: u32, + transfer_conditions: u32, ) -> DispatchResult { let t_issuer = UserBuilder::::default() .generate_did() .build("TrustedClaimIssuer"); let trusted_issuer = TrustedIssuer::from(t_issuer.did()); - let setup = |a: &User, - b: &User, - ticker: Ticker, - complexity: u32, - transfer_managers: u32| - -> DispatchResult { + let setup = |a: &User, b: &User, ticker: Ticker, complexity: u32| -> DispatchResult { make_asset::(a, Some(ticker.as_slice())); compliance_setup::( complexity, @@ -49,12 +44,12 @@ fn create_assets_and_compliance>>( b.did(), trusted_issuer.clone(), ); - add_transfer_managers::(ticker, a.origin(), a.did(), transfer_managers); + add_transfer_conditions::(ticker, a.origin(), a.did(), transfer_conditions); Ok(()) }; - setup(from, to, offering_ticker, complexity, transfer_managers).unwrap(); - setup(to, from, raise_ticker, complexity, transfer_managers).unwrap(); + setup(from, to, offering_ticker, complexity).unwrap(); + setup(to, from, raise_ticker, complexity).unwrap(); Ok(()) } @@ -91,7 +86,7 @@ struct UserWithPortfolio { fn setup_fundraiser>>( complexity: u32, tiers: u32, - transfer_managers: u32, + transfer_conditions: u32, ) -> Result<(UserWithPortfolio, UserWithPortfolio), DispatchError> { let alice = user::("alice"); let bob = user::("bob"); @@ -102,7 +97,7 @@ fn setup_fundraiser>>( OFFERING_TICKER, RAISE_TICKER, complexity, - transfer_managers, + transfer_conditions, ) .unwrap(); @@ -163,7 +158,7 @@ benchmarks! { } invest { - let (alice, bob) = setup_fundraiser::(T::MaxConditionComplexity::get() as u32, MAX_TIERS as u32, T::MaxTransferManagersPerAsset::get() as u32).unwrap(); + let (alice, bob) = setup_fundraiser::(T::MaxConditionComplexity::get() as u32, MAX_TIERS as u32, MAX_CONDITIONS as u32).unwrap(); }: _( bob.user.origin(), bob.portfolio, diff --git a/pallets/sto/src/lib.rs b/pallets/sto/src/lib.rs index b4d6aa6da5..d40bb926c9 100644 --- a/pallets/sto/src/lib.rs +++ b/pallets/sto/src/lib.rs @@ -40,6 +40,7 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::impl_checked_inc; use polymesh_primitives_derive::VecU8StrongTyped; +use scale_info::TypeInfo; use frame_support::weights::Weight; use polymesh_primitives::{Balance, EventDid, IdentityId, PortfolioId, Ticker}; @@ -52,15 +53,16 @@ type ExternalAgents = pallet_external_agents::Module; type Identity = pallet_identity::Module; type Portfolio = pallet_portfolio::Module; type Settlement = pallet_settlement::Module; -type Timestamp = pallet_timestamp::Module; +type Timestamp = pallet_timestamp::Pallet; /// The per-ticker ID of a fundraiser. -#[derive(Copy, Clone, Encode, Decode, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug)] pub struct FundraiserId(pub u64); impl_checked_inc!(FundraiserId); /// Status of a Fundraiser. -#[derive(Clone, PartialEq, Eq, Encode, Decode, PartialOrd, Ord, Debug)] +#[derive(Clone, PartialEq, Eq, Encode, Decode, TypeInfo, PartialOrd, Ord, Debug)] pub enum FundraiserStatus { /// Fundraiser is open for investments if start_time <= current_time < end_time. Live, @@ -79,7 +81,8 @@ impl Default for FundraiserStatus { } /// Details about the Fundraiser. -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "std", derive(Debug))] pub struct Fundraiser { /// The permissioned agent that created the `Fundraiser`. @@ -115,7 +118,8 @@ impl Fundraiser { } /// Single tier of a tiered pricing model. -#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PriceTier { /// Total amount available. pub total: Balance, @@ -125,7 +129,8 @@ pub struct PriceTier { /// Single price tier of a `Fundraiser`. /// Similar to a `PriceTier` but with an extra field `remaining` for tracking the amount available for purchase in a tier. -#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Encode, Decode, TypeInfo)] +#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "std", derive(Debug))] pub struct FundraiserTier { /// Total amount available. @@ -146,10 +151,9 @@ impl Into for PriceTier { } } -/// Wrapper type for Fundraiser name -#[derive( - Decode, Encode, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, VecU8StrongTyped, -)] +/// Wrapper type for Fundraiser name. +#[derive(Encode, Decode, TypeInfo, VecU8StrongTyped)] +#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct FundraiserName(Vec); pub trait WeightInfo { diff --git a/pallets/sudo/Cargo.toml b/pallets/sudo/Cargo.toml index 856e2b4e53..f969200409 100644 --- a/pallets/sudo/Cargo.toml +++ b/pallets/sudo/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-sudo" version = "2.0.0" authors = ["Parity Technologies "] -edition = "2018" +edition = "2021" license = "Apache-2.0" homepage = "https://substrate.dev" repository = "https://github.com/PolymathNetwork/substrate/" @@ -14,15 +14,16 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.104", optional = true } -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false} -sp-runtime = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false} +sp-runtime = { version = "6.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } [dev-dependencies] -sp-core = { version = "3.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } [features] default = ["std"] diff --git a/pallets/sudo/src/mock.rs b/pallets/sudo/src/mock.rs index 40c95ad6a5..bfa59aad8e 100644 --- a/pallets/sudo/src/mock.rs +++ b/pallets/sudo/src/mock.rs @@ -17,12 +17,8 @@ //! Test utilities -use super::*; use crate as sudo; -use frame_support::traits::Filter; -use frame_support::{ - impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types, weights::Weight, -}; +use frame_support::{parameter_types, weights::Weight}; use sp_core::H256; use sp_io; use sp_runtime::{ @@ -33,15 +29,15 @@ use sp_runtime::{ // Logger module to track execution. pub mod logger { - use super::*; - use frame_system::ensure_root; + use frame_support::{decl_event, decl_module, decl_storage, weights::Weight}; + use frame_system::{ensure_root, ensure_signed}; - pub trait Trait: frame_system::Config { + pub trait Config: frame_system::Config { type Event: From> + Into<::Event>; } decl_storage! { - trait Store for Module as Logger { + trait Store for Module as Logger { AccountLog get(fn account_log): Vec; I32Log get(fn i32_log): Vec; } @@ -55,7 +51,7 @@ pub mod logger { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::Origin { fn deposit_event() = default; #[weight = *weight] @@ -78,34 +74,20 @@ pub mod logger { } } -impl_outer_origin! { - pub enum Origin for Test where system = frame_system {} -} - -mod test_events { - pub use crate::Event; -} - -impl_outer_event! { - pub enum TestEvent for Test { - frame_system, - sudo, - logger, - } -} - -impl_outer_dispatch! { - pub enum Call for Test where origin: Origin { - sudo::Sudo, - logger::Logger, +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Sudo: sudo::{Pallet, Call, Config, Storage, Event}, + Logger: logger::{Pallet, Call, Storage, Event}, } -} - -// For testing the pallet, we construct most of a mock runtime. This means -// first constructing a configuration type (`Test`) which `impl`s each of the -// configuration traits of pallets we want to use. -#[derive(Clone, Eq, PartialEq)] -pub struct Test; +); parameter_types! { pub const BlockHashCount: u64 = 250; @@ -114,15 +96,10 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub struct BlockEverything; -impl Filter for BlockEverything { - fn filter(_: &Call) -> bool { - false - } -} - impl frame_system::Config for Test { - type BaseCallFilter = BlockEverything; + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); type Origin = Origin; type Call = Call; type Index = u64; @@ -132,38 +109,28 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = TestEvent; + type Event = Event; type BlockHashCount = BlockHashCount; - type MaximumBlockWeight = MaximumBlockWeight; type DbWeight = (); - type BlockExecutionWeight = (); - type ExtrinsicBaseWeight = (); - type MaximumExtrinsicWeight = MaximumBlockWeight; - type MaximumBlockLength = MaximumBlockLength; - type AvailableBlockRatio = AvailableBlockRatio; type Version = (); type PalletInfo = PalletInfo; type AccountData = (); type OnNewAccount = (); type OnKilledAccount = (); type SystemWeightInfo = (); + type OnSetCode = (); + type SS58Prefix = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } -// Implement the logger module's `Trait` on the Test runtime. -impl logger::Trait for Test { - type Event = TestEvent; -} - -// Implement the sudo module's `Trait` on the Test runtime. -impl Trait for Test { - type Event = TestEvent; +impl sudo::Config for Test { + type Event = Event; type Call = Call; } -// Assign back to type variables in order to make dispatched calls of these modules later. -pub type Sudo = Module; -pub type Logger = logger::Module; -pub type System = frame_system::Module; +impl logger::Config for Test { + type Event = Event; +} // New types for dispatchable functions. pub type SudoCall = sudo::Call; @@ -174,7 +141,7 @@ pub fn new_test_ext(root_key: u64) -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default() .build_storage::() .unwrap(); - GenesisConfig:: { key: root_key } + sudo::GenesisConfig:: { key: root_key } .assimilate_storage(&mut t) .unwrap(); t.into() diff --git a/pallets/sudo/src/tests.rs b/pallets/sudo/src/tests.rs index 451bce4b01..108b85b713 100644 --- a/pallets/sudo/src/tests.rs +++ b/pallets/sudo/src/tests.rs @@ -19,9 +19,7 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{ - new_test_ext, Call, Logger, LoggerCall, Origin, Sudo, SudoCall, System, Test, TestEvent, -}; +use mock::{new_test_ext, Call, Event, Logger, LoggerCall, Origin, Sudo, SudoCall, System, Test}; #[test] fn test_setup_works() { @@ -38,12 +36,18 @@ fn sudo_basics() { // Configure a default test environment and set the root `key` to 1. new_test_ext(1).execute_with(|| { // A privileged function should work when `sudo` is passed the root `key` as `origin`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1_000))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1_000, + })); assert_ok!(Sudo::sudo(Origin::signed(1), call)); assert_eq!(Logger::i32_log(), vec![42i32]); // A privileged function should not work when `sudo` is passed a non-root `key` as `origin`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1_000))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1_000, + })); assert_noop!( Sudo::sudo(Origin::signed(2), call), Error::::RequireSudo @@ -58,9 +62,12 @@ fn sudo_emits_events_correctly() { System::set_block_number(1); // Should emit event to indicate success when called with the root `key` and `call` is `Ok`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1, + })); assert_ok!(Sudo::sudo(Origin::signed(1), call)); - let expected_event = TestEvent::sudo(RawEvent::Sudid(Ok(()))); + let expected_event = Event::Sudo(RawEvent::Sudid(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }) } @@ -69,12 +76,18 @@ fn sudo_emits_events_correctly() { fn sudo_unchecked_weight_basics() { new_test_ext(1).execute_with(|| { // A privileged function should work when `sudo` is passed the root `key` as origin. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1_000))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1_000, + })); assert_ok!(Sudo::sudo_unchecked_weight(Origin::signed(1), call, 1_000)); assert_eq!(Logger::i32_log(), vec![42i32]); // A privileged function should not work when called with a non-root `key`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1_000))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1_000, + })); assert_noop!( Sudo::sudo_unchecked_weight(Origin::signed(2), call, 1_000), Error::::RequireSudo, @@ -83,8 +96,14 @@ fn sudo_unchecked_weight_basics() { assert_eq!(Logger::i32_log(), vec![42i32]); // Controls the dispatched weight. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1))); - let sudo_unchecked_weight_call = SudoCall::sudo_unchecked_weight(call, 1_000); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1, + })); + let sudo_unchecked_weight_call = SudoCall::sudo_unchecked_weight { + call, + _weight: 1_000, + }; let info = sudo_unchecked_weight_call.get_dispatch_info(); assert_eq!(info.weight, 1_000); }); @@ -97,9 +116,12 @@ fn sudo_unchecked_weight_emits_events_correctly() { System::set_block_number(1); // Should emit event to indicate success when called with the root `key` and `call` is `Ok`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1, + })); assert_ok!(Sudo::sudo_unchecked_weight(Origin::signed(1), call, 1_000)); - let expected_event = TestEvent::sudo(RawEvent::Sudid(Ok(()))); + let expected_event = Event::Sudo(RawEvent::Sudid(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }) } @@ -129,11 +151,11 @@ fn set_key_emits_events_correctly() { // A root `key` can change the root `key`. assert_ok!(Sudo::set_key(Origin::signed(1), 2)); - let expected_event = TestEvent::sudo(RawEvent::KeyChanged(1)); + let expected_event = Event::Sudo(RawEvent::KeyChanged(1)); assert!(System::events().iter().any(|a| a.event == expected_event)); // Double check. assert_ok!(Sudo::set_key(Origin::signed(2), 4)); - let expected_event = TestEvent::sudo(RawEvent::KeyChanged(2)); + let expected_event = Event::Sudo(RawEvent::KeyChanged(2)); assert!(System::events().iter().any(|a| a.event == expected_event)); }); } @@ -142,20 +164,29 @@ fn set_key_emits_events_correctly() { fn sudo_as_basics() { new_test_ext(1).execute_with(|| { // A privileged function will not work when passed to `sudo_as`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log(42, 1_000))); + let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + i: 42, + weight: 1_000, + })); assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); assert!(Logger::i32_log().is_empty()); assert!(Logger::account_log().is_empty()); // A non-privileged function should not work when called with a non-root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log(42, 1))); + let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + i: 42, + weight: 1, + })); assert_noop!( Sudo::sudo_as(Origin::signed(3), 2, call), Error::::RequireSudo ); // A non-privileged function will work when passed to `sudo_as` with the root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log(42, 1))); + let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + i: 42, + weight: 1, + })); assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); assert_eq!(Logger::i32_log(), vec![42i32]); // The correct user makes the call within `sudo_as`. @@ -170,9 +201,12 @@ fn sudo_as_emits_events_correctly() { System::set_block_number(1); // A non-privileged function will work when passed to `sudo_as` with the root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log(42, 1))); + let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + i: 42, + weight: 1, + })); assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); - let expected_event = TestEvent::sudo(RawEvent::SudoAsDone(Ok(()))); + let expected_event = Event::Sudo(RawEvent::SudoAsDone(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }); } diff --git a/pallets/test-utils/Cargo.toml b/pallets/test-utils/Cargo.toml index 0058ef2d3f..7cea23cc09 100644 --- a/pallets/test-utils/Cargo.toml +++ b/pallets/test-utils/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-test-utils" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives", default-features = false } @@ -16,15 +16,15 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Crypto -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "3.0.0", default-features = false } - -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-std = { version = "4.0.0", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] diff --git a/pallets/test-utils/src/benchmarking.rs b/pallets/test-utils/src/benchmarking.rs index 06dcc6c843..58d02de0da 100644 --- a/pallets/test-utils/src/benchmarking.rs +++ b/pallets/test-utils/src/benchmarking.rs @@ -22,7 +22,6 @@ use polymesh_common_utilities::{ }; use frame_benchmarking::{account, benchmarks}; -use sp_std::prelude::*; const SEED: u32 = 0; #[cfg(feature = "running-ci")] @@ -70,5 +69,5 @@ benchmarks! { Module::::mock_cdd_register_did(cdd.origin().into(), user.account()) .expect("CDD provider cannot generate a DID for that user"); - }: _(user.origin, user.account) + }: _(user.origin(), user.account()) } diff --git a/pallets/test-utils/src/lib.rs b/pallets/test-utils/src/lib.rs index 857055eee2..da6781ebf2 100644 --- a/pallets/test-utils/src/lib.rs +++ b/pallets/test-utils/src/lib.rs @@ -184,9 +184,8 @@ impl TestUtilsFn for Module { fn register_did( target: T::AccountId, investor: InvestorUid, - secondary_keys: Vec>, + secondary_keys: Vec>, ) -> DispatchResult { - let keys = secondary_keys.into_iter().map(SecondaryKey::from).collect(); - Self::register_did(RawOrigin::Signed(target).into(), investor, keys) + Self::register_did(RawOrigin::Signed(target).into(), investor, secondary_keys) } } diff --git a/pallets/transaction-payment/Cargo.toml b/pallets/transaction-payment/Cargo.toml index e5c68cdd4f..81e0b1a2e6 100644 --- a/pallets/transaction-payment/Cargo.toml +++ b/pallets/transaction-payment/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-transaction-payment" version = "2.0.0" authors = ["Parity Technologies "] -edition = "2018" +edition = "2021" [dependencies] # Our deps @@ -13,14 +13,15 @@ polymesh-common-utilities = { path = "../common", default-features = false } serde = { version = "1.0.104", default-features = false, optional = true } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-std = { version = "4.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } [dev-dependencies] serde_json = "1.0.56" diff --git a/pallets/transaction-payment/src/lib.rs b/pallets/transaction-payment/src/lib.rs index 90053d6170..c2eccc157f 100644 --- a/pallets/transaction-payment/src/lib.rs +++ b/pallets/transaction-payment/src/lib.rs @@ -68,6 +68,7 @@ use polymesh_common_utilities::traits::{ transaction_payment::{CddAndFeeDetails, ChargeTxFee}, }; use polymesh_primitives::TransactionError; +use scale_info::TypeInfo; use sp_runtime::{ traits::{ Convert, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SaturatedConversion, Saturating, @@ -199,7 +200,7 @@ where .get(DispatchClass::Normal) .max_total .unwrap_or_else(|| weights.max_block); - let current_block_weight = >::block_weight(); + let current_block_weight = >::block_weight(); let normal_block_weight = *current_block_weight .get(DispatchClass::Normal) .min(&normal_max_weight); @@ -240,7 +241,7 @@ where } /// Storage releases of the module. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] enum Releases { /// Original version of the module. V1Ancient, @@ -319,7 +320,7 @@ decl_module! { use sp_std::convert::TryInto; assert!( ::max_value() >= - Multiplier::checked_from_integer( + Multiplier::checked_from_integer::( T::BlockWeights::get().max_block.try_into().unwrap() ).unwrap(), ); @@ -344,7 +345,7 @@ decl_module! { target += addition; sp_io::TestExternalities::new_empty().execute_with(|| { - >::set_block_consumed_resources(target, 0); + >::set_block_consumed_resources(target, 0); let next = T::FeeMultiplierUpdate::convert(min_value); assert!(next > min_value, "The minimum bound of the multiplier is too low. When \ block saturation is more than target by 1% and multiplier is minimal then \ @@ -527,7 +528,8 @@ where /// Require the transactor pay for themselves and maybe include a tip to gain additional priority /// in the queue. -#[derive(Encode, Decode, Clone, Eq, PartialEq)] +#[derive(Encode, Decode, TypeInfo, Clone, Eq, PartialEq)] +#[scale_info(skip_type_params(T))] pub struct ChargeTransactionPayment(#[codec(compact)] BalanceOf); impl ChargeTransactionPayment @@ -683,13 +685,16 @@ where } fn post_dispatch( - pre: Self::Pre, + pre: Option, info: &DispatchInfoOf, post_info: &PostDispatchInfoOf, len: usize, _result: &DispatchResult, ) -> Result<(), TransactionValidityError> { - let (tip, who, imbalance, subsidiser) = pre; + let (tip, who, imbalance, subsidiser) = match pre { + Some(pre) => pre, + None => return Ok(()), + }; let actual_fee = Module::::compute_actual_fee(len as u32, info, post_info, tip); // Fee returned to original payer. diff --git a/pallets/transaction-payment/src/payment.rs b/pallets/transaction-payment/src/payment.rs index a6b2020a65..db697d2137 100644 --- a/pallets/transaction-payment/src/payment.rs +++ b/pallets/transaction-payment/src/payment.rs @@ -25,7 +25,8 @@ pub trait OnChargeTransaction { + Copy + MaybeSerializeDeserialize + Debug - + Default; + + Default + + scale_info::TypeInfo; type LiquidityInfo: Default; /// Before the transaction is executed the payment of the transaction fees @@ -156,10 +157,11 @@ where // merge the imbalance caused by paying the fees and refunding parts of it again. let adjusted_paid = paid .offset(refund_imbalance) + .same() .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Payment))?; // Call someone else to handle the imbalance (fee and tip separately) - let imbalances = adjusted_paid.split(tip); - OU::on_unbalanceds(Some(imbalances.0).into_iter().chain(Some(imbalances.1))); + let (tip, fee) = adjusted_paid.split(tip); + OU::on_unbalanceds(Some(fee).into_iter().chain(Some(tip))); } Ok(()) } diff --git a/pallets/treasury/Cargo.toml b/pallets/treasury/Cargo.toml index d7a6412976..49ec4de4df 100644 --- a/pallets/treasury/Cargo.toml +++ b/pallets/treasury/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-treasury" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] polymesh-common-utilities = { path = "../common", default-features = false } @@ -16,19 +16,20 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } -sp-api = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -frame-support = { version = "3.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } # Benchmarking -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } [features] equalize = [] diff --git a/pallets/treasury/src/lib.rs b/pallets/treasury/src/lib.rs index 3b5e9ae949..f6601cc2bb 100644 --- a/pallets/treasury/src/lib.rs +++ b/pallets/treasury/src/lib.rs @@ -36,15 +36,18 @@ #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; +use frame_support::traits::{StorageInfo, StorageInfoTrait}; use frame_support::{ - decl_error, decl_event, decl_module, ensure, - traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced, WithdrawReasons}, + decl_error, decl_event, decl_module, + dispatch::{DispatchError, DispatchResult}, + ensure, + traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced}, weights::Weight, }; use frame_system::ensure_root; use pallet_identity as identity; use polymesh_common_utilities::{ - constants::TREASURY_MODULE_ID, traits::balances::Config as BalancesConfig, Context, GC_DID, + constants::TREASURY_PALLET_ID, traits::balances::Config as BalancesConfig, Context, GC_DID, }; use polymesh_primitives::{Beneficiary, IdentityId}; use sp_runtime::traits::{AccountIdConversion, Saturating}; @@ -77,12 +80,21 @@ decl_event!( pub enum Event where Balance = BalanceOf, + AccountId = ::AccountId, { /// Disbursement to a target Identity. - /// (target identity, amount) - TreasuryDisbursement(IdentityId, IdentityId, Balance), + /// + /// (treasury identity, target identity, target primary key, amount) + TreasuryDisbursement(IdentityId, IdentityId, AccountId, Balance), + + /// Disbursement to a target Identity failed. + /// + /// (treasury identity, target identity, target primary key, amount) + TreasuryDisbursementFailed(IdentityId, IdentityId, AccountId, Balance), /// Treasury reimbursement. + /// + /// (source identity, amount) TreasuryReimbursement(IdentityId, Balance), } ); @@ -92,6 +104,8 @@ decl_error! { pub enum Error for Module { /// Proposer's balance is too low. InsufficientBalance, + /// Invalid identity for disbursement. + InvalidIdentity, } } @@ -107,17 +121,10 @@ decl_module! { /// # Error /// * `BadOrigin`: Only root can execute transaction. /// * `InsufficientBalance`: If treasury balances is not enough to cover all beneficiaries. - #[weight = ::WeightInfo::disbursement( beneficiaries.len() as u32)] + /// * `InvalidIdentity`: If one of the beneficiaries has an invalid identity. + #[weight = ::WeightInfo::disbursement(beneficiaries.len() as u32)] pub fn disbursement(origin, beneficiaries: Vec>>) { - ensure_root(origin)?; - - // Ensure treasury has enough balance. - let total_amount = beneficiaries.iter().fold(0u32.into(), |acc,b| b.amount.saturating_add(acc)); - ensure!( - Self::balance() >= total_amount, - Error::::InsufficientBalance - ); - beneficiaries.into_iter().for_each(|b| Self::unsafe_disbursement(b.id, b.amount)); + Self::base_disbursement(origin, beneficiaries)?; } /// It transfers the specific `amount` from `origin` account into treasury. @@ -125,45 +132,95 @@ decl_module! { /// Only accounts which are associated to an identity can make a donation to treasury. #[weight = ::WeightInfo::reimbursement()] pub fn reimbursement(origin, amount: BalanceOf) { - let identity::PermissionedCallOriginData { - sender, - primary_did, - .. - } = Identity::::ensure_origin_call_permissions(origin)?; - - // Not checking the cdd for the treasury account as it is assumed - // that treasury account posses a valid CDD check during the genesis phase - T::Currency::transfer( - &sender, - &Self::account_id(), - amount, - ExistenceRequirement::AllowDeath, - )?; - - Self::deposit_event(RawEvent::TreasuryReimbursement(primary_did, amount)); + Self::base_reimbursement(origin, amount)?; } } } impl Module { + fn base_disbursement( + origin: T::Origin, + beneficiaries: Vec>>, + ) -> DispatchResult { + ensure_root(origin)?; + + // Get the primary key for each Beneficiary. + let mut total_amount: BalanceOf = 0u32.into(); + let beneficiaries = beneficiaries + .iter() + .map(|b| -> Result<_, DispatchError> { + total_amount = total_amount.saturating_add(b.amount); + // Ensure the identity exists and get its primary key. + let primary_key = + Identity::::get_primary_key(b.id).ok_or(Error::::InvalidIdentity)?; + Ok((primary_key, b.id, b.amount)) + }) + .collect::, DispatchError>>()?; + + // Ensure treasury has enough balance. + ensure!( + Self::balance() >= total_amount, + Error::::InsufficientBalance + ); + + // Do disbursement. + for (primary_key, id, amount) in beneficiaries { + Self::unsafe_disbursement(primary_key, id, amount); + } + + Ok(()) + } + + fn base_reimbursement(origin: T::Origin, amount: BalanceOf) -> DispatchResult { + let identity::PermissionedCallOriginData { + sender, + primary_did, + .. + } = Identity::::ensure_origin_call_permissions(origin)?; + + // Not checking the cdd for the treasury account as it is assumed + // that treasury account posses a valid CDD check during the genesis phase + T::Currency::transfer( + &sender, + &Self::account_id(), + amount, + ExistenceRequirement::AllowDeath, + )?; + + Self::deposit_event(RawEvent::TreasuryReimbursement(primary_did, amount)); + + Ok(()) + } + /// The account ID of the treasury pot. /// /// This actually does computation. If you need to keep using it, then make sure you cache the /// value and only call this once. fn account_id() -> T::AccountId { - TREASURY_MODULE_ID.into_account() + TREASURY_PALLET_ID.into_account() } - fn unsafe_disbursement(target: IdentityId, amount: BalanceOf) { - let _ = T::Currency::withdraw( + fn unsafe_disbursement(primary_key: T::AccountId, target: IdentityId, amount: BalanceOf) { + // The transfer failure cases are: + // 1. `target` not having a valid CDD. + // 2. The Treasury not having enough POLYX. This shouldn't happen here, + // since the balance is check before the disbursement. + // 3. `primary_key` balance overflow. + // 4. The Treasury's balance is frozen (staking). + let res = T::Currency::transfer( &Self::account_id(), + &primary_key, amount, - WithdrawReasons::TRANSFER, ExistenceRequirement::AllowDeath, ); - let primary_key = Identity::::did_records(target).primary_key; - let _ = T::Currency::deposit_into_existing(&primary_key, amount); - Self::deposit_event(RawEvent::TreasuryDisbursement(GC_DID, target, amount)); + + // Emit event based on transfer results. + let event = if res.is_ok() { + RawEvent::TreasuryDisbursement + } else { + RawEvent::TreasuryDisbursementFailed + }; + Self::deposit_event(event(GC_DID, target, primary_key, amount)); } /// Returns the current balance of the treasury. @@ -182,3 +239,9 @@ impl OnUnbalanced> for Module { Self::deposit_event(RawEvent::TreasuryReimbursement(current_did, numeric_amount)); } } + +impl StorageInfoTrait for Module { + fn storage_info() -> Vec { + Vec::new() + } +} diff --git a/pallets/utility/Cargo.toml b/pallets/utility/Cargo.toml index d6b81bc16e..24d8a01593 100644 --- a/pallets/utility/Cargo.toml +++ b/pallets/utility/Cargo.toml @@ -2,7 +2,7 @@ name = "pallet-utility" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # General @@ -14,14 +14,15 @@ polymesh-common-utilities = { path = "../common", default-features = false } polymesh-primitives = { path = "../../primitives", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } -frame-benchmarking = { version = "3.0.0", default-features = false, optional = true } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive"] } +sp-core = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } # Only for benchmarks hex-literal = "0.2.1" diff --git a/pallets/utility/src/benchmarking.rs b/pallets/utility/src/benchmarking.rs index 80f8edb070..dc13c32b2d 100644 --- a/pallets/utility/src/benchmarking.rs +++ b/pallets/utility/src/benchmarking.rs @@ -13,7 +13,7 @@ const MAX_CALLS: u32 = 30; /// Generate `c` no-op system remark calls. fn make_calls(c: u32) -> Vec<::Call> { - let call: ::Call = frame_system::Call::::remark(vec![]).into(); + let call: ::Call = frame_system::Call::::remark { remark: vec![] }.into(); vec![call; c as usize] } @@ -24,7 +24,11 @@ fn make_transfer_calls( amount: u128, ) -> Vec<::Call> { let idx = ::Lookup::unlookup(to); - let call: ::Call = BalancesCall::transfer(idx, amount.into()).into(); + let call: ::Call = BalancesCall::transfer { + dest: idx, + value: amount.into(), + } + .into(); vec![call; c as usize] } diff --git a/pallets/utility/src/lib.rs b/pallets/utility/src/lib.rs index 0ffa1d5b1f..aeaafd026c 100644 --- a/pallets/utility/src/lib.rs +++ b/pallets/utility/src/lib.rs @@ -52,6 +52,7 @@ pub mod benchmarking; use codec::{Decode, Encode}; +use frame_support::storage::{with_transaction, TransactionOutcome}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo}, @@ -60,14 +61,14 @@ use frame_support::{ weights::{GetDispatchInfo, Weight}, Parameter, }; -use frame_system::{ensure_root, ensure_signed, Module as System, RawOrigin}; +use frame_system::{ensure_root, ensure_signed, Pallet as System, RawOrigin}; use pallet_balances::{self as balances}; use pallet_permissions::with_call_metadata; use polymesh_common_utilities::{ balances::{CheckCdd, Config as BalancesConfig}, identity::{AuthorizationNonce, Config as IdentityConfig}, - with_transaction, }; +use scale_info::TypeInfo; use sp_runtime::{traits::Dispatchable, traits::Verify, DispatchError, RuntimeDebug}; use sp_std::prelude::*; @@ -138,7 +139,7 @@ decl_event! { } /// Wraps a `Call` and provides uniqueness through a nonce -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)] +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub struct UniqueCall { nonce: AuthorizationNonce, call: Box, @@ -210,19 +211,16 @@ decl_module! { let is_root = Self::ensure_root_or_signed(origin.clone())?; // Run batch inside a transaction - Self::deposit_event(match with_transaction(|| { - // Run batch + Self::deposit_event(with_transaction(|| -> TransactionOutcome> { + // Run batch. match Self::run_batch(origin.clone(), is_root, calls, true) { - Event::BatchCompleted(counts) => Ok(Event::BatchCompleted(counts)), + ev @ Event::BatchCompleted(_) => TransactionOutcome::Commit(Ok(ev)), ev => { - // Batch didn't complete. Abort transaction - Err(ev) + // Batch didn't complete. Rollback transaction. + TransactionOutcome::Rollback(Ok(ev)) } } - }) { - Ok(ev) => ev, - Err(ev) => ev - }); + })?); } /// Dispatch multiple calls from the sender's origin. diff --git a/pallets/weights/Cargo.toml b/pallets/weights/Cargo.toml index 7d5fe5b432..c0013d57aa 100644 --- a/pallets/weights/Cargo.toml +++ b/pallets/weights/Cargo.toml @@ -2,20 +2,21 @@ name = "polymesh-weights" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] # substrate pallets -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -pallet-timestamp = { version = "3.0.0", default-features = false } -pallet-babe = { version = "3.0.0", default-features = false } -pallet-im-online = { version = "3.0.0", default-features = false } -pallet-indices = { version = "3.0.0", default-features = false } -pallet-grandpa = { version = "3.0.0", default-features = false } -pallet-scheduler = { version = "3.0.0", default-features = false } -pallet-session = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +pallet-timestamp = { version = "4.0.0-dev", default-features = false } +pallet-babe = { version = "4.0.0-dev", default-features = false } +pallet-im-online = { version = "4.0.0-dev", default-features = false } +pallet-indices = { version = "4.0.0-dev", default-features = false } +pallet-grandpa = { version = "4.0.0-dev", default-features = false } +pallet-preimage = { version = "4.0.0-dev", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false } +pallet-session = { version = "4.0.0-dev", default-features = false } +sp-std = { version = "4.0.0", default-features = false } # our pallets pallet-asset = { path = "../asset", default-features = false } @@ -39,7 +40,7 @@ pallet-sto = { path = "../sto", default-features = false } pallet-treasury = { path = "../treasury", default-features = false } pallet-utility = { path = "../utility", default-features = false } pallet-test-utils = { path = "../test-utils", default-features = false } -#polymesh-contracts = { path = "../contracts", default-features = false } +polymesh-contracts = { path = "../contracts", default-features = false } polymesh-runtime-common = { path = "../runtime/common", default-features = false } [features] @@ -71,5 +72,5 @@ std = [ "pallet-timestamp/std", "pallet-treasury/std", "pallet-utility/std", - #"polymesh-contracts/std", + "polymesh-contracts/std", ] diff --git a/pallets/weights/src/frame_system.rs b/pallets/weights/src/frame_system.rs index a4a9f76ef2..fa4e6816e9 100644 --- a/pallets/weights/src/frame_system.rs +++ b/pallets/weights/src/frame_system.rs @@ -55,14 +55,12 @@ impl frame_system::WeightInfo for WeightInfo { fn remark(_b: u32) -> Weight { (1_594_000 as Weight) } + fn remark_with_event(_b: u32) -> Weight { + (1_787_000 as Weight) + } fn set_heap_pages() -> Weight { (2_017_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) } - fn set_changes_trie_config() -> Weight { - (12_502_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } fn set_storage(i: u32) -> Weight { (4_121_000 as Weight) // Standard Error: 2_000 @@ -81,7 +79,4 @@ impl frame_system::WeightInfo for WeightInfo { .saturating_add((968_000 as Weight).saturating_mul(p as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) } - fn suicide() -> Weight { - (53_564_000 as Weight) - } } diff --git a/pallets/weights/src/lib.rs b/pallets/weights/src/lib.rs index c5bfd0272b..2a3a5354c0 100644 --- a/pallets/weights/src/lib.rs +++ b/pallets/weights/src/lib.rs @@ -36,6 +36,7 @@ pub mod pallet_indices; pub mod pallet_multisig; pub mod pallet_pips; pub mod pallet_portfolio; +pub mod pallet_preimage; pub mod pallet_protocol_fee; pub mod pallet_relayer; pub mod pallet_rewards; @@ -49,4 +50,4 @@ pub mod pallet_test_utils; pub mod pallet_timestamp; pub mod pallet_treasury; pub mod pallet_utility; -//pub mod polymesh_contracts; +pub mod polymesh_contracts; diff --git a/pallets/weights/src/pallet_asset.rs b/pallets/weights/src/pallet_asset.rs index 120f77ce09..c70bdea629 100644 --- a/pallets/weights/src/pallet_asset.rs +++ b/pallets/weights/src/pallet_asset.rs @@ -159,4 +159,30 @@ impl pallet_asset::WeightInfo for WeightInfo { .saturating_add(DbWeight::get().reads(4 as Weight)) .saturating_add(DbWeight::get().writes(3 as Weight)) } + + fn set_asset_metadata() -> Weight { + (175_547_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn set_asset_metadata_details() -> Weight { + (140_383_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn register_and_set_local_asset_metadata() -> Weight { + (279_615_000 as Weight) + .saturating_add(DbWeight::get().reads(8 as Weight)) + .saturating_add(DbWeight::get().writes(6 as Weight)) + } + fn register_asset_metadata_local_type() -> Weight { + (223_108_000 as Weight) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } + fn register_asset_metadata_global_type() -> Weight { + (157_453_000 as Weight) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) + } } diff --git a/pallets/weights/src/pallet_babe.rs b/pallets/weights/src/pallet_babe.rs index 5b0e5b9a63..5d5da2df92 100644 --- a/pallets/weights/src/pallet_babe.rs +++ b/pallets/weights/src/pallet_babe.rs @@ -24,6 +24,10 @@ use polymesh_runtime_common::{ pub struct WeightInfo; impl pallet_babe::WeightInfo for WeightInfo { + fn plan_config_change() -> Weight { + 0 + } + // WARNING! Some components were not used: ["x"] fn report_equivocation(validator_count: u32) -> Weight { // we take the validator set count from the membership proof to diff --git a/pallets/weights/src/pallet_external_agents.rs b/pallets/weights/src/pallet_external_agents.rs index e74cef34c3..897330ef45 100644 --- a/pallets/weights/src/pallet_external_agents.rs +++ b/pallets/weights/src/pallet_external_agents.rs @@ -59,6 +59,20 @@ impl pallet_external_agents::WeightInfo for WeightInfo { .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) } + fn create_group_and_add_auth(p: u32) -> Weight { + (65_478_000 as Weight) + // Standard Error: 35_000 + .saturating_add((391_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + fn create_and_change_custom_group(p: u32) -> Weight { + (65_478_000 as Weight) + // Standard Error: 35_000 + .saturating_add((391_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(DbWeight::get().reads(6 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } fn set_group_permissions(p: u32) -> Weight { (63_756_000 as Weight) // Standard Error: 58_000 diff --git a/pallets/weights/src/pallet_identity.rs b/pallets/weights/src/pallet_identity.rs index 9f6039e898..82e9916270 100644 --- a/pallets/weights/src/pallet_identity.rs +++ b/pallets/weights/src/pallet_identity.rs @@ -113,7 +113,7 @@ impl pallet_identity::WeightInfo for WeightInfo { .saturating_add(DbWeight::get().reads(6 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn set_permission_to_signer() -> Weight { + fn set_secondary_key_permissions() -> Weight { (45_961_000 as Weight) .saturating_add(DbWeight::get().reads(2 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) diff --git a/pallets/weights/src/pallet_multisig.rs b/pallets/weights/src/pallet_multisig.rs index 18ad79b3a7..383f2dfb94 100644 --- a/pallets/weights/src/pallet_multisig.rs +++ b/pallets/weights/src/pallet_multisig.rs @@ -142,7 +142,7 @@ impl pallet_multisig::WeightInfo for WeightInfo { .saturating_add(DbWeight::get().reads(4 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn make_multisig_signer() -> Weight { + fn make_multisig_secondary() -> Weight { (76_564_000 as Weight) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes(2 as Weight)) diff --git a/pallets/weights/src/pallet_preimage.rs b/pallets/weights/src/pallet_preimage.rs new file mode 100644 index 0000000000..3477116685 --- /dev/null +++ b/pallets/weights/src/pallet_preimage.rs @@ -0,0 +1,134 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_preimage +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_preimage +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/preimage/src/weights.rs +// --template=.maintain/frame-weight-template.hbs +// --header=HEADER-APACHE2 +// --raw + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; + +/// Weights for pallet_scheduler using the Substrate node and recommended hardware. +pub struct WeightInfo; +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn note_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + fn note_requested_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:0) + fn note_no_deposit_preimage(s: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + (39_239_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + (24_905_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + (37_451_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + (23_397_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + (13_407_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + (4_202_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + (24_858_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_unnoted_preimage() -> Weight { + (13_763_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + (4_262_000 as Weight) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } +} diff --git a/pallets/weights/src/pallet_scheduler.rs b/pallets/weights/src/pallet_scheduler.rs index 1f3fe6ae12..7a656a4d31 100644 --- a/pallets/weights/src/pallet_scheduler.rs +++ b/pallets/weights/src/pallet_scheduler.rs @@ -52,6 +52,117 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_scheduler using the Substrate node and recommended hardware. pub struct WeightInfo; impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_periodic_named_resolved(s: u32) -> Weight { + (11_587_000 as Weight) + // Standard Error: 17_000 + .saturating_add((17_428_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named_resolved(s: u32) -> Weight { + (8_965_000 as Weight) + // Standard Error: 11_000 + .saturating_add((13_410_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn on_initialize_periodic_resolved(s: u32) -> Weight { + (8_654_000 as Weight) + // Standard Error: 17_000 + .saturating_add((14_990_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn on_initialize_resolved(s: u32) -> Weight { + (9_303_000 as Weight) + // Standard Error: 10_000 + .saturating_add((12_244_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named_aborted(s: u32) -> Weight { + (7_506_000 as Weight) + // Standard Error: 3_000 + .saturating_add((5_208_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Preimage PreimageFor (r:1 w:0) + fn on_initialize_aborted(s: u32) -> Weight { + (8_046_000 as Weight) + // Standard Error: 3_000 + .saturating_add((2_914_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(2 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(2 as Weight)) + } + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_periodic_named(s: u32) -> Weight { + (13_704_000 as Weight) + // Standard Error: 4_000 + .saturating_add((8_186_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:2 w:2) + fn on_initialize_periodic(s: u32) -> Weight { + (12_668_000 as Weight) + // Standard Error: 5_000 + .saturating_add((5_868_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + fn on_initialize_named(s: u32) -> Weight { + (13_946_000 as Weight) + // Standard Error: 4_000 + .saturating_add((4_367_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + // Storage: Scheduler Agenda (r:1 w:1) + fn on_initialize(s: u32) -> Weight { + (13_151_000 as Weight) + // Standard Error: 4_000 + .saturating_add((3_455_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(1 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } fn schedule(s: u32) -> Weight { (30_395_000 as Weight) // Standard Error: 8_000 diff --git a/pallets/weights/src/pallet_statistics.rs b/pallets/weights/src/pallet_statistics.rs index 878a7d05b6..fb92a00718 100644 --- a/pallets/weights/src/pallet_statistics.rs +++ b/pallets/weights/src/pallet_statistics.rs @@ -52,27 +52,31 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_statistics using the Substrate node and recommended hardware. pub struct WeightInfo; impl pallet_statistics::WeightInfo for WeightInfo { - fn add_transfer_manager() -> Weight { - (63_842_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) + fn set_active_asset_stats(i: u32) -> Weight { + (133_150_000 as Weight) + // Standard Error: 21_000 + .saturating_add((202_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) .saturating_add(DbWeight::get().writes(1 as Weight)) } - fn remove_transfer_manager() -> Weight { - (61_562_000 as Weight) + fn batch_update_asset_stats(i: u32) -> Weight { + (281_755_000 as Weight) + // Standard Error: 142_000 + .saturating_add((6_192_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn add_exempted_entities(i: u32) -> Weight { - (79_926_000 as Weight) - // Standard Error: 17_000 - .saturating_add((4_260_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } - fn remove_exempted_entities(i: u32) -> Weight { - (65_490_000 as Weight) - // Standard Error: 15_000 - .saturating_add((4_348_000 as Weight).saturating_mul(i as Weight)) + fn set_asset_transfer_compliance(i: u32) -> Weight { + (8_316_761_000 as Weight) + // Standard Error: 11_125_000 + .saturating_add((132_573_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(DbWeight::get().reads(7 as Weight)) + .saturating_add(DbWeight::get().writes(1 as Weight)) + } + fn set_entities_exempt(i: u32) -> Weight { + (133_340_000 as Weight) + // Standard Error: 87_000 + .saturating_add((5_514_000 as Weight).saturating_mul(i as Weight)) .saturating_add(DbWeight::get().reads(5 as Weight)) .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) } diff --git a/pallets/weights/src/polymesh_contracts.rs b/pallets/weights/src/polymesh_contracts.rs index dba641bb18..527ffd562a 100644 --- a/pallets/weights/src/polymesh_contracts.rs +++ b/pallets/weights/src/polymesh_contracts.rs @@ -1,57 +1,201 @@ -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.1 +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for polymesh_contracts +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-05-16, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 + +// Executed Command: +// ./target/release/polymesh +// benchmark +// pallet +// -s +// 100 +// -r +// 5 +// -p=polymesh_contracts +// -e=* +// --heap-pages +// 4096 +// --db-cache +// 512 +// --execution +// wasm +// --wasm-execution +// compiled +// --output +// ./pallets/weights/src/ +// --template +// ./.maintain/frame-weight-template.hbs #![allow(unused_parens)] #![allow(unused_imports)] use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; +/// Weights for polymesh_contracts using the Substrate node and recommended hardware. pub struct WeightInfo; impl polymesh_contracts::WeightInfo for WeightInfo { - fn put_code(l: u32, u: u32, d: u32) -> Weight { - (0 as Weight) - .saturating_add((259_000 as Weight).saturating_mul(l as Weight)) - .saturating_add((14_000 as Weight).saturating_mul(u as Weight)) - .saturating_add((18_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Storage: Identity KeyRecords (r:2 w:0) + // Storage: System Account (r:1 w:0) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:0) + // Storage: Timestamp Now (r:1 w:0) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + fn prepare_instantiate_full(n: u32) -> Weight { + (546_824_000 as Weight) + // Standard Error: 4_000 + .saturating_add((107_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(12 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) } - fn instantiate() -> Weight { - (1_724_633_000 as Weight) - .saturating_add(DbWeight::get().reads(19 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Storage: Identity KeyRecords (r:2 w:0) + // Storage: System Account (r:1 w:0) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:0) + // Storage: Timestamp Now (r:1 w:0) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + // Storage: Identity CurrentDid (r:1 w:1) + // Storage: Permissions CurrentPalletName (r:1 w:1) + // Storage: Permissions CurrentDispatchableName (r:1 w:1) + // Storage: Asset CustomTypesInverse (r:1 w:1) + // Storage: Asset CustomTypeIdSequence (r:1 w:1) + // Storage: Asset CustomTypes (r:0 w:1) + fn chain_extension_full(n: u32) -> Weight { + (859_188_000 as Weight) + // Standard Error: 3_000 + .saturating_add((15_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(17 as Weight)) + .saturating_add(DbWeight::get().writes(8 as Weight)) } - fn freeze_instantiation() -> Weight { - (123_290_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:2 w:0) + // Storage: System Account (r:1 w:0) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:0) + // Storage: Timestamp Now (r:1 w:0) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + fn chain_extension_early_exit() -> Weight { + (482_664_000 as Weight) + .saturating_add(DbWeight::get().reads(12 as Weight)) + .saturating_add(DbWeight::get().writes(2 as Weight)) } - fn unfreeze_instantiation() -> Weight { - (141_107_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:1 w:0) + // Storage: Asset CustomTypesInverse (r:1 w:1) + // Storage: Asset CustomTypeIdSequence (r:1 w:1) + // Storage: Asset CustomTypes (r:0 w:1) + fn basic_runtime_call(n: u32) -> Weight { + (82_563_000 as Weight) + // Standard Error: 0 + .saturating_add((12_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(3 as Weight)) } - fn transfer_template_ownership() -> Weight { - (201_119_000 as Weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:2 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:0) + // Storage: Timestamp Now (r:1 w:0) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + fn call() -> Weight { + (552_614_000 as Weight) + .saturating_add(DbWeight::get().reads(13 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) } - fn change_template_fees() -> Weight { - (2_494_202_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Storage: Identity KeyRecords (r:2 w:1) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Contracts Nonce (r:1 w:1) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Timestamp Now (r:1 w:0) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + // Storage: Contracts OwnerInfoOf (r:1 w:1) + // Storage: Identity DidKeys (r:0 w:1) + fn instantiate_with_hash(s: u32) -> Weight { + (851_926_000 as Weight) + // Standard Error: 0 + .saturating_add((6_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(15 as Weight)) + .saturating_add(DbWeight::get().writes(9 as Weight)) } - fn change_template_meta_url(u: u32) -> Weight { - (2_196_686_000 as Weight) - .saturating_add((11_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:2 w:1) + // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) + // Storage: Contracts CodeStorage (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Contracts Nonce (r:1 w:1) + // Storage: Contracts ContractInfoOf (r:1 w:1) + // Storage: Timestamp Now (r:1 w:0) + // Storage: Identity IsDidFrozen (r:1 w:0) + // Storage: Instance2Group ActiveMembers (r:1 w:0) + // Storage: Instance2Group InactiveMembers (r:1 w:0) + // Storage: Identity Claims (r:2 w:0) + // Storage: Identity DidKeys (r:0 w:1) + // Storage: Contracts PristineCode (r:0 w:1) + // Storage: Contracts OwnerInfoOf (r:0 w:1) + fn instantiate_with_code(c: u32, s: u32) -> Weight { + (1_161_103_000 as Weight) + // Standard Error: 0 + .saturating_add((406_000 as Weight).saturating_mul(c as Weight)) + // Standard Error: 0 + .saturating_add((6_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(DbWeight::get().reads(14 as Weight)) + .saturating_add(DbWeight::get().writes(10 as Weight)) } - fn update_schedule() -> Weight { - (55_649_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:1 w:0) + // Storage: Contracts CodeStorage (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Contracts PristineCode (r:0 w:1) + // Storage: Contracts OwnerInfoOf (r:0 w:1) + fn upload_code(c: u32) -> Weight { + (184_633_000 as Weight) + // Standard Error: 0 + .saturating_add((142_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) } - fn set_put_code_flag() -> Weight { - (25_048_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Storage: Identity KeyRecords (r:1 w:0) + // Storage: Contracts OwnerInfoOf (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Contracts CodeStorage (r:0 w:1) + // Storage: Contracts PristineCode (r:0 w:1) + fn remove_code() -> Weight { + (106_681_000 as Weight) + .saturating_add(DbWeight::get().reads(3 as Weight)) + .saturating_add(DbWeight::get().writes(4 as Weight)) } } diff --git a/polymesh_schema.json b/polymesh_schema.json index 36993a6478..fa30c23a8e 100644 --- a/polymesh_schema.json +++ b/polymesh_schema.json @@ -77,6 +77,33 @@ "divisible": "bool", "asset_type": "AssetType" }, + "AssetMetadataName": "Text", + "AssetMetadataValue": "Vec", + "AssetMetadataLocalKey": "u64", + "AssetMetadataGlobalKey": "u64", + "AssetMetadataKey": { + "_enum": { + "Global": "u64", + "Local": "u64" + } + }, + "AssetMetadataLockStatus": { + "_enum": { + "Unlocked": "", + "Locked": "", + "LockedUntil": "Moment" + } + }, + "AssetMetadataValueDetail": { + "expire": "Option", + "lock_status": "AssetMetadataLockStatus" + }, + "AssetMetadataDescription": "Text", + "AssetMetadataSpec": { + "url": "Option", + "description": "Option", + "type_def": "Option>" + }, "PalletName": "Text", "DispatchableName": "Text", "AssetPermissions": { @@ -116,16 +143,6 @@ "extrinsic": "ExtrinsicPermissions", "portfolio": "PortfolioPermissions" }, - "LegacyPalletPermissions": { - "pallet_name": "PalletName", - "total": "bool", - "dispatchable_names": "Vec" - }, - "LegacyPermissions": { - "asset": "Option>", - "extrinsic": "Option>", - "portfolio": "Option>" - }, "Signatory": { "_enum": { "Identity": "IdentityId", @@ -133,12 +150,12 @@ } }, "SecondaryKey": { - "signer": "Signatory", + "key": "AccountId", "permissions": "Permissions" }, "SecondaryKeyWithAuth": { "secondary_key": "SecondaryKey", - "auth_signature": "Signature" + "auth_signature": "H512" }, "Subsidy": { "paying_key": "AccountId", @@ -163,8 +180,14 @@ "secondary_key": "SecondaryKey" }, "DidRecord": { - "primary_key": "AccountId", - "secondary_keys": "Vec" + "primary_key": "Option" + }, + "KeyRecord": { + "_enum": { + "PrimaryKey": "IdentityId", + "SecondaryKey": "(IdentityId, Permissions)", + "MultiSigSignerKey": "AccountId" + } }, "KeyIdentityData": { "identity": "IdentityId", @@ -431,7 +454,11 @@ "Custom": "Vec" } }, - "InvestorZKProofData": "Signature", + "InvestorZKProofData": { + "r": "CompressedRistretto", + "s": "Scalar" + }, + "CompressedRistretto": "[u8; 32]", "Scalar": "[u8; 32]", "RistrettoPoint": "[u8; 32]", "ZkProofData": { @@ -650,13 +677,7 @@ "Proposal": "Vec" } }, - "OffChainSignature": { - "_enum": { - "Ed25519": "H512", - "Sr25519": "H512", - "Ecdsa": "H512" - } - }, + "OffChainSignature": "MultiSignature", "Authorization": { "authorization_data": "AuthorizationData", "authorized_by": "IdentityId", @@ -709,24 +730,67 @@ "frozen": "bool" }, "AuthorizationNonce": "u64", - "Counter": "u64", "Percentage": "Permill", - "TransferManager": { - "_enum": { - "CountTransferManager": "Counter", - "PercentageTransferManager": "Percentage" - } - }, "RestrictionResult": { "_enum": ["Valid", "Invalid", "ForceValid"] }, - "Memo": "[u8;32]", + "Memo": "[u8; 32]", "BridgeTx": { "nonce": "u32", "recipient": "AccountId", "amount": "Balance", "tx_hash": "H256" }, + "AssetScope": { + "_enum": { + "Ticker": "Ticker" + } + }, + "StatOpType": { + "_enum": ["Count", "Balance"] + }, + "StatType": { + "op": "StatOpType", + "claim_issuer": "Option<(ClaimType, IdentityId)>" + }, + "StatClaim": { + "_enum": { + "Accredited": "bool", + "Affiliate": "bool", + "Jurisdiction": "Option" + } + }, + "Stat1stKey": { + "asset": "AssetScope", + "stat_type": "StatType" + }, + "Stat2ndKey": { + "_enum": { + "NoClaimStat": "", + "Claim": "StatClaim" + } + }, + "StatUpdate": { + "key2": "Stat2ndKey", + "value": "Option" + }, + "TransferCondition": { + "_enum": { + "MaxInvestorCount": "u64", + "MaxInvestorOwnership": "Percentage", + "ClaimCount": "(StatClaim, IdentityId, u64, Option)", + "ClaimOwnership": "(StatClaim, IdentityId, Percentage, Percentage)" + } + }, + "AssetTransferCompliance": { + "paused": "bool", + "requirements": "Vec" + }, + "TransferConditionExemptKey": { + "asset": "AssetScope", + "op": "StatOpType", + "claim_type": "Option" + }, "AssetCompliance": { "paused": "bool", "requirements": "Vec" @@ -784,13 +848,13 @@ "Err": "Vec" } }, - "DidRecordsSuccess": { + "RpcDidRecordsSuccess": { "primary_key": "AccountId", "secondary_keys": "Vec" }, - "DidRecords": { + "RpcDidRecords": { "_enum": { - "Success": "DidRecordsSuccess", + "Success": "RpcDidRecordsSuccess", "IdNotFound": "Vec" } }, @@ -910,7 +974,7 @@ "start": "Option", "period": "CalendarPeriod", "remaining": "u32" - }, + }, "InstructionStatus": { "_enum": { "Unknown": "", @@ -989,6 +1053,12 @@ "negative": "bool", "degree": "u8" }, + "WeightPerClass": { + "baseExtrinsic": "Weight", + "maxExtrinsic": "Option", + "maxTotal": "Option", + "reserved": "Option" + }, "TargetIdentity": { "_enum": { "ExternalAgent": "", @@ -1106,7 +1176,7 @@ "sender_insufficient_balance": "bool", "portfolio_validity_result": "PortfolioValidityResult", "asset_frozen": "bool", - "statistics_result": "Vec", + "transfer_condition_result": "Vec", "compliance_result": "AssetComplianceResult", "result": "bool" }, @@ -1117,8 +1187,8 @@ "sender_insufficient_balance": "bool", "result": "bool" }, - "TransferManagerResult": { - "tm": "TransferManager", + "TransferConditionResult": { + "condition": "TransferCondition", "result": "bool" }, "AGId": "u32", @@ -1219,7 +1289,7 @@ "isOptional": true } ], - "type": "DidRecords" + "type": "RpcDidRecords" }, "getDidStatus": { "description": "Retrieve status of the DID", diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index d7e9e66428..87108480bf 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -2,13 +2,13 @@ name = "polymesh-primitives" version = "2.0.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] chrono = {version = "0.4.18", default-features = false } serde = { version = "1.0.104", optional = true, default-features = false, features = ["derive"] } -rand_core = { version = "0.5", default-features = false } -rand = { version = "0.7.3", default-features = false, optional = true } +rand_core = { version = "0.6", default-features = false } +rand = { version = "0.8", default-features = false, optional = true } rustc-hex = { version = "2.1.0", default-features = false } either = { version = "1.6.1", default-features = false } @@ -16,24 +16,25 @@ either = { version = "1.6.1", default-features = false } polymesh-primitives-derive = { path = "../primitives_derive", default-features = false } # Crypto -blake2 = { version = "0.9", default-features = false } -confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v2.0.0" } -confidential_identity_v1 = { package = "confidential_identity", git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, tag = "confidential-identity-v1.1.3" } +blake2 = { version = "0.10.2", default-features = false } +confidential_identity = { git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v2" } +confidential_identity_v1 = { package = "confidential_identity", git = "https://github.com/PolymathNetwork/cryptography.git", default-features = false, branch = "confidential-identity-v1" } schnorrkel = { version = "0.10.1", default-features = false } # Substrate -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } -frame-support = { version = "3.0.0", default-features = false } -frame-system = { version = "3.0.0", default-features = false } -sp-application-crypto = { version = "3.0.0", default-features = false, optional = true } -sp-arithmetic = { version = "3.0.0", default-features = false } -sp-core = { version = "3.0.0", default-features = false } -sp-io = { version = "3.0.0", default-features = false } -sp-runtime = { version = "3.0.0", default-features = false } -sp-runtime-interface = { version = "3.0.0", default-features = false } -sp-std = { version = "3.0.0", default-features = false } -sp-version = { version = "3.0.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } +scale-info = { version = "2.0", default-features = false, features = ["derive", "decode"] } +sp-application-crypto = { version = "6.0.0", default-features = false, optional = true } +sp-arithmetic = { version = "5.0.0", default-features = false } +sp-core = { version = "6.0.0", default-features = false } +sp-io = { version = "6.0.0", default-features = false } +sp-runtime = { version = "6.0.0", default-features = false } +sp-runtime-interface = { version = "6.0.0", default-features = false } +sp-std = { version = "4.0.0", default-features = false } +sp-version = { version = "5.0.0", default-features = false } libsecp256k1 = { version = "0.6", default-features = false, features = ["hmac", "static-context"] } [dev-dependencies] @@ -66,6 +67,7 @@ std = [ # Crypto "blake2/simd", "blake2/std", + "confidential_identity/std", "confidential_identity_v1/std", "polymesh-primitives-derive/std", "schnorrkel/std", @@ -73,6 +75,7 @@ std = [ # Rng "rand/std", + "rand/std_rng", "rand_core/std", ] diff --git a/primitives/asset-metadata/Cargo.toml b/primitives/asset-metadata/Cargo.toml new file mode 100644 index 0000000000..33ded5aa3b --- /dev/null +++ b/primitives/asset-metadata/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "asset-metadata" +version = "0.1.0" +edition = "2021" + +[dependencies] +# Polymesh primitives. +polymesh-primitives = { path = "../", default-features = false } + +# SCALE +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.0", default-features = false, features = ["derive", "decode"] } + +[features] +default = ["std"] +no_std = [] +std = [ + "codec/std", + "polymesh-primitives/std", +] diff --git a/primitives/asset-metadata/README.md b/primitives/asset-metadata/README.md new file mode 100644 index 0000000000..39102617dc --- /dev/null +++ b/primitives/asset-metadata/README.md @@ -0,0 +1,4 @@ +# Example Custom Asset Metadata types definition. + +This crate is an example for how to define new asset metadata types. + diff --git a/primitives/asset-metadata/example_schema.json b/primitives/asset-metadata/example_schema.json new file mode 100644 index 0000000000..b2213451c7 --- /dev/null +++ b/primitives/asset-metadata/example_schema.json @@ -0,0 +1,20 @@ +{ + "Duration": { + "secs": "i64", + "nanos": "i32" + }, + "Date": { + "year": "u16", + "month": "u8", + "day": "u8" + }, + "Time": { + "hour": "u8", + "minute": "u8", + "second": "u8" + }, + "DateTime": { + "date": "Date", + "time": "Time" + } +} diff --git a/primitives/asset-metadata/src/bin/dump_specs.rs b/primitives/asset-metadata/src/bin/dump_specs.rs new file mode 100644 index 0000000000..222b67b0c6 --- /dev/null +++ b/primitives/asset-metadata/src/bin/dump_specs.rs @@ -0,0 +1,30 @@ +use codec::Encode; +use std::io::Write; + +use asset_metadata::*; +use polymesh_primitives::asset_metadata::AssetMetadataTypeDef; + +fn main() { + let mut args = std::env::args(); + args.next(); // skip program name. + let type_name = args.next().unwrap_or("Duration".into()); + let type_def = match type_name.as_str() { + "Duration" => AssetMetadataTypeDef::new_from_type::(), + "Date" => AssetMetadataTypeDef::new_from_type::(), + "Time" => AssetMetadataTypeDef::new_from_type::

| (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec
]>; + setUncles: AugmentedSubmittable<(newUncles: Vec | (SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Generic tx **/ [key: string]: SubmittableExtrinsicFunction; }; babe: { + /** + * Plan an epoch config change. The epoch config change is recorded and will be enacted on + * the next call to `enact_epoch_change`. The config will be activated one epoch after. + * Multiple calls to this method will replace any existing planned config change that had + * not been enacted yet. + **/ + planConfigChange: AugmentedSubmittable<(config: SpConsensusBabeDigestsNextConfigDescriptor | { V1: any } | string | Uint8Array) => SubmittableExtrinsic, [SpConsensusBabeDigestsNextConfigDescriptor]>; /** * Report authority equivocation/misbehavior. This method will verify * the equivocation proof and validate the given key ownership proof * against the extracted offender. If both are valid, the offence will * be reported. **/ - reportEquivocation: AugmentedSubmittable<(equivocationProof: BabeEquivocationProof | { offender?: any; slotNumber?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [BabeEquivocationProof, KeyOwnerProof]>; + reportEquivocation: AugmentedSubmittable<(equivocationProof: SpConsensusSlotsEquivocationProof | { offender?: any; slot?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: SpSessionMembershipProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [SpConsensusSlotsEquivocationProof, SpSessionMembershipProof]>; /** * Report authority equivocation/misbehavior. This method will verify * the equivocation proof and validate the given key ownership proof @@ -320,7 +413,7 @@ declare module '@polkadot/api/types/submittable' { * if the block author is defined it will be defined as the equivocation * reporter. **/ - reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: BabeEquivocationProof | { offender?: any; slotNumber?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [BabeEquivocationProof, KeyOwnerProof]>; + reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: SpConsensusSlotsEquivocationProof | { offender?: any; slot?: any; firstHeader?: any; secondHeader?: any } | string | Uint8Array, keyOwnerProof: SpSessionMembershipProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [SpConsensusSlotsEquivocationProof, SpSessionMembershipProof]>; /** * Generic tx **/ @@ -330,11 +423,11 @@ declare module '@polkadot/api/types/submittable' { /** * Burns the given amount of tokens from the caller's free, unlocked balance. **/ - burnAccountBalance: AugmentedSubmittable<(amount: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Balance]>; + burnAccountBalance: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; /** * Move some POLYX from balance of self to balance of BRR. **/ - depositBlockRewardReserveBalance: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; + depositBlockRewardReserveBalance: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; /** * Exactly as `transfer`, except the origin must be root and the source account may be * specified. @@ -344,7 +437,7 @@ declare module '@polkadot/api/types/submittable' { * not assumed to be in the overlay. * # **/ - forceTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [LookupSource, LookupSource, Compact]>; + forceTransfer: AugmentedSubmittable<(source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, MultiAddress, Compact]>; /** * Set the balances of a given account. * @@ -353,7 +446,7 @@ declare module '@polkadot/api/types/submittable' { * * The dispatch origin for this call is `root`. **/ - setBalance: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array, newReserved: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [LookupSource, Compact, Compact]>; + setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array, newReserved: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact, Compact]>; /** * Transfer some liquid free balance to another account. * @@ -378,7 +471,7 @@ declare module '@polkadot/api/types/submittable' { * - Origin account is already in memory, so no DB operations for them. * # **/ - transfer: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [LookupSource, Compact]>; + transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact]>; /** * Transfer the native currency with the help of identifier string * this functionality can help to differentiate the transfers. @@ -389,7 +482,13 @@ declare module '@polkadot/api/types/submittable' { * - Origin account is already in memory, so no DB operations for them. * # **/ - transferWithMemo: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, memo: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [LookupSource, Compact, Option]>; + transferWithMemo: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, memo: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact, Option]>; + /** + * Generic tx + **/ + [key: string]: SubmittableExtrinsicFunction; + }; + base: { /** * Generic tx **/ @@ -402,7 +501,7 @@ declare module '@polkadot/api/types/submittable' { * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - addFreezeAdmin: AugmentedSubmittable<(freezeAdmin: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + addFreezeAdmin: AugmentedSubmittable<(freezeAdmin: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Proposes a vector of bridge transactions. The vector is processed until the first * proposal which causes an error, in which case the error is returned and the rest of @@ -414,21 +513,21 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `500_000_000 + 7_000_000 * bridge_txs.len()` **/ - batchProposeBridgeTx: AugmentedSubmittable<(bridgeTxs: Vec | (BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + batchProposeBridgeTx: AugmentedSubmittable<(bridgeTxs: Vec | (PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Changes the bridge admin key. * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - changeAdmin: AugmentedSubmittable<(admin: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + changeAdmin: AugmentedSubmittable<(admin: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Changes the bridge limit exempted list. * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - changeBridgeExempted: AugmentedSubmittable<(exempted: Vec> | ([IdentityId | string | Uint8Array, bool | boolean | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; + changeBridgeExempted: AugmentedSubmittable<(exempted: Vec> | ([PolymeshPrimitivesIdentityId | string | Uint8Array, bool | boolean | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; /** * Changes the bridge limits. * @@ -436,21 +535,21 @@ declare module '@polkadot/api/types/submittable' { * - `BadAdmin` if `origin` is not `Self::admin()` account. * - `DivisionByZero` if `duration` is zero. **/ - changeBridgeLimit: AugmentedSubmittable<(amount: Balance | AnyNumber | Uint8Array, duration: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Balance, BlockNumber]>; + changeBridgeLimit: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array, duration: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128, u32]>; /** * Changes the controller account as admin. * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - changeController: AugmentedSubmittable<(controller: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + changeController: AugmentedSubmittable<(controller: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Changes the timelock period. * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - changeTimelock: AugmentedSubmittable<(timelock: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BlockNumber]>; + changeTimelock: AugmentedSubmittable<(timelock: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Forces handling a transaction by bypassing the bridge limit and timelock. * @@ -458,7 +557,7 @@ declare module '@polkadot/api/types/submittable' { * - `BadAdmin` if `origin` is not `Self::admin()` account. * - `NoValidCdd` if `bridge_tx.recipient` does not have a valid CDD claim. **/ - forceHandleBridgeTx: AugmentedSubmittable<(bridgeTx: BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array) => SubmittableExtrinsic, [BridgeTx]>; + forceHandleBridgeTx: AugmentedSubmittable<(bridgeTx: PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletBridgeBridgeTx]>; /** * Freezes transaction handling in the bridge module if it is not already frozen. When the * bridge is frozen, attempted transactions get postponed instead of getting handled. @@ -477,7 +576,7 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `400_000_000 + 2_000_000 * bridge_txs.len()` **/ - freezeTxs: AugmentedSubmittable<(bridgeTxs: Vec | (BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + freezeTxs: AugmentedSubmittable<(bridgeTxs: Vec | (PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Handles an approved bridge transaction proposal. * @@ -486,7 +585,7 @@ declare module '@polkadot/api/types/submittable' { * - `TimelockedTx` if the transaction status is `Timelocked`. * - `ProposalAlreadyHandled` if the transaction status is `Handled`. **/ - handleBridgeTx: AugmentedSubmittable<(bridgeTx: BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array) => SubmittableExtrinsic, [BridgeTx]>; + handleBridgeTx: AugmentedSubmittable<(bridgeTx: PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletBridgeBridgeTx]>; /** * Root callable extrinsic, used as an internal call to handle a scheduled timelocked bridge transaction. * @@ -495,7 +594,7 @@ declare module '@polkadot/api/types/submittable' { * - `ProposalAlreadyHandled` if transaction status is `Handled`. * - `FrozenTx` if transaction status is `Frozen`. **/ - handleScheduledBridgeTx: AugmentedSubmittable<(bridgeTx: BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array) => SubmittableExtrinsic, [BridgeTx]>; + handleScheduledBridgeTx: AugmentedSubmittable<(bridgeTx: PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletBridgeBridgeTx]>; /** * Proposes a bridge transaction, which amounts to making a multisig proposal for the * bridge transaction if the transaction is new or approving an existing proposal if the @@ -504,14 +603,22 @@ declare module '@polkadot/api/types/submittable' { * ## Errors * - `ControllerNotSet` if `Controllers` was not set. **/ - proposeBridgeTx: AugmentedSubmittable<(bridgeTx: BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array) => SubmittableExtrinsic, [BridgeTx]>; + proposeBridgeTx: AugmentedSubmittable<(bridgeTx: PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletBridgeBridgeTx]>; /** * Remove a freeze admin. * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. **/ - removeFreezeAdmin: AugmentedSubmittable<(freezeAdmin: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + removeFreezeAdmin: AugmentedSubmittable<(freezeAdmin: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; + /** + * Remove given bridge transactions. + * + * ## Errors + * - `BadAdmin` if `origin` is not `Self::admin()` account. + * - `NotFrozen` if a tx in `bridge_txs` is not frozen. + **/ + removeTxs: AugmentedSubmittable<(bridgeTxs: Vec | (PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Unfreezes transaction handling in the bridge module if it is frozen. * @@ -529,7 +636,7 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `400_000_000 + 7_000_000 * bridge_txs.len()` **/ - unfreezeTxs: AugmentedSubmittable<(bridgeTxs: Vec | (BridgeTx | { nonce?: any; recipient?: any; amount?: any; tx_hash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + unfreezeTxs: AugmentedSubmittable<(bridgeTxs: Vec | (PalletBridgeBridgeTx | { nonce?: any; recipient?: any; amount?: any; txHash?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Generic tx **/ @@ -547,7 +654,7 @@ declare module '@polkadot/api/types/submittable' { * they are rounded down to a whole unit. * * ## Arguments - * - `origin` which must be a holder of for a CAA of `ca_id`. + * - `origin` which must be a holder of the asset and eligible for the distribution. * - `ca_id` identifies the CA to start a capital distribution for. * * # Errors @@ -561,7 +668,7 @@ declare module '@polkadot/api/types/submittable' { * - `BalanceAmountProductSupplyDivisionFailed` if `ba * supply` would overflow. * - Other errors can occur if the compliance manager rejects the transfer. **/ - claim: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId]>; + claim: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId]>; /** * Start and attach a capital distribution, to the CA identified by `ca_id`, * with `amount` funds in `currency` withdrawn from `portfolio` belonging to `origin`'s DID. @@ -579,9 +686,9 @@ declare module '@polkadot/api/types/submittable' { * which is now transferrable. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the CA to start a capital distribution for. - * - `portfolio` specifies the portfolio number of the CAA to distribute `amount` from. + * - `portfolio` specifies the portfolio number of the agent to distribute `amount` from. * - `currency` to withdraw and distribute from the `portfolio`. * - `per_share` amount of `currency` to withdraw and distribute. * Specified as a per-million, i.e. `1 / 10^6`th of one `currency` token. @@ -592,20 +699,22 @@ declare module '@polkadot/api/types/submittable' { * * # Errors * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `ticker`. - * - `DistributingAsset` if `ca_id.ticker == currency`. * - `ExpiryBeforePayment` if `expires_at.unwrap() <= payment_at`. * - `NoSuchCA` if `ca_id` does not identify an existing CA. * - `NoRecordDate` if CA has no record date. * - `RecordDateAfterStart` if CA's record date > payment_at. - * - `UnauthorizedCustodian` if CAA is not the custodian of `portfolio`. + * - `UnauthorizedCustodian` if the caller is not the custodian of `portfolio`. * - `InsufficientPortfolioBalance` if `portfolio` has less than `amount` of `currency`. * - `InsufficientBalance` if the protocol fee couldn't be charged. + * - `CANotBenefit` if the CA is not of kind PredictableBenefit/UnpredictableBenefit + * - `DistributionAmountIsZero` if the `amount` is zero. + * - `DistributionPerShareIsZero` if the `per_share` is zero. * * # Permissions * * Asset * * Portfolio **/ - distribute: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, portfolio: Option | null | object | string | Uint8Array, currency: Ticker | string | Uint8Array, perShare: Balance | AnyNumber | Uint8Array, amount: Balance | AnyNumber | Uint8Array, paymentAt: Moment | AnyNumber | Uint8Array, expiresAt: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [CAId, Option, Ticker, Balance, Balance, Moment, Option]>; + distribute: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, portfolio: Option | null | object | string | Uint8Array, currency: PolymeshPrimitivesTicker | string | Uint8Array, perShare: u128 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, paymentAt: u64 | AnyNumber | Uint8Array, expiresAt: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, Option, PolymeshPrimitivesTicker, u128, u128, u64, Option]>; /** * Push benefit of an ongoing distribution to the given `holder`. * @@ -617,7 +726,7 @@ declare module '@polkadot/api/types/submittable' { * they are rounded down to a whole unit. * * ## Arguments - * - `origin` which must be a holder of for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the CA with a capital distributions to push benefits for. * - `holder` to push benefits to. * @@ -632,7 +741,7 @@ declare module '@polkadot/api/types/submittable' { * - `BalanceAmountProductSupplyDivisionFailed` if `ba * supply` would overflow. * - Other errors can occur if the compliance manager rejects the transfer. **/ - pushBenefit: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, holder: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [CAId, IdentityId]>; + pushBenefit: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, holder: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, PolymeshPrimitivesIdentityId]>; /** * Assuming a distribution has expired, * unlock the remaining amount in the distributor portfolio. @@ -646,13 +755,13 @@ declare module '@polkadot/api/types/submittable' { * - `AlreadyReclaimed` if this function has already been called successfully. * - `NotExpired` if `now < expiry`. **/ - reclaim: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId]>; + reclaim: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId]>; /** * Removes a distribution that hasn't started yet, * unlocking the full amount in the distributor portfolio. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the CA with a not-yet-started capital distribution to remove. * * # Errors @@ -660,7 +769,7 @@ declare module '@polkadot/api/types/submittable' { * - `NoSuchDistribution` if there's no capital distribution for `ca_id`. * - `DistributionStarted` if `payment_at <= now`. **/ - removeDistribution: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId]>; + removeDistribution: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId]>; /** * Generic tx **/ @@ -687,7 +796,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `AddOrigin` or root * * `who` - IdentityId to be added to the group. **/ - addMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + addMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Disables a member at specific moment. * @@ -706,7 +815,7 @@ declare module '@polkadot/api/types/submittable' { * * `expiry` - Time-stamp when `who` is removed from CDD. As soon as it is expired, the * generated claims will be "invalid" as `who` is not considered a member of the group. **/ - disableMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Option, Option]>; + disableMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, Option, Option]>; /** * Removes a member `who` from the set. May only be called from `RemoveOrigin` or root. * @@ -719,7 +828,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `RemoveOrigin` or root * * `who` - IdentityId to be removed from the group. **/ - removeMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + removeMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Changes the membership to a new set, disregarding the existing membership. * May only be called from `ResetOrigin` or root. @@ -728,14 +837,14 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `ResetOrigin` or root * * `members` - New set of identities **/ - resetMembers: AugmentedSubmittable<(members: Vec | (IdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + resetMembers: AugmentedSubmittable<(members: Vec | (PolymeshPrimitivesIdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Change this group's limit for how many concurrent active members they may be. * * # Arguments * * `limit` - the number of active members there may be concurrently. **/ - setActiveMembersLimit: AugmentedSubmittable<(limit: MemberCount | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MemberCount]>; + setActiveMembersLimit: AugmentedSubmittable<(limit: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Swaps out one member `remove` for another member `add`. * @@ -746,7 +855,7 @@ declare module '@polkadot/api/types/submittable' { * * `remove` - IdentityId to be removed from the group. * * `add` - IdentityId to be added in place of `remove`. **/ - swapMember: AugmentedSubmittable<(remove: IdentityId | string | Uint8Array, add: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, IdentityId]>; + swapMember: AugmentedSubmittable<(remove: PolymeshPrimitivesIdentityId | string | Uint8Array, add: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; /** * Generic tx **/ @@ -757,14 +866,14 @@ declare module '@polkadot/api/types/submittable' { * Creates a single checkpoint at the current time. * * # Arguments - * - `origin` is a signer that has permissions to act as owner of `ticker`. + * - `origin` is a signer that has permissions to act as an agent of `ticker`. * - `ticker` to create the checkpoint for. * * # Errors * - `UnauthorizedAgent` if the DID of `origin` isn't a permissioned agent for `ticker`. - * - `CheckpointOverflow` if the total checkpoint counter would overflow. + * - `CounterOverflow` if the total checkpoint counter would overflow. **/ - createCheckpoint: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker]>; + createCheckpoint: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker]>; /** * Creates a schedule generating checkpoints * in the future at either a fixed time or at intervals. @@ -780,14 +889,13 @@ declare module '@polkadot/api/types/submittable' { * - `UnauthorizedAgent` if the DID of `origin` isn't a permissioned agent for `ticker`. * - `ScheduleDurationTooShort` if the schedule duration is too short. * - `InsufficientAccountBalance` if the protocol fee could not be charged. - * - `ScheduleOverflow` if the schedule ID counter would overflow. - * - `CheckpointOverflow` if the total checkpoint counter would overflow. + * - `CounterOverflow` if the schedule ID or total checkpoint counters would overflow. * - `FailedToComputeNextCheckpoint` if the next checkpoint for `schedule` is in the past. * * # Permissions * * Asset **/ - createSchedule: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, schedule: ScheduleSpec | { start?: any; period?: any; remaining?: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, ScheduleSpec]>; + createSchedule: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, schedule: PalletAssetCheckpointScheduleSpec | { start?: any; period?: any; remaining?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PalletAssetCheckpointScheduleSpec]>; /** * Removes the checkpoint schedule of an asset identified by `id`. * @@ -804,7 +912,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - removeSchedule: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, id: ScheduleId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, ScheduleId]>; + removeSchedule: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u64]>; /** * Sets the max complexity of a schedule set for an arbitrary ticker to `max_complexity`. * The new maximum is not enforced retroactively, @@ -843,7 +951,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `AddOrigin` or root * * `who` - IdentityId to be added to the group. **/ - addMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + addMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Disables a member at specific moment. * @@ -862,7 +970,7 @@ declare module '@polkadot/api/types/submittable' { * * `expiry` - Time-stamp when `who` is removed from CDD. As soon as it is expired, the * generated claims will be "invalid" as `who` is not considered a member of the group. **/ - disableMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Option, Option]>; + disableMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, Option, Option]>; /** * Removes a member `who` from the set. May only be called from `RemoveOrigin` or root. * @@ -875,7 +983,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `RemoveOrigin` or root * * `who` - IdentityId to be removed from the group. **/ - removeMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + removeMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Changes the membership to a new set, disregarding the existing membership. * May only be called from `ResetOrigin` or root. @@ -884,14 +992,14 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `ResetOrigin` or root * * `members` - New set of identities **/ - resetMembers: AugmentedSubmittable<(members: Vec | (IdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + resetMembers: AugmentedSubmittable<(members: Vec | (PolymeshPrimitivesIdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Change this group's limit for how many concurrent active members they may be. * * # Arguments * * `limit` - the number of active members there may be concurrently. **/ - setActiveMembersLimit: AugmentedSubmittable<(limit: MemberCount | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MemberCount]>; + setActiveMembersLimit: AugmentedSubmittable<(limit: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Swaps out one member `remove` for another member `add`. * @@ -902,7 +1010,7 @@ declare module '@polkadot/api/types/submittable' { * * `remove` - IdentityId to be removed from the group. * * `add` - IdentityId to be added in place of `remove`. **/ - swapMember: AugmentedSubmittable<(remove: IdentityId | string | Uint8Array, add: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, IdentityId]>; + swapMember: AugmentedSubmittable<(remove: PolymeshPrimitivesIdentityId | string | Uint8Array, add: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; /** * Generic tx **/ @@ -922,7 +1030,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - addComplianceRequirement: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, senderConditions: Vec | (Condition | { condition_type?: any; issuers?: any } | string | Uint8Array)[], receiverConditions: Vec | (Condition | { condition_type?: any; issuers?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, Vec, Vec]>; + addComplianceRequirement: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, senderConditions: Vec | (PolymeshPrimitivesCondition | { conditionType?: any; issuers?: any } | string | Uint8Array)[], receiverConditions: Vec | (PolymeshPrimitivesCondition | { conditionType?: any; issuers?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, Vec, Vec]>; /** * Adds another default trusted claim issuer at the ticker level. * @@ -934,7 +1042,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - addDefaultTrustedClaimIssuer: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, issuer: TrustedIssuer | { issuer?: any; trusted_for?: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, TrustedIssuer]>; + addDefaultTrustedClaimIssuer: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, issuer: PolymeshPrimitivesConditionTrustedIssuer | { issuer?: any; trustedFor?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesConditionTrustedIssuer]>; /** * Modify an existing compliance requirement of a given ticker. * @@ -946,7 +1054,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - changeComplianceRequirement: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, newReq: ComplianceRequirement | { sender_conditions?: any; receiver_conditions?: any; id?: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, ComplianceRequirement]>; + changeComplianceRequirement: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, newReq: PolymeshPrimitivesComplianceManagerComplianceRequirement | { senderConditions?: any; receiverConditions?: any; id?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesComplianceManagerComplianceRequirement]>; /** * Pauses the verification of conditions for `ticker` during transfers. * @@ -957,7 +1065,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - pauseAssetCompliance: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker]>; + pauseAssetCompliance: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker]>; /** * Removes a compliance requirement from an asset's compliance. * @@ -969,7 +1077,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - removeComplianceRequirement: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, u32]>; + removeComplianceRequirement: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u32]>; /** * Removes the given `issuer` from the set of default trusted claim issuers at the ticker level. * @@ -981,10 +1089,13 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - removeDefaultTrustedClaimIssuer: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, issuer: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [Ticker, IdentityId]>; + removeDefaultTrustedClaimIssuer: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, issuer: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; /** * Replaces an asset's compliance by ticker with a new compliance. * + * Compliance requirements will be sorted (ascending by id) before + * replacing the current requirements. + * * # Arguments * * `ticker` - the asset ticker, * * `asset_compliance - the new asset compliance. @@ -996,7 +1107,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - replaceAssetCompliance: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, assetCompliance: Vec | (ComplianceRequirement | { sender_conditions?: any; receiver_conditions?: any; id?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, Vec]>; + replaceAssetCompliance: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, assetCompliance: Vec | (PolymeshPrimitivesComplianceManagerComplianceRequirement | { senderConditions?: any; receiverConditions?: any; id?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, Vec]>; /** * Removes an asset's compliance * @@ -1007,7 +1118,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - resetAssetCompliance: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker]>; + resetAssetCompliance: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker]>; /** * Resumes the verification of conditions for `ticker` during transfers. * @@ -1018,7 +1129,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - resumeAssetCompliance: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker]>; + resumeAssetCompliance: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker]>; /** * Generic tx **/ @@ -1029,7 +1140,7 @@ declare module '@polkadot/api/types/submittable' { * Changes the record date of the CA identified by `ca_id`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `ca_id.ticker` with relevant permissions. * - `ca_id` of the CA to alter. * - `record_date`, if any, to calculate the impact of the CA. * If provided, this results in a scheduled balance snapshot ("checkpoint") at the date. @@ -1042,12 +1153,12 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - changeRecordDate: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, recordDate: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [CAId, Option]>; + changeRecordDate: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, recordDate: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, Option]>; /** * Initiates a CA for `ticker` of `kind` with `details` and other provided arguments. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `ticker` with relevant permissions. * - `ticker` that the CA is made for. * - `kind` of CA being initiated. * - `decl_date` of CA bring initialized. @@ -1064,7 +1175,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * - `DetailsTooLong` if `details.len()` goes beyond `max_details_length`. * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `ticker`. - * - `LocalCAIdOverflow` in the unlikely event that so many CAs were created for this `ticker`, + * - `CounterOverflow` in the unlikely event that so many CAs were created for this `ticker`, * that integer overflow would have occured if instead allowed. * - `TooManyDidTaxes` if `withholding_tax.unwrap().len()` would go over the limit `MaxDidWhts`. * - `DuplicateDidTax` if a DID is included more than once in `wt`. @@ -1075,7 +1186,11 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - initiateCorporateAction: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, kind: CAKind | 'PredictableBenefit' | 'UnpredictableBenefit' | 'IssuerNotice' | 'Reorganization' | 'Other' | number | Uint8Array, declDate: Moment | AnyNumber | Uint8Array, recordDate: Option | null | object | string | Uint8Array, details: CADetails | string, targets: Option | null | object | string | Uint8Array, defaultWithholdingTax: Option | null | object | string | Uint8Array, withholdingTax: Option>> | null | object | string | Uint8Array) => SubmittableExtrinsic, [Ticker, CAKind, Moment, Option, CADetails, Option, Option, Option>>]>; + initiateCorporateAction: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, kind: PalletCorporateActionsCaKind | 'PredictableBenefit' | 'UnpredictableBenefit' | 'IssuerNotice' | 'Reorganization' | 'Other' | number | Uint8Array, declDate: u64 | AnyNumber | Uint8Array, recordDate: Option | null | object | string | Uint8Array, details: Bytes | string | Uint8Array, targets: Option | null | object | string | Uint8Array, defaultWithholdingTax: Option | null | object | string | Uint8Array, withholdingTax: Option>> | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PalletCorporateActionsCaKind, u64, Option, Bytes, Option, Option, Option>>]>; + /** + * Utility extrinsic to batch `initiate_corporate_action` and `distribute` + **/ + initiateCorporateActionAndDistribute: AugmentedSubmittable<(caArgs: PalletCorporateActionsInitiateCorporateActionArgs | { ticker?: any; kind?: any; declDate?: any; recordDate?: any; details?: any; targets?: any; defaultWithholdingTax?: any; withholdingTax?: any } | string | Uint8Array, portfolio: Option | null | object | string | Uint8Array, currency: PolymeshPrimitivesTicker | string | Uint8Array, perShare: u128 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array, paymentAt: u64 | AnyNumber | Uint8Array, expiresAt: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsInitiateCorporateActionArgs, Option, PolymeshPrimitivesTicker, u128, u128, u64, Option]>; /** * Link the given CA `id` to the given `docs`. * Any previous links for the CA are removed in favor of `docs`. @@ -1084,7 +1199,7 @@ declare module '@polkadot/api/types/submittable' { * Once both exist, they can now be linked together. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `id.ticker` with relevant permissions. * - `id` of the CA to associate with `docs`. * - `docs` to associate with the CA with `id`. * @@ -1096,7 +1211,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - linkCaDoc: AugmentedSubmittable<(id: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, docs: Vec | (DocumentId | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [CAId, Vec]>; + linkCaDoc: AugmentedSubmittable<(id: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, docs: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [PalletCorporateActionsCaId, Vec]>; /** * Removes the CA identified by `ca_id`. * @@ -1107,7 +1222,7 @@ declare module '@polkadot/api/types/submittable' { * `strong_ref_count(schedule_id)` decremented. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `ca_id.ticker` with relevant permissions. * - `ca_id` of the CA to remove. * * # Errors @@ -1117,12 +1232,12 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - removeCa: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId]>; + removeCa: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId]>; /** * Set the default CA `TargetIdentities` to `targets`. * * ## Arguments - * - `origin` which must be a signer for the CAA of `ca_id`. + * - `origin` which must be an external agent of `ticker` with relevant permissions. * - `ticker` for which the default identities are changing. * - `targets` the default target identities for a CA. * @@ -1133,12 +1248,12 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - setDefaultTargets: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, targets: TargetIdentities | { identities?: any; treatment?: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, TargetIdentities]>; + setDefaultTargets: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, targets: PalletCorporateActionsTargetIdentities | { identities?: any; treatment?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PalletCorporateActionsTargetIdentities]>; /** * Set the default withholding tax for all DIDs and CAs relevant to this `ticker`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `ticker` with relevant permissions. * - `ticker` that the withholding tax will apply to. * - `tax` that should be withheld when distributing dividends, etc. * @@ -1148,14 +1263,14 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - setDefaultWithholdingTax: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, tax: Tax | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, Tax]>; + setDefaultWithholdingTax: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, tax: Permill | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, Permill]>; /** * Set the withholding tax of `ticker` for `taxed_did` to `tax`. * If `Some(tax)`, this overrides the default withholding tax of `ticker` to `tax` for `taxed_did`. * Otherwise, if `None`, the default withholding tax will be used. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` which must be an external agent of `ticker` with relevant permissions. * - `ticker` that the withholding tax will apply to. * - `taxed_did` that will have its withholding tax updated. * - `tax` that should be withheld when distributing dividends, etc. @@ -1167,7 +1282,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - setDidWithholdingTax: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, taxedDid: IdentityId | string | Uint8Array, tax: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Ticker, IdentityId, Option]>; + setDidWithholdingTax: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, taxedDid: PolymeshPrimitivesIdentityId | string | Uint8Array, tax: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, Option]>; /** * Set the max `length` of `details` in terms of bytes. * May only be called via a PIP. @@ -1188,7 +1303,7 @@ declare module '@polkadot/api/types/submittable' { * See the `BallotMeta` for more. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the CA to attach the ballot to. * - `range` specifies when voting starts and ends. * - `meta` specifies the ballot's metadata as aforementioned. @@ -1207,12 +1322,12 @@ declare module '@polkadot/api/types/submittable' { * - `TooLong` if any of the embedded strings in `meta` are too long. * - `InsufficientBalance` if the protocol fee couldn't be charged. **/ - attachBallot: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, range: BallotTimeRange | { start?: any; end?: any } | string | Uint8Array, meta: BallotMeta | { title?: any; motions?: any } | string | Uint8Array, rcv: bool | boolean | Uint8Array) => SubmittableExtrinsic, [CAId, BallotTimeRange, BallotMeta, bool]>; + attachBallot: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, range: PalletCorporateActionsBallotBallotTimeRange | { start?: any; end?: any } | string | Uint8Array, meta: PalletCorporateActionsBallotBallotMeta | { title?: any; motions?: any } | string | Uint8Array, rcv: bool | boolean | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, PalletCorporateActionsBallotBallotTimeRange, PalletCorporateActionsBallotBallotMeta, bool]>; /** * Amend the end date of the ballot of the CA identified by `ca_id`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the attached ballot's CA. * - `end` specifies the new end date of the ballot. * @@ -1222,12 +1337,12 @@ declare module '@polkadot/api/types/submittable' { * - `VotingAlreadyStarted` if `start >= now`, where `now` is the current time. * - `StartAfterEnd` if `start > end`. **/ - changeEnd: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, end: Moment | AnyNumber | Uint8Array) => SubmittableExtrinsic, [CAId, Moment]>; + changeEnd: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, end: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, u64]>; /** * Amend the metadata (title, motions, etc.) of the ballot of the CA identified by `ca_id`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the attached ballot's CA. * - `meta` specifies the new metadata. * @@ -1238,12 +1353,12 @@ declare module '@polkadot/api/types/submittable' { * - `NumberOfChoicesOverflow` if the total choice in `meta` overflows `usize`. * - `TooLong` if any of the embedded strings in `meta` are too long. **/ - changeMeta: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, meta: BallotMeta | { title?: any; motions?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId, BallotMeta]>; + changeMeta: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, meta: PalletCorporateActionsBallotBallotMeta | { title?: any; motions?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, PalletCorporateActionsBallotBallotMeta]>; /** * Amend RCV support for the ballot of the CA identified by `ca_id`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the attached ballot's CA. * - `rcv` specifies if RCV is to be supported or not. * @@ -1252,12 +1367,12 @@ declare module '@polkadot/api/types/submittable' { * - `NoSuchBallot` if `ca_id` does not identify a ballot. * - `VotingAlreadyStarted` if `start >= now`, where `now` is the current time. **/ - changeRcv: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, rcv: bool | boolean | Uint8Array) => SubmittableExtrinsic, [CAId, bool]>; + changeRcv: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, rcv: bool | boolean | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId, bool]>; /** * Remove the ballot of the CA identified by `ca_id`. * * ## Arguments - * - `origin` which must be a signer for a CAA of `ca_id`. + * - `origin` is a signer that has permissions to act as an agent of `ca_id.ticker`. * - `ca_id` identifies the attached ballot's CA. * * # Errors @@ -1265,7 +1380,7 @@ declare module '@polkadot/api/types/submittable' { * - `NoSuchBallot` if `ca_id` does not identify a ballot. * - `VotingAlreadyStarted` if `start >= now`, where `now` is the current time. **/ - removeBallot: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array) => SubmittableExtrinsic, [CAId]>; + removeBallot: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletCorporateActionsCaId]>; /** * Cast `votes` in the ballot attached to the CA identified by `ca_id`. * @@ -1285,7 +1400,7 @@ declare module '@polkadot/api/types/submittable' { * - `InsufficientVotes` if the voting power used for any motion in `votes` * exceeds `origin`'s DID's voting power. **/ - vote: AugmentedSubmittable<(caId: CAId | { ticker?: any; local_id?: any } | string | Uint8Array, votes: Vec | (BallotVote | { power?: any; fallback?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [CAId, Vec]>; + vote: AugmentedSubmittable<(caId: PalletCorporateActionsCaId | { ticker?: any; localId?: any } | string | Uint8Array, votes: Vec | (PalletCorporateActionsBallotBallotVote | { power?: any; fallback?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PalletCorporateActionsCaId, Vec]>; /** * Generic tx **/ @@ -1305,7 +1420,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - abdicate: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker]>; + abdicate: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker]>; /** * Accept an authorization by an agent "Alice" who issued `auth_id` * to also become an agent of the ticker Alice specified. @@ -1343,7 +1458,15 @@ declare module '@polkadot/api/types/submittable' { * * Asset * * Agent **/ - changeGroup: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, agent: IdentityId | string | Uint8Array, group: AgentGroup | { Full: any } | { Custom: any } | { ExceptMeta: any } | { PolymeshV1CAA: any } | { PolymeshV1PIA: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, IdentityId, AgentGroup]>; + changeGroup: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, agent: PolymeshPrimitivesIdentityId | string | Uint8Array, group: PolymeshPrimitivesAgentAgentGroup | { Full: any } | { Custom: any } | { ExceptMeta: any } | { PolymeshV1CAA: any } | { PolymeshV1PIA: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, PolymeshPrimitivesAgentAgentGroup]>; + /** + * Utility extrinsic to batch `create_group` and `change_group` for custom groups only. + * + * # Permissions + * * Asset + * * Agent + **/ + createAndChangeCustomGroup: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array, agent: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions, PolymeshPrimitivesIdentityId]>; /** * Creates a custom agent group (AG) for the given `ticker`. * @@ -1358,13 +1481,21 @@ declare module '@polkadot/api/types/submittable' { * # Errors * - `UnauthorizedAgent` if `origin` was not authorized as an agent to call this. * - `TooLong` if `perms` had some string or list length that was too long. - * - `LocalAGIdOverflow` if `AGIdSequence::get() + 1` would exceed `u32::MAX`. + * - `CounterOverflow` if `AGIdSequence::get() + 1` would exceed `u32::MAX`. * * # Permissions * * Asset * * Agent **/ - createGroup: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, perms: ExtrinsicPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, ExtrinsicPermissions]>; + createGroup: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions]>; + /** + * Utility extrinsic to batch `create_group` and `add_auth`. + * + * # Permissions + * * Asset + * * Agent + **/ + createGroupAndAddAuth: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array, target: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions, PolymeshPrimitivesSecondaryKeySignatory]>; /** * Remove the given `agent` from `ticker`. * @@ -1381,7 +1512,7 @@ declare module '@polkadot/api/types/submittable' { * * Asset * * Agent **/ - removeAgent: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, agent: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [Ticker, IdentityId]>; + removeAgent: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, agent: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; /** * Updates the permissions of the custom AG identified by `id`, for the given `ticker`. * @@ -1399,7 +1530,7 @@ declare module '@polkadot/api/types/submittable' { * * Asset * * Agent **/ - setGroupPermissions: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, id: AGId | AnyNumber | Uint8Array, perms: ExtrinsicPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, AGId, ExtrinsicPermissions]>; + setGroupPermissions: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, id: u32 | AnyNumber | Uint8Array, perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions | { Whole: any } | { These: any } | { Except: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u32, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions]>; /** * Generic tx **/ @@ -1415,14 +1546,14 @@ declare module '@polkadot/api/types/submittable' { * will start the new authority set using the given finalized block as base. * Only callable by root. **/ - noteStalled: AugmentedSubmittable<(delay: BlockNumber | AnyNumber | Uint8Array, bestFinalizedBlockNumber: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BlockNumber, BlockNumber]>; + noteStalled: AugmentedSubmittable<(delay: u32 | AnyNumber | Uint8Array, bestFinalizedBlockNumber: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, u32]>; /** * Report voter equivocation/misbehavior. This method will verify the * equivocation proof and validate the given key ownership proof * against the extracted offender. If both are valid, the offence * will be reported. **/ - reportEquivocation: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [GrandpaEquivocationProof, KeyOwnerProof]>; + reportEquivocation: AugmentedSubmittable<(equivocationProof: SpFinalityGrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: SpSessionMembershipProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [SpFinalityGrandpaEquivocationProof, SpSessionMembershipProof]>; /** * Report voter equivocation/misbehavior. This method will verify the * equivocation proof and validate the given key ownership proof @@ -1434,7 +1565,7 @@ declare module '@polkadot/api/types/submittable' { * if the block author is defined it will be defined as the equivocation * reporter. **/ - reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: GrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: KeyOwnerProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [GrandpaEquivocationProof, KeyOwnerProof]>; + reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: SpFinalityGrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: SpSessionMembershipProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic, [SpFinalityGrandpaEquivocationProof, SpSessionMembershipProof]>; /** * Generic tx **/ @@ -1443,8 +1574,14 @@ declare module '@polkadot/api/types/submittable' { identity: { /** * Call this with the new primary key. By invoking this method, caller accepts authorization - * with the new primary key. If a CDD service provider approved this change, primary key of - * the DID is updated. + * to become the new primary key of the issuing identity. If a CDD service provider approved + * this change (or this is not required), primary key of the DID is updated. + * + * The caller (new primary key) must be either a secondary key of the issuing identity, or + * unlinked to any identity. + * + * Differs from rotate_primary_key_to_secondary in that it will unlink the old primary key + * instead of leaving it as a secondary key. * * # Arguments * * `owner_auth_id` Authorization from the owner who initiated the change @@ -1454,13 +1591,13 @@ declare module '@polkadot/api/types/submittable' { /** * Adds an authorization. **/ - addAuthorization: AugmentedSubmittable<(target: Signatory | { Identity: any } | { Account: any } | string | Uint8Array, authorizationData: AuthorizationData | { AttestPrimaryKeyRotation: any } | { RotatePrimaryKey: any } | { TransferTicker: any } | { AddMultiSigSigner: any } | { TransferAssetOwnership: any } | { JoinIdentity: any } | { PortfolioCustody: any } | { BecomeAgent: any } | { AddRelayerPayingKey: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Signatory, AuthorizationData, Option]>; + addAuthorization: AugmentedSubmittable<(target: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array, data: PolymeshPrimitivesAuthorizationAuthorizationData | { AttestPrimaryKeyRotation: any } | { RotatePrimaryKey: any } | { TransferTicker: any } | { AddMultiSigSigner: any } | { TransferAssetOwnership: any } | { JoinIdentity: any } | { PortfolioCustody: any } | { BecomeAgent: any } | { AddRelayerPayingKey: any } | { RotatePrimaryKeyToSecondary: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesSecondaryKeySignatory, PolymeshPrimitivesAuthorizationAuthorizationData, Option]>; /** * Adds a new claim record or edits an existing one. * * Only called by did_issuer's secondary key. **/ - addClaim: AugmentedSubmittable<(target: IdentityId | string | Uint8Array, claim: Claim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Claim, Option]>; + addClaim: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array, claim: PolymeshPrimitivesIdentityClaimClaim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaimClaim, Option]>; /** * Add `Claim::InvestorUniqueness` claim for a given target identity. * @@ -1481,24 +1618,30 @@ declare module '@polkadot/api/types/submittable' { * * `ClaimVariantNotAllowed` When origin trying to pass claim variant other than `InvestorUniqueness`. * * `ConfidentialScopeClaimNotAllowed` When issuer is different from target or CDD_ID is invalid for given user. * * `InvalidScopeClaim When proof is invalid. + * * `InvalidCDDId` when you are not the owner of that CDD_ID. **/ - addInvestorUniquenessClaim: AugmentedSubmittable<(target: IdentityId | string | Uint8Array, claim: Claim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, proof: InvestorZKProofData | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Claim, InvestorZKProofData, Option]>; - addInvestorUniquenessClaimV2: AugmentedSubmittable<(target: IdentityId | string | Uint8Array, scope: Scope | { Identity: any } | { Ticker: any } | { Custom: any } | string | Uint8Array, claim: Claim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, proof: ScopeClaimProof | { proof_scope_id_wellformed?: any; proof_scope_id_cdd_id_match?: any; scope_id?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Scope, Claim, ScopeClaimProof, Option]>; + addInvestorUniquenessClaim: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array, claim: PolymeshPrimitivesIdentityClaimClaim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, proof: PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData | { r?: any; s?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaimClaim, PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData, Option]>; + addInvestorUniquenessClaimV2: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array, scope: PolymeshPrimitivesIdentityClaimScope | { Identity: any } | { Ticker: any } | { Custom: any } | string | Uint8Array, claim: PolymeshPrimitivesIdentityClaimClaim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array, proof: ConfidentialIdentityClaimProofsScopeClaimProof | { proofScopeIdWellformed?: any; proofScopeIdCddIdMatch?: any; scopeId?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaimScope, PolymeshPrimitivesIdentityClaimClaim, ConfidentialIdentityClaimProofsScopeClaimProof, Option]>; /** - * It adds secondary keys to target identity `id`. + * Adds secondary keys to target identity `id`. + * * Keys are directly added to identity because each of them has an authorization. * - * Arguments: - * - `origin` Primary key of `id` identity. - * - `id` Identity where new secondary keys will be added. - * - `additional_keys` New secondary items (and their authorization data) to add to target - * identity. + * # Arguments: + * - `origin` which must be the primary key of the identity `id`. + * - `id` to which new secondary keys will be added. + * - `additional_keys` which includes secondary keys, + * coupled with authorization data, to add to target identity. * - * Failure - * - It can only called by primary key owner. + * # Errors + * - Can only called by primary key owner. * - Keys should be able to linked to any identity. **/ - addSecondaryKeysWithAuthorization: AugmentedSubmittable<(additionalKeys: Vec | (SecondaryKeyWithAuth | { secondary_key?: any; auth_signature?: any } | string | Uint8Array)[], expiresAt: Moment | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, Moment]>; + addSecondaryKeysWithAuthorization: AugmentedSubmittable<(additionalKeys: Vec | (PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth | { secondaryKey?: any; authSignature?: any } | string | Uint8Array)[], expiresAt: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u64]>; + /** + * Deprecated. Use `add_secondary_keys_with_authorization` instead. + **/ + addSecondaryKeysWithAuthorizationOld: AugmentedSubmittable<(additionalKeys: Vec | (PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuthV1 | { secondaryKey?: any; authSignature?: any } | string | Uint8Array)[], expiresAt: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u64]>; /** * Register `target_account` with a new Identity. * @@ -1512,7 +1655,7 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `7_000_000_000 + 600_000 * secondary_keys.len()` **/ - cddRegisterDid: AugmentedSubmittable<(targetAccount: AccountId | string | Uint8Array, secondaryKeys: Vec | (SecondaryKey | { signer?: any; permissions?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId, Vec]>; + cddRegisterDid: AugmentedSubmittable<(targetAccount: AccountId32 | string | Uint8Array, secondaryKeys: Vec | (PolymeshPrimitivesSecondaryKey | { key?: any; permissions?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, Vec]>; /** * Set if CDD authorization is required for updating primary key of an identity. * Callable via root (governance) @@ -1531,17 +1674,18 @@ declare module '@polkadot/api/types/submittable' { /** * Assuming this is executed by the GC voting majority, adds a new cdd claim record. **/ - gcAddCddClaim: AugmentedSubmittable<(target: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + gcAddCddClaim: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Assuming this is executed by the GC voting majority, removes an existing cdd claim record. **/ - gcRevokeCddClaim: AugmentedSubmittable<(target: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + gcRevokeCddClaim: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** - * It invalidates any claim generated by `cdd` from `disable_from` timestamps. - * You can also define an expiration time, which will invalidate all claims generated by - * that `cdd` and remove it as CDD member group. + * Invalidates any claim generated by `cdd` from `disable_from` timestamps. + * + * You can also define an expiration time, + * which will invalidate all claims generated by that `cdd` and remove it as CDD member group. **/ - invalidateCddClaims: AugmentedSubmittable<(cdd: IdentityId | string | Uint8Array, disableFrom: Moment | AnyNumber | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Moment, Option]>; + invalidateCddClaims: AugmentedSubmittable<(cdd: PolymeshPrimitivesIdentityId | string | Uint8Array, disableFrom: u64 | AnyNumber | Uint8Array, expiry: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, u64, Option]>; /** * Join an identity as a secondary key. **/ @@ -1551,30 +1695,30 @@ declare module '@polkadot/api/types/submittable' { **/ leaveIdentityAsKey: AugmentedSubmittable<() => SubmittableExtrinsic, []>; /** - * This function is a workaround for https://github.com/polkadot-js/apps/issues/3632 - * It sets permissions for an specific `target_key` key. - * Only the primary key of an identity is able to set secondary key permissions. + * Placeholder for removed `legacy_set_permission_to_signer`. **/ - legacySetPermissionToSigner: AugmentedSubmittable<(signer: Signatory | { Identity: any } | { Account: any } | string | Uint8Array, permissions: LegacyPermissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [Signatory, LegacyPermissions]>; + placeholderLegacySetPermissionToSigner: AugmentedSubmittable<() => SubmittableExtrinsic, []>; /** * Removes an authorization. * _auth_issuer_pays determines whether the issuer of the authorisation pays the transaction fee **/ - removeAuthorization: AugmentedSubmittable<(target: Signatory | { Identity: any } | { Account: any } | string | Uint8Array, authId: u64 | AnyNumber | Uint8Array, authIssuerPays: bool | boolean | Uint8Array) => SubmittableExtrinsic, [Signatory, u64, bool]>; + removeAuthorization: AugmentedSubmittable<(target: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array, authId: u64 | AnyNumber | Uint8Array, authIssuerPays: bool | boolean | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesSecondaryKeySignatory, u64, bool]>; /** * Removes specified secondary keys of a DID if present. * - * # Failure - * It can only called by primary key owner. + * # Errors * - * # Weight - * `950_000_000 + 60_000 * signers_to_remove.len()` + * The extrinsic can only called by primary key owner. **/ - removeSecondaryKeys: AugmentedSubmittable<(signersToRemove: Vec | (Signatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + removeSecondaryKeys: AugmentedSubmittable<(keysToRemove: Vec | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + /** + * Deprecated. Use `remove_secondary_keys` instead. + **/ + removeSecondaryKeysOld: AugmentedSubmittable<(keysToRemove: Vec | (PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Marks the specified claim as revoked. **/ - revokeClaim: AugmentedSubmittable<(target: IdentityId | string | Uint8Array, claim: Claim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Claim]>; + revokeClaim: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array, claim: PolymeshPrimitivesIdentityClaimClaim | { Accredited: any } | { Affiliate: any } | { BuyLockup: any } | { SellLockup: any } | { CustomerDueDiligence: any } | { KnowYourCustomer: any } | { Jurisdiction: any } | { Exempted: any } | { Blocked: any } | { InvestorUniqueness: any } | { NoData: any } | { InvestorUniquenessV2: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaimClaim]>; /** * Revokes a specific claim using its [Claim Unique Index](/pallet_identity/index.html#claim-unique-index) composed by `target`, * `claim_type`, and `scope`. @@ -1585,12 +1729,34 @@ declare module '@polkadot/api/types/submittable' { * - `TargetHasNonZeroBalanceAtScopeId` when you try to revoke a `InvestorUniqueness*` * claim, and `target` identity still have any balance on the given `scope`. **/ - revokeClaimByIndex: AugmentedSubmittable<(target: IdentityId | string | Uint8Array, claimType: ClaimType | 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoData' | 'InvestorUniquenessV2' | number | Uint8Array, scope: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, ClaimType, Option]>; + revokeClaimByIndex: AugmentedSubmittable<(target: PolymeshPrimitivesIdentityId | string | Uint8Array, claimType: PolymeshPrimitivesIdentityClaimClaimType | 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoType' | 'InvestorUniquenessV2' | number | Uint8Array, scope: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaimClaimType, Option]>; + /** + * Call this with the new primary key. By invoking this method, caller accepts authorization + * to become the new primary key of the issuing identity. If a CDD service provider approved + * this change, (or this is not required), primary key of the DID is updated. + * + * The caller (new primary key) must be either a secondary key of the issuing identity, or + * unlinked to any identity. + * + * Differs from accept_primary_key in that it will leave the old primary key as a secondary + * key with the permissions specified in the corresponding RotatePrimaryKeyToSecondary authorization + * instead of unlinking the old primary key. + * + * # Arguments + * * `owner_auth_id` Authorization from the owner who initiated the change + * * `cdd_auth_id` Authorization from a CDD service provider + **/ + rotatePrimaryKeyToSecondary: AugmentedSubmittable<(authId: u64 | AnyNumber | Uint8Array, optionalCddAuthId: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [u64, Option]>; /** - * It sets permissions for an specific `target_key` key. + * Deprecated. Use `set_secondary_key_permissions` instead. + **/ + setPermissionToSigner: AugmentedSubmittable<(key: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array, perms: PolymeshPrimitivesSecondaryKeyPermissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesSecondaryKeySignatory, PolymeshPrimitivesSecondaryKeyPermissions]>; + /** + * Sets permissions for an specific `target_key` key. + * * Only the primary key of an identity is able to set secondary key permissions. **/ - setPermissionToSigner: AugmentedSubmittable<(signer: Signatory | { Identity: any } | { Account: any } | string | Uint8Array, permissions: Permissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [Signatory, Permissions]>; + setSecondaryKeyPermissions: AugmentedSubmittable<(key: AccountId32 | string | Uint8Array, perms: PolymeshPrimitivesSecondaryKeyPermissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, PolymeshPrimitivesSecondaryKeyPermissions]>; /** * Re-enables all secondary keys of the caller's identity. **/ @@ -1603,8 +1769,8 @@ declare module '@polkadot/api/types/submittable' { imOnline: { /** * # - * - Complexity: `O(K + E)` where K is length of `Keys` (heartbeat.validators_len) - * and E is length of `heartbeat.network_state.external_address` + * - Complexity: `O(K + E)` where K is length of `Keys` (heartbeat.validators_len) and E is + * length of `heartbeat.network_state.external_address` * - `O(K)`: decoding of length `K` * - `O(E)`: decoding/encoding of length `E` * - DbReads: pallet_session `Validators`, pallet_session `CurrentIndex`, `Keys`, @@ -1612,7 +1778,7 @@ declare module '@polkadot/api/types/submittable' { * - DbWrites: `ReceivedHeartbeats` * # **/ - heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any; validatorsLen?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic, [Heartbeat, Signature]>; + heartbeat: AugmentedSubmittable<(heartbeat: PalletImOnlineHeartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any; validatorsLen?: any } | string | Uint8Array, signature: PalletImOnlineSr25519AppSr25519Signature | string | Uint8Array) => SubmittableExtrinsic, [PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature]>; /** * Generic tx **/ @@ -1639,7 +1805,7 @@ declare module '@polkadot/api/types/submittable' { * - DB Weight: 1 Read/Write (Accounts) * # **/ - claim: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountIndex]>; + claim: AugmentedSubmittable<(index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Force an index to an account. This doesn't require a deposit. If the index is already * held, then any deposit is reimbursed to its current owner. @@ -1663,7 +1829,7 @@ declare module '@polkadot/api/types/submittable' { * - Writes: Indices Accounts, System Account (original owner) * # **/ - forceTransfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array, freeze: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId, AccountIndex, bool]>; + forceTransfer: AugmentedSubmittable<(updated: AccountId32 | string | Uint8Array, index: u32 | AnyNumber | Uint8Array, freeze: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32, bool]>; /** * Free up an index owned by the sender. * @@ -1684,9 +1850,10 @@ declare module '@polkadot/api/types/submittable' { * - DB Weight: 1 Read/Write (Accounts) * # **/ - free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountIndex]>; + free: AugmentedSubmittable<(index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** - * Freeze an index so it will always point to the sender account. This consumes the deposit. + * Freeze an index so it will always point to the sender account. This consumes the + * deposit. * * The dispatch origin for this call must be _Signed_ and the signing account must have a * non-frozen account `index`. @@ -1704,7 +1871,7 @@ declare module '@polkadot/api/types/submittable' { * - DB Weight: 1 Read/Write (Accounts) * # **/ - freeze: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountIndex]>; + freeze: AugmentedSubmittable<(index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Assign an index already owned by the sender to another account. The balance reservation * is effectively transferred to the new account. @@ -1727,7 +1894,7 @@ declare module '@polkadot/api/types/submittable' { * - Writes: Indices Accounts, System Account (recipient) * # **/ - transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, AccountIndex]>; + transfer: AugmentedSubmittable<(updated: AccountId32 | string | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32]>; /** * Generic tx **/ @@ -1754,7 +1921,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `signer` - Signatory to add. **/ - addMultisigSigner: AugmentedSubmittable<(signer: Signatory | { Identity: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [Signatory]>; + addMultisigSigner: AugmentedSubmittable<(signer: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesSecondaryKeySignatory]>; /** * Adds a signer to the multisig. This must be called by the creator identity of the * multisig. @@ -1766,7 +1933,7 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `900_000_000 + 3_000_000 * signers.len()` **/ - addMultisigSignersViaCreator: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, signers: Vec | (Signatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId, Vec]>; + addMultisigSignersViaCreator: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, signers: Vec | (PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, Vec]>; /** * Approves a multisig proposal using the caller's identity. * @@ -1775,7 +1942,7 @@ declare module '@polkadot/api/types/submittable' { * * `proposal_id` - Proposal id to approve. * If quorum is reached, the proposal will be immediately executed. **/ - approveAsIdentity: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u64]>; + approveAsIdentity: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64]>; /** * Approves a multisig proposal using the caller's secondary key (`AccountId`). * @@ -1784,7 +1951,7 @@ declare module '@polkadot/api/types/submittable' { * * `proposal_id` - Proposal id to approve. * If quorum is reached, the proposal will be immediately executed. **/ - approveAsKey: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u64]>; + approveAsKey: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64]>; /** * Changes the number of signatures required by a multisig. This must be called by the * multisig itself. @@ -1800,7 +1967,7 @@ declare module '@polkadot/api/types/submittable' { * * `signers` - Signers of the multisig (They need to accept authorization before they are actually added). * * `sigs_required` - Number of sigs required to process a multi-sig tx. **/ - createMultisig: AugmentedSubmittable<(signers: Vec | (Signatory | { Identity: any } | { Account: any } | string | Uint8Array)[], sigsRequired: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u64]>; + createMultisig: AugmentedSubmittable<(signers: Vec | (PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array)[], sigsRequired: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u64]>; /** * Creates a multisig proposal if it hasn't been created or approves it if it has. * @@ -1811,7 +1978,7 @@ declare module '@polkadot/api/types/submittable' { * * `auto_close` - Close proposal on receiving enough reject votes. * If this is 1 out of `m` multisig, the proposal will be immediately executed. **/ - createOrApproveProposalAsIdentity: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId, Proposal, Option, bool]>; + createOrApproveProposalAsIdentity: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId32, Call, Option, bool]>; /** * Creates a multisig proposal if it hasn't been created or approves it if it has. * @@ -1822,7 +1989,7 @@ declare module '@polkadot/api/types/submittable' { * * `auto_close` - Close proposal on receiving enough reject votes. * If this is 1 out of `m` multisig, the proposal will be immediately executed. **/ - createOrApproveProposalAsKey: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId, Proposal, Option, bool]>; + createOrApproveProposalAsKey: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId32, Call, Option, bool]>; /** * Creates a multisig proposal * @@ -1833,7 +2000,7 @@ declare module '@polkadot/api/types/submittable' { * * `auto_close` - Close proposal on receiving enough reject votes. * If this is 1 out of `m` multisig, the proposal will be immediately executed. **/ - createProposalAsIdentity: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId, Proposal, Option, bool]>; + createProposalAsIdentity: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId32, Call, Option, bool]>; /** * Creates a multisig proposal * @@ -1844,11 +2011,11 @@ declare module '@polkadot/api/types/submittable' { * * `auto_close` - Close proposal on receiving enough reject votes. * If this is 1 out of `m` multisig, the proposal will be immediately executed. **/ - createProposalAsKey: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId, Proposal, Option, bool]>; + createProposalAsKey: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, autoClose: bool | boolean | Uint8Array) => SubmittableExtrinsic, [AccountId32, Call, Option, bool]>; /** * Root callable extrinsic, used as an internal call for executing scheduled multisig proposal. **/ - executeScheduledProposal: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array, multisigDid: IdentityId | string | Uint8Array, proposalWeight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u64, IdentityId, Weight]>; + executeScheduledProposal: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array, multisigDid: PolymeshPrimitivesIdentityId | string | Uint8Array, proposalWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64, PolymeshPrimitivesIdentityId, u64]>; /** * Adds a multisig as the primary key of the current did if the current DID is the creator * of the multisig. @@ -1856,15 +2023,15 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `multi_sig` - multi sig address **/ - makeMultisigPrimary: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, optionalCddAuthId: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [AccountId, Option]>; + makeMultisigPrimary: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, optionalCddAuthId: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, Option]>; /** - * Adds a multisig as a signer of current did if the current did is the creator of the + * Adds a multisig as a secondary key of current did if the current did is the creator of the * multisig. * * # Arguments * * `multisig` - multi sig address **/ - makeMultisigSigner: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + makeMultisigSecondary: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Rejects a multisig proposal using the caller's identity. * @@ -1873,7 +2040,7 @@ declare module '@polkadot/api/types/submittable' { * * `proposal_id` - Proposal id to reject. * If quorum is reached, the proposal will be immediately executed. **/ - rejectAsIdentity: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u64]>; + rejectAsIdentity: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64]>; /** * Rejects a multisig proposal using the caller's secondary key (`AccountId`). * @@ -1882,14 +2049,14 @@ declare module '@polkadot/api/types/submittable' { * * `proposal_id` - Proposal id to reject. * If quorum is reached, the proposal will be immediately executed. **/ - rejectAsKey: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u64]>; + rejectAsKey: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, proposalId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64]>; /** * Removes a signer from the multisig. This must be called by the multisig itself. * * # Arguments * * `signer` - Signatory to remove. **/ - removeMultisigSigner: AugmentedSubmittable<(signer: Signatory | { Identity: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [Signatory]>; + removeMultisigSigner: AugmentedSubmittable<(signer: PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesSecondaryKeySignatory]>; /** * Removes a signer from the multisig. * This must be called by the creator identity of the multisig. @@ -1901,7 +2068,7 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `900_000_000 + 3_000_000 * signers.len()` **/ - removeMultisigSignersViaCreator: AugmentedSubmittable<(multisig: AccountId | string | Uint8Array, signers: Vec | (Signatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId, Vec]>; + removeMultisigSignersViaCreator: AugmentedSubmittable<(multisig: AccountId32 | string | Uint8Array, signers: Vec | (PolymeshPrimitivesSecondaryKeySignatory | { Identity: any } | { Account: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, Vec]>; /** * Generic tx **/ @@ -1917,7 +2084,7 @@ declare module '@polkadot/api/types/submittable' { * * `IncorrectProposalState` if the proposal isn't pending. * * `NotByCommittee` if the proposal isn't by a committee. **/ - approveCommitteeProposal: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PipId]>; + approveCommitteeProposal: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Clears the snapshot and emits the event `SnapshotCleared`. * @@ -1944,15 +2111,15 @@ declare module '@polkadot/api/types/submittable' { * ``` * This is protects against clearing queue while GC is voting. **/ - enactSnapshotResults: AugmentedSubmittable<(results: Vec> | ([PipId | AnyNumber | Uint8Array, SnapshotResult | 'Approve' | 'Reject' | 'Skip' | number | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; + enactSnapshotResults: AugmentedSubmittable<(results: Vec> | ([u32 | AnyNumber | Uint8Array, PalletPipsSnapshotResult | 'Approve' | 'Reject' | 'Skip' | number | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; /** * Internal dispatchable that handles execution of a PIP. **/ - executeScheduledPip: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PipId]>; + executeScheduledPip: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Internal dispatchable that handles expiration of a PIP. **/ - expireScheduledPip: AugmentedSubmittable<(did: IdentityId | string | Uint8Array, id: PipId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [IdentityId, PipId]>; + expireScheduledPip: AugmentedSubmittable<(did: PolymeshPrimitivesIdentityId | string | Uint8Array, id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, u32]>; /** * A network member creates a PIP by submitting a dispatchable which * changes the network in someway. A minimum deposit is required to open a new proposal. @@ -1964,7 +2131,7 @@ declare module '@polkadot/api/types/submittable' { * * `deposit` minimum deposit value, which is ignored if `proposer` is a committee. * * `url` a link to a website for proposal discussion **/ - propose: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, deposit: Balance | AnyNumber | Uint8Array, url: Option | null | object | string | Uint8Array, description: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Proposal, Balance, Option, Option]>; + propose: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, deposit: u128 | AnyNumber | Uint8Array, url: Option | null | object | string | Uint8Array, description: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Call, u128, Option, Option]>; /** * Prune the PIP given by the `id`, refunding any funds not already refunded. * The PIP may not be active @@ -1976,7 +2143,7 @@ declare module '@polkadot/api/types/submittable' { * * `NoSuchProposal` if the PIP with `id` doesn't exist. * * `IncorrectProposalState` if the proposal is active. **/ - pruneProposal: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PipId]>; + pruneProposal: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Rejects the PIP given by the `id`, refunding any bonded funds, * assuming it hasn't been cancelled or executed. @@ -1987,7 +2154,7 @@ declare module '@polkadot/api/types/submittable' { * * `NoSuchProposal` if the PIP with `id` doesn't exist. * * `IncorrectProposalState` if the proposal was cancelled or executed. **/ - rejectProposal: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PipId]>; + rejectProposal: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Updates the execution schedule of the PIP given by `id`. * @@ -1999,7 +2166,7 @@ declare module '@polkadot/api/types/submittable' { * * `RescheduleNotByReleaseCoordinator` unless triggered by release coordinator. * * `IncorrectProposalState` unless the proposal was in a scheduled state. **/ - rescheduleExecution: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array, until: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PipId, Option]>; + rescheduleExecution: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array, until: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [u32, Option]>; /** * Change the maximum number of active PIPs before community members cannot propose anything. * Can only be called by root. @@ -2015,7 +2182,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `duration` the new default enactment period it takes for a scheduled PIP to be executed. **/ - setDefaultEnactmentPeriod: AugmentedSubmittable<(duration: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BlockNumber]>; + setDefaultEnactmentPeriod: AugmentedSubmittable<(duration: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Change the maximum skip count (`max_pip_skip_count`). * Can only be called by root. @@ -2023,7 +2190,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `max` skips before a PIP cannot be skipped by GC anymore. **/ - setMaxPipSkipCount: AugmentedSubmittable<(max: SkippedCount | AnyNumber | Uint8Array) => SubmittableExtrinsic, [SkippedCount]>; + setMaxPipSkipCount: AugmentedSubmittable<(max: u8 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u8]>; /** * Change the minimum proposal deposit amount required to start a proposal. * Can only be called by root. @@ -2031,7 +2198,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `deposit` the new min deposit required to start a proposal **/ - setMinProposalDeposit: AugmentedSubmittable<(deposit: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Balance]>; + setMinProposalDeposit: AugmentedSubmittable<(deposit: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; /** * Change the amount of blocks after which a pending PIP is expired. * If `expiry` is `None` then PIPs never expire. @@ -2040,7 +2207,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `expiry` the block-time it takes for a still-`Pending` PIP to expire. **/ - setPendingPipExpiry: AugmentedSubmittable<(expiry: MaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [MaybeBlock]>; + setPendingPipExpiry: AugmentedSubmittable<(expiry: PolymeshCommonUtilitiesMaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshCommonUtilitiesMaybeBlock]>; /** * Change whether completed PIPs are pruned. * Can only be called by root. @@ -2077,7 +2244,7 @@ declare module '@polkadot/api/types/submittable' { * * `IncorrectProposalState` if PIP isn't pending. * * `InsufficientDeposit` if `origin` cannot reserve `deposit - old_deposit`. **/ - vote: AugmentedSubmittable<(id: PipId | AnyNumber | Uint8Array, ayeOrNay: bool | boolean | Uint8Array, deposit: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PipId, bool, Balance]>; + vote: AugmentedSubmittable<(id: u32 | AnyNumber | Uint8Array, ayeOrNay: bool | boolean | Uint8Array, deposit: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, bool, u128]>; /** * Generic tx **/ @@ -2090,7 +2257,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `expiry` - The new expiry time. **/ - setExpiresAfter: AugmentedSubmittable<(expiry: MaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [MaybeBlock]>; + setExpiresAfter: AugmentedSubmittable<(expiry: PolymeshCommonUtilitiesMaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshCommonUtilitiesMaybeBlock]>; /** * Changes the release coordinator. * @@ -2100,7 +2267,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, If the new coordinator `id` is not part of the committee. **/ - setReleaseCoordinator: AugmentedSubmittable<(id: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + setReleaseCoordinator: AugmentedSubmittable<(id: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Change the vote threshold the determines the winning proposal. * For e.g., for a simple majority use (1, 2) which represents the in-equation ">= 1/2". @@ -2122,7 +2289,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, if the `origin` is not a member of this committee. **/ - vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: ProposalIndex | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [Hash, ProposalIndex, bool]>; + vote: AugmentedSubmittable<(proposal: H256 | string | Uint8Array, index: u32 | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [H256, u32, bool]>; /** * Proposes to the committee that `call` should be executed in its name. * Alternatively, if the hash of `call` has already been recorded, i.e., already proposed, @@ -2148,12 +2315,90 @@ declare module '@polkadot/api/types/submittable' { **/ [key: string]: SubmittableExtrinsicFunction; }; + polymeshContracts: { + /** + * Calls the `contract` through its address with the given `data`. + * + * The contract is endowed with `value` POLYX, + * but note that this is distinct from gas fees which are limited with `gas_limit`. + * + * The contract may optionally call back into the runtime, + * executing extrinsics such as e.g., `create_asset`. + * During such runtime calls, the current identity will be the one that instantiate the `contract`. + * This restriction exists for security purposes. + * + * # Arguments + * - `contract` to call. + * - `value` in POLYX to transfer to the contract. + * - `gas_limit` that limits how much gas execution can consume, erroring above it. + * - `data` to be interpreted by the smart contract call. + * + * # Errors + * - All the errors in `pallet_contracts::Call::call` can also happen here. + * - `ContractNotFound` if `contract` doesn't exist or isn't a contract. + * - CDD/Permissions are checked, unlike in `pallet_contracts`. + **/ + call: AugmentedSubmittable<(contract: AccountId32 | string | Uint8Array, value: u128 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option | null | object | string | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, u128, u64, Option, Bytes]>; + /** + * Instantiates a smart contract defining it with the given `code` and `salt`. + * + * The contract will be attached as a secondary key, + * with `perms` as its permissions, to `origin`'s identity. + * + * The contract is transferred `endowment` amount of POLYX. + * This is distinct from the `gas_limit`, + * which controls how much gas the deployment code may at most consume. + * + * # Arguments + * - `endowment` amount of POLYX to transfer to the contract. + * - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + * - `code` with the WASM binary defining the smart contract. + * - `salt` used for contract address derivation. + * By varying this, the same `code` can be used under the same identity. + * + * # Errors + * - All the errors in `pallet_contracts::Call::instantiate_with_code` can also happen here. + * - CDD/Permissions are checked, unlike in `pallet_contracts`. + * - Errors that arise when adding a new secondary key can also occur here. + **/ + instantiateWithCode: AugmentedSubmittable<(endowment: u128 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option | null | object | string | Uint8Array, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array, perms: PolymeshPrimitivesSecondaryKeyPermissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [u128, u64, Option, Bytes, Bytes, Bytes, PolymeshPrimitivesSecondaryKeyPermissions]>; + /** + * Instantiates a smart contract defining using the given `code_hash` and `salt`. + * + * Unlike `instantiate_with_code`, + * this assumes that at least one contract with the same WASM code has already been uploaded. + * + * The contract will be attached as a secondary key, + * with `perms` as its permissions, to `origin`'s identity. + * + * The contract is transferred `endowment` amount of POLYX. + * This is distinct from the `gas_limit`, + * which controls how much gas the deployment code may at most consume. + * + * # Arguments + * - `endowment` amount of POLYX to transfer to the contract. + * - `gas_limit` for how much gas the `deploy` code in the contract may at most consume. + * - `code_hash` of an already uploaded WASM binary. + * - `salt` used for contract address derivation. + * By varying this, the same `code` can be used under the same identity. + * + * # Errors + * - All the errors in `pallet_contracts::Call::instantiate` can also happen here. + * - CDD/Permissions are checked, unlike in `pallet_contracts`. + * - Errors that arise when adding a new secondary key can also occur here. + **/ + instantiateWithHash: AugmentedSubmittable<(endowment: u128 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, storageDepositLimit: Option | null | object | string | Uint8Array, codeHash: H256 | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array, perms: PolymeshPrimitivesSecondaryKeyPermissions | { asset?: any; extrinsic?: any; portfolio?: any } | string | Uint8Array) => SubmittableExtrinsic, [u128, u64, Option, H256, Bytes, Bytes, PolymeshPrimitivesSecondaryKeyPermissions]>; + /** + * Generic tx + **/ + [key: string]: SubmittableExtrinsicFunction; + }; portfolio: { acceptPortfolioCustody: AugmentedSubmittable<(authId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; /** * Creates a portfolio with the given `name`. **/ - createPortfolio: AugmentedSubmittable<(name: PortfolioName | string) => SubmittableExtrinsic, [PortfolioName]>; + createPortfolio: AugmentedSubmittable<(name: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; /** * Deletes a user portfolio. A portfolio can be deleted only if it has no funds. * @@ -2164,7 +2409,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - deletePortfolio: AugmentedSubmittable<(num: PortfolioNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PortfolioNumber]>; + deletePortfolio: AugmentedSubmittable<(num: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; /** * Moves a token amount from one portfolio of an identity to another portfolio of the same * identity. Must be called by the custodian of the sender. @@ -2182,7 +2427,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - movePortfolioFunds: AugmentedSubmittable<(from: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, to: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, items: Vec | (MovePortfolioItem | { ticker?: any; amount?: any; memo?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PortfolioId, PortfolioId, Vec]>; + movePortfolioFunds: AugmentedSubmittable<(from: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, to: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, items: Vec | (PalletPortfolioMovePortfolioItem | { ticker?: any; amount?: any; memo?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityIdPortfolioId, Vec]>; /** * When called by the custodian of `portfolio_id`, * allows returning the custody of the portfolio to the portfolio owner unilaterally. @@ -2193,7 +2438,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - quitPortfolioCustody: AugmentedSubmittable<(pid: PortfolioId | { did?: any; kind?: any } | string | Uint8Array) => SubmittableExtrinsic, [PortfolioId]>; + quitPortfolioCustody: AugmentedSubmittable<(pid: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityIdPortfolioId]>; /** * Renames a non-default portfolio. * @@ -2203,7 +2448,37 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - renamePortfolio: AugmentedSubmittable<(num: PortfolioNumber | AnyNumber | Uint8Array, toName: PortfolioName | string) => SubmittableExtrinsic, [PortfolioNumber, PortfolioName]>; + renamePortfolio: AugmentedSubmittable<(num: u64 | AnyNumber | Uint8Array, toName: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, Bytes]>; + /** + * Generic tx + **/ + [key: string]: SubmittableExtrinsicFunction; + }; + preimage: { + /** + * Register a preimage on-chain. + * + * If the preimage was previously requested, no fees or deposits are taken for providing + * the preimage. Otherwise, a deposit is taken proportional to the size of the preimage. + **/ + notePreimage: AugmentedSubmittable<(bytes: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; + /** + * Request a preimage be uploaded to the chain without paying any fees or deposits. + * + * If the preimage requests has already been provided on-chain, we unreserve any deposit + * a user may have paid, and take the control of the preimage out of their hands. + **/ + requestPreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic, [H256]>; + /** + * Clear an unrequested preimage from the runtime storage. + **/ + unnotePreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic, [H256]>; + /** + * Clear a previously made request for a preimage. + * + * NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`. + **/ + unrequestPreimage: AugmentedSubmittable<(hash: H256 | string | Uint8Array) => SubmittableExtrinsic, [H256]>; /** * Generic tx **/ @@ -2216,14 +2491,14 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `BadOrigin` - Only root allowed. **/ - changeBaseFee: AugmentedSubmittable<(op: ProtocolOp | 'AssetRegisterTicker' | 'AssetIssue' | 'AssetAddDocuments' | 'AssetCreateAsset' | 'CheckpointCreateSchedule' | 'ComplianceManagerAddComplianceRequirement' | 'IdentityCddRegisterDid' | 'IdentityAddClaim' | 'IdentityAddSecondaryKeysWithAuthorization' | 'PipsPropose' | 'ContractsPutCode' | 'CorporateBallotAttachBallot' | 'CapitalDistributionDistribute' | number | Uint8Array, baseFee: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [ProtocolOp, Balance]>; + changeBaseFee: AugmentedSubmittable<(op: PolymeshCommonUtilitiesProtocolFeeProtocolOp | 'AssetRegisterTicker' | 'AssetIssue' | 'AssetAddDocuments' | 'AssetCreateAsset' | 'CheckpointCreateSchedule' | 'ComplianceManagerAddComplianceRequirement' | 'IdentityCddRegisterDid' | 'IdentityAddClaim' | 'IdentityAddSecondaryKeysWithAuthorization' | 'PipsPropose' | 'ContractsPutCode' | 'CorporateBallotAttachBallot' | 'CapitalDistributionDistribute' | number | Uint8Array, baseFee: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshCommonUtilitiesProtocolFeeProtocolOp, u128]>; /** * Changes the fee coefficient for the root origin. * * # Errors * * `BadOrigin` - Only root allowed. **/ - changeCoefficient: AugmentedSubmittable<(coefficient: PosRatio) => SubmittableExtrinsic, [PosRatio]>; + changeCoefficient: AugmentedSubmittable<(coefficient: PolymeshPrimitivesPosRatio) => SubmittableExtrinsic, [PolymeshPrimitivesPosRatio]>; /** * Generic tx **/ @@ -2241,7 +2516,7 @@ declare module '@polkadot/api/types/submittable' { * - `AuthorizationError::Expired` if `auth_id` the authorization has expired. * - `AuthorizationError::BadType` if `auth_id` was not a `AddRelayerPayingKey` authorization. * - `NotAuthorizedForUserKey` if `origin` is not authorized to accept the authorization for the `user_key`. - * - `NotAuthorizedForPayingKey` if the authorization was created by a signer that isn't authorized by the `paying_key`. + * - `NotAuthorizedForPayingKey` if the authorization was created an identity different from the `paying_key`'s identity. * - `UserKeyCddMissing` if the `user_key` is not attached to a CDD'd identity. * - `PayingKeyCddMissing` if the `paying_key` is not attached to a CDD'd identity. * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. @@ -2260,7 +2535,7 @@ declare module '@polkadot/api/types/submittable' { * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. * - `Overlow` if the subsidy has less then `amount` POLYX remaining. **/ - decreasePolyxLimit: AugmentedSubmittable<(userKey: AccountId | string | Uint8Array, amount: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, Balance]>; + decreasePolyxLimit: AugmentedSubmittable<(userKey: AccountId32 | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u128]>; /** * Increase the available POLYX for a `user_key`. * @@ -2274,7 +2549,7 @@ declare module '@polkadot/api/types/submittable' { * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. * - `Overlow` if the subsidy's remaining POLYX would have overflowed `u128::MAX`. **/ - increasePolyxLimit: AugmentedSubmittable<(userKey: AccountId | string | Uint8Array, amount: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, Balance]>; + increasePolyxLimit: AugmentedSubmittable<(userKey: AccountId32 | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u128]>; /** * Removes the `paying_key` from a `user_key`. * @@ -2288,7 +2563,7 @@ declare module '@polkadot/api/types/submittable' { * - `NotPayingKey` if the `paying_key` doesn't match the current `paying_key`. * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. **/ - removePayingKey: AugmentedSubmittable<(userKey: AccountId | string | Uint8Array, payingKey: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId, AccountId]>; + removePayingKey: AugmentedSubmittable<(userKey: AccountId32 | string | Uint8Array, payingKey: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32]>; /** * Creates an authorization to allow `user_key` to accept the caller (`origin == paying_key`) as their subsidiser. * @@ -2299,7 +2574,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. **/ - setPayingKey: AugmentedSubmittable<(userKey: AccountId | string | Uint8Array, polyxLimit: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, Balance]>; + setPayingKey: AugmentedSubmittable<(userKey: AccountId32 | string | Uint8Array, polyxLimit: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u128]>; /** * Updates the available POLYX for a `user_key`. * @@ -2312,7 +2587,7 @@ declare module '@polkadot/api/types/submittable' { * - `NotPayingKey` if `origin` doesn't match the current `paying_key`. * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. **/ - updatePolyxLimit: AugmentedSubmittable<(userKey: AccountId | string | Uint8Array, polyxLimit: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, Balance]>; + updatePolyxLimit: AugmentedSubmittable<(userKey: AccountId32 | string | Uint8Array, polyxLimit: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u128]>; /** * Generic tx **/ @@ -2334,8 +2609,8 @@ declare module '@polkadot/api/types/submittable' { * * `ItnRewardAlreadyClaimed` - Reward issued to the `itn_address` has already been claimed. * * `UnknownItnAddress` - `itn_address` is not in the rewards table and has no reward to be claimed. **/ - claimItnReward: AugmentedSubmittable<(rewardAddress: AccountId | string | Uint8Array, itnAddress: AccountId | string | Uint8Array, signature: OffChainSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId, AccountId, OffChainSignature]>; - setItnRewardStatus: AugmentedSubmittable<(itnAddress: AccountId | string | Uint8Array, status: ItnRewardStatus | { Unclaimed: any } | { Claimed: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId, ItnRewardStatus]>; + claimItnReward: AugmentedSubmittable<(rewardAddress: AccountId32 | string | Uint8Array, itnAddress: AccountId32 | string | Uint8Array, signature: SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32, SpRuntimeMultiSignature]>; + setItnRewardStatus: AugmentedSubmittable<(itnAddress: AccountId32 | string | Uint8Array, status: PalletRewardsItnRewardStatus | { Unclaimed: any } | { Claimed: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, PalletRewardsItnRewardStatus]>; /** * Generic tx **/ @@ -2344,43 +2619,16 @@ declare module '@polkadot/api/types/submittable' { scheduler: { /** * Cancel an anonymously scheduled task. - * - * # - * - S = Number of already scheduled calls - * - Base Weight: 22.15 + 2.869 * S µs - * - DB Weight: - * - Read: Agenda - * - Write: Agenda, Lookup - * - Will use base weight of 100 which should be good for up to 30 scheduled calls - * # **/ - cancel: AugmentedSubmittable<(when: BlockNumber | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BlockNumber, u32]>; + cancel: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, u32]>; /** * Cancel a named scheduled task. - * - * # - * - S = Number of already scheduled calls - * - Base Weight: 24.91 + 2.907 * S µs - * - DB Weight: - * - Read: Agenda, Lookup - * - Write: Agenda, Lookup - * - Will use base weight of 100 which should be good for up to 30 scheduled calls - * # **/ cancelNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; /** * Anonymously schedule a task. - * - * # - * - S = Number of already scheduled calls - * - Base Weight: 22.29 + .126 * S µs - * - DB Weight: - * - Read: Agenda - * - Write: Agenda - * - Will use base weight of 25 which should be good for up to 30 scheduled calls - * # **/ - schedule: AugmentedSubmittable<(when: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [BlockNumber, Option, Priority, Call]>; + schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic, [u32, Option>, u8, FrameSupportScheduleMaybeHashed]>; /** * Anonymously schedule a task after a delay. * @@ -2388,28 +2636,19 @@ declare module '@polkadot/api/types/submittable' { * Same as [`schedule`]. * # **/ - scheduleAfter: AugmentedSubmittable<(after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [BlockNumber, Option, Priority, Call]>; + scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic, [u32, Option>, u8, FrameSupportScheduleMaybeHashed]>; /** * Schedule a named task. - * - * # - * - S = Number of already scheduled calls - * - Base Weight: 29.6 + .159 * S µs - * - DB Weight: - * - Read: Agenda, Lookup - * - Write: Agenda, Lookup - * - Will use base weight of 35 which should be good for more than 30 scheduled calls - * # **/ - scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [Bytes, BlockNumber, Option, Priority, Call]>; + scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic, [Bytes, u32, Option>, u8, FrameSupportScheduleMaybeHashed]>; /** * Schedule a named task after a delay. * * # - * Same as [`schedule_named`]. + * Same as [`schedule_named`](Self::schedule_named). * # **/ - scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [Bytes, BlockNumber, Option, Priority, Call]>; + scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: FrameSupportScheduleMaybeHashed | { Value: any } | { Hash: any } | string | Uint8Array) => SubmittableExtrinsic, [Bytes, u32, Option>, u8, FrameSupportScheduleMaybeHashed]>; /** * Generic tx **/ @@ -2418,16 +2657,20 @@ declare module '@polkadot/api/types/submittable' { session: { /** * Removes any session key(s) of the function caller. + * * This doesn't take effect until the next session. * - * The dispatch origin of this function must be signed. + * The dispatch origin of this function must be Signed and the account must be either be + * convertible to a validator ID using the chain's typical addressing system (this usually + * means being a controller account) or directly convertible into a validator ID (which + * usually means being a stash account). * * # - * - Complexity: `O(1)` in number of key types. - * Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed. + * - Complexity: `O(1)` in number of key types. Actual cost depends on the number of length + * of `T::Keys::key_ids()` which is fixed. * - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account` * - DbWrites: `NextKeys`, `origin account` - * - DbWrites per key id: `KeyOwnder` + * - DbWrites per key id: `KeyOwner` * # **/ purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic, []>; @@ -2439,15 +2682,15 @@ declare module '@polkadot/api/types/submittable' { * The dispatch origin of this function must be signed. * * # - * - Complexity: `O(1)` - * Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed. + * - Complexity: `O(1)`. Actual cost depends on the number of length of + * `T::Keys::key_ids()` which is fixed. * - DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys` * - DbWrites: `origin account`, `NextKeys` * - DbReads per key id: `KeyOwner` * - DbWrites per key id: `KeyOwner` * # **/ - setKeys: AugmentedSubmittable<(keys: Keys | string | Uint8Array, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Keys, Bytes]>; + setKeys: AugmentedSubmittable<(keys: PolymeshRuntimeDevelopRuntimeSessionKeys | { grandpa?: any; babe?: any; imOnline?: any; authorityDiscovery?: any } | string | Uint8Array, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic, [PolymeshRuntimeDevelopRuntimeSessionKeys, Bytes]>; /** * Generic tx **/ @@ -2469,7 +2712,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - addAndAffirmInstruction: AugmentedSubmittable<(venueId: u64 | AnyNumber | Uint8Array, settlementType: SettlementType | { SettleOnAffirmation: any } | { SettleOnBlock: any } | string | Uint8Array, tradeDate: Option | null | object | string | Uint8Array, valueDate: Option | null | object | string | Uint8Array, legs: Vec | (Leg | { from?: any; to?: any; asset?: any; amount?: any } | string | Uint8Array)[], portfolios: Vec | (PortfolioId | { did?: any; kind?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [u64, SettlementType, Option, Option, Vec, Vec]>; + addAndAffirmInstruction: AugmentedSubmittable<(venueId: u64 | AnyNumber | Uint8Array, settlementType: PalletSettlementSettlementType | { SettleOnAffirmation: any } | { SettleOnBlock: any } | string | Uint8Array, tradeDate: Option | null | object | string | Uint8Array, valueDate: Option | null | object | string | Uint8Array, legs: Vec | (PalletSettlementLeg | { from?: any; to?: any; asset?: any; amount?: any } | string | Uint8Array)[], portfolios: Vec | (PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [u64, PalletSettlementSettlementType, Option, Option, Vec, Vec]>; /** * Adds a new instruction. * @@ -2484,24 +2727,24 @@ declare module '@polkadot/api/types/submittable' { * # Weight * `950_000_000 + 1_000_000 * legs.len()` **/ - addInstruction: AugmentedSubmittable<(venueId: u64 | AnyNumber | Uint8Array, settlementType: SettlementType | { SettleOnAffirmation: any } | { SettleOnBlock: any } | string | Uint8Array, tradeDate: Option | null | object | string | Uint8Array, valueDate: Option | null | object | string | Uint8Array, legs: Vec | (Leg | { from?: any; to?: any; asset?: any; amount?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [u64, SettlementType, Option, Option, Vec]>; + addInstruction: AugmentedSubmittable<(venueId: u64 | AnyNumber | Uint8Array, settlementType: PalletSettlementSettlementType | { SettleOnAffirmation: any } | { SettleOnBlock: any } | string | Uint8Array, tradeDate: Option | null | object | string | Uint8Array, valueDate: Option | null | object | string | Uint8Array, legs: Vec | (PalletSettlementLeg | { from?: any; to?: any; asset?: any; amount?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [u64, PalletSettlementSettlementType, Option, Option, Vec]>; /** * Provide affirmation to an existing instruction. * * # Arguments - * * `instruction_id` - Instruction id to affirm. + * * `id` - Instruction id to affirm. * * `portfolios` - Portfolios that the sender controls and wants to affirm this instruction. * * `max_legs_count` - Number of legs that need to be affirmed. * * # Permissions * * Portfolio **/ - affirmInstruction: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, portfolios: Vec | (PortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, u32]>; + affirmInstruction: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, portfolios: Vec | (PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, u32]>; /** * Accepts an instruction and claims a signed receipt. * * # Arguments - * * `instruction_id` - Target instruction id. + * * `id` - Target instruction id. * * `leg_id` - Target leg id for the receipt * * `receipt_uid` - Receipt ID generated by the signer. * * `signer` - Signer of the receipt. @@ -2511,7 +2754,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - affirmWithReceipts: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, receiptDetails: Vec | (ReceiptDetails | { receipt_uid?: any; leg_id?: any; signer?: any; signature?: any; metadata?: any } | string | Uint8Array)[], portfolios: Vec | (PortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, Vec, u32]>; + affirmWithReceipts: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, receiptDetails: Vec | (PalletSettlementReceiptDetails | { receiptUid?: any; legId?: any; signer?: any; signature?: any; metadata?: any } | string | Uint8Array)[], portfolios: Vec | (PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, Vec, u32]>; /** * Allows additional venues to create instructions involving an asset. * @@ -2521,7 +2764,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - allowVenues: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, venues: Vec | (u64 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, Vec]>; + allowVenues: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, venues: Vec | (u64 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, Vec]>; /** * Marks a receipt issued by the caller as claimed or not claimed. * This allows the receipt issuer to invalidate an already issued receipt or revalidate an already claimed receipt. @@ -2534,7 +2777,7 @@ declare module '@polkadot/api/types/submittable' { * Claims a signed receipt. * * # Arguments - * * `instruction_id` - Target instruction id for the receipt. + * * `id` - Target instruction id for the receipt. * * `leg_id` - Target leg id for the receipt * * `receipt_uid` - Receipt ID generated by the signer. * * `signer` - Signer of the receipt. @@ -2543,7 +2786,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - claimReceipt: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, receiptDetails: ReceiptDetails | { receipt_uid?: any; leg_id?: any; signer?: any; signature?: any; metadata?: any } | string | Uint8Array) => SubmittableExtrinsic, [u64, ReceiptDetails]>; + claimReceipt: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, receiptDetails: PalletSettlementReceiptDetails | { receiptUid?: any; legId?: any; signer?: any; signature?: any; metadata?: any } | string | Uint8Array) => SubmittableExtrinsic, [u64, PalletSettlementReceiptDetails]>; /** * Registers a new venue. * @@ -2551,7 +2794,7 @@ declare module '@polkadot/api/types/submittable' { * * `signers` - Array of signers that are allowed to sign receipts for this venue * * `typ` - Type of venue being created **/ - createVenue: AugmentedSubmittable<(details: VenueDetails | string, signers: Vec | (AccountId | string | Uint8Array)[], typ: VenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array) => SubmittableExtrinsic, [VenueDetails, Vec, VenueType]>; + createVenue: AugmentedSubmittable<(details: Bytes | string | Uint8Array, signers: Vec | (AccountId32 | string | Uint8Array)[], typ: PalletSettlementVenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array) => SubmittableExtrinsic, [Bytes, Vec, PalletSettlementVenueType]>; /** * Revokes permission given to venues for creating instructions involving a particular asset. * @@ -2561,28 +2804,28 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - disallowVenues: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, venues: Vec | (u64 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, Vec]>; + disallowVenues: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, venues: Vec | (u64 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, Vec]>; /** * Root callable extrinsic, used as an internal call to execute a scheduled settlement instruction. **/ - executeScheduledInstruction: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, legsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, u32]>; + executeScheduledInstruction: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, legsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, u32]>; /** * Rejects an existing instruction. * * # Arguments - * * `instruction_id` - Instruction id to reject. + * * `id` - Instruction id to reject. * * `portfolio` - Portfolio to reject the instruction. * * `num_of_legs` - Number of legs in the instruction. * * # Permissions * * Portfolio **/ - rejectInstruction: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, portfolio: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, numOfLegs: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, PortfolioId, u32]>; + rejectInstruction: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, portfolio: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, numOfLegs: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, PolymeshPrimitivesIdentityIdPortfolioId, u32]>; /** * Reschedules a failed instruction. * * # Arguments - * * `instruction_id` - Target instruction id to reschedule. + * * `id` - Target instruction id to reschedule. * * # Permissions * * Portfolio @@ -2590,7 +2833,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `InstructionNotFailed` - Instruction not in a failed state or does not exist. **/ - rescheduleInstruction: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; + rescheduleInstruction: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; /** * Enables or disabled venue filtering for a token. * @@ -2601,7 +2844,7 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Asset **/ - setVenueFiltering: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, enabled: bool | boolean | Uint8Array) => SubmittableExtrinsic, [Ticker, bool]>; + setVenueFiltering: AugmentedSubmittable<(ticker: PolymeshPrimitivesTicker | string | Uint8Array, enabled: bool | boolean | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, bool]>; /** * Unclaims a previously claimed receipt. * @@ -2619,26 +2862,26 @@ declare module '@polkadot/api/types/submittable' { * * `id` specifies the ID of the venue to edit. * * `details` specifies the updated venue details. **/ - updateVenueDetails: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, details: VenueDetails | string) => SubmittableExtrinsic, [u64, VenueDetails]>; + updateVenueDetails: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, details: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, Bytes]>; /** * Edit a venue's type. * * * `id` specifies the ID of the venue to edit. * * `type` specifies the new type of the venue. **/ - updateVenueType: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, typ: VenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array) => SubmittableExtrinsic, [u64, VenueType]>; + updateVenueType: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, typ: PalletSettlementVenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array) => SubmittableExtrinsic, [u64, PalletSettlementVenueType]>; /** * Withdraw an affirmation for a given instruction. * * # Arguments - * * `instruction_id` - Instruction id for that affirmation get withdrawn. + * * `id` - Instruction id for that affirmation get withdrawn. * * `portfolios` - Portfolios that the sender controls and wants to withdraw affirmation. * * `max_legs_count` - Number of legs that need to be un-affirmed. * * # Permissions * * Portfolio **/ - withdrawAffirmation: AugmentedSubmittable<(instructionId: u64 | AnyNumber | Uint8Array, portfolios: Vec | (PortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, u32]>; + withdrawAffirmation: AugmentedSubmittable<(id: u64 | AnyNumber | Uint8Array, portfolios: Vec | (PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array)[], maxLegsCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, Vec, u32]>; /** * Generic tx **/ @@ -2655,7 +2898,7 @@ declare module '@polkadot/api/types/submittable' { * * identity Validator's IdentityId. * * intended_count No. of validators given identity intends to run. **/ - addPermissionedValidator: AugmentedSubmittable<(identity: IdentityId | string | Uint8Array, intendedCount: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Option]>; + addPermissionedValidator: AugmentedSubmittable<(identity: PolymeshPrimitivesIdentityId | string | Uint8Array, intendedCount: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, Option]>; /** * Take the origin account as a stash and lock up `value` of its balance. `controller` will * be the account that controls it. @@ -2679,12 +2922,8 @@ declare module '@polkadot/api/types/submittable' { * - Read: Bonded, Ledger, [Origin Account], Current Era, History Depth, Locks * - Write: Bonded, Payee, [Origin Account], Locks, Ledger * # - * # Arguments - * * origin Stash account (signer of the extrinsic). - * * controller Account that controls the operation of stash. - * * payee Destination where reward can be transferred. **/ - bond: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [LookupSource, Compact, RewardDestination]>; + bond: AugmentedSubmittable<(controller: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array, payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact, PalletStakingRewardDestination]>; /** * Add some extra amount that have appeared in the stash `free_balance` into the balance up * for staking. @@ -2707,12 +2946,8 @@ declare module '@polkadot/api/types/submittable' { * - Read: Era Election Status, Bonded, Ledger, [Origin Account], Locks * - Write: [Origin Account], Locks, Ledger * # - * - * # Arguments - * * origin Stash account (signer of the extrinsic). - * * max_additional Extra amount that need to be bonded. **/ - bondExtra: AugmentedSubmittable<(maxAdditional: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; + bondExtra: AugmentedSubmittable<(maxAdditional: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; /** * Cancel enactment of a deferred slash. * @@ -2728,7 +2963,7 @@ declare module '@polkadot/api/types/submittable' { * - Write: Unapplied Slashes * # **/ - cancelDeferredSlash: AugmentedSubmittable<(era: EraIndex | AnyNumber | Uint8Array, slashIndices: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [EraIndex, Vec]>; + cancelDeferredSlash: AugmentedSubmittable<(era: u32 | AnyNumber | Uint8Array, slashIndices: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [u32, Vec]>; /** * Switch slashing status on the basis of given `SlashingSwitch`. Can only be called by root. * @@ -2736,7 +2971,7 @@ declare module '@polkadot/api/types/submittable' { * * origin - AccountId of root. * * slashing_switch - Switch used to set the targets for slashing. **/ - changeSlashingAllowedFor: AugmentedSubmittable<(slashingSwitch: SlashingSwitch | 'Validator' | 'ValidatorAndNominator' | 'None' | number | Uint8Array) => SubmittableExtrinsic, [SlashingSwitch]>; + changeSlashingAllowedFor: AugmentedSubmittable<(slashingSwitch: PalletStakingSlashingSwitch | 'Validator' | 'ValidatorAndNominator' | 'None' | number | Uint8Array) => SubmittableExtrinsic, [PalletStakingSlashingSwitch]>; /** * Declare no desire to either validate or nominate. * @@ -2805,7 +3040,7 @@ declare module '@polkadot/api/types/submittable' { * Writes Each: SpanSlash * S * # **/ - forceUnstake: AugmentedSubmittable<(stash: AccountId | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u32]>; + forceUnstake: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32]>; /** * Increments the ideal number of validators. * @@ -2837,11 +3072,8 @@ declare module '@polkadot/api/types/submittable' { * - Writes: Validators, Nominators * # **/ - nominate: AugmentedSubmittable<(targets: Vec | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + nominate: AugmentedSubmittable<(targets: Vec | (MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** - * Polymesh-Note - Weight changes to 1/4 of the actual weight that is calculated using the - * upstream benchmarking process. - * * Pay out all the stakers behind a single validator for a single era. * * - `validator_stash` is the stash account of the validator. Their nominators, up to @@ -2868,15 +3100,15 @@ declare module '@polkadot/api/types/submittable' { * - Write Each: System Account, Locks, Ledger (3 items) * # **/ - payoutStakers: AugmentedSubmittable<(validatorStash: AccountId | string | Uint8Array, era: EraIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, EraIndex]>; + payoutStakers: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32]>; /** * System version of `payout_stakers()`. Only be called by the root origin. **/ - payoutStakersBySystem: AugmentedSubmittable<(validatorStash: AccountId | string | Uint8Array, era: EraIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, EraIndex]>; + payoutStakersBySystem: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32]>; /** - * Remove all data structure concerning a staker/stash once its balance is zero. + * Remove all data structure concerning a staker/stash once its balance is at the minimum. * This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone - * and the target `stash` must have no funds left. + * and the target `stash` must have no funds left beyond the ED. * * This can be called from any origin. * @@ -2890,7 +3122,7 @@ declare module '@polkadot/api/types/submittable' { * - Writes Each: SpanSlash * S * # **/ - reapStash: AugmentedSubmittable<(stash: AccountId | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId, u32]>; + reapStash: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u32]>; /** * Rebond a portion of the stash scheduled to be unlocked. * @@ -2907,7 +3139,7 @@ declare module '@polkadot/api/types/submittable' { * - Writes: [Origin Account], Locks, Ledger * # **/ - rebond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; + rebond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; /** * Remove an identity from the pool of (wannabe) validator identities. Effects are known in the next session. * Staking module checks `PermissionedIdentity` to ensure validators have @@ -2917,7 +3149,7 @@ declare module '@polkadot/api/types/submittable' { * * origin Required origin for removing a potential validator. * * identity Validator's IdentityId. **/ - removePermissionedValidator: AugmentedSubmittable<(identity: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + removePermissionedValidator: AugmentedSubmittable<(identity: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Scale up the ideal number of validators by a factor. * @@ -2954,7 +3186,7 @@ declare module '@polkadot/api/types/submittable' { * - Write: Bonded, Ledger New Controller, Ledger Old Controller * # **/ - setController: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic, [LookupSource]>; + setController: AugmentedSubmittable<(controller: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress]>; /** * Set `HistoryDepth` value. This function will delete any history information * when `HistoryDepth` is reduced. @@ -2978,7 +3210,7 @@ declare module '@polkadot/api/types/submittable' { * - Writes Each: ErasValidatorReward, ErasRewardPoints, ErasTotalStake, ErasStartSessionIndex * # **/ - setHistoryDepth: AugmentedSubmittable<(newHistoryDepth: Compact | AnyNumber | Uint8Array, eraItemsDeleted: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact, Compact]>; + setHistoryDepth: AugmentedSubmittable<(newHistoryDepth: Compact | AnyNumber | Uint8Array, eraItemsDeleted: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact, Compact]>; /** * Set the validators who cannot be slashed (if any). * @@ -2989,15 +3221,15 @@ declare module '@polkadot/api/types/submittable' { * - Write: Invulnerables * # **/ - setInvulnerables: AugmentedSubmittable<(invulnerables: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + setInvulnerables: AugmentedSubmittable<(invulnerables: Vec | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** - * Changes min bond value to be used in bond(). Only Governance + * Changes min bond value to be used in validate(). Only Governance * committee is allowed to change this value. * * # Arguments * * `new_value` the new minimum **/ - setMinBondThreshold: AugmentedSubmittable<(newValue: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BalanceOf]>; + setMinBondThreshold: AugmentedSubmittable<(newValue: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; /** * (Re-)set the payment target for a controller. * @@ -3016,7 +3248,7 @@ declare module '@polkadot/api/types/submittable' { * - Write: Payee * # **/ - setPayee: AugmentedSubmittable<(payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [RewardDestination]>; + setPayee: AugmentedSubmittable<(payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletStakingRewardDestination]>; /** * Sets the ideal number of validators. * @@ -3079,7 +3311,7 @@ declare module '@polkadot/api/types/submittable' { * - Worse solution is retraced in pre-dispatch-checks which sets its own weight. * # **/ - submitElectionSolution: AugmentedSubmittable<(winners: Vec | (ValidatorIndex | AnyNumber | Uint8Array)[], compact: CompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: ElectionScore, era: EraIndex | AnyNumber | Uint8Array, size: ElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic, [Vec, CompactAssignments, ElectionScore, EraIndex, ElectionSize]>; + submitElectionSolution: AugmentedSubmittable<(winners: Vec | (u16 | AnyNumber | Uint8Array)[], compact: PalletStakingCompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: SpNposElectionsElectionScore | { minimalStake?: any; sumStake?: any; sumStakeSquared?: any } | string | Uint8Array, era: u32 | AnyNumber | Uint8Array, size: PalletStakingElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic, [Vec, PalletStakingCompactAssignments, SpNposElectionsElectionScore, u32, PalletStakingElectionSize]>; /** * Unsigned version of `submit_election_solution`. * @@ -3091,7 +3323,7 @@ declare module '@polkadot/api/types/submittable' { * See [`submit_election_solution`]. * # **/ - submitElectionSolutionUnsigned: AugmentedSubmittable<(winners: Vec | (ValidatorIndex | AnyNumber | Uint8Array)[], compact: CompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: ElectionScore, era: EraIndex | AnyNumber | Uint8Array, size: ElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic, [Vec, CompactAssignments, ElectionScore, EraIndex, ElectionSize]>; + submitElectionSolutionUnsigned: AugmentedSubmittable<(winners: Vec | (u16 | AnyNumber | Uint8Array)[], compact: PalletStakingCompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: SpNposElectionsElectionScore | { minimalStake?: any; sumStake?: any; sumStakeSquared?: any } | string | Uint8Array, era: u32 | AnyNumber | Uint8Array, size: PalletStakingElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic, [Vec, PalletStakingCompactAssignments, SpNposElectionsElectionScore, u32, PalletStakingElectionSize]>; /** * Schedule a portion of the stash to be unlocked ready for transfer out after the bond * period ends. If this leaves an amount actively bonded less than @@ -3125,12 +3357,8 @@ declare module '@polkadot/api/types/submittable' { * - Read: EraElectionStatus, Ledger, CurrentEra, Locks, \[Origin Account\] * - Write: Locks, Ledger, \[Origin Account\] * - * - * # Arguments - * * origin Controller (Signer of the extrinsic). - * * value Balance needs to be unbonded. **/ - unbond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; + unbond: AugmentedSubmittable<(value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; /** * Update the intended validator count for a given DID. * @@ -3139,7 +3367,7 @@ declare module '@polkadot/api/types/submittable' { * * identity to add as a validator. * * new_intended_count New value of intended count. **/ - updatePermissionedValidatorIntendedCount: AugmentedSubmittable<(identity: IdentityId | string | Uint8Array, newIntendedCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [IdentityId, u32]>; + updatePermissionedValidatorIntendedCount: AugmentedSubmittable<(identity: PolymeshPrimitivesIdentityId | string | Uint8Array, newIntendedCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, u32]>; /** * Declare the desire to validate for the origin controller. * @@ -3159,7 +3387,7 @@ declare module '@polkadot/api/types/submittable' { * - Write: Nominators, Validators * # **/ - validate: AugmentedSubmittable<(prefs: ValidatorPrefs | { commission?: any; blocked?: any } | string | Uint8Array) => SubmittableExtrinsic, [ValidatorPrefs]>; + validate: AugmentedSubmittable<(prefs: PalletStakingValidatorPrefs | { commission?: any; blocked?: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletStakingValidatorPrefs]>; /** * Validate the nominators CDD expiry time. * @@ -3172,7 +3400,7 @@ declare module '@polkadot/api/types/submittable' { * - Depends on the no. of claim issuers an accountId has for the CDD expiry. * # **/ - validateCddExpiryNominators: AugmentedSubmittable<(targets: Vec | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + validateCddExpiryNominators: AugmentedSubmittable<(targets: Vec | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Remove any unlocked chunks from the `unlocking` queue from our management. * @@ -3198,8 +3426,10 @@ declare module '@polkadot/api/types/submittable' { * - Reads: EraElectionStatus, Ledger, Current Era, Locks, [Origin Account] * - Writes: [Origin Account], Locks, Ledger * Kill: - * - Reads: EraElectionStatus, Ledger, Current Era, Bonded, Slashing Spans, \[Origin Account\], Locks - * - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, [Origin Account], Locks + * - Reads: EraElectionStatus, Ledger, Current Era, Bonded, Slashing Spans, [Origin + * Account], Locks + * - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, + * [Origin Account], Locks * - Writes Each: SpanSlash * S * NOTE: Weight annotation is the kill scenario, we refund otherwise. * # @@ -3212,70 +3442,76 @@ declare module '@polkadot/api/types/submittable' { }; statistics: { /** - * Exempt entities from a transfer manager + * Allow a trusted issuer to init/resync ticker/company stats. * * # Arguments - * * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - * * `ticker` ticker for which the exemption list is being modified. - * * `transfer_manager` Transfer manager for which the exemption list is being modified. - * * `exempted_entities` ScopeIds for which the exemption list is being modified. + * - `origin` - a signer that has permissions to act as an agent of `asset`. + * - `asset` - the asset to change the active stats on. + * - `stat_type` - stat type to update. + * - `values` - Updated values for `stat_type`. * * # Errors - * * `Unauthorized` if `origin` is not the owner of the ticker. + * - `StatTypeMissing` - `stat_type` is not enabled for the `asset`. + * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. * * # Permissions - * * Asset + * - Agent + * - Asset **/ - addExemptedEntities: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, transferManager: TransferManager | { CountTransferManager: any } | { PercentageTransferManager: any } | string | Uint8Array, exemptedEntities: Vec | (ScopeId | string | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, TransferManager, Vec]>; + batchUpdateAssetStats: AugmentedSubmittable<(asset: PolymeshPrimitivesStatisticsAssetScope | { Ticker: any } | string | Uint8Array, statType: PolymeshPrimitivesStatisticsStatType | { op?: any; claimIssuer?: any } | string | Uint8Array, values: BTreeSetStatUpdate) => SubmittableExtrinsic, [PolymeshPrimitivesStatisticsAssetScope, PolymeshPrimitivesStatisticsStatType, BTreeSetStatUpdate]>; /** - * Adds a new transfer manager. + * Set the active asset stat_types. * * # Arguments - * * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - * * `ticker` ticker for which the transfer managers are being updated. - * * `new_transfer_manager` Transfer manager being added. + * - `origin` - a signer that has permissions to act as an agent of `asset`. + * - `asset` - the asset to change the active stats on. + * - `stat_types` - the new stat types to replace any existing types. * * # Errors - * * `Unauthorized` if `origin` is not the owner of the ticker. - * * `DuplicateTransferManager` if `new_transfer_manager` is already enabled for the ticker. - * * `TransferManagersLimitReached` if the `ticker` already has max TMs attached + * - `StatTypeLimitReached` - too many stat types enabled for the `asset`. + * - `CannotRemoveStatTypeInUse` - can not remove a stat type that is in use by transfer conditions. + * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. * * # Permissions - * * Asset + * - Agent + * - Asset **/ - addTransferManager: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, newTransferManager: TransferManager | { CountTransferManager: any } | { PercentageTransferManager: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, TransferManager]>; + setActiveAssetStats: AugmentedSubmittable<(asset: PolymeshPrimitivesStatisticsAssetScope | { Ticker: any } | string | Uint8Array, statTypes: BTreeSetStatType) => SubmittableExtrinsic, [PolymeshPrimitivesStatisticsAssetScope, BTreeSetStatType]>; /** - * remove entities from exemption list of a transfer manager + * Set asset transfer compliance rules. * * # Arguments - * * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - * * `ticker` ticker for which the exemption list is being modified. - * * `transfer_manager` Transfer manager for which the exemption list is being modified. - * * `scope_ids` ScopeIds for which the exemption list is being modified. + * - `origin` - a signer that has permissions to act as an agent of `asset`. + * - `asset` - the asset to change the active stats on. + * - `transfer_conditions` - the new transfer condition to replace any existing conditions. * * # Errors - * * `Unauthorized` if `origin` is not the owner of the ticker. + * - `TransferConditionLimitReached` - too many transfer condititon enabled for `asset`. + * - `StatTypeMissing` - a transfer condition requires a stat type that is not enabled for the `asset`. + * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. * * # Permissions - * * Asset + * - Agent + * - Asset **/ - removeExemptedEntities: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, transferManager: TransferManager | { CountTransferManager: any } | { PercentageTransferManager: any } | string | Uint8Array, entities: Vec | (ScopeId | string | Uint8Array)[]) => SubmittableExtrinsic, [Ticker, TransferManager, Vec]>; + setAssetTransferCompliance: AugmentedSubmittable<(asset: PolymeshPrimitivesStatisticsAssetScope | { Ticker: any } | string | Uint8Array, transferConditions: BTreeSetTransferCondition) => SubmittableExtrinsic, [PolymeshPrimitivesStatisticsAssetScope, BTreeSetTransferCondition]>; /** - * Removes a transfer manager. + * Set/unset entities exempt from an asset's transfer compliance rules. * * # Arguments - * * `origin` It contains the secondary key of the caller (i.e who signed the transaction to execute this function). - * * `ticker` ticker for which the transfer managers are being updated. - * * `transfer_manager` Transfer manager being removed. + * - `origin` - a signer that has permissions to act as an agent of `exempt_key.asset`. + * - `is_exempt` - enable/disable exemption for `entities`. + * - `exempt_key` - the asset and stat type to exempt the `entities` from. + * - `entities` - the entities to set/unset the exemption for. * * # Errors - * * `Unauthorized` if `origin` is not the owner of the ticker. - * * `TransferManagerMissing` if `asset_compliance` contains multiple entries with the same `requirement_id`. + * - `UnauthorizedAgent` if `origin` is not agent-permissioned for `asset`. * * # Permissions - * * Asset + * - Agent + * - Asset **/ - removeTransferManager: AugmentedSubmittable<(ticker: Ticker | string | Uint8Array, transferManager: TransferManager | { CountTransferManager: any } | { PercentageTransferManager: any } | string | Uint8Array) => SubmittableExtrinsic, [Ticker, TransferManager]>; + setEntitiesExempt: AugmentedSubmittable<(isExempt: bool | boolean | Uint8Array, exemptKey: PolymeshPrimitivesTransferComplianceTransferConditionExemptKey | { asset?: any; op?: any; claimType?: any } | string | Uint8Array, entities: BTreeSetIdentityId) => SubmittableExtrinsic, [bool, PolymeshPrimitivesTransferComplianceTransferConditionExemptKey, BTreeSetIdentityId]>; /** * Generic tx **/ @@ -3300,24 +3536,24 @@ declare module '@polkadot/api/types/submittable' { * * Asset * * Portfolio **/ - createFundraiser: AugmentedSubmittable<(offeringPortfolio: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, offeringAsset: Ticker | string | Uint8Array, raisingPortfolio: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, raisingAsset: Ticker | string | Uint8Array, tiers: Vec | (PriceTier | { total?: any; price?: any } | string | Uint8Array)[], venueId: u64 | AnyNumber | Uint8Array, start: Option | null | object | string | Uint8Array, end: Option | null | object | string | Uint8Array, minimumInvestment: Balance | AnyNumber | Uint8Array, fundraiserName: FundraiserName | string) => SubmittableExtrinsic, [PortfolioId, Ticker, PortfolioId, Ticker, Vec, u64, Option, Option, Balance, FundraiserName]>; + createFundraiser: AugmentedSubmittable<(offeringPortfolio: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, raisingPortfolio: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, raisingAsset: PolymeshPrimitivesTicker | string | Uint8Array, tiers: Vec | (PalletStoPriceTier | { total?: any; price?: any } | string | Uint8Array)[], venueId: u64 | AnyNumber | Uint8Array, start: Option | null | object | string | Uint8Array, end: Option | null | object | string | Uint8Array, minimumInvestment: u128 | AnyNumber | Uint8Array, fundraiserName: Bytes | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesTicker, Vec, u64, Option, Option, u128, Bytes]>; /** * Freeze a fundraiser. * * * `offering_asset` - Asset to freeze. - * * `fundraiser_id` - ID of the fundraiser to freeze. + * * `id` - ID of the fundraiser to freeze. * * # Permissions * * Asset **/ - freezeFundraiser: AugmentedSubmittable<(offeringAsset: Ticker | string | Uint8Array, fundraiserId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, u64]>; + freezeFundraiser: AugmentedSubmittable<(offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u64]>; /** * Invest in a fundraiser. * * * `investment_portfolio` - Portfolio that `offering_asset` will be deposited in. * * `funding_portfolio` - Portfolio that will fund the investment. * * `offering_asset` - Asset to invest in. - * * `fundraiser_id` - ID of the fundraiser to invest in. + * * `id` - ID of the fundraiser to invest in. * * `purchase_amount` - Amount of `offering_asset` to purchase. * * `max_price` - Maximum price to pay per unit of `offering_asset`, If `None`there are no constraints on price. * * `receipt` - Off-chain receipt to use instead of on-chain balance in `funding_portfolio`. @@ -3325,39 +3561,39 @@ declare module '@polkadot/api/types/submittable' { * # Permissions * * Portfolio **/ - invest: AugmentedSubmittable<(investmentPortfolio: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, fundingPortfolio: PortfolioId | { did?: any; kind?: any } | string | Uint8Array, offeringAsset: Ticker | string | Uint8Array, fundraiserId: u64 | AnyNumber | Uint8Array, purchaseAmount: Balance | AnyNumber | Uint8Array, maxPrice: Option | null | object | string | Uint8Array, receipt: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PortfolioId, PortfolioId, Ticker, u64, Balance, Option, Option]>; + invest: AugmentedSubmittable<(investmentPortfolio: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, fundingPortfolio: PolymeshPrimitivesIdentityIdPortfolioId | { did?: any; kind?: any } | string | Uint8Array, offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array, purchaseAmount: u128 | AnyNumber | Uint8Array, maxPrice: Option | null | object | string | Uint8Array, receipt: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesTicker, u64, u128, Option, Option]>; /** * Modify the time window a fundraiser is active * * * `offering_asset` - Asset to modify. - * * `fundraiser_id` - ID of the fundraiser to modify. + * * `id` - ID of the fundraiser to modify. * * `start` - New start of the fundraiser. * * `end` - New end of the fundraiser to modify. * * # Permissions * * Asset **/ - modifyFundraiserWindow: AugmentedSubmittable<(offeringAsset: Ticker | string | Uint8Array, fundraiserId: u64 | AnyNumber | Uint8Array, start: Moment | AnyNumber | Uint8Array, end: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Ticker, u64, Moment, Option]>; + modifyFundraiserWindow: AugmentedSubmittable<(offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array, start: u64 | AnyNumber | Uint8Array, end: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u64, u64, Option]>; /** * Stop a fundraiser. * * * `offering_asset` - Asset to stop. - * * `fundraiser_id` - ID of the fundraiser to stop. + * * `id` - ID of the fundraiser to stop. * * # Permissions * * Asset **/ - stop: AugmentedSubmittable<(offeringAsset: Ticker | string | Uint8Array, fundraiserId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, u64]>; + stop: AugmentedSubmittable<(offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u64]>; /** * Unfreeze a fundraiser. * * * `offering_asset` - Asset to unfreeze. - * * `fundraiser_id` - ID of the fundraiser to unfreeze. + * * `id` - ID of the fundraiser to unfreeze. * * # Permissions * * Asset **/ - unfreezeFundraiser: AugmentedSubmittable<(offeringAsset: Ticker | string | Uint8Array, fundraiserId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Ticker, u64]>; + unfreezeFundraiser: AugmentedSubmittable<(offeringAsset: PolymeshPrimitivesTicker | string | Uint8Array, id: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesTicker, u64]>; /** * Generic tx **/ @@ -3375,7 +3611,7 @@ declare module '@polkadot/api/types/submittable' { * - One DB change. * # **/ - setKey: AugmentedSubmittable<(updated: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic, [LookupSource]>; + setKey: AugmentedSubmittable<(updated: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress]>; /** * Authenticates the sudo key and dispatches a function call with `Root` origin. * @@ -3402,7 +3638,7 @@ declare module '@polkadot/api/types/submittable' { * - Weight of derivative `call` execution + 10,000. * # **/ - sudoAs: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [LookupSource, Call]>; + sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Call]>; /** * Authenticates the sudo key and dispatches a function call with `Root` origin. * This function does not check the weight of the call, and instead allows the @@ -3415,7 +3651,7 @@ declare module '@polkadot/api/types/submittable' { * - The weight of this call is defined by the caller. * # **/ - sudoUncheckedWeight: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array, weight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Call, Weight]>; + sudoUncheckedWeight: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Call, u64]>; /** * Generic tx **/ @@ -3431,59 +3667,36 @@ declare module '@polkadot/api/types/submittable' { * * **NOTE:** We rely on the Root origin to provide us the number of subkeys under * the prefix we are removing to accurately calculate the weight of this function. - * - * # - * - `O(P)` where `P` amount of keys with prefix `prefix` - * - `P` storage deletions. - * - Base Weight: 0.834 * P µs - * - Writes: Number of subkeys + 1 - * # **/ - killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Key, u32]>; + killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32]>; /** * Kill some items from storage. - * - * # - * - `O(IK)` where `I` length of `keys` and `K` length of one key - * - `I` storage deletions. - * - Base Weight: .378 * i µs - * - Writes: Number of items - * # **/ - killStorage: AugmentedSubmittable<(keys: Vec | (Key | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + killStorage: AugmentedSubmittable<(keys: Vec | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Make some on-chain remark. * * # * - `O(1)` - * - Base Weight: 0.665 µs, independent of remark length. - * - No DB operations. * # **/ remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; /** - * Set the new changes trie configuration. - * - * # - * - `O(1)` - * - 1 storage write or delete (codec `O(1)`). - * - 1 call to `deposit_log`: Uses `append` API, so O(1) - * - Base Weight: 7.218 µs - * - DB Weight: - * - Writes: Changes Trie, System Digest - * # + * Make some on-chain remark and emit event. **/ - setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [Option]>; + remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; /** * Set the new runtime code. * * # * - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code` + * - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is + * expensive). * - 1 storage write (codec `O(C)`). - * - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is expensive). + * - 1 digest item. * - 1 event. - * The weight of this function is dependent on the runtime, but generally this is very expensive. - * We will treat this as a full block. + * The weight of this function is dependent on the runtime, but generally this is very + * expensive. We will treat this as a full block. * # **/ setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; @@ -3493,33 +3706,20 @@ declare module '@polkadot/api/types/submittable' { * # * - `O(C)` where `C` length of `code` * - 1 storage write (codec `O(C)`). + * - 1 digest item. * - 1 event. - * The weight of this function is dependent on the runtime. We will treat this as a full block. - * # + * The weight of this function is dependent on the runtime. We will treat this as a full + * block. # **/ setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; /** * Set the number of pages in the WebAssembly environment's heap. - * - * # - * - `O(1)` - * - 1 storage write. - * - Base Weight: 1.405 µs - * - 1 write to HEAP_PAGES - * # **/ setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; /** * Set some items of storage. - * - * # - * - `O(I)` where `I` length of `items` - * - `I` storage writes (`O(1)`). - * - Base Weight: 0.568 * i µs - * - Writes: Number of items - * # **/ - setStorage: AugmentedSubmittable<(items: Vec | (KeyValue)[]) => SubmittableExtrinsic, [Vec]>; + setStorage: AugmentedSubmittable<(items: Vec> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; /** * Generic tx **/ @@ -3532,7 +3732,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `expiry` - The new expiry time. **/ - setExpiresAfter: AugmentedSubmittable<(expiry: MaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [MaybeBlock]>; + setExpiresAfter: AugmentedSubmittable<(expiry: PolymeshCommonUtilitiesMaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshCommonUtilitiesMaybeBlock]>; /** * Changes the release coordinator. * @@ -3542,7 +3742,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, If the new coordinator `id` is not part of the committee. **/ - setReleaseCoordinator: AugmentedSubmittable<(id: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + setReleaseCoordinator: AugmentedSubmittable<(id: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Change the vote threshold the determines the winning proposal. * For e.g., for a simple majority use (1, 2) which represents the in-equation ">= 1/2". @@ -3564,7 +3764,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, if the `origin` is not a member of this committee. **/ - vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: ProposalIndex | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [Hash, ProposalIndex, bool]>; + vote: AugmentedSubmittable<(proposal: H256 | string | Uint8Array, index: u32 | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [H256, u32, bool]>; /** * Proposes to the committee that `call` should be executed in its name. * Alternatively, if the hash of `call` has already been recorded, i.e., already proposed, @@ -3611,7 +3811,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `AddOrigin` or root * * `who` - IdentityId to be added to the group. **/ - addMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + addMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Disables a member at specific moment. * @@ -3630,7 +3830,7 @@ declare module '@polkadot/api/types/submittable' { * * `expiry` - Time-stamp when `who` is removed from CDD. As soon as it is expired, the * generated claims will be "invalid" as `who` is not considered a member of the group. **/ - disableMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Option, Option]>; + disableMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, Option, Option]>; /** * Removes a member `who` from the set. May only be called from `RemoveOrigin` or root. * @@ -3643,7 +3843,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `RemoveOrigin` or root * * `who` - IdentityId to be removed from the group. **/ - removeMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + removeMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Changes the membership to a new set, disregarding the existing membership. * May only be called from `ResetOrigin` or root. @@ -3652,14 +3852,14 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `ResetOrigin` or root * * `members` - New set of identities **/ - resetMembers: AugmentedSubmittable<(members: Vec | (IdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + resetMembers: AugmentedSubmittable<(members: Vec | (PolymeshPrimitivesIdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Change this group's limit for how many concurrent active members they may be. * * # Arguments * * `limit` - the number of active members there may be concurrently. **/ - setActiveMembersLimit: AugmentedSubmittable<(limit: MemberCount | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MemberCount]>; + setActiveMembersLimit: AugmentedSubmittable<(limit: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Swaps out one member `remove` for another member `add`. * @@ -3670,7 +3870,7 @@ declare module '@polkadot/api/types/submittable' { * * `remove` - IdentityId to be removed from the group. * * `add` - IdentityId to be added in place of `remove`. **/ - swapMember: AugmentedSubmittable<(remove: IdentityId | string | Uint8Array, add: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, IdentityId]>; + swapMember: AugmentedSubmittable<(remove: PolymeshPrimitivesIdentityId | string | Uint8Array, add: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; /** * Generic tx **/ @@ -3680,7 +3880,7 @@ declare module '@polkadot/api/types/submittable' { /** * Emits an event with caller's identity and CDD status. **/ - getCddOf: AugmentedSubmittable<(of: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + getCddOf: AugmentedSubmittable<(of: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Emits an event with caller's identity. **/ @@ -3699,7 +3899,7 @@ declare module '@polkadot/api/types/submittable' { * - `target_account` (primary key of the new Identity) can be linked to just one and only * one identity. **/ - mockCddRegisterDid: AugmentedSubmittable<(targetAccount: AccountId | string | Uint8Array) => SubmittableExtrinsic, [AccountId]>; + mockCddRegisterDid: AugmentedSubmittable<(targetAccount: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; /** * Generates a new `IdentityID` for the caller, and issues a self-generated CDD claim. * @@ -3712,7 +3912,7 @@ declare module '@polkadot/api/types/submittable' { * - `SecondaryKeysContainPrimaryKey` if `secondary_keys` contains the caller account. * - `DidAlreadyExists` if auto-generated DID already exists. **/ - registerDid: AugmentedSubmittable<(uid: InvestorUid | string | Uint8Array, secondaryKeys: Vec | (SecondaryKey | { signer?: any; permissions?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [InvestorUid, Vec]>; + registerDid: AugmentedSubmittable<(uid: PolymeshPrimitivesCddIdInvestorUid | string | Uint8Array, secondaryKeys: Vec | (PolymeshPrimitivesSecondaryKey | { key?: any; permissions?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [PolymeshPrimitivesCddIdInvestorUid, Vec]>; /** * Generic tx **/ @@ -3732,11 +3932,12 @@ declare module '@polkadot/api/types/submittable' { * * # * - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`) - * - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in `on_finalize`) + * - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in + * `on_finalize`) * - 1 event handler `on_timestamp_set`. Must be `O(1)`. * # **/ - set: AugmentedSubmittable<(now: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; + set: AugmentedSubmittable<(now: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; /** * Generic tx **/ @@ -3750,14 +3951,15 @@ declare module '@polkadot/api/types/submittable' { * # Error * * `BadOrigin`: Only root can execute transaction. * * `InsufficientBalance`: If treasury balances is not enough to cover all beneficiaries. + * * `InvalidIdentity`: If one of the beneficiaries has an invalid identity. **/ - disbursement: AugmentedSubmittable<(beneficiaries: Vec | (Beneficiary | { id?: any; amount?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + disbursement: AugmentedSubmittable<(beneficiaries: Vec | (PolymeshPrimitivesBeneficiary | { id?: any; amount?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * It transfers the specific `amount` from `origin` account into treasury. * * Only accounts which are associated to an identity can make a donation to treasury. **/ - reimbursement: AugmentedSubmittable<(amount: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic, [BalanceOf]>; + reimbursement: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; /** * Generic tx **/ @@ -3770,7 +3972,7 @@ declare module '@polkadot/api/types/submittable' { * # Arguments * * `expiry` - The new expiry time. **/ - setExpiresAfter: AugmentedSubmittable<(expiry: MaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [MaybeBlock]>; + setExpiresAfter: AugmentedSubmittable<(expiry: PolymeshCommonUtilitiesMaybeBlock | { Some: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic, [PolymeshCommonUtilitiesMaybeBlock]>; /** * Changes the release coordinator. * @@ -3780,7 +3982,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, If the new coordinator `id` is not part of the committee. **/ - setReleaseCoordinator: AugmentedSubmittable<(id: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + setReleaseCoordinator: AugmentedSubmittable<(id: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Change the vote threshold the determines the winning proposal. * For e.g., for a simple majority use (1, 2) which represents the in-equation ">= 1/2". @@ -3802,7 +4004,7 @@ declare module '@polkadot/api/types/submittable' { * # Errors * * `NotAMember`, if the `origin` is not a member of this committee. **/ - vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: ProposalIndex | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [Hash, ProposalIndex, bool]>; + vote: AugmentedSubmittable<(proposal: H256 | string | Uint8Array, index: u32 | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [H256, u32, bool]>; /** * Proposes to the committee that `call` should be executed in its name. * Alternatively, if the hash of `call` has already been recorded, i.e., already proposed, @@ -3849,7 +4051,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `AddOrigin` or root * * `who` - IdentityId to be added to the group. **/ - addMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + addMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Disables a member at specific moment. * @@ -3868,7 +4070,7 @@ declare module '@polkadot/api/types/submittable' { * * `expiry` - Time-stamp when `who` is removed from CDD. As soon as it is expired, the * generated claims will be "invalid" as `who` is not considered a member of the group. **/ - disableMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, Option, Option]>; + disableMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array, expiry: Option | null | object | string | Uint8Array, at: Option | null | object | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, Option, Option]>; /** * Removes a member `who` from the set. May only be called from `RemoveOrigin` or root. * @@ -3881,7 +4083,7 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `RemoveOrigin` or root * * `who` - IdentityId to be removed from the group. **/ - removeMember: AugmentedSubmittable<(who: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId]>; + removeMember: AugmentedSubmittable<(who: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId]>; /** * Changes the membership to a new set, disregarding the existing membership. * May only be called from `ResetOrigin` or root. @@ -3890,14 +4092,14 @@ declare module '@polkadot/api/types/submittable' { * * `origin` - Origin representing `ResetOrigin` or root * * `members` - New set of identities **/ - resetMembers: AugmentedSubmittable<(members: Vec | (IdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; + resetMembers: AugmentedSubmittable<(members: Vec | (PolymeshPrimitivesIdentityId | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; /** * Change this group's limit for how many concurrent active members they may be. * * # Arguments * * `limit` - the number of active members there may be concurrently. **/ - setActiveMembersLimit: AugmentedSubmittable<(limit: MemberCount | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MemberCount]>; + setActiveMembersLimit: AugmentedSubmittable<(limit: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; /** * Swaps out one member `remove` for another member `add`. * @@ -3908,7 +4110,7 @@ declare module '@polkadot/api/types/submittable' { * * `remove` - IdentityId to be removed from the group. * * `add` - IdentityId to be added in place of `remove`. **/ - swapMember: AugmentedSubmittable<(remove: IdentityId | string | Uint8Array, add: IdentityId | string | Uint8Array) => SubmittableExtrinsic, [IdentityId, IdentityId]>; + swapMember: AugmentedSubmittable<(remove: PolymeshPrimitivesIdentityId | string | Uint8Array, add: PolymeshPrimitivesIdentityId | string | Uint8Array) => SubmittableExtrinsic, [PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; /** * Generic tx **/ @@ -3996,16 +4198,11 @@ declare module '@polkadot/api/types/submittable' { * - `call`: Call to be relayed on behalf of target * **/ - relayTx: AugmentedSubmittable<(target: AccountId | string | Uint8Array, signature: OffChainSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string | Uint8Array, call: UniqueCall | { nonce?: any; call?: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId, OffChainSignature, UniqueCall]>; + relayTx: AugmentedSubmittable<(target: AccountId32 | string | Uint8Array, signature: SpRuntimeMultiSignature | { Ed25519: any } | { Sr25519: any } | { Ecdsa: any } | string | Uint8Array, call: PalletUtilityUniqueCall | { nonce?: any; call?: any } | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, SpRuntimeMultiSignature, PalletUtilityUniqueCall]>; /** * Generic tx **/ [key: string]: SubmittableExtrinsicFunction; }; - } - - export interface SubmittableExtrinsics extends AugmentedSubmittables { - (extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic; - [key: string]: SubmittableModuleExtrinsics; - } -} + } // AugmentedSubmittables +} // declare module diff --git a/scripts/cli/src/interfaces/augment-api.ts b/scripts/cli/src/interfaces/augment-api.ts index c283f4fa44..921d2f824d 100644 --- a/scripts/cli/src/interfaces/augment-api.ts +++ b/scripts/cli/src/interfaces/augment-api.ts @@ -1,7 +1,6 @@ // Auto-generated via `yarn polkadot-types-from-chain`, do not edit /* eslint-disable */ -import '@polkadot/api/augment/rpc'; import './augment-api-consts'; import './augment-api-errors'; import './augment-api-events'; diff --git a/scripts/cli/src/interfaces/augment-types.ts b/scripts/cli/src/interfaces/augment-types.ts index f48e5a0457..f833d8426d 100644 --- a/scripts/cli/src/interfaces/augment-types.ts +++ b/scripts/cli/src/interfaces/augment-types.ts @@ -1,7 +1,8 @@ // Auto-generated via `yarn polkadot-types-from-defs`, do not edit /* eslint-disable */ -import type { BitVec, Bool, Bytes, Compact, Data, I128, I16, I256, I32, I64, I8, Json, Null, Option, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, Vec, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types'; +import type { Data, StorageKey } from '@polkadot/types'; +import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec'; import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets'; import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations'; import type { RawAuraPreDigest } from '@polkadot/types/interfaces/aura'; @@ -10,46 +11,46 @@ import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship'; import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe'; import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances'; import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy'; -import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, InitializationData } from '@polkadot/types/interfaces/bridges'; +import type { BridgeMessageId, BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges'; import type { BlockHash } from '@polkadot/types/interfaces/chain'; import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate'; -import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims'; +import type { StatementKind } from '@polkadot/types/interfaces/claims'; import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective'; import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; -import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; -import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpec, ContractEventSpec, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpec, ContractMessageSpec, ContractProject, ContractProjectContract, ContractProjectSource, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi'; +import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; +import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi'; import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan'; import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus'; import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy'; import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections'; import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; -import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth'; +import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumAddress, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth'; import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm'; -import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics'; +import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics'; import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset'; import type { ActiveGilt, ActiveGiltsTotal, ActiveIndex, GiltBid } from '@polkadot/types/interfaces/gilt'; import type { AuthorityIndex, AuthorityList, AuthoritySet, AuthoritySetChange, AuthoritySetChanges, AuthorityWeight, DelayKind, DelayKindBest, EncodedFinalityProofs, ForkTreePendingChange, ForkTreePendingChangeNode, GrandpaCommit, GrandpaEquivocation, GrandpaEquivocationProof, GrandpaEquivocationValue, GrandpaJustification, GrandpaPrecommit, GrandpaPrevote, GrandpaSignedPrecommit, JustificationNotification, KeyOwnerProof, NextAuthority, PendingChange, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; -import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement } from '@polkadot/types/interfaces/identity'; +import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityInfoTo198, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement, RegistrationTo198 } from '@polkadot/types/interfaces/identity'; import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline'; import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery'; -import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV12, DoubleMapTypeV13, DoubleMapTypeV9, ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV9, MapTypeLatest, MapTypeV10, MapTypeV11, MapTypeV12, MapTypeV13, MapTypeV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, NMapTypeLatest, NMapTypeV13, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; +import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV14, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV14, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV14, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV14, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableType, PortableTypeV14, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr'; import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; -import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TransientValidationData, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains'; +import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeLocation, DisputeResult, DisputeState, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, SlotRange10, Statement, SubId, SystemInherentData, TransientValidationData, UpgradeGoAhead, UpgradeRestriction, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersData10, WinnersDataTuple, WinnersDataTuple10, WinningData, WinningData10, WinningDataEntry } from '@polkadot/types/interfaces/parachains'; import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import type { Approvals } from '@polkadot/types/interfaces/poll'; import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy'; import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase'; import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; -import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; -import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo'; +import type { AccountId, AccountId20, AccountId32, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; +import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo'; import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session'; import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society'; -import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; -import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; +import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; +import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support'; import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; @@ -57,2273 +58,26 @@ import type { Multiplier } from '@polkadot/types/interfaces/txpayment'; import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques'; import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility'; import type { VestingInfo } from '@polkadot/types/interfaces/vesting'; -import type { AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, BodyId, BodyPart, BodyPartAtLeastProportion, BodyPartFraction, BodyPartMoreThanProportion, DoubleEncodedCall, InboundStatus, Junction, MultiAsset, MultiAssetAbstractFungible, MultiAssetAbstractNonFungible, MultiAssetConcreteFungible, MultiAssetConcreteNonFungible, MultiLocation, NetworkId, OutboundStatus, Outcome, PluralityJunction, QueueConfigData, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, Xcm, XcmAssetEffects, XcmError, XcmHrmpChannelAccepted, XcmHrmpChannelClosing, XcmHrmpNewChannelOpenRequest, XcmOrder, XcmOrderBuyExecution, XcmOrderDepositAsset, XcmOrderDepositReserveAsset, XcmOrderExchangeAsset, XcmOrderInitiateReserveWithdraw, XcmOrderInitiateTeleport, XcmOrderQueryHolding, XcmOrigin, XcmOriginKind, XcmQueryResponse, XcmRelayedFrom, XcmReserveAssetDeposit, XcmResponse, XcmTeleportAsset, XcmTransact, XcmTransferAsset, XcmTransferReserveAsset, XcmWithdrawAsset, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm'; -import type { AGId, AffirmationStatus, AgentGroup, AssetCompliance, AssetComplianceResult, AssetDidResult, AssetIdentifier, AssetName, AssetOwnershipRelation, AssetPermissions, AssetType, Authorization, AuthorizationData, AuthorizationNonce, AuthorizationType, BallotMeta, BallotTimeRange, BallotTitle, BallotVote, Beneficiary, BridgeTx, BridgeTxDetail, BridgeTxStatus, CACheckpoint, CADetails, CAId, CAKind, CalendarPeriod, CalendarUnit, CanTransferResult, CappedFee, CddId, CddStatus, CheckpointId, CheckpointSchedule, ChoiceTitle, Claim, Claim1stKey, Claim2ndKey, ClaimType, ClassicTickerImport, ClassicTickerRegistration, Committee, ComplianceRequirement, ComplianceRequirementResult, Condition, ConditionResult, ConditionType, CorporateAction, Counter, CountryCode, CustomAssetTypeId, DepositInfo, DidRecord, DidRecords, DidRecordsSuccess, DidStatus, DispatchableName, DispatchableNames, Distribution, Document, DocumentHash, DocumentId, DocumentName, DocumentType, DocumentUri, ErrorAt, EventCounts, EventDid, ExtVersion, ExtensionAttributes, ExtrinsicPermissions, FundingRoundName, Fundraiser, FundraiserName, FundraiserStatus, FundraiserTier, GranularCanTransferResult, HandledTxStatus, IdentityClaim, IdentityId, IdentityRole, InactiveMember, Instruction, InstructionStatus, InvestorUid, InvestorZKProofData, ItnRewardStatus, KeyIdentityData, Leg, LegStatus, LegacyPalletPermissions, LegacyPermissions, LocalCAId, MaybeBlock, Memo, MetaDescription, MetaUrl, MetaVersion, Motion, MotionInfoLink, MotionTitle, MovePortfolioItem, OffChainSignature, PalletName, PalletPermissions, Percentage, PermissionedIdentityPrefs, Permissions, Pip, PipDescription, PipId, PipsMetadata, PolymeshVotes, PortfolioId, PortfolioKind, PortfolioName, PortfolioNumber, PortfolioPermissions, PortfolioValidityResult, PosRatio, PreAuthorizedKeyInfo, PriceTier, ProposalData, ProposalDetails, ProposalState, ProposalStatus, Proposer, ProtocolOp, Receipt, ReceiptDetails, ReceiptMetadata, RecordDate, RecordDateSpec, RestrictionResult, RistrettoPoint, Scalar, ScheduleId, ScheduleSpec, Scope, ScopeClaimProof, ScopeId, SecondaryKey, SecondaryKeyWithAuth, SecurityToken, SettlementType, Signatory, SkippedCount, SlashingSwitch, SmartExtension, SmartExtensionName, SmartExtensionType, SnapshotId, SnapshotMetadata, SnapshotResult, SnapshottedPip, StoredSchedule, Subsidy, TargetIdAuthorization, TargetIdentities, TargetIdentity, TargetTreatment, Tax, TemplateDetails, TemplateMetadata, Ticker, TickerRegistration, TickerRegistrationConfig, TransferManager, TransferManagerResult, TrustedFor, TrustedIssuer, UniqueCall, Url, Venue, VenueDetails, VenueType, Version, VoteByPip, VoteCount, VoteCountProposalFound, VotingResult, ZkProofData } from 'polymesh-typegen/interfaces/default'; +import type { AssetInstance, AssetInstanceV0, AssetInstanceV1, AssetInstanceV2, BodyId, BodyPart, DoubleEncodedCall, Fungibility, FungibilityV0, FungibilityV1, FungibilityV2, InboundStatus, InstructionV2, InteriorMultiLocation, Junction, JunctionV0, JunctionV1, JunctionV2, Junctions, JunctionsV1, JunctionsV2, MultiAsset, MultiAssetFilter, MultiAssetFilterV1, MultiAssetFilterV2, MultiAssetV0, MultiAssetV1, MultiAssetV2, MultiAssets, MultiAssetsV1, MultiAssetsV2, MultiLocation, MultiLocationV0, MultiLocationV1, MultiLocationV2, NetworkId, OriginKindV0, OriginKindV1, OriginKindV2, OutboundStatus, Outcome, QueryId, QueryStatus, QueueConfigData, Response, ResponseV0, ResponseV1, ResponseV2, ResponseV2Error, ResponseV2Result, VersionMigrationStage, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse, VersionedXcm, WeightLimitV2, WildFungibility, WildFungibilityV0, WildFungibilityV1, WildFungibilityV2, WildMultiAsset, WildMultiAssetV1, WildMultiAssetV2, Xcm, XcmAssetId, XcmError, XcmErrorV0, XcmErrorV1, XcmErrorV2, XcmOrder, XcmOrderV0, XcmOrderV1, XcmOrderV2, XcmOrigin, XcmOriginKind, XcmV0, XcmV1, XcmV2, XcmVersion, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm'; +import type { AGId, AffirmationStatus, AgentGroup, AssetCompliance, AssetComplianceResult, AssetDidResult, AssetIdentifier, AssetMetadataDescription, AssetMetadataGlobalKey, AssetMetadataKey, AssetMetadataLocalKey, AssetMetadataLockStatus, AssetMetadataName, AssetMetadataSpec, AssetMetadataValue, AssetMetadataValueDetail, AssetName, AssetOwnershipRelation, AssetPermissions, AssetScope, AssetTransferCompliance, AssetType, Authorization, AuthorizationData, AuthorizationNonce, AuthorizationType, BallotMeta, BallotTimeRange, BallotTitle, BallotVote, Beneficiary, BridgeTx, BridgeTxDetail, BridgeTxStatus, CACheckpoint, CADetails, CAId, CAKind, CalendarPeriod, CalendarUnit, CanTransferResult, CappedFee, CddId, CddStatus, CheckpointId, CheckpointSchedule, ChoiceTitle, Claim, Claim1stKey, Claim2ndKey, ClaimType, ClassicTickerImport, ClassicTickerRegistration, Committee, ComplianceRequirement, ComplianceRequirementResult, CompressedRistretto, Condition, ConditionResult, ConditionType, CorporateAction, CountryCode, CustomAssetTypeId, DepositInfo, DidRecord, DidStatus, DispatchableName, DispatchableNames, Distribution, Document, DocumentHash, DocumentId, DocumentName, DocumentType, DocumentUri, ErrorAt, EventCounts, EventDid, ExtVersion, ExtensionAttributes, ExtrinsicPermissions, FundingRoundName, Fundraiser, FundraiserId, FundraiserName, FundraiserStatus, FundraiserTier, GranularCanTransferResult, HandledTxStatus, IdentityClaim, IdentityId, IdentityRole, InactiveMember, Instruction, InstructionId, InstructionStatus, InvestorUid, InvestorZKProofData, ItnRewardStatus, KeyIdentityData, KeyRecord, Leg, LegId, LegStatus, LocalCAId, MaybeBlock, Memo, MetaDescription, MetaUrl, MetaVersion, Motion, MotionInfoLink, MotionTitle, MovePortfolioItem, OffChainSignature, PalletName, PalletPermissions, Percentage, PermissionedIdentityPrefs, Permissions, Pip, PipDescription, PipId, PipsMetadata, PolymeshVotes, PortfolioId, PortfolioKind, PortfolioName, PortfolioNumber, PortfolioPermissions, PortfolioValidityResult, PosRatio, PreAuthorizedKeyInfo, PriceTier, ProposalData, ProposalDetails, ProposalState, ProposalStatus, Proposer, ProtocolOp, Receipt, ReceiptDetails, ReceiptMetadata, RecordDate, RecordDateSpec, RestrictionResult, RistrettoPoint, RpcDidRecords, RpcDidRecordsSuccess, Scalar, ScheduleId, ScheduleSpec, Scope, ScopeClaimProof, ScopeId, SecondaryKey, SecondaryKeyWithAuth, SecurityToken, SettlementType, Signatory, SkippedCount, SlashingSwitch, SmartExtension, SmartExtensionName, SmartExtensionType, SnapshotId, SnapshotMetadata, SnapshotResult, SnapshottedPip, Stat1stKey, Stat2ndKey, StatClaim, StatOpType, StatType, StatUpdate, StoredSchedule, Subsidy, TargetIdAuthorization, TargetIdentities, TargetIdentity, TargetTreatment, Tax, TemplateDetails, TemplateMetadata, Ticker, TickerRegistration, TickerRegistrationConfig, TransferCondition, TransferConditionExemptKey, TransferConditionResult, TrustedFor, TrustedIssuer, UniqueCall, Url, Venue, VenueDetails, VenueId, VenueType, Version, VoteByPip, VoteCount, VoteCountProposalFound, VotingResult, ZkProofData } from 'polymesh-typegen/interfaces/default'; declare module '@polkadot/types/types/registry' { export interface InterfaceTypes { - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Compact': Compact; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option
': Option
; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option
': Option
; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Option': Option; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec
': Vec
; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec
': Vec
; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; - 'Vec': Vec; AbridgedCandidateReceipt: AbridgedCandidateReceipt; AbridgedHostConfiguration: AbridgedHostConfiguration; AbridgedHrmpChannel: AbridgedHrmpChannel; AccountData: AccountData; AccountId: AccountId; - AccountId32Junction: AccountId32Junction; + AccountId20: AccountId20; + AccountId32: AccountId32; AccountIdOf: AccountIdOf; AccountIndex: AccountIndex; - AccountIndex64Junction: AccountIndex64Junction; AccountInfo: AccountInfo; AccountInfoWithDualRefCount: AccountInfoWithDualRefCount; AccountInfoWithProviders: AccountInfoWithProviders; AccountInfoWithRefCount: AccountInfoWithRefCount; AccountInfoWithRefCountU8: AccountInfoWithRefCountU8; AccountInfoWithTripleRefCount: AccountInfoWithTripleRefCount; - AccountKey20Junction: AccountKey20Junction; AccountStatus: AccountStatus; AccountValidity: AccountValidity; AccountVote: AccountVote; @@ -2357,11 +111,25 @@ declare module '@polkadot/types/types/registry' { AssetId: AssetId; AssetIdentifier: AssetIdentifier; AssetInstance: AssetInstance; + AssetInstanceV0: AssetInstanceV0; + AssetInstanceV1: AssetInstanceV1; + AssetInstanceV2: AssetInstanceV2; AssetMetadata: AssetMetadata; + AssetMetadataDescription: AssetMetadataDescription; + AssetMetadataGlobalKey: AssetMetadataGlobalKey; + AssetMetadataKey: AssetMetadataKey; + AssetMetadataLocalKey: AssetMetadataLocalKey; + AssetMetadataLockStatus: AssetMetadataLockStatus; + AssetMetadataName: AssetMetadataName; + AssetMetadataSpec: AssetMetadataSpec; + AssetMetadataValue: AssetMetadataValue; + AssetMetadataValueDetail: AssetMetadataValueDetail; AssetName: AssetName; AssetOptions: AssetOptions; AssetOwnershipRelation: AssetOwnershipRelation; AssetPermissions: AssetPermissions; + AssetScope: AssetScope; + AssetTransferCompliance: AssetTransferCompliance; AssetType: AssetType; AssignmentId: AssignmentId; AssignmentKind: AssignmentKind; @@ -2420,12 +188,12 @@ declare module '@polkadot/types/types/registry' { BlockTraceEvent: BlockTraceEvent; BlockTraceEventData: BlockTraceEventData; BlockTraceSpan: BlockTraceSpan; + BlockV0: BlockV0; + BlockV1: BlockV1; + BlockV2: BlockV2; BlockWeights: BlockWeights; BodyId: BodyId; BodyPart: BodyPart; - BodyPartAtLeastProportion: BodyPartAtLeastProportion; - BodyPartFraction: BodyPartFraction; - BodyPartMoreThanProportion: BodyPartMoreThanProportion; bool: bool; Bool: Bool; Bounty: Bounty; @@ -2437,6 +205,7 @@ declare module '@polkadot/types/types/registry' { BridgedBlockHash: BridgedBlockHash; BridgedBlockNumber: BridgedBlockNumber; BridgedHeader: BridgedHeader; + BridgeMessageId: BridgeMessageId; BridgeTx: BridgeTx; BridgeTxDetail: BridgeTxDetail; BridgeTxStatus: BridgeTxStatus; @@ -2452,6 +221,7 @@ declare module '@polkadot/types/types/registry' { CallHash: CallHash; CallHashOf: CallHashOf; CallIndex: CallIndex; + CallOrigin: CallOrigin; CandidateCommitments: CandidateCommitments; CandidateDescriptor: CandidateDescriptor; CandidateHash: CandidateHash; @@ -2462,6 +232,7 @@ declare module '@polkadot/types/types/registry' { CappedFee: CappedFee; CddId: CddId; CddStatus: CddStatus; + ChainId: ChainId; ChainProperties: ChainProperties; ChainType: ChainType; ChangesTrieConfiguration: ChangesTrieConfiguration; @@ -2480,6 +251,10 @@ declare module '@polkadot/types/types/registry' { ClassMetadata: ClassMetadata; CodecHash: CodecHash; CodeHash: CodeHash; + CodeSource: CodeSource; + CodeUploadRequest: CodeUploadRequest; + CodeUploadResult: CodeUploadResult; + CodeUploadResultValue: CodeUploadResultValue; CollatorId: CollatorId; CollatorSignature: CollatorSignature; CollectiveOrigin: CollectiveOrigin; @@ -2494,6 +269,7 @@ declare module '@polkadot/types/types/registry' { CompactScoreCompact: CompactScoreCompact; ComplianceRequirement: ComplianceRequirement; ComplianceRequirementResult: ComplianceRequirementResult; + CompressedRistretto: CompressedRistretto; Condition: Condition; ConditionResult: ConditionResult; ConditionType: ConditionType; @@ -2501,14 +277,27 @@ declare module '@polkadot/types/types/registry' { Consensus: Consensus; ConsensusEngineId: ConsensusEngineId; ConsumedWeight: ConsumedWeight; + ContractCallFlags: ContractCallFlags; ContractCallRequest: ContractCallRequest; - ContractConstructorSpec: ContractConstructorSpec; - ContractContractSpec: ContractContractSpec; + ContractConstructorSpecLatest: ContractConstructorSpecLatest; + ContractConstructorSpecV0: ContractConstructorSpecV0; + ContractConstructorSpecV1: ContractConstructorSpecV1; + ContractConstructorSpecV2: ContractConstructorSpecV2; + ContractConstructorSpecV3: ContractConstructorSpecV3; + ContractContractSpecV0: ContractContractSpecV0; + ContractContractSpecV1: ContractContractSpecV1; + ContractContractSpecV2: ContractContractSpecV2; + ContractContractSpecV3: ContractContractSpecV3; ContractCryptoHasher: ContractCryptoHasher; ContractDiscriminant: ContractDiscriminant; ContractDisplayName: ContractDisplayName; - ContractEventParamSpec: ContractEventParamSpec; - ContractEventSpec: ContractEventSpec; + ContractEventParamSpecLatest: ContractEventParamSpecLatest; + ContractEventParamSpecV0: ContractEventParamSpecV0; + ContractEventParamSpecV2: ContractEventParamSpecV2; + ContractEventSpecLatest: ContractEventSpecLatest; + ContractEventSpecV0: ContractEventSpecV0; + ContractEventSpecV1: ContractEventSpecV1; + ContractEventSpecV2: ContractEventSpecV2; ContractExecResult: ContractExecResult; ContractExecResultErr: ContractExecResultErr; ContractExecResultErrModule: ContractExecResultErrModule; @@ -2521,6 +310,8 @@ declare module '@polkadot/types/types/registry' { ContractExecResultTo267: ContractExecResultTo267; ContractInfo: ContractInfo; ContractInstantiateResult: ContractInstantiateResult; + ContractInstantiateResultTo267: ContractInstantiateResultTo267; + ContractInstantiateResultTo299: ContractInstantiateResultTo299; ContractLayoutArray: ContractLayoutArray; ContractLayoutCell: ContractLayoutCell; ContractLayoutEnum: ContractLayoutEnum; @@ -2529,11 +320,25 @@ declare module '@polkadot/types/types/registry' { ContractLayoutKey: ContractLayoutKey; ContractLayoutStruct: ContractLayoutStruct; ContractLayoutStructField: ContractLayoutStructField; - ContractMessageParamSpec: ContractMessageParamSpec; - ContractMessageSpec: ContractMessageSpec; + ContractMessageParamSpecLatest: ContractMessageParamSpecLatest; + ContractMessageParamSpecV0: ContractMessageParamSpecV0; + ContractMessageParamSpecV2: ContractMessageParamSpecV2; + ContractMessageSpecLatest: ContractMessageSpecLatest; + ContractMessageSpecV0: ContractMessageSpecV0; + ContractMessageSpecV1: ContractMessageSpecV1; + ContractMessageSpecV2: ContractMessageSpecV2; + ContractMetadata: ContractMetadata; + ContractMetadataLatest: ContractMetadataLatest; + ContractMetadataV0: ContractMetadataV0; + ContractMetadataV1: ContractMetadataV1; + ContractMetadataV2: ContractMetadataV2; + ContractMetadataV3: ContractMetadataV3; ContractProject: ContractProject; ContractProjectContract: ContractProjectContract; + ContractProjectInfo: ContractProjectInfo; ContractProjectSource: ContractProjectSource; + ContractProjectV0: ContractProjectV0; + ContractReturnFlags: ContractReturnFlags; ContractSelector: ContractSelector; ContractStorageKey: ContractStorageKey; ContractStorageLayout: ContractStorageLayout; @@ -2543,8 +348,8 @@ declare module '@polkadot/types/types/registry' { CoreIndex: CoreIndex; CoreOccupied: CoreOccupied; CorporateAction: CorporateAction; - Counter: Counter; CountryCode: CountryCode; + CrateVersion: CrateVersion; CreatedBlock: CreatedBlock; CustomAssetTypeId: CustomAssetTypeId; Data: Data; @@ -2554,13 +359,12 @@ declare module '@polkadot/types/types/registry' { DelayKindBest: DelayKindBest; Delegations: Delegations; DeletedContract: DeletedContract; + DeliveredMessages: DeliveredMessages; DepositBalance: DepositBalance; DepositBalanceOf: DepositBalanceOf; DepositInfo: DepositInfo; DestroyWitness: DestroyWitness; DidRecord: DidRecord; - DidRecords: DidRecords; - DidRecordsSuccess: DidRecordsSuccess; DidStatus: DidStatus; Digest: Digest; DigestItem: DigestItem; @@ -2571,6 +375,7 @@ declare module '@polkadot/types/types/registry' { DispatchError: DispatchError; DispatchErrorModule: DispatchErrorModule; DispatchErrorTo198: DispatchErrorTo198; + DispatchFeePayment: DispatchFeePayment; DispatchInfo: DispatchInfo; DispatchInfoTo190: DispatchInfoTo190; DispatchInfoTo244: DispatchInfoTo244; @@ -2578,6 +383,9 @@ declare module '@polkadot/types/types/registry' { DispatchResult: DispatchResult; DispatchResultOf: DispatchResultOf; DispatchResultTo198: DispatchResultTo198; + DisputeLocation: DisputeLocation; + DisputeResult: DisputeResult; + DisputeState: DisputeState; DisputeStatement: DisputeStatement; DisputeStatementSet: DisputeStatementSet; Distribution: Distribution; @@ -2588,16 +396,12 @@ declare module '@polkadot/types/types/registry' { DocumentType: DocumentType; DocumentUri: DocumentUri; DoubleEncodedCall: DoubleEncodedCall; - DoubleMapTypeLatest: DoubleMapTypeLatest; - DoubleMapTypeV10: DoubleMapTypeV10; - DoubleMapTypeV11: DoubleMapTypeV11; - DoubleMapTypeV12: DoubleMapTypeV12; - DoubleMapTypeV13: DoubleMapTypeV13; - DoubleMapTypeV9: DoubleMapTypeV9; DoubleVoteReport: DoubleVoteReport; DownwardMessage: DownwardMessage; EcdsaSignature: EcdsaSignature; Ed25519Signature: Ed25519Signature; + EIP1559Transaction: EIP1559Transaction; + EIP2930Transaction: EIP2930Transaction; ElectionCompute: ElectionCompute; ElectionPhase: ElectionPhase; ElectionResult: ElectionResult; @@ -2607,6 +411,7 @@ declare module '@polkadot/types/types/registry' { EncodedFinalityProofs: EncodedFinalityProofs; EncodedJustification: EncodedJustification; EpochAuthorship: EpochAuthorship; + Era: Era; EraIndex: EraIndex; EraPoints: EraPoints; EraRewardPoints: EraRewardPoints; @@ -2617,8 +422,12 @@ declare module '@polkadot/types/types/registry' { ErrorMetadataV11: ErrorMetadataV11; ErrorMetadataV12: ErrorMetadataV12; ErrorMetadataV13: ErrorMetadataV13; + ErrorMetadataV14: ErrorMetadataV14; ErrorMetadataV9: ErrorMetadataV9; + EthAccessList: EthAccessList; + EthAccessListItem: EthAccessListItem; EthAccount: EthAccount; + EthAddress: EthAddress; EthBlock: EthBlock; EthBloom: EthBloom; EthCallRequest: EthCallRequest; @@ -2660,6 +469,7 @@ declare module '@polkadot/types/types/registry' { EventMetadataV11: EventMetadataV11; EventMetadataV12: EventMetadataV12; EventMetadataV13: EventMetadataV13; + EventMetadataV14: EventMetadataV14; EventMetadataV9: EventMetadataV9; EventRecord: EventRecord; EvmAccount: EvmAccount; @@ -2681,6 +491,7 @@ declare module '@polkadot/types/types/registry' { ExtrinsicMetadataV11: ExtrinsicMetadataV11; ExtrinsicMetadataV12: ExtrinsicMetadataV12; ExtrinsicMetadataV13: ExtrinsicMetadataV13; + ExtrinsicMetadataV14: ExtrinsicMetadataV14; ExtrinsicOrHash: ExtrinsicOrHash; ExtrinsicPayload: ExtrinsicPayload; ExtrinsicPayloadUnknown: ExtrinsicPayloadUnknown; @@ -2709,20 +520,27 @@ declare module '@polkadot/types/types/registry' { FunctionArgumentMetadataV11: FunctionArgumentMetadataV11; FunctionArgumentMetadataV12: FunctionArgumentMetadataV12; FunctionArgumentMetadataV13: FunctionArgumentMetadataV13; + FunctionArgumentMetadataV14: FunctionArgumentMetadataV14; FunctionArgumentMetadataV9: FunctionArgumentMetadataV9; FunctionMetadataLatest: FunctionMetadataLatest; FunctionMetadataV10: FunctionMetadataV10; FunctionMetadataV11: FunctionMetadataV11; FunctionMetadataV12: FunctionMetadataV12; FunctionMetadataV13: FunctionMetadataV13; + FunctionMetadataV14: FunctionMetadataV14; FunctionMetadataV9: FunctionMetadataV9; FundIndex: FundIndex; FundInfo: FundInfo; FundingRoundName: FundingRoundName; Fundraiser: Fundraiser; + FundraiserId: FundraiserId; FundraiserName: FundraiserName; FundraiserStatus: FundraiserStatus; FundraiserTier: FundraiserTier; + Fungibility: Fungibility; + FungibilityV0: FungibilityV0; + FungibilityV1: FungibilityV1; + FungibilityV2: FungibilityV2; Gas: Gas; GiltBid: GiltBid; GlobalValidationData: GlobalValidationData; @@ -2778,6 +596,7 @@ declare module '@polkadot/types/types/registry' { IdentityId: IdentityId; IdentityInfo: IdentityInfo; IdentityInfoAdditional: IdentityInfoAdditional; + IdentityInfoTo198: IdentityInfoTo198; IdentityJudgement: IdentityJudgement; IdentityRole: IdentityRole; ImmortalEra: ImmortalEra; @@ -2786,6 +605,8 @@ declare module '@polkadot/types/types/registry' { InboundDownwardMessage: InboundDownwardMessage; InboundHrmpMessage: InboundHrmpMessage; InboundHrmpMessages: InboundHrmpMessages; + InboundLaneData: InboundLaneData; + InboundRelayer: InboundRelayer; InboundStatus: InboundStatus; IncludedBlocks: IncludedBlocks; InclusionFee: InclusionFee; @@ -2800,10 +621,17 @@ declare module '@polkadot/types/types/registry' { InstanceId: InstanceId; InstanceMetadata: InstanceMetadata; InstantiateRequest: InstantiateRequest; + InstantiateRequestV1: InstantiateRequestV1; + InstantiateRequestV2: InstantiateRequestV2; InstantiateReturnValue: InstantiateReturnValue; + InstantiateReturnValueOk: InstantiateReturnValueOk; + InstantiateReturnValueTo267: InstantiateReturnValueTo267; Instruction: Instruction; + InstructionId: InstructionId; InstructionStatus: InstructionStatus; + InstructionV2: InstructionV2; InstructionWeights: InstructionWeights; + InteriorMultiLocation: InteriorMultiLocation; InvalidDisputeStatementKind: InvalidDisputeStatementKind; InvalidTransaction: InvalidTransaction; InvestorUid: InvestorUid; @@ -2811,25 +639,33 @@ declare module '@polkadot/types/types/registry' { ItnRewardStatus: ItnRewardStatus; Json: Json; Junction: Junction; + Junctions: Junctions; + JunctionsV1: JunctionsV1; + JunctionsV2: JunctionsV2; + JunctionV0: JunctionV0; + JunctionV1: JunctionV1; + JunctionV2: JunctionV2; Justification: Justification; JustificationNotification: JustificationNotification; Justifications: Justifications; Key: Key; KeyIdentityData: KeyIdentityData; KeyOwnerProof: KeyOwnerProof; + KeyRecord: KeyRecord; Keys: Keys; KeyType: KeyType; KeyTypeId: KeyTypeId; KeyValue: KeyValue; KeyValueOption: KeyValueOption; Kind: Kind; + LaneId: LaneId; LastContribution: LastContribution; LastRuntimeUpgradeInfo: LastRuntimeUpgradeInfo; LeasePeriod: LeasePeriod; LeasePeriodOf: LeasePeriodOf; Leg: Leg; - LegacyPalletPermissions: LegacyPalletPermissions; - LegacyPermissions: LegacyPermissions; + LegacyTransaction: LegacyTransaction; + LegId: LegId; LegStatus: LegStatus; Limits: Limits; LimitsTo264: LimitsTo264; @@ -2839,21 +675,20 @@ declare module '@polkadot/types/types/registry' { LookupSource: LookupSource; LookupTarget: LookupTarget; LotteryConfig: LotteryConfig; - MapTypeLatest: MapTypeLatest; - MapTypeV10: MapTypeV10; - MapTypeV11: MapTypeV11; - MapTypeV12: MapTypeV12; - MapTypeV13: MapTypeV13; - MapTypeV9: MapTypeV9; MaybeBlock: MaybeBlock; MaybeRandomness: MaybeRandomness; MaybeVrf: MaybeVrf; MemberCount: MemberCount; MembershipProof: MembershipProof; Memo: Memo; + MessageData: MessageData; MessageId: MessageId; MessageIngestionType: MessageIngestionType; + MessageKey: MessageKey; + MessageNonce: MessageNonce; MessageQueueChain: MessageQueueChain; + MessagesDeliveryProofOf: MessagesDeliveryProofOf; + MessagesProofOf: MessagesProofOf; MessagingStateSnapshot: MessagingStateSnapshot; MessagingStateSnapshotEgressEntry: MessagingStateSnapshotEgressEntry; MetadataAll: MetadataAll; @@ -2862,20 +697,19 @@ declare module '@polkadot/types/types/registry' { MetadataV11: MetadataV11; MetadataV12: MetadataV12; MetadataV13: MetadataV13; + MetadataV14: MetadataV14; MetadataV9: MetadataV9; MetaDescription: MetaDescription; MetaUrl: MetaUrl; MetaVersion: MetaVersion; MmrLeafProof: MmrLeafProof; MmrRootHash: MmrRootHash; - ModuleConstantMetadataLatest: ModuleConstantMetadataLatest; ModuleConstantMetadataV10: ModuleConstantMetadataV10; ModuleConstantMetadataV11: ModuleConstantMetadataV11; ModuleConstantMetadataV12: ModuleConstantMetadataV12; ModuleConstantMetadataV13: ModuleConstantMetadataV13; ModuleConstantMetadataV9: ModuleConstantMetadataV9; ModuleId: ModuleId; - ModuleMetadataLatest: ModuleMetadataLatest; ModuleMetadataV10: ModuleMetadataV10; ModuleMetadataV11: ModuleMetadataV11; ModuleMetadataV12: ModuleMetadataV12; @@ -2891,12 +725,20 @@ declare module '@polkadot/types/types/registry' { MovePortfolioItem: MovePortfolioItem; MultiAddress: MultiAddress; MultiAsset: MultiAsset; - MultiAssetAbstractFungible: MultiAssetAbstractFungible; - MultiAssetAbstractNonFungible: MultiAssetAbstractNonFungible; - MultiAssetConcreteFungible: MultiAssetConcreteFungible; - MultiAssetConcreteNonFungible: MultiAssetConcreteNonFungible; + MultiAssetFilter: MultiAssetFilter; + MultiAssetFilterV1: MultiAssetFilterV1; + MultiAssetFilterV2: MultiAssetFilterV2; + MultiAssets: MultiAssets; + MultiAssetsV1: MultiAssetsV1; + MultiAssetsV2: MultiAssetsV2; + MultiAssetV0: MultiAssetV0; + MultiAssetV1: MultiAssetV1; + MultiAssetV2: MultiAssetV2; MultiDisputeStatementSet: MultiDisputeStatementSet; MultiLocation: MultiLocation; + MultiLocationV0: MultiLocationV0; + MultiLocationV1: MultiLocationV1; + MultiLocationV2: MultiLocationV2; Multiplier: Multiplier; Multisig: Multisig; MultiSignature: MultiSignature; @@ -2909,8 +751,6 @@ declare module '@polkadot/types/types/registry' { NextAuthority: NextAuthority; NextConfigDescriptor: NextConfigDescriptor; NextConfigDescriptorV1: NextConfigDescriptorV1; - NMapTypeLatest: NMapTypeLatest; - NMapTypeV13: NMapTypeV13; NodeRole: NodeRole; Nominations: Nominations; NominatorIndex: NominatorIndex; @@ -2931,19 +771,38 @@ declare module '@polkadot/types/types/registry' { OpenTipFinderTo225: OpenTipFinderTo225; OpenTipTip: OpenTipTip; OpenTipTo225: OpenTipTo225; + OperatingMode: OperatingMode; Origin: Origin; OriginCaller: OriginCaller; + OriginKindV0: OriginKindV0; + OriginKindV1: OriginKindV1; + OriginKindV2: OriginKindV2; OutboundHrmpMessage: OutboundHrmpMessage; + OutboundLaneData: OutboundLaneData; + OutboundMessageFee: OutboundMessageFee; + OutboundPayload: OutboundPayload; OutboundStatus: OutboundStatus; Outcome: Outcome; OverweightIndex: OverweightIndex; Owner: Owner; PageCounter: PageCounter; PageIndexData: PageIndexData; + PalletCallMetadataLatest: PalletCallMetadataLatest; + PalletCallMetadataV14: PalletCallMetadataV14; + PalletConstantMetadataLatest: PalletConstantMetadataLatest; + PalletConstantMetadataV14: PalletConstantMetadataV14; + PalletErrorMetadataLatest: PalletErrorMetadataLatest; + PalletErrorMetadataV14: PalletErrorMetadataV14; + PalletEventMetadataLatest: PalletEventMetadataLatest; + PalletEventMetadataV14: PalletEventMetadataV14; PalletId: PalletId; + PalletMetadataLatest: PalletMetadataLatest; + PalletMetadataV14: PalletMetadataV14; PalletName: PalletName; PalletPermissions: PalletPermissions; PalletsOrigin: PalletsOrigin; + PalletStorageMetadataLatest: PalletStorageMetadataLatest; + PalletStorageMetadataV14: PalletStorageMetadataV14; PalletVersion: PalletVersion; ParachainDispatchOrigin: ParachainDispatchOrigin; ParachainInherentData: ParachainInherentData; @@ -2953,6 +812,7 @@ declare module '@polkadot/types/types/registry' { ParaId: ParaId; ParaInfo: ParaInfo; ParaLifecycle: ParaLifecycle; + Parameter: Parameter; ParaPastCodeMeta: ParaPastCodeMeta; ParaScheduling: ParaScheduling; ParathreadClaim: ParathreadClaim; @@ -2992,9 +852,10 @@ declare module '@polkadot/types/types/registry' { PipDescription: PipDescription; PipId: PipId; PipsMetadata: PipsMetadata; - PluralityJunction: PluralityJunction; Points: Points; PolymeshVotes: PolymeshVotes; + PortableType: PortableType; + PortableTypeV14: PortableTypeV14; PortfolioId: PortfolioId; PortfolioKind: PortfolioKind; PortfolioName: PortfolioName; @@ -3026,6 +887,8 @@ declare module '@polkadot/types/types/registry' { ProxyDefinition: ProxyDefinition; ProxyState: ProxyState; ProxyType: ProxyType; + QueryId: QueryId; + QueryStatus: QueryStatus; QueueConfigData: QueueConfigData; QueuedParathread: QueuedParathread; Randomness: Randomness; @@ -3066,19 +929,28 @@ declare module '@polkadot/types/types/registry' { RegistrarInfo: RegistrarInfo; Registration: Registration; RegistrationJudgement: RegistrationJudgement; + RegistrationTo198: RegistrationTo198; RelayBlockNumber: RelayBlockNumber; RelayChainBlockNumber: RelayChainBlockNumber; RelayChainHash: RelayChainHash; + RelayerId: RelayerId; RelayHash: RelayHash; Releases: Releases; Remark: Remark; Renouncing: Renouncing; RentProjection: RentProjection; + ReplacementTimes: ReplacementTimes; ReportedRoundStates: ReportedRoundStates; Reporter: Reporter; ReportIdOf: ReportIdOf; ReserveData: ReserveData; ReserveIdentifier: ReserveIdentifier; + Response: Response; + ResponseV0: ResponseV0; + ResponseV1: ResponseV1; + ResponseV2: ResponseV2; + ResponseV2Error: ResponseV2Error; + ResponseV2Result: ResponseV2Result; RestrictionResult: RestrictionResult; Retriable: Retriable; RewardDestination: RewardDestination; @@ -3086,6 +958,8 @@ declare module '@polkadot/types/types/registry' { RistrettoPoint: RistrettoPoint; RoundSnapshot: RoundSnapshot; RoundState: RoundState; + RpcDidRecords: RpcDidRecords; + RpcDidRecordsSuccess: RpcDidRecordsSuccess; RpcMethods: RpcMethods; RuntimeDbWeight: RuntimeDbWeight; RuntimeDispatchInfo: RuntimeDispatchInfo; @@ -3136,6 +1010,37 @@ declare module '@polkadot/types/types/registry' { SetId: SetId; SetIndex: SetIndex; SettlementType: SettlementType; + Si0Field: Si0Field; + Si0LookupTypeId: Si0LookupTypeId; + Si0Path: Si0Path; + Si0Type: Si0Type; + Si0TypeDef: Si0TypeDef; + Si0TypeDefArray: Si0TypeDefArray; + Si0TypeDefBitSequence: Si0TypeDefBitSequence; + Si0TypeDefCompact: Si0TypeDefCompact; + Si0TypeDefComposite: Si0TypeDefComposite; + Si0TypeDefPhantom: Si0TypeDefPhantom; + Si0TypeDefPrimitive: Si0TypeDefPrimitive; + Si0TypeDefSequence: Si0TypeDefSequence; + Si0TypeDefTuple: Si0TypeDefTuple; + Si0TypeDefVariant: Si0TypeDefVariant; + Si0TypeParameter: Si0TypeParameter; + Si0Variant: Si0Variant; + Si1Field: Si1Field; + Si1LookupTypeId: Si1LookupTypeId; + Si1Path: Si1Path; + Si1Type: Si1Type; + Si1TypeDef: Si1TypeDef; + Si1TypeDefArray: Si1TypeDefArray; + Si1TypeDefBitSequence: Si1TypeDefBitSequence; + Si1TypeDefCompact: Si1TypeDefCompact; + Si1TypeDefComposite: Si1TypeDefComposite; + Si1TypeDefPrimitive: Si1TypeDefPrimitive; + Si1TypeDefSequence: Si1TypeDefSequence; + Si1TypeDefTuple: Si1TypeDefTuple; + Si1TypeDefVariant: Si1TypeDefVariant; + Si1TypeParameter: Si1TypeParameter; + Si1Variant: Si1Variant; SiField: SiField; Signatory: Signatory; Signature: Signature; @@ -3144,8 +1049,11 @@ declare module '@polkadot/types/types/registry' { SignedBlock: SignedBlock; SignedBlockWithJustification: SignedBlockWithJustification; SignedBlockWithJustifications: SignedBlockWithJustifications; + SignedExtensionMetadataLatest: SignedExtensionMetadataLatest; + SignedExtensionMetadataV14: SignedExtensionMetadataV14; SignedSubmission: SignedSubmission; SignedSubmissionOf: SignedSubmissionOf; + SignedSubmissionTo276: SignedSubmissionTo276; SignerPayload: SignerPayload; SigningContext: SigningContext; SiLookupTypeId: SiLookupTypeId; @@ -3153,11 +1061,14 @@ declare module '@polkadot/types/types/registry' { SiType: SiType; SiTypeDef: SiTypeDef; SiTypeDefArray: SiTypeDefArray; + SiTypeDefBitSequence: SiTypeDefBitSequence; + SiTypeDefCompact: SiTypeDefCompact; SiTypeDefComposite: SiTypeDefComposite; SiTypeDefPrimitive: SiTypeDefPrimitive; SiTypeDefSequence: SiTypeDefSequence; SiTypeDefTuple: SiTypeDefTuple; SiTypeDefVariant: SiTypeDefVariant; + SiTypeParameter: SiTypeParameter; SiVariant: SiVariant; SkippedCount: SkippedCount; SlashingSpans: SlashingSpans; @@ -3167,6 +1078,7 @@ declare module '@polkadot/types/types/registry' { Slot: Slot; SlotNumber: SlotNumber; SlotRange: SlotRange; + SlotRange10: SlotRange10; SmartExtension: SmartExtension; SmartExtensionName: SmartExtensionName; SmartExtensionType: SmartExtensionType; @@ -3181,41 +1093,52 @@ declare module '@polkadot/types/types/registry' { SolutionSupports: SolutionSupports; SpanIndex: SpanIndex; SpanRecord: SpanRecord; + SpecVersion: SpecVersion; Sr25519Signature: Sr25519Signature; StakingLedger: StakingLedger; StakingLedgerTo223: StakingLedgerTo223; StakingLedgerTo240: StakingLedgerTo240; + Stat1stKey: Stat1stKey; + Stat2ndKey: Stat2ndKey; + StatClaim: StatClaim; Statement: Statement; StatementKind: StatementKind; + StatOpType: StatOpType; + StatType: StatType; + StatUpdate: StatUpdate; StorageChangeSet: StorageChangeSet; StorageData: StorageData; + StorageDeposit: StorageDeposit; StorageEntryMetadataLatest: StorageEntryMetadataLatest; StorageEntryMetadataV10: StorageEntryMetadataV10; StorageEntryMetadataV11: StorageEntryMetadataV11; StorageEntryMetadataV12: StorageEntryMetadataV12; StorageEntryMetadataV13: StorageEntryMetadataV13; + StorageEntryMetadataV14: StorageEntryMetadataV14; StorageEntryMetadataV9: StorageEntryMetadataV9; StorageEntryModifierLatest: StorageEntryModifierLatest; StorageEntryModifierV10: StorageEntryModifierV10; StorageEntryModifierV11: StorageEntryModifierV11; StorageEntryModifierV12: StorageEntryModifierV12; StorageEntryModifierV13: StorageEntryModifierV13; + StorageEntryModifierV14: StorageEntryModifierV14; StorageEntryModifierV9: StorageEntryModifierV9; StorageEntryTypeLatest: StorageEntryTypeLatest; StorageEntryTypeV10: StorageEntryTypeV10; StorageEntryTypeV11: StorageEntryTypeV11; StorageEntryTypeV12: StorageEntryTypeV12; StorageEntryTypeV13: StorageEntryTypeV13; + StorageEntryTypeV14: StorageEntryTypeV14; StorageEntryTypeV9: StorageEntryTypeV9; StorageHasher: StorageHasher; StorageHasherV10: StorageHasherV10; StorageHasherV11: StorageHasherV11; StorageHasherV12: StorageHasherV12; StorageHasherV13: StorageHasherV13; + StorageHasherV14: StorageHasherV14; StorageHasherV9: StorageHasherV9; StorageKey: StorageKey; StorageKind: StorageKind; - StorageMetadataLatest: StorageMetadataLatest; StorageMetadataV10: StorageMetadataV10; StorageMetadataV11: StorageMetadataV11; StorageMetadataV12: StorageMetadataV12; @@ -3256,9 +1179,13 @@ declare module '@polkadot/types/types/registry' { TransactionInfo: TransactionInfo; TransactionPriority: TransactionPriority; TransactionStorageProof: TransactionStorageProof; + TransactionV0: TransactionV0; + TransactionV1: TransactionV1; + TransactionV2: TransactionV2; TransactionValidityError: TransactionValidityError; - TransferManager: TransferManager; - TransferManagerResult: TransferManagerResult; + TransferCondition: TransferCondition; + TransferConditionExemptKey: TransferConditionExemptKey; + TransferConditionResult: TransferConditionResult; TransientValidationData: TransientValidationData; TreasuryProposal: TreasuryProposal; TrieId: TrieId; @@ -3285,6 +1212,10 @@ declare module '@polkadot/types/types/registry' { UniqueCall: UniqueCall; UnknownTransaction: UnknownTransaction; UnlockChunk: UnlockChunk; + UnrewardedRelayer: UnrewardedRelayer; + UnrewardedRelayersState: UnrewardedRelayersState; + UpgradeGoAhead: UpgradeGoAhead; + UpgradeRestriction: UpgradeRestriction; UpwardMessage: UpwardMessage; Url: Url; usize: usize; @@ -3311,11 +1242,15 @@ declare module '@polkadot/types/types/registry' { VecInboundHrmpMessage: VecInboundHrmpMessage; Venue: Venue; VenueDetails: VenueDetails; + VenueId: VenueId; VenueType: VenueType; Version: Version; VersionedMultiAsset: VersionedMultiAsset; + VersionedMultiAssets: VersionedMultiAssets; VersionedMultiLocation: VersionedMultiLocation; + VersionedResponse: VersionedResponse; VersionedXcm: VersionedXcm; + VersionMigrationStage: VersionMigrationStage; VestingInfo: VestingInfo; VestingSchedule: VestingSchedule; Vote: Vote; @@ -3339,40 +1274,42 @@ declare module '@polkadot/types/types/registry' { VrfOutput: VrfOutput; VrfProof: VrfProof; Weight: Weight; + WeightLimitV2: WeightLimitV2; WeightMultiplier: WeightMultiplier; WeightPerClass: WeightPerClass; WeightToFeeCoefficient: WeightToFeeCoefficient; + WildFungibility: WildFungibility; + WildFungibilityV0: WildFungibilityV0; + WildFungibilityV1: WildFungibilityV1; + WildFungibilityV2: WildFungibilityV2; + WildMultiAsset: WildMultiAsset; + WildMultiAssetV1: WildMultiAssetV1; + WildMultiAssetV2: WildMultiAssetV2; WinnersData: WinnersData; + WinnersData10: WinnersData10; WinnersDataTuple: WinnersDataTuple; + WinnersDataTuple10: WinnersDataTuple10; WinningData: WinningData; + WinningData10: WinningData10; WinningDataEntry: WinningDataEntry; WithdrawReasons: WithdrawReasons; Xcm: Xcm; - XcmAssetEffects: XcmAssetEffects; + XcmAssetId: XcmAssetId; XcmError: XcmError; - XcmHrmpChannelAccepted: XcmHrmpChannelAccepted; - XcmHrmpChannelClosing: XcmHrmpChannelClosing; - XcmHrmpNewChannelOpenRequest: XcmHrmpNewChannelOpenRequest; + XcmErrorV0: XcmErrorV0; + XcmErrorV1: XcmErrorV1; + XcmErrorV2: XcmErrorV2; XcmOrder: XcmOrder; - XcmOrderBuyExecution: XcmOrderBuyExecution; - XcmOrderDepositAsset: XcmOrderDepositAsset; - XcmOrderDepositReserveAsset: XcmOrderDepositReserveAsset; - XcmOrderExchangeAsset: XcmOrderExchangeAsset; - XcmOrderInitiateReserveWithdraw: XcmOrderInitiateReserveWithdraw; - XcmOrderInitiateTeleport: XcmOrderInitiateTeleport; - XcmOrderQueryHolding: XcmOrderQueryHolding; + XcmOrderV0: XcmOrderV0; + XcmOrderV1: XcmOrderV1; + XcmOrderV2: XcmOrderV2; XcmOrigin: XcmOrigin; XcmOriginKind: XcmOriginKind; XcmpMessageFormat: XcmpMessageFormat; - XcmQueryResponse: XcmQueryResponse; - XcmRelayedFrom: XcmRelayedFrom; - XcmReserveAssetDeposit: XcmReserveAssetDeposit; - XcmResponse: XcmResponse; - XcmTeleportAsset: XcmTeleportAsset; - XcmTransact: XcmTransact; - XcmTransferAsset: XcmTransferAsset; - XcmTransferReserveAsset: XcmTransferReserveAsset; - XcmWithdrawAsset: XcmWithdrawAsset; + XcmV0: XcmV0; + XcmV1: XcmV1; + XcmV2: XcmV2; + XcmVersion: XcmVersion; ZkProofData: ZkProofData; - } -} + } // InterfaceTypes +} // declare module diff --git a/scripts/cli/src/interfaces/default/types.ts b/scripts/cli/src/interfaces/default/types.ts index 6c75febced..b1ee528b6f 100644 --- a/scripts/cli/src/interfaces/default/types.ts +++ b/scripts/cli/src/interfaces/default/types.ts @@ -1,10 +1,10 @@ // Auto-generated via `yarn polkadot-types-from-defs`, do not edit /* eslint-disable */ -import type { Bytes, Enum, Option, Struct, Text, U8aFixed, Vec, bool, u16, u32, u64, u8 } from '@polkadot/types'; -import type { ITuple } from '@polkadot/types/types'; -import type { Signature } from '@polkadot/types/interfaces/extrinsics'; -import type { AccountId, Balance, BlockNumber, Call, H256, H512, Hash, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime'; +import type { Bytes, Enum, Option, Struct, Text, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; +import type { ITuple } from '@polkadot/types-codec/types'; +import type { MultiSignature, Signature } from '@polkadot/types/interfaces/extrinsics'; +import type { AccountId, Balance, BlockNumber, Call, H256, H512, Hash, MultiAddress, Perbill, Permill, Weight } from '@polkadot/types/interfaces/runtime'; import type { AccountInfoWithDualRefCount, DispatchError } from '@polkadot/types/interfaces/system'; /** @name AccountInfo */ @@ -18,6 +18,7 @@ export interface AffirmationStatus extends Enum { readonly isUnknown: boolean; readonly isPending: boolean; readonly isAffirmed: boolean; + readonly type: 'Unknown' | 'Pending' | 'Affirmed'; } /** @name AgentGroup */ @@ -26,8 +27,9 @@ export interface AgentGroup extends Enum { readonly isCustom: boolean; readonly asCustom: AGId; readonly isExceptMeta: boolean; - readonly isPolymeshV1Caa: boolean; - readonly isPolymeshV1Pia: boolean; + readonly isPolymeshV1CAA: boolean; + readonly isPolymeshV1PIA: boolean; + readonly type: 'Full' | 'Custom' | 'ExceptMeta' | 'PolymeshV1CAA' | 'PolymeshV1PIA'; } /** @name AGId */ @@ -52,6 +54,7 @@ export interface AssetDidResult extends Enum { readonly asOk: IdentityId; readonly isErr: boolean; readonly asErr: Bytes; + readonly type: 'Ok' | 'Err'; } /** @name AssetIdentifier */ @@ -64,6 +67,53 @@ export interface AssetIdentifier extends Enum { readonly asIsin: U8aFixed; readonly isLei: boolean; readonly asLei: U8aFixed; + readonly type: 'Cusip' | 'Cins' | 'Isin' | 'Lei'; +} + +/** @name AssetMetadataDescription */ +export interface AssetMetadataDescription extends Text {} + +/** @name AssetMetadataGlobalKey */ +export interface AssetMetadataGlobalKey extends u64 {} + +/** @name AssetMetadataKey */ +export interface AssetMetadataKey extends Enum { + readonly isGlobal: boolean; + readonly asGlobal: u64; + readonly isLocal: boolean; + readonly asLocal: u64; + readonly type: 'Global' | 'Local'; +} + +/** @name AssetMetadataLocalKey */ +export interface AssetMetadataLocalKey extends u64 {} + +/** @name AssetMetadataLockStatus */ +export interface AssetMetadataLockStatus extends Enum { + readonly isUnlocked: boolean; + readonly isLocked: boolean; + readonly isLockedUntil: boolean; + readonly asLockedUntil: Moment; + readonly type: 'Unlocked' | 'Locked' | 'LockedUntil'; +} + +/** @name AssetMetadataName */ +export interface AssetMetadataName extends Text {} + +/** @name AssetMetadataSpec */ +export interface AssetMetadataSpec extends Struct { + readonly url: Option; + readonly description: Option; + readonly type_def: Option; +} + +/** @name AssetMetadataValue */ +export interface AssetMetadataValue extends Bytes {} + +/** @name AssetMetadataValueDetail */ +export interface AssetMetadataValueDetail extends Struct { + readonly expire: Option; + readonly lock_status: AssetMetadataLockStatus; } /** @name AssetName */ @@ -74,6 +124,7 @@ export interface AssetOwnershipRelation extends Enum { readonly isNotOwned: boolean; readonly isTickerOwned: boolean; readonly isAssetOwned: boolean; + readonly type: 'NotOwned' | 'TickerOwned' | 'AssetOwned'; } /** @name AssetPermissions */ @@ -83,6 +134,20 @@ export interface AssetPermissions extends Enum { readonly asThese: Vec; readonly isExcept: boolean; readonly asExcept: Vec; + readonly type: 'Whole' | 'These' | 'Except'; +} + +/** @name AssetScope */ +export interface AssetScope extends Enum { + readonly isTicker: boolean; + readonly asTicker: Ticker; + readonly type: 'Ticker'; +} + +/** @name AssetTransferCompliance */ +export interface AssetTransferCompliance extends Struct { + readonly paused: bool; + readonly requirements: Vec; } /** @name AssetType */ @@ -99,6 +164,7 @@ export interface AssetType extends Enum { readonly isCustom: boolean; readonly asCustom: CustomAssetTypeId; readonly isStableCoin: boolean; + readonly type: 'EquityCommon' | 'EquityPreferred' | 'Commodity' | 'FixedIncome' | 'Reit' | 'Fund' | 'RevenueShareAgreement' | 'StructuredProduct' | 'Derivative' | 'Custom' | 'StableCoin'; } /** @name Authorization */ @@ -128,6 +194,9 @@ export interface AuthorizationData extends Enum { readonly asBecomeAgent: ITuple<[Ticker, AgentGroup]>; readonly isAddRelayerPayingKey: boolean; readonly asAddRelayerPayingKey: ITuple<[AccountId, AccountId, Balance]>; + readonly isRotatePrimaryKeyToSecondary: boolean; + readonly asRotatePrimaryKeyToSecondary: Permissions; + readonly type: 'AttestPrimaryKeyRotation' | 'RotatePrimaryKey' | 'TransferTicker' | 'AddMultiSigSigner' | 'TransferAssetOwnership' | 'JoinIdentity' | 'PortfolioCustody' | 'BecomeAgent' | 'AddRelayerPayingKey' | 'RotatePrimaryKeyToSecondary'; } /** @name AuthorizationNonce */ @@ -144,6 +213,8 @@ export interface AuthorizationType extends Enum { readonly isPortfolioCustody: boolean; readonly isBecomeAgent: boolean; readonly isAddRelayerPayingKey: boolean; + readonly isRotatePrimaryKeyToSecondary: boolean; + readonly type: 'AttestPrimaryKeyRotation' | 'RotatePrimaryKey' | 'TransferTicker' | 'AddMultiSigSigner' | 'TransferAssetOwnership' | 'JoinIdentity' | 'PortfolioCustody' | 'BecomeAgent' | 'AddRelayerPayingKey' | 'RotatePrimaryKeyToSecondary'; } /** @name BallotMeta */ @@ -197,6 +268,7 @@ export interface BridgeTxStatus extends Enum { readonly isFrozen: boolean; readonly isTimelocked: boolean; readonly isHandled: boolean; + readonly type: 'Absent' | 'Pending' | 'Frozen' | 'Timelocked' | 'Handled'; } /** @name CACheckpoint */ @@ -205,6 +277,7 @@ export interface CACheckpoint extends Enum { readonly asScheduled: ITuple<[ScheduleId, u64]>; readonly isExisting: boolean; readonly asExisting: CheckpointId; + readonly type: 'Scheduled' | 'Existing'; } /** @name CADetails */ @@ -223,6 +296,7 @@ export interface CAKind extends Enum { readonly isIssuerNotice: boolean; readonly isReorganization: boolean; readonly isOther: boolean; + readonly type: 'PredictableBenefit' | 'UnpredictableBenefit' | 'IssuerNotice' | 'Reorganization' | 'Other'; } /** @name CalendarPeriod */ @@ -240,6 +314,7 @@ export interface CalendarUnit extends Enum { readonly isWeek: boolean; readonly isMonth: boolean; readonly isYear: boolean; + readonly type: 'Second' | 'Minute' | 'Hour' | 'Day' | 'Week' | 'Month' | 'Year'; } /** @name CanTransferResult */ @@ -248,6 +323,7 @@ export interface CanTransferResult extends Enum { readonly asOk: u8; readonly isErr: boolean; readonly asErr: Bytes; + readonly type: 'Ok' | 'Err'; } /** @name CappedFee */ @@ -262,6 +338,7 @@ export interface CddStatus extends Enum { readonly asOk: IdentityId; readonly isErr: boolean; readonly asErr: Bytes; + readonly type: 'Ok' | 'Err'; } /** @name CheckpointId */ @@ -301,6 +378,7 @@ export interface Claim extends Enum { readonly isNoData: boolean; readonly isInvestorUniquenessV2: boolean; readonly asInvestorUniquenessV2: CddId; + readonly type: 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoData' | 'InvestorUniquenessV2'; } /** @name Claim1stKey */ @@ -329,6 +407,7 @@ export interface ClaimType extends Enum { readonly isInvestorUniqueness: boolean; readonly isNoData: boolean; readonly isInvestorUniquenessV2: boolean; + readonly type: 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoData' | 'InvestorUniquenessV2'; } /** @name ClassicTickerImport */ @@ -349,6 +428,7 @@ export interface ClassicTickerRegistration extends Struct { export interface Committee extends Enum { readonly isTechnical: boolean; readonly isUpgrade: boolean; + readonly type: 'Technical' | 'Upgrade'; } /** @name ComplianceRequirement */ @@ -366,6 +446,9 @@ export interface ComplianceRequirementResult extends Struct { readonly result: bool; } +/** @name CompressedRistretto */ +export interface CompressedRistretto extends U8aFixed {} + /** @name Condition */ export interface Condition extends Struct { readonly condition_type: ConditionType; @@ -390,6 +473,7 @@ export interface ConditionType extends Enum { readonly asIsNoneOf: Vec; readonly isIsIdentity: boolean; readonly asIsIdentity: TargetIdentity; + readonly type: 'IsPresent' | 'IsAbsent' | 'IsAnyOf' | 'IsNoneOf' | 'IsIdentity'; } /** @name CorporateAction */ @@ -402,9 +486,6 @@ export interface CorporateAction extends Struct { readonly withholding_tax: Vec>; } -/** @name Counter */ -export interface Counter extends u64 {} - /** @name CountryCode */ export interface CountryCode extends Enum { readonly isAf: boolean; @@ -657,6 +738,7 @@ export interface CountryCode extends Enum { readonly isBq: boolean; readonly isCw: boolean; readonly isSx: boolean; + readonly type: 'Af' | 'Ax' | 'Al' | 'Dz' | 'As' | 'Ad' | 'Ao' | 'Ai' | 'Aq' | 'Ag' | 'Ar' | 'Am' | 'Aw' | 'Au' | 'At' | 'Az' | 'Bs' | 'Bh' | 'Bd' | 'Bb' | 'By' | 'Be' | 'Bz' | 'Bj' | 'Bm' | 'Bt' | 'Bo' | 'Ba' | 'Bw' | 'Bv' | 'Br' | 'Vg' | 'Io' | 'Bn' | 'Bg' | 'Bf' | 'Bi' | 'Kh' | 'Cm' | 'Ca' | 'Cv' | 'Ky' | 'Cf' | 'Td' | 'Cl' | 'Cn' | 'Hk' | 'Mo' | 'Cx' | 'Cc' | 'Co' | 'Km' | 'Cg' | 'Cd' | 'Ck' | 'Cr' | 'Ci' | 'Hr' | 'Cu' | 'Cy' | 'Cz' | 'Dk' | 'Dj' | 'Dm' | 'Do' | 'Ec' | 'Eg' | 'Sv' | 'Gq' | 'Er' | 'Ee' | 'Et' | 'Fk' | 'Fo' | 'Fj' | 'Fi' | 'Fr' | 'Gf' | 'Pf' | 'Tf' | 'Ga' | 'Gm' | 'Ge' | 'De' | 'Gh' | 'Gi' | 'Gr' | 'Gl' | 'Gd' | 'Gp' | 'Gu' | 'Gt' | 'Gg' | 'Gn' | 'Gw' | 'Gy' | 'Ht' | 'Hm' | 'Va' | 'Hn' | 'Hu' | 'Is' | 'In' | 'Id' | 'Ir' | 'Iq' | 'Ie' | 'Im' | 'Il' | 'It' | 'Jm' | 'Jp' | 'Je' | 'Jo' | 'Kz' | 'Ke' | 'Ki' | 'Kp' | 'Kr' | 'Kw' | 'Kg' | 'La' | 'Lv' | 'Lb' | 'Ls' | 'Lr' | 'Ly' | 'Li' | 'Lt' | 'Lu' | 'Mk' | 'Mg' | 'Mw' | 'My' | 'Mv' | 'Ml' | 'Mt' | 'Mh' | 'Mq' | 'Mr' | 'Mu' | 'Yt' | 'Mx' | 'Fm' | 'Md' | 'Mc' | 'Mn' | 'Me' | 'Ms' | 'Ma' | 'Mz' | 'Mm' | 'Na' | 'Nr' | 'Np' | 'Nl' | 'An' | 'Nc' | 'Nz' | 'Ni' | 'Ne' | 'Ng' | 'Nu' | 'Nf' | 'Mp' | 'No' | 'Om' | 'Pk' | 'Pw' | 'Ps' | 'Pa' | 'Pg' | 'Py' | 'Pe' | 'Ph' | 'Pn' | 'Pl' | 'Pt' | 'Pr' | 'Qa' | 'Re' | 'Ro' | 'Ru' | 'Rw' | 'Bl' | 'Sh' | 'Kn' | 'Lc' | 'Mf' | 'Pm' | 'Vc' | 'Ws' | 'Sm' | 'St' | 'Sa' | 'Sn' | 'Rs' | 'Sc' | 'Sl' | 'Sg' | 'Sk' | 'Si' | 'Sb' | 'So' | 'Za' | 'Gs' | 'Ss' | 'Es' | 'Lk' | 'Sd' | 'Sr' | 'Sj' | 'Sz' | 'Se' | 'Ch' | 'Sy' | 'Tw' | 'Tj' | 'Tz' | 'Th' | 'Tl' | 'Tg' | 'Tk' | 'To' | 'Tt' | 'Tn' | 'Tr' | 'Tm' | 'Tc' | 'Tv' | 'Ug' | 'Ua' | 'Ae' | 'Gb' | 'Us' | 'Um' | 'Uy' | 'Uz' | 'Vu' | 'Ve' | 'Vn' | 'Vi' | 'Wf' | 'Eh' | 'Ye' | 'Zm' | 'Zw' | 'Bq' | 'Cw' | 'Sx'; } /** @name CustomAssetTypeId */ @@ -670,22 +752,7 @@ export interface DepositInfo extends Struct { /** @name DidRecord */ export interface DidRecord extends Struct { - readonly primary_key: AccountId; - readonly secondary_keys: Vec; -} - -/** @name DidRecords */ -export interface DidRecords extends Enum { - readonly isSuccess: boolean; - readonly asSuccess: DidRecordsSuccess; - readonly isIdNotFound: boolean; - readonly asIdNotFound: Bytes; -} - -/** @name DidRecordsSuccess */ -export interface DidRecordsSuccess extends Struct { - readonly primary_key: AccountId; - readonly secondary_keys: Vec; + readonly primary_key: Option; } /** @name DidStatus */ @@ -693,6 +760,7 @@ export interface DidStatus extends Enum { readonly isUnknown: boolean; readonly isExists: boolean; readonly isCddVerified: boolean; + readonly type: 'Unknown' | 'Exists' | 'CddVerified'; } /** @name DispatchableName */ @@ -705,6 +773,7 @@ export interface DispatchableNames extends Enum { readonly asThese: Vec; readonly isExcept: boolean; readonly asExcept: Vec; + readonly type: 'Whole' | 'These' | 'Except'; } /** @name Distribution */ @@ -747,6 +816,7 @@ export interface DocumentHash extends Enum { readonly asH160: U8aFixed; readonly isH128: boolean; readonly asH128: U8aFixed; + readonly type: 'None' | 'H512' | 'H384' | 'H320' | 'H256' | 'H224' | 'H192' | 'H160' | 'H128'; } /** @name DocumentId */ @@ -789,6 +859,7 @@ export interface ExtrinsicPermissions extends Enum { readonly asThese: Vec; readonly isExcept: boolean; readonly asExcept: Vec; + readonly type: 'Whole' | 'These' | 'Except'; } /** @name ExtVersion */ @@ -805,13 +876,16 @@ export interface Fundraiser extends Struct { readonly raising_portfolio: PortfolioId; readonly raising_asset: Ticker; readonly tiers: Vec; - readonly venue_id: u64; + readonly venue_id: VenueId; readonly start: Moment; readonly end: Option; readonly status: FundraiserStatus; readonly minimum_investment: Balance; } +/** @name FundraiserId */ +export interface FundraiserId extends u64 {} + /** @name FundraiserName */ export interface FundraiserName extends Text {} @@ -821,6 +895,7 @@ export interface FundraiserStatus extends Enum { readonly isFrozen: boolean; readonly isClosed: boolean; readonly isClosedEarly: boolean; + readonly type: 'Live' | 'Frozen' | 'Closed' | 'ClosedEarly'; } /** @name FundraiserTier */ @@ -842,7 +917,7 @@ export interface GranularCanTransferResult extends Struct { readonly sender_insufficient_balance: bool; readonly portfolio_validity_result: PortfolioValidityResult; readonly asset_frozen: bool; - readonly statistics_result: Vec; + readonly transfer_condition_result: Vec; readonly compliance_result: AssetComplianceResult; readonly result: bool; } @@ -852,6 +927,7 @@ export interface HandledTxStatus extends Enum { readonly isSuccess: boolean; readonly isError: boolean; readonly asError: Text; + readonly type: 'Success' | 'Error'; } /** @name IdentityClaim */ @@ -878,6 +954,7 @@ export interface IdentityRole extends Enum { readonly isCddamlClaimIssuer: boolean; readonly isAccreditedInvestorClaimIssuer: boolean; readonly isVerifiedIdentityClaimIssuer: boolean; + readonly type: 'Issuer' | 'SimpleTokenIssuer' | 'Validator' | 'ClaimIssuer' | 'Investor' | 'NodeRunner' | 'Pm' | 'CddamlClaimIssuer' | 'AccreditedInvestorClaimIssuer' | 'VerifiedIdentityClaimIssuer'; } /** @name InactiveMember */ @@ -889,8 +966,8 @@ export interface InactiveMember extends Struct { /** @name Instruction */ export interface Instruction extends Struct { - readonly instruction_id: u64; - readonly venue_id: u64; + readonly instruction_id: InstructionId; + readonly venue_id: VenueId; readonly status: InstructionStatus; readonly settlement_type: SettlementType; readonly created_at: Option; @@ -898,24 +975,32 @@ export interface Instruction extends Struct { readonly value_date: Option; } +/** @name InstructionId */ +export interface InstructionId extends u64 {} + /** @name InstructionStatus */ export interface InstructionStatus extends Enum { readonly isUnknown: boolean; readonly isPending: boolean; readonly isFailed: boolean; + readonly type: 'Unknown' | 'Pending' | 'Failed'; } /** @name InvestorUid */ export interface InvestorUid extends U8aFixed {} /** @name InvestorZKProofData */ -export interface InvestorZKProofData extends Signature {} +export interface InvestorZKProofData extends Struct { + readonly r: CompressedRistretto; + readonly s: Scalar; +} /** @name ItnRewardStatus */ export interface ItnRewardStatus extends Enum { readonly isUnclaimed: boolean; readonly asUnclaimed: Balance; readonly isClaimed: boolean; + readonly type: 'Unclaimed' | 'Claimed'; } /** @name KeyIdentityData */ @@ -924,6 +1009,17 @@ export interface KeyIdentityData extends Struct { readonly permissions: Option; } +/** @name KeyRecord */ +export interface KeyRecord extends Enum { + readonly isPrimaryKey: boolean; + readonly asPrimaryKey: IdentityId; + readonly isSecondaryKey: boolean; + readonly asSecondaryKey: ITuple<[IdentityId, Permissions]>; + readonly isMultiSigSignerKey: boolean; + readonly asMultiSigSignerKey: AccountId; + readonly type: 'PrimaryKey' | 'SecondaryKey' | 'MultiSigSignerKey'; +} + /** @name Leg */ export interface Leg extends Struct { readonly from: PortfolioId; @@ -932,19 +1028,8 @@ export interface Leg extends Struct { readonly amount: Balance; } -/** @name LegacyPalletPermissions */ -export interface LegacyPalletPermissions extends Struct { - readonly pallet_name: PalletName; - readonly total: bool; - readonly dispatchable_names: Vec; -} - -/** @name LegacyPermissions */ -export interface LegacyPermissions extends Struct { - readonly asset: Option>; - readonly extrinsic: Option>; - readonly portfolio: Option>; -} +/** @name LegId */ +export interface LegId extends u64 {} /** @name LegStatus */ export interface LegStatus extends Enum { @@ -952,6 +1037,7 @@ export interface LegStatus extends Enum { readonly isExecutionPending: boolean; readonly isExecutionToBeSkipped: boolean; readonly asExecutionToBeSkipped: ITuple<[AccountId, u64]>; + readonly type: 'PendingTokenLock' | 'ExecutionPending' | 'ExecutionToBeSkipped'; } /** @name LocalCAId */ @@ -965,6 +1051,7 @@ export interface MaybeBlock extends Enum { readonly isSome: boolean; readonly asSome: BlockNumber; readonly isNone: boolean; + readonly type: 'Some' | 'None'; } /** @name Memo */ @@ -1003,14 +1090,7 @@ export interface MovePortfolioItem extends Struct { } /** @name OffChainSignature */ -export interface OffChainSignature extends Enum { - readonly isEd25519: boolean; - readonly asEd25519: H512; - readonly isSr25519: boolean; - readonly asSr25519: H512; - readonly isEcdsa: boolean; - readonly asEcdsa: H512; -} +export interface OffChainSignature extends MultiSignature {} /** @name PalletName */ export interface PalletName extends Text {} @@ -1064,8 +1144,8 @@ export interface PipsMetadata extends Struct { /** @name PolymeshVotes */ export interface PolymeshVotes extends Struct { readonly index: u32; - readonly ayes: Vec>; - readonly nays: Vec>; + readonly ayes: Vec; + readonly nays: Vec; readonly expiry: MaybeBlock; } @@ -1080,6 +1160,7 @@ export interface PortfolioKind extends Enum { readonly isDefault: boolean; readonly isUser: boolean; readonly asUser: PortfolioNumber; + readonly type: 'Default' | 'User'; } /** @name PortfolioName */ @@ -1095,6 +1176,7 @@ export interface PortfolioPermissions extends Enum { readonly asThese: Vec; readonly isExcept: boolean; readonly asExcept: Vec; + readonly type: 'Whole' | 'These' | 'Except'; } /** @name PortfolioValidityResult */ @@ -1127,6 +1209,7 @@ export interface ProposalData extends Enum { readonly asHash: Hash; readonly isProposal: boolean; readonly asProposal: Bytes; + readonly type: 'Hash' | 'Proposal'; } /** @name ProposalDetails */ @@ -1146,6 +1229,7 @@ export interface ProposalState extends Enum { readonly isFailed: boolean; readonly isExecuted: boolean; readonly isExpired: boolean; + readonly type: 'Pending' | 'Rejected' | 'Scheduled' | 'Failed' | 'Executed' | 'Expired'; } /** @name ProposalStatus */ @@ -1155,6 +1239,7 @@ export interface ProposalStatus extends Enum { readonly isExecutionSuccessful: boolean; readonly isExecutionFailed: boolean; readonly isRejected: boolean; + readonly type: 'Invalid' | 'ActiveOrExpired' | 'ExecutionSuccessful' | 'ExecutionFailed' | 'Rejected'; } /** @name Proposer */ @@ -1163,6 +1248,7 @@ export interface Proposer extends Enum { readonly asCommunity: AccountId; readonly isCommittee: boolean; readonly asCommittee: Committee; + readonly type: 'Community' | 'Committee'; } /** @name ProtocolOp */ @@ -1180,6 +1266,7 @@ export interface ProtocolOp extends Enum { readonly isContractsPutCode: boolean; readonly isCorporateBallotAttachBallot: boolean; readonly isCapitalDistributionDistribute: boolean; + readonly type: 'AssetRegisterTicker' | 'AssetIssue' | 'AssetAddDocuments' | 'AssetCreateAsset' | 'CheckpointCreateSchedule' | 'ComplianceManagerAddComplianceRequirement' | 'IdentityCddRegisterDid' | 'IdentityAddClaim' | 'IdentityAddSecondaryKeysWithAuthorization' | 'PipsPropose' | 'ContractsPutCode' | 'CorporateBallotAttachBallot' | 'CapitalDistributionDistribute'; } /** @name Receipt */ @@ -1194,7 +1281,7 @@ export interface Receipt extends Struct { /** @name ReceiptDetails */ export interface ReceiptDetails extends Struct { readonly receipt_uid: u64; - readonly leg_id: u64; + readonly leg_id: LegId; readonly signer: AccountId; readonly signature: OffChainSignature; readonly metadata: ReceiptMetadata; @@ -1217,6 +1304,7 @@ export interface RecordDateSpec extends Enum { readonly asExistingSchedule: ScheduleId; readonly isExisting: boolean; readonly asExisting: CheckpointId; + readonly type: 'Scheduled' | 'ExistingSchedule' | 'Existing'; } /** @name RestrictionResult */ @@ -1224,11 +1312,27 @@ export interface RestrictionResult extends Enum { readonly isValid: boolean; readonly isInvalid: boolean; readonly isForceValid: boolean; + readonly type: 'Valid' | 'Invalid' | 'ForceValid'; } /** @name RistrettoPoint */ export interface RistrettoPoint extends U8aFixed {} +/** @name RpcDidRecords */ +export interface RpcDidRecords extends Enum { + readonly isSuccess: boolean; + readonly asSuccess: RpcDidRecordsSuccess; + readonly isIdNotFound: boolean; + readonly asIdNotFound: Bytes; + readonly type: 'Success' | 'IdNotFound'; +} + +/** @name RpcDidRecordsSuccess */ +export interface RpcDidRecordsSuccess extends Struct { + readonly primary_key: AccountId; + readonly secondary_keys: Vec; +} + /** @name Scalar */ export interface Scalar extends U8aFixed {} @@ -1250,6 +1354,7 @@ export interface Scope extends Enum { readonly asTicker: Ticker; readonly isCustom: boolean; readonly asCustom: Bytes; + readonly type: 'Identity' | 'Ticker' | 'Custom'; } /** @name ScopeClaimProof */ @@ -1264,14 +1369,14 @@ export interface ScopeId extends U8aFixed {} /** @name SecondaryKey */ export interface SecondaryKey extends Struct { - readonly signer: Signatory; + readonly key: AccountId; readonly permissions: Permissions; } /** @name SecondaryKeyWithAuth */ export interface SecondaryKeyWithAuth extends Struct { readonly secondary_key: SecondaryKey; - readonly auth_signature: Signature; + readonly auth_signature: H512; } /** @name SecurityToken */ @@ -1287,6 +1392,7 @@ export interface SettlementType extends Enum { readonly isSettleOnAffirmation: boolean; readonly isSettleOnBlock: boolean; readonly asSettleOnBlock: BlockNumber; + readonly type: 'SettleOnAffirmation' | 'SettleOnBlock'; } /** @name Signatory */ @@ -1295,6 +1401,7 @@ export interface Signatory extends Enum { readonly asIdentity: IdentityId; readonly isAccount: boolean; readonly asAccount: AccountId; + readonly type: 'Identity' | 'Account'; } /** @name SkippedCount */ @@ -1305,6 +1412,7 @@ export interface SlashingSwitch extends Enum { readonly isValidator: boolean; readonly isValidatorAndNominator: boolean; readonly isNone: boolean; + readonly type: 'Validator' | 'ValidatorAndNominator' | 'None'; } /** @name SmartExtension */ @@ -1325,6 +1433,7 @@ export interface SmartExtensionType extends Enum { readonly isSmartWallet: boolean; readonly isCustom: boolean; readonly asCustom: Bytes; + readonly type: 'TransferManager' | 'Offerings' | 'SmartWallet' | 'Custom'; } /** @name SnapshotId */ @@ -1342,6 +1451,7 @@ export interface SnapshotResult extends Enum { readonly isApprove: boolean; readonly isReject: boolean; readonly isSkip: boolean; + readonly type: 'Approve' | 'Reject' | 'Skip'; } /** @name SnapshottedPip */ @@ -1350,6 +1460,50 @@ export interface SnapshottedPip extends Struct { readonly weight: ITuple<[bool, Balance]>; } +/** @name Stat1stKey */ +export interface Stat1stKey extends Struct { + readonly asset: AssetScope; + readonly stat_type: StatType; +} + +/** @name Stat2ndKey */ +export interface Stat2ndKey extends Enum { + readonly isNoClaimStat: boolean; + readonly isClaim: boolean; + readonly asClaim: StatClaim; + readonly type: 'NoClaimStat' | 'Claim'; +} + +/** @name StatClaim */ +export interface StatClaim extends Enum { + readonly isAccredited: boolean; + readonly asAccredited: bool; + readonly isAffiliate: boolean; + readonly asAffiliate: bool; + readonly isJurisdiction: boolean; + readonly asJurisdiction: Option; + readonly type: 'Accredited' | 'Affiliate' | 'Jurisdiction'; +} + +/** @name StatOpType */ +export interface StatOpType extends Enum { + readonly isCount: boolean; + readonly isBalance: boolean; + readonly type: 'Count' | 'Balance'; +} + +/** @name StatType */ +export interface StatType extends Struct { + readonly op: StatOpType; + readonly claim_issuer: Option>; +} + +/** @name StatUpdate */ +export interface StatUpdate extends Struct { + readonly key2: Stat2ndKey; + readonly value: Option; +} + /** @name StoredSchedule */ export interface StoredSchedule extends Struct { readonly schedule: CheckpointSchedule; @@ -1382,12 +1536,14 @@ export interface TargetIdentity extends Enum { readonly isExternalAgent: boolean; readonly isSpecific: boolean; readonly asSpecific: IdentityId; + readonly type: 'ExternalAgent' | 'Specific'; } /** @name TargetTreatment */ export interface TargetTreatment extends Enum { readonly isInclude: boolean; readonly isExclude: boolean; + readonly type: 'Include' | 'Exclude'; } /** @name Tax */ @@ -1424,17 +1580,29 @@ export interface TickerRegistrationConfig extends Struct { readonly registration_length: Option; } -/** @name TransferManager */ -export interface TransferManager extends Enum { - readonly isCountTransferManager: boolean; - readonly asCountTransferManager: Counter; - readonly isPercentageTransferManager: boolean; - readonly asPercentageTransferManager: Percentage; +/** @name TransferCondition */ +export interface TransferCondition extends Enum { + readonly isMaxInvestorCount: boolean; + readonly asMaxInvestorCount: u64; + readonly isMaxInvestorOwnership: boolean; + readonly asMaxInvestorOwnership: Percentage; + readonly isClaimCount: boolean; + readonly asClaimCount: ITuple<[StatClaim, IdentityId, u64, Option]>; + readonly isClaimOwnership: boolean; + readonly asClaimOwnership: ITuple<[StatClaim, IdentityId, Percentage, Percentage]>; + readonly type: 'MaxInvestorCount' | 'MaxInvestorOwnership' | 'ClaimCount' | 'ClaimOwnership'; } -/** @name TransferManagerResult */ -export interface TransferManagerResult extends Struct { - readonly tm: TransferManager; +/** @name TransferConditionExemptKey */ +export interface TransferConditionExemptKey extends Struct { + readonly asset: AssetScope; + readonly op: StatOpType; + readonly claim_type: Option; +} + +/** @name TransferConditionResult */ +export interface TransferConditionResult extends Struct { + readonly condition: TransferCondition; readonly result: bool; } @@ -1443,6 +1611,7 @@ export interface TrustedFor extends Enum { readonly isAny: boolean; readonly isSpecific: boolean; readonly asSpecific: Vec; + readonly type: 'Any' | 'Specific'; } /** @name TrustedIssuer */ @@ -1469,12 +1638,16 @@ export interface Venue extends Struct { /** @name VenueDetails */ export interface VenueDetails extends Text {} +/** @name VenueId */ +export interface VenueId extends u64 {} + /** @name VenueType */ export interface VenueType extends Enum { readonly isOther: boolean; readonly isDistribution: boolean; readonly isSto: boolean; readonly isExchange: boolean; + readonly type: 'Other' | 'Distribution' | 'Sto' | 'Exchange'; } /** @name Version */ @@ -1494,6 +1667,7 @@ export interface VoteCount extends Enum { readonly isProposalFound: boolean; readonly asProposalFound: VoteCountProposalFound; readonly isProposalNotFound: boolean; + readonly type: 'ProposalFound' | 'ProposalNotFound'; } /** @name VoteCountProposalFound */ @@ -1510,6 +1684,14 @@ export interface VotingResult extends Struct { readonly nays_stake: Balance; } +/** @name WeightPerClass */ +export interface WeightPerClass extends Struct { + readonly baseExtrinsic: Weight; + readonly maxExtrinsic: Option; + readonly maxTotal: Option; + readonly reserved: Option; +} + /** @name WeightToFeeCoefficient */ export interface WeightToFeeCoefficient extends Struct { readonly coeffInteger: Balance; diff --git a/scripts/cli/src/interfaces/definitions.ts b/scripts/cli/src/interfaces/definitions.ts index 3eff6822de..0aaf090edd 100644 --- a/scripts/cli/src/interfaces/definitions.ts +++ b/scripts/cli/src/interfaces/definitions.ts @@ -1,3 +1,3 @@ export default { -types: {"Address":"MultiAddress","LookupSource":"MultiAddress","AccountInfo":"AccountInfoWithDualRefCount","IdentityId":"[u8; 32]","EventDid":"IdentityId","EventCounts":"Vec","ErrorAt":"(u32, DispatchError)","InvestorUid":"[u8; 16]","Ticker":"[u8; 12]","CddId":"[u8; 32]","ScopeId":"[u8; 32]","PosRatio":"(u32, u32)","DocumentId":"u32","DocumentName":"Text","DocumentUri":"Text","DocumentHash":{"_enum":{"None":"","H512":"[u8; 64]","H384":"[u8; 48]","H320":"[u8; 40]","H256":"[u8; 32]","H224":"[u8; 28]","H192":"[u8; 24]","H160":"[u8; 20]","H128":"[u8; 16]"}},"DocumentType":"Text","Document":{"uri":"DocumentUri","content_hash":"DocumentHash","name":"DocumentName","doc_type":"Option","filing_date":"Option"},"Version":"u8","CustomAssetTypeId":"u32","AssetType":{"_enum":{"EquityCommon":"","EquityPreferred":"","Commodity":"","FixedIncome":"","REIT":"","Fund":"","RevenueShareAgreement":"","StructuredProduct":"","Derivative":"","Custom":"CustomAssetTypeId","StableCoin":""}},"AssetIdentifier":{"_enum":{"CUSIP":"[u8; 9]","CINS":"[u8; 9]","ISIN":"[u8; 12]","LEI":"[u8; 20]"}},"AssetOwnershipRelation":{"_enum":{"NotOwned":"","TickerOwned":"","AssetOwned":""}},"AssetName":"Text","FundingRoundName":"Text","VenueDetails":"Text","SecurityToken":{"total_supply":"Balance","owner_did":"IdentityId","divisible":"bool","asset_type":"AssetType"},"PalletName":"Text","DispatchableName":"Text","AssetPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"PortfolioPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"DispatchableNames":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"PalletPermissions":{"pallet_name":"PalletName","dispatchable_names":"DispatchableNames"},"ExtrinsicPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"Permissions":{"asset":"AssetPermissions","extrinsic":"ExtrinsicPermissions","portfolio":"PortfolioPermissions"},"LegacyPalletPermissions":{"pallet_name":"PalletName","total":"bool","dispatchable_names":"Vec"},"LegacyPermissions":{"asset":"Option>","extrinsic":"Option>","portfolio":"Option>"},"Signatory":{"_enum":{"Identity":"IdentityId","Account":"AccountId"}},"SecondaryKey":{"signer":"Signatory","permissions":"Permissions"},"SecondaryKeyWithAuth":{"secondary_key":"SecondaryKey","auth_signature":"Signature"},"Subsidy":{"paying_key":"AccountId","remaining":"Balance"},"IdentityRole":{"_enum":["Issuer","SimpleTokenIssuer","Validator","ClaimIssuer","Investor","NodeRunner","PM","CDDAMLClaimIssuer","AccreditedInvestorClaimIssuer","VerifiedIdentityClaimIssuer"]},"PreAuthorizedKeyInfo":{"target_id":"IdentityId","secondary_key":"SecondaryKey"},"DidRecord":{"primary_key":"AccountId","secondary_keys":"Vec"},"KeyIdentityData":{"identity":"IdentityId","permissions":"Option"},"CountryCode":{"_enum":["AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","VG","IO","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","HK","MO","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SK","SI","SB","SO","ZA","GS","SS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UM","UY","UZ","VU","VE","VN","VI","WF","EH","YE","ZM","ZW","BQ","CW","SX"]},"Scope":{"_enum":{"Identity":"IdentityId","Ticker":"Ticker","Custom":"Vec"}},"InvestorZKProofData":"Signature","Scalar":"[u8; 32]","RistrettoPoint":"[u8; 32]","ZkProofData":{"challenge_responses":"[Scalar; 2]","subtract_expressions_res":"RistrettoPoint","blinded_scope_did_hash":"RistrettoPoint"},"ScopeClaimProof":{"proof_scope_id_wellformed":"Signature","proof_scope_id_cdd_id_match":"ZkProofData","scope_id":"RistrettoPoint"},"Claim":{"_enum":{"Accredited":"Scope","Affiliate":"Scope","BuyLockup":"Scope","SellLockup":"Scope","CustomerDueDiligence":"CddId","KnowYourCustomer":"Scope","Jurisdiction":"(CountryCode, Scope)","Exempted":"Scope","Blocked":"Scope","InvestorUniqueness":"(Scope, ScopeId, CddId)","NoData":"","InvestorUniquenessV2":"(CddId)"}},"ClaimType":{"_enum":{"Accredited":"","Affiliate":"","BuyLockup":"","SellLockup":"","CustomerDueDiligence":"","KnowYourCustomer":"","Jurisdiction":"","Exempted":"","Blocked":"","InvestorUniqueness":"","NoData":"","InvestorUniquenessV2":""}},"IdentityClaim":{"claim_issuer":"IdentityId","issuance_date":"Moment","last_update_date":"Moment","expiry":"Option","claim":"Claim"},"ComplianceRequirement":{"sender_conditions":"Vec","receiver_conditions":"Vec","id":"u32"},"ComplianceRequirementResult":{"sender_conditions":"Vec","receiver_conditions":"Vec","id":"u32","result":"bool"},"ConditionType":{"_enum":{"IsPresent":"Claim","IsAbsent":"Claim","IsAnyOf":"Vec","IsNoneOf":"Vec","IsIdentity":"TargetIdentity"}},"TrustedFor":{"_enum":{"Any":"","Specific":"Vec"}},"TrustedIssuer":{"issuer":"IdentityId","trusted_for":"TrustedFor"},"Condition":{"condition_type":"ConditionType","issuers":"Vec"},"ConditionResult":{"condition":"Condition","result":"bool"},"TargetIdAuthorization":{"target_id":"IdentityId","nonce":"u64","expires_at":"Moment"},"TickerRegistration":{"owner":"IdentityId","expiry":"Option"},"TickerRegistrationConfig":{"max_ticker_length":"u8","registration_length":"Option"},"ClassicTickerRegistration":{"eth_owner":"EthereumAddress","is_created":"bool"},"ClassicTickerImport":{"eth_owner":"EthereumAddress","ticker":"Ticker","is_contract":"bool","is_created":"bool"},"EthereumAddress":"[u8; 20]","EcdsaSignature":"[u8; 65]","MotionTitle":"Text","MotionInfoLink":"Text","ChoiceTitle":"Text","Motion":{"title":"MotionTitle","info_link":"MotionInfoLink","choices":"Vec"},"BallotTitle":"Text","BallotMeta":{"title":"BallotTitle","motions":"Vec"},"BallotTimeRange":{"start":"Moment","end":"Moment"},"BallotVote":{"power":"Balance","fallback":"Option"},"MaybeBlock":{"_enum":{"Some":"BlockNumber","None":""}},"Url":"Text","PipDescription":"Text","PipsMetadata":{"id":"PipId","url":"Option","description":"Option","created_at":"BlockNumber","transaction_version":"u32","expiry":"MaybeBlock"},"Proposer":{"_enum":{"Community":"AccountId","Committee":"Committee"}},"Committee":{"_enum":{"Technical":"","Upgrade":""}},"SkippedCount":"u8","SnapshottedPip":{"id":"PipId","weight":"(bool, Balance)"},"SnapshotId":"u32","SnapshotMetadata":{"created_at":"BlockNumber","made_by":"AccountId","id":"SnapshotId"},"SnapshotResult":{"_enum":{"Approve":"","Reject":"","Skip":""}},"Beneficiary":{"id":"IdentityId","amount":"Balance"},"DepositInfo":{"owner":"AccountId","amount":"Balance"},"PolymeshVotes":{"index":"u32","ayes":"Vec<(IdentityId, Balance)>","nays":"Vec<(IdentityId, Balance)>","expiry":"MaybeBlock"},"PipId":"u32","ProposalState":{"_enum":["Pending","Rejected","Scheduled","Failed","Executed","Expired"]},"Pip":{"id":"PipId","proposal":"Call","state":"ProposalState","proposer":"Proposer"},"ProposalData":{"_enum":{"Hash":"Hash","Proposal":"Vec"}},"OffChainSignature":{"_enum":{"Ed25519":"H512","Sr25519":"H512","Ecdsa":"H512"}},"Authorization":{"authorization_data":"AuthorizationData","authorized_by":"IdentityId","expiry":"Option","auth_id":"u64"},"AuthorizationData":{"_enum":{"AttestPrimaryKeyRotation":"IdentityId","RotatePrimaryKey":"","TransferTicker":"Ticker","AddMultiSigSigner":"AccountId","TransferAssetOwnership":"Ticker","JoinIdentity":"Permissions","PortfolioCustody":"PortfolioId","BecomeAgent":"(Ticker, AgentGroup)","AddRelayerPayingKey":"(AccountId, AccountId, Balance)"}},"SmartExtensionType":{"_enum":{"TransferManager":"","Offerings":"","SmartWallet":"","Custom":"Vec"}},"SmartExtensionName":"Text","SmartExtension":{"extension_type":"SmartExtensionType","extension_name":"SmartExtensionName","extension_id":"AccountId","is_archive":"bool"},"MetaUrl":"Text","MetaDescription":"Text","MetaVersion":"u32","ExtVersion":"u32","TemplateMetadata":{"url":"Option","se_type":"SmartExtensionType","usage_fee":"Balance","description":"MetaDescription","version":"MetaVersion"},"TemplateDetails":{"instantiation_fee":"Balance","owner":"IdentityId","frozen":"bool"},"AuthorizationNonce":"u64","Counter":"u64","Percentage":"Permill","TransferManager":{"_enum":{"CountTransferManager":"Counter","PercentageTransferManager":"Percentage"}},"RestrictionResult":{"_enum":["Valid","Invalid","ForceValid"]},"Memo":"[u8;32]","BridgeTx":{"nonce":"u32","recipient":"AccountId","amount":"Balance","tx_hash":"H256"},"AssetCompliance":{"paused":"bool","requirements":"Vec"},"AssetComplianceResult":{"paused":"bool","requirements":"Vec","result":"bool"},"Claim1stKey":{"target":"IdentityId","claim_type":"ClaimType"},"Claim2ndKey":{"issuer":"IdentityId","scope":"Option"},"InactiveMember":{"id":"IdentityId","deactivated_at":"Moment","expiry":"Option"},"VotingResult":{"ayes_count":"u32","ayes_stake":"Balance","nays_count":"u32","nays_stake":"Balance"},"ProtocolOp":{"_enum":["AssetRegisterTicker","AssetIssue","AssetAddDocuments","AssetCreateAsset","CheckpointCreateSchedule","ComplianceManagerAddComplianceRequirement","IdentityCddRegisterDid","IdentityAddClaim","IdentityAddSecondaryKeysWithAuthorization","PipsPropose","ContractsPutCode","CorporateBallotAttachBallot","CapitalDistributionDistribute"]},"CddStatus":{"_enum":{"Ok":"IdentityId","Err":"Vec"}},"AssetDidResult":{"_enum":{"Ok":"IdentityId","Err":"Vec"}},"DidRecordsSuccess":{"primary_key":"AccountId","secondary_keys":"Vec"},"DidRecords":{"_enum":{"Success":"DidRecordsSuccess","IdNotFound":"Vec"}},"VoteCountProposalFound":{"ayes":"u64","nays":"u64"},"VoteCount":{"_enum":{"ProposalFound":"VoteCountProposalFound","ProposalNotFound":""}},"Vote":"(bool, Balance)","VoteByPip":{"pip":"PipId","vote":"Vote"},"BridgeTxDetail":{"amount":"Balance","status":"BridgeTxStatus","execution_block":"BlockNumber","tx_hash":"H256"},"BridgeTxStatus":{"_enum":{"Absent":"","Pending":"u8","Frozen":"","Timelocked":"","Handled":""}},"HandledTxStatus":{"_enum":{"Success":"","Error":"Text"}},"CappedFee":"u64","CanTransferResult":{"_enum":{"Ok":"u8","Err":"Vec"}},"AuthorizationType":{"_enum":{"AttestPrimaryKeyRotation":"","RotatePrimaryKey":"","TransferTicker":"","AddMultiSigSigner":"","TransferAssetOwnership":"","JoinIdentity":"","PortfolioCustody":"","BecomeAgent":"","AddRelayerPayingKey":""}},"ProposalDetails":{"approvals":"u64","rejections":"u64","status":"ProposalStatus","expiry":"Option","auto_close":"bool"},"ProposalStatus":{"_enum":{"Invalid":"","ActiveOrExpired":"","ExecutionSuccessful":"","ExecutionFailed":"","Rejected":""}},"DidStatus":{"_enum":{"Unknown":"","Exists":"","CddVerified":""}},"PortfolioName":"Text","PortfolioNumber":"u64","PortfolioKind":{"_enum":{"Default":"","User":"PortfolioNumber"}},"PortfolioId":{"did":"IdentityId","kind":"PortfolioKind"},"Moment":"u64","CalendarUnit":{"_enum":["Second","Minute","Hour","Day","Week","Month","Year"]},"CalendarPeriod":{"unit":"CalendarUnit","amount":"u64"},"CheckpointSchedule":{"start":"Moment","period":"CalendarPeriod"},"CheckpointId":"u64","ScheduleId":"u64","StoredSchedule":{"schedule":"CheckpointSchedule","id":"ScheduleId","at":"Moment","remaining":"u32"},"ScheduleSpec":{"start":"Option","period":"CalendarPeriod","remaining":"u32"},"InstructionStatus":{"_enum":{"Unknown":"","Pending":"","Failed":""}},"LegStatus":{"_enum":{"PendingTokenLock":"","ExecutionPending":"","ExecutionToBeSkipped":"(AccountId, u64)"}},"AffirmationStatus":{"_enum":{"Unknown":"","Pending":"","Affirmed":""}},"SettlementType":{"_enum":{"SettleOnAffirmation":"","SettleOnBlock":"BlockNumber"}},"Instruction":{"instruction_id":"u64","venue_id":"u64","status":"InstructionStatus","settlement_type":"SettlementType","created_at":"Option","trade_date":"Option","value_date":"Option"},"Leg":{"from":"PortfolioId","to":"PortfolioId","asset":"Ticker","amount":"Balance"},"Venue":{"creator":"IdentityId","venue_type":"VenueType"},"Receipt":{"receipt_uid":"u64","from":"PortfolioId","to":"PortfolioId","asset":"Ticker","amount":"Balance"},"ReceiptMetadata":"Text","ReceiptDetails":{"receipt_uid":"u64","leg_id":"u64","signer":"AccountId","signature":"OffChainSignature","metadata":"ReceiptMetadata"},"UniqueCall":{"nonce":"u64","call":"Call"},"MovePortfolioItem":{"ticker":"Ticker","amount":"Balance","memo":"Option"},"WeightToFeeCoefficient":{"coeffInteger":"Balance","coeffFrac":"Perbill","negative":"bool","degree":"u8"},"TargetIdentity":{"_enum":{"ExternalAgent":"","Specific":"IdentityId"}},"FundraiserName":"Text","FundraiserStatus":{"_enum":["Live","Frozen","Closed","ClosedEarly"]},"FundraiserTier":{"total":"Balance","price":"Balance","remaining":"Balance"},"Fundraiser":{"creator":"IdentityId","offering_portfolio":"PortfolioId","offering_asset":"Ticker","raising_portfolio":"PortfolioId","raising_asset":"Ticker","tiers":"Vec","venue_id":"u64","start":"Moment","end":"Option","status":"FundraiserStatus","minimum_investment":"Balance"},"VenueType":{"_enum":["Other","Distribution","Sto","Exchange"]},"ExtensionAttributes":{"usage_fee":"Balance","version":"MetaVersion"},"Tax":"Permill","TargetIdentities":{"identities":"Vec","treatment":"TargetTreatment"},"TargetTreatment":{"_enum":["Include","Exclude"]},"CAKind":{"_enum":["PredictableBenefit","UnpredictableBenefit","IssuerNotice","Reorganization","Other"]},"CADetails":"Text","CACheckpoint":{"_enum":{"Scheduled":"(ScheduleId, u64)","Existing":"CheckpointId"}},"RecordDate":{"date":"Moment","checkpoint":"CACheckpoint"},"RecordDateSpec":{"_enum":{"Scheduled":"Moment","ExistingSchedule":"ScheduleId","Existing":"CheckpointId"}},"CorporateAction":{"kind":"CAKind","decl_date":"Moment","record_date":"Option","targets":"TargetIdentities","default_withholding_tax":"Tax","withholding_tax":"Vec<(IdentityId, Tax)>"},"LocalCAId":"u32","CAId":{"ticker":"Ticker","local_id":"LocalCAId"},"Distribution":{"from":"PortfolioId","currency":"Ticker","per_share":"Balance","amount":"Balance","remaining":"Balance","reclaimed":"bool","payment_at":"Moment","expires_at":"Option"},"SlashingSwitch":{"_enum":["Validator","ValidatorAndNominator","None"]},"PriceTier":{"total":"Balance","price":"Balance"},"PermissionedIdentityPrefs":{"intended_count":"u32","running_count":"u32"},"GranularCanTransferResult":{"invalid_granularity":"bool","self_transfer":"bool","invalid_receiver_cdd":"bool","invalid_sender_cdd":"bool","missing_scope_claim":"bool","receiver_custodian_error":"bool","sender_custodian_error":"bool","sender_insufficient_balance":"bool","portfolio_validity_result":"PortfolioValidityResult","asset_frozen":"bool","statistics_result":"Vec","compliance_result":"AssetComplianceResult","result":"bool"},"PortfolioValidityResult":{"receiver_is_same_portfolio":"bool","sender_portfolio_does_not_exist":"bool","receiver_portfolio_does_not_exist":"bool","sender_insufficient_balance":"bool","result":"bool"},"TransferManagerResult":{"tm":"TransferManager","result":"bool"},"AGId":"u32","AgentGroup":{"_enum":{"Full":"","Custom":"AGId","ExceptMeta":"","PolymeshV1CAA":"","PolymeshV1PIA":""}},"ItnRewardStatus":{"_enum":{"Unclaimed":"Balance","Claimed":""}}} +types: {"Address":"MultiAddress","LookupSource":"MultiAddress","AccountInfo":"AccountInfoWithDualRefCount","IdentityId":"[u8; 32]","EventDid":"IdentityId","EventCounts":"Vec","ErrorAt":"(u32, DispatchError)","InvestorUid":"[u8; 16]","Ticker":"[u8; 12]","CddId":"[u8; 32]","ScopeId":"[u8; 32]","PosRatio":"(u32, u32)","DocumentId":"u32","DocumentName":"Text","DocumentUri":"Text","DocumentHash":{"_enum":{"None":"","H512":"[u8; 64]","H384":"[u8; 48]","H320":"[u8; 40]","H256":"[u8; 32]","H224":"[u8; 28]","H192":"[u8; 24]","H160":"[u8; 20]","H128":"[u8; 16]"}},"DocumentType":"Text","Document":{"uri":"DocumentUri","content_hash":"DocumentHash","name":"DocumentName","doc_type":"Option","filing_date":"Option"},"Version":"u8","CustomAssetTypeId":"u32","AssetType":{"_enum":{"EquityCommon":"","EquityPreferred":"","Commodity":"","FixedIncome":"","REIT":"","Fund":"","RevenueShareAgreement":"","StructuredProduct":"","Derivative":"","Custom":"CustomAssetTypeId","StableCoin":""}},"AssetIdentifier":{"_enum":{"CUSIP":"[u8; 9]","CINS":"[u8; 9]","ISIN":"[u8; 12]","LEI":"[u8; 20]"}},"AssetOwnershipRelation":{"_enum":{"NotOwned":"","TickerOwned":"","AssetOwned":""}},"AssetName":"Text","FundingRoundName":"Text","VenueDetails":"Text","SecurityToken":{"total_supply":"Balance","owner_did":"IdentityId","divisible":"bool","asset_type":"AssetType"},"AssetMetadataName":"Text","AssetMetadataValue":"Vec","AssetMetadataLocalKey":"u64","AssetMetadataGlobalKey":"u64","AssetMetadataKey":{"_enum":{"Global":"u64","Local":"u64"}},"AssetMetadataLockStatus":{"_enum":{"Unlocked":"","Locked":"","LockedUntil":"Moment"}},"AssetMetadataValueDetail":{"expire":"Option","lock_status":"AssetMetadataLockStatus"},"AssetMetadataDescription":"Text","AssetMetadataSpec":{"url":"Option","description":"Option","type_def":"Option>"},"PalletName":"Text","DispatchableName":"Text","AssetPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"PortfolioPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"DispatchableNames":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"PalletPermissions":{"pallet_name":"PalletName","dispatchable_names":"DispatchableNames"},"ExtrinsicPermissions":{"_enum":{"Whole":"","These":"Vec","Except":"Vec"}},"Permissions":{"asset":"AssetPermissions","extrinsic":"ExtrinsicPermissions","portfolio":"PortfolioPermissions"},"Signatory":{"_enum":{"Identity":"IdentityId","Account":"AccountId"}},"SecondaryKey":{"key":"AccountId","permissions":"Permissions"},"SecondaryKeyWithAuth":{"secondary_key":"SecondaryKey","auth_signature":"H512"},"Subsidy":{"paying_key":"AccountId","remaining":"Balance"},"IdentityRole":{"_enum":["Issuer","SimpleTokenIssuer","Validator","ClaimIssuer","Investor","NodeRunner","PM","CDDAMLClaimIssuer","AccreditedInvestorClaimIssuer","VerifiedIdentityClaimIssuer"]},"PreAuthorizedKeyInfo":{"target_id":"IdentityId","secondary_key":"SecondaryKey"},"DidRecord":{"primary_key":"Option"},"KeyRecord":{"_enum":{"PrimaryKey":"IdentityId","SecondaryKey":"(IdentityId, Permissions)","MultiSigSignerKey":"AccountId"}},"KeyIdentityData":{"identity":"IdentityId","permissions":"Option"},"CountryCode":{"_enum":["AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","VG","IO","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","HK","MO","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SK","SI","SB","SO","ZA","GS","SS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UM","UY","UZ","VU","VE","VN","VI","WF","EH","YE","ZM","ZW","BQ","CW","SX"]},"Scope":{"_enum":{"Identity":"IdentityId","Ticker":"Ticker","Custom":"Vec"}},"InvestorZKProofData":{"r":"CompressedRistretto","s":"Scalar"},"CompressedRistretto":"[u8; 32]","Scalar":"[u8; 32]","RistrettoPoint":"[u8; 32]","ZkProofData":{"challenge_responses":"[Scalar; 2]","subtract_expressions_res":"RistrettoPoint","blinded_scope_did_hash":"RistrettoPoint"},"ScopeClaimProof":{"proof_scope_id_wellformed":"Signature","proof_scope_id_cdd_id_match":"ZkProofData","scope_id":"RistrettoPoint"},"Claim":{"_enum":{"Accredited":"Scope","Affiliate":"Scope","BuyLockup":"Scope","SellLockup":"Scope","CustomerDueDiligence":"CddId","KnowYourCustomer":"Scope","Jurisdiction":"(CountryCode, Scope)","Exempted":"Scope","Blocked":"Scope","InvestorUniqueness":"(Scope, ScopeId, CddId)","NoData":"","InvestorUniquenessV2":"(CddId)"}},"ClaimType":{"_enum":{"Accredited":"","Affiliate":"","BuyLockup":"","SellLockup":"","CustomerDueDiligence":"","KnowYourCustomer":"","Jurisdiction":"","Exempted":"","Blocked":"","InvestorUniqueness":"","NoData":"","InvestorUniquenessV2":""}},"IdentityClaim":{"claim_issuer":"IdentityId","issuance_date":"Moment","last_update_date":"Moment","expiry":"Option","claim":"Claim"},"ComplianceRequirement":{"sender_conditions":"Vec","receiver_conditions":"Vec","id":"u32"},"ComplianceRequirementResult":{"sender_conditions":"Vec","receiver_conditions":"Vec","id":"u32","result":"bool"},"ConditionType":{"_enum":{"IsPresent":"Claim","IsAbsent":"Claim","IsAnyOf":"Vec","IsNoneOf":"Vec","IsIdentity":"TargetIdentity"}},"TrustedFor":{"_enum":{"Any":"","Specific":"Vec"}},"TrustedIssuer":{"issuer":"IdentityId","trusted_for":"TrustedFor"},"Condition":{"condition_type":"ConditionType","issuers":"Vec"},"ConditionResult":{"condition":"Condition","result":"bool"},"TargetIdAuthorization":{"target_id":"IdentityId","nonce":"u64","expires_at":"Moment"},"TickerRegistration":{"owner":"IdentityId","expiry":"Option"},"TickerRegistrationConfig":{"max_ticker_length":"u8","registration_length":"Option"},"ClassicTickerRegistration":{"eth_owner":"EthereumAddress","is_created":"bool"},"ClassicTickerImport":{"eth_owner":"EthereumAddress","ticker":"Ticker","is_contract":"bool","is_created":"bool"},"EthereumAddress":"[u8; 20]","EcdsaSignature":"[u8; 65]","MotionTitle":"Text","MotionInfoLink":"Text","ChoiceTitle":"Text","Motion":{"title":"MotionTitle","info_link":"MotionInfoLink","choices":"Vec"},"BallotTitle":"Text","BallotMeta":{"title":"BallotTitle","motions":"Vec"},"BallotTimeRange":{"start":"Moment","end":"Moment"},"BallotVote":{"power":"Balance","fallback":"Option"},"MaybeBlock":{"_enum":{"Some":"BlockNumber","None":""}},"Url":"Text","PipDescription":"Text","PipsMetadata":{"id":"PipId","url":"Option","description":"Option","created_at":"BlockNumber","transaction_version":"u32","expiry":"MaybeBlock"},"Proposer":{"_enum":{"Community":"AccountId","Committee":"Committee"}},"Committee":{"_enum":{"Technical":"","Upgrade":""}},"SkippedCount":"u8","SnapshottedPip":{"id":"PipId","weight":"(bool, Balance)"},"SnapshotId":"u32","SnapshotMetadata":{"created_at":"BlockNumber","made_by":"AccountId","id":"SnapshotId"},"SnapshotResult":{"_enum":{"Approve":"","Reject":"","Skip":""}},"Beneficiary":{"id":"IdentityId","amount":"Balance"},"DepositInfo":{"owner":"AccountId","amount":"Balance"},"PolymeshVotes":{"index":"u32","ayes":"Vec","nays":"Vec","expiry":"MaybeBlock"},"PipId":"u32","ProposalState":{"_enum":["Pending","Rejected","Scheduled","Failed","Executed","Expired"]},"Pip":{"id":"PipId","proposal":"Call","state":"ProposalState","proposer":"Proposer"},"ProposalData":{"_enum":{"Hash":"Hash","Proposal":"Vec"}},"OffChainSignature":"MultiSignature","Authorization":{"authorization_data":"AuthorizationData","authorized_by":"IdentityId","expiry":"Option","auth_id":"u64"},"AuthorizationData":{"_enum":{"AttestPrimaryKeyRotation":"IdentityId","RotatePrimaryKey":"","TransferTicker":"Ticker","AddMultiSigSigner":"AccountId","TransferAssetOwnership":"Ticker","JoinIdentity":"Permissions","PortfolioCustody":"PortfolioId","BecomeAgent":"(Ticker, AgentGroup)","AddRelayerPayingKey":"(AccountId, AccountId, Balance)","RotatePrimaryKeyToSecondary":"Permissions"}},"SmartExtensionType":{"_enum":{"TransferManager":"","Offerings":"","SmartWallet":"","Custom":"Vec"}},"SmartExtensionName":"Text","SmartExtension":{"extension_type":"SmartExtensionType","extension_name":"SmartExtensionName","extension_id":"AccountId","is_archive":"bool"},"MetaUrl":"Text","MetaDescription":"Text","MetaVersion":"u32","ExtVersion":"u32","TemplateMetadata":{"url":"Option","se_type":"SmartExtensionType","usage_fee":"Balance","description":"MetaDescription","version":"MetaVersion"},"TemplateDetails":{"instantiation_fee":"Balance","owner":"IdentityId","frozen":"bool"},"AuthorizationNonce":"u64","Percentage":"Permill","RestrictionResult":{"_enum":["Valid","Invalid","ForceValid"]},"Memo":"[u8; 32]","BridgeTx":{"nonce":"u32","recipient":"AccountId","amount":"Balance","tx_hash":"H256"},"AssetScope":{"_enum":{"Ticker":"Ticker"}},"StatOpType":{"_enum":["Count","Balance"]},"StatType":{"op":"StatOpType","claim_issuer":"Option<(ClaimType, IdentityId)>"},"StatClaim":{"_enum":{"Accredited":"bool","Affiliate":"bool","Jurisdiction":"Option"}},"Stat1stKey":{"asset":"AssetScope","stat_type":"StatType"},"Stat2ndKey":{"_enum":{"NoClaimStat":"","Claim":"StatClaim"}},"StatUpdate":{"key2":"Stat2ndKey","value":"Option"},"TransferCondition":{"_enum":{"MaxInvestorCount":"u64","MaxInvestorOwnership":"Percentage","ClaimCount":"(StatClaim, IdentityId, u64, Option)","ClaimOwnership":"(StatClaim, IdentityId, Percentage, Percentage)"}},"AssetTransferCompliance":{"paused":"bool","requirements":"Vec"},"TransferConditionExemptKey":{"asset":"AssetScope","op":"StatOpType","claim_type":"Option"},"AssetCompliance":{"paused":"bool","requirements":"Vec"},"AssetComplianceResult":{"paused":"bool","requirements":"Vec","result":"bool"},"Claim1stKey":{"target":"IdentityId","claim_type":"ClaimType"},"Claim2ndKey":{"issuer":"IdentityId","scope":"Option"},"InactiveMember":{"id":"IdentityId","deactivated_at":"Moment","expiry":"Option"},"VotingResult":{"ayes_count":"u32","ayes_stake":"Balance","nays_count":"u32","nays_stake":"Balance"},"ProtocolOp":{"_enum":["AssetRegisterTicker","AssetIssue","AssetAddDocuments","AssetCreateAsset","CheckpointCreateSchedule","ComplianceManagerAddComplianceRequirement","IdentityCddRegisterDid","IdentityAddClaim","IdentityAddSecondaryKeysWithAuthorization","PipsPropose","ContractsPutCode","CorporateBallotAttachBallot","CapitalDistributionDistribute"]},"CddStatus":{"_enum":{"Ok":"IdentityId","Err":"Vec"}},"AssetDidResult":{"_enum":{"Ok":"IdentityId","Err":"Vec"}},"RpcDidRecordsSuccess":{"primary_key":"AccountId","secondary_keys":"Vec"},"RpcDidRecords":{"_enum":{"Success":"RpcDidRecordsSuccess","IdNotFound":"Vec"}},"VoteCountProposalFound":{"ayes":"u64","nays":"u64"},"VoteCount":{"_enum":{"ProposalFound":"VoteCountProposalFound","ProposalNotFound":""}},"Vote":"(bool, Balance)","VoteByPip":{"pip":"PipId","vote":"Vote"},"BridgeTxDetail":{"amount":"Balance","status":"BridgeTxStatus","execution_block":"BlockNumber","tx_hash":"H256"},"BridgeTxStatus":{"_enum":{"Absent":"","Pending":"u8","Frozen":"","Timelocked":"","Handled":""}},"HandledTxStatus":{"_enum":{"Success":"","Error":"Text"}},"CappedFee":"u64","CanTransferResult":{"_enum":{"Ok":"u8","Err":"Vec"}},"AuthorizationType":{"_enum":{"AttestPrimaryKeyRotation":"","RotatePrimaryKey":"","TransferTicker":"","AddMultiSigSigner":"","TransferAssetOwnership":"","JoinIdentity":"","PortfolioCustody":"","BecomeAgent":"","AddRelayerPayingKey":"","RotatePrimaryKeyToSecondary":""}},"ProposalDetails":{"approvals":"u64","rejections":"u64","status":"ProposalStatus","expiry":"Option","auto_close":"bool"},"ProposalStatus":{"_enum":{"Invalid":"","ActiveOrExpired":"","ExecutionSuccessful":"","ExecutionFailed":"","Rejected":""}},"DidStatus":{"_enum":{"Unknown":"","Exists":"","CddVerified":""}},"PortfolioName":"Text","PortfolioNumber":"u64","PortfolioKind":{"_enum":{"Default":"","User":"PortfolioNumber"}},"PortfolioId":{"did":"IdentityId","kind":"PortfolioKind"},"Moment":"u64","CalendarUnit":{"_enum":["Second","Minute","Hour","Day","Week","Month","Year"]},"CalendarPeriod":{"unit":"CalendarUnit","amount":"u64"},"CheckpointSchedule":{"start":"Moment","period":"CalendarPeriod"},"CheckpointId":"u64","ScheduleId":"u64","StoredSchedule":{"schedule":"CheckpointSchedule","id":"ScheduleId","at":"Moment","remaining":"u32"},"ScheduleSpec":{"start":"Option","period":"CalendarPeriod","remaining":"u32"},"InstructionStatus":{"_enum":{"Unknown":"","Pending":"","Failed":""}},"LegStatus":{"_enum":{"PendingTokenLock":"","ExecutionPending":"","ExecutionToBeSkipped":"(AccountId, u64)"}},"AffirmationStatus":{"_enum":{"Unknown":"","Pending":"","Affirmed":""}},"SettlementType":{"_enum":{"SettleOnAffirmation":"","SettleOnBlock":"BlockNumber"}},"LegId":"u64","InstructionId":"u64","Instruction":{"instruction_id":"InstructionId","venue_id":"VenueId","status":"InstructionStatus","settlement_type":"SettlementType","created_at":"Option","trade_date":"Option","value_date":"Option"},"Leg":{"from":"PortfolioId","to":"PortfolioId","asset":"Ticker","amount":"Balance"},"Venue":{"creator":"IdentityId","venue_type":"VenueType"},"Receipt":{"receipt_uid":"u64","from":"PortfolioId","to":"PortfolioId","asset":"Ticker","amount":"Balance"},"ReceiptMetadata":"Text","ReceiptDetails":{"receipt_uid":"u64","leg_id":"LegId","signer":"AccountId","signature":"OffChainSignature","metadata":"ReceiptMetadata"},"UniqueCall":{"nonce":"u64","call":"Call"},"MovePortfolioItem":{"ticker":"Ticker","amount":"Balance","memo":"Option"},"WeightToFeeCoefficient":{"coeffInteger":"Balance","coeffFrac":"Perbill","negative":"bool","degree":"u8"},"WeightPerClass":{"baseExtrinsic":"Weight","maxExtrinsic":"Option","maxTotal":"Option","reserved":"Option"},"TargetIdentity":{"_enum":{"ExternalAgent":"","Specific":"IdentityId"}},"FundraiserId":"u64","FundraiserName":"Text","FundraiserStatus":{"_enum":["Live","Frozen","Closed","ClosedEarly"]},"FundraiserTier":{"total":"Balance","price":"Balance","remaining":"Balance"},"Fundraiser":{"creator":"IdentityId","offering_portfolio":"PortfolioId","offering_asset":"Ticker","raising_portfolio":"PortfolioId","raising_asset":"Ticker","tiers":"Vec","venue_id":"VenueId","start":"Moment","end":"Option","status":"FundraiserStatus","minimum_investment":"Balance"},"VenueId":"u64","VenueType":{"_enum":["Other","Distribution","Sto","Exchange"]},"ExtensionAttributes":{"usage_fee":"Balance","version":"MetaVersion"},"Tax":"Permill","TargetIdentities":{"identities":"Vec","treatment":"TargetTreatment"},"TargetTreatment":{"_enum":["Include","Exclude"]},"CAKind":{"_enum":["PredictableBenefit","UnpredictableBenefit","IssuerNotice","Reorganization","Other"]},"CADetails":"Text","CACheckpoint":{"_enum":{"Scheduled":"(ScheduleId, u64)","Existing":"CheckpointId"}},"RecordDate":{"date":"Moment","checkpoint":"CACheckpoint"},"RecordDateSpec":{"_enum":{"Scheduled":"Moment","ExistingSchedule":"ScheduleId","Existing":"CheckpointId"}},"CorporateAction":{"kind":"CAKind","decl_date":"Moment","record_date":"Option","targets":"TargetIdentities","default_withholding_tax":"Tax","withholding_tax":"Vec<(IdentityId, Tax)>"},"LocalCAId":"u32","CAId":{"ticker":"Ticker","local_id":"LocalCAId"},"Distribution":{"from":"PortfolioId","currency":"Ticker","per_share":"Balance","amount":"Balance","remaining":"Balance","reclaimed":"bool","payment_at":"Moment","expires_at":"Option"},"SlashingSwitch":{"_enum":["Validator","ValidatorAndNominator","None"]},"PriceTier":{"total":"Balance","price":"Balance"},"PermissionedIdentityPrefs":{"intended_count":"u32","running_count":"u32"},"GranularCanTransferResult":{"invalid_granularity":"bool","self_transfer":"bool","invalid_receiver_cdd":"bool","invalid_sender_cdd":"bool","missing_scope_claim":"bool","receiver_custodian_error":"bool","sender_custodian_error":"bool","sender_insufficient_balance":"bool","portfolio_validity_result":"PortfolioValidityResult","asset_frozen":"bool","transfer_condition_result":"Vec","compliance_result":"AssetComplianceResult","result":"bool"},"PortfolioValidityResult":{"receiver_is_same_portfolio":"bool","sender_portfolio_does_not_exist":"bool","receiver_portfolio_does_not_exist":"bool","sender_insufficient_balance":"bool","result":"bool"},"TransferConditionResult":{"condition":"TransferCondition","result":"bool"},"AGId":"u32","AgentGroup":{"_enum":{"Full":"","Custom":"AGId","ExceptMeta":"","PolymeshV1CAA":"","PolymeshV1PIA":""}},"ItnRewardStatus":{"_enum":{"Unclaimed":"Balance","Claimed":""}}} } \ No newline at end of file diff --git a/scripts/cli/src/interfaces/lookup.ts b/scripts/cli/src/interfaces/lookup.ts new file mode 100644 index 0000000000..6d9844b2d0 --- /dev/null +++ b/scripts/cli/src/interfaces/lookup.ts @@ -0,0 +1,4419 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +/* eslint-disable sort-keys */ + +export default { + /** + * Lookup3: frame_system::AccountInfo + **/ + FrameSystemAccountInfo: { + nonce: 'u32', + consumers: 'u32', + providers: 'u32', + sufficients: 'u32', + data: 'PolymeshCommonUtilitiesBalancesAccountData' + }, + /** + * Lookup5: polymesh_common_utilities::traits::balances::AccountData + **/ + PolymeshCommonUtilitiesBalancesAccountData: { + free: 'u128', + reserved: 'u128', + miscFrozen: 'u128', + feeFrozen: 'u128' + }, + /** + * Lookup7: frame_support::weights::PerDispatchClass + **/ + FrameSupportWeightsPerDispatchClassU64: { + normal: 'u64', + operational: 'u64', + mandatory: 'u64' + }, + /** + * Lookup11: sp_runtime::generic::digest::Digest + **/ + SpRuntimeDigest: { + logs: 'Vec' + }, + /** + * Lookup13: sp_runtime::generic::digest::DigestItem + **/ + SpRuntimeDigestDigestItem: { + _enum: { + Other: 'Bytes', + __Unused1: 'Null', + __Unused2: 'Null', + __Unused3: 'Null', + Consensus: '([u8;4],Bytes)', + Seal: '([u8;4],Bytes)', + PreRuntime: '([u8;4],Bytes)', + __Unused7: 'Null', + RuntimeEnvironmentUpdated: 'Null' + } + }, + /** + * Lookup16: frame_system::EventRecord + **/ + FrameSystemEventRecord: { + phase: 'FrameSystemPhase', + event: 'Event', + topics: 'Vec' + }, + /** + * Lookup18: frame_system::pallet::Event + **/ + FrameSystemEvent: { + _enum: { + ExtrinsicSuccess: { + dispatchInfo: 'FrameSupportWeightsDispatchInfo', + }, + ExtrinsicFailed: { + dispatchError: 'SpRuntimeDispatchError', + dispatchInfo: 'FrameSupportWeightsDispatchInfo', + }, + CodeUpdated: 'Null', + NewAccount: { + account: 'AccountId32', + }, + KilledAccount: { + account: 'AccountId32', + }, + Remarked: { + _alias: { + hash_: 'hash', + }, + sender: 'AccountId32', + hash_: 'H256' + } + } + }, + /** + * Lookup19: frame_support::weights::DispatchInfo + **/ + FrameSupportWeightsDispatchInfo: { + weight: 'u64', + class: 'FrameSupportWeightsDispatchClass', + paysFee: 'FrameSupportWeightsPays' + }, + /** + * Lookup20: frame_support::weights::DispatchClass + **/ + FrameSupportWeightsDispatchClass: { + _enum: ['Normal', 'Operational', 'Mandatory'] + }, + /** + * Lookup21: frame_support::weights::Pays + **/ + FrameSupportWeightsPays: { + _enum: ['Yes', 'No'] + }, + /** + * Lookup22: sp_runtime::DispatchError + **/ + SpRuntimeDispatchError: { + _enum: { + Other: 'Null', + CannotLookup: 'Null', + BadOrigin: 'Null', + Module: 'SpRuntimeModuleError', + ConsumerRemaining: 'Null', + NoProviders: 'Null', + TooManyConsumers: 'Null', + Token: 'SpRuntimeTokenError', + Arithmetic: 'SpRuntimeArithmeticError', + Transactional: 'SpRuntimeTransactionalError' + } + }, + /** + * Lookup23: sp_runtime::ModuleError + **/ + SpRuntimeModuleError: { + index: 'u8', + error: '[u8;4]' + }, + /** + * Lookup24: sp_runtime::TokenError + **/ + SpRuntimeTokenError: { + _enum: ['NoFunds', 'WouldDie', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported'] + }, + /** + * Lookup25: sp_runtime::ArithmeticError + **/ + SpRuntimeArithmeticError: { + _enum: ['Underflow', 'Overflow', 'DivisionByZero'] + }, + /** + * Lookup26: sp_runtime::TransactionalError + **/ + SpRuntimeTransactionalError: { + _enum: ['LimitReached', 'NoLayer'] + }, + /** + * Lookup27: pallet_indices::pallet::Event + **/ + PalletIndicesEvent: { + _enum: { + IndexAssigned: { + who: 'AccountId32', + index: 'u32', + }, + IndexFreed: { + index: 'u32', + }, + IndexFrozen: { + index: 'u32', + who: 'AccountId32' + } + } + }, + /** + * Lookup28: polymesh_common_utilities::traits::balances::RawEvent + **/ + PolymeshCommonUtilitiesBalancesRawEvent: { + _enum: { + Endowed: '(Option,AccountId32,u128)', + Transfer: '(Option,AccountId32,Option,AccountId32,u128,Option)', + BalanceSet: '(PolymeshPrimitivesIdentityId,AccountId32,u128,u128)', + AccountBalanceBurned: '(PolymeshPrimitivesIdentityId,AccountId32,u128)', + Reserved: '(AccountId32,u128)', + Unreserved: '(AccountId32,u128)', + ReserveRepatriated: '(AccountId32,AccountId32,u128,FrameSupportTokensMiscBalanceStatus)' + } + }, + /** + * Lookup30: polymesh_primitives::identity_id::IdentityId + **/ + PolymeshPrimitivesIdentityId: '[u8;32]', + /** + * Lookup32: polymesh_common_utilities::traits::balances::Memo + **/ + PolymeshCommonUtilitiesBalancesMemo: '[u8;32]', + /** + * Lookup33: frame_support::traits::tokens::misc::BalanceStatus + **/ + FrameSupportTokensMiscBalanceStatus: { + _enum: ['Free', 'Reserved'] + }, + /** + * Lookup34: polymesh_common_utilities::traits::identity::RawEvent + **/ + PolymeshCommonUtilitiesIdentityRawEvent: { + _enum: { + DidCreated: '(PolymeshPrimitivesIdentityId,AccountId32,Vec)', + SecondaryKeysAdded: '(PolymeshPrimitivesIdentityId,Vec)', + SecondaryKeysRemoved: '(PolymeshPrimitivesIdentityId,Vec)', + SecondaryKeyLeftIdentity: '(PolymeshPrimitivesIdentityId,AccountId32)', + SecondaryKeyPermissionsUpdated: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeyPermissions,PolymeshPrimitivesSecondaryKeyPermissions)', + PrimaryKeyUpdated: '(PolymeshPrimitivesIdentityId,AccountId32,AccountId32)', + ClaimAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityClaim)', + ClaimRevoked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityClaim)', + AssetDidRegistered: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + AuthorizationAdded: '(PolymeshPrimitivesIdentityId,Option,Option,u64,PolymeshPrimitivesAuthorizationAuthorizationData,Option)', + AuthorizationRevoked: '(Option,Option,u64)', + AuthorizationRejected: '(Option,Option,u64)', + AuthorizationConsumed: '(Option,Option,u64)', + CddRequirementForPrimaryKeyUpdated: 'bool', + CddClaimsInvalidated: '(PolymeshPrimitivesIdentityId,u64)', + SecondaryKeysFrozen: 'PolymeshPrimitivesIdentityId', + SecondaryKeysUnfrozen: 'PolymeshPrimitivesIdentityId' + } + }, + /** + * Lookup36: polymesh_primitives::secondary_key::SecondaryKey + **/ + PolymeshPrimitivesSecondaryKey: { + key: 'AccountId32', + permissions: 'PolymeshPrimitivesSecondaryKeyPermissions' + }, + /** + * Lookup37: polymesh_primitives::secondary_key::Permissions + **/ + PolymeshPrimitivesSecondaryKeyPermissions: { + asset: 'PolymeshPrimitivesSubsetSubsetRestrictionTicker', + extrinsic: 'PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', + portfolio: 'PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId' + }, + /** + * Lookup38: polymesh_primitives::subset::SubsetRestriction + **/ + PolymeshPrimitivesSubsetSubsetRestrictionTicker: { + _enum: { + Whole: 'Null', + These: 'BTreeSetTicker', + Except: 'BTreeSetTicker' + } + }, + /** + * Lookup39: polymesh_primitives::ticker::Ticker + **/ + PolymeshPrimitivesTicker: '[u8;12]', + /** + * Lookup41: BTreeSet + **/ + BTreeSetTicker: 'Vec', + /** + * Lookup43: polymesh_primitives::subset::SubsetRestriction + **/ + PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions: { + _enum: { + Whole: 'Null', + These: 'BTreeSetPalletPermissions', + Except: 'BTreeSetPalletPermissions' + } + }, + /** + * Lookup44: polymesh_primitives::secondary_key::PalletPermissions + **/ + PolymeshPrimitivesSecondaryKeyPalletPermissions: { + palletName: 'Bytes', + dispatchableNames: 'PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName' + }, + /** + * Lookup46: polymesh_primitives::subset::SubsetRestriction + **/ + PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName: { + _enum: { + Whole: 'Null', + These: 'BTreeSetDispatchableName', + Except: 'BTreeSetDispatchableName' + } + }, + /** + * Lookup48: BTreeSet + **/ + BTreeSetDispatchableName: 'Vec', + /** + * Lookup50: BTreeSet + **/ + BTreeSetPalletPermissions: 'Vec', + /** + * Lookup52: polymesh_primitives::subset::SubsetRestriction + **/ + PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId: { + _enum: { + Whole: 'Null', + These: 'BTreeSetPortfolioId', + Except: 'BTreeSetPortfolioId' + } + }, + /** + * Lookup53: polymesh_primitives::identity_id::PortfolioId + **/ + PolymeshPrimitivesIdentityIdPortfolioId: { + did: 'PolymeshPrimitivesIdentityId', + kind: 'PolymeshPrimitivesIdentityIdPortfolioKind' + }, + /** + * Lookup54: polymesh_primitives::identity_id::PortfolioKind + **/ + PolymeshPrimitivesIdentityIdPortfolioKind: { + _enum: { + Default: 'Null', + User: 'u64' + } + }, + /** + * Lookup56: BTreeSet + **/ + BTreeSetPortfolioId: 'Vec', + /** + * Lookup59: polymesh_primitives::identity_claim::IdentityClaim + **/ + PolymeshPrimitivesIdentityClaim: { + claimIssuer: 'PolymeshPrimitivesIdentityId', + issuanceDate: 'u64', + lastUpdateDate: 'u64', + expiry: 'Option', + claim: 'PolymeshPrimitivesIdentityClaimClaim' + }, + /** + * Lookup61: polymesh_primitives::identity_claim::Claim + **/ + PolymeshPrimitivesIdentityClaimClaim: { + _enum: { + Accredited: 'PolymeshPrimitivesIdentityClaimScope', + Affiliate: 'PolymeshPrimitivesIdentityClaimScope', + BuyLockup: 'PolymeshPrimitivesIdentityClaimScope', + SellLockup: 'PolymeshPrimitivesIdentityClaimScope', + CustomerDueDiligence: 'PolymeshPrimitivesCddId', + KnowYourCustomer: 'PolymeshPrimitivesIdentityClaimScope', + Jurisdiction: '(PolymeshPrimitivesJurisdictionCountryCode,PolymeshPrimitivesIdentityClaimScope)', + Exempted: 'PolymeshPrimitivesIdentityClaimScope', + Blocked: 'PolymeshPrimitivesIdentityClaimScope', + InvestorUniqueness: '(PolymeshPrimitivesIdentityClaimScope,PolymeshPrimitivesIdentityId,PolymeshPrimitivesCddId)', + NoData: 'Null', + InvestorUniquenessV2: 'PolymeshPrimitivesCddId' + } + }, + /** + * Lookup62: polymesh_primitives::identity_claim::Scope + **/ + PolymeshPrimitivesIdentityClaimScope: { + _enum: { + Identity: 'PolymeshPrimitivesIdentityId', + Ticker: 'PolymeshPrimitivesTicker', + Custom: 'Bytes' + } + }, + /** + * Lookup63: polymesh_primitives::cdd_id::CddId + **/ + PolymeshPrimitivesCddId: '[u8;32]', + /** + * Lookup64: polymesh_primitives::jurisdiction::CountryCode + **/ + PolymeshPrimitivesJurisdictionCountryCode: { + _enum: ['AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AI', 'AQ', 'AG', 'AR', 'AM', 'AW', 'AU', 'AT', 'AZ', 'BS', 'BH', 'BD', 'BB', 'BY', 'BE', 'BZ', 'BJ', 'BM', 'BT', 'BO', 'BA', 'BW', 'BV', 'BR', 'VG', 'IO', 'BN', 'BG', 'BF', 'BI', 'KH', 'CM', 'CA', 'CV', 'KY', 'CF', 'TD', 'CL', 'CN', 'HK', 'MO', 'CX', 'CC', 'CO', 'KM', 'CG', 'CD', 'CK', 'CR', 'CI', 'HR', 'CU', 'CY', 'CZ', 'DK', 'DJ', 'DM', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FK', 'FO', 'FJ', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GD', 'GP', 'GU', 'GT', 'GG', 'GN', 'GW', 'GY', 'HT', 'HM', 'VA', 'HN', 'HU', 'IS', 'IN', 'ID', 'IR', 'IQ', 'IE', 'IM', 'IL', 'IT', 'JM', 'JP', 'JE', 'JO', 'KZ', 'KE', 'KI', 'KP', 'KR', 'KW', 'KG', 'LA', 'LV', 'LB', 'LS', 'LR', 'LY', 'LI', 'LT', 'LU', 'MK', 'MG', 'MW', 'MY', 'MV', 'ML', 'MT', 'MH', 'MQ', 'MR', 'MU', 'YT', 'MX', 'FM', 'MD', 'MC', 'MN', 'ME', 'MS', 'MA', 'MZ', 'MM', 'NA', 'NR', 'NP', 'NL', 'AN', 'NC', 'NZ', 'NI', 'NE', 'NG', 'NU', 'NF', 'MP', 'NO', 'OM', 'PK', 'PW', 'PS', 'PA', 'PG', 'PY', 'PE', 'PH', 'PN', 'PL', 'PT', 'PR', 'QA', 'RE', 'RO', 'RU', 'RW', 'BL', 'SH', 'KN', 'LC', 'MF', 'PM', 'VC', 'WS', 'SM', 'ST', 'SA', 'SN', 'RS', 'SC', 'SL', 'SG', 'SK', 'SI', 'SB', 'SO', 'ZA', 'GS', 'SS', 'ES', 'LK', 'SD', 'SR', 'SJ', 'SZ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'TZ', 'TH', 'TL', 'TG', 'TK', 'TO', 'TT', 'TN', 'TR', 'TM', 'TC', 'TV', 'UG', 'UA', 'AE', 'GB', 'US', 'UM', 'UY', 'UZ', 'VU', 'VE', 'VN', 'VI', 'WF', 'EH', 'YE', 'ZM', 'ZW', 'BQ', 'CW', 'SX'] + }, + /** + * Lookup66: polymesh_primitives::authorization::AuthorizationData + **/ + PolymeshPrimitivesAuthorizationAuthorizationData: { + _enum: { + AttestPrimaryKeyRotation: 'PolymeshPrimitivesIdentityId', + RotatePrimaryKey: 'Null', + TransferTicker: 'PolymeshPrimitivesTicker', + AddMultiSigSigner: 'AccountId32', + TransferAssetOwnership: 'PolymeshPrimitivesTicker', + JoinIdentity: 'PolymeshPrimitivesSecondaryKeyPermissions', + PortfolioCustody: 'PolymeshPrimitivesIdentityIdPortfolioId', + BecomeAgent: '(PolymeshPrimitivesTicker,PolymeshPrimitivesAgentAgentGroup)', + AddRelayerPayingKey: '(AccountId32,AccountId32,u128)', + RotatePrimaryKeyToSecondary: 'PolymeshPrimitivesSecondaryKeyPermissions' + } + }, + /** + * Lookup67: polymesh_primitives::agent::AgentGroup + **/ + PolymeshPrimitivesAgentAgentGroup: { + _enum: { + Full: 'Null', + Custom: 'u32', + ExceptMeta: 'Null', + PolymeshV1CAA: 'Null', + PolymeshV1PIA: 'Null' + } + }, + /** + * Lookup70: polymesh_common_utilities::traits::group::RawEvent + **/ + PolymeshCommonUtilitiesGroupRawEventInstance2: { + _enum: { + MemberAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRevoked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersSwapped: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersReset: '(PolymeshPrimitivesIdentityId,Vec)', + ActiveLimitChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + Dummy: 'Null' + } + }, + /** + * Lookup71: pallet_group::Instance2 + **/ + PalletGroupInstance2: 'Null', + /** + * Lookup73: pallet_committee::RawEvent + **/ + PalletCommitteeRawEventInstance1: { + _enum: { + Proposed: '(PolymeshPrimitivesIdentityId,u32,H256)', + Voted: '(PolymeshPrimitivesIdentityId,u32,H256,bool,u32,u32,u32)', + VoteRetracted: '(PolymeshPrimitivesIdentityId,u32,H256,bool)', + FinalVotes: '(PolymeshPrimitivesIdentityId,u32,H256,Vec,Vec)', + Approved: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Rejected: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Executed: '(PolymeshPrimitivesIdentityId,H256,Result)', + ReleaseCoordinatorUpdated: '(PolymeshPrimitivesIdentityId,Option)', + ExpiresAfterUpdated: '(PolymeshPrimitivesIdentityId,PolymeshCommonUtilitiesMaybeBlock)', + VoteThresholdUpdated: '(PolymeshPrimitivesIdentityId,u32,u32)' + } + }, + /** + * Lookup74: pallet_committee::Instance1 + **/ + PalletCommitteeInstance1: 'Null', + /** + * Lookup77: polymesh_common_utilities::MaybeBlock + **/ + PolymeshCommonUtilitiesMaybeBlock: { + _enum: { + Some: 'u32', + None: 'Null' + } + }, + /** + * Lookup78: polymesh_common_utilities::traits::group::RawEvent + **/ + PolymeshCommonUtilitiesGroupRawEventInstance1: { + _enum: { + MemberAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRevoked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersSwapped: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersReset: '(PolymeshPrimitivesIdentityId,Vec)', + ActiveLimitChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + Dummy: 'Null' + } + }, + /** + * Lookup79: pallet_group::Instance1 + **/ + PalletGroupInstance1: 'Null', + /** + * Lookup80: pallet_committee::RawEvent + **/ + PalletCommitteeRawEventInstance3: { + _enum: { + Proposed: '(PolymeshPrimitivesIdentityId,u32,H256)', + Voted: '(PolymeshPrimitivesIdentityId,u32,H256,bool,u32,u32,u32)', + VoteRetracted: '(PolymeshPrimitivesIdentityId,u32,H256,bool)', + FinalVotes: '(PolymeshPrimitivesIdentityId,u32,H256,Vec,Vec)', + Approved: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Rejected: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Executed: '(PolymeshPrimitivesIdentityId,H256,Result)', + ReleaseCoordinatorUpdated: '(PolymeshPrimitivesIdentityId,Option)', + ExpiresAfterUpdated: '(PolymeshPrimitivesIdentityId,PolymeshCommonUtilitiesMaybeBlock)', + VoteThresholdUpdated: '(PolymeshPrimitivesIdentityId,u32,u32)' + } + }, + /** + * Lookup81: pallet_committee::Instance3 + **/ + PalletCommitteeInstance3: 'Null', + /** + * Lookup82: polymesh_common_utilities::traits::group::RawEvent + **/ + PolymeshCommonUtilitiesGroupRawEventInstance3: { + _enum: { + MemberAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRevoked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersSwapped: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersReset: '(PolymeshPrimitivesIdentityId,Vec)', + ActiveLimitChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + Dummy: 'Null' + } + }, + /** + * Lookup83: pallet_group::Instance3 + **/ + PalletGroupInstance3: 'Null', + /** + * Lookup84: pallet_committee::RawEvent + **/ + PalletCommitteeRawEventInstance4: { + _enum: { + Proposed: '(PolymeshPrimitivesIdentityId,u32,H256)', + Voted: '(PolymeshPrimitivesIdentityId,u32,H256,bool,u32,u32,u32)', + VoteRetracted: '(PolymeshPrimitivesIdentityId,u32,H256,bool)', + FinalVotes: '(PolymeshPrimitivesIdentityId,u32,H256,Vec,Vec)', + Approved: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Rejected: '(PolymeshPrimitivesIdentityId,H256,u32,u32,u32)', + Executed: '(PolymeshPrimitivesIdentityId,H256,Result)', + ReleaseCoordinatorUpdated: '(PolymeshPrimitivesIdentityId,Option)', + ExpiresAfterUpdated: '(PolymeshPrimitivesIdentityId,PolymeshCommonUtilitiesMaybeBlock)', + VoteThresholdUpdated: '(PolymeshPrimitivesIdentityId,u32,u32)' + } + }, + /** + * Lookup85: pallet_committee::Instance4 + **/ + PalletCommitteeInstance4: 'Null', + /** + * Lookup86: polymesh_common_utilities::traits::group::RawEvent + **/ + PolymeshCommonUtilitiesGroupRawEventInstance4: { + _enum: { + MemberAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MemberRevoked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersSwapped: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + MembersReset: '(PolymeshPrimitivesIdentityId,Vec)', + ActiveLimitChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + Dummy: 'Null' + } + }, + /** + * Lookup87: pallet_group::Instance4 + **/ + PalletGroupInstance4: 'Null', + /** + * Lookup88: pallet_multisig::RawEvent + **/ + PalletMultisigRawEvent: { + _enum: { + MultiSigCreated: '(PolymeshPrimitivesIdentityId,AccountId32,AccountId32,Vec,u64)', + ProposalAdded: '(PolymeshPrimitivesIdentityId,AccountId32,u64)', + ProposalExecuted: '(PolymeshPrimitivesIdentityId,AccountId32,u64,bool)', + MultiSigSignerAdded: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeySignatory)', + MultiSigSignerAuthorized: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeySignatory)', + MultiSigSignerRemoved: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeySignatory)', + MultiSigSignaturesRequiredChanged: '(PolymeshPrimitivesIdentityId,AccountId32,u64)', + ProposalApproved: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeySignatory,u64)', + ProposalRejectionVote: '(PolymeshPrimitivesIdentityId,AccountId32,PolymeshPrimitivesSecondaryKeySignatory,u64)', + ProposalRejected: '(PolymeshPrimitivesIdentityId,AccountId32,u64)', + ProposalExecutionFailed: 'SpRuntimeDispatchError', + SchedulingFailed: 'SpRuntimeDispatchError' + } + }, + /** + * Lookup90: polymesh_primitives::secondary_key::Signatory + **/ + PolymeshPrimitivesSecondaryKeySignatory: { + _enum: { + Identity: 'PolymeshPrimitivesIdentityId', + Account: 'AccountId32' + } + }, + /** + * Lookup91: pallet_bridge::RawEvent + **/ + PalletBridgeRawEvent: { + _enum: { + ControllerChanged: '(PolymeshPrimitivesIdentityId,AccountId32)', + AdminChanged: '(PolymeshPrimitivesIdentityId,AccountId32)', + TimelockChanged: '(PolymeshPrimitivesIdentityId,u32)', + Bridged: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx)', + Frozen: 'PolymeshPrimitivesIdentityId', + Unfrozen: 'PolymeshPrimitivesIdentityId', + FrozenTx: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx)', + UnfrozenTx: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx)', + ExemptedUpdated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,bool)', + BridgeLimitUpdated: '(PolymeshPrimitivesIdentityId,u128,u32)', + TxsHandled: 'Vec<(AccountId32,u32,PalletBridgeHandledTxStatus)>', + BridgeTxScheduled: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx,u32)', + BridgeTxScheduleFailed: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx,Bytes)', + FreezeAdminAdded: '(PolymeshPrimitivesIdentityId,AccountId32)', + FreezeAdminRemoved: '(PolymeshPrimitivesIdentityId,AccountId32)', + TxRemoved: '(PolymeshPrimitivesIdentityId,PalletBridgeBridgeTx)' + } + }, + /** + * Lookup92: pallet_bridge::BridgeTx + **/ + PalletBridgeBridgeTx: { + nonce: 'u32', + recipient: 'AccountId32', + amount: 'u128', + txHash: 'H256' + }, + /** + * Lookup95: pallet_bridge::HandledTxStatus + **/ + PalletBridgeHandledTxStatus: { + _enum: { + Success: 'Null', + Error: 'Bytes' + } + }, + /** + * Lookup96: pallet_staking::RawEvent + **/ + PalletStakingRawEvent: { + _enum: { + EraPayout: '(u32,u128,u128)', + Reward: '(PolymeshPrimitivesIdentityId,AccountId32,u128)', + Slash: '(AccountId32,u128)', + OldSlashingReportDiscarded: 'u32', + StakingElection: 'PalletStakingElectionCompute', + SolutionStored: 'PalletStakingElectionCompute', + Bonded: '(PolymeshPrimitivesIdentityId,AccountId32,u128)', + Unbonded: '(PolymeshPrimitivesIdentityId,AccountId32,u128)', + Nominated: '(PolymeshPrimitivesIdentityId,AccountId32,Vec)', + Withdrawn: '(AccountId32,u128)', + PermissionedIdentityAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + PermissionedIdentityRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId)', + InvalidatedNominators: '(PolymeshPrimitivesIdentityId,AccountId32,Vec)', + CommissionCapUpdated: '(PolymeshPrimitivesIdentityId,Perbill,Perbill)', + MinimumBondThresholdUpdated: '(Option,u128)', + RewardPaymentSchedulingInterrupted: '(AccountId32,u32,SpRuntimeDispatchError)', + SlashingAllowedForChanged: 'PalletStakingSlashingSwitch' + } + }, + /** + * Lookup97: pallet_staking::ElectionCompute + **/ + PalletStakingElectionCompute: { + _enum: ['OnChain', 'Signed', 'Unsigned'] + }, + /** + * Lookup99: pallet_staking::SlashingSwitch + **/ + PalletStakingSlashingSwitch: { + _enum: ['Validator', 'ValidatorAndNominator', 'None'] + }, + /** + * Lookup100: pallet_offences::pallet::Event + **/ + PalletOffencesEvent: { + _enum: { + Offence: { + kind: '[u8;16]', + timeslot: 'Bytes' + } + } + }, + /** + * Lookup102: pallet_session::pallet::Event + **/ + PalletSessionEvent: { + _enum: { + NewSession: { + sessionIndex: 'u32' + } + } + }, + /** + * Lookup103: pallet_grandpa::pallet::Event + **/ + PalletGrandpaEvent: { + _enum: { + NewAuthorities: { + authoritySet: 'Vec<(SpFinalityGrandpaAppPublic,u64)>', + }, + Paused: 'Null', + Resumed: 'Null' + } + }, + /** + * Lookup106: sp_finality_grandpa::app::Public + **/ + SpFinalityGrandpaAppPublic: 'SpCoreEd25519Public', + /** + * Lookup107: sp_core::ed25519::Public + **/ + SpCoreEd25519Public: '[u8;32]', + /** + * Lookup108: pallet_im_online::pallet::Event + **/ + PalletImOnlineEvent: { + _enum: { + HeartbeatReceived: { + authorityId: 'PalletImOnlineSr25519AppSr25519Public', + }, + AllGood: 'Null', + SomeOffline: { + offline: 'Vec<(AccountId32,PalletStakingExposure)>' + } + } + }, + /** + * Lookup109: pallet_im_online::sr25519::app_sr25519::Public + **/ + PalletImOnlineSr25519AppSr25519Public: 'SpCoreSr25519Public', + /** + * Lookup110: sp_core::sr25519::Public + **/ + SpCoreSr25519Public: '[u8;32]', + /** + * Lookup113: pallet_staking::Exposure + **/ + PalletStakingExposure: { + total: 'Compact', + own: 'Compact', + others: 'Vec' + }, + /** + * Lookup116: pallet_staking::IndividualExposure + **/ + PalletStakingIndividualExposure: { + who: 'AccountId32', + value: 'Compact' + }, + /** + * Lookup117: pallet_sudo::RawEvent + **/ + PalletSudoRawEvent: { + _enum: { + Sudid: 'Result', + KeyChanged: 'AccountId32', + SudoAsDone: 'Result' + } + }, + /** + * Lookup118: polymesh_common_utilities::traits::asset::RawEvent + **/ + PolymeshCommonUtilitiesAssetRawEvent: { + _enum: { + Transfer: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityIdPortfolioId,PolymeshPrimitivesIdentityIdPortfolioId,u128)', + Issued: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId,u128,Bytes,u128)', + Redeemed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId,u128)', + AssetCreated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,bool,PolymeshPrimitivesAssetAssetType,PolymeshPrimitivesIdentityId,bool)', + IdentifiersUpdated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Vec)', + DivisibilityChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,bool)', + TransferWithData: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,u128,Bytes)', + IsIssuable: '(PolymeshPrimitivesTicker,bool)', + TickerRegistered: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Option)', + TickerTransferred: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId)', + AssetOwnershipTransferred: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId)', + AssetFrozen: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + AssetUnfrozen: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + AssetRenamed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Bytes)', + FundingRoundSet: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Bytes)', + DocumentAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,u32,PolymeshPrimitivesDocument)', + DocumentRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,u32)', + ExtensionRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,AccountId32)', + ClassicTickerClaimed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesEthereumEthereumAddress)', + ControllerTransfer: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityIdPortfolioId,u128)', + CustomAssetTypeExists: '(PolymeshPrimitivesIdentityId,u32,Bytes)', + CustomAssetTypeRegistered: '(PolymeshPrimitivesIdentityId,u32,Bytes)', + SetAssetMetadataValue: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Bytes,Option)', + SetAssetMetadataValueDetails: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail)', + RegisterAssetMetadataLocalType: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Bytes,u64,PolymeshPrimitivesAssetMetadataAssetMetadataSpec)', + RegisterAssetMetadataGlobalType: '(Bytes,u64,PolymeshPrimitivesAssetMetadataAssetMetadataSpec)' + } + }, + /** + * Lookup120: polymesh_primitives::asset::AssetType + **/ + PolymeshPrimitivesAssetAssetType: { + _enum: { + EquityCommon: 'Null', + EquityPreferred: 'Null', + Commodity: 'Null', + FixedIncome: 'Null', + REIT: 'Null', + Fund: 'Null', + RevenueShareAgreement: 'Null', + StructuredProduct: 'Null', + Derivative: 'Null', + Custom: 'u32', + StableCoin: 'Null' + } + }, + /** + * Lookup123: polymesh_primitives::asset_identifier::AssetIdentifier + **/ + PolymeshPrimitivesAssetIdentifier: { + _enum: { + CUSIP: '[u8;9]', + CINS: '[u8;9]', + ISIN: '[u8;12]', + LEI: '[u8;20]', + FIGI: '[u8;12]' + } + }, + /** + * Lookup128: polymesh_primitives::document::Document + **/ + PolymeshPrimitivesDocument: { + uri: 'Bytes', + contentHash: 'PolymeshPrimitivesDocumentHash', + name: 'Bytes', + docType: 'Option', + filingDate: 'Option' + }, + /** + * Lookup130: polymesh_primitives::document_hash::DocumentHash + **/ + PolymeshPrimitivesDocumentHash: { + _enum: { + None: 'Null', + H512: '[u8;64]', + H384: '[u8;48]', + H320: '[u8;40]', + H256: '[u8;32]', + H224: '[u8;28]', + H192: '[u8;24]', + H160: '[u8;20]', + H128: '[u8;16]' + } + }, + /** + * Lookup139: polymesh_primitives::ethereum::EthereumAddress + **/ + PolymeshPrimitivesEthereumEthereumAddress: '[u8;20]', + /** + * Lookup142: polymesh_primitives::asset_metadata::AssetMetadataValueDetail + **/ + PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail: { + expire: 'Option', + lockStatus: 'PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus' + }, + /** + * Lookup143: polymesh_primitives::asset_metadata::AssetMetadataLockStatus + **/ + PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus: { + _enum: { + Unlocked: 'Null', + Locked: 'Null', + LockedUntil: 'u64' + } + }, + /** + * Lookup146: polymesh_primitives::asset_metadata::AssetMetadataSpec + **/ + PolymeshPrimitivesAssetMetadataAssetMetadataSpec: { + url: 'Option', + description: 'Option', + typeDef: 'Option' + }, + /** + * Lookup153: pallet_corporate_actions::distribution::Event + **/ + PalletCorporateActionsDistributionEvent: { + _enum: { + Created: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId,PalletCorporateActionsDistribution)', + BenefitClaimed: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId,PalletCorporateActionsDistribution,u128,Permill)', + Reclaimed: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId,u128)', + Removed: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId)' + } + }, + /** + * Lookup154: polymesh_primitives::event_only::EventOnly + **/ + PolymeshPrimitivesEventOnly: 'PolymeshPrimitivesIdentityId', + /** + * Lookup155: pallet_corporate_actions::CAId + **/ + PalletCorporateActionsCaId: { + ticker: 'PolymeshPrimitivesTicker', + localId: 'u32' + }, + /** + * Lookup157: pallet_corporate_actions::distribution::Distribution + **/ + PalletCorporateActionsDistribution: { + from: 'PolymeshPrimitivesIdentityIdPortfolioId', + currency: 'PolymeshPrimitivesTicker', + perShare: 'u128', + amount: 'u128', + remaining: 'u128', + reclaimed: 'bool', + paymentAt: 'u64', + expiresAt: 'Option' + }, + /** + * Lookup159: polymesh_common_utilities::traits::checkpoint::Event + **/ + PolymeshCommonUtilitiesCheckpointEvent: { + _enum: { + CheckpointCreated: '(Option,PolymeshPrimitivesTicker,u64,u128,u64)', + MaximumSchedulesComplexityChanged: '(PolymeshPrimitivesIdentityId,u64)', + ScheduleCreated: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,PolymeshCommonUtilitiesCheckpointStoredSchedule)', + ScheduleRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshCommonUtilitiesCheckpointStoredSchedule)' + } + }, + /** + * Lookup162: polymesh_common_utilities::traits::checkpoint::StoredSchedule + **/ + PolymeshCommonUtilitiesCheckpointStoredSchedule: { + schedule: 'PolymeshPrimitivesCalendarCheckpointSchedule', + id: 'u64', + at: 'u64', + remaining: 'u32' + }, + /** + * Lookup163: polymesh_primitives::calendar::CheckpointSchedule + **/ + PolymeshPrimitivesCalendarCheckpointSchedule: { + start: 'u64', + period: 'PolymeshPrimitivesCalendarCalendarPeriod' + }, + /** + * Lookup164: polymesh_primitives::calendar::CalendarPeriod + **/ + PolymeshPrimitivesCalendarCalendarPeriod: { + unit: 'PolymeshPrimitivesCalendarCalendarUnit', + amount: 'u64' + }, + /** + * Lookup165: polymesh_primitives::calendar::CalendarUnit + **/ + PolymeshPrimitivesCalendarCalendarUnit: { + _enum: ['Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'] + }, + /** + * Lookup167: pallet_compliance_manager::Event + **/ + PalletComplianceManagerEvent: { + _enum: { + ComplianceRequirementCreated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesComplianceManagerComplianceRequirement)', + ComplianceRequirementRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,u32)', + AssetComplianceReplaced: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Vec)', + AssetComplianceReset: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + AssetComplianceResumed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + AssetCompliancePaused: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker)', + ComplianceRequirementChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesComplianceManagerComplianceRequirement)', + TrustedDefaultClaimIssuerAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesConditionTrustedIssuer)', + TrustedDefaultClaimIssuerRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId)' + } + }, + /** + * Lookup168: polymesh_primitives::compliance_manager::ComplianceRequirement + **/ + PolymeshPrimitivesComplianceManagerComplianceRequirement: { + senderConditions: 'Vec', + receiverConditions: 'Vec', + id: 'u32' + }, + /** + * Lookup170: polymesh_primitives::condition::Condition + **/ + PolymeshPrimitivesCondition: { + conditionType: 'PolymeshPrimitivesConditionConditionType', + issuers: 'Vec' + }, + /** + * Lookup171: polymesh_primitives::condition::ConditionType + **/ + PolymeshPrimitivesConditionConditionType: { + _enum: { + IsPresent: 'PolymeshPrimitivesIdentityClaimClaim', + IsAbsent: 'PolymeshPrimitivesIdentityClaimClaim', + IsAnyOf: 'Vec', + IsNoneOf: 'Vec', + IsIdentity: 'PolymeshPrimitivesConditionTargetIdentity' + } + }, + /** + * Lookup173: polymesh_primitives::condition::TargetIdentity + **/ + PolymeshPrimitivesConditionTargetIdentity: { + _enum: { + ExternalAgent: 'Null', + Specific: 'PolymeshPrimitivesIdentityId' + } + }, + /** + * Lookup175: polymesh_primitives::condition::TrustedIssuer + **/ + PolymeshPrimitivesConditionTrustedIssuer: { + issuer: 'PolymeshPrimitivesIdentityId', + trustedFor: 'PolymeshPrimitivesConditionTrustedFor' + }, + /** + * Lookup176: polymesh_primitives::condition::TrustedFor + **/ + PolymeshPrimitivesConditionTrustedFor: { + _enum: { + Any: 'Null', + Specific: 'Vec' + } + }, + /** + * Lookup178: polymesh_primitives::identity_claim::ClaimType + **/ + PolymeshPrimitivesIdentityClaimClaimType: { + _enum: ['Accredited', 'Affiliate', 'BuyLockup', 'SellLockup', 'CustomerDueDiligence', 'KnowYourCustomer', 'Jurisdiction', 'Exempted', 'Blocked', 'InvestorUniqueness', 'NoType', 'InvestorUniquenessV2'] + }, + /** + * Lookup180: pallet_corporate_actions::Event + **/ + PalletCorporateActionsEvent: { + _enum: { + MaxDetailsLengthChanged: '(PolymeshPrimitivesIdentityId,u32)', + DefaultTargetIdentitiesChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PalletCorporateActionsTargetIdentities)', + DefaultWithholdingTaxChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Permill)', + DidWithholdingTaxChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId,Option)', + CAATransferred: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId)', + CAInitiated: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId,PalletCorporateActionsCorporateAction,Bytes)', + CALinkedToDoc: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,Vec)', + CARemoved: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId)', + RecordDateChanged: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId,PalletCorporateActionsCorporateAction)' + } + }, + /** + * Lookup181: pallet_corporate_actions::TargetIdentities + **/ + PalletCorporateActionsTargetIdentities: { + identities: 'Vec', + treatment: 'PalletCorporateActionsTargetTreatment' + }, + /** + * Lookup182: pallet_corporate_actions::TargetTreatment + **/ + PalletCorporateActionsTargetTreatment: { + _enum: ['Include', 'Exclude'] + }, + /** + * Lookup184: pallet_corporate_actions::CorporateAction + **/ + PalletCorporateActionsCorporateAction: { + kind: 'PalletCorporateActionsCaKind', + declDate: 'u64', + recordDate: 'Option', + targets: 'PalletCorporateActionsTargetIdentities', + defaultWithholdingTax: 'Permill', + withholdingTax: 'Vec<(PolymeshPrimitivesIdentityId,Permill)>' + }, + /** + * Lookup185: pallet_corporate_actions::CAKind + **/ + PalletCorporateActionsCaKind: { + _enum: ['PredictableBenefit', 'UnpredictableBenefit', 'IssuerNotice', 'Reorganization', 'Other'] + }, + /** + * Lookup187: pallet_corporate_actions::RecordDate + **/ + PalletCorporateActionsRecordDate: { + date: 'u64', + checkpoint: 'PalletCorporateActionsCaCheckpoint' + }, + /** + * Lookup188: pallet_corporate_actions::CACheckpoint + **/ + PalletCorporateActionsCaCheckpoint: { + _enum: { + Scheduled: '(u64,u64)', + Existing: 'u64' + } + }, + /** + * Lookup193: pallet_corporate_actions::ballot::Event + **/ + PalletCorporateActionsBallotEvent: { + _enum: { + Created: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,PalletCorporateActionsBallotBallotTimeRange,PalletCorporateActionsBallotBallotMeta,bool)', + VoteCast: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,Vec)', + RangeChanged: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,PalletCorporateActionsBallotBallotTimeRange)', + MetaChanged: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,PalletCorporateActionsBallotBallotMeta)', + RCVChanged: '(PolymeshPrimitivesIdentityId,PalletCorporateActionsCaId,bool)', + Removed: '(PolymeshPrimitivesEventOnly,PalletCorporateActionsCaId)' + } + }, + /** + * Lookup194: pallet_corporate_actions::ballot::BallotTimeRange + **/ + PalletCorporateActionsBallotBallotTimeRange: { + start: 'u64', + end: 'u64' + }, + /** + * Lookup195: pallet_corporate_actions::ballot::BallotMeta + **/ + PalletCorporateActionsBallotBallotMeta: { + title: 'Bytes', + motions: 'Vec' + }, + /** + * Lookup198: pallet_corporate_actions::ballot::Motion + **/ + PalletCorporateActionsBallotMotion: { + title: 'Bytes', + infoLink: 'Bytes', + choices: 'Vec' + }, + /** + * Lookup204: pallet_corporate_actions::ballot::BallotVote + **/ + PalletCorporateActionsBallotBallotVote: { + power: 'u128', + fallback: 'Option' + }, + /** + * Lookup207: pallet_pips::RawEvent + **/ + PalletPipsRawEvent: { + _enum: { + HistoricalPipsPruned: '(PolymeshPrimitivesIdentityId,bool,bool)', + ProposalCreated: '(PolymeshPrimitivesIdentityId,PalletPipsProposer,u32,u128,Option,Option,PolymeshCommonUtilitiesMaybeBlock,PalletPipsProposalData)', + ProposalStateUpdated: '(PolymeshPrimitivesIdentityId,u32,PalletPipsProposalState)', + Voted: '(PolymeshPrimitivesIdentityId,AccountId32,u32,bool,u128)', + PipClosed: '(PolymeshPrimitivesIdentityId,u32,bool)', + ExecutionScheduled: '(PolymeshPrimitivesIdentityId,u32,u32)', + DefaultEnactmentPeriodChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + MinimumProposalDepositChanged: '(PolymeshPrimitivesIdentityId,u128,u128)', + PendingPipExpiryChanged: '(PolymeshPrimitivesIdentityId,PolymeshCommonUtilitiesMaybeBlock,PolymeshCommonUtilitiesMaybeBlock)', + MaxPipSkipCountChanged: '(PolymeshPrimitivesIdentityId,u8,u8)', + ActivePipLimitChanged: '(PolymeshPrimitivesIdentityId,u32,u32)', + ProposalRefund: '(PolymeshPrimitivesIdentityId,u32,u128)', + SnapshotCleared: '(PolymeshPrimitivesIdentityId,u32)', + SnapshotTaken: '(PolymeshPrimitivesIdentityId,u32,Vec)', + PipSkipped: '(PolymeshPrimitivesIdentityId,u32,u8)', + SnapshotResultsEnacted: '(PolymeshPrimitivesIdentityId,Option,Vec<(u32,u8)>,Vec,Vec)', + ExecutionSchedulingFailed: '(PolymeshPrimitivesIdentityId,u32,u32)', + ExpiryScheduled: '(PolymeshPrimitivesIdentityId,u32,u32)', + ExpirySchedulingFailed: '(PolymeshPrimitivesIdentityId,u32,u32)', + ExecutionCancellingFailed: 'u32' + } + }, + /** + * Lookup208: pallet_pips::Proposer + **/ + PalletPipsProposer: { + _enum: { + Community: 'AccountId32', + Committee: 'PalletPipsCommittee' + } + }, + /** + * Lookup209: pallet_pips::Committee + **/ + PalletPipsCommittee: { + _enum: ['Technical', 'Upgrade'] + }, + /** + * Lookup213: pallet_pips::ProposalData + **/ + PalletPipsProposalData: { + _enum: { + Hash: 'H256', + Proposal: 'Bytes' + } + }, + /** + * Lookup214: pallet_pips::ProposalState + **/ + PalletPipsProposalState: { + _enum: ['Pending', 'Rejected', 'Scheduled', 'Failed', 'Executed', 'Expired'] + }, + /** + * Lookup217: pallet_pips::SnapshottedPip + **/ + PalletPipsSnapshottedPip: { + id: 'u32', + weight: '(bool,u128)' + }, + /** + * Lookup223: polymesh_common_utilities::traits::portfolio::Event + **/ + PolymeshCommonUtilitiesPortfolioEvent: { + _enum: { + PortfolioCreated: '(PolymeshPrimitivesIdentityId,u64,Bytes)', + PortfolioDeleted: '(PolymeshPrimitivesIdentityId,u64)', + MovedBetweenPortfolios: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityIdPortfolioId,PolymeshPrimitivesIdentityIdPortfolioId,PolymeshPrimitivesTicker,u128,Option)', + PortfolioRenamed: '(PolymeshPrimitivesIdentityId,u64,Bytes)', + UserPortfolios: '(PolymeshPrimitivesIdentityId,Vec<(u64,Bytes)>)', + PortfolioCustodianChanged: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityIdPortfolioId,PolymeshPrimitivesIdentityId)' + } + }, + /** + * Lookup227: pallet_protocol_fee::RawEvent + **/ + PalletProtocolFeeRawEvent: { + _enum: { + FeeSet: '(PolymeshPrimitivesIdentityId,u128)', + CoefficientSet: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesPosRatio)', + FeeCharged: '(AccountId32,u128)' + } + }, + /** + * Lookup228: polymesh_primitives::PosRatio + **/ + PolymeshPrimitivesPosRatio: '(u32,u32)', + /** + * Lookup229: pallet_scheduler::pallet::Event + **/ + PalletSchedulerEvent: { + _enum: { + Scheduled: { + when: 'u32', + index: 'u32', + }, + Canceled: { + when: 'u32', + index: 'u32', + }, + Dispatched: { + task: '(u32,u32)', + id: 'Option', + result: 'Result', + }, + CallLookupFailed: { + task: '(u32,u32)', + id: 'Option', + error: 'FrameSupportScheduleLookupError' + } + } + }, + /** + * Lookup231: frame_support::traits::schedule::LookupError + **/ + FrameSupportScheduleLookupError: { + _enum: ['Unknown', 'BadFormat'] + }, + /** + * Lookup232: pallet_settlement::RawEvent + **/ + PalletSettlementRawEvent: { + _enum: { + VenueCreated: '(PolymeshPrimitivesIdentityId,u64,Bytes,PalletSettlementVenueType)', + VenueDetailsUpdated: '(PolymeshPrimitivesIdentityId,u64,Bytes)', + VenueTypeUpdated: '(PolymeshPrimitivesIdentityId,u64,PalletSettlementVenueType)', + InstructionCreated: '(PolymeshPrimitivesIdentityId,u64,u64,PalletSettlementSettlementType,Option,Option,Vec)', + InstructionAffirmed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityIdPortfolioId,u64)', + AffirmationWithdrawn: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityIdPortfolioId,u64)', + InstructionRejected: '(PolymeshPrimitivesIdentityId,u64)', + ReceiptClaimed: '(PolymeshPrimitivesIdentityId,u64,u64,u64,AccountId32,Bytes)', + ReceiptValidityChanged: '(PolymeshPrimitivesIdentityId,AccountId32,u64,bool)', + ReceiptUnclaimed: '(PolymeshPrimitivesIdentityId,u64,u64,u64,AccountId32)', + VenueFiltering: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,bool)', + VenuesAllowed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Vec)', + VenuesBlocked: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,Vec)', + LegFailedExecution: '(PolymeshPrimitivesIdentityId,u64,u64)', + InstructionFailed: '(PolymeshPrimitivesIdentityId,u64)', + InstructionExecuted: '(PolymeshPrimitivesIdentityId,u64)', + VenueUnauthorized: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTicker,u64)', + SchedulingFailed: 'SpRuntimeDispatchError', + InstructionRescheduled: '(PolymeshPrimitivesIdentityId,u64)' + } + }, + /** + * Lookup235: pallet_settlement::VenueType + **/ + PalletSettlementVenueType: { + _enum: ['Other', 'Distribution', 'Sto', 'Exchange'] + }, + /** + * Lookup237: pallet_settlement::SettlementType + **/ + PalletSettlementSettlementType: { + _enum: { + SettleOnAffirmation: 'Null', + SettleOnBlock: 'u32' + } + }, + /** + * Lookup239: pallet_settlement::Leg + **/ + PalletSettlementLeg: { + from: 'PolymeshPrimitivesIdentityIdPortfolioId', + to: 'PolymeshPrimitivesIdentityIdPortfolioId', + asset: 'PolymeshPrimitivesTicker', + amount: 'u128' + }, + /** + * Lookup243: polymesh_common_utilities::traits::statistics::Event + **/ + PolymeshCommonUtilitiesStatisticsEvent: { + _enum: { + StatTypesAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesStatisticsAssetScope,Vec)', + StatTypesRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesStatisticsAssetScope,Vec)', + AssetStatsUpdated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesStatisticsAssetScope,PolymeshPrimitivesStatisticsStatType,Vec)', + SetAssetTransferCompliance: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesStatisticsAssetScope,Vec)', + TransferConditionExemptionsAdded: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTransferComplianceTransferConditionExemptKey,Vec)', + TransferConditionExemptionsRemoved: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesTransferComplianceTransferConditionExemptKey,Vec)' + } + }, + /** + * Lookup244: polymesh_primitives::statistics::AssetScope + **/ + PolymeshPrimitivesStatisticsAssetScope: { + _enum: { + Ticker: 'PolymeshPrimitivesTicker' + } + }, + /** + * Lookup246: polymesh_primitives::statistics::StatType + **/ + PolymeshPrimitivesStatisticsStatType: { + op: 'PolymeshPrimitivesStatisticsStatOpType', + claimIssuer: 'Option<(PolymeshPrimitivesIdentityClaimClaimType,PolymeshPrimitivesIdentityId)>' + }, + /** + * Lookup247: polymesh_primitives::statistics::StatOpType + **/ + PolymeshPrimitivesStatisticsStatOpType: { + _enum: ['Count', 'Balance'] + }, + /** + * Lookup251: polymesh_primitives::statistics::StatUpdate + **/ + PolymeshPrimitivesStatisticsStatUpdate: { + key2: 'PolymeshPrimitivesStatisticsStat2ndKey', + value: 'Option' + }, + /** + * Lookup252: polymesh_primitives::statistics::Stat2ndKey + **/ + PolymeshPrimitivesStatisticsStat2ndKey: { + _enum: { + NoClaimStat: 'Null', + Claim: 'PolymeshPrimitivesStatisticsStatClaim' + } + }, + /** + * Lookup253: polymesh_primitives::statistics::StatClaim + **/ + PolymeshPrimitivesStatisticsStatClaim: { + _enum: { + Accredited: 'bool', + Affiliate: 'bool', + Jurisdiction: 'Option' + } + }, + /** + * Lookup257: polymesh_primitives::transfer_compliance::TransferCondition + **/ + PolymeshPrimitivesTransferComplianceTransferCondition: { + _enum: { + MaxInvestorCount: 'u64', + MaxInvestorOwnership: 'Permill', + ClaimCount: '(PolymeshPrimitivesStatisticsStatClaim,PolymeshPrimitivesIdentityId,u64,Option)', + ClaimOwnership: '(PolymeshPrimitivesStatisticsStatClaim,PolymeshPrimitivesIdentityId,Permill,Permill)' + } + }, + /** + * Lookup259: polymesh_primitives::transfer_compliance::TransferConditionExemptKey + **/ + PolymeshPrimitivesTransferComplianceTransferConditionExemptKey: { + asset: 'PolymeshPrimitivesStatisticsAssetScope', + op: 'PolymeshPrimitivesStatisticsStatOpType', + claimType: 'Option' + }, + /** + * Lookup261: pallet_sto::RawEvent + **/ + PalletStoRawEvent: { + _enum: { + FundraiserCreated: '(PolymeshPrimitivesIdentityId,u64,Bytes,PalletStoFundraiser)', + Invested: '(PolymeshPrimitivesIdentityId,u64,PolymeshPrimitivesTicker,PolymeshPrimitivesTicker,u128,u128)', + FundraiserFrozen: '(PolymeshPrimitivesIdentityId,u64)', + FundraiserUnfrozen: '(PolymeshPrimitivesIdentityId,u64)', + FundraiserWindowModified: '(PolymeshPrimitivesEventOnly,u64,u64,Option,u64,Option)', + FundraiserClosed: '(PolymeshPrimitivesIdentityId,u64)' + } + }, + /** + * Lookup264: pallet_sto::Fundraiser + **/ + PalletStoFundraiser: { + creator: 'PolymeshPrimitivesIdentityId', + offeringPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + offeringAsset: 'PolymeshPrimitivesTicker', + raisingPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + raisingAsset: 'PolymeshPrimitivesTicker', + tiers: 'Vec', + venueId: 'u64', + start: 'u64', + end: 'Option', + status: 'PalletStoFundraiserStatus', + minimumInvestment: 'u128' + }, + /** + * Lookup266: pallet_sto::FundraiserTier + **/ + PalletStoFundraiserTier: { + total: 'u128', + price: 'u128', + remaining: 'u128' + }, + /** + * Lookup267: pallet_sto::FundraiserStatus + **/ + PalletStoFundraiserStatus: { + _enum: ['Live', 'Frozen', 'Closed', 'ClosedEarly'] + }, + /** + * Lookup268: pallet_treasury::RawEvent + **/ + PalletTreasuryRawEvent: { + _enum: { + TreasuryDisbursement: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,AccountId32,u128)', + TreasuryDisbursementFailed: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesIdentityId,AccountId32,u128)', + TreasuryReimbursement: '(PolymeshPrimitivesIdentityId,u128)' + } + }, + /** + * Lookup269: pallet_utility::Event + **/ + PalletUtilityEvent: { + _enum: { + BatchInterrupted: '(Vec,(u32,SpRuntimeDispatchError))', + BatchOptimisticFailed: '(Vec,Vec<(u32,SpRuntimeDispatchError)>)', + BatchCompleted: 'Vec' + } + }, + /** + * Lookup273: polymesh_common_utilities::traits::base::Event + **/ + PolymeshCommonUtilitiesBaseEvent: { + _enum: { + UnexpectedError: 'Option' + } + }, + /** + * Lookup275: polymesh_common_utilities::traits::external_agents::Event + **/ + PolymeshCommonUtilitiesExternalAgentsEvent: { + _enum: { + GroupCreated: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,u32,PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions)', + GroupPermissionsUpdated: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,u32,PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions)', + AgentAdded: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,PolymeshPrimitivesAgentAgentGroup)', + AgentRemoved: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId)', + GroupChanged: '(PolymeshPrimitivesEventOnly,PolymeshPrimitivesTicker,PolymeshPrimitivesIdentityId,PolymeshPrimitivesAgentAgentGroup)' + } + }, + /** + * Lookup276: polymesh_common_utilities::traits::relayer::RawEvent + **/ + PolymeshCommonUtilitiesRelayerRawEvent: { + _enum: { + AuthorizedPayingKey: '(PolymeshPrimitivesEventOnly,AccountId32,AccountId32,u128,u64)', + AcceptedPayingKey: '(PolymeshPrimitivesEventOnly,AccountId32,AccountId32)', + RemovedPayingKey: '(PolymeshPrimitivesEventOnly,AccountId32,AccountId32)', + UpdatedPolyxLimit: '(PolymeshPrimitivesEventOnly,AccountId32,AccountId32,u128,u128)' + } + }, + /** + * Lookup277: pallet_rewards::RawEvent + **/ + PalletRewardsRawEvent: { + _enum: { + ItnRewardClaimed: '(AccountId32,u128)' + } + }, + /** + * Lookup278: pallet_contracts::pallet::Event + **/ + PalletContractsEvent: { + _enum: { + Instantiated: { + deployer: 'AccountId32', + contract: 'AccountId32', + }, + Terminated: { + contract: 'AccountId32', + beneficiary: 'AccountId32', + }, + CodeStored: { + codeHash: 'H256', + }, + ContractEmitted: { + contract: 'AccountId32', + data: 'Bytes', + }, + CodeRemoved: { + codeHash: 'H256', + }, + ContractCodeUpdated: { + contract: 'AccountId32', + newCodeHash: 'H256', + oldCodeHash: 'H256' + } + } + }, + /** + * Lookup279: polymesh_contracts::Event + **/ + PolymeshContractsEvent: 'Null', + /** + * Lookup280: pallet_preimage::pallet::Event + **/ + PalletPreimageEvent: { + _enum: { + Noted: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256', + }, + Requested: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256', + }, + Cleared: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256' + } + } + }, + /** + * Lookup281: pallet_test_utils::RawEvent + **/ + PalletTestUtilsRawEvent: { + _enum: { + MockInvestorUIDCreated: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesCddIdInvestorUid)', + DidStatus: '(PolymeshPrimitivesIdentityId,AccountId32)', + CddStatus: '(Option,AccountId32,bool)' + } + }, + /** + * Lookup282: polymesh_primitives::cdd_id::InvestorUid + **/ + PolymeshPrimitivesCddIdInvestorUid: '[u8;16]', + /** + * Lookup283: frame_system::Phase + **/ + FrameSystemPhase: { + _enum: { + ApplyExtrinsic: 'u32', + Finalization: 'Null', + Initialization: 'Null' + } + }, + /** + * Lookup286: frame_system::LastRuntimeUpgradeInfo + **/ + FrameSystemLastRuntimeUpgradeInfo: { + specVersion: 'Compact', + specName: 'Text' + }, + /** + * Lookup289: frame_system::pallet::Call + **/ + FrameSystemCall: { + _enum: { + fill_block: { + ratio: 'Perbill', + }, + remark: { + remark: 'Bytes', + }, + set_heap_pages: { + pages: 'u64', + }, + set_code: { + code: 'Bytes', + }, + set_code_without_checks: { + code: 'Bytes', + }, + set_storage: { + items: 'Vec<(Bytes,Bytes)>', + }, + kill_storage: { + _alias: { + keys_: 'keys', + }, + keys_: 'Vec', + }, + kill_prefix: { + prefix: 'Bytes', + subkeys: 'u32', + }, + remark_with_event: { + remark: 'Bytes' + } + } + }, + /** + * Lookup293: frame_system::limits::BlockWeights + **/ + FrameSystemLimitsBlockWeights: { + baseBlock: 'u64', + maxBlock: 'u64', + perClass: 'FrameSupportWeightsPerDispatchClassWeightsPerClass' + }, + /** + * Lookup294: frame_support::weights::PerDispatchClass + **/ + FrameSupportWeightsPerDispatchClassWeightsPerClass: { + normal: 'FrameSystemLimitsWeightsPerClass', + operational: 'FrameSystemLimitsWeightsPerClass', + mandatory: 'FrameSystemLimitsWeightsPerClass' + }, + /** + * Lookup295: frame_system::limits::WeightsPerClass + **/ + FrameSystemLimitsWeightsPerClass: { + baseExtrinsic: 'u64', + maxExtrinsic: 'Option', + maxTotal: 'Option', + reserved: 'Option' + }, + /** + * Lookup296: frame_system::limits::BlockLength + **/ + FrameSystemLimitsBlockLength: { + max: 'FrameSupportWeightsPerDispatchClassU32' + }, + /** + * Lookup297: frame_support::weights::PerDispatchClass + **/ + FrameSupportWeightsPerDispatchClassU32: { + normal: 'u32', + operational: 'u32', + mandatory: 'u32' + }, + /** + * Lookup298: frame_support::weights::RuntimeDbWeight + **/ + FrameSupportWeightsRuntimeDbWeight: { + read: 'u64', + write: 'u64' + }, + /** + * Lookup299: sp_version::RuntimeVersion + **/ + SpVersionRuntimeVersion: { + specName: 'Text', + implName: 'Text', + authoringVersion: 'u32', + specVersion: 'u32', + implVersion: 'u32', + apis: 'Vec<([u8;8],u32)>', + transactionVersion: 'u32', + stateVersion: 'u8' + }, + /** + * Lookup304: frame_system::pallet::Error + **/ + FrameSystemError: { + _enum: ['InvalidSpecName', 'SpecVersionNeedsToIncrease', 'FailedToExtractRuntimeVersion', 'NonDefaultComposite', 'NonZeroRefCount', 'CallFiltered'] + }, + /** + * Lookup307: sp_consensus_babe::app::Public + **/ + SpConsensusBabeAppPublic: 'SpCoreSr25519Public', + /** + * Lookup310: sp_consensus_babe::digests::NextConfigDescriptor + **/ + SpConsensusBabeDigestsNextConfigDescriptor: { + _enum: { + __Unused0: 'Null', + V1: { + c: '(u64,u64)', + allowedSlots: 'SpConsensusBabeAllowedSlots' + } + } + }, + /** + * Lookup312: sp_consensus_babe::AllowedSlots + **/ + SpConsensusBabeAllowedSlots: { + _enum: ['PrimarySlots', 'PrimaryAndSecondaryPlainSlots', 'PrimaryAndSecondaryVRFSlots'] + }, + /** + * Lookup316: sp_consensus_babe::BabeEpochConfiguration + **/ + SpConsensusBabeBabeEpochConfiguration: { + c: '(u64,u64)', + allowedSlots: 'SpConsensusBabeAllowedSlots' + }, + /** + * Lookup317: pallet_babe::pallet::Call + **/ + PalletBabeCall: { + _enum: { + report_equivocation: { + equivocationProof: 'SpConsensusSlotsEquivocationProof', + keyOwnerProof: 'SpSessionMembershipProof', + }, + report_equivocation_unsigned: { + equivocationProof: 'SpConsensusSlotsEquivocationProof', + keyOwnerProof: 'SpSessionMembershipProof', + }, + plan_config_change: { + config: 'SpConsensusBabeDigestsNextConfigDescriptor' + } + } + }, + /** + * Lookup318: sp_consensus_slots::EquivocationProof, sp_consensus_babe::app::Public> + **/ + SpConsensusSlotsEquivocationProof: { + offender: 'SpConsensusBabeAppPublic', + slot: 'u64', + firstHeader: 'SpRuntimeHeader', + secondHeader: 'SpRuntimeHeader' + }, + /** + * Lookup319: sp_runtime::generic::header::Header + **/ + SpRuntimeHeader: { + parentHash: 'H256', + number: 'Compact', + stateRoot: 'H256', + extrinsicsRoot: 'H256', + digest: 'SpRuntimeDigest' + }, + /** + * Lookup320: sp_runtime::traits::BlakeTwo256 + **/ + SpRuntimeBlakeTwo256: 'Null', + /** + * Lookup321: sp_session::MembershipProof + **/ + SpSessionMembershipProof: { + session: 'u32', + trieNodes: 'Vec', + validatorCount: 'u32' + }, + /** + * Lookup322: pallet_babe::pallet::Error + **/ + PalletBabeError: { + _enum: ['InvalidEquivocationProof', 'InvalidKeyOwnershipProof', 'DuplicateOffenceReport'] + }, + /** + * Lookup323: pallet_timestamp::pallet::Call + **/ + PalletTimestampCall: { + _enum: { + set: { + now: 'Compact' + } + } + }, + /** + * Lookup326: pallet_indices::pallet::Call + **/ + PalletIndicesCall: { + _enum: { + claim: { + index: 'u32', + }, + transfer: { + _alias: { + new_: 'new', + }, + new_: 'AccountId32', + index: 'u32', + }, + free: { + index: 'u32', + }, + force_transfer: { + _alias: { + new_: 'new', + }, + new_: 'AccountId32', + index: 'u32', + freeze: 'bool', + }, + freeze: { + index: 'u32' + } + } + }, + /** + * Lookup327: pallet_indices::pallet::Error + **/ + PalletIndicesError: { + _enum: ['NotAssigned', 'NotOwner', 'InUse', 'NotTransfer', 'Permanent'] + }, + /** + * Lookup329: pallet_authorship::UncleEntryItem + **/ + PalletAuthorshipUncleEntryItem: { + _enum: { + InclusionHeight: 'u32', + Uncle: '(H256,Option)' + } + }, + /** + * Lookup330: pallet_authorship::pallet::Call + **/ + PalletAuthorshipCall: { + _enum: { + set_uncles: { + newUncles: 'Vec' + } + } + }, + /** + * Lookup332: pallet_authorship::pallet::Error + **/ + PalletAuthorshipError: { + _enum: ['InvalidUncleParent', 'UnclesAlreadySet', 'TooManyUncles', 'GenesisUncle', 'TooHighUncle', 'UncleAlreadyIncluded', 'OldUncle'] + }, + /** + * Lookup334: pallet_balances::BalanceLock + **/ + PalletBalancesBalanceLock: { + id: '[u8;8]', + amount: 'u128', + reasons: 'PolymeshCommonUtilitiesBalancesReasons' + }, + /** + * Lookup335: polymesh_common_utilities::traits::balances::Reasons + **/ + PolymeshCommonUtilitiesBalancesReasons: { + _enum: ['Fee', 'Misc', 'All'] + }, + /** + * Lookup336: pallet_balances::Call + **/ + PalletBalancesCall: { + _enum: { + transfer: { + dest: 'MultiAddress', + value: 'Compact', + }, + transfer_with_memo: { + dest: 'MultiAddress', + value: 'Compact', + memo: 'Option', + }, + deposit_block_reward_reserve_balance: { + value: 'Compact', + }, + set_balance: { + who: 'MultiAddress', + newFree: 'Compact', + newReserved: 'Compact', + }, + force_transfer: { + source: 'MultiAddress', + dest: 'MultiAddress', + value: 'Compact', + }, + burn_account_balance: { + amount: 'u128' + } + } + }, + /** + * Lookup338: pallet_balances::Error + **/ + PalletBalancesError: { + _enum: ['LiquidityRestrictions', 'Overflow', 'InsufficientBalance', 'ExistentialDeposit', 'ReceiverCddMissing'] + }, + /** + * Lookup340: pallet_transaction_payment::Releases + **/ + PalletTransactionPaymentReleases: { + _enum: ['V1Ancient', 'V2'] + }, + /** + * Lookup342: frame_support::weights::WeightToFeeCoefficient + **/ + FrameSupportWeightsWeightToFeeCoefficient: { + coeffInteger: 'u128', + coeffFrac: 'Perbill', + negative: 'bool', + degree: 'u8' + }, + /** + * Lookup343: polymesh_primitives::identity::DidRecord + **/ + PolymeshPrimitivesIdentityDidRecord: { + primaryKey: 'Option' + }, + /** + * Lookup345: pallet_identity::types::Claim1stKey + **/ + PalletIdentityClaim1stKey: { + target: 'PolymeshPrimitivesIdentityId', + claimType: 'PolymeshPrimitivesIdentityClaimClaimType' + }, + /** + * Lookup346: pallet_identity::types::Claim2ndKey + **/ + PalletIdentityClaim2ndKey: { + issuer: 'PolymeshPrimitivesIdentityId', + scope: 'Option' + }, + /** + * Lookup348: polymesh_primitives::secondary_key::KeyRecord + **/ + PolymeshPrimitivesSecondaryKeyKeyRecord: { + _enum: { + PrimaryKey: 'PolymeshPrimitivesIdentityId', + SecondaryKey: '(PolymeshPrimitivesIdentityId,PolymeshPrimitivesSecondaryKeyPermissions)', + MultiSigSignerKey: 'AccountId32' + } + }, + /** + * Lookup351: polymesh_primitives::authorization::Authorization + **/ + PolymeshPrimitivesAuthorization: { + authorizationData: 'PolymeshPrimitivesAuthorizationAuthorizationData', + authorizedBy: 'PolymeshPrimitivesIdentityId', + expiry: 'Option', + authId: 'u64' + }, + /** + * Lookup354: pallet_identity::Call + **/ + PalletIdentityCall: { + _enum: { + cdd_register_did: { + targetAccount: 'AccountId32', + secondaryKeys: 'Vec', + }, + invalidate_cdd_claims: { + cdd: 'PolymeshPrimitivesIdentityId', + disableFrom: 'u64', + expiry: 'Option', + }, + remove_secondary_keys_old: { + keysToRemove: 'Vec', + }, + accept_primary_key: { + rotationAuthId: 'u64', + optionalCddAuthId: 'Option', + }, + change_cdd_requirement_for_mk_rotation: { + authRequired: 'bool', + }, + join_identity_as_key: { + authId: 'u64', + }, + leave_identity_as_key: 'Null', + add_claim: { + target: 'PolymeshPrimitivesIdentityId', + claim: 'PolymeshPrimitivesIdentityClaimClaim', + expiry: 'Option', + }, + revoke_claim: { + target: 'PolymeshPrimitivesIdentityId', + claim: 'PolymeshPrimitivesIdentityClaimClaim', + }, + set_permission_to_signer: { + key: 'PolymeshPrimitivesSecondaryKeySignatory', + perms: 'PolymeshPrimitivesSecondaryKeyPermissions', + }, + placeholder_legacy_set_permission_to_signer: 'Null', + freeze_secondary_keys: 'Null', + unfreeze_secondary_keys: 'Null', + add_authorization: { + target: 'PolymeshPrimitivesSecondaryKeySignatory', + data: 'PolymeshPrimitivesAuthorizationAuthorizationData', + expiry: 'Option', + }, + remove_authorization: { + target: 'PolymeshPrimitivesSecondaryKeySignatory', + authId: 'u64', + authIssuerPays: 'bool', + }, + add_secondary_keys_with_authorization_old: { + additionalKeys: 'Vec', + expiresAt: 'u64', + }, + add_investor_uniqueness_claim: { + target: 'PolymeshPrimitivesIdentityId', + claim: 'PolymeshPrimitivesIdentityClaimClaim', + proof: 'PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData', + expiry: 'Option', + }, + gc_add_cdd_claim: { + target: 'PolymeshPrimitivesIdentityId', + }, + gc_revoke_cdd_claim: { + target: 'PolymeshPrimitivesIdentityId', + }, + add_investor_uniqueness_claim_v2: { + target: 'PolymeshPrimitivesIdentityId', + scope: 'PolymeshPrimitivesIdentityClaimScope', + claim: 'PolymeshPrimitivesIdentityClaimClaim', + proof: 'ConfidentialIdentityClaimProofsScopeClaimProof', + expiry: 'Option', + }, + revoke_claim_by_index: { + target: 'PolymeshPrimitivesIdentityId', + claimType: 'PolymeshPrimitivesIdentityClaimClaimType', + scope: 'Option', + }, + rotate_primary_key_to_secondary: { + authId: 'u64', + optionalCddAuthId: 'Option', + }, + add_secondary_keys_with_authorization: { + additionalKeys: 'Vec', + expiresAt: 'u64', + }, + set_secondary_key_permissions: { + key: 'AccountId32', + perms: 'PolymeshPrimitivesSecondaryKeyPermissions', + }, + remove_secondary_keys: { + keysToRemove: 'Vec' + } + } + }, + /** + * Lookup356: polymesh_common_utilities::traits::identity::SecondaryKeyWithAuthV1 + **/ + PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuthV1: { + secondaryKey: 'PolymeshPrimitivesSecondaryKeyV1SecondaryKey', + authSignature: 'H512' + }, + /** + * Lookup357: polymesh_primitives::secondary_key::v1::SecondaryKey + **/ + PolymeshPrimitivesSecondaryKeyV1SecondaryKey: { + signer: 'PolymeshPrimitivesSecondaryKeySignatory', + permissions: 'PolymeshPrimitivesSecondaryKeyPermissions' + }, + /** + * Lookup359: polymesh_primitives::investor_zkproof_data::v1::InvestorZKProofData + **/ + PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData: 'SchnorrkelSignSignature', + /** + * Lookup360: schnorrkel::sign::Signature + **/ + SchnorrkelSignSignature: { + r: 'Curve25519DalekRistrettoCompressedRistretto', + s: 'Curve25519DalekScalar' + }, + /** + * Lookup361: curve25519_dalek::ristretto::CompressedRistretto + **/ + Curve25519DalekRistrettoCompressedRistretto: '[u8;32]', + /** + * Lookup362: curve25519_dalek::scalar::Scalar + **/ + Curve25519DalekScalar: { + bytes: '[u8;32]' + }, + /** + * Lookup363: confidential_identity::claim_proofs::ScopeClaimProof + **/ + ConfidentialIdentityClaimProofsScopeClaimProof: { + proofScopeIdWellformed: 'ConfidentialIdentitySignSignature', + proofScopeIdCddIdMatch: 'ConfidentialIdentityClaimProofsZkProofData', + scopeId: 'Curve25519DalekRistrettoRistrettoPoint' + }, + /** + * Lookup364: confidential_identity::sign::Signature + **/ + ConfidentialIdentitySignSignature: { + r: 'Curve25519DalekRistrettoCompressedRistretto', + s: 'Curve25519DalekScalar' + }, + /** + * Lookup365: confidential_identity::claim_proofs::ZkProofData + **/ + ConfidentialIdentityClaimProofsZkProofData: { + challengeResponses: '[Lookup362;2]', + subtractExpressionsRes: 'Curve25519DalekRistrettoRistrettoPoint', + blindedScopeDidHash: 'Curve25519DalekRistrettoRistrettoPoint' + }, + /** + * Lookup367: curve25519_dalek::ristretto::RistrettoPoint + **/ + Curve25519DalekRistrettoRistrettoPoint: 'Curve25519DalekEdwardsEdwardsPoint', + /** + * Lookup368: curve25519_dalek::edwards::EdwardsPoint + **/ + Curve25519DalekEdwardsEdwardsPoint: { + x: 'Curve25519DalekBackendSerialU64FieldFieldElement51', + y: 'Curve25519DalekBackendSerialU64FieldFieldElement51', + z: 'Curve25519DalekBackendSerialU64FieldFieldElement51', + t: 'Curve25519DalekBackendSerialU64FieldFieldElement51' + }, + /** + * Lookup369: curve25519_dalek::backend::serial::u64::field::FieldElement51 + **/ + Curve25519DalekBackendSerialU64FieldFieldElement51: '[u64;5]', + /** + * Lookup372: polymesh_common_utilities::traits::identity::SecondaryKeyWithAuth + **/ + PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth: { + secondaryKey: 'PolymeshPrimitivesSecondaryKey', + authSignature: 'H512' + }, + /** + * Lookup373: pallet_identity::Error + **/ + PalletIdentityError: { + _enum: ['AlreadyLinked', 'MissingCurrentIdentity', 'Unauthorized', 'InvalidAccountKey', 'UnAuthorizedCddProvider', 'InvalidAuthorizationFromOwner', 'InvalidAuthorizationFromCddProvider', 'NotCddProviderAttestation', 'AuthorizationsNotForSameDids', 'DidMustAlreadyExist', 'CurrentIdentityCannotBeForwarded', 'AuthorizationExpired', 'TargetHasNoCdd', 'AuthorizationHasBeenRevoked', 'InvalidAuthorizationSignature', 'KeyNotAllowed', 'NotPrimaryKey', 'DidDoesNotExist', 'DidAlreadyExists', 'SecondaryKeysContainPrimaryKey', 'FailedToChargeFee', 'NotASigner', 'CannotDecodeSignerAccountId', 'MultiSigHasBalance', 'ConfidentialScopeClaimNotAllowed', 'InvalidScopeClaim', 'ClaimVariantNotAllowed', 'TargetHasNonZeroBalanceAtScopeId', 'CDDIdNotUniqueForIdentity', 'InvalidCDDId', 'ClaimAndProofVersionsDoNotMatch', 'AccountKeyIsBeingUsed', 'CustomScopeTooLong'] + }, + /** + * Lookup375: polymesh_common_utilities::traits::group::InactiveMember + **/ + PolymeshCommonUtilitiesGroupInactiveMember: { + id: 'PolymeshPrimitivesIdentityId', + deactivatedAt: 'u64', + expiry: 'Option' + }, + /** + * Lookup376: pallet_group::Call + **/ + PalletGroupCall: { + _enum: { + set_active_members_limit: { + limit: 'u32', + }, + disable_member: { + who: 'PolymeshPrimitivesIdentityId', + expiry: 'Option', + at: 'Option', + }, + add_member: { + who: 'PolymeshPrimitivesIdentityId', + }, + remove_member: { + who: 'PolymeshPrimitivesIdentityId', + }, + swap_member: { + remove: 'PolymeshPrimitivesIdentityId', + add: 'PolymeshPrimitivesIdentityId', + }, + reset_members: { + members: 'Vec', + }, + abdicate_membership: 'Null' + } + }, + /** + * Lookup377: pallet_group::Error + **/ + PalletGroupError: { + _enum: ['OnlyPrimaryKeyAllowed', 'DuplicateMember', 'NoSuchMember', 'LastMemberCannotQuit', 'MissingCurrentIdentity', 'ActiveMembersLimitExceeded', 'ActiveMembersLimitOverflow'] + }, + /** + * Lookup379: pallet_committee::Call + **/ + PalletCommitteeCall: { + _enum: { + set_vote_threshold: { + n: 'u32', + d: 'u32', + }, + set_release_coordinator: { + id: 'PolymeshPrimitivesIdentityId', + }, + set_expires_after: { + expiry: 'PolymeshCommonUtilitiesMaybeBlock', + }, + vote_or_propose: { + approve: 'bool', + call: 'Call', + }, + vote: { + proposal: 'H256', + index: 'u32', + approve: 'bool' + } + } + }, + /** + * Lookup385: pallet_multisig::Call + **/ + PalletMultisigCall: { + _enum: { + create_multisig: { + signers: 'Vec', + sigsRequired: 'u64', + }, + create_or_approve_proposal_as_identity: { + multisig: 'AccountId32', + proposal: 'Call', + expiry: 'Option', + autoClose: 'bool', + }, + create_or_approve_proposal_as_key: { + multisig: 'AccountId32', + proposal: 'Call', + expiry: 'Option', + autoClose: 'bool', + }, + create_proposal_as_identity: { + multisig: 'AccountId32', + proposal: 'Call', + expiry: 'Option', + autoClose: 'bool', + }, + create_proposal_as_key: { + multisig: 'AccountId32', + proposal: 'Call', + expiry: 'Option', + autoClose: 'bool', + }, + approve_as_identity: { + multisig: 'AccountId32', + proposalId: 'u64', + }, + approve_as_key: { + multisig: 'AccountId32', + proposalId: 'u64', + }, + reject_as_identity: { + multisig: 'AccountId32', + proposalId: 'u64', + }, + reject_as_key: { + multisig: 'AccountId32', + proposalId: 'u64', + }, + accept_multisig_signer_as_identity: { + authId: 'u64', + }, + accept_multisig_signer_as_key: { + authId: 'u64', + }, + add_multisig_signer: { + signer: 'PolymeshPrimitivesSecondaryKeySignatory', + }, + remove_multisig_signer: { + signer: 'PolymeshPrimitivesSecondaryKeySignatory', + }, + add_multisig_signers_via_creator: { + multisig: 'AccountId32', + signers: 'Vec', + }, + remove_multisig_signers_via_creator: { + multisig: 'AccountId32', + signers: 'Vec', + }, + change_sigs_required: { + sigsRequired: 'u64', + }, + make_multisig_secondary: { + multisig: 'AccountId32', + }, + make_multisig_primary: { + multisig: 'AccountId32', + optionalCddAuthId: 'Option', + }, + execute_scheduled_proposal: { + multisig: 'AccountId32', + proposalId: 'u64', + multisigDid: 'PolymeshPrimitivesIdentityId', + proposalWeight: 'u64' + } + } + }, + /** + * Lookup386: pallet_bridge::Call + **/ + PalletBridgeCall: { + _enum: { + change_controller: { + controller: 'AccountId32', + }, + change_admin: { + admin: 'AccountId32', + }, + change_timelock: { + timelock: 'u32', + }, + freeze: 'Null', + unfreeze: 'Null', + change_bridge_limit: { + amount: 'u128', + duration: 'u32', + }, + change_bridge_exempted: { + exempted: 'Vec<(PolymeshPrimitivesIdentityId,bool)>', + }, + force_handle_bridge_tx: { + bridgeTx: 'PalletBridgeBridgeTx', + }, + batch_propose_bridge_tx: { + bridgeTxs: 'Vec', + }, + propose_bridge_tx: { + bridgeTx: 'PalletBridgeBridgeTx', + }, + handle_bridge_tx: { + bridgeTx: 'PalletBridgeBridgeTx', + }, + freeze_txs: { + bridgeTxs: 'Vec', + }, + unfreeze_txs: { + bridgeTxs: 'Vec', + }, + handle_scheduled_bridge_tx: { + bridgeTx: 'PalletBridgeBridgeTx', + }, + add_freeze_admin: { + freezeAdmin: 'AccountId32', + }, + remove_freeze_admin: { + freezeAdmin: 'AccountId32', + }, + remove_txs: { + bridgeTxs: 'Vec' + } + } + }, + /** + * Lookup390: pallet_staking::Call + **/ + PalletStakingCall: { + _enum: { + bond: { + controller: 'MultiAddress', + value: 'Compact', + payee: 'PalletStakingRewardDestination', + }, + bond_extra: { + maxAdditional: 'Compact', + }, + unbond: { + value: 'Compact', + }, + withdraw_unbonded: { + numSlashingSpans: 'u32', + }, + validate: { + prefs: 'PalletStakingValidatorPrefs', + }, + nominate: { + targets: 'Vec', + }, + chill: 'Null', + set_payee: { + payee: 'PalletStakingRewardDestination', + }, + set_controller: { + controller: 'MultiAddress', + }, + set_validator_count: { + _alias: { + new_: 'new', + }, + new_: 'Compact', + }, + increase_validator_count: { + additional: 'Compact', + }, + scale_validator_count: { + factor: 'Percent', + }, + add_permissioned_validator: { + identity: 'PolymeshPrimitivesIdentityId', + intendedCount: 'Option', + }, + remove_permissioned_validator: { + identity: 'PolymeshPrimitivesIdentityId', + }, + validate_cdd_expiry_nominators: { + targets: 'Vec', + }, + set_commission_cap: { + newCap: 'Perbill', + }, + set_min_bond_threshold: { + newValue: 'u128', + }, + force_no_eras: 'Null', + force_new_era: 'Null', + set_invulnerables: { + invulnerables: 'Vec', + }, + force_unstake: { + stash: 'AccountId32', + numSlashingSpans: 'u32', + }, + force_new_era_always: 'Null', + cancel_deferred_slash: { + era: 'u32', + slashIndices: 'Vec', + }, + payout_stakers: { + validatorStash: 'AccountId32', + era: 'u32', + }, + rebond: { + value: 'Compact', + }, + set_history_depth: { + newHistoryDepth: 'Compact', + eraItemsDeleted: 'Compact', + }, + reap_stash: { + stash: 'AccountId32', + numSlashingSpans: 'u32', + }, + submit_election_solution: { + _alias: { + size_: 'size', + }, + winners: 'Vec', + compact: 'PalletStakingCompactAssignments', + score: 'SpNposElectionsElectionScore', + era: 'u32', + size_: 'PalletStakingElectionSize', + }, + submit_election_solution_unsigned: { + _alias: { + size_: 'size', + }, + winners: 'Vec', + compact: 'PalletStakingCompactAssignments', + score: 'SpNposElectionsElectionScore', + era: 'u32', + size_: 'PalletStakingElectionSize', + }, + payout_stakers_by_system: { + validatorStash: 'AccountId32', + era: 'u32', + }, + change_slashing_allowed_for: { + slashingSwitch: 'PalletStakingSlashingSwitch', + }, + update_permissioned_validator_intended_count: { + identity: 'PolymeshPrimitivesIdentityId', + newIntendedCount: 'u32' + } + } + }, + /** + * Lookup391: pallet_staking::RewardDestination + **/ + PalletStakingRewardDestination: { + _enum: { + Staked: 'Null', + Stash: 'Null', + Controller: 'Null', + Account: 'AccountId32' + } + }, + /** + * Lookup392: pallet_staking::ValidatorPrefs + **/ + PalletStakingValidatorPrefs: { + commission: 'Compact', + blocked: 'bool' + }, + /** + * Lookup398: pallet_staking::CompactAssignments + **/ + PalletStakingCompactAssignments: { + votes1: 'Vec<(Compact,Compact)>', + votes2: 'Vec<(Compact,(Compact,Compact),Compact)>', + votes3: 'Vec<(Compact,[(Compact,Compact);2],Compact)>', + votes4: 'Vec<(Compact,[(Compact,Compact);3],Compact)>', + votes5: 'Vec<(Compact,[(Compact,Compact);4],Compact)>', + votes6: 'Vec<(Compact,[(Compact,Compact);5],Compact)>', + votes7: 'Vec<(Compact,[(Compact,Compact);6],Compact)>', + votes8: 'Vec<(Compact,[(Compact,Compact);7],Compact)>', + votes9: 'Vec<(Compact,[(Compact,Compact);8],Compact)>', + votes10: 'Vec<(Compact,[(Compact,Compact);9],Compact)>', + votes11: 'Vec<(Compact,[(Compact,Compact);10],Compact)>', + votes12: 'Vec<(Compact,[(Compact,Compact);11],Compact)>', + votes13: 'Vec<(Compact,[(Compact,Compact);12],Compact)>', + votes14: 'Vec<(Compact,[(Compact,Compact);13],Compact)>', + votes15: 'Vec<(Compact,[(Compact,Compact);14],Compact)>', + votes16: 'Vec<(Compact,[(Compact,Compact);15],Compact)>' + }, + /** + * Lookup449: sp_npos_elections::ElectionScore + **/ + SpNposElectionsElectionScore: { + minimalStake: 'u128', + sumStake: 'u128', + sumStakeSquared: 'u128' + }, + /** + * Lookup450: pallet_staking::ElectionSize + **/ + PalletStakingElectionSize: { + validators: 'Compact', + nominators: 'Compact' + }, + /** + * Lookup451: pallet_session::pallet::Call + **/ + PalletSessionCall: { + _enum: { + set_keys: { + _alias: { + keys_: 'keys', + }, + keys_: 'PolymeshRuntimeDevelopRuntimeSessionKeys', + proof: 'Bytes', + }, + purge_keys: 'Null' + } + }, + /** + * Lookup452: polymesh_runtime_develop::runtime::SessionKeys + **/ + PolymeshRuntimeDevelopRuntimeSessionKeys: { + grandpa: 'SpFinalityGrandpaAppPublic', + babe: 'SpConsensusBabeAppPublic', + imOnline: 'PalletImOnlineSr25519AppSr25519Public', + authorityDiscovery: 'SpAuthorityDiscoveryAppPublic' + }, + /** + * Lookup453: sp_authority_discovery::app::Public + **/ + SpAuthorityDiscoveryAppPublic: 'SpCoreSr25519Public', + /** + * Lookup454: pallet_grandpa::pallet::Call + **/ + PalletGrandpaCall: { + _enum: { + report_equivocation: { + equivocationProof: 'SpFinalityGrandpaEquivocationProof', + keyOwnerProof: 'SpSessionMembershipProof', + }, + report_equivocation_unsigned: { + equivocationProof: 'SpFinalityGrandpaEquivocationProof', + keyOwnerProof: 'SpSessionMembershipProof', + }, + note_stalled: { + delay: 'u32', + bestFinalizedBlockNumber: 'u32' + } + } + }, + /** + * Lookup455: sp_finality_grandpa::EquivocationProof + **/ + SpFinalityGrandpaEquivocationProof: { + setId: 'u64', + equivocation: 'SpFinalityGrandpaEquivocation' + }, + /** + * Lookup456: sp_finality_grandpa::Equivocation + **/ + SpFinalityGrandpaEquivocation: { + _enum: { + Prevote: 'FinalityGrandpaEquivocationPrevote', + Precommit: 'FinalityGrandpaEquivocationPrecommit' + } + }, + /** + * Lookup457: finality_grandpa::Equivocation, sp_finality_grandpa::app::Signature> + **/ + FinalityGrandpaEquivocationPrevote: { + roundNumber: 'u64', + identity: 'SpFinalityGrandpaAppPublic', + first: '(FinalityGrandpaPrevote,SpFinalityGrandpaAppSignature)', + second: '(FinalityGrandpaPrevote,SpFinalityGrandpaAppSignature)' + }, + /** + * Lookup458: finality_grandpa::Prevote + **/ + FinalityGrandpaPrevote: { + targetHash: 'H256', + targetNumber: 'u32' + }, + /** + * Lookup459: sp_finality_grandpa::app::Signature + **/ + SpFinalityGrandpaAppSignature: 'SpCoreEd25519Signature', + /** + * Lookup460: sp_core::ed25519::Signature + **/ + SpCoreEd25519Signature: '[u8;64]', + /** + * Lookup462: finality_grandpa::Equivocation, sp_finality_grandpa::app::Signature> + **/ + FinalityGrandpaEquivocationPrecommit: { + roundNumber: 'u64', + identity: 'SpFinalityGrandpaAppPublic', + first: '(FinalityGrandpaPrecommit,SpFinalityGrandpaAppSignature)', + second: '(FinalityGrandpaPrecommit,SpFinalityGrandpaAppSignature)' + }, + /** + * Lookup463: finality_grandpa::Precommit + **/ + FinalityGrandpaPrecommit: { + targetHash: 'H256', + targetNumber: 'u32' + }, + /** + * Lookup465: pallet_im_online::pallet::Call + **/ + PalletImOnlineCall: { + _enum: { + heartbeat: { + heartbeat: 'PalletImOnlineHeartbeat', + signature: 'PalletImOnlineSr25519AppSr25519Signature' + } + } + }, + /** + * Lookup466: pallet_im_online::Heartbeat + **/ + PalletImOnlineHeartbeat: { + blockNumber: 'u32', + networkState: 'SpCoreOffchainOpaqueNetworkState', + sessionIndex: 'u32', + authorityIndex: 'u32', + validatorsLen: 'u32' + }, + /** + * Lookup467: sp_core::offchain::OpaqueNetworkState + **/ + SpCoreOffchainOpaqueNetworkState: { + peerId: 'Bytes', + externalAddresses: 'Vec' + }, + /** + * Lookup471: pallet_im_online::sr25519::app_sr25519::Signature + **/ + PalletImOnlineSr25519AppSr25519Signature: 'SpCoreSr25519Signature', + /** + * Lookup472: sp_core::sr25519::Signature + **/ + SpCoreSr25519Signature: '[u8;64]', + /** + * Lookup473: pallet_sudo::Call + **/ + PalletSudoCall: { + _enum: { + sudo: { + call: 'Call', + }, + sudo_unchecked_weight: { + call: 'Call', + weight: 'u64', + }, + set_key: { + _alias: { + new_: 'new', + }, + new_: 'MultiAddress', + }, + sudo_as: { + who: 'MultiAddress', + call: 'Call' + } + } + }, + /** + * Lookup474: pallet_asset::Call + **/ + PalletAssetCall: { + _enum: { + register_ticker: { + ticker: 'PolymeshPrimitivesTicker', + }, + accept_ticker_transfer: { + authId: 'u64', + }, + accept_asset_ownership_transfer: { + authId: 'u64', + }, + create_asset: { + name: 'Bytes', + ticker: 'PolymeshPrimitivesTicker', + divisible: 'bool', + assetType: 'PolymeshPrimitivesAssetAssetType', + identifiers: 'Vec', + fundingRound: 'Option', + disableIu: 'bool', + }, + freeze: { + ticker: 'PolymeshPrimitivesTicker', + }, + unfreeze: { + ticker: 'PolymeshPrimitivesTicker', + }, + rename_asset: { + ticker: 'PolymeshPrimitivesTicker', + name: 'Bytes', + }, + issue: { + ticker: 'PolymeshPrimitivesTicker', + amount: 'u128', + }, + redeem: { + ticker: 'PolymeshPrimitivesTicker', + value: 'u128', + }, + make_divisible: { + ticker: 'PolymeshPrimitivesTicker', + }, + add_documents: { + docs: 'Vec', + ticker: 'PolymeshPrimitivesTicker', + }, + remove_documents: { + ids: 'Vec', + ticker: 'PolymeshPrimitivesTicker', + }, + set_funding_round: { + ticker: 'PolymeshPrimitivesTicker', + name: 'Bytes', + }, + update_identifiers: { + ticker: 'PolymeshPrimitivesTicker', + identifiers: 'Vec', + }, + claim_classic_ticker: { + ticker: 'PolymeshPrimitivesTicker', + ethereumSignature: 'PolymeshPrimitivesEthereumEcdsaSignature', + }, + reserve_classic_ticker: { + classicTickerImport: 'PalletAssetClassicTickerImport', + contractDid: 'PolymeshPrimitivesIdentityId', + config: 'PalletAssetTickerRegistrationConfig', + }, + controller_transfer: { + ticker: 'PolymeshPrimitivesTicker', + value: 'u128', + fromPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + }, + register_custom_asset_type: { + ty: 'Bytes', + }, + create_asset_with_custom_type: { + name: 'Bytes', + ticker: 'PolymeshPrimitivesTicker', + divisible: 'bool', + customAssetType: 'Bytes', + identifiers: 'Vec', + fundingRound: 'Option', + disableIu: 'bool', + }, + set_asset_metadata: { + ticker: 'PolymeshPrimitivesTicker', + key: 'PolymeshPrimitivesAssetMetadataAssetMetadataKey', + value: 'Bytes', + detail: 'Option', + }, + set_asset_metadata_details: { + ticker: 'PolymeshPrimitivesTicker', + key: 'PolymeshPrimitivesAssetMetadataAssetMetadataKey', + detail: 'PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail', + }, + register_and_set_local_asset_metadata: { + ticker: 'PolymeshPrimitivesTicker', + name: 'Bytes', + spec: 'PolymeshPrimitivesAssetMetadataAssetMetadataSpec', + value: 'Bytes', + detail: 'Option', + }, + register_asset_metadata_local_type: { + ticker: 'PolymeshPrimitivesTicker', + name: 'Bytes', + spec: 'PolymeshPrimitivesAssetMetadataAssetMetadataSpec', + }, + register_asset_metadata_global_type: { + name: 'Bytes', + spec: 'PolymeshPrimitivesAssetMetadataAssetMetadataSpec' + } + } + }, + /** + * Lookup477: polymesh_primitives::ethereum::EcdsaSignature + **/ + PolymeshPrimitivesEthereumEcdsaSignature: '[u8;65]', + /** + * Lookup479: pallet_asset::ClassicTickerImport + **/ + PalletAssetClassicTickerImport: { + ethOwner: 'PolymeshPrimitivesEthereumEthereumAddress', + ticker: 'PolymeshPrimitivesTicker', + isContract: 'bool', + isCreated: 'bool' + }, + /** + * Lookup480: pallet_asset::TickerRegistrationConfig + **/ + PalletAssetTickerRegistrationConfig: { + maxTickerLength: 'u8', + registrationLength: 'Option' + }, + /** + * Lookup481: polymesh_primitives::asset_metadata::AssetMetadataKey + **/ + PolymeshPrimitivesAssetMetadataAssetMetadataKey: { + _enum: { + Global: 'u64', + Local: 'u64' + } + }, + /** + * Lookup482: pallet_corporate_actions::distribution::Call + **/ + PalletCorporateActionsDistributionCall: { + _enum: { + distribute: { + caId: 'PalletCorporateActionsCaId', + portfolio: 'Option', + currency: 'PolymeshPrimitivesTicker', + perShare: 'u128', + amount: 'u128', + paymentAt: 'u64', + expiresAt: 'Option', + }, + claim: { + caId: 'PalletCorporateActionsCaId', + }, + push_benefit: { + caId: 'PalletCorporateActionsCaId', + holder: 'PolymeshPrimitivesIdentityId', + }, + reclaim: { + caId: 'PalletCorporateActionsCaId', + }, + remove_distribution: { + caId: 'PalletCorporateActionsCaId' + } + } + }, + /** + * Lookup484: pallet_asset::checkpoint::Call + **/ + PalletAssetCheckpointCall: { + _enum: { + create_checkpoint: { + ticker: 'PolymeshPrimitivesTicker', + }, + set_schedules_max_complexity: { + maxComplexity: 'u64', + }, + create_schedule: { + ticker: 'PolymeshPrimitivesTicker', + schedule: 'PalletAssetCheckpointScheduleSpec', + }, + remove_schedule: { + ticker: 'PolymeshPrimitivesTicker', + id: 'u64' + } + } + }, + /** + * Lookup485: pallet_asset::checkpoint::ScheduleSpec + **/ + PalletAssetCheckpointScheduleSpec: { + start: 'Option', + period: 'PolymeshPrimitivesCalendarCalendarPeriod', + remaining: 'u32' + }, + /** + * Lookup486: pallet_compliance_manager::Call + **/ + PalletComplianceManagerCall: { + _enum: { + add_compliance_requirement: { + ticker: 'PolymeshPrimitivesTicker', + senderConditions: 'Vec', + receiverConditions: 'Vec', + }, + remove_compliance_requirement: { + ticker: 'PolymeshPrimitivesTicker', + id: 'u32', + }, + replace_asset_compliance: { + ticker: 'PolymeshPrimitivesTicker', + assetCompliance: 'Vec', + }, + reset_asset_compliance: { + ticker: 'PolymeshPrimitivesTicker', + }, + pause_asset_compliance: { + ticker: 'PolymeshPrimitivesTicker', + }, + resume_asset_compliance: { + ticker: 'PolymeshPrimitivesTicker', + }, + add_default_trusted_claim_issuer: { + ticker: 'PolymeshPrimitivesTicker', + issuer: 'PolymeshPrimitivesConditionTrustedIssuer', + }, + remove_default_trusted_claim_issuer: { + ticker: 'PolymeshPrimitivesTicker', + issuer: 'PolymeshPrimitivesIdentityId', + }, + change_compliance_requirement: { + ticker: 'PolymeshPrimitivesTicker', + newReq: 'PolymeshPrimitivesComplianceManagerComplianceRequirement' + } + } + }, + /** + * Lookup487: pallet_corporate_actions::Call + **/ + PalletCorporateActionsCall: { + _enum: { + set_max_details_length: { + length: 'u32', + }, + set_default_targets: { + ticker: 'PolymeshPrimitivesTicker', + targets: 'PalletCorporateActionsTargetIdentities', + }, + set_default_withholding_tax: { + ticker: 'PolymeshPrimitivesTicker', + tax: 'Permill', + }, + set_did_withholding_tax: { + ticker: 'PolymeshPrimitivesTicker', + taxedDid: 'PolymeshPrimitivesIdentityId', + tax: 'Option', + }, + initiate_corporate_action: { + ticker: 'PolymeshPrimitivesTicker', + kind: 'PalletCorporateActionsCaKind', + declDate: 'u64', + recordDate: 'Option', + details: 'Bytes', + targets: 'Option', + defaultWithholdingTax: 'Option', + withholdingTax: 'Option>', + }, + link_ca_doc: { + id: 'PalletCorporateActionsCaId', + docs: 'Vec', + }, + remove_ca: { + caId: 'PalletCorporateActionsCaId', + }, + change_record_date: { + caId: 'PalletCorporateActionsCaId', + recordDate: 'Option', + }, + initiate_corporate_action_and_distribute: { + caArgs: 'PalletCorporateActionsInitiateCorporateActionArgs', + portfolio: 'Option', + currency: 'PolymeshPrimitivesTicker', + perShare: 'u128', + amount: 'u128', + paymentAt: 'u64', + expiresAt: 'Option' + } + } + }, + /** + * Lookup489: pallet_corporate_actions::RecordDateSpec + **/ + PalletCorporateActionsRecordDateSpec: { + _enum: { + Scheduled: 'u64', + ExistingSchedule: 'u64', + Existing: 'u64' + } + }, + /** + * Lookup492: pallet_corporate_actions::InitiateCorporateActionArgs + **/ + PalletCorporateActionsInitiateCorporateActionArgs: { + ticker: 'PolymeshPrimitivesTicker', + kind: 'PalletCorporateActionsCaKind', + declDate: 'u64', + recordDate: 'Option', + details: 'Bytes', + targets: 'Option', + defaultWithholdingTax: 'Option', + withholdingTax: 'Option>' + }, + /** + * Lookup493: pallet_corporate_actions::ballot::Call + **/ + PalletCorporateActionsBallotCall: { + _enum: { + attach_ballot: { + caId: 'PalletCorporateActionsCaId', + range: 'PalletCorporateActionsBallotBallotTimeRange', + meta: 'PalletCorporateActionsBallotBallotMeta', + rcv: 'bool', + }, + vote: { + caId: 'PalletCorporateActionsCaId', + votes: 'Vec', + }, + change_end: { + caId: 'PalletCorporateActionsCaId', + end: 'u64', + }, + change_meta: { + caId: 'PalletCorporateActionsCaId', + meta: 'PalletCorporateActionsBallotBallotMeta', + }, + change_rcv: { + caId: 'PalletCorporateActionsCaId', + rcv: 'bool', + }, + remove_ballot: { + caId: 'PalletCorporateActionsCaId' + } + } + }, + /** + * Lookup494: pallet_pips::Call + **/ + PalletPipsCall: { + _enum: { + set_prune_historical_pips: { + prune: 'bool', + }, + set_min_proposal_deposit: { + deposit: 'u128', + }, + set_default_enactment_period: { + duration: 'u32', + }, + set_pending_pip_expiry: { + expiry: 'PolymeshCommonUtilitiesMaybeBlock', + }, + set_max_pip_skip_count: { + max: 'u8', + }, + set_active_pip_limit: { + limit: 'u32', + }, + propose: { + proposal: 'Call', + deposit: 'u128', + url: 'Option', + description: 'Option', + }, + vote: { + id: 'u32', + ayeOrNay: 'bool', + deposit: 'u128', + }, + approve_committee_proposal: { + id: 'u32', + }, + reject_proposal: { + id: 'u32', + }, + prune_proposal: { + id: 'u32', + }, + reschedule_execution: { + id: 'u32', + until: 'Option', + }, + clear_snapshot: 'Null', + snapshot: 'Null', + enact_snapshot_results: { + results: 'Vec<(u32,PalletPipsSnapshotResult)>', + }, + execute_scheduled_pip: { + id: 'u32', + }, + expire_scheduled_pip: { + did: 'PolymeshPrimitivesIdentityId', + id: 'u32' + } + } + }, + /** + * Lookup497: pallet_pips::SnapshotResult + **/ + PalletPipsSnapshotResult: { + _enum: ['Approve', 'Reject', 'Skip'] + }, + /** + * Lookup498: pallet_portfolio::Call + **/ + PalletPortfolioCall: { + _enum: { + create_portfolio: { + name: 'Bytes', + }, + delete_portfolio: { + num: 'u64', + }, + move_portfolio_funds: { + from: 'PolymeshPrimitivesIdentityIdPortfolioId', + to: 'PolymeshPrimitivesIdentityIdPortfolioId', + items: 'Vec', + }, + rename_portfolio: { + num: 'u64', + toName: 'Bytes', + }, + quit_portfolio_custody: { + pid: 'PolymeshPrimitivesIdentityIdPortfolioId', + }, + accept_portfolio_custody: { + authId: 'u64' + } + } + }, + /** + * Lookup500: pallet_portfolio::MovePortfolioItem + **/ + PalletPortfolioMovePortfolioItem: { + ticker: 'PolymeshPrimitivesTicker', + amount: 'u128', + memo: 'Option' + }, + /** + * Lookup501: pallet_protocol_fee::Call + **/ + PalletProtocolFeeCall: { + _enum: { + change_coefficient: { + coefficient: 'PolymeshPrimitivesPosRatio', + }, + change_base_fee: { + op: 'PolymeshCommonUtilitiesProtocolFeeProtocolOp', + baseFee: 'u128' + } + } + }, + /** + * Lookup502: polymesh_common_utilities::protocol_fee::ProtocolOp + **/ + PolymeshCommonUtilitiesProtocolFeeProtocolOp: { + _enum: ['AssetRegisterTicker', 'AssetIssue', 'AssetAddDocuments', 'AssetCreateAsset', 'CheckpointCreateSchedule', 'ComplianceManagerAddComplianceRequirement', 'IdentityCddRegisterDid', 'IdentityAddClaim', 'IdentityAddSecondaryKeysWithAuthorization', 'PipsPropose', 'ContractsPutCode', 'CorporateBallotAttachBallot', 'CapitalDistributionDistribute'] + }, + /** + * Lookup503: pallet_scheduler::pallet::Call + **/ + PalletSchedulerCall: { + _enum: { + schedule: { + when: 'u32', + maybePeriodic: 'Option<(u32,u32)>', + priority: 'u8', + call: 'FrameSupportScheduleMaybeHashed', + }, + cancel: { + when: 'u32', + index: 'u32', + }, + schedule_named: { + id: 'Bytes', + when: 'u32', + maybePeriodic: 'Option<(u32,u32)>', + priority: 'u8', + call: 'FrameSupportScheduleMaybeHashed', + }, + cancel_named: { + id: 'Bytes', + }, + schedule_after: { + after: 'u32', + maybePeriodic: 'Option<(u32,u32)>', + priority: 'u8', + call: 'FrameSupportScheduleMaybeHashed', + }, + schedule_named_after: { + id: 'Bytes', + after: 'u32', + maybePeriodic: 'Option<(u32,u32)>', + priority: 'u8', + call: 'FrameSupportScheduleMaybeHashed' + } + } + }, + /** + * Lookup505: frame_support::traits::schedule::MaybeHashed + **/ + FrameSupportScheduleMaybeHashed: { + _enum: { + Value: 'Call', + Hash: 'H256' + } + }, + /** + * Lookup506: pallet_settlement::Call + **/ + PalletSettlementCall: { + _enum: { + create_venue: { + details: 'Bytes', + signers: 'Vec', + typ: 'PalletSettlementVenueType', + }, + update_venue_details: { + id: 'u64', + details: 'Bytes', + }, + update_venue_type: { + id: 'u64', + typ: 'PalletSettlementVenueType', + }, + add_instruction: { + venueId: 'u64', + settlementType: 'PalletSettlementSettlementType', + tradeDate: 'Option', + valueDate: 'Option', + legs: 'Vec', + }, + add_and_affirm_instruction: { + venueId: 'u64', + settlementType: 'PalletSettlementSettlementType', + tradeDate: 'Option', + valueDate: 'Option', + legs: 'Vec', + portfolios: 'Vec', + }, + affirm_instruction: { + id: 'u64', + portfolios: 'Vec', + maxLegsCount: 'u32', + }, + withdraw_affirmation: { + id: 'u64', + portfolios: 'Vec', + maxLegsCount: 'u32', + }, + reject_instruction: { + id: 'u64', + portfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + numOfLegs: 'u32', + }, + affirm_with_receipts: { + id: 'u64', + receiptDetails: 'Vec', + portfolios: 'Vec', + maxLegsCount: 'u32', + }, + claim_receipt: { + id: 'u64', + receiptDetails: 'PalletSettlementReceiptDetails', + }, + unclaim_receipt: { + instructionId: 'u64', + legId: 'u64', + }, + set_venue_filtering: { + ticker: 'PolymeshPrimitivesTicker', + enabled: 'bool', + }, + allow_venues: { + ticker: 'PolymeshPrimitivesTicker', + venues: 'Vec', + }, + disallow_venues: { + ticker: 'PolymeshPrimitivesTicker', + venues: 'Vec', + }, + change_receipt_validity: { + receiptUid: 'u64', + validity: 'bool', + }, + execute_scheduled_instruction: { + id: 'u64', + legsCount: 'u32', + }, + reschedule_instruction: { + id: 'u64' + } + } + }, + /** + * Lookup508: pallet_settlement::ReceiptDetails + **/ + PalletSettlementReceiptDetails: { + receiptUid: 'u64', + legId: 'u64', + signer: 'AccountId32', + signature: 'SpRuntimeMultiSignature', + metadata: 'Bytes' + }, + /** + * Lookup509: sp_runtime::MultiSignature + **/ + SpRuntimeMultiSignature: { + _enum: { + Ed25519: 'SpCoreEd25519Signature', + Sr25519: 'SpCoreSr25519Signature', + Ecdsa: 'SpCoreEcdsaSignature' + } + }, + /** + * Lookup510: sp_core::ecdsa::Signature + **/ + SpCoreEcdsaSignature: '[u8;65]', + /** + * Lookup511: pallet_statistics::Call + **/ + PalletStatisticsCall: { + _enum: { + set_active_asset_stats: { + asset: 'PolymeshPrimitivesStatisticsAssetScope', + statTypes: 'BTreeSetStatType', + }, + batch_update_asset_stats: { + asset: 'PolymeshPrimitivesStatisticsAssetScope', + statType: 'PolymeshPrimitivesStatisticsStatType', + values: 'BTreeSetStatUpdate', + }, + set_asset_transfer_compliance: { + asset: 'PolymeshPrimitivesStatisticsAssetScope', + transferConditions: 'BTreeSetTransferCondition', + }, + set_entities_exempt: { + isExempt: 'bool', + exemptKey: 'PolymeshPrimitivesTransferComplianceTransferConditionExemptKey', + entities: 'BTreeSetIdentityId' + } + } + }, + /** + * Lookup512: BTreeSet + **/ + BTreeSetStatType: 'Vec', + /** + * Lookup513: BTreeSet + **/ + BTreeSetStatUpdate: 'Vec', + /** + * Lookup514: BTreeSet + **/ + BTreeSetTransferCondition: 'Vec', + /** + * Lookup515: BTreeSet + **/ + BTreeSetIdentityId: 'Vec', + /** + * Lookup516: pallet_sto::Call + **/ + PalletStoCall: { + _enum: { + create_fundraiser: { + offeringPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + offeringAsset: 'PolymeshPrimitivesTicker', + raisingPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + raisingAsset: 'PolymeshPrimitivesTicker', + tiers: 'Vec', + venueId: 'u64', + start: 'Option', + end: 'Option', + minimumInvestment: 'u128', + fundraiserName: 'Bytes', + }, + invest: { + investmentPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + fundingPortfolio: 'PolymeshPrimitivesIdentityIdPortfolioId', + offeringAsset: 'PolymeshPrimitivesTicker', + id: 'u64', + purchaseAmount: 'u128', + maxPrice: 'Option', + receipt: 'Option', + }, + freeze_fundraiser: { + offeringAsset: 'PolymeshPrimitivesTicker', + id: 'u64', + }, + unfreeze_fundraiser: { + offeringAsset: 'PolymeshPrimitivesTicker', + id: 'u64', + }, + modify_fundraiser_window: { + offeringAsset: 'PolymeshPrimitivesTicker', + id: 'u64', + start: 'u64', + end: 'Option', + }, + stop: { + offeringAsset: 'PolymeshPrimitivesTicker', + id: 'u64' + } + } + }, + /** + * Lookup518: pallet_sto::PriceTier + **/ + PalletStoPriceTier: { + total: 'u128', + price: 'u128' + }, + /** + * Lookup520: pallet_treasury::Call + **/ + PalletTreasuryCall: { + _enum: { + disbursement: { + beneficiaries: 'Vec', + }, + reimbursement: { + amount: 'u128' + } + } + }, + /** + * Lookup522: polymesh_primitives::Beneficiary + **/ + PolymeshPrimitivesBeneficiary: { + id: 'PolymeshPrimitivesIdentityId', + amount: 'u128' + }, + /** + * Lookup523: pallet_utility::Call + **/ + PalletUtilityCall: { + _enum: { + batch: { + calls: 'Vec', + }, + batch_atomic: { + calls: 'Vec', + }, + batch_optimistic: { + calls: 'Vec', + }, + relay_tx: { + target: 'AccountId32', + signature: 'SpRuntimeMultiSignature', + call: 'PalletUtilityUniqueCall' + } + } + }, + /** + * Lookup525: pallet_utility::UniqueCall + **/ + PalletUtilityUniqueCall: { + nonce: 'u64', + call: 'Call' + }, + /** + * Lookup526: pallet_base::Call + **/ + PalletBaseCall: 'Null', + /** + * Lookup527: pallet_external_agents::Call + **/ + PalletExternalAgentsCall: { + _enum: { + create_group: { + ticker: 'PolymeshPrimitivesTicker', + perms: 'PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', + }, + set_group_permissions: { + ticker: 'PolymeshPrimitivesTicker', + id: 'u32', + perms: 'PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', + }, + remove_agent: { + ticker: 'PolymeshPrimitivesTicker', + agent: 'PolymeshPrimitivesIdentityId', + }, + abdicate: { + ticker: 'PolymeshPrimitivesTicker', + }, + change_group: { + ticker: 'PolymeshPrimitivesTicker', + agent: 'PolymeshPrimitivesIdentityId', + group: 'PolymeshPrimitivesAgentAgentGroup', + }, + accept_become_agent: { + authId: 'u64', + }, + create_group_and_add_auth: { + ticker: 'PolymeshPrimitivesTicker', + perms: 'PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', + target: 'PolymeshPrimitivesSecondaryKeySignatory', + }, + create_and_change_custom_group: { + ticker: 'PolymeshPrimitivesTicker', + perms: 'PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions', + agent: 'PolymeshPrimitivesIdentityId' + } + } + }, + /** + * Lookup528: pallet_relayer::Call + **/ + PalletRelayerCall: { + _enum: { + set_paying_key: { + userKey: 'AccountId32', + polyxLimit: 'u128', + }, + accept_paying_key: { + authId: 'u64', + }, + remove_paying_key: { + userKey: 'AccountId32', + payingKey: 'AccountId32', + }, + update_polyx_limit: { + userKey: 'AccountId32', + polyxLimit: 'u128', + }, + increase_polyx_limit: { + userKey: 'AccountId32', + amount: 'u128', + }, + decrease_polyx_limit: { + userKey: 'AccountId32', + amount: 'u128' + } + } + }, + /** + * Lookup529: pallet_rewards::Call + **/ + PalletRewardsCall: { + _enum: { + claim_itn_reward: { + rewardAddress: 'AccountId32', + itnAddress: 'AccountId32', + signature: 'SpRuntimeMultiSignature', + }, + set_itn_reward_status: { + itnAddress: 'AccountId32', + status: 'PalletRewardsItnRewardStatus' + } + } + }, + /** + * Lookup530: pallet_rewards::ItnRewardStatus + **/ + PalletRewardsItnRewardStatus: { + _enum: { + Unclaimed: 'u128', + Claimed: 'Null' + } + }, + /** + * Lookup531: polymesh_contracts::Call + **/ + PolymeshContractsCall: { + _enum: { + call: { + contract: 'AccountId32', + value: 'u128', + gasLimit: 'u64', + storageDepositLimit: 'Option', + data: 'Bytes', + }, + instantiate_with_code: { + endowment: 'u128', + gasLimit: 'u64', + storageDepositLimit: 'Option', + code: 'Bytes', + data: 'Bytes', + salt: 'Bytes', + perms: 'PolymeshPrimitivesSecondaryKeyPermissions', + }, + instantiate_with_hash: { + endowment: 'u128', + gasLimit: 'u64', + storageDepositLimit: 'Option', + codeHash: 'H256', + data: 'Bytes', + salt: 'Bytes', + perms: 'PolymeshPrimitivesSecondaryKeyPermissions' + } + } + }, + /** + * Lookup532: pallet_preimage::pallet::Call + **/ + PalletPreimageCall: { + _enum: { + note_preimage: { + bytes: 'Bytes', + }, + unnote_preimage: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256', + }, + request_preimage: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256', + }, + unrequest_preimage: { + _alias: { + hash_: 'hash', + }, + hash_: 'H256' + } + } + }, + /** + * Lookup533: pallet_test_utils::Call + **/ + PalletTestUtilsCall: { + _enum: { + register_did: { + uid: 'PolymeshPrimitivesCddIdInvestorUid', + secondaryKeys: 'Vec', + }, + mock_cdd_register_did: { + targetAccount: 'AccountId32', + }, + get_my_did: 'Null', + get_cdd_of: { + of: 'AccountId32' + } + } + }, + /** + * Lookup534: pallet_committee::PolymeshVotes + **/ + PalletCommitteePolymeshVotes: { + index: 'u32', + ayes: 'Vec', + nays: 'Vec', + expiry: 'PolymeshCommonUtilitiesMaybeBlock' + }, + /** + * Lookup536: pallet_committee::Error + **/ + PalletCommitteeError: { + _enum: ['DuplicateVote', 'NotAMember', 'NoSuchProposal', 'ProposalExpired', 'DuplicateProposal', 'MismatchedVotingIndex', 'InvalidProportion', 'FirstVoteReject', 'ProposalsLimitReached'] + }, + /** + * Lookup546: pallet_multisig::ProposalDetails + **/ + PalletMultisigProposalDetails: { + approvals: 'u64', + rejections: 'u64', + status: 'PalletMultisigProposalStatus', + expiry: 'Option', + autoClose: 'bool' + }, + /** + * Lookup547: pallet_multisig::ProposalStatus + **/ + PalletMultisigProposalStatus: { + _enum: ['Invalid', 'ActiveOrExpired', 'ExecutionSuccessful', 'ExecutionFailed', 'Rejected'] + }, + /** + * Lookup549: pallet_multisig::Error + **/ + PalletMultisigError: { + _enum: ['CddMissing', 'ProposalMissing', 'DecodingError', 'NoSigners', 'RequiredSignaturesOutOfBounds', 'NotASigner', 'NoSuchMultisig', 'NotEnoughSigners', 'NonceOverflow', 'AlreadyVoted', 'AlreadyASigner', 'FailedToChargeFee', 'IdentityNotCreator', 'ChangeNotAllowed', 'SignerAlreadyLinkedToMultisig', 'SignerAlreadyLinkedToIdentity', 'MultisigNotAllowedToLinkToItself', 'MissingCurrentIdentity', 'NotPrimaryKey', 'ProposalAlreadyRejected', 'ProposalExpired', 'ProposalAlreadyExecuted', 'MultisigMissingIdentity', 'FailedToSchedule', 'TooManySigners'] + }, + /** + * Lookup551: pallet_bridge::BridgeTxDetail + **/ + PalletBridgeBridgeTxDetail: { + amount: 'u128', + status: 'PalletBridgeBridgeTxStatus', + executionBlock: 'u32', + txHash: 'H256' + }, + /** + * Lookup552: pallet_bridge::BridgeTxStatus + **/ + PalletBridgeBridgeTxStatus: { + _enum: { + Absent: 'Null', + Pending: 'u8', + Frozen: 'Null', + Timelocked: 'Null', + Handled: 'Null' + } + }, + /** + * Lookup555: pallet_bridge::Error + **/ + PalletBridgeError: { + _enum: ['ControllerNotSet', 'BadCaller', 'BadAdmin', 'NoValidCdd', 'ProposalAlreadyHandled', 'Unauthorized', 'Frozen', 'NotFrozen', 'FrozenTx', 'BridgeLimitReached', 'Overflow', 'DivisionByZero', 'TimelockedTx'] + }, + /** + * Lookup556: pallet_staking::StakingLedger + **/ + PalletStakingStakingLedger: { + stash: 'AccountId32', + total: 'Compact', + active: 'Compact', + unlocking: 'Vec', + claimedRewards: 'Vec' + }, + /** + * Lookup558: pallet_staking::UnlockChunk + **/ + PalletStakingUnlockChunk: { + value: 'Compact', + era: 'Compact' + }, + /** + * Lookup559: pallet_staking::Nominations + **/ + PalletStakingNominations: { + targets: 'Vec', + submittedIn: 'u32', + suppressed: 'bool' + }, + /** + * Lookup560: pallet_staking::ActiveEraInfo + **/ + PalletStakingActiveEraInfo: { + index: 'u32', + start: 'Option' + }, + /** + * Lookup562: pallet_staking::EraRewardPoints + **/ + PalletStakingEraRewardPoints: { + total: 'u32', + individual: 'BTreeMap' + }, + /** + * Lookup565: pallet_staking::Forcing + **/ + PalletStakingForcing: { + _enum: ['NotForcing', 'ForceNew', 'ForceNone', 'ForceAlways'] + }, + /** + * Lookup567: pallet_staking::UnappliedSlash + **/ + PalletStakingUnappliedSlash: { + validator: 'AccountId32', + own: 'u128', + others: 'Vec<(AccountId32,u128)>', + reporters: 'Vec', + payout: 'u128' + }, + /** + * Lookup571: pallet_staking::slashing::SlashingSpans + **/ + PalletStakingSlashingSlashingSpans: { + spanIndex: 'u32', + lastStart: 'u32', + lastNonzeroSlash: 'u32', + prior: 'Vec' + }, + /** + * Lookup572: pallet_staking::slashing::SpanRecord + **/ + PalletStakingSlashingSpanRecord: { + slashed: 'u128', + paidOut: 'u128' + }, + /** + * Lookup573: pallet_staking::ElectionResult + **/ + PalletStakingElectionResult: { + electedStashes: 'Vec', + exposures: 'Vec<(AccountId32,PalletStakingExposure)>', + compute: 'PalletStakingElectionCompute' + }, + /** + * Lookup574: pallet_staking::ElectionStatus + **/ + PalletStakingElectionStatus: { + _enum: { + Closed: 'Null', + Open: 'u32' + } + }, + /** + * Lookup575: pallet_staking::PermissionedIdentityPrefs + **/ + PalletStakingPermissionedIdentityPrefs: { + intendedCount: 'u32', + runningCount: 'u32' + }, + /** + * Lookup576: pallet_staking::Releases + **/ + PalletStakingReleases: { + _enum: ['V1_0_0Ancient', 'V2_0_0', 'V3_0_0', 'V4_0_0', 'V5_0_0', 'V6_0_0', 'V6_0_1', 'V7_0_0'] + }, + /** + * Lookup577: pallet_staking::Error + **/ + PalletStakingError: { + _enum: ['NotController', 'NotStash', 'AlreadyBonded', 'AlreadyPaired', 'EmptyTargets', 'InvalidSlashIndex', 'InsufficientValue', 'NoMoreChunks', 'NoUnlockChunk', 'FundedTarget', 'InvalidEraToReward', 'NotSortedAndUnique', 'AlreadyClaimed', 'OffchainElectionEarlySubmission', 'OffchainElectionWeakSubmission', 'SnapshotUnavailable', 'OffchainElectionBogusWinnerCount', 'OffchainElectionBogusWinner', 'OffchainElectionBogusCompact', 'OffchainElectionBogusNominator', 'OffchainElectionBogusNomination', 'OffchainElectionSlashedNomination', 'OffchainElectionBogusSelfVote', 'OffchainElectionBogusEdge', 'OffchainElectionBogusScore', 'OffchainElectionBogusElectionSize', 'CallNotAllowed', 'IncorrectSlashingSpans', 'AlreadyExists', 'NotExists', 'NoChange', 'InvalidValidatorIdentity', 'InvalidValidatorCommission', 'StashIdentityDoesNotExist', 'StashIdentityNotPermissioned', 'StashIdentityNotCDDed', 'HitIntendedValidatorCount', 'IntendedCountIsExceedingConsensusLimit', 'BondTooSmall', 'BadState', 'TooManyTargets', 'BadTarget'] + }, + /** + * Lookup578: sp_staking::offence::OffenceDetails + **/ + SpStakingOffenceOffenceDetails: { + offender: '(AccountId32,PalletStakingExposure)', + reporters: 'Vec' + }, + /** + * Lookup583: sp_core::crypto::KeyTypeId + **/ + SpCoreCryptoKeyTypeId: '[u8;4]', + /** + * Lookup584: pallet_session::pallet::Error + **/ + PalletSessionError: { + _enum: ['InvalidProof', 'NoAssociatedValidatorId', 'DuplicatedKey', 'NoKeys', 'NoAccount'] + }, + /** + * Lookup585: pallet_grandpa::StoredState + **/ + PalletGrandpaStoredState: { + _enum: { + Live: 'Null', + PendingPause: { + scheduledAt: 'u32', + delay: 'u32', + }, + Paused: 'Null', + PendingResume: { + scheduledAt: 'u32', + delay: 'u32' + } + } + }, + /** + * Lookup586: pallet_grandpa::StoredPendingChange + **/ + PalletGrandpaStoredPendingChange: { + scheduledAt: 'u32', + delay: 'u32', + nextAuthorities: 'Vec<(SpFinalityGrandpaAppPublic,u64)>', + forced: 'Option' + }, + /** + * Lookup588: pallet_grandpa::pallet::Error + **/ + PalletGrandpaError: { + _enum: ['PauseFailed', 'ResumeFailed', 'ChangePending', 'TooSoon', 'InvalidKeyOwnershipProof', 'InvalidEquivocationProof', 'DuplicateOffenceReport'] + }, + /** + * Lookup592: pallet_im_online::BoundedOpaqueNetworkState + **/ + PalletImOnlineBoundedOpaqueNetworkState: { + peerId: 'Bytes', + externalAddresses: 'Vec' + }, + /** + * Lookup596: pallet_im_online::pallet::Error + **/ + PalletImOnlineError: { + _enum: ['InvalidKey', 'DuplicatedHeartbeat'] + }, + /** + * Lookup598: pallet_sudo::Error + **/ + PalletSudoError: { + _enum: ['RequireSudo'] + }, + /** + * Lookup599: pallet_asset::TickerRegistration + **/ + PalletAssetTickerRegistration: { + owner: 'PolymeshPrimitivesIdentityId', + expiry: 'Option' + }, + /** + * Lookup600: pallet_asset::SecurityToken + **/ + PalletAssetSecurityToken: { + totalSupply: 'u128', + ownerDid: 'PolymeshPrimitivesIdentityId', + divisible: 'bool', + assetType: 'PolymeshPrimitivesAssetAssetType' + }, + /** + * Lookup604: pallet_asset::AssetOwnershipRelation + **/ + PalletAssetAssetOwnershipRelation: { + _enum: ['NotOwned', 'TickerOwned', 'AssetOwned'] + }, + /** + * Lookup606: pallet_asset::ClassicTickerRegistration + **/ + PalletAssetClassicTickerRegistration: { + ethOwner: 'PolymeshPrimitivesEthereumEthereumAddress', + isCreated: 'bool' + }, + /** + * Lookup612: pallet_asset::Error + **/ + PalletAssetError: { + _enum: ['Unauthorized', 'AlreadyArchived', 'AlreadyUnArchived', 'ExtensionAlreadyPresent', 'AssetAlreadyCreated', 'TickerTooLong', 'TickerNotAscii', 'TickerAlreadyRegistered', 'TotalSupplyAboveLimit', 'NoSuchAsset', 'AlreadyFrozen', 'NotAnOwner', 'BalanceOverflow', 'TotalSupplyOverflow', 'InvalidGranularity', 'NotFrozen', 'InvalidTransfer', 'InsufficientBalance', 'AssetAlreadyDivisible', 'MaximumTMExtensionLimitReached', 'IncompatibleExtensionVersion', 'InvalidEthereumSignature', 'NoSuchClassicTicker', 'TickerRegistrationExpired', 'SenderSameAsReceiver', 'NoSuchDoc', 'MaxLengthOfAssetNameExceeded', 'FundingRoundNameMaxLengthExceeded', 'InvalidAssetIdentifier', 'InvestorUniquenessClaimNotAllowed', 'InvalidCustomAssetTypeId', 'AssetMetadataNameMaxLengthExceeded', 'AssetMetadataValueMaxLengthExceeded', 'AssetMetadataTypeDefMaxLengthExceeded', 'AssetMetadataKeyIsMissing', 'AssetMetadataValueIsLocked', 'AssetMetadataLocalKeyAlreadyExists', 'AssetMetadataGlobalKeyAlreadyExists'] + }, + /** + * Lookup615: pallet_corporate_actions::distribution::Error + **/ + PalletCorporateActionsDistributionError: { + _enum: ['CANotBenefit', 'AlreadyExists', 'ExpiryBeforePayment', 'HolderAlreadyPaid', 'NoSuchDistribution', 'CannotClaimBeforeStart', 'CannotClaimAfterExpiry', 'BalancePerShareProductOverflowed', 'NotDistributionCreator', 'AlreadyReclaimed', 'NotExpired', 'DistributionStarted', 'InsufficientRemainingAmount', 'DistributionAmountIsZero', 'DistributionPerShareIsZero'] + }, + /** + * Lookup622: pallet_asset::checkpoint::Error + **/ + PalletAssetCheckpointError: { + _enum: ['NoSuchSchedule', 'ScheduleNotRemovable', 'FailedToComputeNextCheckpoint', 'ScheduleDurationTooShort', 'SchedulesTooComplex'] + }, + /** + * Lookup623: polymesh_primitives::compliance_manager::AssetCompliance + **/ + PolymeshPrimitivesComplianceManagerAssetCompliance: { + paused: 'bool', + requirements: 'Vec' + }, + /** + * Lookup625: pallet_compliance_manager::Error + **/ + PalletComplianceManagerError: { + _enum: ['Unauthorized', 'DidNotExist', 'InvalidComplianceRequirementId', 'IncorrectOperationOnTrustedIssuer', 'DuplicateComplianceRequirements', 'ComplianceRequirementTooComplex'] + }, + /** + * Lookup628: pallet_corporate_actions::Error + **/ + PalletCorporateActionsError: { + _enum: ['AuthNotCAATransfer', 'DetailsTooLong', 'DuplicateDidTax', 'TooManyDidTaxes', 'TooManyTargetIds', 'NoSuchCheckpointId', 'NoSuchCA', 'NoRecordDate', 'RecordDateAfterStart', 'DeclDateAfterRecordDate', 'DeclDateInFuture', 'NotTargetedByCA'] + }, + /** + * Lookup630: pallet_corporate_actions::ballot::Error + **/ + PalletCorporateActionsBallotError: { + _enum: ['CANotNotice', 'AlreadyExists', 'NoSuchBallot', 'StartAfterEnd', 'NowAfterEnd', 'NumberOfChoicesOverflow', 'VotingAlreadyStarted', 'VotingNotStarted', 'VotingAlreadyEnded', 'WrongVoteCount', 'InsufficientVotes', 'NoSuchRCVFallback', 'RCVSelfCycle', 'RCVNotAllowed'] + }, + /** + * Lookup631: pallet_permissions::Error + **/ + PalletPermissionsError: { + _enum: ['UnauthorizedCaller'] + }, + /** + * Lookup632: pallet_pips::PipsMetadata + **/ + PalletPipsPipsMetadata: { + id: 'u32', + url: 'Option', + description: 'Option', + createdAt: 'u32', + transactionVersion: 'u32', + expiry: 'PolymeshCommonUtilitiesMaybeBlock' + }, + /** + * Lookup634: pallet_pips::DepositInfo + **/ + PalletPipsDepositInfo: { + owner: 'AccountId32', + amount: 'u128' + }, + /** + * Lookup635: pallet_pips::Pip + **/ + PalletPipsPip: { + id: 'u32', + proposal: 'Call', + state: 'PalletPipsProposalState', + proposer: 'PalletPipsProposer' + }, + /** + * Lookup636: pallet_pips::VotingResult + **/ + PalletPipsVotingResult: { + ayesCount: 'u32', + ayesStake: 'u128', + naysCount: 'u32', + naysStake: 'u128' + }, + /** + * Lookup637: pallet_pips::Vote + **/ + PalletPipsVote: '(bool,u128)', + /** + * Lookup638: pallet_pips::SnapshotMetadata + **/ + PalletPipsSnapshotMetadata: { + createdAt: 'u32', + madeBy: 'AccountId32', + id: 'u32' + }, + /** + * Lookup640: pallet_pips::Error + **/ + PalletPipsError: { + _enum: ['RescheduleNotByReleaseCoordinator', 'NotFromCommunity', 'NotByCommittee', 'TooManyActivePips', 'IncorrectDeposit', 'InsufficientDeposit', 'NoSuchProposal', 'NotACommitteeMember', 'InvalidFutureBlockNumber', 'NumberOfVotesExceeded', 'StakeAmountOfVotesExceeded', 'MissingCurrentIdentity', 'IncorrectProposalState', 'CannotSkipPip', 'SnapshotResultTooLarge', 'SnapshotIdMismatch', 'ScheduledProposalDoesntExist', 'ProposalNotInScheduledState'] + }, + /** + * Lookup646: pallet_portfolio::Error + **/ + PalletPortfolioError: { + _enum: ['PortfolioDoesNotExist', 'InsufficientPortfolioBalance', 'DestinationIsSamePortfolio', 'PortfolioNameAlreadyInUse', 'SecondaryKeyNotAuthorizedForPortfolio', 'UnauthorizedCustodian', 'InsufficientTokensLocked', 'PortfolioNotEmpty', 'DifferentIdentityPortfolios'] + }, + /** + * Lookup647: pallet_protocol_fee::Error + **/ + PalletProtocolFeeError: { + _enum: ['InsufficientAccountBalance', 'UnHandledImbalances', 'InsufficientSubsidyBalance'] + }, + /** + * Lookup650: pallet_scheduler::ScheduledV3, BlockNumber, polymesh_runtime_develop::runtime::OriginCaller, sp_core::crypto::AccountId32> + **/ + PalletSchedulerScheduledV3: { + maybeId: 'Option', + priority: 'u8', + call: 'FrameSupportScheduleMaybeHashed', + maybePeriodic: 'Option<(u32,u32)>', + origin: 'PolymeshRuntimeDevelopRuntimeOriginCaller' + }, + /** + * Lookup651: polymesh_runtime_develop::runtime::OriginCaller + **/ + PolymeshRuntimeDevelopRuntimeOriginCaller: { + _enum: { + system: 'FrameSupportDispatchRawOrigin', + __Unused1: 'Null', + __Unused2: 'Null', + __Unused3: 'Null', + Void: 'SpCoreVoid', + __Unused5: 'Null', + __Unused6: 'Null', + __Unused7: 'Null', + __Unused8: 'Null', + PolymeshCommittee: 'PalletCommitteeRawOriginInstance1', + __Unused10: 'Null', + TechnicalCommittee: 'PalletCommitteeRawOriginInstance3', + __Unused12: 'Null', + UpgradeCommittee: 'PalletCommitteeRawOriginInstance4' + } + }, + /** + * Lookup652: frame_support::dispatch::RawOrigin + **/ + FrameSupportDispatchRawOrigin: { + _enum: { + Root: 'Null', + Signed: 'AccountId32', + None: 'Null' + } + }, + /** + * Lookup653: pallet_committee::RawOrigin + **/ + PalletCommitteeRawOriginInstance1: { + _enum: ['Endorsed'] + }, + /** + * Lookup654: pallet_committee::RawOrigin + **/ + PalletCommitteeRawOriginInstance3: { + _enum: ['Endorsed'] + }, + /** + * Lookup655: pallet_committee::RawOrigin + **/ + PalletCommitteeRawOriginInstance4: { + _enum: ['Endorsed'] + }, + /** + * Lookup656: sp_core::Void + **/ + SpCoreVoid: 'Null', + /** + * Lookup657: pallet_scheduler::pallet::Error + **/ + PalletSchedulerError: { + _enum: ['FailedToSchedule', 'NotFound', 'TargetBlockNumberInPast', 'RescheduleNoChange'] + }, + /** + * Lookup658: pallet_settlement::Venue + **/ + PalletSettlementVenue: { + creator: 'PolymeshPrimitivesIdentityId', + venueType: 'PalletSettlementVenueType' + }, + /** + * Lookup661: pallet_settlement::Instruction + **/ + PalletSettlementInstruction: { + instructionId: 'u64', + venueId: 'u64', + status: 'PalletSettlementInstructionStatus', + settlementType: 'PalletSettlementSettlementType', + createdAt: 'Option', + tradeDate: 'Option', + valueDate: 'Option' + }, + /** + * Lookup662: pallet_settlement::InstructionStatus + **/ + PalletSettlementInstructionStatus: { + _enum: ['Unknown', 'Pending', 'Failed'] + }, + /** + * Lookup664: pallet_settlement::LegStatus + **/ + PalletSettlementLegStatus: { + _enum: { + PendingTokenLock: 'Null', + ExecutionPending: 'Null', + ExecutionToBeSkipped: '(AccountId32,u64)' + } + }, + /** + * Lookup666: pallet_settlement::AffirmationStatus + **/ + PalletSettlementAffirmationStatus: { + _enum: ['Unknown', 'Pending', 'Affirmed'] + }, + /** + * Lookup670: pallet_settlement::Error + **/ + PalletSettlementError: { + _enum: ['InvalidVenue', 'Unauthorized', 'NoPendingAffirm', 'InstructionNotAffirmed', 'InstructionNotPending', 'InstructionNotFailed', 'LegNotPending', 'UnauthorizedSigner', 'ReceiptAlreadyClaimed', 'ReceiptNotClaimed', 'UnauthorizedVenue', 'FailedToLockTokens', 'InstructionFailed', 'InstructionDatesInvalid', 'InstructionSettleBlockPassed', 'InvalidSignature', 'SameSenderReceiver', 'PortfolioMismatch', 'SettleOnPastBlock', 'NoPortfolioProvided', 'UnexpectedAffirmationStatus', 'FailedToSchedule', 'LegCountTooSmall', 'UnknownInstruction', 'InstructionHasTooManyLegs'] + }, + /** + * Lookup672: polymesh_primitives::statistics::Stat1stKey + **/ + PolymeshPrimitivesStatisticsStat1stKey: { + asset: 'PolymeshPrimitivesStatisticsAssetScope', + statType: 'PolymeshPrimitivesStatisticsStatType' + }, + /** + * Lookup673: polymesh_primitives::transfer_compliance::AssetTransferCompliance + **/ + PolymeshPrimitivesTransferComplianceAssetTransferCompliance: { + paused: 'bool', + requirements: 'BTreeSetTransferCondition' + }, + /** + * Lookup676: pallet_statistics::Error + **/ + PalletStatisticsError: { + _enum: ['InvalidTransfer', 'StatTypeMissing', 'StatTypeNeededByTransferCondition', 'CannotRemoveStatTypeInUse', 'StatTypeLimitReached', 'TransferConditionLimitReached'] + }, + /** + * Lookup678: pallet_sto::Error + **/ + PalletStoError: { + _enum: ['Unauthorized', 'Overflow', 'InsufficientTokensRemaining', 'FundraiserNotFound', 'FundraiserNotLive', 'FundraiserClosed', 'FundraiserExpired', 'InvalidVenue', 'InvalidPriceTiers', 'InvalidOfferingWindow', 'MaxPriceExceeded', 'InvestmentAmountTooLow'] + }, + /** + * Lookup679: pallet_treasury::Error + **/ + PalletTreasuryError: { + _enum: ['InsufficientBalance', 'InvalidIdentity'] + }, + /** + * Lookup680: pallet_utility::Error + **/ + PalletUtilityError: { + _enum: ['InvalidSignature', 'TargetCddMissing', 'InvalidNonce'] + }, + /** + * Lookup681: pallet_base::Error + **/ + PalletBaseError: { + _enum: ['TooLong', 'CounterOverflow'] + }, + /** + * Lookup683: pallet_external_agents::Error + **/ + PalletExternalAgentsError: { + _enum: ['NoSuchAG', 'UnauthorizedAgent', 'AlreadyAnAgent', 'NotAnAgent', 'RemovingLastFullAgent', 'SecondaryKeyNotAuthorizedForAsset'] + }, + /** + * Lookup684: pallet_relayer::Subsidy + **/ + PalletRelayerSubsidy: { + payingKey: 'AccountId32', + remaining: 'u128' + }, + /** + * Lookup685: pallet_relayer::Error + **/ + PalletRelayerError: { + _enum: ['UserKeyCddMissing', 'PayingKeyCddMissing', 'NoPayingKey', 'NotPayingKey', 'NotAuthorizedForPayingKey', 'NotAuthorizedForUserKey', 'Overflow'] + }, + /** + * Lookup686: pallet_rewards::Error + **/ + PalletRewardsError: { + _enum: ['UnknownItnAddress', 'ItnRewardAlreadyClaimed', 'InvalidSignature', 'UnableToCovertBalance'] + }, + /** + * Lookup687: pallet_contracts::wasm::PrefabWasmModule + **/ + PalletContractsWasmPrefabWasmModule: { + instructionWeightsVersion: 'Compact', + initial: 'Compact', + maximum: 'Compact', + code: 'Bytes' + }, + /** + * Lookup688: pallet_contracts::wasm::OwnerInfo + **/ + PalletContractsWasmOwnerInfo: { + owner: 'AccountId32', + deposit: 'Compact', + refcount: 'Compact' + }, + /** + * Lookup689: pallet_contracts::storage::RawContractInfo + **/ + PalletContractsStorageRawContractInfo: { + trieId: 'Bytes', + codeHash: 'H256', + storageDeposit: 'u128' + }, + /** + * Lookup691: pallet_contracts::storage::DeletedContract + **/ + PalletContractsStorageDeletedContract: { + trieId: 'Bytes' + }, + /** + * Lookup692: pallet_contracts::schedule::Schedule + **/ + PalletContractsSchedule: { + limits: 'PalletContractsScheduleLimits', + instructionWeights: 'PalletContractsScheduleInstructionWeights', + hostFnWeights: 'PalletContractsScheduleHostFnWeights' + }, + /** + * Lookup693: pallet_contracts::schedule::Limits + **/ + PalletContractsScheduleLimits: { + eventTopics: 'u32', + stackHeight: 'Option', + globals: 'u32', + parameters: 'u32', + memoryPages: 'u32', + tableSize: 'u32', + brTableSize: 'u32', + subjectLen: 'u32', + callDepth: 'u32', + payloadLen: 'u32', + codeLen: 'u32' + }, + /** + * Lookup694: pallet_contracts::schedule::InstructionWeights + **/ + PalletContractsScheduleInstructionWeights: { + _alias: { + r_if: 'r#if' + }, + version: 'u32', + i64const: 'u32', + i64load: 'u32', + i64store: 'u32', + select: 'u32', + r_if: 'u32', + br: 'u32', + brIf: 'u32', + brTable: 'u32', + brTablePerEntry: 'u32', + call: 'u32', + callIndirect: 'u32', + callIndirectPerParam: 'u32', + localGet: 'u32', + localSet: 'u32', + localTee: 'u32', + globalGet: 'u32', + globalSet: 'u32', + memoryCurrent: 'u32', + memoryGrow: 'u32', + i64clz: 'u32', + i64ctz: 'u32', + i64popcnt: 'u32', + i64eqz: 'u32', + i64extendsi32: 'u32', + i64extendui32: 'u32', + i32wrapi64: 'u32', + i64eq: 'u32', + i64ne: 'u32', + i64lts: 'u32', + i64ltu: 'u32', + i64gts: 'u32', + i64gtu: 'u32', + i64les: 'u32', + i64leu: 'u32', + i64ges: 'u32', + i64geu: 'u32', + i64add: 'u32', + i64sub: 'u32', + i64mul: 'u32', + i64divs: 'u32', + i64divu: 'u32', + i64rems: 'u32', + i64remu: 'u32', + i64and: 'u32', + i64or: 'u32', + i64xor: 'u32', + i64shl: 'u32', + i64shrs: 'u32', + i64shru: 'u32', + i64rotl: 'u32', + i64rotr: 'u32' + }, + /** + * Lookup695: pallet_contracts::schedule::HostFnWeights + **/ + PalletContractsScheduleHostFnWeights: { + _alias: { + r_return: 'r#return' + }, + caller: 'u64', + isContract: 'u64', + codeHash: 'u64', + ownCodeHash: 'u64', + callerIsOrigin: 'u64', + address: 'u64', + gasLeft: 'u64', + balance: 'u64', + valueTransferred: 'u64', + minimumBalance: 'u64', + blockNumber: 'u64', + now: 'u64', + weightToFee: 'u64', + gas: 'u64', + input: 'u64', + inputPerByte: 'u64', + r_return: 'u64', + returnPerByte: 'u64', + terminate: 'u64', + random: 'u64', + depositEvent: 'u64', + depositEventPerTopic: 'u64', + depositEventPerByte: 'u64', + debugMessage: 'u64', + setStorage: 'u64', + setStoragePerNewByte: 'u64', + setStoragePerOldByte: 'u64', + setCodeHash: 'u64', + clearStorage: 'u64', + clearStoragePerByte: 'u64', + containsStorage: 'u64', + containsStoragePerByte: 'u64', + getStorage: 'u64', + getStoragePerByte: 'u64', + takeStorage: 'u64', + takeStoragePerByte: 'u64', + transfer: 'u64', + call: 'u64', + delegateCall: 'u64', + callTransferSurcharge: 'u64', + callPerClonedByte: 'u64', + instantiate: 'u64', + instantiateTransferSurcharge: 'u64', + instantiatePerSaltByte: 'u64', + hashSha2256: 'u64', + hashSha2256PerByte: 'u64', + hashKeccak256: 'u64', + hashKeccak256PerByte: 'u64', + hashBlake2256: 'u64', + hashBlake2256PerByte: 'u64', + hashBlake2128: 'u64', + hashBlake2128PerByte: 'u64', + ecdsaRecover: 'u64', + ecdsaToEthAddress: 'u64' + }, + /** + * Lookup696: pallet_contracts::pallet::Error + **/ + PalletContractsError: { + _enum: ['InvalidScheduleVersion', 'InvalidCallFlags', 'OutOfGas', 'OutputBufferTooSmall', 'TransferFailed', 'MaxCallDepthReached', 'ContractNotFound', 'CodeTooLarge', 'CodeNotFound', 'OutOfBounds', 'DecodingFailed', 'ContractTrapped', 'ValueTooLarge', 'TerminatedWhileReentrant', 'InputForwarded', 'RandomSubjectTooLong', 'TooManyTopics', 'DuplicateTopics', 'NoChainExtension', 'DeletionQueueFull', 'DuplicateContract', 'TerminatedInConstructor', 'DebugMessageInvalidUTF8', 'ReentranceDenied', 'StorageDepositNotEnoughFunds', 'StorageDepositLimitExhausted', 'CodeInUse', 'ContractReverted', 'CodeRejected'] + }, + /** + * Lookup697: polymesh_contracts::Error + **/ + PolymeshContractsError: { + _enum: ['RuntimeCallNotFound', 'DataLeftAfterDecoding', 'InLenTooLarge', 'InstantiatorWithNoIdentity'] + }, + /** + * Lookup698: pallet_preimage::RequestStatus + **/ + PalletPreimageRequestStatus: { + _enum: { + Unrequested: 'Option<(AccountId32,u128)>', + Requested: 'u32' + } + }, + /** + * Lookup701: pallet_preimage::pallet::Error + **/ + PalletPreimageError: { + _enum: ['TooLarge', 'AlreadyNoted', 'NotAuthorized', 'NotNoted', 'Requested', 'NotRequested'] + }, + /** + * Lookup702: pallet_test_utils::Error + **/ + PalletTestUtilsError: 'Null', + /** + * Lookup705: frame_system::extensions::check_spec_version::CheckSpecVersion + **/ + FrameSystemExtensionsCheckSpecVersion: 'Null', + /** + * Lookup706: frame_system::extensions::check_tx_version::CheckTxVersion + **/ + FrameSystemExtensionsCheckTxVersion: 'Null', + /** + * Lookup707: frame_system::extensions::check_genesis::CheckGenesis + **/ + FrameSystemExtensionsCheckGenesis: 'Null', + /** + * Lookup710: frame_system::extensions::check_nonce::CheckNonce + **/ + FrameSystemExtensionsCheckNonce: 'Compact', + /** + * Lookup711: polymesh_extensions::check_weight::CheckWeight + **/ + PolymeshExtensionsCheckWeight: 'FrameSystemExtensionsCheckWeight', + /** + * Lookup712: frame_system::extensions::check_weight::CheckWeight + **/ + FrameSystemExtensionsCheckWeight: 'Null', + /** + * Lookup713: pallet_transaction_payment::ChargeTransactionPayment + **/ + PalletTransactionPaymentChargeTransactionPayment: 'Compact', + /** + * Lookup714: pallet_permissions::StoreCallMetadata + **/ + PalletPermissionsStoreCallMetadata: 'Null', + /** + * Lookup715: polymesh_runtime_develop::runtime::Runtime + **/ + PolymeshRuntimeDevelopRuntime: 'Null' +}; diff --git a/scripts/cli/src/interfaces/registry.ts b/scripts/cli/src/interfaces/registry.ts new file mode 100644 index 0000000000..9558477014 --- /dev/null +++ b/scripts/cli/src/interfaces/registry.ts @@ -0,0 +1,378 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +import type { ConfidentialIdentityClaimProofsScopeClaimProof, ConfidentialIdentityClaimProofsZkProofData, ConfidentialIdentitySignSignature, Curve25519DalekBackendSerialU64FieldFieldElement51, Curve25519DalekEdwardsEdwardsPoint, Curve25519DalekRistrettoCompressedRistretto, Curve25519DalekRistrettoRistrettoPoint, Curve25519DalekScalar, FinalityGrandpaEquivocationPrecommit, FinalityGrandpaEquivocationPrevote, FinalityGrandpaPrecommit, FinalityGrandpaPrevote, FrameSupportDispatchRawOrigin, FrameSupportScheduleLookupError, FrameSupportScheduleMaybeHashed, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, PalletAssetAssetOwnershipRelation, PalletAssetCall, PalletAssetCheckpointCall, PalletAssetCheckpointError, PalletAssetCheckpointScheduleSpec, PalletAssetClassicTickerImport, PalletAssetClassicTickerRegistration, PalletAssetError, PalletAssetSecurityToken, PalletAssetTickerRegistration, PalletAssetTickerRegistrationConfig, PalletAuthorshipCall, PalletAuthorshipError, PalletAuthorshipUncleEntryItem, PalletBabeCall, PalletBabeError, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBaseCall, PalletBaseError, PalletBridgeBridgeTx, PalletBridgeBridgeTxDetail, PalletBridgeBridgeTxStatus, PalletBridgeCall, PalletBridgeError, PalletBridgeHandledTxStatus, PalletBridgeRawEvent, PalletCommitteeCall, PalletCommitteeError, PalletCommitteeInstance1, PalletCommitteeInstance3, PalletCommitteeInstance4, PalletCommitteePolymeshVotes, PalletCommitteeRawEventInstance1, PalletCommitteeRawEventInstance3, PalletCommitteeRawEventInstance4, PalletCommitteeRawOriginInstance1, PalletCommitteeRawOriginInstance3, PalletCommitteeRawOriginInstance4, PalletComplianceManagerCall, PalletComplianceManagerError, PalletComplianceManagerEvent, PalletContractsError, PalletContractsEvent, PalletContractsSchedule, PalletContractsScheduleHostFnWeights, PalletContractsScheduleInstructionWeights, PalletContractsScheduleLimits, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletCorporateActionsBallotBallotMeta, PalletCorporateActionsBallotBallotTimeRange, PalletCorporateActionsBallotBallotVote, PalletCorporateActionsBallotCall, PalletCorporateActionsBallotError, PalletCorporateActionsBallotEvent, PalletCorporateActionsBallotMotion, PalletCorporateActionsCaCheckpoint, PalletCorporateActionsCaId, PalletCorporateActionsCaKind, PalletCorporateActionsCall, PalletCorporateActionsCorporateAction, PalletCorporateActionsDistribution, PalletCorporateActionsDistributionCall, PalletCorporateActionsDistributionError, PalletCorporateActionsDistributionEvent, PalletCorporateActionsError, PalletCorporateActionsEvent, PalletCorporateActionsInitiateCorporateActionArgs, PalletCorporateActionsRecordDate, PalletCorporateActionsRecordDateSpec, PalletCorporateActionsTargetIdentities, PalletCorporateActionsTargetTreatment, PalletExternalAgentsCall, PalletExternalAgentsError, PalletGrandpaCall, PalletGrandpaError, PalletGrandpaEvent, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletGroupCall, PalletGroupError, PalletGroupInstance1, PalletGroupInstance2, PalletGroupInstance3, PalletGroupInstance4, PalletIdentityCall, PalletIdentityClaim1stKey, PalletIdentityClaim2ndKey, PalletIdentityError, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineCall, PalletImOnlineError, PalletImOnlineEvent, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Public, PalletImOnlineSr25519AppSr25519Signature, PalletIndicesCall, PalletIndicesError, PalletIndicesEvent, PalletMultisigCall, PalletMultisigError, PalletMultisigProposalDetails, PalletMultisigProposalStatus, PalletMultisigRawEvent, PalletOffencesEvent, PalletPermissionsError, PalletPermissionsStoreCallMetadata, PalletPipsCall, PalletPipsCommittee, PalletPipsDepositInfo, PalletPipsError, PalletPipsPip, PalletPipsPipsMetadata, PalletPipsProposalData, PalletPipsProposalState, PalletPipsProposer, PalletPipsRawEvent, PalletPipsSnapshotMetadata, PalletPipsSnapshotResult, PalletPipsSnapshottedPip, PalletPipsVote, PalletPipsVotingResult, PalletPortfolioCall, PalletPortfolioError, PalletPortfolioMovePortfolioItem, PalletPreimageCall, PalletPreimageError, PalletPreimageEvent, PalletPreimageRequestStatus, PalletProtocolFeeCall, PalletProtocolFeeError, PalletProtocolFeeRawEvent, PalletRelayerCall, PalletRelayerError, PalletRelayerSubsidy, PalletRewardsCall, PalletRewardsError, PalletRewardsItnRewardStatus, PalletRewardsRawEvent, PalletSchedulerCall, PalletSchedulerError, PalletSchedulerEvent, PalletSchedulerScheduledV3, PalletSessionCall, PalletSessionError, PalletSessionEvent, PalletSettlementAffirmationStatus, PalletSettlementCall, PalletSettlementError, PalletSettlementInstruction, PalletSettlementInstructionStatus, PalletSettlementLeg, PalletSettlementLegStatus, PalletSettlementRawEvent, PalletSettlementReceiptDetails, PalletSettlementSettlementType, PalletSettlementVenue, PalletSettlementVenueType, PalletStakingActiveEraInfo, PalletStakingCall, PalletStakingCompactAssignments, PalletStakingElectionCompute, PalletStakingElectionResult, PalletStakingElectionSize, PalletStakingElectionStatus, PalletStakingEraRewardPoints, PalletStakingError, PalletStakingExposure, PalletStakingForcing, PalletStakingIndividualExposure, PalletStakingNominations, PalletStakingPermissionedIdentityPrefs, PalletStakingRawEvent, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingSlashingSwitch, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingUnlockChunk, PalletStakingValidatorPrefs, PalletStatisticsCall, PalletStatisticsError, PalletStoCall, PalletStoError, PalletStoFundraiser, PalletStoFundraiserStatus, PalletStoFundraiserTier, PalletStoPriceTier, PalletStoRawEvent, PalletSudoCall, PalletSudoError, PalletSudoRawEvent, PalletTestUtilsCall, PalletTestUtilsError, PalletTestUtilsRawEvent, PalletTimestampCall, PalletTransactionPaymentChargeTransactionPayment, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryRawEvent, PalletUtilityCall, PalletUtilityError, PalletUtilityEvent, PalletUtilityUniqueCall, PolymeshCommonUtilitiesAssetRawEvent, PolymeshCommonUtilitiesBalancesAccountData, PolymeshCommonUtilitiesBalancesMemo, PolymeshCommonUtilitiesBalancesRawEvent, PolymeshCommonUtilitiesBalancesReasons, PolymeshCommonUtilitiesBaseEvent, PolymeshCommonUtilitiesCheckpointEvent, PolymeshCommonUtilitiesCheckpointStoredSchedule, PolymeshCommonUtilitiesExternalAgentsEvent, PolymeshCommonUtilitiesGroupInactiveMember, PolymeshCommonUtilitiesGroupRawEventInstance1, PolymeshCommonUtilitiesGroupRawEventInstance2, PolymeshCommonUtilitiesGroupRawEventInstance3, PolymeshCommonUtilitiesGroupRawEventInstance4, PolymeshCommonUtilitiesIdentityRawEvent, PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth, PolymeshCommonUtilitiesMaybeBlock, PolymeshCommonUtilitiesPortfolioEvent, PolymeshCommonUtilitiesProtocolFeeProtocolOp, PolymeshCommonUtilitiesRelayerRawEvent, PolymeshCommonUtilitiesStatisticsEvent, PolymeshContractsCall, PolymeshContractsError, PolymeshContractsEvent, PolymeshExtensionsCheckWeight, PolymeshPrimitivesAgentAgentGroup, PolymeshPrimitivesAssetAssetType, PolymeshPrimitivesAssetIdentifier, PolymeshPrimitivesAssetMetadataAssetMetadataKey, PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus, PolymeshPrimitivesAssetMetadataAssetMetadataSpec, PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail, PolymeshPrimitivesAuthorization, PolymeshPrimitivesAuthorizationAuthorizationData, PolymeshPrimitivesBeneficiary, PolymeshPrimitivesCalendarCalendarPeriod, PolymeshPrimitivesCalendarCalendarUnit, PolymeshPrimitivesCalendarCheckpointSchedule, PolymeshPrimitivesCddId, PolymeshPrimitivesCddIdInvestorUid, PolymeshPrimitivesComplianceManagerAssetCompliance, PolymeshPrimitivesComplianceManagerComplianceRequirement, PolymeshPrimitivesCondition, PolymeshPrimitivesConditionConditionType, PolymeshPrimitivesConditionTargetIdentity, PolymeshPrimitivesConditionTrustedFor, PolymeshPrimitivesConditionTrustedIssuer, PolymeshPrimitivesDocument, PolymeshPrimitivesDocumentHash, PolymeshPrimitivesEthereumEcdsaSignature, PolymeshPrimitivesEthereumEthereumAddress, PolymeshPrimitivesEventOnly, PolymeshPrimitivesIdentityClaim, PolymeshPrimitivesIdentityClaimClaim, PolymeshPrimitivesIdentityClaimClaimType, PolymeshPrimitivesIdentityClaimScope, PolymeshPrimitivesIdentityDidRecord, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityIdPortfolioKind, PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData, PolymeshPrimitivesJurisdictionCountryCode, PolymeshPrimitivesPosRatio, PolymeshPrimitivesSecondaryKey, PolymeshPrimitivesSecondaryKeyKeyRecord, PolymeshPrimitivesSecondaryKeyPalletPermissions, PolymeshPrimitivesSecondaryKeyPermissions, PolymeshPrimitivesSecondaryKeySignatory, PolymeshPrimitivesStatisticsAssetScope, PolymeshPrimitivesStatisticsStat1stKey, PolymeshPrimitivesStatisticsStat2ndKey, PolymeshPrimitivesStatisticsStatClaim, PolymeshPrimitivesStatisticsStatOpType, PolymeshPrimitivesStatisticsStatType, PolymeshPrimitivesStatisticsStatUpdate, PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions, PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId, PolymeshPrimitivesSubsetSubsetRestrictionTicker, PolymeshPrimitivesTicker, PolymeshPrimitivesTransferComplianceAssetTransferCompliance, PolymeshPrimitivesTransferComplianceTransferCondition, PolymeshPrimitivesTransferComplianceTransferConditionExemptKey, PolymeshRuntimeCiRuntime, PolymeshRuntimeCiRuntimeOriginCaller, PolymeshRuntimeCiRuntimeSessionKeys, SchnorrkelSignSignature, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAllowedSlots, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreCryptoKeyTypeId, SpCoreEcdsaSignature, SpCoreEd25519Public, SpCoreEd25519Signature, SpCoreOffchainOpaqueNetworkState, SpCoreSr25519Public, SpCoreSr25519Signature, SpCoreVoid, SpFinalityGrandpaAppPublic, SpFinalityGrandpaAppSignature, SpFinalityGrandpaEquivocation, SpFinalityGrandpaEquivocationProof, SpNposElectionsElectionScore, SpRuntimeArithmeticError, SpRuntimeBlakeTwo256, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeHeader, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpSessionMembershipProof, SpStakingOffenceOffenceDetails, SpVersionRuntimeVersion } from '@polkadot/types/lookup'; + +declare module '@polkadot/types/types/registry' { + export interface InterfaceTypes { + ConfidentialIdentityClaimProofsScopeClaimProof: ConfidentialIdentityClaimProofsScopeClaimProof; + ConfidentialIdentityClaimProofsZkProofData: ConfidentialIdentityClaimProofsZkProofData; + ConfidentialIdentitySignSignature: ConfidentialIdentitySignSignature; + Curve25519DalekBackendSerialU64FieldFieldElement51: Curve25519DalekBackendSerialU64FieldFieldElement51; + Curve25519DalekEdwardsEdwardsPoint: Curve25519DalekEdwardsEdwardsPoint; + Curve25519DalekRistrettoCompressedRistretto: Curve25519DalekRistrettoCompressedRistretto; + Curve25519DalekRistrettoRistrettoPoint: Curve25519DalekRistrettoRistrettoPoint; + Curve25519DalekScalar: Curve25519DalekScalar; + FinalityGrandpaEquivocationPrecommit: FinalityGrandpaEquivocationPrecommit; + FinalityGrandpaEquivocationPrevote: FinalityGrandpaEquivocationPrevote; + FinalityGrandpaPrecommit: FinalityGrandpaPrecommit; + FinalityGrandpaPrevote: FinalityGrandpaPrevote; + FrameSupportDispatchRawOrigin: FrameSupportDispatchRawOrigin; + FrameSupportScheduleLookupError: FrameSupportScheduleLookupError; + FrameSupportScheduleMaybeHashed: FrameSupportScheduleMaybeHashed; + FrameSupportTokensMiscBalanceStatus: FrameSupportTokensMiscBalanceStatus; + FrameSupportWeightsDispatchClass: FrameSupportWeightsDispatchClass; + FrameSupportWeightsDispatchInfo: FrameSupportWeightsDispatchInfo; + FrameSupportWeightsPays: FrameSupportWeightsPays; + FrameSupportWeightsPerDispatchClassU32: FrameSupportWeightsPerDispatchClassU32; + FrameSupportWeightsPerDispatchClassU64: FrameSupportWeightsPerDispatchClassU64; + FrameSupportWeightsPerDispatchClassWeightsPerClass: FrameSupportWeightsPerDispatchClassWeightsPerClass; + FrameSupportWeightsRuntimeDbWeight: FrameSupportWeightsRuntimeDbWeight; + FrameSupportWeightsWeightToFeeCoefficient: FrameSupportWeightsWeightToFeeCoefficient; + FrameSystemAccountInfo: FrameSystemAccountInfo; + FrameSystemCall: FrameSystemCall; + FrameSystemError: FrameSystemError; + FrameSystemEvent: FrameSystemEvent; + FrameSystemEventRecord: FrameSystemEventRecord; + FrameSystemExtensionsCheckGenesis: FrameSystemExtensionsCheckGenesis; + FrameSystemExtensionsCheckNonce: FrameSystemExtensionsCheckNonce; + FrameSystemExtensionsCheckSpecVersion: FrameSystemExtensionsCheckSpecVersion; + FrameSystemExtensionsCheckTxVersion: FrameSystemExtensionsCheckTxVersion; + FrameSystemExtensionsCheckWeight: FrameSystemExtensionsCheckWeight; + FrameSystemLastRuntimeUpgradeInfo: FrameSystemLastRuntimeUpgradeInfo; + FrameSystemLimitsBlockLength: FrameSystemLimitsBlockLength; + FrameSystemLimitsBlockWeights: FrameSystemLimitsBlockWeights; + FrameSystemLimitsWeightsPerClass: FrameSystemLimitsWeightsPerClass; + FrameSystemPhase: FrameSystemPhase; + PalletAssetAssetOwnershipRelation: PalletAssetAssetOwnershipRelation; + PalletAssetCall: PalletAssetCall; + PalletAssetCheckpointCall: PalletAssetCheckpointCall; + PalletAssetCheckpointError: PalletAssetCheckpointError; + PalletAssetCheckpointScheduleSpec: PalletAssetCheckpointScheduleSpec; + PalletAssetClassicTickerImport: PalletAssetClassicTickerImport; + PalletAssetClassicTickerRegistration: PalletAssetClassicTickerRegistration; + PalletAssetError: PalletAssetError; + PalletAssetSecurityToken: PalletAssetSecurityToken; + PalletAssetTickerRegistration: PalletAssetTickerRegistration; + PalletAssetTickerRegistrationConfig: PalletAssetTickerRegistrationConfig; + PalletAuthorshipCall: PalletAuthorshipCall; + PalletAuthorshipError: PalletAuthorshipError; + PalletAuthorshipUncleEntryItem: PalletAuthorshipUncleEntryItem; + PalletBabeCall: PalletBabeCall; + PalletBabeError: PalletBabeError; + PalletBalancesBalanceLock: PalletBalancesBalanceLock; + PalletBalancesCall: PalletBalancesCall; + PalletBalancesError: PalletBalancesError; + PalletBaseCall: PalletBaseCall; + PalletBaseError: PalletBaseError; + PalletBridgeBridgeTx: PalletBridgeBridgeTx; + PalletBridgeBridgeTxDetail: PalletBridgeBridgeTxDetail; + PalletBridgeBridgeTxStatus: PalletBridgeBridgeTxStatus; + PalletBridgeCall: PalletBridgeCall; + PalletBridgeError: PalletBridgeError; + PalletBridgeHandledTxStatus: PalletBridgeHandledTxStatus; + PalletBridgeRawEvent: PalletBridgeRawEvent; + PalletCommitteeCall: PalletCommitteeCall; + PalletCommitteeError: PalletCommitteeError; + PalletCommitteeInstance1: PalletCommitteeInstance1; + PalletCommitteeInstance3: PalletCommitteeInstance3; + PalletCommitteeInstance4: PalletCommitteeInstance4; + PalletCommitteePolymeshVotes: PalletCommitteePolymeshVotes; + PalletCommitteeRawEventInstance1: PalletCommitteeRawEventInstance1; + PalletCommitteeRawEventInstance3: PalletCommitteeRawEventInstance3; + PalletCommitteeRawEventInstance4: PalletCommitteeRawEventInstance4; + PalletCommitteeRawOriginInstance1: PalletCommitteeRawOriginInstance1; + PalletCommitteeRawOriginInstance3: PalletCommitteeRawOriginInstance3; + PalletCommitteeRawOriginInstance4: PalletCommitteeRawOriginInstance4; + PalletComplianceManagerCall: PalletComplianceManagerCall; + PalletComplianceManagerError: PalletComplianceManagerError; + PalletComplianceManagerEvent: PalletComplianceManagerEvent; + PalletContractsError: PalletContractsError; + PalletContractsEvent: PalletContractsEvent; + PalletContractsSchedule: PalletContractsSchedule; + PalletContractsScheduleHostFnWeights: PalletContractsScheduleHostFnWeights; + PalletContractsScheduleInstructionWeights: PalletContractsScheduleInstructionWeights; + PalletContractsScheduleLimits: PalletContractsScheduleLimits; + PalletContractsStorageDeletedContract: PalletContractsStorageDeletedContract; + PalletContractsStorageRawContractInfo: PalletContractsStorageRawContractInfo; + PalletContractsWasmOwnerInfo: PalletContractsWasmOwnerInfo; + PalletContractsWasmPrefabWasmModule: PalletContractsWasmPrefabWasmModule; + PalletCorporateActionsBallotBallotMeta: PalletCorporateActionsBallotBallotMeta; + PalletCorporateActionsBallotBallotTimeRange: PalletCorporateActionsBallotBallotTimeRange; + PalletCorporateActionsBallotBallotVote: PalletCorporateActionsBallotBallotVote; + PalletCorporateActionsBallotCall: PalletCorporateActionsBallotCall; + PalletCorporateActionsBallotError: PalletCorporateActionsBallotError; + PalletCorporateActionsBallotEvent: PalletCorporateActionsBallotEvent; + PalletCorporateActionsBallotMotion: PalletCorporateActionsBallotMotion; + PalletCorporateActionsCaCheckpoint: PalletCorporateActionsCaCheckpoint; + PalletCorporateActionsCaId: PalletCorporateActionsCaId; + PalletCorporateActionsCaKind: PalletCorporateActionsCaKind; + PalletCorporateActionsCall: PalletCorporateActionsCall; + PalletCorporateActionsCorporateAction: PalletCorporateActionsCorporateAction; + PalletCorporateActionsDistribution: PalletCorporateActionsDistribution; + PalletCorporateActionsDistributionCall: PalletCorporateActionsDistributionCall; + PalletCorporateActionsDistributionError: PalletCorporateActionsDistributionError; + PalletCorporateActionsDistributionEvent: PalletCorporateActionsDistributionEvent; + PalletCorporateActionsError: PalletCorporateActionsError; + PalletCorporateActionsEvent: PalletCorporateActionsEvent; + PalletCorporateActionsInitiateCorporateActionArgs: PalletCorporateActionsInitiateCorporateActionArgs; + PalletCorporateActionsRecordDate: PalletCorporateActionsRecordDate; + PalletCorporateActionsRecordDateSpec: PalletCorporateActionsRecordDateSpec; + PalletCorporateActionsTargetIdentities: PalletCorporateActionsTargetIdentities; + PalletCorporateActionsTargetTreatment: PalletCorporateActionsTargetTreatment; + PalletExternalAgentsCall: PalletExternalAgentsCall; + PalletExternalAgentsError: PalletExternalAgentsError; + PalletGrandpaCall: PalletGrandpaCall; + PalletGrandpaError: PalletGrandpaError; + PalletGrandpaEvent: PalletGrandpaEvent; + PalletGrandpaStoredPendingChange: PalletGrandpaStoredPendingChange; + PalletGrandpaStoredState: PalletGrandpaStoredState; + PalletGroupCall: PalletGroupCall; + PalletGroupError: PalletGroupError; + PalletGroupInstance1: PalletGroupInstance1; + PalletGroupInstance2: PalletGroupInstance2; + PalletGroupInstance3: PalletGroupInstance3; + PalletGroupInstance4: PalletGroupInstance4; + PalletIdentityCall: PalletIdentityCall; + PalletIdentityClaim1stKey: PalletIdentityClaim1stKey; + PalletIdentityClaim2ndKey: PalletIdentityClaim2ndKey; + PalletIdentityError: PalletIdentityError; + PalletImOnlineBoundedOpaqueNetworkState: PalletImOnlineBoundedOpaqueNetworkState; + PalletImOnlineCall: PalletImOnlineCall; + PalletImOnlineError: PalletImOnlineError; + PalletImOnlineEvent: PalletImOnlineEvent; + PalletImOnlineHeartbeat: PalletImOnlineHeartbeat; + PalletImOnlineSr25519AppSr25519Public: PalletImOnlineSr25519AppSr25519Public; + PalletImOnlineSr25519AppSr25519Signature: PalletImOnlineSr25519AppSr25519Signature; + PalletIndicesCall: PalletIndicesCall; + PalletIndicesError: PalletIndicesError; + PalletIndicesEvent: PalletIndicesEvent; + PalletMultisigCall: PalletMultisigCall; + PalletMultisigError: PalletMultisigError; + PalletMultisigProposalDetails: PalletMultisigProposalDetails; + PalletMultisigProposalStatus: PalletMultisigProposalStatus; + PalletMultisigRawEvent: PalletMultisigRawEvent; + PalletOffencesEvent: PalletOffencesEvent; + PalletPermissionsError: PalletPermissionsError; + PalletPermissionsStoreCallMetadata: PalletPermissionsStoreCallMetadata; + PalletPipsCall: PalletPipsCall; + PalletPipsCommittee: PalletPipsCommittee; + PalletPipsDepositInfo: PalletPipsDepositInfo; + PalletPipsError: PalletPipsError; + PalletPipsPip: PalletPipsPip; + PalletPipsPipsMetadata: PalletPipsPipsMetadata; + PalletPipsProposalData: PalletPipsProposalData; + PalletPipsProposalState: PalletPipsProposalState; + PalletPipsProposer: PalletPipsProposer; + PalletPipsRawEvent: PalletPipsRawEvent; + PalletPipsSnapshotMetadata: PalletPipsSnapshotMetadata; + PalletPipsSnapshotResult: PalletPipsSnapshotResult; + PalletPipsSnapshottedPip: PalletPipsSnapshottedPip; + PalletPipsVote: PalletPipsVote; + PalletPipsVotingResult: PalletPipsVotingResult; + PalletPortfolioCall: PalletPortfolioCall; + PalletPortfolioError: PalletPortfolioError; + PalletPortfolioMovePortfolioItem: PalletPortfolioMovePortfolioItem; + PalletPreimageCall: PalletPreimageCall; + PalletPreimageError: PalletPreimageError; + PalletPreimageEvent: PalletPreimageEvent; + PalletPreimageRequestStatus: PalletPreimageRequestStatus; + PalletProtocolFeeCall: PalletProtocolFeeCall; + PalletProtocolFeeError: PalletProtocolFeeError; + PalletProtocolFeeRawEvent: PalletProtocolFeeRawEvent; + PalletRelayerCall: PalletRelayerCall; + PalletRelayerError: PalletRelayerError; + PalletRelayerSubsidy: PalletRelayerSubsidy; + PalletRewardsCall: PalletRewardsCall; + PalletRewardsError: PalletRewardsError; + PalletRewardsItnRewardStatus: PalletRewardsItnRewardStatus; + PalletRewardsRawEvent: PalletRewardsRawEvent; + PalletSchedulerCall: PalletSchedulerCall; + PalletSchedulerError: PalletSchedulerError; + PalletSchedulerEvent: PalletSchedulerEvent; + PalletSchedulerScheduledV3: PalletSchedulerScheduledV3; + PalletSessionCall: PalletSessionCall; + PalletSessionError: PalletSessionError; + PalletSessionEvent: PalletSessionEvent; + PalletSettlementAffirmationStatus: PalletSettlementAffirmationStatus; + PalletSettlementCall: PalletSettlementCall; + PalletSettlementError: PalletSettlementError; + PalletSettlementInstruction: PalletSettlementInstruction; + PalletSettlementInstructionStatus: PalletSettlementInstructionStatus; + PalletSettlementLeg: PalletSettlementLeg; + PalletSettlementLegStatus: PalletSettlementLegStatus; + PalletSettlementRawEvent: PalletSettlementRawEvent; + PalletSettlementReceiptDetails: PalletSettlementReceiptDetails; + PalletSettlementSettlementType: PalletSettlementSettlementType; + PalletSettlementVenue: PalletSettlementVenue; + PalletSettlementVenueType: PalletSettlementVenueType; + PalletStakingActiveEraInfo: PalletStakingActiveEraInfo; + PalletStakingCall: PalletStakingCall; + PalletStakingCompactAssignments: PalletStakingCompactAssignments; + PalletStakingElectionCompute: PalletStakingElectionCompute; + PalletStakingElectionResult: PalletStakingElectionResult; + PalletStakingElectionSize: PalletStakingElectionSize; + PalletStakingElectionStatus: PalletStakingElectionStatus; + PalletStakingEraRewardPoints: PalletStakingEraRewardPoints; + PalletStakingError: PalletStakingError; + PalletStakingExposure: PalletStakingExposure; + PalletStakingForcing: PalletStakingForcing; + PalletStakingIndividualExposure: PalletStakingIndividualExposure; + PalletStakingNominations: PalletStakingNominations; + PalletStakingPermissionedIdentityPrefs: PalletStakingPermissionedIdentityPrefs; + PalletStakingRawEvent: PalletStakingRawEvent; + PalletStakingReleases: PalletStakingReleases; + PalletStakingRewardDestination: PalletStakingRewardDestination; + PalletStakingSlashingSlashingSpans: PalletStakingSlashingSlashingSpans; + PalletStakingSlashingSpanRecord: PalletStakingSlashingSpanRecord; + PalletStakingSlashingSwitch: PalletStakingSlashingSwitch; + PalletStakingStakingLedger: PalletStakingStakingLedger; + PalletStakingUnappliedSlash: PalletStakingUnappliedSlash; + PalletStakingUnlockChunk: PalletStakingUnlockChunk; + PalletStakingValidatorPrefs: PalletStakingValidatorPrefs; + PalletStatisticsCall: PalletStatisticsCall; + PalletStatisticsError: PalletStatisticsError; + PalletStoCall: PalletStoCall; + PalletStoError: PalletStoError; + PalletStoFundraiser: PalletStoFundraiser; + PalletStoFundraiserStatus: PalletStoFundraiserStatus; + PalletStoFundraiserTier: PalletStoFundraiserTier; + PalletStoPriceTier: PalletStoPriceTier; + PalletStoRawEvent: PalletStoRawEvent; + PalletSudoCall: PalletSudoCall; + PalletSudoError: PalletSudoError; + PalletSudoRawEvent: PalletSudoRawEvent; + PalletTestUtilsCall: PalletTestUtilsCall; + PalletTestUtilsError: PalletTestUtilsError; + PalletTestUtilsRawEvent: PalletTestUtilsRawEvent; + PalletTimestampCall: PalletTimestampCall; + PalletTransactionPaymentChargeTransactionPayment: PalletTransactionPaymentChargeTransactionPayment; + PalletTransactionPaymentReleases: PalletTransactionPaymentReleases; + PalletTreasuryCall: PalletTreasuryCall; + PalletTreasuryError: PalletTreasuryError; + PalletTreasuryRawEvent: PalletTreasuryRawEvent; + PalletUtilityCall: PalletUtilityCall; + PalletUtilityError: PalletUtilityError; + PalletUtilityEvent: PalletUtilityEvent; + PalletUtilityUniqueCall: PalletUtilityUniqueCall; + PolymeshCommonUtilitiesAssetRawEvent: PolymeshCommonUtilitiesAssetRawEvent; + PolymeshCommonUtilitiesBalancesAccountData: PolymeshCommonUtilitiesBalancesAccountData; + PolymeshCommonUtilitiesBalancesMemo: PolymeshCommonUtilitiesBalancesMemo; + PolymeshCommonUtilitiesBalancesRawEvent: PolymeshCommonUtilitiesBalancesRawEvent; + PolymeshCommonUtilitiesBalancesReasons: PolymeshCommonUtilitiesBalancesReasons; + PolymeshCommonUtilitiesBaseEvent: PolymeshCommonUtilitiesBaseEvent; + PolymeshCommonUtilitiesCheckpointEvent: PolymeshCommonUtilitiesCheckpointEvent; + PolymeshCommonUtilitiesCheckpointStoredSchedule: PolymeshCommonUtilitiesCheckpointStoredSchedule; + PolymeshCommonUtilitiesExternalAgentsEvent: PolymeshCommonUtilitiesExternalAgentsEvent; + PolymeshCommonUtilitiesGroupInactiveMember: PolymeshCommonUtilitiesGroupInactiveMember; + PolymeshCommonUtilitiesGroupRawEventInstance1: PolymeshCommonUtilitiesGroupRawEventInstance1; + PolymeshCommonUtilitiesGroupRawEventInstance2: PolymeshCommonUtilitiesGroupRawEventInstance2; + PolymeshCommonUtilitiesGroupRawEventInstance3: PolymeshCommonUtilitiesGroupRawEventInstance3; + PolymeshCommonUtilitiesGroupRawEventInstance4: PolymeshCommonUtilitiesGroupRawEventInstance4; + PolymeshCommonUtilitiesIdentityRawEvent: PolymeshCommonUtilitiesIdentityRawEvent; + PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth: PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth; + PolymeshCommonUtilitiesMaybeBlock: PolymeshCommonUtilitiesMaybeBlock; + PolymeshCommonUtilitiesPortfolioEvent: PolymeshCommonUtilitiesPortfolioEvent; + PolymeshCommonUtilitiesProtocolFeeProtocolOp: PolymeshCommonUtilitiesProtocolFeeProtocolOp; + PolymeshCommonUtilitiesRelayerRawEvent: PolymeshCommonUtilitiesRelayerRawEvent; + PolymeshCommonUtilitiesStatisticsEvent: PolymeshCommonUtilitiesStatisticsEvent; + PolymeshContractsCall: PolymeshContractsCall; + PolymeshContractsError: PolymeshContractsError; + PolymeshContractsEvent: PolymeshContractsEvent; + PolymeshExtensionsCheckWeight: PolymeshExtensionsCheckWeight; + PolymeshPrimitivesAgentAgentGroup: PolymeshPrimitivesAgentAgentGroup; + PolymeshPrimitivesAssetAssetType: PolymeshPrimitivesAssetAssetType; + PolymeshPrimitivesAssetIdentifier: PolymeshPrimitivesAssetIdentifier; + PolymeshPrimitivesAssetMetadataAssetMetadataKey: PolymeshPrimitivesAssetMetadataAssetMetadataKey; + PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus: PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus; + PolymeshPrimitivesAssetMetadataAssetMetadataSpec: PolymeshPrimitivesAssetMetadataAssetMetadataSpec; + PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail: PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail; + PolymeshPrimitivesAuthorization: PolymeshPrimitivesAuthorization; + PolymeshPrimitivesAuthorizationAuthorizationData: PolymeshPrimitivesAuthorizationAuthorizationData; + PolymeshPrimitivesBeneficiary: PolymeshPrimitivesBeneficiary; + PolymeshPrimitivesCalendarCalendarPeriod: PolymeshPrimitivesCalendarCalendarPeriod; + PolymeshPrimitivesCalendarCalendarUnit: PolymeshPrimitivesCalendarCalendarUnit; + PolymeshPrimitivesCalendarCheckpointSchedule: PolymeshPrimitivesCalendarCheckpointSchedule; + PolymeshPrimitivesCddId: PolymeshPrimitivesCddId; + PolymeshPrimitivesCddIdInvestorUid: PolymeshPrimitivesCddIdInvestorUid; + PolymeshPrimitivesComplianceManagerAssetCompliance: PolymeshPrimitivesComplianceManagerAssetCompliance; + PolymeshPrimitivesComplianceManagerComplianceRequirement: PolymeshPrimitivesComplianceManagerComplianceRequirement; + PolymeshPrimitivesCondition: PolymeshPrimitivesCondition; + PolymeshPrimitivesConditionConditionType: PolymeshPrimitivesConditionConditionType; + PolymeshPrimitivesConditionTargetIdentity: PolymeshPrimitivesConditionTargetIdentity; + PolymeshPrimitivesConditionTrustedFor: PolymeshPrimitivesConditionTrustedFor; + PolymeshPrimitivesConditionTrustedIssuer: PolymeshPrimitivesConditionTrustedIssuer; + PolymeshPrimitivesDocument: PolymeshPrimitivesDocument; + PolymeshPrimitivesDocumentHash: PolymeshPrimitivesDocumentHash; + PolymeshPrimitivesEthereumEcdsaSignature: PolymeshPrimitivesEthereumEcdsaSignature; + PolymeshPrimitivesEthereumEthereumAddress: PolymeshPrimitivesEthereumEthereumAddress; + PolymeshPrimitivesEventOnly: PolymeshPrimitivesEventOnly; + PolymeshPrimitivesIdentityClaim: PolymeshPrimitivesIdentityClaim; + PolymeshPrimitivesIdentityClaimClaim: PolymeshPrimitivesIdentityClaimClaim; + PolymeshPrimitivesIdentityClaimClaimType: PolymeshPrimitivesIdentityClaimClaimType; + PolymeshPrimitivesIdentityClaimScope: PolymeshPrimitivesIdentityClaimScope; + PolymeshPrimitivesIdentityDidRecord: PolymeshPrimitivesIdentityDidRecord; + PolymeshPrimitivesIdentityId: PolymeshPrimitivesIdentityId; + PolymeshPrimitivesIdentityIdPortfolioId: PolymeshPrimitivesIdentityIdPortfolioId; + PolymeshPrimitivesIdentityIdPortfolioKind: PolymeshPrimitivesIdentityIdPortfolioKind; + PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData: PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData; + PolymeshPrimitivesJurisdictionCountryCode: PolymeshPrimitivesJurisdictionCountryCode; + PolymeshPrimitivesPosRatio: PolymeshPrimitivesPosRatio; + PolymeshPrimitivesSecondaryKey: PolymeshPrimitivesSecondaryKey; + PolymeshPrimitivesSecondaryKeyKeyRecord: PolymeshPrimitivesSecondaryKeyKeyRecord; + PolymeshPrimitivesSecondaryKeyPalletPermissions: PolymeshPrimitivesSecondaryKeyPalletPermissions; + PolymeshPrimitivesSecondaryKeyPermissions: PolymeshPrimitivesSecondaryKeyPermissions; + PolymeshPrimitivesSecondaryKeySignatory: PolymeshPrimitivesSecondaryKeySignatory; + PolymeshPrimitivesStatisticsAssetScope: PolymeshPrimitivesStatisticsAssetScope; + PolymeshPrimitivesStatisticsStat1stKey: PolymeshPrimitivesStatisticsStat1stKey; + PolymeshPrimitivesStatisticsStat2ndKey: PolymeshPrimitivesStatisticsStat2ndKey; + PolymeshPrimitivesStatisticsStatClaim: PolymeshPrimitivesStatisticsStatClaim; + PolymeshPrimitivesStatisticsStatOpType: PolymeshPrimitivesStatisticsStatOpType; + PolymeshPrimitivesStatisticsStatType: PolymeshPrimitivesStatisticsStatType; + PolymeshPrimitivesStatisticsStatUpdate: PolymeshPrimitivesStatisticsStatUpdate; + PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName: PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName; + PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId: PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId; + PolymeshPrimitivesSubsetSubsetRestrictionTicker: PolymeshPrimitivesSubsetSubsetRestrictionTicker; + PolymeshPrimitivesTicker: PolymeshPrimitivesTicker; + PolymeshPrimitivesTransferComplianceAssetTransferCompliance: PolymeshPrimitivesTransferComplianceAssetTransferCompliance; + PolymeshPrimitivesTransferComplianceTransferCondition: PolymeshPrimitivesTransferComplianceTransferCondition; + PolymeshPrimitivesTransferComplianceTransferConditionExemptKey: PolymeshPrimitivesTransferComplianceTransferConditionExemptKey; + PolymeshRuntimeCiRuntime: PolymeshRuntimeCiRuntime; + PolymeshRuntimeCiRuntimeOriginCaller: PolymeshRuntimeCiRuntimeOriginCaller; + PolymeshRuntimeCiRuntimeSessionKeys: PolymeshRuntimeCiRuntimeSessionKeys; + SchnorrkelSignSignature: SchnorrkelSignSignature; + SpAuthorityDiscoveryAppPublic: SpAuthorityDiscoveryAppPublic; + SpConsensusBabeAllowedSlots: SpConsensusBabeAllowedSlots; + SpConsensusBabeAppPublic: SpConsensusBabeAppPublic; + SpConsensusBabeBabeEpochConfiguration: SpConsensusBabeBabeEpochConfiguration; + SpConsensusBabeDigestsNextConfigDescriptor: SpConsensusBabeDigestsNextConfigDescriptor; + SpConsensusSlotsEquivocationProof: SpConsensusSlotsEquivocationProof; + SpCoreCryptoKeyTypeId: SpCoreCryptoKeyTypeId; + SpCoreEcdsaSignature: SpCoreEcdsaSignature; + SpCoreEd25519Public: SpCoreEd25519Public; + SpCoreEd25519Signature: SpCoreEd25519Signature; + SpCoreOffchainOpaqueNetworkState: SpCoreOffchainOpaqueNetworkState; + SpCoreSr25519Public: SpCoreSr25519Public; + SpCoreSr25519Signature: SpCoreSr25519Signature; + SpCoreVoid: SpCoreVoid; + SpFinalityGrandpaAppPublic: SpFinalityGrandpaAppPublic; + SpFinalityGrandpaAppSignature: SpFinalityGrandpaAppSignature; + SpFinalityGrandpaEquivocation: SpFinalityGrandpaEquivocation; + SpFinalityGrandpaEquivocationProof: SpFinalityGrandpaEquivocationProof; + SpNposElectionsElectionScore: SpNposElectionsElectionScore; + SpRuntimeArithmeticError: SpRuntimeArithmeticError; + SpRuntimeBlakeTwo256: SpRuntimeBlakeTwo256; + SpRuntimeDigest: SpRuntimeDigest; + SpRuntimeDigestDigestItem: SpRuntimeDigestDigestItem; + SpRuntimeDispatchError: SpRuntimeDispatchError; + SpRuntimeHeader: SpRuntimeHeader; + SpRuntimeModuleError: SpRuntimeModuleError; + SpRuntimeMultiSignature: SpRuntimeMultiSignature; + SpRuntimeTokenError: SpRuntimeTokenError; + SpRuntimeTransactionalError: SpRuntimeTransactionalError; + SpSessionMembershipProof: SpSessionMembershipProof; + SpStakingOffenceOffenceDetails: SpStakingOffenceOffenceDetails; + SpVersionRuntimeVersion: SpVersionRuntimeVersion; + } // InterfaceTypes +} // declare module diff --git a/scripts/cli/src/interfaces/types-lookup.ts b/scripts/cli/src/interfaces/types-lookup.ts new file mode 100644 index 0000000000..d9a1877632 --- /dev/null +++ b/scripts/cli/src/interfaces/types-lookup.ts @@ -0,0 +1,5307 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +declare module '@polkadot/types/lookup' { + import type { BTreeMap, Bytes, Compact, Enum, Null, Option, Result, Struct, Text, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; + import type { ITuple } from '@polkadot/types-codec/types'; + import type { AccountId32, Call, H256, H512, MultiAddress, PerU16, Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime'; + import type { Event } from '@polkadot/types/interfaces/system'; + + /** @name FrameSystemAccountInfo (3) */ + export interface FrameSystemAccountInfo extends Struct { + readonly nonce: u32; + readonly consumers: u32; + readonly providers: u32; + readonly sufficients: u32; + readonly data: PolymeshCommonUtilitiesBalancesAccountData; + } + + /** @name PolymeshCommonUtilitiesBalancesAccountData (5) */ + export interface PolymeshCommonUtilitiesBalancesAccountData extends Struct { + readonly free: u128; + readonly reserved: u128; + readonly miscFrozen: u128; + readonly feeFrozen: u128; + } + + /** @name FrameSupportWeightsPerDispatchClassU64 (7) */ + export interface FrameSupportWeightsPerDispatchClassU64 extends Struct { + readonly normal: u64; + readonly operational: u64; + readonly mandatory: u64; + } + + /** @name SpRuntimeDigest (11) */ + export interface SpRuntimeDigest extends Struct { + readonly logs: Vec; + } + + /** @name SpRuntimeDigestDigestItem (13) */ + export interface SpRuntimeDigestDigestItem extends Enum { + readonly isOther: boolean; + readonly asOther: Bytes; + readonly isConsensus: boolean; + readonly asConsensus: ITuple<[U8aFixed, Bytes]>; + readonly isSeal: boolean; + readonly asSeal: ITuple<[U8aFixed, Bytes]>; + readonly isPreRuntime: boolean; + readonly asPreRuntime: ITuple<[U8aFixed, Bytes]>; + readonly isRuntimeEnvironmentUpdated: boolean; + readonly type: 'Other' | 'Consensus' | 'Seal' | 'PreRuntime' | 'RuntimeEnvironmentUpdated'; + } + + /** @name FrameSystemEventRecord (16) */ + export interface FrameSystemEventRecord extends Struct { + readonly phase: FrameSystemPhase; + readonly event: Event; + readonly topics: Vec; + } + + /** @name FrameSystemEvent (18) */ + export interface FrameSystemEvent extends Enum { + readonly isExtrinsicSuccess: boolean; + readonly asExtrinsicSuccess: { + readonly dispatchInfo: FrameSupportWeightsDispatchInfo; + } & Struct; + readonly isExtrinsicFailed: boolean; + readonly asExtrinsicFailed: { + readonly dispatchError: SpRuntimeDispatchError; + readonly dispatchInfo: FrameSupportWeightsDispatchInfo; + } & Struct; + readonly isCodeUpdated: boolean; + readonly isNewAccount: boolean; + readonly asNewAccount: { + readonly account: AccountId32; + } & Struct; + readonly isKilledAccount: boolean; + readonly asKilledAccount: { + readonly account: AccountId32; + } & Struct; + readonly isRemarked: boolean; + readonly asRemarked: { + readonly sender: AccountId32; + readonly hash_: H256; + } & Struct; + readonly type: 'ExtrinsicSuccess' | 'ExtrinsicFailed' | 'CodeUpdated' | 'NewAccount' | 'KilledAccount' | 'Remarked'; + } + + /** @name FrameSupportWeightsDispatchInfo (19) */ + export interface FrameSupportWeightsDispatchInfo extends Struct { + readonly weight: u64; + readonly class: FrameSupportWeightsDispatchClass; + readonly paysFee: FrameSupportWeightsPays; + } + + /** @name FrameSupportWeightsDispatchClass (20) */ + export interface FrameSupportWeightsDispatchClass extends Enum { + readonly isNormal: boolean; + readonly isOperational: boolean; + readonly isMandatory: boolean; + readonly type: 'Normal' | 'Operational' | 'Mandatory'; + } + + /** @name FrameSupportWeightsPays (21) */ + export interface FrameSupportWeightsPays extends Enum { + readonly isYes: boolean; + readonly isNo: boolean; + readonly type: 'Yes' | 'No'; + } + + /** @name SpRuntimeDispatchError (22) */ + export interface SpRuntimeDispatchError extends Enum { + readonly isOther: boolean; + readonly isCannotLookup: boolean; + readonly isBadOrigin: boolean; + readonly isModule: boolean; + readonly asModule: SpRuntimeModuleError; + readonly isConsumerRemaining: boolean; + readonly isNoProviders: boolean; + readonly isTooManyConsumers: boolean; + readonly isToken: boolean; + readonly asToken: SpRuntimeTokenError; + readonly isArithmetic: boolean; + readonly asArithmetic: SpRuntimeArithmeticError; + readonly isTransactional: boolean; + readonly asTransactional: SpRuntimeTransactionalError; + readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'TooManyConsumers' | 'Token' | 'Arithmetic' | 'Transactional'; + } + + /** @name SpRuntimeModuleError (23) */ + export interface SpRuntimeModuleError extends Struct { + readonly index: u8; + readonly error: U8aFixed; + } + + /** @name SpRuntimeTokenError (24) */ + export interface SpRuntimeTokenError extends Enum { + readonly isNoFunds: boolean; + readonly isWouldDie: boolean; + readonly isBelowMinimum: boolean; + readonly isCannotCreate: boolean; + readonly isUnknownAsset: boolean; + readonly isFrozen: boolean; + readonly isUnsupported: boolean; + readonly type: 'NoFunds' | 'WouldDie' | 'BelowMinimum' | 'CannotCreate' | 'UnknownAsset' | 'Frozen' | 'Unsupported'; + } + + /** @name SpRuntimeArithmeticError (25) */ + export interface SpRuntimeArithmeticError extends Enum { + readonly isUnderflow: boolean; + readonly isOverflow: boolean; + readonly isDivisionByZero: boolean; + readonly type: 'Underflow' | 'Overflow' | 'DivisionByZero'; + } + + /** @name SpRuntimeTransactionalError (26) */ + export interface SpRuntimeTransactionalError extends Enum { + readonly isLimitReached: boolean; + readonly isNoLayer: boolean; + readonly type: 'LimitReached' | 'NoLayer'; + } + + /** @name PalletIndicesEvent (27) */ + export interface PalletIndicesEvent extends Enum { + readonly isIndexAssigned: boolean; + readonly asIndexAssigned: { + readonly who: AccountId32; + readonly index: u32; + } & Struct; + readonly isIndexFreed: boolean; + readonly asIndexFreed: { + readonly index: u32; + } & Struct; + readonly isIndexFrozen: boolean; + readonly asIndexFrozen: { + readonly index: u32; + readonly who: AccountId32; + } & Struct; + readonly type: 'IndexAssigned' | 'IndexFreed' | 'IndexFrozen'; + } + + /** @name PolymeshCommonUtilitiesBalancesRawEvent (28) */ + export interface PolymeshCommonUtilitiesBalancesRawEvent extends Enum { + readonly isEndowed: boolean; + readonly asEndowed: ITuple<[Option, AccountId32, u128]>; + readonly isTransfer: boolean; + readonly asTransfer: ITuple<[Option, AccountId32, Option, AccountId32, u128, Option]>; + readonly isBalanceSet: boolean; + readonly asBalanceSet: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u128, u128]>; + readonly isAccountBalanceBurned: boolean; + readonly asAccountBalanceBurned: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isReserved: boolean; + readonly asReserved: ITuple<[AccountId32, u128]>; + readonly isUnreserved: boolean; + readonly asUnreserved: ITuple<[AccountId32, u128]>; + readonly isReserveRepatriated: boolean; + readonly asReserveRepatriated: ITuple<[AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>; + readonly type: 'Endowed' | 'Transfer' | 'BalanceSet' | 'AccountBalanceBurned' | 'Reserved' | 'Unreserved' | 'ReserveRepatriated'; + } + + /** @name PolymeshPrimitivesIdentityId (30) */ + export interface PolymeshPrimitivesIdentityId extends U8aFixed {} + + /** @name PolymeshCommonUtilitiesBalancesMemo (32) */ + export interface PolymeshCommonUtilitiesBalancesMemo extends U8aFixed {} + + /** @name FrameSupportTokensMiscBalanceStatus (33) */ + export interface FrameSupportTokensMiscBalanceStatus extends Enum { + readonly isFree: boolean; + readonly isReserved: boolean; + readonly type: 'Free' | 'Reserved'; + } + + /** @name PolymeshCommonUtilitiesIdentityRawEvent (34) */ + export interface PolymeshCommonUtilitiesIdentityRawEvent extends Enum { + readonly isDidCreated: boolean; + readonly asDidCreated: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, Vec]>; + readonly isSecondaryKeysAdded: boolean; + readonly asSecondaryKeysAdded: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isSecondaryKeysRemoved: boolean; + readonly asSecondaryKeysRemoved: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isSecondaryKeyLeftIdentity: boolean; + readonly asSecondaryKeyLeftIdentity: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isSecondaryKeyPermissionsUpdated: boolean; + readonly asSecondaryKeyPermissionsUpdated: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeyPermissions, PolymeshPrimitivesSecondaryKeyPermissions]>; + readonly isPrimaryKeyUpdated: boolean; + readonly asPrimaryKeyUpdated: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, AccountId32]>; + readonly isClaimAdded: boolean; + readonly asClaimAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaim]>; + readonly isClaimRevoked: boolean; + readonly asClaimRevoked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityClaim]>; + readonly isAssetDidRegistered: boolean; + readonly asAssetDidRegistered: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isAuthorizationAdded: boolean; + readonly asAuthorizationAdded: ITuple<[PolymeshPrimitivesIdentityId, Option, Option, u64, PolymeshPrimitivesAuthorizationAuthorizationData, Option]>; + readonly isAuthorizationRevoked: boolean; + readonly asAuthorizationRevoked: ITuple<[Option, Option, u64]>; + readonly isAuthorizationRejected: boolean; + readonly asAuthorizationRejected: ITuple<[Option, Option, u64]>; + readonly isAuthorizationConsumed: boolean; + readonly asAuthorizationConsumed: ITuple<[Option, Option, u64]>; + readonly isCddRequirementForPrimaryKeyUpdated: boolean; + readonly asCddRequirementForPrimaryKeyUpdated: bool; + readonly isCddClaimsInvalidated: boolean; + readonly asCddClaimsInvalidated: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isSecondaryKeysFrozen: boolean; + readonly asSecondaryKeysFrozen: PolymeshPrimitivesIdentityId; + readonly isSecondaryKeysUnfrozen: boolean; + readonly asSecondaryKeysUnfrozen: PolymeshPrimitivesIdentityId; + readonly type: 'DidCreated' | 'SecondaryKeysAdded' | 'SecondaryKeysRemoved' | 'SecondaryKeyLeftIdentity' | 'SecondaryKeyPermissionsUpdated' | 'PrimaryKeyUpdated' | 'ClaimAdded' | 'ClaimRevoked' | 'AssetDidRegistered' | 'AuthorizationAdded' | 'AuthorizationRevoked' | 'AuthorizationRejected' | 'AuthorizationConsumed' | 'CddRequirementForPrimaryKeyUpdated' | 'CddClaimsInvalidated' | 'SecondaryKeysFrozen' | 'SecondaryKeysUnfrozen'; + } + + /** @name PolymeshPrimitivesSecondaryKey (36) */ + export interface PolymeshPrimitivesSecondaryKey extends Struct { + readonly key: AccountId32; + readonly permissions: PolymeshPrimitivesSecondaryKeyPermissions; + } + + /** @name PolymeshPrimitivesSecondaryKeyPermissions (37) */ + export interface PolymeshPrimitivesSecondaryKeyPermissions extends Struct { + readonly asset: PolymeshPrimitivesSubsetSubsetRestrictionTicker; + readonly extrinsic: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + readonly portfolio: PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId; + } + + /** @name PolymeshPrimitivesSubsetSubsetRestrictionTicker (38) */ + export interface PolymeshPrimitivesSubsetSubsetRestrictionTicker extends Enum { + readonly isWhole: boolean; + readonly isThese: boolean; + readonly asThese: BTreeSetTicker; + readonly isExcept: boolean; + readonly asExcept: BTreeSetTicker; + readonly type: 'Whole' | 'These' | 'Except'; + } + + /** @name PolymeshPrimitivesTicker (39) */ + export interface PolymeshPrimitivesTicker extends U8aFixed {} + + /** @name BTreeSetTicker (41) */ + export interface BTreeSetTicker extends Vec {} + + /** @name PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions (43) */ + export interface PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions extends Enum { + readonly isWhole: boolean; + readonly isThese: boolean; + readonly asThese: BTreeSetPalletPermissions; + readonly isExcept: boolean; + readonly asExcept: BTreeSetPalletPermissions; + readonly type: 'Whole' | 'These' | 'Except'; + } + + /** @name PolymeshPrimitivesSecondaryKeyPalletPermissions (44) */ + export interface PolymeshPrimitivesSecondaryKeyPalletPermissions extends Struct { + readonly palletName: Bytes; + readonly dispatchableNames: PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName; + } + + /** @name PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName (46) */ + export interface PolymeshPrimitivesSubsetSubsetRestrictionDispatchableName extends Enum { + readonly isWhole: boolean; + readonly isThese: boolean; + readonly asThese: BTreeSetDispatchableName; + readonly isExcept: boolean; + readonly asExcept: BTreeSetDispatchableName; + readonly type: 'Whole' | 'These' | 'Except'; + } + + /** @name BTreeSetDispatchableName (48) */ + export interface BTreeSetDispatchableName extends Vec {} + + /** @name BTreeSetPalletPermissions (50) */ + export interface BTreeSetPalletPermissions extends Vec {} + + /** @name PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId (52) */ + export interface PolymeshPrimitivesSubsetSubsetRestrictionPortfolioId extends Enum { + readonly isWhole: boolean; + readonly isThese: boolean; + readonly asThese: BTreeSetPortfolioId; + readonly isExcept: boolean; + readonly asExcept: BTreeSetPortfolioId; + readonly type: 'Whole' | 'These' | 'Except'; + } + + /** @name PolymeshPrimitivesIdentityIdPortfolioId (53) */ + export interface PolymeshPrimitivesIdentityIdPortfolioId extends Struct { + readonly did: PolymeshPrimitivesIdentityId; + readonly kind: PolymeshPrimitivesIdentityIdPortfolioKind; + } + + /** @name PolymeshPrimitivesIdentityIdPortfolioKind (54) */ + export interface PolymeshPrimitivesIdentityIdPortfolioKind extends Enum { + readonly isDefault: boolean; + readonly isUser: boolean; + readonly asUser: u64; + readonly type: 'Default' | 'User'; + } + + /** @name BTreeSetPortfolioId (56) */ + export interface BTreeSetPortfolioId extends Vec {} + + /** @name PolymeshPrimitivesIdentityClaim (59) */ + export interface PolymeshPrimitivesIdentityClaim extends Struct { + readonly claimIssuer: PolymeshPrimitivesIdentityId; + readonly issuanceDate: u64; + readonly lastUpdateDate: u64; + readonly expiry: Option; + readonly claim: PolymeshPrimitivesIdentityClaimClaim; + } + + /** @name PolymeshPrimitivesIdentityClaimClaim (61) */ + export interface PolymeshPrimitivesIdentityClaimClaim extends Enum { + readonly isAccredited: boolean; + readonly asAccredited: PolymeshPrimitivesIdentityClaimScope; + readonly isAffiliate: boolean; + readonly asAffiliate: PolymeshPrimitivesIdentityClaimScope; + readonly isBuyLockup: boolean; + readonly asBuyLockup: PolymeshPrimitivesIdentityClaimScope; + readonly isSellLockup: boolean; + readonly asSellLockup: PolymeshPrimitivesIdentityClaimScope; + readonly isCustomerDueDiligence: boolean; + readonly asCustomerDueDiligence: PolymeshPrimitivesCddId; + readonly isKnowYourCustomer: boolean; + readonly asKnowYourCustomer: PolymeshPrimitivesIdentityClaimScope; + readonly isJurisdiction: boolean; + readonly asJurisdiction: ITuple<[PolymeshPrimitivesJurisdictionCountryCode, PolymeshPrimitivesIdentityClaimScope]>; + readonly isExempted: boolean; + readonly asExempted: PolymeshPrimitivesIdentityClaimScope; + readonly isBlocked: boolean; + readonly asBlocked: PolymeshPrimitivesIdentityClaimScope; + readonly isInvestorUniqueness: boolean; + readonly asInvestorUniqueness: ITuple<[PolymeshPrimitivesIdentityClaimScope, PolymeshPrimitivesIdentityId, PolymeshPrimitivesCddId]>; + readonly isNoData: boolean; + readonly isInvestorUniquenessV2: boolean; + readonly asInvestorUniquenessV2: PolymeshPrimitivesCddId; + readonly type: 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoData' | 'InvestorUniquenessV2'; + } + + /** @name PolymeshPrimitivesIdentityClaimScope (62) */ + export interface PolymeshPrimitivesIdentityClaimScope extends Enum { + readonly isIdentity: boolean; + readonly asIdentity: PolymeshPrimitivesIdentityId; + readonly isTicker: boolean; + readonly asTicker: PolymeshPrimitivesTicker; + readonly isCustom: boolean; + readonly asCustom: Bytes; + readonly type: 'Identity' | 'Ticker' | 'Custom'; + } + + /** @name PolymeshPrimitivesCddId (63) */ + export interface PolymeshPrimitivesCddId extends U8aFixed {} + + /** @name PolymeshPrimitivesJurisdictionCountryCode (64) */ + export interface PolymeshPrimitivesJurisdictionCountryCode extends Enum { + readonly isAf: boolean; + readonly isAx: boolean; + readonly isAl: boolean; + readonly isDz: boolean; + readonly isAs: boolean; + readonly isAd: boolean; + readonly isAo: boolean; + readonly isAi: boolean; + readonly isAq: boolean; + readonly isAg: boolean; + readonly isAr: boolean; + readonly isAm: boolean; + readonly isAw: boolean; + readonly isAu: boolean; + readonly isAt: boolean; + readonly isAz: boolean; + readonly isBs: boolean; + readonly isBh: boolean; + readonly isBd: boolean; + readonly isBb: boolean; + readonly isBy: boolean; + readonly isBe: boolean; + readonly isBz: boolean; + readonly isBj: boolean; + readonly isBm: boolean; + readonly isBt: boolean; + readonly isBo: boolean; + readonly isBa: boolean; + readonly isBw: boolean; + readonly isBv: boolean; + readonly isBr: boolean; + readonly isVg: boolean; + readonly isIo: boolean; + readonly isBn: boolean; + readonly isBg: boolean; + readonly isBf: boolean; + readonly isBi: boolean; + readonly isKh: boolean; + readonly isCm: boolean; + readonly isCa: boolean; + readonly isCv: boolean; + readonly isKy: boolean; + readonly isCf: boolean; + readonly isTd: boolean; + readonly isCl: boolean; + readonly isCn: boolean; + readonly isHk: boolean; + readonly isMo: boolean; + readonly isCx: boolean; + readonly isCc: boolean; + readonly isCo: boolean; + readonly isKm: boolean; + readonly isCg: boolean; + readonly isCd: boolean; + readonly isCk: boolean; + readonly isCr: boolean; + readonly isCi: boolean; + readonly isHr: boolean; + readonly isCu: boolean; + readonly isCy: boolean; + readonly isCz: boolean; + readonly isDk: boolean; + readonly isDj: boolean; + readonly isDm: boolean; + readonly isDo: boolean; + readonly isEc: boolean; + readonly isEg: boolean; + readonly isSv: boolean; + readonly isGq: boolean; + readonly isEr: boolean; + readonly isEe: boolean; + readonly isEt: boolean; + readonly isFk: boolean; + readonly isFo: boolean; + readonly isFj: boolean; + readonly isFi: boolean; + readonly isFr: boolean; + readonly isGf: boolean; + readonly isPf: boolean; + readonly isTf: boolean; + readonly isGa: boolean; + readonly isGm: boolean; + readonly isGe: boolean; + readonly isDe: boolean; + readonly isGh: boolean; + readonly isGi: boolean; + readonly isGr: boolean; + readonly isGl: boolean; + readonly isGd: boolean; + readonly isGp: boolean; + readonly isGu: boolean; + readonly isGt: boolean; + readonly isGg: boolean; + readonly isGn: boolean; + readonly isGw: boolean; + readonly isGy: boolean; + readonly isHt: boolean; + readonly isHm: boolean; + readonly isVa: boolean; + readonly isHn: boolean; + readonly isHu: boolean; + readonly isIs: boolean; + readonly isIn: boolean; + readonly isId: boolean; + readonly isIr: boolean; + readonly isIq: boolean; + readonly isIe: boolean; + readonly isIm: boolean; + readonly isIl: boolean; + readonly isIt: boolean; + readonly isJm: boolean; + readonly isJp: boolean; + readonly isJe: boolean; + readonly isJo: boolean; + readonly isKz: boolean; + readonly isKe: boolean; + readonly isKi: boolean; + readonly isKp: boolean; + readonly isKr: boolean; + readonly isKw: boolean; + readonly isKg: boolean; + readonly isLa: boolean; + readonly isLv: boolean; + readonly isLb: boolean; + readonly isLs: boolean; + readonly isLr: boolean; + readonly isLy: boolean; + readonly isLi: boolean; + readonly isLt: boolean; + readonly isLu: boolean; + readonly isMk: boolean; + readonly isMg: boolean; + readonly isMw: boolean; + readonly isMy: boolean; + readonly isMv: boolean; + readonly isMl: boolean; + readonly isMt: boolean; + readonly isMh: boolean; + readonly isMq: boolean; + readonly isMr: boolean; + readonly isMu: boolean; + readonly isYt: boolean; + readonly isMx: boolean; + readonly isFm: boolean; + readonly isMd: boolean; + readonly isMc: boolean; + readonly isMn: boolean; + readonly isMe: boolean; + readonly isMs: boolean; + readonly isMa: boolean; + readonly isMz: boolean; + readonly isMm: boolean; + readonly isNa: boolean; + readonly isNr: boolean; + readonly isNp: boolean; + readonly isNl: boolean; + readonly isAn: boolean; + readonly isNc: boolean; + readonly isNz: boolean; + readonly isNi: boolean; + readonly isNe: boolean; + readonly isNg: boolean; + readonly isNu: boolean; + readonly isNf: boolean; + readonly isMp: boolean; + readonly isNo: boolean; + readonly isOm: boolean; + readonly isPk: boolean; + readonly isPw: boolean; + readonly isPs: boolean; + readonly isPa: boolean; + readonly isPg: boolean; + readonly isPy: boolean; + readonly isPe: boolean; + readonly isPh: boolean; + readonly isPn: boolean; + readonly isPl: boolean; + readonly isPt: boolean; + readonly isPr: boolean; + readonly isQa: boolean; + readonly isRe: boolean; + readonly isRo: boolean; + readonly isRu: boolean; + readonly isRw: boolean; + readonly isBl: boolean; + readonly isSh: boolean; + readonly isKn: boolean; + readonly isLc: boolean; + readonly isMf: boolean; + readonly isPm: boolean; + readonly isVc: boolean; + readonly isWs: boolean; + readonly isSm: boolean; + readonly isSt: boolean; + readonly isSa: boolean; + readonly isSn: boolean; + readonly isRs: boolean; + readonly isSc: boolean; + readonly isSl: boolean; + readonly isSg: boolean; + readonly isSk: boolean; + readonly isSi: boolean; + readonly isSb: boolean; + readonly isSo: boolean; + readonly isZa: boolean; + readonly isGs: boolean; + readonly isSs: boolean; + readonly isEs: boolean; + readonly isLk: boolean; + readonly isSd: boolean; + readonly isSr: boolean; + readonly isSj: boolean; + readonly isSz: boolean; + readonly isSe: boolean; + readonly isCh: boolean; + readonly isSy: boolean; + readonly isTw: boolean; + readonly isTj: boolean; + readonly isTz: boolean; + readonly isTh: boolean; + readonly isTl: boolean; + readonly isTg: boolean; + readonly isTk: boolean; + readonly isTo: boolean; + readonly isTt: boolean; + readonly isTn: boolean; + readonly isTr: boolean; + readonly isTm: boolean; + readonly isTc: boolean; + readonly isTv: boolean; + readonly isUg: boolean; + readonly isUa: boolean; + readonly isAe: boolean; + readonly isGb: boolean; + readonly isUs: boolean; + readonly isUm: boolean; + readonly isUy: boolean; + readonly isUz: boolean; + readonly isVu: boolean; + readonly isVe: boolean; + readonly isVn: boolean; + readonly isVi: boolean; + readonly isWf: boolean; + readonly isEh: boolean; + readonly isYe: boolean; + readonly isZm: boolean; + readonly isZw: boolean; + readonly isBq: boolean; + readonly isCw: boolean; + readonly isSx: boolean; + readonly type: 'Af' | 'Ax' | 'Al' | 'Dz' | 'As' | 'Ad' | 'Ao' | 'Ai' | 'Aq' | 'Ag' | 'Ar' | 'Am' | 'Aw' | 'Au' | 'At' | 'Az' | 'Bs' | 'Bh' | 'Bd' | 'Bb' | 'By' | 'Be' | 'Bz' | 'Bj' | 'Bm' | 'Bt' | 'Bo' | 'Ba' | 'Bw' | 'Bv' | 'Br' | 'Vg' | 'Io' | 'Bn' | 'Bg' | 'Bf' | 'Bi' | 'Kh' | 'Cm' | 'Ca' | 'Cv' | 'Ky' | 'Cf' | 'Td' | 'Cl' | 'Cn' | 'Hk' | 'Mo' | 'Cx' | 'Cc' | 'Co' | 'Km' | 'Cg' | 'Cd' | 'Ck' | 'Cr' | 'Ci' | 'Hr' | 'Cu' | 'Cy' | 'Cz' | 'Dk' | 'Dj' | 'Dm' | 'Do' | 'Ec' | 'Eg' | 'Sv' | 'Gq' | 'Er' | 'Ee' | 'Et' | 'Fk' | 'Fo' | 'Fj' | 'Fi' | 'Fr' | 'Gf' | 'Pf' | 'Tf' | 'Ga' | 'Gm' | 'Ge' | 'De' | 'Gh' | 'Gi' | 'Gr' | 'Gl' | 'Gd' | 'Gp' | 'Gu' | 'Gt' | 'Gg' | 'Gn' | 'Gw' | 'Gy' | 'Ht' | 'Hm' | 'Va' | 'Hn' | 'Hu' | 'Is' | 'In' | 'Id' | 'Ir' | 'Iq' | 'Ie' | 'Im' | 'Il' | 'It' | 'Jm' | 'Jp' | 'Je' | 'Jo' | 'Kz' | 'Ke' | 'Ki' | 'Kp' | 'Kr' | 'Kw' | 'Kg' | 'La' | 'Lv' | 'Lb' | 'Ls' | 'Lr' | 'Ly' | 'Li' | 'Lt' | 'Lu' | 'Mk' | 'Mg' | 'Mw' | 'My' | 'Mv' | 'Ml' | 'Mt' | 'Mh' | 'Mq' | 'Mr' | 'Mu' | 'Yt' | 'Mx' | 'Fm' | 'Md' | 'Mc' | 'Mn' | 'Me' | 'Ms' | 'Ma' | 'Mz' | 'Mm' | 'Na' | 'Nr' | 'Np' | 'Nl' | 'An' | 'Nc' | 'Nz' | 'Ni' | 'Ne' | 'Ng' | 'Nu' | 'Nf' | 'Mp' | 'No' | 'Om' | 'Pk' | 'Pw' | 'Ps' | 'Pa' | 'Pg' | 'Py' | 'Pe' | 'Ph' | 'Pn' | 'Pl' | 'Pt' | 'Pr' | 'Qa' | 'Re' | 'Ro' | 'Ru' | 'Rw' | 'Bl' | 'Sh' | 'Kn' | 'Lc' | 'Mf' | 'Pm' | 'Vc' | 'Ws' | 'Sm' | 'St' | 'Sa' | 'Sn' | 'Rs' | 'Sc' | 'Sl' | 'Sg' | 'Sk' | 'Si' | 'Sb' | 'So' | 'Za' | 'Gs' | 'Ss' | 'Es' | 'Lk' | 'Sd' | 'Sr' | 'Sj' | 'Sz' | 'Se' | 'Ch' | 'Sy' | 'Tw' | 'Tj' | 'Tz' | 'Th' | 'Tl' | 'Tg' | 'Tk' | 'To' | 'Tt' | 'Tn' | 'Tr' | 'Tm' | 'Tc' | 'Tv' | 'Ug' | 'Ua' | 'Ae' | 'Gb' | 'Us' | 'Um' | 'Uy' | 'Uz' | 'Vu' | 'Ve' | 'Vn' | 'Vi' | 'Wf' | 'Eh' | 'Ye' | 'Zm' | 'Zw' | 'Bq' | 'Cw' | 'Sx'; + } + + /** @name PolymeshPrimitivesAuthorizationAuthorizationData (66) */ + export interface PolymeshPrimitivesAuthorizationAuthorizationData extends Enum { + readonly isAttestPrimaryKeyRotation: boolean; + readonly asAttestPrimaryKeyRotation: PolymeshPrimitivesIdentityId; + readonly isRotatePrimaryKey: boolean; + readonly isTransferTicker: boolean; + readonly asTransferTicker: PolymeshPrimitivesTicker; + readonly isAddMultiSigSigner: boolean; + readonly asAddMultiSigSigner: AccountId32; + readonly isTransferAssetOwnership: boolean; + readonly asTransferAssetOwnership: PolymeshPrimitivesTicker; + readonly isJoinIdentity: boolean; + readonly asJoinIdentity: PolymeshPrimitivesSecondaryKeyPermissions; + readonly isPortfolioCustody: boolean; + readonly asPortfolioCustody: PolymeshPrimitivesIdentityIdPortfolioId; + readonly isBecomeAgent: boolean; + readonly asBecomeAgent: ITuple<[PolymeshPrimitivesTicker, PolymeshPrimitivesAgentAgentGroup]>; + readonly isAddRelayerPayingKey: boolean; + readonly asAddRelayerPayingKey: ITuple<[AccountId32, AccountId32, u128]>; + readonly isRotatePrimaryKeyToSecondary: boolean; + readonly asRotatePrimaryKeyToSecondary: PolymeshPrimitivesSecondaryKeyPermissions; + readonly type: 'AttestPrimaryKeyRotation' | 'RotatePrimaryKey' | 'TransferTicker' | 'AddMultiSigSigner' | 'TransferAssetOwnership' | 'JoinIdentity' | 'PortfolioCustody' | 'BecomeAgent' | 'AddRelayerPayingKey' | 'RotatePrimaryKeyToSecondary'; + } + + /** @name PolymeshPrimitivesAgentAgentGroup (67) */ + export interface PolymeshPrimitivesAgentAgentGroup extends Enum { + readonly isFull: boolean; + readonly isCustom: boolean; + readonly asCustom: u32; + readonly isExceptMeta: boolean; + readonly isPolymeshV1CAA: boolean; + readonly isPolymeshV1PIA: boolean; + readonly type: 'Full' | 'Custom' | 'ExceptMeta' | 'PolymeshV1CAA' | 'PolymeshV1PIA'; + } + + /** @name PolymeshCommonUtilitiesGroupRawEventInstance2 (70) */ + export interface PolymeshCommonUtilitiesGroupRawEventInstance2 extends Enum { + readonly isMemberAdded: boolean; + readonly asMemberAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRemoved: boolean; + readonly asMemberRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRevoked: boolean; + readonly asMemberRevoked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersSwapped: boolean; + readonly asMembersSwapped: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersReset: boolean; + readonly asMembersReset: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isActiveLimitChanged: boolean; + readonly asActiveLimitChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isDummy: boolean; + readonly type: 'MemberAdded' | 'MemberRemoved' | 'MemberRevoked' | 'MembersSwapped' | 'MembersReset' | 'ActiveLimitChanged' | 'Dummy'; + } + + /** @name PalletGroupInstance2 (71) */ + export type PalletGroupInstance2 = Null; + + /** @name PalletCommitteeRawEventInstance1 (73) */ + export interface PalletCommitteeRawEventInstance1 extends Enum { + readonly isProposed: boolean; + readonly asProposed: ITuple<[PolymeshPrimitivesIdentityId, u32, H256]>; + readonly isVoted: boolean; + readonly asVoted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool, u32, u32, u32]>; + readonly isVoteRetracted: boolean; + readonly asVoteRetracted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool]>; + readonly isFinalVotes: boolean; + readonly asFinalVotes: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, Vec, Vec]>; + readonly isApproved: boolean; + readonly asApproved: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isRejected: boolean; + readonly asRejected: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isExecuted: boolean; + readonly asExecuted: ITuple<[PolymeshPrimitivesIdentityId, H256, Result]>; + readonly isReleaseCoordinatorUpdated: boolean; + readonly asReleaseCoordinatorUpdated: ITuple<[PolymeshPrimitivesIdentityId, Option]>; + readonly isExpiresAfterUpdated: boolean; + readonly asExpiresAfterUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshCommonUtilitiesMaybeBlock]>; + readonly isVoteThresholdUpdated: boolean; + readonly asVoteThresholdUpdated: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly type: 'Proposed' | 'Voted' | 'VoteRetracted' | 'FinalVotes' | 'Approved' | 'Rejected' | 'Executed' | 'ReleaseCoordinatorUpdated' | 'ExpiresAfterUpdated' | 'VoteThresholdUpdated'; + } + + /** @name PalletCommitteeInstance1 (74) */ + export type PalletCommitteeInstance1 = Null; + + /** @name PolymeshCommonUtilitiesMaybeBlock (77) */ + export interface PolymeshCommonUtilitiesMaybeBlock extends Enum { + readonly isSome: boolean; + readonly asSome: u32; + readonly isNone: boolean; + readonly type: 'Some' | 'None'; + } + + /** @name PolymeshCommonUtilitiesGroupRawEventInstance1 (78) */ + export interface PolymeshCommonUtilitiesGroupRawEventInstance1 extends Enum { + readonly isMemberAdded: boolean; + readonly asMemberAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRemoved: boolean; + readonly asMemberRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRevoked: boolean; + readonly asMemberRevoked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersSwapped: boolean; + readonly asMembersSwapped: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersReset: boolean; + readonly asMembersReset: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isActiveLimitChanged: boolean; + readonly asActiveLimitChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isDummy: boolean; + readonly type: 'MemberAdded' | 'MemberRemoved' | 'MemberRevoked' | 'MembersSwapped' | 'MembersReset' | 'ActiveLimitChanged' | 'Dummy'; + } + + /** @name PalletGroupInstance1 (79) */ + export type PalletGroupInstance1 = Null; + + /** @name PalletCommitteeRawEventInstance3 (80) */ + export interface PalletCommitteeRawEventInstance3 extends Enum { + readonly isProposed: boolean; + readonly asProposed: ITuple<[PolymeshPrimitivesIdentityId, u32, H256]>; + readonly isVoted: boolean; + readonly asVoted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool, u32, u32, u32]>; + readonly isVoteRetracted: boolean; + readonly asVoteRetracted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool]>; + readonly isFinalVotes: boolean; + readonly asFinalVotes: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, Vec, Vec]>; + readonly isApproved: boolean; + readonly asApproved: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isRejected: boolean; + readonly asRejected: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isExecuted: boolean; + readonly asExecuted: ITuple<[PolymeshPrimitivesIdentityId, H256, Result]>; + readonly isReleaseCoordinatorUpdated: boolean; + readonly asReleaseCoordinatorUpdated: ITuple<[PolymeshPrimitivesIdentityId, Option]>; + readonly isExpiresAfterUpdated: boolean; + readonly asExpiresAfterUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshCommonUtilitiesMaybeBlock]>; + readonly isVoteThresholdUpdated: boolean; + readonly asVoteThresholdUpdated: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly type: 'Proposed' | 'Voted' | 'VoteRetracted' | 'FinalVotes' | 'Approved' | 'Rejected' | 'Executed' | 'ReleaseCoordinatorUpdated' | 'ExpiresAfterUpdated' | 'VoteThresholdUpdated'; + } + + /** @name PalletCommitteeInstance3 (81) */ + export type PalletCommitteeInstance3 = Null; + + /** @name PolymeshCommonUtilitiesGroupRawEventInstance3 (82) */ + export interface PolymeshCommonUtilitiesGroupRawEventInstance3 extends Enum { + readonly isMemberAdded: boolean; + readonly asMemberAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRemoved: boolean; + readonly asMemberRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRevoked: boolean; + readonly asMemberRevoked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersSwapped: boolean; + readonly asMembersSwapped: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersReset: boolean; + readonly asMembersReset: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isActiveLimitChanged: boolean; + readonly asActiveLimitChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isDummy: boolean; + readonly type: 'MemberAdded' | 'MemberRemoved' | 'MemberRevoked' | 'MembersSwapped' | 'MembersReset' | 'ActiveLimitChanged' | 'Dummy'; + } + + /** @name PalletGroupInstance3 (83) */ + export type PalletGroupInstance3 = Null; + + /** @name PalletCommitteeRawEventInstance4 (84) */ + export interface PalletCommitteeRawEventInstance4 extends Enum { + readonly isProposed: boolean; + readonly asProposed: ITuple<[PolymeshPrimitivesIdentityId, u32, H256]>; + readonly isVoted: boolean; + readonly asVoted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool, u32, u32, u32]>; + readonly isVoteRetracted: boolean; + readonly asVoteRetracted: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, bool]>; + readonly isFinalVotes: boolean; + readonly asFinalVotes: ITuple<[PolymeshPrimitivesIdentityId, u32, H256, Vec, Vec]>; + readonly isApproved: boolean; + readonly asApproved: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isRejected: boolean; + readonly asRejected: ITuple<[PolymeshPrimitivesIdentityId, H256, u32, u32, u32]>; + readonly isExecuted: boolean; + readonly asExecuted: ITuple<[PolymeshPrimitivesIdentityId, H256, Result]>; + readonly isReleaseCoordinatorUpdated: boolean; + readonly asReleaseCoordinatorUpdated: ITuple<[PolymeshPrimitivesIdentityId, Option]>; + readonly isExpiresAfterUpdated: boolean; + readonly asExpiresAfterUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshCommonUtilitiesMaybeBlock]>; + readonly isVoteThresholdUpdated: boolean; + readonly asVoteThresholdUpdated: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly type: 'Proposed' | 'Voted' | 'VoteRetracted' | 'FinalVotes' | 'Approved' | 'Rejected' | 'Executed' | 'ReleaseCoordinatorUpdated' | 'ExpiresAfterUpdated' | 'VoteThresholdUpdated'; + } + + /** @name PalletCommitteeInstance4 (85) */ + export type PalletCommitteeInstance4 = Null; + + /** @name PolymeshCommonUtilitiesGroupRawEventInstance4 (86) */ + export interface PolymeshCommonUtilitiesGroupRawEventInstance4 extends Enum { + readonly isMemberAdded: boolean; + readonly asMemberAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRemoved: boolean; + readonly asMemberRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMemberRevoked: boolean; + readonly asMemberRevoked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersSwapped: boolean; + readonly asMembersSwapped: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isMembersReset: boolean; + readonly asMembersReset: ITuple<[PolymeshPrimitivesIdentityId, Vec]>; + readonly isActiveLimitChanged: boolean; + readonly asActiveLimitChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isDummy: boolean; + readonly type: 'MemberAdded' | 'MemberRemoved' | 'MemberRevoked' | 'MembersSwapped' | 'MembersReset' | 'ActiveLimitChanged' | 'Dummy'; + } + + /** @name PalletGroupInstance4 (87) */ + export type PalletGroupInstance4 = Null; + + /** @name PalletMultisigRawEvent (88) */ + export interface PalletMultisigRawEvent extends Enum { + readonly isMultiSigCreated: boolean; + readonly asMultiSigCreated: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, AccountId32, Vec, u64]>; + readonly isProposalAdded: boolean; + readonly asProposalAdded: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u64]>; + readonly isProposalExecuted: boolean; + readonly asProposalExecuted: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u64, bool]>; + readonly isMultiSigSignerAdded: boolean; + readonly asMultiSigSignerAdded: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeySignatory]>; + readonly isMultiSigSignerAuthorized: boolean; + readonly asMultiSigSignerAuthorized: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeySignatory]>; + readonly isMultiSigSignerRemoved: boolean; + readonly asMultiSigSignerRemoved: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeySignatory]>; + readonly isMultiSigSignaturesRequiredChanged: boolean; + readonly asMultiSigSignaturesRequiredChanged: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u64]>; + readonly isProposalApproved: boolean; + readonly asProposalApproved: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeySignatory, u64]>; + readonly isProposalRejectionVote: boolean; + readonly asProposalRejectionVote: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, PolymeshPrimitivesSecondaryKeySignatory, u64]>; + readonly isProposalRejected: boolean; + readonly asProposalRejected: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u64]>; + readonly isProposalExecutionFailed: boolean; + readonly asProposalExecutionFailed: SpRuntimeDispatchError; + readonly isSchedulingFailed: boolean; + readonly asSchedulingFailed: SpRuntimeDispatchError; + readonly type: 'MultiSigCreated' | 'ProposalAdded' | 'ProposalExecuted' | 'MultiSigSignerAdded' | 'MultiSigSignerAuthorized' | 'MultiSigSignerRemoved' | 'MultiSigSignaturesRequiredChanged' | 'ProposalApproved' | 'ProposalRejectionVote' | 'ProposalRejected' | 'ProposalExecutionFailed' | 'SchedulingFailed'; + } + + /** @name PolymeshPrimitivesSecondaryKeySignatory (90) */ + export interface PolymeshPrimitivesSecondaryKeySignatory extends Enum { + readonly isIdentity: boolean; + readonly asIdentity: PolymeshPrimitivesIdentityId; + readonly isAccount: boolean; + readonly asAccount: AccountId32; + readonly type: 'Identity' | 'Account'; + } + + /** @name PalletBridgeRawEvent (91) */ + export interface PalletBridgeRawEvent extends Enum { + readonly isControllerChanged: boolean; + readonly asControllerChanged: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isAdminChanged: boolean; + readonly asAdminChanged: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isTimelockChanged: boolean; + readonly asTimelockChanged: ITuple<[PolymeshPrimitivesIdentityId, u32]>; + readonly isBridged: boolean; + readonly asBridged: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx]>; + readonly isFrozen: boolean; + readonly asFrozen: PolymeshPrimitivesIdentityId; + readonly isUnfrozen: boolean; + readonly asUnfrozen: PolymeshPrimitivesIdentityId; + readonly isFrozenTx: boolean; + readonly asFrozenTx: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx]>; + readonly isUnfrozenTx: boolean; + readonly asUnfrozenTx: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx]>; + readonly isExemptedUpdated: boolean; + readonly asExemptedUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, bool]>; + readonly isBridgeLimitUpdated: boolean; + readonly asBridgeLimitUpdated: ITuple<[PolymeshPrimitivesIdentityId, u128, u32]>; + readonly isTxsHandled: boolean; + readonly asTxsHandled: Vec>; + readonly isBridgeTxScheduled: boolean; + readonly asBridgeTxScheduled: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx, u32]>; + readonly isBridgeTxScheduleFailed: boolean; + readonly asBridgeTxScheduleFailed: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx, Bytes]>; + readonly isFreezeAdminAdded: boolean; + readonly asFreezeAdminAdded: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isFreezeAdminRemoved: boolean; + readonly asFreezeAdminRemoved: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isTxRemoved: boolean; + readonly asTxRemoved: ITuple<[PolymeshPrimitivesIdentityId, PalletBridgeBridgeTx]>; + readonly type: 'ControllerChanged' | 'AdminChanged' | 'TimelockChanged' | 'Bridged' | 'Frozen' | 'Unfrozen' | 'FrozenTx' | 'UnfrozenTx' | 'ExemptedUpdated' | 'BridgeLimitUpdated' | 'TxsHandled' | 'BridgeTxScheduled' | 'BridgeTxScheduleFailed' | 'FreezeAdminAdded' | 'FreezeAdminRemoved' | 'TxRemoved'; + } + + /** @name PalletBridgeBridgeTx (92) */ + export interface PalletBridgeBridgeTx extends Struct { + readonly nonce: u32; + readonly recipient: AccountId32; + readonly amount: u128; + readonly txHash: H256; + } + + /** @name PalletBridgeHandledTxStatus (95) */ + export interface PalletBridgeHandledTxStatus extends Enum { + readonly isSuccess: boolean; + readonly isError: boolean; + readonly asError: Bytes; + readonly type: 'Success' | 'Error'; + } + + /** @name PalletStakingRawEvent (96) */ + export interface PalletStakingRawEvent extends Enum { + readonly isEraPayout: boolean; + readonly asEraPayout: ITuple<[u32, u128, u128]>; + readonly isReward: boolean; + readonly asReward: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isSlash: boolean; + readonly asSlash: ITuple<[AccountId32, u128]>; + readonly isOldSlashingReportDiscarded: boolean; + readonly asOldSlashingReportDiscarded: u32; + readonly isStakingElection: boolean; + readonly asStakingElection: PalletStakingElectionCompute; + readonly isSolutionStored: boolean; + readonly asSolutionStored: PalletStakingElectionCompute; + readonly isBonded: boolean; + readonly asBonded: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isUnbonded: boolean; + readonly asUnbonded: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isNominated: boolean; + readonly asNominated: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, Vec]>; + readonly isWithdrawn: boolean; + readonly asWithdrawn: ITuple<[AccountId32, u128]>; + readonly isPermissionedIdentityAdded: boolean; + readonly asPermissionedIdentityAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isPermissionedIdentityRemoved: boolean; + readonly asPermissionedIdentityRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId]>; + readonly isInvalidatedNominators: boolean; + readonly asInvalidatedNominators: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, Vec]>; + readonly isCommissionCapUpdated: boolean; + readonly asCommissionCapUpdated: ITuple<[PolymeshPrimitivesIdentityId, Perbill, Perbill]>; + readonly isMinimumBondThresholdUpdated: boolean; + readonly asMinimumBondThresholdUpdated: ITuple<[Option, u128]>; + readonly isRewardPaymentSchedulingInterrupted: boolean; + readonly asRewardPaymentSchedulingInterrupted: ITuple<[AccountId32, u32, SpRuntimeDispatchError]>; + readonly isSlashingAllowedForChanged: boolean; + readonly asSlashingAllowedForChanged: PalletStakingSlashingSwitch; + readonly type: 'EraPayout' | 'Reward' | 'Slash' | 'OldSlashingReportDiscarded' | 'StakingElection' | 'SolutionStored' | 'Bonded' | 'Unbonded' | 'Nominated' | 'Withdrawn' | 'PermissionedIdentityAdded' | 'PermissionedIdentityRemoved' | 'InvalidatedNominators' | 'CommissionCapUpdated' | 'MinimumBondThresholdUpdated' | 'RewardPaymentSchedulingInterrupted' | 'SlashingAllowedForChanged'; + } + + /** @name PalletStakingElectionCompute (97) */ + export interface PalletStakingElectionCompute extends Enum { + readonly isOnChain: boolean; + readonly isSigned: boolean; + readonly isUnsigned: boolean; + readonly type: 'OnChain' | 'Signed' | 'Unsigned'; + } + + /** @name PalletStakingSlashingSwitch (99) */ + export interface PalletStakingSlashingSwitch extends Enum { + readonly isValidator: boolean; + readonly isValidatorAndNominator: boolean; + readonly isNone: boolean; + readonly type: 'Validator' | 'ValidatorAndNominator' | 'None'; + } + + /** @name PalletOffencesEvent (100) */ + export interface PalletOffencesEvent extends Enum { + readonly isOffence: boolean; + readonly asOffence: { + readonly kind: U8aFixed; + readonly timeslot: Bytes; + } & Struct; + readonly type: 'Offence'; + } + + /** @name PalletSessionEvent (102) */ + export interface PalletSessionEvent extends Enum { + readonly isNewSession: boolean; + readonly asNewSession: { + readonly sessionIndex: u32; + } & Struct; + readonly type: 'NewSession'; + } + + /** @name PalletGrandpaEvent (103) */ + export interface PalletGrandpaEvent extends Enum { + readonly isNewAuthorities: boolean; + readonly asNewAuthorities: { + readonly authoritySet: Vec>; + } & Struct; + readonly isPaused: boolean; + readonly isResumed: boolean; + readonly type: 'NewAuthorities' | 'Paused' | 'Resumed'; + } + + /** @name SpFinalityGrandpaAppPublic (106) */ + export interface SpFinalityGrandpaAppPublic extends SpCoreEd25519Public {} + + /** @name SpCoreEd25519Public (107) */ + export interface SpCoreEd25519Public extends U8aFixed {} + + /** @name PalletImOnlineEvent (108) */ + export interface PalletImOnlineEvent extends Enum { + readonly isHeartbeatReceived: boolean; + readonly asHeartbeatReceived: { + readonly authorityId: PalletImOnlineSr25519AppSr25519Public; + } & Struct; + readonly isAllGood: boolean; + readonly isSomeOffline: boolean; + readonly asSomeOffline: { + readonly offline: Vec>; + } & Struct; + readonly type: 'HeartbeatReceived' | 'AllGood' | 'SomeOffline'; + } + + /** @name PalletImOnlineSr25519AppSr25519Public (109) */ + export interface PalletImOnlineSr25519AppSr25519Public extends SpCoreSr25519Public {} + + /** @name SpCoreSr25519Public (110) */ + export interface SpCoreSr25519Public extends U8aFixed {} + + /** @name PalletStakingExposure (113) */ + export interface PalletStakingExposure extends Struct { + readonly total: Compact; + readonly own: Compact; + readonly others: Vec; + } + + /** @name PalletStakingIndividualExposure (116) */ + export interface PalletStakingIndividualExposure extends Struct { + readonly who: AccountId32; + readonly value: Compact; + } + + /** @name PalletSudoRawEvent (117) */ + export interface PalletSudoRawEvent extends Enum { + readonly isSudid: boolean; + readonly asSudid: Result; + readonly isKeyChanged: boolean; + readonly asKeyChanged: AccountId32; + readonly isSudoAsDone: boolean; + readonly asSudoAsDone: Result; + readonly type: 'Sudid' | 'KeyChanged' | 'SudoAsDone'; + } + + /** @name PolymeshCommonUtilitiesAssetRawEvent (118) */ + export interface PolymeshCommonUtilitiesAssetRawEvent extends Enum { + readonly isTransfer: boolean; + readonly asTransfer: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityIdPortfolioId, u128]>; + readonly isIssued: boolean; + readonly asIssued: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, u128, Bytes, u128]>; + readonly isRedeemed: boolean; + readonly asRedeemed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, u128]>; + readonly isAssetCreated: boolean; + readonly asAssetCreated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, bool, PolymeshPrimitivesAssetAssetType, PolymeshPrimitivesIdentityId, bool]>; + readonly isIdentifiersUpdated: boolean; + readonly asIdentifiersUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Vec]>; + readonly isDivisibilityChanged: boolean; + readonly asDivisibilityChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, bool]>; + readonly isTransferWithData: boolean; + readonly asTransferWithData: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, u128, Bytes]>; + readonly isIsIssuable: boolean; + readonly asIsIssuable: ITuple<[PolymeshPrimitivesTicker, bool]>; + readonly isTickerRegistered: boolean; + readonly asTickerRegistered: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Option]>; + readonly isTickerTransferred: boolean; + readonly asTickerTransferred: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; + readonly isAssetOwnershipTransferred: boolean; + readonly asAssetOwnershipTransferred: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; + readonly isAssetFrozen: boolean; + readonly asAssetFrozen: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isAssetUnfrozen: boolean; + readonly asAssetUnfrozen: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isAssetRenamed: boolean; + readonly asAssetRenamed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Bytes]>; + readonly isFundingRoundSet: boolean; + readonly asFundingRoundSet: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Bytes]>; + readonly isDocumentAdded: boolean; + readonly asDocumentAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, u32, PolymeshPrimitivesDocument]>; + readonly isDocumentRemoved: boolean; + readonly asDocumentRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, u32]>; + readonly isExtensionRemoved: boolean; + readonly asExtensionRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, AccountId32]>; + readonly isClassicTickerClaimed: boolean; + readonly asClassicTickerClaimed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesEthereumEthereumAddress]>; + readonly isControllerTransfer: boolean; + readonly asControllerTransfer: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityIdPortfolioId, u128]>; + readonly isCustomAssetTypeExists: boolean; + readonly asCustomAssetTypeExists: ITuple<[PolymeshPrimitivesIdentityId, u32, Bytes]>; + readonly isCustomAssetTypeRegistered: boolean; + readonly asCustomAssetTypeRegistered: ITuple<[PolymeshPrimitivesIdentityId, u32, Bytes]>; + readonly isSetAssetMetadataValue: boolean; + readonly asSetAssetMetadataValue: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Bytes, Option]>; + readonly isSetAssetMetadataValueDetails: boolean; + readonly asSetAssetMetadataValueDetails: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail]>; + readonly isRegisterAssetMetadataLocalType: boolean; + readonly asRegisterAssetMetadataLocalType: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Bytes, u64, PolymeshPrimitivesAssetMetadataAssetMetadataSpec]>; + readonly isRegisterAssetMetadataGlobalType: boolean; + readonly asRegisterAssetMetadataGlobalType: ITuple<[Bytes, u64, PolymeshPrimitivesAssetMetadataAssetMetadataSpec]>; + readonly type: 'Transfer' | 'Issued' | 'Redeemed' | 'AssetCreated' | 'IdentifiersUpdated' | 'DivisibilityChanged' | 'TransferWithData' | 'IsIssuable' | 'TickerRegistered' | 'TickerTransferred' | 'AssetOwnershipTransferred' | 'AssetFrozen' | 'AssetUnfrozen' | 'AssetRenamed' | 'FundingRoundSet' | 'DocumentAdded' | 'DocumentRemoved' | 'ExtensionRemoved' | 'ClassicTickerClaimed' | 'ControllerTransfer' | 'CustomAssetTypeExists' | 'CustomAssetTypeRegistered' | 'SetAssetMetadataValue' | 'SetAssetMetadataValueDetails' | 'RegisterAssetMetadataLocalType' | 'RegisterAssetMetadataGlobalType'; + } + + /** @name PolymeshPrimitivesAssetAssetType (120) */ + export interface PolymeshPrimitivesAssetAssetType extends Enum { + readonly isEquityCommon: boolean; + readonly isEquityPreferred: boolean; + readonly isCommodity: boolean; + readonly isFixedIncome: boolean; + readonly isReit: boolean; + readonly isFund: boolean; + readonly isRevenueShareAgreement: boolean; + readonly isStructuredProduct: boolean; + readonly isDerivative: boolean; + readonly isCustom: boolean; + readonly asCustom: u32; + readonly isStableCoin: boolean; + readonly type: 'EquityCommon' | 'EquityPreferred' | 'Commodity' | 'FixedIncome' | 'Reit' | 'Fund' | 'RevenueShareAgreement' | 'StructuredProduct' | 'Derivative' | 'Custom' | 'StableCoin'; + } + + /** @name PolymeshPrimitivesAssetIdentifier (123) */ + export interface PolymeshPrimitivesAssetIdentifier extends Enum { + readonly isCusip: boolean; + readonly asCusip: U8aFixed; + readonly isCins: boolean; + readonly asCins: U8aFixed; + readonly isIsin: boolean; + readonly asIsin: U8aFixed; + readonly isLei: boolean; + readonly asLei: U8aFixed; + readonly isFigi: boolean; + readonly asFigi: U8aFixed; + readonly type: 'Cusip' | 'Cins' | 'Isin' | 'Lei' | 'Figi'; + } + + /** @name PolymeshPrimitivesDocument (128) */ + export interface PolymeshPrimitivesDocument extends Struct { + readonly uri: Bytes; + readonly contentHash: PolymeshPrimitivesDocumentHash; + readonly name: Bytes; + readonly docType: Option; + readonly filingDate: Option; + } + + /** @name PolymeshPrimitivesDocumentHash (130) */ + export interface PolymeshPrimitivesDocumentHash extends Enum { + readonly isNone: boolean; + readonly isH512: boolean; + readonly asH512: U8aFixed; + readonly isH384: boolean; + readonly asH384: U8aFixed; + readonly isH320: boolean; + readonly asH320: U8aFixed; + readonly isH256: boolean; + readonly asH256: U8aFixed; + readonly isH224: boolean; + readonly asH224: U8aFixed; + readonly isH192: boolean; + readonly asH192: U8aFixed; + readonly isH160: boolean; + readonly asH160: U8aFixed; + readonly isH128: boolean; + readonly asH128: U8aFixed; + readonly type: 'None' | 'H512' | 'H384' | 'H320' | 'H256' | 'H224' | 'H192' | 'H160' | 'H128'; + } + + /** @name PolymeshPrimitivesEthereumEthereumAddress (139) */ + export interface PolymeshPrimitivesEthereumEthereumAddress extends U8aFixed {} + + /** @name PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail (142) */ + export interface PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail extends Struct { + readonly expire: Option; + readonly lockStatus: PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus; + } + + /** @name PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus (143) */ + export interface PolymeshPrimitivesAssetMetadataAssetMetadataLockStatus extends Enum { + readonly isUnlocked: boolean; + readonly isLocked: boolean; + readonly isLockedUntil: boolean; + readonly asLockedUntil: u64; + readonly type: 'Unlocked' | 'Locked' | 'LockedUntil'; + } + + /** @name PolymeshPrimitivesAssetMetadataAssetMetadataSpec (146) */ + export interface PolymeshPrimitivesAssetMetadataAssetMetadataSpec extends Struct { + readonly url: Option; + readonly description: Option; + readonly typeDef: Option; + } + + /** @name PalletCorporateActionsDistributionEvent (153) */ + export interface PalletCorporateActionsDistributionEvent extends Enum { + readonly isCreated: boolean; + readonly asCreated: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId, PalletCorporateActionsDistribution]>; + readonly isBenefitClaimed: boolean; + readonly asBenefitClaimed: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId, PalletCorporateActionsDistribution, u128, Permill]>; + readonly isReclaimed: boolean; + readonly asReclaimed: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId, u128]>; + readonly isRemoved: boolean; + readonly asRemoved: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId]>; + readonly type: 'Created' | 'BenefitClaimed' | 'Reclaimed' | 'Removed'; + } + + /** @name PolymeshPrimitivesEventOnly (154) */ + export interface PolymeshPrimitivesEventOnly extends PolymeshPrimitivesIdentityId {} + + /** @name PalletCorporateActionsCaId (155) */ + export interface PalletCorporateActionsCaId extends Struct { + readonly ticker: PolymeshPrimitivesTicker; + readonly localId: u32; + } + + /** @name PalletCorporateActionsDistribution (157) */ + export interface PalletCorporateActionsDistribution extends Struct { + readonly from: PolymeshPrimitivesIdentityIdPortfolioId; + readonly currency: PolymeshPrimitivesTicker; + readonly perShare: u128; + readonly amount: u128; + readonly remaining: u128; + readonly reclaimed: bool; + readonly paymentAt: u64; + readonly expiresAt: Option; + } + + /** @name PolymeshCommonUtilitiesCheckpointEvent (159) */ + export interface PolymeshCommonUtilitiesCheckpointEvent extends Enum { + readonly isCheckpointCreated: boolean; + readonly asCheckpointCreated: ITuple<[Option, PolymeshPrimitivesTicker, u64, u128, u64]>; + readonly isMaximumSchedulesComplexityChanged: boolean; + readonly asMaximumSchedulesComplexityChanged: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isScheduleCreated: boolean; + readonly asScheduleCreated: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, PolymeshCommonUtilitiesCheckpointStoredSchedule]>; + readonly isScheduleRemoved: boolean; + readonly asScheduleRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshCommonUtilitiesCheckpointStoredSchedule]>; + readonly type: 'CheckpointCreated' | 'MaximumSchedulesComplexityChanged' | 'ScheduleCreated' | 'ScheduleRemoved'; + } + + /** @name PolymeshCommonUtilitiesCheckpointStoredSchedule (162) */ + export interface PolymeshCommonUtilitiesCheckpointStoredSchedule extends Struct { + readonly schedule: PolymeshPrimitivesCalendarCheckpointSchedule; + readonly id: u64; + readonly at: u64; + readonly remaining: u32; + } + + /** @name PolymeshPrimitivesCalendarCheckpointSchedule (163) */ + export interface PolymeshPrimitivesCalendarCheckpointSchedule extends Struct { + readonly start: u64; + readonly period: PolymeshPrimitivesCalendarCalendarPeriod; + } + + /** @name PolymeshPrimitivesCalendarCalendarPeriod (164) */ + export interface PolymeshPrimitivesCalendarCalendarPeriod extends Struct { + readonly unit: PolymeshPrimitivesCalendarCalendarUnit; + readonly amount: u64; + } + + /** @name PolymeshPrimitivesCalendarCalendarUnit (165) */ + export interface PolymeshPrimitivesCalendarCalendarUnit extends Enum { + readonly isSecond: boolean; + readonly isMinute: boolean; + readonly isHour: boolean; + readonly isDay: boolean; + readonly isWeek: boolean; + readonly isMonth: boolean; + readonly isYear: boolean; + readonly type: 'Second' | 'Minute' | 'Hour' | 'Day' | 'Week' | 'Month' | 'Year'; + } + + /** @name PalletComplianceManagerEvent (167) */ + export interface PalletComplianceManagerEvent extends Enum { + readonly isComplianceRequirementCreated: boolean; + readonly asComplianceRequirementCreated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesComplianceManagerComplianceRequirement]>; + readonly isComplianceRequirementRemoved: boolean; + readonly asComplianceRequirementRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, u32]>; + readonly isAssetComplianceReplaced: boolean; + readonly asAssetComplianceReplaced: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Vec]>; + readonly isAssetComplianceReset: boolean; + readonly asAssetComplianceReset: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isAssetComplianceResumed: boolean; + readonly asAssetComplianceResumed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isAssetCompliancePaused: boolean; + readonly asAssetCompliancePaused: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker]>; + readonly isComplianceRequirementChanged: boolean; + readonly asComplianceRequirementChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesComplianceManagerComplianceRequirement]>; + readonly isTrustedDefaultClaimIssuerAdded: boolean; + readonly asTrustedDefaultClaimIssuerAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesConditionTrustedIssuer]>; + readonly isTrustedDefaultClaimIssuerRemoved: boolean; + readonly asTrustedDefaultClaimIssuerRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; + readonly type: 'ComplianceRequirementCreated' | 'ComplianceRequirementRemoved' | 'AssetComplianceReplaced' | 'AssetComplianceReset' | 'AssetComplianceResumed' | 'AssetCompliancePaused' | 'ComplianceRequirementChanged' | 'TrustedDefaultClaimIssuerAdded' | 'TrustedDefaultClaimIssuerRemoved'; + } + + /** @name PolymeshPrimitivesComplianceManagerComplianceRequirement (168) */ + export interface PolymeshPrimitivesComplianceManagerComplianceRequirement extends Struct { + readonly senderConditions: Vec; + readonly receiverConditions: Vec; + readonly id: u32; + } + + /** @name PolymeshPrimitivesCondition (170) */ + export interface PolymeshPrimitivesCondition extends Struct { + readonly conditionType: PolymeshPrimitivesConditionConditionType; + readonly issuers: Vec; + } + + /** @name PolymeshPrimitivesConditionConditionType (171) */ + export interface PolymeshPrimitivesConditionConditionType extends Enum { + readonly isIsPresent: boolean; + readonly asIsPresent: PolymeshPrimitivesIdentityClaimClaim; + readonly isIsAbsent: boolean; + readonly asIsAbsent: PolymeshPrimitivesIdentityClaimClaim; + readonly isIsAnyOf: boolean; + readonly asIsAnyOf: Vec; + readonly isIsNoneOf: boolean; + readonly asIsNoneOf: Vec; + readonly isIsIdentity: boolean; + readonly asIsIdentity: PolymeshPrimitivesConditionTargetIdentity; + readonly type: 'IsPresent' | 'IsAbsent' | 'IsAnyOf' | 'IsNoneOf' | 'IsIdentity'; + } + + /** @name PolymeshPrimitivesConditionTargetIdentity (173) */ + export interface PolymeshPrimitivesConditionTargetIdentity extends Enum { + readonly isExternalAgent: boolean; + readonly isSpecific: boolean; + readonly asSpecific: PolymeshPrimitivesIdentityId; + readonly type: 'ExternalAgent' | 'Specific'; + } + + /** @name PolymeshPrimitivesConditionTrustedIssuer (175) */ + export interface PolymeshPrimitivesConditionTrustedIssuer extends Struct { + readonly issuer: PolymeshPrimitivesIdentityId; + readonly trustedFor: PolymeshPrimitivesConditionTrustedFor; + } + + /** @name PolymeshPrimitivesConditionTrustedFor (176) */ + export interface PolymeshPrimitivesConditionTrustedFor extends Enum { + readonly isAny: boolean; + readonly isSpecific: boolean; + readonly asSpecific: Vec; + readonly type: 'Any' | 'Specific'; + } + + /** @name PolymeshPrimitivesIdentityClaimClaimType (178) */ + export interface PolymeshPrimitivesIdentityClaimClaimType extends Enum { + readonly isAccredited: boolean; + readonly isAffiliate: boolean; + readonly isBuyLockup: boolean; + readonly isSellLockup: boolean; + readonly isCustomerDueDiligence: boolean; + readonly isKnowYourCustomer: boolean; + readonly isJurisdiction: boolean; + readonly isExempted: boolean; + readonly isBlocked: boolean; + readonly isInvestorUniqueness: boolean; + readonly isNoType: boolean; + readonly isInvestorUniquenessV2: boolean; + readonly type: 'Accredited' | 'Affiliate' | 'BuyLockup' | 'SellLockup' | 'CustomerDueDiligence' | 'KnowYourCustomer' | 'Jurisdiction' | 'Exempted' | 'Blocked' | 'InvestorUniqueness' | 'NoType' | 'InvestorUniquenessV2'; + } + + /** @name PalletCorporateActionsEvent (180) */ + export interface PalletCorporateActionsEvent extends Enum { + readonly isMaxDetailsLengthChanged: boolean; + readonly asMaxDetailsLengthChanged: ITuple<[PolymeshPrimitivesIdentityId, u32]>; + readonly isDefaultTargetIdentitiesChanged: boolean; + readonly asDefaultTargetIdentitiesChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PalletCorporateActionsTargetIdentities]>; + readonly isDefaultWithholdingTaxChanged: boolean; + readonly asDefaultWithholdingTaxChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Permill]>; + readonly isDidWithholdingTaxChanged: boolean; + readonly asDidWithholdingTaxChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, Option]>; + readonly isCaaTransferred: boolean; + readonly asCaaTransferred: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; + readonly isCaInitiated: boolean; + readonly asCaInitiated: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId, PalletCorporateActionsCorporateAction, Bytes]>; + readonly isCaLinkedToDoc: boolean; + readonly asCaLinkedToDoc: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, Vec]>; + readonly isCaRemoved: boolean; + readonly asCaRemoved: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId]>; + readonly isRecordDateChanged: boolean; + readonly asRecordDateChanged: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId, PalletCorporateActionsCorporateAction]>; + readonly type: 'MaxDetailsLengthChanged' | 'DefaultTargetIdentitiesChanged' | 'DefaultWithholdingTaxChanged' | 'DidWithholdingTaxChanged' | 'CaaTransferred' | 'CaInitiated' | 'CaLinkedToDoc' | 'CaRemoved' | 'RecordDateChanged'; + } + + /** @name PalletCorporateActionsTargetIdentities (181) */ + export interface PalletCorporateActionsTargetIdentities extends Struct { + readonly identities: Vec; + readonly treatment: PalletCorporateActionsTargetTreatment; + } + + /** @name PalletCorporateActionsTargetTreatment (182) */ + export interface PalletCorporateActionsTargetTreatment extends Enum { + readonly isInclude: boolean; + readonly isExclude: boolean; + readonly type: 'Include' | 'Exclude'; + } + + /** @name PalletCorporateActionsCorporateAction (184) */ + export interface PalletCorporateActionsCorporateAction extends Struct { + readonly kind: PalletCorporateActionsCaKind; + readonly declDate: u64; + readonly recordDate: Option; + readonly targets: PalletCorporateActionsTargetIdentities; + readonly defaultWithholdingTax: Permill; + readonly withholdingTax: Vec>; + } + + /** @name PalletCorporateActionsCaKind (185) */ + export interface PalletCorporateActionsCaKind extends Enum { + readonly isPredictableBenefit: boolean; + readonly isUnpredictableBenefit: boolean; + readonly isIssuerNotice: boolean; + readonly isReorganization: boolean; + readonly isOther: boolean; + readonly type: 'PredictableBenefit' | 'UnpredictableBenefit' | 'IssuerNotice' | 'Reorganization' | 'Other'; + } + + /** @name PalletCorporateActionsRecordDate (187) */ + export interface PalletCorporateActionsRecordDate extends Struct { + readonly date: u64; + readonly checkpoint: PalletCorporateActionsCaCheckpoint; + } + + /** @name PalletCorporateActionsCaCheckpoint (188) */ + export interface PalletCorporateActionsCaCheckpoint extends Enum { + readonly isScheduled: boolean; + readonly asScheduled: ITuple<[u64, u64]>; + readonly isExisting: boolean; + readonly asExisting: u64; + readonly type: 'Scheduled' | 'Existing'; + } + + /** @name PalletCorporateActionsBallotEvent (193) */ + export interface PalletCorporateActionsBallotEvent extends Enum { + readonly isCreated: boolean; + readonly asCreated: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, PalletCorporateActionsBallotBallotTimeRange, PalletCorporateActionsBallotBallotMeta, bool]>; + readonly isVoteCast: boolean; + readonly asVoteCast: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, Vec]>; + readonly isRangeChanged: boolean; + readonly asRangeChanged: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, PalletCorporateActionsBallotBallotTimeRange]>; + readonly isMetaChanged: boolean; + readonly asMetaChanged: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, PalletCorporateActionsBallotBallotMeta]>; + readonly isRcvChanged: boolean; + readonly asRcvChanged: ITuple<[PolymeshPrimitivesIdentityId, PalletCorporateActionsCaId, bool]>; + readonly isRemoved: boolean; + readonly asRemoved: ITuple<[PolymeshPrimitivesEventOnly, PalletCorporateActionsCaId]>; + readonly type: 'Created' | 'VoteCast' | 'RangeChanged' | 'MetaChanged' | 'RcvChanged' | 'Removed'; + } + + /** @name PalletCorporateActionsBallotBallotTimeRange (194) */ + export interface PalletCorporateActionsBallotBallotTimeRange extends Struct { + readonly start: u64; + readonly end: u64; + } + + /** @name PalletCorporateActionsBallotBallotMeta (195) */ + export interface PalletCorporateActionsBallotBallotMeta extends Struct { + readonly title: Bytes; + readonly motions: Vec; + } + + /** @name PalletCorporateActionsBallotMotion (198) */ + export interface PalletCorporateActionsBallotMotion extends Struct { + readonly title: Bytes; + readonly infoLink: Bytes; + readonly choices: Vec; + } + + /** @name PalletCorporateActionsBallotBallotVote (204) */ + export interface PalletCorporateActionsBallotBallotVote extends Struct { + readonly power: u128; + readonly fallback: Option; + } + + /** @name PalletPipsRawEvent (207) */ + export interface PalletPipsRawEvent extends Enum { + readonly isHistoricalPipsPruned: boolean; + readonly asHistoricalPipsPruned: ITuple<[PolymeshPrimitivesIdentityId, bool, bool]>; + readonly isProposalCreated: boolean; + readonly asProposalCreated: ITuple<[PolymeshPrimitivesIdentityId, PalletPipsProposer, u32, u128, Option, Option, PolymeshCommonUtilitiesMaybeBlock, PalletPipsProposalData]>; + readonly isProposalStateUpdated: boolean; + readonly asProposalStateUpdated: ITuple<[PolymeshPrimitivesIdentityId, u32, PalletPipsProposalState]>; + readonly isVoted: boolean; + readonly asVoted: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u32, bool, u128]>; + readonly isPipClosed: boolean; + readonly asPipClosed: ITuple<[PolymeshPrimitivesIdentityId, u32, bool]>; + readonly isExecutionScheduled: boolean; + readonly asExecutionScheduled: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isDefaultEnactmentPeriodChanged: boolean; + readonly asDefaultEnactmentPeriodChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isMinimumProposalDepositChanged: boolean; + readonly asMinimumProposalDepositChanged: ITuple<[PolymeshPrimitivesIdentityId, u128, u128]>; + readonly isPendingPipExpiryChanged: boolean; + readonly asPendingPipExpiryChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshCommonUtilitiesMaybeBlock, PolymeshCommonUtilitiesMaybeBlock]>; + readonly isMaxPipSkipCountChanged: boolean; + readonly asMaxPipSkipCountChanged: ITuple<[PolymeshPrimitivesIdentityId, u8, u8]>; + readonly isActivePipLimitChanged: boolean; + readonly asActivePipLimitChanged: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isProposalRefund: boolean; + readonly asProposalRefund: ITuple<[PolymeshPrimitivesIdentityId, u32, u128]>; + readonly isSnapshotCleared: boolean; + readonly asSnapshotCleared: ITuple<[PolymeshPrimitivesIdentityId, u32]>; + readonly isSnapshotTaken: boolean; + readonly asSnapshotTaken: ITuple<[PolymeshPrimitivesIdentityId, u32, Vec]>; + readonly isPipSkipped: boolean; + readonly asPipSkipped: ITuple<[PolymeshPrimitivesIdentityId, u32, u8]>; + readonly isSnapshotResultsEnacted: boolean; + readonly asSnapshotResultsEnacted: ITuple<[PolymeshPrimitivesIdentityId, Option, Vec>, Vec, Vec]>; + readonly isExecutionSchedulingFailed: boolean; + readonly asExecutionSchedulingFailed: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isExpiryScheduled: boolean; + readonly asExpiryScheduled: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isExpirySchedulingFailed: boolean; + readonly asExpirySchedulingFailed: ITuple<[PolymeshPrimitivesIdentityId, u32, u32]>; + readonly isExecutionCancellingFailed: boolean; + readonly asExecutionCancellingFailed: u32; + readonly type: 'HistoricalPipsPruned' | 'ProposalCreated' | 'ProposalStateUpdated' | 'Voted' | 'PipClosed' | 'ExecutionScheduled' | 'DefaultEnactmentPeriodChanged' | 'MinimumProposalDepositChanged' | 'PendingPipExpiryChanged' | 'MaxPipSkipCountChanged' | 'ActivePipLimitChanged' | 'ProposalRefund' | 'SnapshotCleared' | 'SnapshotTaken' | 'PipSkipped' | 'SnapshotResultsEnacted' | 'ExecutionSchedulingFailed' | 'ExpiryScheduled' | 'ExpirySchedulingFailed' | 'ExecutionCancellingFailed'; + } + + /** @name PalletPipsProposer (208) */ + export interface PalletPipsProposer extends Enum { + readonly isCommunity: boolean; + readonly asCommunity: AccountId32; + readonly isCommittee: boolean; + readonly asCommittee: PalletPipsCommittee; + readonly type: 'Community' | 'Committee'; + } + + /** @name PalletPipsCommittee (209) */ + export interface PalletPipsCommittee extends Enum { + readonly isTechnical: boolean; + readonly isUpgrade: boolean; + readonly type: 'Technical' | 'Upgrade'; + } + + /** @name PalletPipsProposalData (213) */ + export interface PalletPipsProposalData extends Enum { + readonly isHash: boolean; + readonly asHash: H256; + readonly isProposal: boolean; + readonly asProposal: Bytes; + readonly type: 'Hash' | 'Proposal'; + } + + /** @name PalletPipsProposalState (214) */ + export interface PalletPipsProposalState extends Enum { + readonly isPending: boolean; + readonly isRejected: boolean; + readonly isScheduled: boolean; + readonly isFailed: boolean; + readonly isExecuted: boolean; + readonly isExpired: boolean; + readonly type: 'Pending' | 'Rejected' | 'Scheduled' | 'Failed' | 'Executed' | 'Expired'; + } + + /** @name PalletPipsSnapshottedPip (217) */ + export interface PalletPipsSnapshottedPip extends Struct { + readonly id: u32; + readonly weight: ITuple<[bool, u128]>; + } + + /** @name PolymeshCommonUtilitiesPortfolioEvent (223) */ + export interface PolymeshCommonUtilitiesPortfolioEvent extends Enum { + readonly isPortfolioCreated: boolean; + readonly asPortfolioCreated: ITuple<[PolymeshPrimitivesIdentityId, u64, Bytes]>; + readonly isPortfolioDeleted: boolean; + readonly asPortfolioDeleted: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isMovedBetweenPortfolios: boolean; + readonly asMovedBetweenPortfolios: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesTicker, u128, Option]>; + readonly isPortfolioRenamed: boolean; + readonly asPortfolioRenamed: ITuple<[PolymeshPrimitivesIdentityId, u64, Bytes]>; + readonly isUserPortfolios: boolean; + readonly asUserPortfolios: ITuple<[PolymeshPrimitivesIdentityId, Vec>]>; + readonly isPortfolioCustodianChanged: boolean; + readonly asPortfolioCustodianChanged: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityIdPortfolioId, PolymeshPrimitivesIdentityId]>; + readonly type: 'PortfolioCreated' | 'PortfolioDeleted' | 'MovedBetweenPortfolios' | 'PortfolioRenamed' | 'UserPortfolios' | 'PortfolioCustodianChanged'; + } + + /** @name PalletProtocolFeeRawEvent (227) */ + export interface PalletProtocolFeeRawEvent extends Enum { + readonly isFeeSet: boolean; + readonly asFeeSet: ITuple<[PolymeshPrimitivesIdentityId, u128]>; + readonly isCoefficientSet: boolean; + readonly asCoefficientSet: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesPosRatio]>; + readonly isFeeCharged: boolean; + readonly asFeeCharged: ITuple<[AccountId32, u128]>; + readonly type: 'FeeSet' | 'CoefficientSet' | 'FeeCharged'; + } + + /** @name PolymeshPrimitivesPosRatio (228) */ + export interface PolymeshPrimitivesPosRatio extends ITuple<[u32, u32]> {} + + /** @name PalletSchedulerEvent (229) */ + export interface PalletSchedulerEvent extends Enum { + readonly isScheduled: boolean; + readonly asScheduled: { + readonly when: u32; + readonly index: u32; + } & Struct; + readonly isCanceled: boolean; + readonly asCanceled: { + readonly when: u32; + readonly index: u32; + } & Struct; + readonly isDispatched: boolean; + readonly asDispatched: { + readonly task: ITuple<[u32, u32]>; + readonly id: Option; + readonly result: Result; + } & Struct; + readonly isCallLookupFailed: boolean; + readonly asCallLookupFailed: { + readonly task: ITuple<[u32, u32]>; + readonly id: Option; + readonly error: FrameSupportScheduleLookupError; + } & Struct; + readonly type: 'Scheduled' | 'Canceled' | 'Dispatched' | 'CallLookupFailed'; + } + + /** @name FrameSupportScheduleLookupError (231) */ + export interface FrameSupportScheduleLookupError extends Enum { + readonly isUnknown: boolean; + readonly isBadFormat: boolean; + readonly type: 'Unknown' | 'BadFormat'; + } + + /** @name PalletSettlementRawEvent (232) */ + export interface PalletSettlementRawEvent extends Enum { + readonly isVenueCreated: boolean; + readonly asVenueCreated: ITuple<[PolymeshPrimitivesIdentityId, u64, Bytes, PalletSettlementVenueType]>; + readonly isVenueDetailsUpdated: boolean; + readonly asVenueDetailsUpdated: ITuple<[PolymeshPrimitivesIdentityId, u64, Bytes]>; + readonly isVenueTypeUpdated: boolean; + readonly asVenueTypeUpdated: ITuple<[PolymeshPrimitivesIdentityId, u64, PalletSettlementVenueType]>; + readonly isInstructionCreated: boolean; + readonly asInstructionCreated: ITuple<[PolymeshPrimitivesIdentityId, u64, u64, PalletSettlementSettlementType, Option, Option, Vec]>; + readonly isInstructionAffirmed: boolean; + readonly asInstructionAffirmed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityIdPortfolioId, u64]>; + readonly isAffirmationWithdrawn: boolean; + readonly asAffirmationWithdrawn: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityIdPortfolioId, u64]>; + readonly isInstructionRejected: boolean; + readonly asInstructionRejected: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isReceiptClaimed: boolean; + readonly asReceiptClaimed: ITuple<[PolymeshPrimitivesIdentityId, u64, u64, u64, AccountId32, Bytes]>; + readonly isReceiptValidityChanged: boolean; + readonly asReceiptValidityChanged: ITuple<[PolymeshPrimitivesIdentityId, AccountId32, u64, bool]>; + readonly isReceiptUnclaimed: boolean; + readonly asReceiptUnclaimed: ITuple<[PolymeshPrimitivesIdentityId, u64, u64, u64, AccountId32]>; + readonly isVenueFiltering: boolean; + readonly asVenueFiltering: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, bool]>; + readonly isVenuesAllowed: boolean; + readonly asVenuesAllowed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Vec]>; + readonly isVenuesBlocked: boolean; + readonly asVenuesBlocked: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, Vec]>; + readonly isLegFailedExecution: boolean; + readonly asLegFailedExecution: ITuple<[PolymeshPrimitivesIdentityId, u64, u64]>; + readonly isInstructionFailed: boolean; + readonly asInstructionFailed: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isInstructionExecuted: boolean; + readonly asInstructionExecuted: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isVenueUnauthorized: boolean; + readonly asVenueUnauthorized: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTicker, u64]>; + readonly isSchedulingFailed: boolean; + readonly asSchedulingFailed: SpRuntimeDispatchError; + readonly isInstructionRescheduled: boolean; + readonly asInstructionRescheduled: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly type: 'VenueCreated' | 'VenueDetailsUpdated' | 'VenueTypeUpdated' | 'InstructionCreated' | 'InstructionAffirmed' | 'AffirmationWithdrawn' | 'InstructionRejected' | 'ReceiptClaimed' | 'ReceiptValidityChanged' | 'ReceiptUnclaimed' | 'VenueFiltering' | 'VenuesAllowed' | 'VenuesBlocked' | 'LegFailedExecution' | 'InstructionFailed' | 'InstructionExecuted' | 'VenueUnauthorized' | 'SchedulingFailed' | 'InstructionRescheduled'; + } + + /** @name PalletSettlementVenueType (235) */ + export interface PalletSettlementVenueType extends Enum { + readonly isOther: boolean; + readonly isDistribution: boolean; + readonly isSto: boolean; + readonly isExchange: boolean; + readonly type: 'Other' | 'Distribution' | 'Sto' | 'Exchange'; + } + + /** @name PalletSettlementSettlementType (237) */ + export interface PalletSettlementSettlementType extends Enum { + readonly isSettleOnAffirmation: boolean; + readonly isSettleOnBlock: boolean; + readonly asSettleOnBlock: u32; + readonly type: 'SettleOnAffirmation' | 'SettleOnBlock'; + } + + /** @name PalletSettlementLeg (239) */ + export interface PalletSettlementLeg extends Struct { + readonly from: PolymeshPrimitivesIdentityIdPortfolioId; + readonly to: PolymeshPrimitivesIdentityIdPortfolioId; + readonly asset: PolymeshPrimitivesTicker; + readonly amount: u128; + } + + /** @name PolymeshCommonUtilitiesStatisticsEvent (243) */ + export interface PolymeshCommonUtilitiesStatisticsEvent extends Enum { + readonly isStatTypesAdded: boolean; + readonly asStatTypesAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesStatisticsAssetScope, Vec]>; + readonly isStatTypesRemoved: boolean; + readonly asStatTypesRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesStatisticsAssetScope, Vec]>; + readonly isAssetStatsUpdated: boolean; + readonly asAssetStatsUpdated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesStatisticsAssetScope, PolymeshPrimitivesStatisticsStatType, Vec]>; + readonly isSetAssetTransferCompliance: boolean; + readonly asSetAssetTransferCompliance: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesStatisticsAssetScope, Vec]>; + readonly isTransferConditionExemptionsAdded: boolean; + readonly asTransferConditionExemptionsAdded: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTransferComplianceTransferConditionExemptKey, Vec]>; + readonly isTransferConditionExemptionsRemoved: boolean; + readonly asTransferConditionExemptionsRemoved: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesTransferComplianceTransferConditionExemptKey, Vec]>; + readonly type: 'StatTypesAdded' | 'StatTypesRemoved' | 'AssetStatsUpdated' | 'SetAssetTransferCompliance' | 'TransferConditionExemptionsAdded' | 'TransferConditionExemptionsRemoved'; + } + + /** @name PolymeshPrimitivesStatisticsAssetScope (244) */ + export interface PolymeshPrimitivesStatisticsAssetScope extends Enum { + readonly isTicker: boolean; + readonly asTicker: PolymeshPrimitivesTicker; + readonly type: 'Ticker'; + } + + /** @name PolymeshPrimitivesStatisticsStatType (246) */ + export interface PolymeshPrimitivesStatisticsStatType extends Struct { + readonly op: PolymeshPrimitivesStatisticsStatOpType; + readonly claimIssuer: Option>; + } + + /** @name PolymeshPrimitivesStatisticsStatOpType (247) */ + export interface PolymeshPrimitivesStatisticsStatOpType extends Enum { + readonly isCount: boolean; + readonly isBalance: boolean; + readonly type: 'Count' | 'Balance'; + } + + /** @name PolymeshPrimitivesStatisticsStatUpdate (251) */ + export interface PolymeshPrimitivesStatisticsStatUpdate extends Struct { + readonly key2: PolymeshPrimitivesStatisticsStat2ndKey; + readonly value: Option; + } + + /** @name PolymeshPrimitivesStatisticsStat2ndKey (252) */ + export interface PolymeshPrimitivesStatisticsStat2ndKey extends Enum { + readonly isNoClaimStat: boolean; + readonly isClaim: boolean; + readonly asClaim: PolymeshPrimitivesStatisticsStatClaim; + readonly type: 'NoClaimStat' | 'Claim'; + } + + /** @name PolymeshPrimitivesStatisticsStatClaim (253) */ + export interface PolymeshPrimitivesStatisticsStatClaim extends Enum { + readonly isAccredited: boolean; + readonly asAccredited: bool; + readonly isAffiliate: boolean; + readonly asAffiliate: bool; + readonly isJurisdiction: boolean; + readonly asJurisdiction: Option; + readonly type: 'Accredited' | 'Affiliate' | 'Jurisdiction'; + } + + /** @name PolymeshPrimitivesTransferComplianceTransferCondition (257) */ + export interface PolymeshPrimitivesTransferComplianceTransferCondition extends Enum { + readonly isMaxInvestorCount: boolean; + readonly asMaxInvestorCount: u64; + readonly isMaxInvestorOwnership: boolean; + readonly asMaxInvestorOwnership: Permill; + readonly isClaimCount: boolean; + readonly asClaimCount: ITuple<[PolymeshPrimitivesStatisticsStatClaim, PolymeshPrimitivesIdentityId, u64, Option]>; + readonly isClaimOwnership: boolean; + readonly asClaimOwnership: ITuple<[PolymeshPrimitivesStatisticsStatClaim, PolymeshPrimitivesIdentityId, Permill, Permill]>; + readonly type: 'MaxInvestorCount' | 'MaxInvestorOwnership' | 'ClaimCount' | 'ClaimOwnership'; + } + + /** @name PolymeshPrimitivesTransferComplianceTransferConditionExemptKey (259) */ + export interface PolymeshPrimitivesTransferComplianceTransferConditionExemptKey extends Struct { + readonly asset: PolymeshPrimitivesStatisticsAssetScope; + readonly op: PolymeshPrimitivesStatisticsStatOpType; + readonly claimType: Option; + } + + /** @name PalletStoRawEvent (261) */ + export interface PalletStoRawEvent extends Enum { + readonly isFundraiserCreated: boolean; + readonly asFundraiserCreated: ITuple<[PolymeshPrimitivesIdentityId, u64, Bytes, PalletStoFundraiser]>; + readonly isInvested: boolean; + readonly asInvested: ITuple<[PolymeshPrimitivesIdentityId, u64, PolymeshPrimitivesTicker, PolymeshPrimitivesTicker, u128, u128]>; + readonly isFundraiserFrozen: boolean; + readonly asFundraiserFrozen: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isFundraiserUnfrozen: boolean; + readonly asFundraiserUnfrozen: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly isFundraiserWindowModified: boolean; + readonly asFundraiserWindowModified: ITuple<[PolymeshPrimitivesEventOnly, u64, u64, Option, u64, Option]>; + readonly isFundraiserClosed: boolean; + readonly asFundraiserClosed: ITuple<[PolymeshPrimitivesIdentityId, u64]>; + readonly type: 'FundraiserCreated' | 'Invested' | 'FundraiserFrozen' | 'FundraiserUnfrozen' | 'FundraiserWindowModified' | 'FundraiserClosed'; + } + + /** @name PalletStoFundraiser (264) */ + export interface PalletStoFundraiser extends Struct { + readonly creator: PolymeshPrimitivesIdentityId; + readonly offeringPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly raisingPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly raisingAsset: PolymeshPrimitivesTicker; + readonly tiers: Vec; + readonly venueId: u64; + readonly start: u64; + readonly end: Option; + readonly status: PalletStoFundraiserStatus; + readonly minimumInvestment: u128; + } + + /** @name PalletStoFundraiserTier (266) */ + export interface PalletStoFundraiserTier extends Struct { + readonly total: u128; + readonly price: u128; + readonly remaining: u128; + } + + /** @name PalletStoFundraiserStatus (267) */ + export interface PalletStoFundraiserStatus extends Enum { + readonly isLive: boolean; + readonly isFrozen: boolean; + readonly isClosed: boolean; + readonly isClosedEarly: boolean; + readonly type: 'Live' | 'Frozen' | 'Closed' | 'ClosedEarly'; + } + + /** @name PalletTreasuryRawEvent (268) */ + export interface PalletTreasuryRawEvent extends Enum { + readonly isTreasuryDisbursement: boolean; + readonly asTreasuryDisbursement: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isTreasuryDisbursementFailed: boolean; + readonly asTreasuryDisbursementFailed: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesIdentityId, AccountId32, u128]>; + readonly isTreasuryReimbursement: boolean; + readonly asTreasuryReimbursement: ITuple<[PolymeshPrimitivesIdentityId, u128]>; + readonly type: 'TreasuryDisbursement' | 'TreasuryDisbursementFailed' | 'TreasuryReimbursement'; + } + + /** @name PalletUtilityEvent (269) */ + export interface PalletUtilityEvent extends Enum { + readonly isBatchInterrupted: boolean; + readonly asBatchInterrupted: ITuple<[Vec, ITuple<[u32, SpRuntimeDispatchError]>]>; + readonly isBatchOptimisticFailed: boolean; + readonly asBatchOptimisticFailed: ITuple<[Vec, Vec>]>; + readonly isBatchCompleted: boolean; + readonly asBatchCompleted: Vec; + readonly type: 'BatchInterrupted' | 'BatchOptimisticFailed' | 'BatchCompleted'; + } + + /** @name PolymeshCommonUtilitiesBaseEvent (273) */ + export interface PolymeshCommonUtilitiesBaseEvent extends Enum { + readonly isUnexpectedError: boolean; + readonly asUnexpectedError: Option; + readonly type: 'UnexpectedError'; + } + + /** @name PolymeshCommonUtilitiesExternalAgentsEvent (275) */ + export interface PolymeshCommonUtilitiesExternalAgentsEvent extends Enum { + readonly isGroupCreated: boolean; + readonly asGroupCreated: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, u32, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions]>; + readonly isGroupPermissionsUpdated: boolean; + readonly asGroupPermissionsUpdated: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, u32, PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions]>; + readonly isAgentAdded: boolean; + readonly asAgentAdded: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, PolymeshPrimitivesAgentAgentGroup]>; + readonly isAgentRemoved: boolean; + readonly asAgentRemoved: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId]>; + readonly isGroupChanged: boolean; + readonly asGroupChanged: ITuple<[PolymeshPrimitivesEventOnly, PolymeshPrimitivesTicker, PolymeshPrimitivesIdentityId, PolymeshPrimitivesAgentAgentGroup]>; + readonly type: 'GroupCreated' | 'GroupPermissionsUpdated' | 'AgentAdded' | 'AgentRemoved' | 'GroupChanged'; + } + + /** @name PolymeshCommonUtilitiesRelayerRawEvent (276) */ + export interface PolymeshCommonUtilitiesRelayerRawEvent extends Enum { + readonly isAuthorizedPayingKey: boolean; + readonly asAuthorizedPayingKey: ITuple<[PolymeshPrimitivesEventOnly, AccountId32, AccountId32, u128, u64]>; + readonly isAcceptedPayingKey: boolean; + readonly asAcceptedPayingKey: ITuple<[PolymeshPrimitivesEventOnly, AccountId32, AccountId32]>; + readonly isRemovedPayingKey: boolean; + readonly asRemovedPayingKey: ITuple<[PolymeshPrimitivesEventOnly, AccountId32, AccountId32]>; + readonly isUpdatedPolyxLimit: boolean; + readonly asUpdatedPolyxLimit: ITuple<[PolymeshPrimitivesEventOnly, AccountId32, AccountId32, u128, u128]>; + readonly type: 'AuthorizedPayingKey' | 'AcceptedPayingKey' | 'RemovedPayingKey' | 'UpdatedPolyxLimit'; + } + + /** @name PalletRewardsRawEvent (277) */ + export interface PalletRewardsRawEvent extends Enum { + readonly isItnRewardClaimed: boolean; + readonly asItnRewardClaimed: ITuple<[AccountId32, u128]>; + readonly type: 'ItnRewardClaimed'; + } + + /** @name PalletContractsEvent (278) */ + export interface PalletContractsEvent extends Enum { + readonly isInstantiated: boolean; + readonly asInstantiated: { + readonly deployer: AccountId32; + readonly contract: AccountId32; + } & Struct; + readonly isTerminated: boolean; + readonly asTerminated: { + readonly contract: AccountId32; + readonly beneficiary: AccountId32; + } & Struct; + readonly isCodeStored: boolean; + readonly asCodeStored: { + readonly codeHash: H256; + } & Struct; + readonly isContractEmitted: boolean; + readonly asContractEmitted: { + readonly contract: AccountId32; + readonly data: Bytes; + } & Struct; + readonly isCodeRemoved: boolean; + readonly asCodeRemoved: { + readonly codeHash: H256; + } & Struct; + readonly isContractCodeUpdated: boolean; + readonly asContractCodeUpdated: { + readonly contract: AccountId32; + readonly newCodeHash: H256; + readonly oldCodeHash: H256; + } & Struct; + readonly type: 'Instantiated' | 'Terminated' | 'CodeStored' | 'ContractEmitted' | 'CodeRemoved' | 'ContractCodeUpdated'; + } + + /** @name PolymeshContractsEvent (279) */ + export type PolymeshContractsEvent = Null; + + /** @name PalletPreimageEvent (280) */ + export interface PalletPreimageEvent extends Enum { + readonly isNoted: boolean; + readonly asNoted: { + readonly hash_: H256; + } & Struct; + readonly isRequested: boolean; + readonly asRequested: { + readonly hash_: H256; + } & Struct; + readonly isCleared: boolean; + readonly asCleared: { + readonly hash_: H256; + } & Struct; + readonly type: 'Noted' | 'Requested' | 'Cleared'; + } + + /** @name PalletTestUtilsRawEvent (281) */ + export interface PalletTestUtilsRawEvent extends Enum { + readonly isMockInvestorUIDCreated: boolean; + readonly asMockInvestorUIDCreated: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesCddIdInvestorUid]>; + readonly isDidStatus: boolean; + readonly asDidStatus: ITuple<[PolymeshPrimitivesIdentityId, AccountId32]>; + readonly isCddStatus: boolean; + readonly asCddStatus: ITuple<[Option, AccountId32, bool]>; + readonly type: 'MockInvestorUIDCreated' | 'DidStatus' | 'CddStatus'; + } + + /** @name PolymeshPrimitivesCddIdInvestorUid (282) */ + export interface PolymeshPrimitivesCddIdInvestorUid extends U8aFixed {} + + /** @name FrameSystemPhase (283) */ + export interface FrameSystemPhase extends Enum { + readonly isApplyExtrinsic: boolean; + readonly asApplyExtrinsic: u32; + readonly isFinalization: boolean; + readonly isInitialization: boolean; + readonly type: 'ApplyExtrinsic' | 'Finalization' | 'Initialization'; + } + + /** @name FrameSystemLastRuntimeUpgradeInfo (286) */ + export interface FrameSystemLastRuntimeUpgradeInfo extends Struct { + readonly specVersion: Compact; + readonly specName: Text; + } + + /** @name FrameSystemCall (289) */ + export interface FrameSystemCall extends Enum { + readonly isFillBlock: boolean; + readonly asFillBlock: { + readonly ratio: Perbill; + } & Struct; + readonly isRemark: boolean; + readonly asRemark: { + readonly remark: Bytes; + } & Struct; + readonly isSetHeapPages: boolean; + readonly asSetHeapPages: { + readonly pages: u64; + } & Struct; + readonly isSetCode: boolean; + readonly asSetCode: { + readonly code: Bytes; + } & Struct; + readonly isSetCodeWithoutChecks: boolean; + readonly asSetCodeWithoutChecks: { + readonly code: Bytes; + } & Struct; + readonly isSetStorage: boolean; + readonly asSetStorage: { + readonly items: Vec>; + } & Struct; + readonly isKillStorage: boolean; + readonly asKillStorage: { + readonly keys_: Vec; + } & Struct; + readonly isKillPrefix: boolean; + readonly asKillPrefix: { + readonly prefix: Bytes; + readonly subkeys: u32; + } & Struct; + readonly isRemarkWithEvent: boolean; + readonly asRemarkWithEvent: { + readonly remark: Bytes; + } & Struct; + readonly type: 'FillBlock' | 'Remark' | 'SetHeapPages' | 'SetCode' | 'SetCodeWithoutChecks' | 'SetStorage' | 'KillStorage' | 'KillPrefix' | 'RemarkWithEvent'; + } + + /** @name FrameSystemLimitsBlockWeights (293) */ + export interface FrameSystemLimitsBlockWeights extends Struct { + readonly baseBlock: u64; + readonly maxBlock: u64; + readonly perClass: FrameSupportWeightsPerDispatchClassWeightsPerClass; + } + + /** @name FrameSupportWeightsPerDispatchClassWeightsPerClass (294) */ + export interface FrameSupportWeightsPerDispatchClassWeightsPerClass extends Struct { + readonly normal: FrameSystemLimitsWeightsPerClass; + readonly operational: FrameSystemLimitsWeightsPerClass; + readonly mandatory: FrameSystemLimitsWeightsPerClass; + } + + /** @name FrameSystemLimitsWeightsPerClass (295) */ + export interface FrameSystemLimitsWeightsPerClass extends Struct { + readonly baseExtrinsic: u64; + readonly maxExtrinsic: Option; + readonly maxTotal: Option; + readonly reserved: Option; + } + + /** @name FrameSystemLimitsBlockLength (296) */ + export interface FrameSystemLimitsBlockLength extends Struct { + readonly max: FrameSupportWeightsPerDispatchClassU32; + } + + /** @name FrameSupportWeightsPerDispatchClassU32 (297) */ + export interface FrameSupportWeightsPerDispatchClassU32 extends Struct { + readonly normal: u32; + readonly operational: u32; + readonly mandatory: u32; + } + + /** @name FrameSupportWeightsRuntimeDbWeight (298) */ + export interface FrameSupportWeightsRuntimeDbWeight extends Struct { + readonly read: u64; + readonly write: u64; + } + + /** @name SpVersionRuntimeVersion (299) */ + export interface SpVersionRuntimeVersion extends Struct { + readonly specName: Text; + readonly implName: Text; + readonly authoringVersion: u32; + readonly specVersion: u32; + readonly implVersion: u32; + readonly apis: Vec>; + readonly transactionVersion: u32; + readonly stateVersion: u8; + } + + /** @name FrameSystemError (304) */ + export interface FrameSystemError extends Enum { + readonly isInvalidSpecName: boolean; + readonly isSpecVersionNeedsToIncrease: boolean; + readonly isFailedToExtractRuntimeVersion: boolean; + readonly isNonDefaultComposite: boolean; + readonly isNonZeroRefCount: boolean; + readonly isCallFiltered: boolean; + readonly type: 'InvalidSpecName' | 'SpecVersionNeedsToIncrease' | 'FailedToExtractRuntimeVersion' | 'NonDefaultComposite' | 'NonZeroRefCount' | 'CallFiltered'; + } + + /** @name SpConsensusBabeAppPublic (307) */ + export interface SpConsensusBabeAppPublic extends SpCoreSr25519Public {} + + /** @name SpConsensusBabeDigestsNextConfigDescriptor (310) */ + export interface SpConsensusBabeDigestsNextConfigDescriptor extends Enum { + readonly isV1: boolean; + readonly asV1: { + readonly c: ITuple<[u64, u64]>; + readonly allowedSlots: SpConsensusBabeAllowedSlots; + } & Struct; + readonly type: 'V1'; + } + + /** @name SpConsensusBabeAllowedSlots (312) */ + export interface SpConsensusBabeAllowedSlots extends Enum { + readonly isPrimarySlots: boolean; + readonly isPrimaryAndSecondaryPlainSlots: boolean; + readonly isPrimaryAndSecondaryVRFSlots: boolean; + readonly type: 'PrimarySlots' | 'PrimaryAndSecondaryPlainSlots' | 'PrimaryAndSecondaryVRFSlots'; + } + + /** @name SpConsensusBabeBabeEpochConfiguration (316) */ + export interface SpConsensusBabeBabeEpochConfiguration extends Struct { + readonly c: ITuple<[u64, u64]>; + readonly allowedSlots: SpConsensusBabeAllowedSlots; + } + + /** @name PalletBabeCall (317) */ + export interface PalletBabeCall extends Enum { + readonly isReportEquivocation: boolean; + readonly asReportEquivocation: { + readonly equivocationProof: SpConsensusSlotsEquivocationProof; + readonly keyOwnerProof: SpSessionMembershipProof; + } & Struct; + readonly isReportEquivocationUnsigned: boolean; + readonly asReportEquivocationUnsigned: { + readonly equivocationProof: SpConsensusSlotsEquivocationProof; + readonly keyOwnerProof: SpSessionMembershipProof; + } & Struct; + readonly isPlanConfigChange: boolean; + readonly asPlanConfigChange: { + readonly config: SpConsensusBabeDigestsNextConfigDescriptor; + } & Struct; + readonly type: 'ReportEquivocation' | 'ReportEquivocationUnsigned' | 'PlanConfigChange'; + } + + /** @name SpConsensusSlotsEquivocationProof (318) */ + export interface SpConsensusSlotsEquivocationProof extends Struct { + readonly offender: SpConsensusBabeAppPublic; + readonly slot: u64; + readonly firstHeader: SpRuntimeHeader; + readonly secondHeader: SpRuntimeHeader; + } + + /** @name SpRuntimeHeader (319) */ + export interface SpRuntimeHeader extends Struct { + readonly parentHash: H256; + readonly number: Compact; + readonly stateRoot: H256; + readonly extrinsicsRoot: H256; + readonly digest: SpRuntimeDigest; + } + + /** @name SpRuntimeBlakeTwo256 (320) */ + export type SpRuntimeBlakeTwo256 = Null; + + /** @name SpSessionMembershipProof (321) */ + export interface SpSessionMembershipProof extends Struct { + readonly session: u32; + readonly trieNodes: Vec; + readonly validatorCount: u32; + } + + /** @name PalletBabeError (322) */ + export interface PalletBabeError extends Enum { + readonly isInvalidEquivocationProof: boolean; + readonly isInvalidKeyOwnershipProof: boolean; + readonly isDuplicateOffenceReport: boolean; + readonly type: 'InvalidEquivocationProof' | 'InvalidKeyOwnershipProof' | 'DuplicateOffenceReport'; + } + + /** @name PalletTimestampCall (323) */ + export interface PalletTimestampCall extends Enum { + readonly isSet: boolean; + readonly asSet: { + readonly now: Compact; + } & Struct; + readonly type: 'Set'; + } + + /** @name PalletIndicesCall (326) */ + export interface PalletIndicesCall extends Enum { + readonly isClaim: boolean; + readonly asClaim: { + readonly index: u32; + } & Struct; + readonly isTransfer: boolean; + readonly asTransfer: { + readonly new_: AccountId32; + readonly index: u32; + } & Struct; + readonly isFree: boolean; + readonly asFree: { + readonly index: u32; + } & Struct; + readonly isForceTransfer: boolean; + readonly asForceTransfer: { + readonly new_: AccountId32; + readonly index: u32; + readonly freeze: bool; + } & Struct; + readonly isFreeze: boolean; + readonly asFreeze: { + readonly index: u32; + } & Struct; + readonly type: 'Claim' | 'Transfer' | 'Free' | 'ForceTransfer' | 'Freeze'; + } + + /** @name PalletIndicesError (327) */ + export interface PalletIndicesError extends Enum { + readonly isNotAssigned: boolean; + readonly isNotOwner: boolean; + readonly isInUse: boolean; + readonly isNotTransfer: boolean; + readonly isPermanent: boolean; + readonly type: 'NotAssigned' | 'NotOwner' | 'InUse' | 'NotTransfer' | 'Permanent'; + } + + /** @name PalletAuthorshipUncleEntryItem (329) */ + export interface PalletAuthorshipUncleEntryItem extends Enum { + readonly isInclusionHeight: boolean; + readonly asInclusionHeight: u32; + readonly isUncle: boolean; + readonly asUncle: ITuple<[H256, Option]>; + readonly type: 'InclusionHeight' | 'Uncle'; + } + + /** @name PalletAuthorshipCall (330) */ + export interface PalletAuthorshipCall extends Enum { + readonly isSetUncles: boolean; + readonly asSetUncles: { + readonly newUncles: Vec; + } & Struct; + readonly type: 'SetUncles'; + } + + /** @name PalletAuthorshipError (332) */ + export interface PalletAuthorshipError extends Enum { + readonly isInvalidUncleParent: boolean; + readonly isUnclesAlreadySet: boolean; + readonly isTooManyUncles: boolean; + readonly isGenesisUncle: boolean; + readonly isTooHighUncle: boolean; + readonly isUncleAlreadyIncluded: boolean; + readonly isOldUncle: boolean; + readonly type: 'InvalidUncleParent' | 'UnclesAlreadySet' | 'TooManyUncles' | 'GenesisUncle' | 'TooHighUncle' | 'UncleAlreadyIncluded' | 'OldUncle'; + } + + /** @name PalletBalancesBalanceLock (334) */ + export interface PalletBalancesBalanceLock extends Struct { + readonly id: U8aFixed; + readonly amount: u128; + readonly reasons: PolymeshCommonUtilitiesBalancesReasons; + } + + /** @name PolymeshCommonUtilitiesBalancesReasons (335) */ + export interface PolymeshCommonUtilitiesBalancesReasons extends Enum { + readonly isFee: boolean; + readonly isMisc: boolean; + readonly isAll: boolean; + readonly type: 'Fee' | 'Misc' | 'All'; + } + + /** @name PalletBalancesCall (336) */ + export interface PalletBalancesCall extends Enum { + readonly isTransfer: boolean; + readonly asTransfer: { + readonly dest: MultiAddress; + readonly value: Compact; + } & Struct; + readonly isTransferWithMemo: boolean; + readonly asTransferWithMemo: { + readonly dest: MultiAddress; + readonly value: Compact; + readonly memo: Option; + } & Struct; + readonly isDepositBlockRewardReserveBalance: boolean; + readonly asDepositBlockRewardReserveBalance: { + readonly value: Compact; + } & Struct; + readonly isSetBalance: boolean; + readonly asSetBalance: { + readonly who: MultiAddress; + readonly newFree: Compact; + readonly newReserved: Compact; + } & Struct; + readonly isForceTransfer: boolean; + readonly asForceTransfer: { + readonly source: MultiAddress; + readonly dest: MultiAddress; + readonly value: Compact; + } & Struct; + readonly isBurnAccountBalance: boolean; + readonly asBurnAccountBalance: { + readonly amount: u128; + } & Struct; + readonly type: 'Transfer' | 'TransferWithMemo' | 'DepositBlockRewardReserveBalance' | 'SetBalance' | 'ForceTransfer' | 'BurnAccountBalance'; + } + + /** @name PalletBalancesError (338) */ + export interface PalletBalancesError extends Enum { + readonly isLiquidityRestrictions: boolean; + readonly isOverflow: boolean; + readonly isInsufficientBalance: boolean; + readonly isExistentialDeposit: boolean; + readonly isReceiverCddMissing: boolean; + readonly type: 'LiquidityRestrictions' | 'Overflow' | 'InsufficientBalance' | 'ExistentialDeposit' | 'ReceiverCddMissing'; + } + + /** @name PalletTransactionPaymentReleases (340) */ + export interface PalletTransactionPaymentReleases extends Enum { + readonly isV1Ancient: boolean; + readonly isV2: boolean; + readonly type: 'V1Ancient' | 'V2'; + } + + /** @name FrameSupportWeightsWeightToFeeCoefficient (342) */ + export interface FrameSupportWeightsWeightToFeeCoefficient extends Struct { + readonly coeffInteger: u128; + readonly coeffFrac: Perbill; + readonly negative: bool; + readonly degree: u8; + } + + /** @name PolymeshPrimitivesIdentityDidRecord (343) */ + export interface PolymeshPrimitivesIdentityDidRecord extends Struct { + readonly primaryKey: Option; + } + + /** @name PalletIdentityClaim1stKey (345) */ + export interface PalletIdentityClaim1stKey extends Struct { + readonly target: PolymeshPrimitivesIdentityId; + readonly claimType: PolymeshPrimitivesIdentityClaimClaimType; + } + + /** @name PalletIdentityClaim2ndKey (346) */ + export interface PalletIdentityClaim2ndKey extends Struct { + readonly issuer: PolymeshPrimitivesIdentityId; + readonly scope: Option; + } + + /** @name PolymeshPrimitivesSecondaryKeyKeyRecord (348) */ + export interface PolymeshPrimitivesSecondaryKeyKeyRecord extends Enum { + readonly isPrimaryKey: boolean; + readonly asPrimaryKey: PolymeshPrimitivesIdentityId; + readonly isSecondaryKey: boolean; + readonly asSecondaryKey: ITuple<[PolymeshPrimitivesIdentityId, PolymeshPrimitivesSecondaryKeyPermissions]>; + readonly isMultiSigSignerKey: boolean; + readonly asMultiSigSignerKey: AccountId32; + readonly type: 'PrimaryKey' | 'SecondaryKey' | 'MultiSigSignerKey'; + } + + /** @name PolymeshPrimitivesAuthorization (351) */ + export interface PolymeshPrimitivesAuthorization extends Struct { + readonly authorizationData: PolymeshPrimitivesAuthorizationAuthorizationData; + readonly authorizedBy: PolymeshPrimitivesIdentityId; + readonly expiry: Option; + readonly authId: u64; + } + + /** @name PalletIdentityCall (354) */ + export interface PalletIdentityCall extends Enum { + readonly isCddRegisterDid: boolean; + readonly asCddRegisterDid: { + readonly targetAccount: AccountId32; + readonly secondaryKeys: Vec; + } & Struct; + readonly isInvalidateCddClaims: boolean; + readonly asInvalidateCddClaims: { + readonly cdd: PolymeshPrimitivesIdentityId; + readonly disableFrom: u64; + readonly expiry: Option; + } & Struct; + readonly isRemoveSecondaryKeysOld: boolean; + readonly asRemoveSecondaryKeysOld: { + readonly keysToRemove: Vec; + } & Struct; + readonly isAcceptPrimaryKey: boolean; + readonly asAcceptPrimaryKey: { + readonly rotationAuthId: u64; + readonly optionalCddAuthId: Option; + } & Struct; + readonly isChangeCddRequirementForMkRotation: boolean; + readonly asChangeCddRequirementForMkRotation: { + readonly authRequired: bool; + } & Struct; + readonly isJoinIdentityAsKey: boolean; + readonly asJoinIdentityAsKey: { + readonly authId: u64; + } & Struct; + readonly isLeaveIdentityAsKey: boolean; + readonly isAddClaim: boolean; + readonly asAddClaim: { + readonly target: PolymeshPrimitivesIdentityId; + readonly claim: PolymeshPrimitivesIdentityClaimClaim; + readonly expiry: Option; + } & Struct; + readonly isRevokeClaim: boolean; + readonly asRevokeClaim: { + readonly target: PolymeshPrimitivesIdentityId; + readonly claim: PolymeshPrimitivesIdentityClaimClaim; + } & Struct; + readonly isSetPermissionToSigner: boolean; + readonly asSetPermissionToSigner: { + readonly key: PolymeshPrimitivesSecondaryKeySignatory; + readonly perms: PolymeshPrimitivesSecondaryKeyPermissions; + } & Struct; + readonly isPlaceholderLegacySetPermissionToSigner: boolean; + readonly isFreezeSecondaryKeys: boolean; + readonly isUnfreezeSecondaryKeys: boolean; + readonly isAddAuthorization: boolean; + readonly asAddAuthorization: { + readonly target: PolymeshPrimitivesSecondaryKeySignatory; + readonly data: PolymeshPrimitivesAuthorizationAuthorizationData; + readonly expiry: Option; + } & Struct; + readonly isRemoveAuthorization: boolean; + readonly asRemoveAuthorization: { + readonly target: PolymeshPrimitivesSecondaryKeySignatory; + readonly authId: u64; + readonly authIssuerPays: bool; + } & Struct; + readonly isAddSecondaryKeysWithAuthorizationOld: boolean; + readonly asAddSecondaryKeysWithAuthorizationOld: { + readonly additionalKeys: Vec; + readonly expiresAt: u64; + } & Struct; + readonly isAddInvestorUniquenessClaim: boolean; + readonly asAddInvestorUniquenessClaim: { + readonly target: PolymeshPrimitivesIdentityId; + readonly claim: PolymeshPrimitivesIdentityClaimClaim; + readonly proof: PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData; + readonly expiry: Option; + } & Struct; + readonly isGcAddCddClaim: boolean; + readonly asGcAddCddClaim: { + readonly target: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isGcRevokeCddClaim: boolean; + readonly asGcRevokeCddClaim: { + readonly target: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isAddInvestorUniquenessClaimV2: boolean; + readonly asAddInvestorUniquenessClaimV2: { + readonly target: PolymeshPrimitivesIdentityId; + readonly scope: PolymeshPrimitivesIdentityClaimScope; + readonly claim: PolymeshPrimitivesIdentityClaimClaim; + readonly proof: ConfidentialIdentityClaimProofsScopeClaimProof; + readonly expiry: Option; + } & Struct; + readonly isRevokeClaimByIndex: boolean; + readonly asRevokeClaimByIndex: { + readonly target: PolymeshPrimitivesIdentityId; + readonly claimType: PolymeshPrimitivesIdentityClaimClaimType; + readonly scope: Option; + } & Struct; + readonly isRotatePrimaryKeyToSecondary: boolean; + readonly asRotatePrimaryKeyToSecondary: { + readonly authId: u64; + readonly optionalCddAuthId: Option; + } & Struct; + readonly isAddSecondaryKeysWithAuthorization: boolean; + readonly asAddSecondaryKeysWithAuthorization: { + readonly additionalKeys: Vec; + readonly expiresAt: u64; + } & Struct; + readonly isSetSecondaryKeyPermissions: boolean; + readonly asSetSecondaryKeyPermissions: { + readonly key: AccountId32; + readonly perms: PolymeshPrimitivesSecondaryKeyPermissions; + } & Struct; + readonly isRemoveSecondaryKeys: boolean; + readonly asRemoveSecondaryKeys: { + readonly keysToRemove: Vec; + } & Struct; + readonly type: 'CddRegisterDid' | 'InvalidateCddClaims' | 'RemoveSecondaryKeysOld' | 'AcceptPrimaryKey' | 'ChangeCddRequirementForMkRotation' | 'JoinIdentityAsKey' | 'LeaveIdentityAsKey' | 'AddClaim' | 'RevokeClaim' | 'SetPermissionToSigner' | 'PlaceholderLegacySetPermissionToSigner' | 'FreezeSecondaryKeys' | 'UnfreezeSecondaryKeys' | 'AddAuthorization' | 'RemoveAuthorization' | 'AddSecondaryKeysWithAuthorizationOld' | 'AddInvestorUniquenessClaim' | 'GcAddCddClaim' | 'GcRevokeCddClaim' | 'AddInvestorUniquenessClaimV2' | 'RevokeClaimByIndex' | 'RotatePrimaryKeyToSecondary' | 'AddSecondaryKeysWithAuthorization' | 'SetSecondaryKeyPermissions' | 'RemoveSecondaryKeys'; + } + + /** @name PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuthV1 (356) */ + export interface PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuthV1 extends Struct { + readonly secondaryKey: PolymeshPrimitivesSecondaryKeyV1SecondaryKey; + readonly authSignature: H512; + } + + /** @name PolymeshPrimitivesSecondaryKeyV1SecondaryKey (357) */ + export interface PolymeshPrimitivesSecondaryKeyV1SecondaryKey extends Struct { + readonly signer: PolymeshPrimitivesSecondaryKeySignatory; + readonly permissions: PolymeshPrimitivesSecondaryKeyPermissions; + } + + /** @name PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData (359) */ + export interface PolymeshPrimitivesInvestorZkproofDataV1InvestorZKProofData extends SchnorrkelSignSignature {} + + /** @name SchnorrkelSignSignature (360) */ + export interface SchnorrkelSignSignature extends Struct { + readonly r: Curve25519DalekRistrettoCompressedRistretto; + readonly s: Curve25519DalekScalar; + } + + /** @name Curve25519DalekRistrettoCompressedRistretto (361) */ + export interface Curve25519DalekRistrettoCompressedRistretto extends U8aFixed {} + + /** @name Curve25519DalekScalar (362) */ + export interface Curve25519DalekScalar extends Struct { + readonly bytes: U8aFixed; + } + + /** @name ConfidentialIdentityClaimProofsScopeClaimProof (363) */ + export interface ConfidentialIdentityClaimProofsScopeClaimProof extends Struct { + readonly proofScopeIdWellformed: ConfidentialIdentitySignSignature; + readonly proofScopeIdCddIdMatch: ConfidentialIdentityClaimProofsZkProofData; + readonly scopeId: Curve25519DalekRistrettoRistrettoPoint; + } + + /** @name ConfidentialIdentitySignSignature (364) */ + export interface ConfidentialIdentitySignSignature extends Struct { + readonly r: Curve25519DalekRistrettoCompressedRistretto; + readonly s: Curve25519DalekScalar; + } + + /** @name ConfidentialIdentityClaimProofsZkProofData (365) */ + export interface ConfidentialIdentityClaimProofsZkProofData extends Struct { + readonly challengeResponses: Vec; + readonly subtractExpressionsRes: Curve25519DalekRistrettoRistrettoPoint; + readonly blindedScopeDidHash: Curve25519DalekRistrettoRistrettoPoint; + } + + /** @name Curve25519DalekRistrettoRistrettoPoint (367) */ + export interface Curve25519DalekRistrettoRistrettoPoint extends Curve25519DalekEdwardsEdwardsPoint {} + + /** @name Curve25519DalekEdwardsEdwardsPoint (368) */ + export interface Curve25519DalekEdwardsEdwardsPoint extends Struct { + readonly x: Curve25519DalekBackendSerialU64FieldFieldElement51; + readonly y: Curve25519DalekBackendSerialU64FieldFieldElement51; + readonly z: Curve25519DalekBackendSerialU64FieldFieldElement51; + readonly t: Curve25519DalekBackendSerialU64FieldFieldElement51; + } + + /** @name Curve25519DalekBackendSerialU64FieldFieldElement51 (369) */ + export interface Curve25519DalekBackendSerialU64FieldFieldElement51 extends Vec {} + + /** @name PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth (372) */ + export interface PolymeshCommonUtilitiesIdentitySecondaryKeyWithAuth extends Struct { + readonly secondaryKey: PolymeshPrimitivesSecondaryKey; + readonly authSignature: H512; + } + + /** @name PalletIdentityError (373) */ + export interface PalletIdentityError extends Enum { + readonly isAlreadyLinked: boolean; + readonly isMissingCurrentIdentity: boolean; + readonly isUnauthorized: boolean; + readonly isInvalidAccountKey: boolean; + readonly isUnAuthorizedCddProvider: boolean; + readonly isInvalidAuthorizationFromOwner: boolean; + readonly isInvalidAuthorizationFromCddProvider: boolean; + readonly isNotCddProviderAttestation: boolean; + readonly isAuthorizationsNotForSameDids: boolean; + readonly isDidMustAlreadyExist: boolean; + readonly isCurrentIdentityCannotBeForwarded: boolean; + readonly isAuthorizationExpired: boolean; + readonly isTargetHasNoCdd: boolean; + readonly isAuthorizationHasBeenRevoked: boolean; + readonly isInvalidAuthorizationSignature: boolean; + readonly isKeyNotAllowed: boolean; + readonly isNotPrimaryKey: boolean; + readonly isDidDoesNotExist: boolean; + readonly isDidAlreadyExists: boolean; + readonly isSecondaryKeysContainPrimaryKey: boolean; + readonly isFailedToChargeFee: boolean; + readonly isNotASigner: boolean; + readonly isCannotDecodeSignerAccountId: boolean; + readonly isMultiSigHasBalance: boolean; + readonly isConfidentialScopeClaimNotAllowed: boolean; + readonly isInvalidScopeClaim: boolean; + readonly isClaimVariantNotAllowed: boolean; + readonly isTargetHasNonZeroBalanceAtScopeId: boolean; + readonly isCddIdNotUniqueForIdentity: boolean; + readonly isInvalidCDDId: boolean; + readonly isClaimAndProofVersionsDoNotMatch: boolean; + readonly isAccountKeyIsBeingUsed: boolean; + readonly isCustomScopeTooLong: boolean; + readonly type: 'AlreadyLinked' | 'MissingCurrentIdentity' | 'Unauthorized' | 'InvalidAccountKey' | 'UnAuthorizedCddProvider' | 'InvalidAuthorizationFromOwner' | 'InvalidAuthorizationFromCddProvider' | 'NotCddProviderAttestation' | 'AuthorizationsNotForSameDids' | 'DidMustAlreadyExist' | 'CurrentIdentityCannotBeForwarded' | 'AuthorizationExpired' | 'TargetHasNoCdd' | 'AuthorizationHasBeenRevoked' | 'InvalidAuthorizationSignature' | 'KeyNotAllowed' | 'NotPrimaryKey' | 'DidDoesNotExist' | 'DidAlreadyExists' | 'SecondaryKeysContainPrimaryKey' | 'FailedToChargeFee' | 'NotASigner' | 'CannotDecodeSignerAccountId' | 'MultiSigHasBalance' | 'ConfidentialScopeClaimNotAllowed' | 'InvalidScopeClaim' | 'ClaimVariantNotAllowed' | 'TargetHasNonZeroBalanceAtScopeId' | 'CddIdNotUniqueForIdentity' | 'InvalidCDDId' | 'ClaimAndProofVersionsDoNotMatch' | 'AccountKeyIsBeingUsed' | 'CustomScopeTooLong'; + } + + /** @name PolymeshCommonUtilitiesGroupInactiveMember (375) */ + export interface PolymeshCommonUtilitiesGroupInactiveMember extends Struct { + readonly id: PolymeshPrimitivesIdentityId; + readonly deactivatedAt: u64; + readonly expiry: Option; + } + + /** @name PalletGroupCall (376) */ + export interface PalletGroupCall extends Enum { + readonly isSetActiveMembersLimit: boolean; + readonly asSetActiveMembersLimit: { + readonly limit: u32; + } & Struct; + readonly isDisableMember: boolean; + readonly asDisableMember: { + readonly who: PolymeshPrimitivesIdentityId; + readonly expiry: Option; + readonly at: Option; + } & Struct; + readonly isAddMember: boolean; + readonly asAddMember: { + readonly who: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isRemoveMember: boolean; + readonly asRemoveMember: { + readonly who: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isSwapMember: boolean; + readonly asSwapMember: { + readonly remove: PolymeshPrimitivesIdentityId; + readonly add: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isResetMembers: boolean; + readonly asResetMembers: { + readonly members: Vec; + } & Struct; + readonly isAbdicateMembership: boolean; + readonly type: 'SetActiveMembersLimit' | 'DisableMember' | 'AddMember' | 'RemoveMember' | 'SwapMember' | 'ResetMembers' | 'AbdicateMembership'; + } + + /** @name PalletGroupError (377) */ + export interface PalletGroupError extends Enum { + readonly isOnlyPrimaryKeyAllowed: boolean; + readonly isDuplicateMember: boolean; + readonly isNoSuchMember: boolean; + readonly isLastMemberCannotQuit: boolean; + readonly isMissingCurrentIdentity: boolean; + readonly isActiveMembersLimitExceeded: boolean; + readonly isActiveMembersLimitOverflow: boolean; + readonly type: 'OnlyPrimaryKeyAllowed' | 'DuplicateMember' | 'NoSuchMember' | 'LastMemberCannotQuit' | 'MissingCurrentIdentity' | 'ActiveMembersLimitExceeded' | 'ActiveMembersLimitOverflow'; + } + + /** @name PalletCommitteeCall (379) */ + export interface PalletCommitteeCall extends Enum { + readonly isSetVoteThreshold: boolean; + readonly asSetVoteThreshold: { + readonly n: u32; + readonly d: u32; + } & Struct; + readonly isSetReleaseCoordinator: boolean; + readonly asSetReleaseCoordinator: { + readonly id: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isSetExpiresAfter: boolean; + readonly asSetExpiresAfter: { + readonly expiry: PolymeshCommonUtilitiesMaybeBlock; + } & Struct; + readonly isVoteOrPropose: boolean; + readonly asVoteOrPropose: { + readonly approve: bool; + readonly call: Call; + } & Struct; + readonly isVote: boolean; + readonly asVote: { + readonly proposal: H256; + readonly index: u32; + readonly approve: bool; + } & Struct; + readonly type: 'SetVoteThreshold' | 'SetReleaseCoordinator' | 'SetExpiresAfter' | 'VoteOrPropose' | 'Vote'; + } + + /** @name PalletMultisigCall (385) */ + export interface PalletMultisigCall extends Enum { + readonly isCreateMultisig: boolean; + readonly asCreateMultisig: { + readonly signers: Vec; + readonly sigsRequired: u64; + } & Struct; + readonly isCreateOrApproveProposalAsIdentity: boolean; + readonly asCreateOrApproveProposalAsIdentity: { + readonly multisig: AccountId32; + readonly proposal: Call; + readonly expiry: Option; + readonly autoClose: bool; + } & Struct; + readonly isCreateOrApproveProposalAsKey: boolean; + readonly asCreateOrApproveProposalAsKey: { + readonly multisig: AccountId32; + readonly proposal: Call; + readonly expiry: Option; + readonly autoClose: bool; + } & Struct; + readonly isCreateProposalAsIdentity: boolean; + readonly asCreateProposalAsIdentity: { + readonly multisig: AccountId32; + readonly proposal: Call; + readonly expiry: Option; + readonly autoClose: bool; + } & Struct; + readonly isCreateProposalAsKey: boolean; + readonly asCreateProposalAsKey: { + readonly multisig: AccountId32; + readonly proposal: Call; + readonly expiry: Option; + readonly autoClose: bool; + } & Struct; + readonly isApproveAsIdentity: boolean; + readonly asApproveAsIdentity: { + readonly multisig: AccountId32; + readonly proposalId: u64; + } & Struct; + readonly isApproveAsKey: boolean; + readonly asApproveAsKey: { + readonly multisig: AccountId32; + readonly proposalId: u64; + } & Struct; + readonly isRejectAsIdentity: boolean; + readonly asRejectAsIdentity: { + readonly multisig: AccountId32; + readonly proposalId: u64; + } & Struct; + readonly isRejectAsKey: boolean; + readonly asRejectAsKey: { + readonly multisig: AccountId32; + readonly proposalId: u64; + } & Struct; + readonly isAcceptMultisigSignerAsIdentity: boolean; + readonly asAcceptMultisigSignerAsIdentity: { + readonly authId: u64; + } & Struct; + readonly isAcceptMultisigSignerAsKey: boolean; + readonly asAcceptMultisigSignerAsKey: { + readonly authId: u64; + } & Struct; + readonly isAddMultisigSigner: boolean; + readonly asAddMultisigSigner: { + readonly signer: PolymeshPrimitivesSecondaryKeySignatory; + } & Struct; + readonly isRemoveMultisigSigner: boolean; + readonly asRemoveMultisigSigner: { + readonly signer: PolymeshPrimitivesSecondaryKeySignatory; + } & Struct; + readonly isAddMultisigSignersViaCreator: boolean; + readonly asAddMultisigSignersViaCreator: { + readonly multisig: AccountId32; + readonly signers: Vec; + } & Struct; + readonly isRemoveMultisigSignersViaCreator: boolean; + readonly asRemoveMultisigSignersViaCreator: { + readonly multisig: AccountId32; + readonly signers: Vec; + } & Struct; + readonly isChangeSigsRequired: boolean; + readonly asChangeSigsRequired: { + readonly sigsRequired: u64; + } & Struct; + readonly isMakeMultisigSecondary: boolean; + readonly asMakeMultisigSecondary: { + readonly multisig: AccountId32; + } & Struct; + readonly isMakeMultisigPrimary: boolean; + readonly asMakeMultisigPrimary: { + readonly multisig: AccountId32; + readonly optionalCddAuthId: Option; + } & Struct; + readonly isExecuteScheduledProposal: boolean; + readonly asExecuteScheduledProposal: { + readonly multisig: AccountId32; + readonly proposalId: u64; + readonly multisigDid: PolymeshPrimitivesIdentityId; + readonly proposalWeight: u64; + } & Struct; + readonly type: 'CreateMultisig' | 'CreateOrApproveProposalAsIdentity' | 'CreateOrApproveProposalAsKey' | 'CreateProposalAsIdentity' | 'CreateProposalAsKey' | 'ApproveAsIdentity' | 'ApproveAsKey' | 'RejectAsIdentity' | 'RejectAsKey' | 'AcceptMultisigSignerAsIdentity' | 'AcceptMultisigSignerAsKey' | 'AddMultisigSigner' | 'RemoveMultisigSigner' | 'AddMultisigSignersViaCreator' | 'RemoveMultisigSignersViaCreator' | 'ChangeSigsRequired' | 'MakeMultisigSecondary' | 'MakeMultisigPrimary' | 'ExecuteScheduledProposal'; + } + + /** @name PalletBridgeCall (386) */ + export interface PalletBridgeCall extends Enum { + readonly isChangeController: boolean; + readonly asChangeController: { + readonly controller: AccountId32; + } & Struct; + readonly isChangeAdmin: boolean; + readonly asChangeAdmin: { + readonly admin: AccountId32; + } & Struct; + readonly isChangeTimelock: boolean; + readonly asChangeTimelock: { + readonly timelock: u32; + } & Struct; + readonly isFreeze: boolean; + readonly isUnfreeze: boolean; + readonly isChangeBridgeLimit: boolean; + readonly asChangeBridgeLimit: { + readonly amount: u128; + readonly duration: u32; + } & Struct; + readonly isChangeBridgeExempted: boolean; + readonly asChangeBridgeExempted: { + readonly exempted: Vec>; + } & Struct; + readonly isForceHandleBridgeTx: boolean; + readonly asForceHandleBridgeTx: { + readonly bridgeTx: PalletBridgeBridgeTx; + } & Struct; + readonly isBatchProposeBridgeTx: boolean; + readonly asBatchProposeBridgeTx: { + readonly bridgeTxs: Vec; + } & Struct; + readonly isProposeBridgeTx: boolean; + readonly asProposeBridgeTx: { + readonly bridgeTx: PalletBridgeBridgeTx; + } & Struct; + readonly isHandleBridgeTx: boolean; + readonly asHandleBridgeTx: { + readonly bridgeTx: PalletBridgeBridgeTx; + } & Struct; + readonly isFreezeTxs: boolean; + readonly asFreezeTxs: { + readonly bridgeTxs: Vec; + } & Struct; + readonly isUnfreezeTxs: boolean; + readonly asUnfreezeTxs: { + readonly bridgeTxs: Vec; + } & Struct; + readonly isHandleScheduledBridgeTx: boolean; + readonly asHandleScheduledBridgeTx: { + readonly bridgeTx: PalletBridgeBridgeTx; + } & Struct; + readonly isAddFreezeAdmin: boolean; + readonly asAddFreezeAdmin: { + readonly freezeAdmin: AccountId32; + } & Struct; + readonly isRemoveFreezeAdmin: boolean; + readonly asRemoveFreezeAdmin: { + readonly freezeAdmin: AccountId32; + } & Struct; + readonly isRemoveTxs: boolean; + readonly asRemoveTxs: { + readonly bridgeTxs: Vec; + } & Struct; + readonly type: 'ChangeController' | 'ChangeAdmin' | 'ChangeTimelock' | 'Freeze' | 'Unfreeze' | 'ChangeBridgeLimit' | 'ChangeBridgeExempted' | 'ForceHandleBridgeTx' | 'BatchProposeBridgeTx' | 'ProposeBridgeTx' | 'HandleBridgeTx' | 'FreezeTxs' | 'UnfreezeTxs' | 'HandleScheduledBridgeTx' | 'AddFreezeAdmin' | 'RemoveFreezeAdmin' | 'RemoveTxs'; + } + + /** @name PalletStakingCall (390) */ + export interface PalletStakingCall extends Enum { + readonly isBond: boolean; + readonly asBond: { + readonly controller: MultiAddress; + readonly value: Compact; + readonly payee: PalletStakingRewardDestination; + } & Struct; + readonly isBondExtra: boolean; + readonly asBondExtra: { + readonly maxAdditional: Compact; + } & Struct; + readonly isUnbond: boolean; + readonly asUnbond: { + readonly value: Compact; + } & Struct; + readonly isWithdrawUnbonded: boolean; + readonly asWithdrawUnbonded: { + readonly numSlashingSpans: u32; + } & Struct; + readonly isValidate: boolean; + readonly asValidate: { + readonly prefs: PalletStakingValidatorPrefs; + } & Struct; + readonly isNominate: boolean; + readonly asNominate: { + readonly targets: Vec; + } & Struct; + readonly isChill: boolean; + readonly isSetPayee: boolean; + readonly asSetPayee: { + readonly payee: PalletStakingRewardDestination; + } & Struct; + readonly isSetController: boolean; + readonly asSetController: { + readonly controller: MultiAddress; + } & Struct; + readonly isSetValidatorCount: boolean; + readonly asSetValidatorCount: { + readonly new_: Compact; + } & Struct; + readonly isIncreaseValidatorCount: boolean; + readonly asIncreaseValidatorCount: { + readonly additional: Compact; + } & Struct; + readonly isScaleValidatorCount: boolean; + readonly asScaleValidatorCount: { + readonly factor: Percent; + } & Struct; + readonly isAddPermissionedValidator: boolean; + readonly asAddPermissionedValidator: { + readonly identity: PolymeshPrimitivesIdentityId; + readonly intendedCount: Option; + } & Struct; + readonly isRemovePermissionedValidator: boolean; + readonly asRemovePermissionedValidator: { + readonly identity: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isValidateCddExpiryNominators: boolean; + readonly asValidateCddExpiryNominators: { + readonly targets: Vec; + } & Struct; + readonly isSetCommissionCap: boolean; + readonly asSetCommissionCap: { + readonly newCap: Perbill; + } & Struct; + readonly isSetMinBondThreshold: boolean; + readonly asSetMinBondThreshold: { + readonly newValue: u128; + } & Struct; + readonly isForceNoEras: boolean; + readonly isForceNewEra: boolean; + readonly isSetInvulnerables: boolean; + readonly asSetInvulnerables: { + readonly invulnerables: Vec; + } & Struct; + readonly isForceUnstake: boolean; + readonly asForceUnstake: { + readonly stash: AccountId32; + readonly numSlashingSpans: u32; + } & Struct; + readonly isForceNewEraAlways: boolean; + readonly isCancelDeferredSlash: boolean; + readonly asCancelDeferredSlash: { + readonly era: u32; + readonly slashIndices: Vec; + } & Struct; + readonly isPayoutStakers: boolean; + readonly asPayoutStakers: { + readonly validatorStash: AccountId32; + readonly era: u32; + } & Struct; + readonly isRebond: boolean; + readonly asRebond: { + readonly value: Compact; + } & Struct; + readonly isSetHistoryDepth: boolean; + readonly asSetHistoryDepth: { + readonly newHistoryDepth: Compact; + readonly eraItemsDeleted: Compact; + } & Struct; + readonly isReapStash: boolean; + readonly asReapStash: { + readonly stash: AccountId32; + readonly numSlashingSpans: u32; + } & Struct; + readonly isSubmitElectionSolution: boolean; + readonly asSubmitElectionSolution: { + readonly winners: Vec; + readonly compact: PalletStakingCompactAssignments; + readonly score: SpNposElectionsElectionScore; + readonly era: u32; + readonly size_: PalletStakingElectionSize; + } & Struct; + readonly isSubmitElectionSolutionUnsigned: boolean; + readonly asSubmitElectionSolutionUnsigned: { + readonly winners: Vec; + readonly compact: PalletStakingCompactAssignments; + readonly score: SpNposElectionsElectionScore; + readonly era: u32; + readonly size_: PalletStakingElectionSize; + } & Struct; + readonly isPayoutStakersBySystem: boolean; + readonly asPayoutStakersBySystem: { + readonly validatorStash: AccountId32; + readonly era: u32; + } & Struct; + readonly isChangeSlashingAllowedFor: boolean; + readonly asChangeSlashingAllowedFor: { + readonly slashingSwitch: PalletStakingSlashingSwitch; + } & Struct; + readonly isUpdatePermissionedValidatorIntendedCount: boolean; + readonly asUpdatePermissionedValidatorIntendedCount: { + readonly identity: PolymeshPrimitivesIdentityId; + readonly newIntendedCount: u32; + } & Struct; + readonly type: 'Bond' | 'BondExtra' | 'Unbond' | 'WithdrawUnbonded' | 'Validate' | 'Nominate' | 'Chill' | 'SetPayee' | 'SetController' | 'SetValidatorCount' | 'IncreaseValidatorCount' | 'ScaleValidatorCount' | 'AddPermissionedValidator' | 'RemovePermissionedValidator' | 'ValidateCddExpiryNominators' | 'SetCommissionCap' | 'SetMinBondThreshold' | 'ForceNoEras' | 'ForceNewEra' | 'SetInvulnerables' | 'ForceUnstake' | 'ForceNewEraAlways' | 'CancelDeferredSlash' | 'PayoutStakers' | 'Rebond' | 'SetHistoryDepth' | 'ReapStash' | 'SubmitElectionSolution' | 'SubmitElectionSolutionUnsigned' | 'PayoutStakersBySystem' | 'ChangeSlashingAllowedFor' | 'UpdatePermissionedValidatorIntendedCount'; + } + + /** @name PalletStakingRewardDestination (391) */ + export interface PalletStakingRewardDestination extends Enum { + readonly isStaked: boolean; + readonly isStash: boolean; + readonly isController: boolean; + readonly isAccount: boolean; + readonly asAccount: AccountId32; + readonly type: 'Staked' | 'Stash' | 'Controller' | 'Account'; + } + + /** @name PalletStakingValidatorPrefs (392) */ + export interface PalletStakingValidatorPrefs extends Struct { + readonly commission: Compact; + readonly blocked: bool; + } + + /** @name PalletStakingCompactAssignments (398) */ + export interface PalletStakingCompactAssignments extends Struct { + readonly votes1: Vec, Compact]>>; + readonly votes2: Vec, ITuple<[Compact, Compact]>, Compact]>>; + readonly votes3: Vec, Vec, Compact]>>, Compact]>>; + readonly votes4: Vec, Vec, Compact]>>, Compact]>>; + readonly votes5: Vec, Vec, Compact]>>, Compact]>>; + readonly votes6: Vec, Vec, Compact]>>, Compact]>>; + readonly votes7: Vec, Vec, Compact]>>, Compact]>>; + readonly votes8: Vec, Vec, Compact]>>, Compact]>>; + readonly votes9: Vec, Vec, Compact]>>, Compact]>>; + readonly votes10: Vec, Vec, Compact]>>, Compact]>>; + readonly votes11: Vec, Vec, Compact]>>, Compact]>>; + readonly votes12: Vec, Vec, Compact]>>, Compact]>>; + readonly votes13: Vec, Vec, Compact]>>, Compact]>>; + readonly votes14: Vec, Vec, Compact]>>, Compact]>>; + readonly votes15: Vec, Vec, Compact]>>, Compact]>>; + readonly votes16: Vec, Vec, Compact]>>, Compact]>>; + } + + /** @name SpNposElectionsElectionScore (449) */ + export interface SpNposElectionsElectionScore extends Struct { + readonly minimalStake: u128; + readonly sumStake: u128; + readonly sumStakeSquared: u128; + } + + /** @name PalletStakingElectionSize (450) */ + export interface PalletStakingElectionSize extends Struct { + readonly validators: Compact; + readonly nominators: Compact; + } + + /** @name PalletSessionCall (451) */ + export interface PalletSessionCall extends Enum { + readonly isSetKeys: boolean; + readonly asSetKeys: { + readonly keys_: PolymeshRuntimeDevelopRuntimeSessionKeys; + readonly proof: Bytes; + } & Struct; + readonly isPurgeKeys: boolean; + readonly type: 'SetKeys' | 'PurgeKeys'; + } + + /** @name PolymeshRuntimeDevelopRuntimeSessionKeys (452) */ + export interface PolymeshRuntimeDevelopRuntimeSessionKeys extends Struct { + readonly grandpa: SpFinalityGrandpaAppPublic; + readonly babe: SpConsensusBabeAppPublic; + readonly imOnline: PalletImOnlineSr25519AppSr25519Public; + readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic; + } + + /** @name SpAuthorityDiscoveryAppPublic (453) */ + export interface SpAuthorityDiscoveryAppPublic extends SpCoreSr25519Public {} + + /** @name PalletGrandpaCall (454) */ + export interface PalletGrandpaCall extends Enum { + readonly isReportEquivocation: boolean; + readonly asReportEquivocation: { + readonly equivocationProof: SpFinalityGrandpaEquivocationProof; + readonly keyOwnerProof: SpSessionMembershipProof; + } & Struct; + readonly isReportEquivocationUnsigned: boolean; + readonly asReportEquivocationUnsigned: { + readonly equivocationProof: SpFinalityGrandpaEquivocationProof; + readonly keyOwnerProof: SpSessionMembershipProof; + } & Struct; + readonly isNoteStalled: boolean; + readonly asNoteStalled: { + readonly delay: u32; + readonly bestFinalizedBlockNumber: u32; + } & Struct; + readonly type: 'ReportEquivocation' | 'ReportEquivocationUnsigned' | 'NoteStalled'; + } + + /** @name SpFinalityGrandpaEquivocationProof (455) */ + export interface SpFinalityGrandpaEquivocationProof extends Struct { + readonly setId: u64; + readonly equivocation: SpFinalityGrandpaEquivocation; + } + + /** @name SpFinalityGrandpaEquivocation (456) */ + export interface SpFinalityGrandpaEquivocation extends Enum { + readonly isPrevote: boolean; + readonly asPrevote: FinalityGrandpaEquivocationPrevote; + readonly isPrecommit: boolean; + readonly asPrecommit: FinalityGrandpaEquivocationPrecommit; + readonly type: 'Prevote' | 'Precommit'; + } + + /** @name FinalityGrandpaEquivocationPrevote (457) */ + export interface FinalityGrandpaEquivocationPrevote extends Struct { + readonly roundNumber: u64; + readonly identity: SpFinalityGrandpaAppPublic; + readonly first: ITuple<[FinalityGrandpaPrevote, SpFinalityGrandpaAppSignature]>; + readonly second: ITuple<[FinalityGrandpaPrevote, SpFinalityGrandpaAppSignature]>; + } + + /** @name FinalityGrandpaPrevote (458) */ + export interface FinalityGrandpaPrevote extends Struct { + readonly targetHash: H256; + readonly targetNumber: u32; + } + + /** @name SpFinalityGrandpaAppSignature (459) */ + export interface SpFinalityGrandpaAppSignature extends SpCoreEd25519Signature {} + + /** @name SpCoreEd25519Signature (460) */ + export interface SpCoreEd25519Signature extends U8aFixed {} + + /** @name FinalityGrandpaEquivocationPrecommit (462) */ + export interface FinalityGrandpaEquivocationPrecommit extends Struct { + readonly roundNumber: u64; + readonly identity: SpFinalityGrandpaAppPublic; + readonly first: ITuple<[FinalityGrandpaPrecommit, SpFinalityGrandpaAppSignature]>; + readonly second: ITuple<[FinalityGrandpaPrecommit, SpFinalityGrandpaAppSignature]>; + } + + /** @name FinalityGrandpaPrecommit (463) */ + export interface FinalityGrandpaPrecommit extends Struct { + readonly targetHash: H256; + readonly targetNumber: u32; + } + + /** @name PalletImOnlineCall (465) */ + export interface PalletImOnlineCall extends Enum { + readonly isHeartbeat: boolean; + readonly asHeartbeat: { + readonly heartbeat: PalletImOnlineHeartbeat; + readonly signature: PalletImOnlineSr25519AppSr25519Signature; + } & Struct; + readonly type: 'Heartbeat'; + } + + /** @name PalletImOnlineHeartbeat (466) */ + export interface PalletImOnlineHeartbeat extends Struct { + readonly blockNumber: u32; + readonly networkState: SpCoreOffchainOpaqueNetworkState; + readonly sessionIndex: u32; + readonly authorityIndex: u32; + readonly validatorsLen: u32; + } + + /** @name SpCoreOffchainOpaqueNetworkState (467) */ + export interface SpCoreOffchainOpaqueNetworkState extends Struct { + readonly peerId: Bytes; + readonly externalAddresses: Vec; + } + + /** @name PalletImOnlineSr25519AppSr25519Signature (471) */ + export interface PalletImOnlineSr25519AppSr25519Signature extends SpCoreSr25519Signature {} + + /** @name SpCoreSr25519Signature (472) */ + export interface SpCoreSr25519Signature extends U8aFixed {} + + /** @name PalletSudoCall (473) */ + export interface PalletSudoCall extends Enum { + readonly isSudo: boolean; + readonly asSudo: { + readonly call: Call; + } & Struct; + readonly isSudoUncheckedWeight: boolean; + readonly asSudoUncheckedWeight: { + readonly call: Call; + readonly weight: u64; + } & Struct; + readonly isSetKey: boolean; + readonly asSetKey: { + readonly new_: MultiAddress; + } & Struct; + readonly isSudoAs: boolean; + readonly asSudoAs: { + readonly who: MultiAddress; + readonly call: Call; + } & Struct; + readonly type: 'Sudo' | 'SudoUncheckedWeight' | 'SetKey' | 'SudoAs'; + } + + /** @name PalletAssetCall (474) */ + export interface PalletAssetCall extends Enum { + readonly isRegisterTicker: boolean; + readonly asRegisterTicker: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isAcceptTickerTransfer: boolean; + readonly asAcceptTickerTransfer: { + readonly authId: u64; + } & Struct; + readonly isAcceptAssetOwnershipTransfer: boolean; + readonly asAcceptAssetOwnershipTransfer: { + readonly authId: u64; + } & Struct; + readonly isCreateAsset: boolean; + readonly asCreateAsset: { + readonly name: Bytes; + readonly ticker: PolymeshPrimitivesTicker; + readonly divisible: bool; + readonly assetType: PolymeshPrimitivesAssetAssetType; + readonly identifiers: Vec; + readonly fundingRound: Option; + readonly disableIu: bool; + } & Struct; + readonly isFreeze: boolean; + readonly asFreeze: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isUnfreeze: boolean; + readonly asUnfreeze: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isRenameAsset: boolean; + readonly asRenameAsset: { + readonly ticker: PolymeshPrimitivesTicker; + readonly name: Bytes; + } & Struct; + readonly isIssue: boolean; + readonly asIssue: { + readonly ticker: PolymeshPrimitivesTicker; + readonly amount: u128; + } & Struct; + readonly isRedeem: boolean; + readonly asRedeem: { + readonly ticker: PolymeshPrimitivesTicker; + readonly value: u128; + } & Struct; + readonly isMakeDivisible: boolean; + readonly asMakeDivisible: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isAddDocuments: boolean; + readonly asAddDocuments: { + readonly docs: Vec; + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isRemoveDocuments: boolean; + readonly asRemoveDocuments: { + readonly ids: Vec; + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isSetFundingRound: boolean; + readonly asSetFundingRound: { + readonly ticker: PolymeshPrimitivesTicker; + readonly name: Bytes; + } & Struct; + readonly isUpdateIdentifiers: boolean; + readonly asUpdateIdentifiers: { + readonly ticker: PolymeshPrimitivesTicker; + readonly identifiers: Vec; + } & Struct; + readonly isClaimClassicTicker: boolean; + readonly asClaimClassicTicker: { + readonly ticker: PolymeshPrimitivesTicker; + readonly ethereumSignature: PolymeshPrimitivesEthereumEcdsaSignature; + } & Struct; + readonly isReserveClassicTicker: boolean; + readonly asReserveClassicTicker: { + readonly classicTickerImport: PalletAssetClassicTickerImport; + readonly contractDid: PolymeshPrimitivesIdentityId; + readonly config: PalletAssetTickerRegistrationConfig; + } & Struct; + readonly isControllerTransfer: boolean; + readonly asControllerTransfer: { + readonly ticker: PolymeshPrimitivesTicker; + readonly value: u128; + readonly fromPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + } & Struct; + readonly isRegisterCustomAssetType: boolean; + readonly asRegisterCustomAssetType: { + readonly ty: Bytes; + } & Struct; + readonly isCreateAssetWithCustomType: boolean; + readonly asCreateAssetWithCustomType: { + readonly name: Bytes; + readonly ticker: PolymeshPrimitivesTicker; + readonly divisible: bool; + readonly customAssetType: Bytes; + readonly identifiers: Vec; + readonly fundingRound: Option; + readonly disableIu: bool; + } & Struct; + readonly isSetAssetMetadata: boolean; + readonly asSetAssetMetadata: { + readonly ticker: PolymeshPrimitivesTicker; + readonly key: PolymeshPrimitivesAssetMetadataAssetMetadataKey; + readonly value: Bytes; + readonly detail: Option; + } & Struct; + readonly isSetAssetMetadataDetails: boolean; + readonly asSetAssetMetadataDetails: { + readonly ticker: PolymeshPrimitivesTicker; + readonly key: PolymeshPrimitivesAssetMetadataAssetMetadataKey; + readonly detail: PolymeshPrimitivesAssetMetadataAssetMetadataValueDetail; + } & Struct; + readonly isRegisterAndSetLocalAssetMetadata: boolean; + readonly asRegisterAndSetLocalAssetMetadata: { + readonly ticker: PolymeshPrimitivesTicker; + readonly name: Bytes; + readonly spec: PolymeshPrimitivesAssetMetadataAssetMetadataSpec; + readonly value: Bytes; + readonly detail: Option; + } & Struct; + readonly isRegisterAssetMetadataLocalType: boolean; + readonly asRegisterAssetMetadataLocalType: { + readonly ticker: PolymeshPrimitivesTicker; + readonly name: Bytes; + readonly spec: PolymeshPrimitivesAssetMetadataAssetMetadataSpec; + } & Struct; + readonly isRegisterAssetMetadataGlobalType: boolean; + readonly asRegisterAssetMetadataGlobalType: { + readonly name: Bytes; + readonly spec: PolymeshPrimitivesAssetMetadataAssetMetadataSpec; + } & Struct; + readonly type: 'RegisterTicker' | 'AcceptTickerTransfer' | 'AcceptAssetOwnershipTransfer' | 'CreateAsset' | 'Freeze' | 'Unfreeze' | 'RenameAsset' | 'Issue' | 'Redeem' | 'MakeDivisible' | 'AddDocuments' | 'RemoveDocuments' | 'SetFundingRound' | 'UpdateIdentifiers' | 'ClaimClassicTicker' | 'ReserveClassicTicker' | 'ControllerTransfer' | 'RegisterCustomAssetType' | 'CreateAssetWithCustomType' | 'SetAssetMetadata' | 'SetAssetMetadataDetails' | 'RegisterAndSetLocalAssetMetadata' | 'RegisterAssetMetadataLocalType' | 'RegisterAssetMetadataGlobalType'; + } + + /** @name PolymeshPrimitivesEthereumEcdsaSignature (477) */ + export interface PolymeshPrimitivesEthereumEcdsaSignature extends U8aFixed {} + + /** @name PalletAssetClassicTickerImport (479) */ + export interface PalletAssetClassicTickerImport extends Struct { + readonly ethOwner: PolymeshPrimitivesEthereumEthereumAddress; + readonly ticker: PolymeshPrimitivesTicker; + readonly isContract: bool; + readonly isCreated: bool; + } + + /** @name PalletAssetTickerRegistrationConfig (480) */ + export interface PalletAssetTickerRegistrationConfig extends Struct { + readonly maxTickerLength: u8; + readonly registrationLength: Option; + } + + /** @name PolymeshPrimitivesAssetMetadataAssetMetadataKey (481) */ + export interface PolymeshPrimitivesAssetMetadataAssetMetadataKey extends Enum { + readonly isGlobal: boolean; + readonly asGlobal: u64; + readonly isLocal: boolean; + readonly asLocal: u64; + readonly type: 'Global' | 'Local'; + } + + /** @name PalletCorporateActionsDistributionCall (482) */ + export interface PalletCorporateActionsDistributionCall extends Enum { + readonly isDistribute: boolean; + readonly asDistribute: { + readonly caId: PalletCorporateActionsCaId; + readonly portfolio: Option; + readonly currency: PolymeshPrimitivesTicker; + readonly perShare: u128; + readonly amount: u128; + readonly paymentAt: u64; + readonly expiresAt: Option; + } & Struct; + readonly isClaim: boolean; + readonly asClaim: { + readonly caId: PalletCorporateActionsCaId; + } & Struct; + readonly isPushBenefit: boolean; + readonly asPushBenefit: { + readonly caId: PalletCorporateActionsCaId; + readonly holder: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isReclaim: boolean; + readonly asReclaim: { + readonly caId: PalletCorporateActionsCaId; + } & Struct; + readonly isRemoveDistribution: boolean; + readonly asRemoveDistribution: { + readonly caId: PalletCorporateActionsCaId; + } & Struct; + readonly type: 'Distribute' | 'Claim' | 'PushBenefit' | 'Reclaim' | 'RemoveDistribution'; + } + + /** @name PalletAssetCheckpointCall (484) */ + export interface PalletAssetCheckpointCall extends Enum { + readonly isCreateCheckpoint: boolean; + readonly asCreateCheckpoint: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isSetSchedulesMaxComplexity: boolean; + readonly asSetSchedulesMaxComplexity: { + readonly maxComplexity: u64; + } & Struct; + readonly isCreateSchedule: boolean; + readonly asCreateSchedule: { + readonly ticker: PolymeshPrimitivesTicker; + readonly schedule: PalletAssetCheckpointScheduleSpec; + } & Struct; + readonly isRemoveSchedule: boolean; + readonly asRemoveSchedule: { + readonly ticker: PolymeshPrimitivesTicker; + readonly id: u64; + } & Struct; + readonly type: 'CreateCheckpoint' | 'SetSchedulesMaxComplexity' | 'CreateSchedule' | 'RemoveSchedule'; + } + + /** @name PalletAssetCheckpointScheduleSpec (485) */ + export interface PalletAssetCheckpointScheduleSpec extends Struct { + readonly start: Option; + readonly period: PolymeshPrimitivesCalendarCalendarPeriod; + readonly remaining: u32; + } + + /** @name PalletComplianceManagerCall (486) */ + export interface PalletComplianceManagerCall extends Enum { + readonly isAddComplianceRequirement: boolean; + readonly asAddComplianceRequirement: { + readonly ticker: PolymeshPrimitivesTicker; + readonly senderConditions: Vec; + readonly receiverConditions: Vec; + } & Struct; + readonly isRemoveComplianceRequirement: boolean; + readonly asRemoveComplianceRequirement: { + readonly ticker: PolymeshPrimitivesTicker; + readonly id: u32; + } & Struct; + readonly isReplaceAssetCompliance: boolean; + readonly asReplaceAssetCompliance: { + readonly ticker: PolymeshPrimitivesTicker; + readonly assetCompliance: Vec; + } & Struct; + readonly isResetAssetCompliance: boolean; + readonly asResetAssetCompliance: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isPauseAssetCompliance: boolean; + readonly asPauseAssetCompliance: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isResumeAssetCompliance: boolean; + readonly asResumeAssetCompliance: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isAddDefaultTrustedClaimIssuer: boolean; + readonly asAddDefaultTrustedClaimIssuer: { + readonly ticker: PolymeshPrimitivesTicker; + readonly issuer: PolymeshPrimitivesConditionTrustedIssuer; + } & Struct; + readonly isRemoveDefaultTrustedClaimIssuer: boolean; + readonly asRemoveDefaultTrustedClaimIssuer: { + readonly ticker: PolymeshPrimitivesTicker; + readonly issuer: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isChangeComplianceRequirement: boolean; + readonly asChangeComplianceRequirement: { + readonly ticker: PolymeshPrimitivesTicker; + readonly newReq: PolymeshPrimitivesComplianceManagerComplianceRequirement; + } & Struct; + readonly type: 'AddComplianceRequirement' | 'RemoveComplianceRequirement' | 'ReplaceAssetCompliance' | 'ResetAssetCompliance' | 'PauseAssetCompliance' | 'ResumeAssetCompliance' | 'AddDefaultTrustedClaimIssuer' | 'RemoveDefaultTrustedClaimIssuer' | 'ChangeComplianceRequirement'; + } + + /** @name PalletCorporateActionsCall (487) */ + export interface PalletCorporateActionsCall extends Enum { + readonly isSetMaxDetailsLength: boolean; + readonly asSetMaxDetailsLength: { + readonly length: u32; + } & Struct; + readonly isSetDefaultTargets: boolean; + readonly asSetDefaultTargets: { + readonly ticker: PolymeshPrimitivesTicker; + readonly targets: PalletCorporateActionsTargetIdentities; + } & Struct; + readonly isSetDefaultWithholdingTax: boolean; + readonly asSetDefaultWithholdingTax: { + readonly ticker: PolymeshPrimitivesTicker; + readonly tax: Permill; + } & Struct; + readonly isSetDidWithholdingTax: boolean; + readonly asSetDidWithholdingTax: { + readonly ticker: PolymeshPrimitivesTicker; + readonly taxedDid: PolymeshPrimitivesIdentityId; + readonly tax: Option; + } & Struct; + readonly isInitiateCorporateAction: boolean; + readonly asInitiateCorporateAction: { + readonly ticker: PolymeshPrimitivesTicker; + readonly kind: PalletCorporateActionsCaKind; + readonly declDate: u64; + readonly recordDate: Option; + readonly details: Bytes; + readonly targets: Option; + readonly defaultWithholdingTax: Option; + readonly withholdingTax: Option>>; + } & Struct; + readonly isLinkCaDoc: boolean; + readonly asLinkCaDoc: { + readonly id: PalletCorporateActionsCaId; + readonly docs: Vec; + } & Struct; + readonly isRemoveCa: boolean; + readonly asRemoveCa: { + readonly caId: PalletCorporateActionsCaId; + } & Struct; + readonly isChangeRecordDate: boolean; + readonly asChangeRecordDate: { + readonly caId: PalletCorporateActionsCaId; + readonly recordDate: Option; + } & Struct; + readonly isInitiateCorporateActionAndDistribute: boolean; + readonly asInitiateCorporateActionAndDistribute: { + readonly caArgs: PalletCorporateActionsInitiateCorporateActionArgs; + readonly portfolio: Option; + readonly currency: PolymeshPrimitivesTicker; + readonly perShare: u128; + readonly amount: u128; + readonly paymentAt: u64; + readonly expiresAt: Option; + } & Struct; + readonly type: 'SetMaxDetailsLength' | 'SetDefaultTargets' | 'SetDefaultWithholdingTax' | 'SetDidWithholdingTax' | 'InitiateCorporateAction' | 'LinkCaDoc' | 'RemoveCa' | 'ChangeRecordDate' | 'InitiateCorporateActionAndDistribute'; + } + + /** @name PalletCorporateActionsRecordDateSpec (489) */ + export interface PalletCorporateActionsRecordDateSpec extends Enum { + readonly isScheduled: boolean; + readonly asScheduled: u64; + readonly isExistingSchedule: boolean; + readonly asExistingSchedule: u64; + readonly isExisting: boolean; + readonly asExisting: u64; + readonly type: 'Scheduled' | 'ExistingSchedule' | 'Existing'; + } + + /** @name PalletCorporateActionsInitiateCorporateActionArgs (492) */ + export interface PalletCorporateActionsInitiateCorporateActionArgs extends Struct { + readonly ticker: PolymeshPrimitivesTicker; + readonly kind: PalletCorporateActionsCaKind; + readonly declDate: u64; + readonly recordDate: Option; + readonly details: Bytes; + readonly targets: Option; + readonly defaultWithholdingTax: Option; + readonly withholdingTax: Option>>; + } + + /** @name PalletCorporateActionsBallotCall (493) */ + export interface PalletCorporateActionsBallotCall extends Enum { + readonly isAttachBallot: boolean; + readonly asAttachBallot: { + readonly caId: PalletCorporateActionsCaId; + readonly range: PalletCorporateActionsBallotBallotTimeRange; + readonly meta: PalletCorporateActionsBallotBallotMeta; + readonly rcv: bool; + } & Struct; + readonly isVote: boolean; + readonly asVote: { + readonly caId: PalletCorporateActionsCaId; + readonly votes: Vec; + } & Struct; + readonly isChangeEnd: boolean; + readonly asChangeEnd: { + readonly caId: PalletCorporateActionsCaId; + readonly end: u64; + } & Struct; + readonly isChangeMeta: boolean; + readonly asChangeMeta: { + readonly caId: PalletCorporateActionsCaId; + readonly meta: PalletCorporateActionsBallotBallotMeta; + } & Struct; + readonly isChangeRcv: boolean; + readonly asChangeRcv: { + readonly caId: PalletCorporateActionsCaId; + readonly rcv: bool; + } & Struct; + readonly isRemoveBallot: boolean; + readonly asRemoveBallot: { + readonly caId: PalletCorporateActionsCaId; + } & Struct; + readonly type: 'AttachBallot' | 'Vote' | 'ChangeEnd' | 'ChangeMeta' | 'ChangeRcv' | 'RemoveBallot'; + } + + /** @name PalletPipsCall (494) */ + export interface PalletPipsCall extends Enum { + readonly isSetPruneHistoricalPips: boolean; + readonly asSetPruneHistoricalPips: { + readonly prune: bool; + } & Struct; + readonly isSetMinProposalDeposit: boolean; + readonly asSetMinProposalDeposit: { + readonly deposit: u128; + } & Struct; + readonly isSetDefaultEnactmentPeriod: boolean; + readonly asSetDefaultEnactmentPeriod: { + readonly duration: u32; + } & Struct; + readonly isSetPendingPipExpiry: boolean; + readonly asSetPendingPipExpiry: { + readonly expiry: PolymeshCommonUtilitiesMaybeBlock; + } & Struct; + readonly isSetMaxPipSkipCount: boolean; + readonly asSetMaxPipSkipCount: { + readonly max: u8; + } & Struct; + readonly isSetActivePipLimit: boolean; + readonly asSetActivePipLimit: { + readonly limit: u32; + } & Struct; + readonly isPropose: boolean; + readonly asPropose: { + readonly proposal: Call; + readonly deposit: u128; + readonly url: Option; + readonly description: Option; + } & Struct; + readonly isVote: boolean; + readonly asVote: { + readonly id: u32; + readonly ayeOrNay: bool; + readonly deposit: u128; + } & Struct; + readonly isApproveCommitteeProposal: boolean; + readonly asApproveCommitteeProposal: { + readonly id: u32; + } & Struct; + readonly isRejectProposal: boolean; + readonly asRejectProposal: { + readonly id: u32; + } & Struct; + readonly isPruneProposal: boolean; + readonly asPruneProposal: { + readonly id: u32; + } & Struct; + readonly isRescheduleExecution: boolean; + readonly asRescheduleExecution: { + readonly id: u32; + readonly until: Option; + } & Struct; + readonly isClearSnapshot: boolean; + readonly isSnapshot: boolean; + readonly isEnactSnapshotResults: boolean; + readonly asEnactSnapshotResults: { + readonly results: Vec>; + } & Struct; + readonly isExecuteScheduledPip: boolean; + readonly asExecuteScheduledPip: { + readonly id: u32; + } & Struct; + readonly isExpireScheduledPip: boolean; + readonly asExpireScheduledPip: { + readonly did: PolymeshPrimitivesIdentityId; + readonly id: u32; + } & Struct; + readonly type: 'SetPruneHistoricalPips' | 'SetMinProposalDeposit' | 'SetDefaultEnactmentPeriod' | 'SetPendingPipExpiry' | 'SetMaxPipSkipCount' | 'SetActivePipLimit' | 'Propose' | 'Vote' | 'ApproveCommitteeProposal' | 'RejectProposal' | 'PruneProposal' | 'RescheduleExecution' | 'ClearSnapshot' | 'Snapshot' | 'EnactSnapshotResults' | 'ExecuteScheduledPip' | 'ExpireScheduledPip'; + } + + /** @name PalletPipsSnapshotResult (497) */ + export interface PalletPipsSnapshotResult extends Enum { + readonly isApprove: boolean; + readonly isReject: boolean; + readonly isSkip: boolean; + readonly type: 'Approve' | 'Reject' | 'Skip'; + } + + /** @name PalletPortfolioCall (498) */ + export interface PalletPortfolioCall extends Enum { + readonly isCreatePortfolio: boolean; + readonly asCreatePortfolio: { + readonly name: Bytes; + } & Struct; + readonly isDeletePortfolio: boolean; + readonly asDeletePortfolio: { + readonly num: u64; + } & Struct; + readonly isMovePortfolioFunds: boolean; + readonly asMovePortfolioFunds: { + readonly from: PolymeshPrimitivesIdentityIdPortfolioId; + readonly to: PolymeshPrimitivesIdentityIdPortfolioId; + readonly items: Vec; + } & Struct; + readonly isRenamePortfolio: boolean; + readonly asRenamePortfolio: { + readonly num: u64; + readonly toName: Bytes; + } & Struct; + readonly isQuitPortfolioCustody: boolean; + readonly asQuitPortfolioCustody: { + readonly pid: PolymeshPrimitivesIdentityIdPortfolioId; + } & Struct; + readonly isAcceptPortfolioCustody: boolean; + readonly asAcceptPortfolioCustody: { + readonly authId: u64; + } & Struct; + readonly type: 'CreatePortfolio' | 'DeletePortfolio' | 'MovePortfolioFunds' | 'RenamePortfolio' | 'QuitPortfolioCustody' | 'AcceptPortfolioCustody'; + } + + /** @name PalletPortfolioMovePortfolioItem (500) */ + export interface PalletPortfolioMovePortfolioItem extends Struct { + readonly ticker: PolymeshPrimitivesTicker; + readonly amount: u128; + readonly memo: Option; + } + + /** @name PalletProtocolFeeCall (501) */ + export interface PalletProtocolFeeCall extends Enum { + readonly isChangeCoefficient: boolean; + readonly asChangeCoefficient: { + readonly coefficient: PolymeshPrimitivesPosRatio; + } & Struct; + readonly isChangeBaseFee: boolean; + readonly asChangeBaseFee: { + readonly op: PolymeshCommonUtilitiesProtocolFeeProtocolOp; + readonly baseFee: u128; + } & Struct; + readonly type: 'ChangeCoefficient' | 'ChangeBaseFee'; + } + + /** @name PolymeshCommonUtilitiesProtocolFeeProtocolOp (502) */ + export interface PolymeshCommonUtilitiesProtocolFeeProtocolOp extends Enum { + readonly isAssetRegisterTicker: boolean; + readonly isAssetIssue: boolean; + readonly isAssetAddDocuments: boolean; + readonly isAssetCreateAsset: boolean; + readonly isCheckpointCreateSchedule: boolean; + readonly isComplianceManagerAddComplianceRequirement: boolean; + readonly isIdentityCddRegisterDid: boolean; + readonly isIdentityAddClaim: boolean; + readonly isIdentityAddSecondaryKeysWithAuthorization: boolean; + readonly isPipsPropose: boolean; + readonly isContractsPutCode: boolean; + readonly isCorporateBallotAttachBallot: boolean; + readonly isCapitalDistributionDistribute: boolean; + readonly type: 'AssetRegisterTicker' | 'AssetIssue' | 'AssetAddDocuments' | 'AssetCreateAsset' | 'CheckpointCreateSchedule' | 'ComplianceManagerAddComplianceRequirement' | 'IdentityCddRegisterDid' | 'IdentityAddClaim' | 'IdentityAddSecondaryKeysWithAuthorization' | 'PipsPropose' | 'ContractsPutCode' | 'CorporateBallotAttachBallot' | 'CapitalDistributionDistribute'; + } + + /** @name PalletSchedulerCall (503) */ + export interface PalletSchedulerCall extends Enum { + readonly isSchedule: boolean; + readonly asSchedule: { + readonly when: u32; + readonly maybePeriodic: Option>; + readonly priority: u8; + readonly call: FrameSupportScheduleMaybeHashed; + } & Struct; + readonly isCancel: boolean; + readonly asCancel: { + readonly when: u32; + readonly index: u32; + } & Struct; + readonly isScheduleNamed: boolean; + readonly asScheduleNamed: { + readonly id: Bytes; + readonly when: u32; + readonly maybePeriodic: Option>; + readonly priority: u8; + readonly call: FrameSupportScheduleMaybeHashed; + } & Struct; + readonly isCancelNamed: boolean; + readonly asCancelNamed: { + readonly id: Bytes; + } & Struct; + readonly isScheduleAfter: boolean; + readonly asScheduleAfter: { + readonly after: u32; + readonly maybePeriodic: Option>; + readonly priority: u8; + readonly call: FrameSupportScheduleMaybeHashed; + } & Struct; + readonly isScheduleNamedAfter: boolean; + readonly asScheduleNamedAfter: { + readonly id: Bytes; + readonly after: u32; + readonly maybePeriodic: Option>; + readonly priority: u8; + readonly call: FrameSupportScheduleMaybeHashed; + } & Struct; + readonly type: 'Schedule' | 'Cancel' | 'ScheduleNamed' | 'CancelNamed' | 'ScheduleAfter' | 'ScheduleNamedAfter'; + } + + /** @name FrameSupportScheduleMaybeHashed (505) */ + export interface FrameSupportScheduleMaybeHashed extends Enum { + readonly isValue: boolean; + readonly asValue: Call; + readonly isHash: boolean; + readonly asHash: H256; + readonly type: 'Value' | 'Hash'; + } + + /** @name PalletSettlementCall (506) */ + export interface PalletSettlementCall extends Enum { + readonly isCreateVenue: boolean; + readonly asCreateVenue: { + readonly details: Bytes; + readonly signers: Vec; + readonly typ: PalletSettlementVenueType; + } & Struct; + readonly isUpdateVenueDetails: boolean; + readonly asUpdateVenueDetails: { + readonly id: u64; + readonly details: Bytes; + } & Struct; + readonly isUpdateVenueType: boolean; + readonly asUpdateVenueType: { + readonly id: u64; + readonly typ: PalletSettlementVenueType; + } & Struct; + readonly isAddInstruction: boolean; + readonly asAddInstruction: { + readonly venueId: u64; + readonly settlementType: PalletSettlementSettlementType; + readonly tradeDate: Option; + readonly valueDate: Option; + readonly legs: Vec; + } & Struct; + readonly isAddAndAffirmInstruction: boolean; + readonly asAddAndAffirmInstruction: { + readonly venueId: u64; + readonly settlementType: PalletSettlementSettlementType; + readonly tradeDate: Option; + readonly valueDate: Option; + readonly legs: Vec; + readonly portfolios: Vec; + } & Struct; + readonly isAffirmInstruction: boolean; + readonly asAffirmInstruction: { + readonly id: u64; + readonly portfolios: Vec; + readonly maxLegsCount: u32; + } & Struct; + readonly isWithdrawAffirmation: boolean; + readonly asWithdrawAffirmation: { + readonly id: u64; + readonly portfolios: Vec; + readonly maxLegsCount: u32; + } & Struct; + readonly isRejectInstruction: boolean; + readonly asRejectInstruction: { + readonly id: u64; + readonly portfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly numOfLegs: u32; + } & Struct; + readonly isAffirmWithReceipts: boolean; + readonly asAffirmWithReceipts: { + readonly id: u64; + readonly receiptDetails: Vec; + readonly portfolios: Vec; + readonly maxLegsCount: u32; + } & Struct; + readonly isClaimReceipt: boolean; + readonly asClaimReceipt: { + readonly id: u64; + readonly receiptDetails: PalletSettlementReceiptDetails; + } & Struct; + readonly isUnclaimReceipt: boolean; + readonly asUnclaimReceipt: { + readonly instructionId: u64; + readonly legId: u64; + } & Struct; + readonly isSetVenueFiltering: boolean; + readonly asSetVenueFiltering: { + readonly ticker: PolymeshPrimitivesTicker; + readonly enabled: bool; + } & Struct; + readonly isAllowVenues: boolean; + readonly asAllowVenues: { + readonly ticker: PolymeshPrimitivesTicker; + readonly venues: Vec; + } & Struct; + readonly isDisallowVenues: boolean; + readonly asDisallowVenues: { + readonly ticker: PolymeshPrimitivesTicker; + readonly venues: Vec; + } & Struct; + readonly isChangeReceiptValidity: boolean; + readonly asChangeReceiptValidity: { + readonly receiptUid: u64; + readonly validity: bool; + } & Struct; + readonly isExecuteScheduledInstruction: boolean; + readonly asExecuteScheduledInstruction: { + readonly id: u64; + readonly legsCount: u32; + } & Struct; + readonly isRescheduleInstruction: boolean; + readonly asRescheduleInstruction: { + readonly id: u64; + } & Struct; + readonly type: 'CreateVenue' | 'UpdateVenueDetails' | 'UpdateVenueType' | 'AddInstruction' | 'AddAndAffirmInstruction' | 'AffirmInstruction' | 'WithdrawAffirmation' | 'RejectInstruction' | 'AffirmWithReceipts' | 'ClaimReceipt' | 'UnclaimReceipt' | 'SetVenueFiltering' | 'AllowVenues' | 'DisallowVenues' | 'ChangeReceiptValidity' | 'ExecuteScheduledInstruction' | 'RescheduleInstruction'; + } + + /** @name PalletSettlementReceiptDetails (508) */ + export interface PalletSettlementReceiptDetails extends Struct { + readonly receiptUid: u64; + readonly legId: u64; + readonly signer: AccountId32; + readonly signature: SpRuntimeMultiSignature; + readonly metadata: Bytes; + } + + /** @name SpRuntimeMultiSignature (509) */ + export interface SpRuntimeMultiSignature extends Enum { + readonly isEd25519: boolean; + readonly asEd25519: SpCoreEd25519Signature; + readonly isSr25519: boolean; + readonly asSr25519: SpCoreSr25519Signature; + readonly isEcdsa: boolean; + readonly asEcdsa: SpCoreEcdsaSignature; + readonly type: 'Ed25519' | 'Sr25519' | 'Ecdsa'; + } + + /** @name SpCoreEcdsaSignature (510) */ + export interface SpCoreEcdsaSignature extends U8aFixed {} + + /** @name PalletStatisticsCall (511) */ + export interface PalletStatisticsCall extends Enum { + readonly isSetActiveAssetStats: boolean; + readonly asSetActiveAssetStats: { + readonly asset: PolymeshPrimitivesStatisticsAssetScope; + readonly statTypes: BTreeSetStatType; + } & Struct; + readonly isBatchUpdateAssetStats: boolean; + readonly asBatchUpdateAssetStats: { + readonly asset: PolymeshPrimitivesStatisticsAssetScope; + readonly statType: PolymeshPrimitivesStatisticsStatType; + readonly values: BTreeSetStatUpdate; + } & Struct; + readonly isSetAssetTransferCompliance: boolean; + readonly asSetAssetTransferCompliance: { + readonly asset: PolymeshPrimitivesStatisticsAssetScope; + readonly transferConditions: BTreeSetTransferCondition; + } & Struct; + readonly isSetEntitiesExempt: boolean; + readonly asSetEntitiesExempt: { + readonly isExempt: bool; + readonly exemptKey: PolymeshPrimitivesTransferComplianceTransferConditionExemptKey; + readonly entities: BTreeSetIdentityId; + } & Struct; + readonly type: 'SetActiveAssetStats' | 'BatchUpdateAssetStats' | 'SetAssetTransferCompliance' | 'SetEntitiesExempt'; + } + + /** @name BTreeSetStatType (512) */ + export interface BTreeSetStatType extends Vec {} + + /** @name BTreeSetStatUpdate (513) */ + export interface BTreeSetStatUpdate extends Vec {} + + /** @name BTreeSetTransferCondition (514) */ + export interface BTreeSetTransferCondition extends Vec {} + + /** @name BTreeSetIdentityId (515) */ + export interface BTreeSetIdentityId extends Vec {} + + /** @name PalletStoCall (516) */ + export interface PalletStoCall extends Enum { + readonly isCreateFundraiser: boolean; + readonly asCreateFundraiser: { + readonly offeringPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly raisingPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly raisingAsset: PolymeshPrimitivesTicker; + readonly tiers: Vec; + readonly venueId: u64; + readonly start: Option; + readonly end: Option; + readonly minimumInvestment: u128; + readonly fundraiserName: Bytes; + } & Struct; + readonly isInvest: boolean; + readonly asInvest: { + readonly investmentPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly fundingPortfolio: PolymeshPrimitivesIdentityIdPortfolioId; + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly id: u64; + readonly purchaseAmount: u128; + readonly maxPrice: Option; + readonly receipt: Option; + } & Struct; + readonly isFreezeFundraiser: boolean; + readonly asFreezeFundraiser: { + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly id: u64; + } & Struct; + readonly isUnfreezeFundraiser: boolean; + readonly asUnfreezeFundraiser: { + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly id: u64; + } & Struct; + readonly isModifyFundraiserWindow: boolean; + readonly asModifyFundraiserWindow: { + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly id: u64; + readonly start: u64; + readonly end: Option; + } & Struct; + readonly isStop: boolean; + readonly asStop: { + readonly offeringAsset: PolymeshPrimitivesTicker; + readonly id: u64; + } & Struct; + readonly type: 'CreateFundraiser' | 'Invest' | 'FreezeFundraiser' | 'UnfreezeFundraiser' | 'ModifyFundraiserWindow' | 'Stop'; + } + + /** @name PalletStoPriceTier (518) */ + export interface PalletStoPriceTier extends Struct { + readonly total: u128; + readonly price: u128; + } + + /** @name PalletTreasuryCall (520) */ + export interface PalletTreasuryCall extends Enum { + readonly isDisbursement: boolean; + readonly asDisbursement: { + readonly beneficiaries: Vec; + } & Struct; + readonly isReimbursement: boolean; + readonly asReimbursement: { + readonly amount: u128; + } & Struct; + readonly type: 'Disbursement' | 'Reimbursement'; + } + + /** @name PolymeshPrimitivesBeneficiary (522) */ + export interface PolymeshPrimitivesBeneficiary extends Struct { + readonly id: PolymeshPrimitivesIdentityId; + readonly amount: u128; + } + + /** @name PalletUtilityCall (523) */ + export interface PalletUtilityCall extends Enum { + readonly isBatch: boolean; + readonly asBatch: { + readonly calls: Vec; + } & Struct; + readonly isBatchAtomic: boolean; + readonly asBatchAtomic: { + readonly calls: Vec; + } & Struct; + readonly isBatchOptimistic: boolean; + readonly asBatchOptimistic: { + readonly calls: Vec; + } & Struct; + readonly isRelayTx: boolean; + readonly asRelayTx: { + readonly target: AccountId32; + readonly signature: SpRuntimeMultiSignature; + readonly call: PalletUtilityUniqueCall; + } & Struct; + readonly type: 'Batch' | 'BatchAtomic' | 'BatchOptimistic' | 'RelayTx'; + } + + /** @name PalletUtilityUniqueCall (525) */ + export interface PalletUtilityUniqueCall extends Struct { + readonly nonce: u64; + readonly call: Call; + } + + /** @name PalletBaseCall (526) */ + export type PalletBaseCall = Null; + + /** @name PalletExternalAgentsCall (527) */ + export interface PalletExternalAgentsCall extends Enum { + readonly isCreateGroup: boolean; + readonly asCreateGroup: { + readonly ticker: PolymeshPrimitivesTicker; + readonly perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + } & Struct; + readonly isSetGroupPermissions: boolean; + readonly asSetGroupPermissions: { + readonly ticker: PolymeshPrimitivesTicker; + readonly id: u32; + readonly perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + } & Struct; + readonly isRemoveAgent: boolean; + readonly asRemoveAgent: { + readonly ticker: PolymeshPrimitivesTicker; + readonly agent: PolymeshPrimitivesIdentityId; + } & Struct; + readonly isAbdicate: boolean; + readonly asAbdicate: { + readonly ticker: PolymeshPrimitivesTicker; + } & Struct; + readonly isChangeGroup: boolean; + readonly asChangeGroup: { + readonly ticker: PolymeshPrimitivesTicker; + readonly agent: PolymeshPrimitivesIdentityId; + readonly group: PolymeshPrimitivesAgentAgentGroup; + } & Struct; + readonly isAcceptBecomeAgent: boolean; + readonly asAcceptBecomeAgent: { + readonly authId: u64; + } & Struct; + readonly isCreateGroupAndAddAuth: boolean; + readonly asCreateGroupAndAddAuth: { + readonly ticker: PolymeshPrimitivesTicker; + readonly perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + readonly target: PolymeshPrimitivesSecondaryKeySignatory; + } & Struct; + readonly isCreateAndChangeCustomGroup: boolean; + readonly asCreateAndChangeCustomGroup: { + readonly ticker: PolymeshPrimitivesTicker; + readonly perms: PolymeshPrimitivesSubsetSubsetRestrictionPalletPermissions; + readonly agent: PolymeshPrimitivesIdentityId; + } & Struct; + readonly type: 'CreateGroup' | 'SetGroupPermissions' | 'RemoveAgent' | 'Abdicate' | 'ChangeGroup' | 'AcceptBecomeAgent' | 'CreateGroupAndAddAuth' | 'CreateAndChangeCustomGroup'; + } + + /** @name PalletRelayerCall (528) */ + export interface PalletRelayerCall extends Enum { + readonly isSetPayingKey: boolean; + readonly asSetPayingKey: { + readonly userKey: AccountId32; + readonly polyxLimit: u128; + } & Struct; + readonly isAcceptPayingKey: boolean; + readonly asAcceptPayingKey: { + readonly authId: u64; + } & Struct; + readonly isRemovePayingKey: boolean; + readonly asRemovePayingKey: { + readonly userKey: AccountId32; + readonly payingKey: AccountId32; + } & Struct; + readonly isUpdatePolyxLimit: boolean; + readonly asUpdatePolyxLimit: { + readonly userKey: AccountId32; + readonly polyxLimit: u128; + } & Struct; + readonly isIncreasePolyxLimit: boolean; + readonly asIncreasePolyxLimit: { + readonly userKey: AccountId32; + readonly amount: u128; + } & Struct; + readonly isDecreasePolyxLimit: boolean; + readonly asDecreasePolyxLimit: { + readonly userKey: AccountId32; + readonly amount: u128; + } & Struct; + readonly type: 'SetPayingKey' | 'AcceptPayingKey' | 'RemovePayingKey' | 'UpdatePolyxLimit' | 'IncreasePolyxLimit' | 'DecreasePolyxLimit'; + } + + /** @name PalletRewardsCall (529) */ + export interface PalletRewardsCall extends Enum { + readonly isClaimItnReward: boolean; + readonly asClaimItnReward: { + readonly rewardAddress: AccountId32; + readonly itnAddress: AccountId32; + readonly signature: SpRuntimeMultiSignature; + } & Struct; + readonly isSetItnRewardStatus: boolean; + readonly asSetItnRewardStatus: { + readonly itnAddress: AccountId32; + readonly status: PalletRewardsItnRewardStatus; + } & Struct; + readonly type: 'ClaimItnReward' | 'SetItnRewardStatus'; + } + + /** @name PalletRewardsItnRewardStatus (530) */ + export interface PalletRewardsItnRewardStatus extends Enum { + readonly isUnclaimed: boolean; + readonly asUnclaimed: u128; + readonly isClaimed: boolean; + readonly type: 'Unclaimed' | 'Claimed'; + } + + /** @name PolymeshContractsCall (531) */ + export interface PolymeshContractsCall extends Enum { + readonly isCall: boolean; + readonly asCall: { + readonly contract: AccountId32; + readonly value: u128; + readonly gasLimit: u64; + readonly storageDepositLimit: Option; + readonly data: Bytes; + } & Struct; + readonly isInstantiateWithCode: boolean; + readonly asInstantiateWithCode: { + readonly endowment: u128; + readonly gasLimit: u64; + readonly storageDepositLimit: Option; + readonly code: Bytes; + readonly data: Bytes; + readonly salt: Bytes; + readonly perms: PolymeshPrimitivesSecondaryKeyPermissions; + } & Struct; + readonly isInstantiateWithHash: boolean; + readonly asInstantiateWithHash: { + readonly endowment: u128; + readonly gasLimit: u64; + readonly storageDepositLimit: Option; + readonly codeHash: H256; + readonly data: Bytes; + readonly salt: Bytes; + readonly perms: PolymeshPrimitivesSecondaryKeyPermissions; + } & Struct; + readonly type: 'Call' | 'InstantiateWithCode' | 'InstantiateWithHash'; + } + + /** @name PalletPreimageCall (532) */ + export interface PalletPreimageCall extends Enum { + readonly isNotePreimage: boolean; + readonly asNotePreimage: { + readonly bytes: Bytes; + } & Struct; + readonly isUnnotePreimage: boolean; + readonly asUnnotePreimage: { + readonly hash_: H256; + } & Struct; + readonly isRequestPreimage: boolean; + readonly asRequestPreimage: { + readonly hash_: H256; + } & Struct; + readonly isUnrequestPreimage: boolean; + readonly asUnrequestPreimage: { + readonly hash_: H256; + } & Struct; + readonly type: 'NotePreimage' | 'UnnotePreimage' | 'RequestPreimage' | 'UnrequestPreimage'; + } + + /** @name PalletTestUtilsCall (533) */ + export interface PalletTestUtilsCall extends Enum { + readonly isRegisterDid: boolean; + readonly asRegisterDid: { + readonly uid: PolymeshPrimitivesCddIdInvestorUid; + readonly secondaryKeys: Vec; + } & Struct; + readonly isMockCddRegisterDid: boolean; + readonly asMockCddRegisterDid: { + readonly targetAccount: AccountId32; + } & Struct; + readonly isGetMyDid: boolean; + readonly isGetCddOf: boolean; + readonly asGetCddOf: { + readonly of: AccountId32; + } & Struct; + readonly type: 'RegisterDid' | 'MockCddRegisterDid' | 'GetMyDid' | 'GetCddOf'; + } + + /** @name PalletCommitteePolymeshVotes (534) */ + export interface PalletCommitteePolymeshVotes extends Struct { + readonly index: u32; + readonly ayes: Vec; + readonly nays: Vec; + readonly expiry: PolymeshCommonUtilitiesMaybeBlock; + } + + /** @name PalletCommitteeError (536) */ + export interface PalletCommitteeError extends Enum { + readonly isDuplicateVote: boolean; + readonly isNotAMember: boolean; + readonly isNoSuchProposal: boolean; + readonly isProposalExpired: boolean; + readonly isDuplicateProposal: boolean; + readonly isMismatchedVotingIndex: boolean; + readonly isInvalidProportion: boolean; + readonly isFirstVoteReject: boolean; + readonly isProposalsLimitReached: boolean; + readonly type: 'DuplicateVote' | 'NotAMember' | 'NoSuchProposal' | 'ProposalExpired' | 'DuplicateProposal' | 'MismatchedVotingIndex' | 'InvalidProportion' | 'FirstVoteReject' | 'ProposalsLimitReached'; + } + + /** @name PalletMultisigProposalDetails (546) */ + export interface PalletMultisigProposalDetails extends Struct { + readonly approvals: u64; + readonly rejections: u64; + readonly status: PalletMultisigProposalStatus; + readonly expiry: Option; + readonly autoClose: bool; + } + + /** @name PalletMultisigProposalStatus (547) */ + export interface PalletMultisigProposalStatus extends Enum { + readonly isInvalid: boolean; + readonly isActiveOrExpired: boolean; + readonly isExecutionSuccessful: boolean; + readonly isExecutionFailed: boolean; + readonly isRejected: boolean; + readonly type: 'Invalid' | 'ActiveOrExpired' | 'ExecutionSuccessful' | 'ExecutionFailed' | 'Rejected'; + } + + /** @name PalletMultisigError (549) */ + export interface PalletMultisigError extends Enum { + readonly isCddMissing: boolean; + readonly isProposalMissing: boolean; + readonly isDecodingError: boolean; + readonly isNoSigners: boolean; + readonly isRequiredSignaturesOutOfBounds: boolean; + readonly isNotASigner: boolean; + readonly isNoSuchMultisig: boolean; + readonly isNotEnoughSigners: boolean; + readonly isNonceOverflow: boolean; + readonly isAlreadyVoted: boolean; + readonly isAlreadyASigner: boolean; + readonly isFailedToChargeFee: boolean; + readonly isIdentityNotCreator: boolean; + readonly isChangeNotAllowed: boolean; + readonly isSignerAlreadyLinkedToMultisig: boolean; + readonly isSignerAlreadyLinkedToIdentity: boolean; + readonly isMultisigNotAllowedToLinkToItself: boolean; + readonly isMissingCurrentIdentity: boolean; + readonly isNotPrimaryKey: boolean; + readonly isProposalAlreadyRejected: boolean; + readonly isProposalExpired: boolean; + readonly isProposalAlreadyExecuted: boolean; + readonly isMultisigMissingIdentity: boolean; + readonly isFailedToSchedule: boolean; + readonly isTooManySigners: boolean; + readonly type: 'CddMissing' | 'ProposalMissing' | 'DecodingError' | 'NoSigners' | 'RequiredSignaturesOutOfBounds' | 'NotASigner' | 'NoSuchMultisig' | 'NotEnoughSigners' | 'NonceOverflow' | 'AlreadyVoted' | 'AlreadyASigner' | 'FailedToChargeFee' | 'IdentityNotCreator' | 'ChangeNotAllowed' | 'SignerAlreadyLinkedToMultisig' | 'SignerAlreadyLinkedToIdentity' | 'MultisigNotAllowedToLinkToItself' | 'MissingCurrentIdentity' | 'NotPrimaryKey' | 'ProposalAlreadyRejected' | 'ProposalExpired' | 'ProposalAlreadyExecuted' | 'MultisigMissingIdentity' | 'FailedToSchedule' | 'TooManySigners'; + } + + /** @name PalletBridgeBridgeTxDetail (551) */ + export interface PalletBridgeBridgeTxDetail extends Struct { + readonly amount: u128; + readonly status: PalletBridgeBridgeTxStatus; + readonly executionBlock: u32; + readonly txHash: H256; + } + + /** @name PalletBridgeBridgeTxStatus (552) */ + export interface PalletBridgeBridgeTxStatus extends Enum { + readonly isAbsent: boolean; + readonly isPending: boolean; + readonly asPending: u8; + readonly isFrozen: boolean; + readonly isTimelocked: boolean; + readonly isHandled: boolean; + readonly type: 'Absent' | 'Pending' | 'Frozen' | 'Timelocked' | 'Handled'; + } + + /** @name PalletBridgeError (555) */ + export interface PalletBridgeError extends Enum { + readonly isControllerNotSet: boolean; + readonly isBadCaller: boolean; + readonly isBadAdmin: boolean; + readonly isNoValidCdd: boolean; + readonly isProposalAlreadyHandled: boolean; + readonly isUnauthorized: boolean; + readonly isFrozen: boolean; + readonly isNotFrozen: boolean; + readonly isFrozenTx: boolean; + readonly isBridgeLimitReached: boolean; + readonly isOverflow: boolean; + readonly isDivisionByZero: boolean; + readonly isTimelockedTx: boolean; + readonly type: 'ControllerNotSet' | 'BadCaller' | 'BadAdmin' | 'NoValidCdd' | 'ProposalAlreadyHandled' | 'Unauthorized' | 'Frozen' | 'NotFrozen' | 'FrozenTx' | 'BridgeLimitReached' | 'Overflow' | 'DivisionByZero' | 'TimelockedTx'; + } + + /** @name PalletStakingStakingLedger (556) */ + export interface PalletStakingStakingLedger extends Struct { + readonly stash: AccountId32; + readonly total: Compact; + readonly active: Compact; + readonly unlocking: Vec; + readonly claimedRewards: Vec; + } + + /** @name PalletStakingUnlockChunk (558) */ + export interface PalletStakingUnlockChunk extends Struct { + readonly value: Compact; + readonly era: Compact; + } + + /** @name PalletStakingNominations (559) */ + export interface PalletStakingNominations extends Struct { + readonly targets: Vec; + readonly submittedIn: u32; + readonly suppressed: bool; + } + + /** @name PalletStakingActiveEraInfo (560) */ + export interface PalletStakingActiveEraInfo extends Struct { + readonly index: u32; + readonly start: Option; + } + + /** @name PalletStakingEraRewardPoints (562) */ + export interface PalletStakingEraRewardPoints extends Struct { + readonly total: u32; + readonly individual: BTreeMap; + } + + /** @name PalletStakingForcing (565) */ + export interface PalletStakingForcing extends Enum { + readonly isNotForcing: boolean; + readonly isForceNew: boolean; + readonly isForceNone: boolean; + readonly isForceAlways: boolean; + readonly type: 'NotForcing' | 'ForceNew' | 'ForceNone' | 'ForceAlways'; + } + + /** @name PalletStakingUnappliedSlash (567) */ + export interface PalletStakingUnappliedSlash extends Struct { + readonly validator: AccountId32; + readonly own: u128; + readonly others: Vec>; + readonly reporters: Vec; + readonly payout: u128; + } + + /** @name PalletStakingSlashingSlashingSpans (571) */ + export interface PalletStakingSlashingSlashingSpans extends Struct { + readonly spanIndex: u32; + readonly lastStart: u32; + readonly lastNonzeroSlash: u32; + readonly prior: Vec; + } + + /** @name PalletStakingSlashingSpanRecord (572) */ + export interface PalletStakingSlashingSpanRecord extends Struct { + readonly slashed: u128; + readonly paidOut: u128; + } + + /** @name PalletStakingElectionResult (573) */ + export interface PalletStakingElectionResult extends Struct { + readonly electedStashes: Vec; + readonly exposures: Vec>; + readonly compute: PalletStakingElectionCompute; + } + + /** @name PalletStakingElectionStatus (574) */ + export interface PalletStakingElectionStatus extends Enum { + readonly isClosed: boolean; + readonly isOpen: boolean; + readonly asOpen: u32; + readonly type: 'Closed' | 'Open'; + } + + /** @name PalletStakingPermissionedIdentityPrefs (575) */ + export interface PalletStakingPermissionedIdentityPrefs extends Struct { + readonly intendedCount: u32; + readonly runningCount: u32; + } + + /** @name PalletStakingReleases (576) */ + export interface PalletStakingReleases extends Enum { + readonly isV100Ancient: boolean; + readonly isV200: boolean; + readonly isV300: boolean; + readonly isV400: boolean; + readonly isV500: boolean; + readonly isV600: boolean; + readonly isV601: boolean; + readonly isV700: boolean; + readonly type: 'V100Ancient' | 'V200' | 'V300' | 'V400' | 'V500' | 'V600' | 'V601' | 'V700'; + } + + /** @name PalletStakingError (577) */ + export interface PalletStakingError extends Enum { + readonly isNotController: boolean; + readonly isNotStash: boolean; + readonly isAlreadyBonded: boolean; + readonly isAlreadyPaired: boolean; + readonly isEmptyTargets: boolean; + readonly isInvalidSlashIndex: boolean; + readonly isInsufficientValue: boolean; + readonly isNoMoreChunks: boolean; + readonly isNoUnlockChunk: boolean; + readonly isFundedTarget: boolean; + readonly isInvalidEraToReward: boolean; + readonly isNotSortedAndUnique: boolean; + readonly isAlreadyClaimed: boolean; + readonly isOffchainElectionEarlySubmission: boolean; + readonly isOffchainElectionWeakSubmission: boolean; + readonly isSnapshotUnavailable: boolean; + readonly isOffchainElectionBogusWinnerCount: boolean; + readonly isOffchainElectionBogusWinner: boolean; + readonly isOffchainElectionBogusCompact: boolean; + readonly isOffchainElectionBogusNominator: boolean; + readonly isOffchainElectionBogusNomination: boolean; + readonly isOffchainElectionSlashedNomination: boolean; + readonly isOffchainElectionBogusSelfVote: boolean; + readonly isOffchainElectionBogusEdge: boolean; + readonly isOffchainElectionBogusScore: boolean; + readonly isOffchainElectionBogusElectionSize: boolean; + readonly isCallNotAllowed: boolean; + readonly isIncorrectSlashingSpans: boolean; + readonly isAlreadyExists: boolean; + readonly isNotExists: boolean; + readonly isNoChange: boolean; + readonly isInvalidValidatorIdentity: boolean; + readonly isInvalidValidatorCommission: boolean; + readonly isStashIdentityDoesNotExist: boolean; + readonly isStashIdentityNotPermissioned: boolean; + readonly isStashIdentityNotCDDed: boolean; + readonly isHitIntendedValidatorCount: boolean; + readonly isIntendedCountIsExceedingConsensusLimit: boolean; + readonly isBondTooSmall: boolean; + readonly isBadState: boolean; + readonly isTooManyTargets: boolean; + readonly isBadTarget: boolean; + readonly type: 'NotController' | 'NotStash' | 'AlreadyBonded' | 'AlreadyPaired' | 'EmptyTargets' | 'InvalidSlashIndex' | 'InsufficientValue' | 'NoMoreChunks' | 'NoUnlockChunk' | 'FundedTarget' | 'InvalidEraToReward' | 'NotSortedAndUnique' | 'AlreadyClaimed' | 'OffchainElectionEarlySubmission' | 'OffchainElectionWeakSubmission' | 'SnapshotUnavailable' | 'OffchainElectionBogusWinnerCount' | 'OffchainElectionBogusWinner' | 'OffchainElectionBogusCompact' | 'OffchainElectionBogusNominator' | 'OffchainElectionBogusNomination' | 'OffchainElectionSlashedNomination' | 'OffchainElectionBogusSelfVote' | 'OffchainElectionBogusEdge' | 'OffchainElectionBogusScore' | 'OffchainElectionBogusElectionSize' | 'CallNotAllowed' | 'IncorrectSlashingSpans' | 'AlreadyExists' | 'NotExists' | 'NoChange' | 'InvalidValidatorIdentity' | 'InvalidValidatorCommission' | 'StashIdentityDoesNotExist' | 'StashIdentityNotPermissioned' | 'StashIdentityNotCDDed' | 'HitIntendedValidatorCount' | 'IntendedCountIsExceedingConsensusLimit' | 'BondTooSmall' | 'BadState' | 'TooManyTargets' | 'BadTarget'; + } + + /** @name SpStakingOffenceOffenceDetails (578) */ + export interface SpStakingOffenceOffenceDetails extends Struct { + readonly offender: ITuple<[AccountId32, PalletStakingExposure]>; + readonly reporters: Vec; + } + + /** @name SpCoreCryptoKeyTypeId (583) */ + export interface SpCoreCryptoKeyTypeId extends U8aFixed {} + + /** @name PalletSessionError (584) */ + export interface PalletSessionError extends Enum { + readonly isInvalidProof: boolean; + readonly isNoAssociatedValidatorId: boolean; + readonly isDuplicatedKey: boolean; + readonly isNoKeys: boolean; + readonly isNoAccount: boolean; + readonly type: 'InvalidProof' | 'NoAssociatedValidatorId' | 'DuplicatedKey' | 'NoKeys' | 'NoAccount'; + } + + /** @name PalletGrandpaStoredState (585) */ + export interface PalletGrandpaStoredState extends Enum { + readonly isLive: boolean; + readonly isPendingPause: boolean; + readonly asPendingPause: { + readonly scheduledAt: u32; + readonly delay: u32; + } & Struct; + readonly isPaused: boolean; + readonly isPendingResume: boolean; + readonly asPendingResume: { + readonly scheduledAt: u32; + readonly delay: u32; + } & Struct; + readonly type: 'Live' | 'PendingPause' | 'Paused' | 'PendingResume'; + } + + /** @name PalletGrandpaStoredPendingChange (586) */ + export interface PalletGrandpaStoredPendingChange extends Struct { + readonly scheduledAt: u32; + readonly delay: u32; + readonly nextAuthorities: Vec>; + readonly forced: Option; + } + + /** @name PalletGrandpaError (588) */ + export interface PalletGrandpaError extends Enum { + readonly isPauseFailed: boolean; + readonly isResumeFailed: boolean; + readonly isChangePending: boolean; + readonly isTooSoon: boolean; + readonly isInvalidKeyOwnershipProof: boolean; + readonly isInvalidEquivocationProof: boolean; + readonly isDuplicateOffenceReport: boolean; + readonly type: 'PauseFailed' | 'ResumeFailed' | 'ChangePending' | 'TooSoon' | 'InvalidKeyOwnershipProof' | 'InvalidEquivocationProof' | 'DuplicateOffenceReport'; + } + + /** @name PalletImOnlineBoundedOpaqueNetworkState (592) */ + export interface PalletImOnlineBoundedOpaqueNetworkState extends Struct { + readonly peerId: Bytes; + readonly externalAddresses: Vec; + } + + /** @name PalletImOnlineError (596) */ + export interface PalletImOnlineError extends Enum { + readonly isInvalidKey: boolean; + readonly isDuplicatedHeartbeat: boolean; + readonly type: 'InvalidKey' | 'DuplicatedHeartbeat'; + } + + /** @name PalletSudoError (598) */ + export interface PalletSudoError extends Enum { + readonly isRequireSudo: boolean; + readonly type: 'RequireSudo'; + } + + /** @name PalletAssetTickerRegistration (599) */ + export interface PalletAssetTickerRegistration extends Struct { + readonly owner: PolymeshPrimitivesIdentityId; + readonly expiry: Option; + } + + /** @name PalletAssetSecurityToken (600) */ + export interface PalletAssetSecurityToken extends Struct { + readonly totalSupply: u128; + readonly ownerDid: PolymeshPrimitivesIdentityId; + readonly divisible: bool; + readonly assetType: PolymeshPrimitivesAssetAssetType; + } + + /** @name PalletAssetAssetOwnershipRelation (604) */ + export interface PalletAssetAssetOwnershipRelation extends Enum { + readonly isNotOwned: boolean; + readonly isTickerOwned: boolean; + readonly isAssetOwned: boolean; + readonly type: 'NotOwned' | 'TickerOwned' | 'AssetOwned'; + } + + /** @name PalletAssetClassicTickerRegistration (606) */ + export interface PalletAssetClassicTickerRegistration extends Struct { + readonly ethOwner: PolymeshPrimitivesEthereumEthereumAddress; + readonly isCreated: bool; + } + + /** @name PalletAssetError (612) */ + export interface PalletAssetError extends Enum { + readonly isUnauthorized: boolean; + readonly isAlreadyArchived: boolean; + readonly isAlreadyUnArchived: boolean; + readonly isExtensionAlreadyPresent: boolean; + readonly isAssetAlreadyCreated: boolean; + readonly isTickerTooLong: boolean; + readonly isTickerNotAscii: boolean; + readonly isTickerAlreadyRegistered: boolean; + readonly isTotalSupplyAboveLimit: boolean; + readonly isNoSuchAsset: boolean; + readonly isAlreadyFrozen: boolean; + readonly isNotAnOwner: boolean; + readonly isBalanceOverflow: boolean; + readonly isTotalSupplyOverflow: boolean; + readonly isInvalidGranularity: boolean; + readonly isNotFrozen: boolean; + readonly isInvalidTransfer: boolean; + readonly isInsufficientBalance: boolean; + readonly isAssetAlreadyDivisible: boolean; + readonly isMaximumTMExtensionLimitReached: boolean; + readonly isIncompatibleExtensionVersion: boolean; + readonly isInvalidEthereumSignature: boolean; + readonly isNoSuchClassicTicker: boolean; + readonly isTickerRegistrationExpired: boolean; + readonly isSenderSameAsReceiver: boolean; + readonly isNoSuchDoc: boolean; + readonly isMaxLengthOfAssetNameExceeded: boolean; + readonly isFundingRoundNameMaxLengthExceeded: boolean; + readonly isInvalidAssetIdentifier: boolean; + readonly isInvestorUniquenessClaimNotAllowed: boolean; + readonly isInvalidCustomAssetTypeId: boolean; + readonly isAssetMetadataNameMaxLengthExceeded: boolean; + readonly isAssetMetadataValueMaxLengthExceeded: boolean; + readonly isAssetMetadataTypeDefMaxLengthExceeded: boolean; + readonly isAssetMetadataKeyIsMissing: boolean; + readonly isAssetMetadataValueIsLocked: boolean; + readonly isAssetMetadataLocalKeyAlreadyExists: boolean; + readonly isAssetMetadataGlobalKeyAlreadyExists: boolean; + readonly type: 'Unauthorized' | 'AlreadyArchived' | 'AlreadyUnArchived' | 'ExtensionAlreadyPresent' | 'AssetAlreadyCreated' | 'TickerTooLong' | 'TickerNotAscii' | 'TickerAlreadyRegistered' | 'TotalSupplyAboveLimit' | 'NoSuchAsset' | 'AlreadyFrozen' | 'NotAnOwner' | 'BalanceOverflow' | 'TotalSupplyOverflow' | 'InvalidGranularity' | 'NotFrozen' | 'InvalidTransfer' | 'InsufficientBalance' | 'AssetAlreadyDivisible' | 'MaximumTMExtensionLimitReached' | 'IncompatibleExtensionVersion' | 'InvalidEthereumSignature' | 'NoSuchClassicTicker' | 'TickerRegistrationExpired' | 'SenderSameAsReceiver' | 'NoSuchDoc' | 'MaxLengthOfAssetNameExceeded' | 'FundingRoundNameMaxLengthExceeded' | 'InvalidAssetIdentifier' | 'InvestorUniquenessClaimNotAllowed' | 'InvalidCustomAssetTypeId' | 'AssetMetadataNameMaxLengthExceeded' | 'AssetMetadataValueMaxLengthExceeded' | 'AssetMetadataTypeDefMaxLengthExceeded' | 'AssetMetadataKeyIsMissing' | 'AssetMetadataValueIsLocked' | 'AssetMetadataLocalKeyAlreadyExists' | 'AssetMetadataGlobalKeyAlreadyExists'; + } + + /** @name PalletCorporateActionsDistributionError (615) */ + export interface PalletCorporateActionsDistributionError extends Enum { + readonly isCaNotBenefit: boolean; + readonly isAlreadyExists: boolean; + readonly isExpiryBeforePayment: boolean; + readonly isHolderAlreadyPaid: boolean; + readonly isNoSuchDistribution: boolean; + readonly isCannotClaimBeforeStart: boolean; + readonly isCannotClaimAfterExpiry: boolean; + readonly isBalancePerShareProductOverflowed: boolean; + readonly isNotDistributionCreator: boolean; + readonly isAlreadyReclaimed: boolean; + readonly isNotExpired: boolean; + readonly isDistributionStarted: boolean; + readonly isInsufficientRemainingAmount: boolean; + readonly isDistributionAmountIsZero: boolean; + readonly isDistributionPerShareIsZero: boolean; + readonly type: 'CaNotBenefit' | 'AlreadyExists' | 'ExpiryBeforePayment' | 'HolderAlreadyPaid' | 'NoSuchDistribution' | 'CannotClaimBeforeStart' | 'CannotClaimAfterExpiry' | 'BalancePerShareProductOverflowed' | 'NotDistributionCreator' | 'AlreadyReclaimed' | 'NotExpired' | 'DistributionStarted' | 'InsufficientRemainingAmount' | 'DistributionAmountIsZero' | 'DistributionPerShareIsZero'; + } + + /** @name PalletAssetCheckpointError (622) */ + export interface PalletAssetCheckpointError extends Enum { + readonly isNoSuchSchedule: boolean; + readonly isScheduleNotRemovable: boolean; + readonly isFailedToComputeNextCheckpoint: boolean; + readonly isScheduleDurationTooShort: boolean; + readonly isSchedulesTooComplex: boolean; + readonly type: 'NoSuchSchedule' | 'ScheduleNotRemovable' | 'FailedToComputeNextCheckpoint' | 'ScheduleDurationTooShort' | 'SchedulesTooComplex'; + } + + /** @name PolymeshPrimitivesComplianceManagerAssetCompliance (623) */ + export interface PolymeshPrimitivesComplianceManagerAssetCompliance extends Struct { + readonly paused: bool; + readonly requirements: Vec; + } + + /** @name PalletComplianceManagerError (625) */ + export interface PalletComplianceManagerError extends Enum { + readonly isUnauthorized: boolean; + readonly isDidNotExist: boolean; + readonly isInvalidComplianceRequirementId: boolean; + readonly isIncorrectOperationOnTrustedIssuer: boolean; + readonly isDuplicateComplianceRequirements: boolean; + readonly isComplianceRequirementTooComplex: boolean; + readonly type: 'Unauthorized' | 'DidNotExist' | 'InvalidComplianceRequirementId' | 'IncorrectOperationOnTrustedIssuer' | 'DuplicateComplianceRequirements' | 'ComplianceRequirementTooComplex'; + } + + /** @name PalletCorporateActionsError (628) */ + export interface PalletCorporateActionsError extends Enum { + readonly isAuthNotCAATransfer: boolean; + readonly isDetailsTooLong: boolean; + readonly isDuplicateDidTax: boolean; + readonly isTooManyDidTaxes: boolean; + readonly isTooManyTargetIds: boolean; + readonly isNoSuchCheckpointId: boolean; + readonly isNoSuchCA: boolean; + readonly isNoRecordDate: boolean; + readonly isRecordDateAfterStart: boolean; + readonly isDeclDateAfterRecordDate: boolean; + readonly isDeclDateInFuture: boolean; + readonly isNotTargetedByCA: boolean; + readonly type: 'AuthNotCAATransfer' | 'DetailsTooLong' | 'DuplicateDidTax' | 'TooManyDidTaxes' | 'TooManyTargetIds' | 'NoSuchCheckpointId' | 'NoSuchCA' | 'NoRecordDate' | 'RecordDateAfterStart' | 'DeclDateAfterRecordDate' | 'DeclDateInFuture' | 'NotTargetedByCA'; + } + + /** @name PalletCorporateActionsBallotError (630) */ + export interface PalletCorporateActionsBallotError extends Enum { + readonly isCaNotNotice: boolean; + readonly isAlreadyExists: boolean; + readonly isNoSuchBallot: boolean; + readonly isStartAfterEnd: boolean; + readonly isNowAfterEnd: boolean; + readonly isNumberOfChoicesOverflow: boolean; + readonly isVotingAlreadyStarted: boolean; + readonly isVotingNotStarted: boolean; + readonly isVotingAlreadyEnded: boolean; + readonly isWrongVoteCount: boolean; + readonly isInsufficientVotes: boolean; + readonly isNoSuchRCVFallback: boolean; + readonly isRcvSelfCycle: boolean; + readonly isRcvNotAllowed: boolean; + readonly type: 'CaNotNotice' | 'AlreadyExists' | 'NoSuchBallot' | 'StartAfterEnd' | 'NowAfterEnd' | 'NumberOfChoicesOverflow' | 'VotingAlreadyStarted' | 'VotingNotStarted' | 'VotingAlreadyEnded' | 'WrongVoteCount' | 'InsufficientVotes' | 'NoSuchRCVFallback' | 'RcvSelfCycle' | 'RcvNotAllowed'; + } + + /** @name PalletPermissionsError (631) */ + export interface PalletPermissionsError extends Enum { + readonly isUnauthorizedCaller: boolean; + readonly type: 'UnauthorizedCaller'; + } + + /** @name PalletPipsPipsMetadata (632) */ + export interface PalletPipsPipsMetadata extends Struct { + readonly id: u32; + readonly url: Option; + readonly description: Option; + readonly createdAt: u32; + readonly transactionVersion: u32; + readonly expiry: PolymeshCommonUtilitiesMaybeBlock; + } + + /** @name PalletPipsDepositInfo (634) */ + export interface PalletPipsDepositInfo extends Struct { + readonly owner: AccountId32; + readonly amount: u128; + } + + /** @name PalletPipsPip (635) */ + export interface PalletPipsPip extends Struct { + readonly id: u32; + readonly proposal: Call; + readonly state: PalletPipsProposalState; + readonly proposer: PalletPipsProposer; + } + + /** @name PalletPipsVotingResult (636) */ + export interface PalletPipsVotingResult extends Struct { + readonly ayesCount: u32; + readonly ayesStake: u128; + readonly naysCount: u32; + readonly naysStake: u128; + } + + /** @name PalletPipsVote (637) */ + export interface PalletPipsVote extends ITuple<[bool, u128]> {} + + /** @name PalletPipsSnapshotMetadata (638) */ + export interface PalletPipsSnapshotMetadata extends Struct { + readonly createdAt: u32; + readonly madeBy: AccountId32; + readonly id: u32; + } + + /** @name PalletPipsError (640) */ + export interface PalletPipsError extends Enum { + readonly isRescheduleNotByReleaseCoordinator: boolean; + readonly isNotFromCommunity: boolean; + readonly isNotByCommittee: boolean; + readonly isTooManyActivePips: boolean; + readonly isIncorrectDeposit: boolean; + readonly isInsufficientDeposit: boolean; + readonly isNoSuchProposal: boolean; + readonly isNotACommitteeMember: boolean; + readonly isInvalidFutureBlockNumber: boolean; + readonly isNumberOfVotesExceeded: boolean; + readonly isStakeAmountOfVotesExceeded: boolean; + readonly isMissingCurrentIdentity: boolean; + readonly isIncorrectProposalState: boolean; + readonly isCannotSkipPip: boolean; + readonly isSnapshotResultTooLarge: boolean; + readonly isSnapshotIdMismatch: boolean; + readonly isScheduledProposalDoesntExist: boolean; + readonly isProposalNotInScheduledState: boolean; + readonly type: 'RescheduleNotByReleaseCoordinator' | 'NotFromCommunity' | 'NotByCommittee' | 'TooManyActivePips' | 'IncorrectDeposit' | 'InsufficientDeposit' | 'NoSuchProposal' | 'NotACommitteeMember' | 'InvalidFutureBlockNumber' | 'NumberOfVotesExceeded' | 'StakeAmountOfVotesExceeded' | 'MissingCurrentIdentity' | 'IncorrectProposalState' | 'CannotSkipPip' | 'SnapshotResultTooLarge' | 'SnapshotIdMismatch' | 'ScheduledProposalDoesntExist' | 'ProposalNotInScheduledState'; + } + + /** @name PalletPortfolioError (646) */ + export interface PalletPortfolioError extends Enum { + readonly isPortfolioDoesNotExist: boolean; + readonly isInsufficientPortfolioBalance: boolean; + readonly isDestinationIsSamePortfolio: boolean; + readonly isPortfolioNameAlreadyInUse: boolean; + readonly isSecondaryKeyNotAuthorizedForPortfolio: boolean; + readonly isUnauthorizedCustodian: boolean; + readonly isInsufficientTokensLocked: boolean; + readonly isPortfolioNotEmpty: boolean; + readonly isDifferentIdentityPortfolios: boolean; + readonly type: 'PortfolioDoesNotExist' | 'InsufficientPortfolioBalance' | 'DestinationIsSamePortfolio' | 'PortfolioNameAlreadyInUse' | 'SecondaryKeyNotAuthorizedForPortfolio' | 'UnauthorizedCustodian' | 'InsufficientTokensLocked' | 'PortfolioNotEmpty' | 'DifferentIdentityPortfolios'; + } + + /** @name PalletProtocolFeeError (647) */ + export interface PalletProtocolFeeError extends Enum { + readonly isInsufficientAccountBalance: boolean; + readonly isUnHandledImbalances: boolean; + readonly isInsufficientSubsidyBalance: boolean; + readonly type: 'InsufficientAccountBalance' | 'UnHandledImbalances' | 'InsufficientSubsidyBalance'; + } + + /** @name PalletSchedulerScheduledV3 (650) */ + export interface PalletSchedulerScheduledV3 extends Struct { + readonly maybeId: Option; + readonly priority: u8; + readonly call: FrameSupportScheduleMaybeHashed; + readonly maybePeriodic: Option>; + readonly origin: PolymeshRuntimeDevelopRuntimeOriginCaller; + } + + /** @name PolymeshRuntimeDevelopRuntimeOriginCaller (651) */ + export interface PolymeshRuntimeDevelopRuntimeOriginCaller extends Enum { + readonly isSystem: boolean; + readonly asSystem: FrameSupportDispatchRawOrigin; + readonly isVoid: boolean; + readonly isPolymeshCommittee: boolean; + readonly asPolymeshCommittee: PalletCommitteeRawOriginInstance1; + readonly isTechnicalCommittee: boolean; + readonly asTechnicalCommittee: PalletCommitteeRawOriginInstance3; + readonly isUpgradeCommittee: boolean; + readonly asUpgradeCommittee: PalletCommitteeRawOriginInstance4; + readonly type: 'System' | 'Void' | 'PolymeshCommittee' | 'TechnicalCommittee' | 'UpgradeCommittee'; + } + + /** @name FrameSupportDispatchRawOrigin (652) */ + export interface FrameSupportDispatchRawOrigin extends Enum { + readonly isRoot: boolean; + readonly isSigned: boolean; + readonly asSigned: AccountId32; + readonly isNone: boolean; + readonly type: 'Root' | 'Signed' | 'None'; + } + + /** @name PalletCommitteeRawOriginInstance1 (653) */ + export interface PalletCommitteeRawOriginInstance1 extends Enum { + readonly isEndorsed: boolean; + readonly type: 'Endorsed'; + } + + /** @name PalletCommitteeRawOriginInstance3 (654) */ + export interface PalletCommitteeRawOriginInstance3 extends Enum { + readonly isEndorsed: boolean; + readonly type: 'Endorsed'; + } + + /** @name PalletCommitteeRawOriginInstance4 (655) */ + export interface PalletCommitteeRawOriginInstance4 extends Enum { + readonly isEndorsed: boolean; + readonly type: 'Endorsed'; + } + + /** @name SpCoreVoid (656) */ + export type SpCoreVoid = Null; + + /** @name PalletSchedulerError (657) */ + export interface PalletSchedulerError extends Enum { + readonly isFailedToSchedule: boolean; + readonly isNotFound: boolean; + readonly isTargetBlockNumberInPast: boolean; + readonly isRescheduleNoChange: boolean; + readonly type: 'FailedToSchedule' | 'NotFound' | 'TargetBlockNumberInPast' | 'RescheduleNoChange'; + } + + /** @name PalletSettlementVenue (658) */ + export interface PalletSettlementVenue extends Struct { + readonly creator: PolymeshPrimitivesIdentityId; + readonly venueType: PalletSettlementVenueType; + } + + /** @name PalletSettlementInstruction (661) */ + export interface PalletSettlementInstruction extends Struct { + readonly instructionId: u64; + readonly venueId: u64; + readonly status: PalletSettlementInstructionStatus; + readonly settlementType: PalletSettlementSettlementType; + readonly createdAt: Option; + readonly tradeDate: Option; + readonly valueDate: Option; + } + + /** @name PalletSettlementInstructionStatus (662) */ + export interface PalletSettlementInstructionStatus extends Enum { + readonly isUnknown: boolean; + readonly isPending: boolean; + readonly isFailed: boolean; + readonly type: 'Unknown' | 'Pending' | 'Failed'; + } + + /** @name PalletSettlementLegStatus (664) */ + export interface PalletSettlementLegStatus extends Enum { + readonly isPendingTokenLock: boolean; + readonly isExecutionPending: boolean; + readonly isExecutionToBeSkipped: boolean; + readonly asExecutionToBeSkipped: ITuple<[AccountId32, u64]>; + readonly type: 'PendingTokenLock' | 'ExecutionPending' | 'ExecutionToBeSkipped'; + } + + /** @name PalletSettlementAffirmationStatus (666) */ + export interface PalletSettlementAffirmationStatus extends Enum { + readonly isUnknown: boolean; + readonly isPending: boolean; + readonly isAffirmed: boolean; + readonly type: 'Unknown' | 'Pending' | 'Affirmed'; + } + + /** @name PalletSettlementError (670) */ + export interface PalletSettlementError extends Enum { + readonly isInvalidVenue: boolean; + readonly isUnauthorized: boolean; + readonly isNoPendingAffirm: boolean; + readonly isInstructionNotAffirmed: boolean; + readonly isInstructionNotPending: boolean; + readonly isInstructionNotFailed: boolean; + readonly isLegNotPending: boolean; + readonly isUnauthorizedSigner: boolean; + readonly isReceiptAlreadyClaimed: boolean; + readonly isReceiptNotClaimed: boolean; + readonly isUnauthorizedVenue: boolean; + readonly isFailedToLockTokens: boolean; + readonly isInstructionFailed: boolean; + readonly isInstructionDatesInvalid: boolean; + readonly isInstructionSettleBlockPassed: boolean; + readonly isInvalidSignature: boolean; + readonly isSameSenderReceiver: boolean; + readonly isPortfolioMismatch: boolean; + readonly isSettleOnPastBlock: boolean; + readonly isNoPortfolioProvided: boolean; + readonly isUnexpectedAffirmationStatus: boolean; + readonly isFailedToSchedule: boolean; + readonly isLegCountTooSmall: boolean; + readonly isUnknownInstruction: boolean; + readonly isInstructionHasTooManyLegs: boolean; + readonly type: 'InvalidVenue' | 'Unauthorized' | 'NoPendingAffirm' | 'InstructionNotAffirmed' | 'InstructionNotPending' | 'InstructionNotFailed' | 'LegNotPending' | 'UnauthorizedSigner' | 'ReceiptAlreadyClaimed' | 'ReceiptNotClaimed' | 'UnauthorizedVenue' | 'FailedToLockTokens' | 'InstructionFailed' | 'InstructionDatesInvalid' | 'InstructionSettleBlockPassed' | 'InvalidSignature' | 'SameSenderReceiver' | 'PortfolioMismatch' | 'SettleOnPastBlock' | 'NoPortfolioProvided' | 'UnexpectedAffirmationStatus' | 'FailedToSchedule' | 'LegCountTooSmall' | 'UnknownInstruction' | 'InstructionHasTooManyLegs'; + } + + /** @name PolymeshPrimitivesStatisticsStat1stKey (672) */ + export interface PolymeshPrimitivesStatisticsStat1stKey extends Struct { + readonly asset: PolymeshPrimitivesStatisticsAssetScope; + readonly statType: PolymeshPrimitivesStatisticsStatType; + } + + /** @name PolymeshPrimitivesTransferComplianceAssetTransferCompliance (673) */ + export interface PolymeshPrimitivesTransferComplianceAssetTransferCompliance extends Struct { + readonly paused: bool; + readonly requirements: BTreeSetTransferCondition; + } + + /** @name PalletStatisticsError (676) */ + export interface PalletStatisticsError extends Enum { + readonly isInvalidTransfer: boolean; + readonly isStatTypeMissing: boolean; + readonly isStatTypeNeededByTransferCondition: boolean; + readonly isCannotRemoveStatTypeInUse: boolean; + readonly isStatTypeLimitReached: boolean; + readonly isTransferConditionLimitReached: boolean; + readonly type: 'InvalidTransfer' | 'StatTypeMissing' | 'StatTypeNeededByTransferCondition' | 'CannotRemoveStatTypeInUse' | 'StatTypeLimitReached' | 'TransferConditionLimitReached'; + } + + /** @name PalletStoError (678) */ + export interface PalletStoError extends Enum { + readonly isUnauthorized: boolean; + readonly isOverflow: boolean; + readonly isInsufficientTokensRemaining: boolean; + readonly isFundraiserNotFound: boolean; + readonly isFundraiserNotLive: boolean; + readonly isFundraiserClosed: boolean; + readonly isFundraiserExpired: boolean; + readonly isInvalidVenue: boolean; + readonly isInvalidPriceTiers: boolean; + readonly isInvalidOfferingWindow: boolean; + readonly isMaxPriceExceeded: boolean; + readonly isInvestmentAmountTooLow: boolean; + readonly type: 'Unauthorized' | 'Overflow' | 'InsufficientTokensRemaining' | 'FundraiserNotFound' | 'FundraiserNotLive' | 'FundraiserClosed' | 'FundraiserExpired' | 'InvalidVenue' | 'InvalidPriceTiers' | 'InvalidOfferingWindow' | 'MaxPriceExceeded' | 'InvestmentAmountTooLow'; + } + + /** @name PalletTreasuryError (679) */ + export interface PalletTreasuryError extends Enum { + readonly isInsufficientBalance: boolean; + readonly isInvalidIdentity: boolean; + readonly type: 'InsufficientBalance' | 'InvalidIdentity'; + } + + /** @name PalletUtilityError (680) */ + export interface PalletUtilityError extends Enum { + readonly isInvalidSignature: boolean; + readonly isTargetCddMissing: boolean; + readonly isInvalidNonce: boolean; + readonly type: 'InvalidSignature' | 'TargetCddMissing' | 'InvalidNonce'; + } + + /** @name PalletBaseError (681) */ + export interface PalletBaseError extends Enum { + readonly isTooLong: boolean; + readonly isCounterOverflow: boolean; + readonly type: 'TooLong' | 'CounterOverflow'; + } + + /** @name PalletExternalAgentsError (683) */ + export interface PalletExternalAgentsError extends Enum { + readonly isNoSuchAG: boolean; + readonly isUnauthorizedAgent: boolean; + readonly isAlreadyAnAgent: boolean; + readonly isNotAnAgent: boolean; + readonly isRemovingLastFullAgent: boolean; + readonly isSecondaryKeyNotAuthorizedForAsset: boolean; + readonly type: 'NoSuchAG' | 'UnauthorizedAgent' | 'AlreadyAnAgent' | 'NotAnAgent' | 'RemovingLastFullAgent' | 'SecondaryKeyNotAuthorizedForAsset'; + } + + /** @name PalletRelayerSubsidy (684) */ + export interface PalletRelayerSubsidy extends Struct { + readonly payingKey: AccountId32; + readonly remaining: u128; + } + + /** @name PalletRelayerError (685) */ + export interface PalletRelayerError extends Enum { + readonly isUserKeyCddMissing: boolean; + readonly isPayingKeyCddMissing: boolean; + readonly isNoPayingKey: boolean; + readonly isNotPayingKey: boolean; + readonly isNotAuthorizedForPayingKey: boolean; + readonly isNotAuthorizedForUserKey: boolean; + readonly isOverflow: boolean; + readonly type: 'UserKeyCddMissing' | 'PayingKeyCddMissing' | 'NoPayingKey' | 'NotPayingKey' | 'NotAuthorizedForPayingKey' | 'NotAuthorizedForUserKey' | 'Overflow'; + } + + /** @name PalletRewardsError (686) */ + export interface PalletRewardsError extends Enum { + readonly isUnknownItnAddress: boolean; + readonly isItnRewardAlreadyClaimed: boolean; + readonly isInvalidSignature: boolean; + readonly isUnableToCovertBalance: boolean; + readonly type: 'UnknownItnAddress' | 'ItnRewardAlreadyClaimed' | 'InvalidSignature' | 'UnableToCovertBalance'; + } + + /** @name PalletContractsWasmPrefabWasmModule (687) */ + export interface PalletContractsWasmPrefabWasmModule extends Struct { + readonly instructionWeightsVersion: Compact; + readonly initial: Compact; + readonly maximum: Compact; + readonly code: Bytes; + } + + /** @name PalletContractsWasmOwnerInfo (688) */ + export interface PalletContractsWasmOwnerInfo extends Struct { + readonly owner: AccountId32; + readonly deposit: Compact; + readonly refcount: Compact; + } + + /** @name PalletContractsStorageRawContractInfo (689) */ + export interface PalletContractsStorageRawContractInfo extends Struct { + readonly trieId: Bytes; + readonly codeHash: H256; + readonly storageDeposit: u128; + } + + /** @name PalletContractsStorageDeletedContract (691) */ + export interface PalletContractsStorageDeletedContract extends Struct { + readonly trieId: Bytes; + } + + /** @name PalletContractsSchedule (692) */ + export interface PalletContractsSchedule extends Struct { + readonly limits: PalletContractsScheduleLimits; + readonly instructionWeights: PalletContractsScheduleInstructionWeights; + readonly hostFnWeights: PalletContractsScheduleHostFnWeights; + } + + /** @name PalletContractsScheduleLimits (693) */ + export interface PalletContractsScheduleLimits extends Struct { + readonly eventTopics: u32; + readonly stackHeight: Option; + readonly globals: u32; + readonly parameters: u32; + readonly memoryPages: u32; + readonly tableSize: u32; + readonly brTableSize: u32; + readonly subjectLen: u32; + readonly callDepth: u32; + readonly payloadLen: u32; + readonly codeLen: u32; + } + + /** @name PalletContractsScheduleInstructionWeights (694) */ + export interface PalletContractsScheduleInstructionWeights extends Struct { + readonly version: u32; + readonly i64const: u32; + readonly i64load: u32; + readonly i64store: u32; + readonly select: u32; + readonly r_if: u32; + readonly br: u32; + readonly brIf: u32; + readonly brTable: u32; + readonly brTablePerEntry: u32; + readonly call: u32; + readonly callIndirect: u32; + readonly callIndirectPerParam: u32; + readonly localGet: u32; + readonly localSet: u32; + readonly localTee: u32; + readonly globalGet: u32; + readonly globalSet: u32; + readonly memoryCurrent: u32; + readonly memoryGrow: u32; + readonly i64clz: u32; + readonly i64ctz: u32; + readonly i64popcnt: u32; + readonly i64eqz: u32; + readonly i64extendsi32: u32; + readonly i64extendui32: u32; + readonly i32wrapi64: u32; + readonly i64eq: u32; + readonly i64ne: u32; + readonly i64lts: u32; + readonly i64ltu: u32; + readonly i64gts: u32; + readonly i64gtu: u32; + readonly i64les: u32; + readonly i64leu: u32; + readonly i64ges: u32; + readonly i64geu: u32; + readonly i64add: u32; + readonly i64sub: u32; + readonly i64mul: u32; + readonly i64divs: u32; + readonly i64divu: u32; + readonly i64rems: u32; + readonly i64remu: u32; + readonly i64and: u32; + readonly i64or: u32; + readonly i64xor: u32; + readonly i64shl: u32; + readonly i64shrs: u32; + readonly i64shru: u32; + readonly i64rotl: u32; + readonly i64rotr: u32; + } + + /** @name PalletContractsScheduleHostFnWeights (695) */ + export interface PalletContractsScheduleHostFnWeights extends Struct { + readonly caller: u64; + readonly isContract: u64; + readonly codeHash: u64; + readonly ownCodeHash: u64; + readonly callerIsOrigin: u64; + readonly address: u64; + readonly gasLeft: u64; + readonly balance: u64; + readonly valueTransferred: u64; + readonly minimumBalance: u64; + readonly blockNumber: u64; + readonly now: u64; + readonly weightToFee: u64; + readonly gas: u64; + readonly input: u64; + readonly inputPerByte: u64; + readonly r_return: u64; + readonly returnPerByte: u64; + readonly terminate: u64; + readonly random: u64; + readonly depositEvent: u64; + readonly depositEventPerTopic: u64; + readonly depositEventPerByte: u64; + readonly debugMessage: u64; + readonly setStorage: u64; + readonly setStoragePerNewByte: u64; + readonly setStoragePerOldByte: u64; + readonly setCodeHash: u64; + readonly clearStorage: u64; + readonly clearStoragePerByte: u64; + readonly containsStorage: u64; + readonly containsStoragePerByte: u64; + readonly getStorage: u64; + readonly getStoragePerByte: u64; + readonly takeStorage: u64; + readonly takeStoragePerByte: u64; + readonly transfer: u64; + readonly call: u64; + readonly delegateCall: u64; + readonly callTransferSurcharge: u64; + readonly callPerClonedByte: u64; + readonly instantiate: u64; + readonly instantiateTransferSurcharge: u64; + readonly instantiatePerSaltByte: u64; + readonly hashSha2256: u64; + readonly hashSha2256PerByte: u64; + readonly hashKeccak256: u64; + readonly hashKeccak256PerByte: u64; + readonly hashBlake2256: u64; + readonly hashBlake2256PerByte: u64; + readonly hashBlake2128: u64; + readonly hashBlake2128PerByte: u64; + readonly ecdsaRecover: u64; + readonly ecdsaToEthAddress: u64; + } + + /** @name PalletContractsError (696) */ + export interface PalletContractsError extends Enum { + readonly isInvalidScheduleVersion: boolean; + readonly isInvalidCallFlags: boolean; + readonly isOutOfGas: boolean; + readonly isOutputBufferTooSmall: boolean; + readonly isTransferFailed: boolean; + readonly isMaxCallDepthReached: boolean; + readonly isContractNotFound: boolean; + readonly isCodeTooLarge: boolean; + readonly isCodeNotFound: boolean; + readonly isOutOfBounds: boolean; + readonly isDecodingFailed: boolean; + readonly isContractTrapped: boolean; + readonly isValueTooLarge: boolean; + readonly isTerminatedWhileReentrant: boolean; + readonly isInputForwarded: boolean; + readonly isRandomSubjectTooLong: boolean; + readonly isTooManyTopics: boolean; + readonly isDuplicateTopics: boolean; + readonly isNoChainExtension: boolean; + readonly isDeletionQueueFull: boolean; + readonly isDuplicateContract: boolean; + readonly isTerminatedInConstructor: boolean; + readonly isDebugMessageInvalidUTF8: boolean; + readonly isReentranceDenied: boolean; + readonly isStorageDepositNotEnoughFunds: boolean; + readonly isStorageDepositLimitExhausted: boolean; + readonly isCodeInUse: boolean; + readonly isContractReverted: boolean; + readonly isCodeRejected: boolean; + readonly type: 'InvalidScheduleVersion' | 'InvalidCallFlags' | 'OutOfGas' | 'OutputBufferTooSmall' | 'TransferFailed' | 'MaxCallDepthReached' | 'ContractNotFound' | 'CodeTooLarge' | 'CodeNotFound' | 'OutOfBounds' | 'DecodingFailed' | 'ContractTrapped' | 'ValueTooLarge' | 'TerminatedWhileReentrant' | 'InputForwarded' | 'RandomSubjectTooLong' | 'TooManyTopics' | 'DuplicateTopics' | 'NoChainExtension' | 'DeletionQueueFull' | 'DuplicateContract' | 'TerminatedInConstructor' | 'DebugMessageInvalidUTF8' | 'ReentranceDenied' | 'StorageDepositNotEnoughFunds' | 'StorageDepositLimitExhausted' | 'CodeInUse' | 'ContractReverted' | 'CodeRejected'; + } + + /** @name PolymeshContractsError (697) */ + export interface PolymeshContractsError extends Enum { + readonly isRuntimeCallNotFound: boolean; + readonly isDataLeftAfterDecoding: boolean; + readonly isInLenTooLarge: boolean; + readonly isInstantiatorWithNoIdentity: boolean; + readonly type: 'RuntimeCallNotFound' | 'DataLeftAfterDecoding' | 'InLenTooLarge' | 'InstantiatorWithNoIdentity'; + } + + /** @name PalletPreimageRequestStatus (698) */ + export interface PalletPreimageRequestStatus extends Enum { + readonly isUnrequested: boolean; + readonly asUnrequested: Option>; + readonly isRequested: boolean; + readonly asRequested: u32; + readonly type: 'Unrequested' | 'Requested'; + } + + /** @name PalletPreimageError (701) */ + export interface PalletPreimageError extends Enum { + readonly isTooLarge: boolean; + readonly isAlreadyNoted: boolean; + readonly isNotAuthorized: boolean; + readonly isNotNoted: boolean; + readonly isRequested: boolean; + readonly isNotRequested: boolean; + readonly type: 'TooLarge' | 'AlreadyNoted' | 'NotAuthorized' | 'NotNoted' | 'Requested' | 'NotRequested'; + } + + /** @name PalletTestUtilsError (702) */ + export type PalletTestUtilsError = Null; + + /** @name FrameSystemExtensionsCheckSpecVersion (705) */ + export type FrameSystemExtensionsCheckSpecVersion = Null; + + /** @name FrameSystemExtensionsCheckTxVersion (706) */ + export type FrameSystemExtensionsCheckTxVersion = Null; + + /** @name FrameSystemExtensionsCheckGenesis (707) */ + export type FrameSystemExtensionsCheckGenesis = Null; + + /** @name FrameSystemExtensionsCheckNonce (710) */ + export interface FrameSystemExtensionsCheckNonce extends Compact {} + + /** @name PolymeshExtensionsCheckWeight (711) */ + export interface PolymeshExtensionsCheckWeight extends FrameSystemExtensionsCheckWeight {} + + /** @name FrameSystemExtensionsCheckWeight (712) */ + export type FrameSystemExtensionsCheckWeight = Null; + + /** @name PalletTransactionPaymentChargeTransactionPayment (713) */ + export interface PalletTransactionPaymentChargeTransactionPayment extends Compact {} + + /** @name PalletPermissionsStoreCallMetadata (714) */ + export type PalletPermissionsStoreCallMetadata = Null; + + /** @name PolymeshRuntimeDevelopRuntime (715) */ + export type PolymeshRuntimeDevelopRuntime = Null; + +} // declare module diff --git a/scripts/cli/src/tests/0_create_identities.ts b/scripts/cli/src/tests/0_create_identities.ts deleted file mode 100644 index 942630b858..0000000000 --- a/scripts/cli/src/tests/0_create_identities.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { initMain, generateKeys } from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "0_primary"; - const keys = await generateKeys(2, primaryDevSeed); - await createIdentities(alice, keys); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: CREATE IDENTITIES"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/10_governance_management.ts b/scripts/cli/src/tests/10_governance_management.ts deleted file mode 100644 index d3e836560b..0000000000 --- a/scripts/cli/src/tests/10_governance_management.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - ApiSingleton, - generateEntityFromUri, - initMain, - sendTx, - transferAmount, -} from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import * as staking from "../helpers/staking_helper"; -import * as pips from "../helpers/pips_helper"; -import * as committee from "../helpers/committee_helper"; -import Keyring from "@polkadot/keyring"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const govCommittee1 = testEntities[2]; - const govCommittee2 = testEntities[3]; - const bob = await generateEntityFromUri("10_bob"); - const dave = await generateEntityFromUri("10_dave"); - await pips.setDefaultEnactmentPeriod(alice, 10); - await createIdentities(alice, [bob, dave]); - - // Bob and Dave needs some funds to use. - await distributePolyBatch(alice, [bob, dave], transferAmount); - await staking.bond(dave, bob, 1_000_000, "Staked"); - const setLimit = await pips.setActivePipLimit(42); - - const firstPipCount = await pips.pipIdSequence(); - await pips.propose(bob, setLimit, 9_000_000_000, "google.com", "first"); - console.log("after propose"); - - const secondPipCount = await pips.pipIdSequence(); - await pips.propose(bob, setLimit, 10_000_000_000, "google.com", "second"); - await sendTx( - dave, - (await ApiSingleton.getInstance()).tx.pips.vote(1, true, 10) - ); - - // GC needs some funds to use. - await distributePolyBatch( - alice, - [govCommittee1, govCommittee2], - transferAmount - ); - - // Snapshot and approve second PIP. - await pips.snapshot(govCommittee1); - const approvePIP = await pips.enactSnapshotResults(secondPipCount, "Approve"); - await pips.voteResult([govCommittee1, govCommittee2], approvePIP); - - // Reject the first PIP - const rejectPIP = await pips.rejectProposal(firstPipCount); - await pips.voteResult([govCommittee1, govCommittee2], rejectPIP); - - // Finally reschedule, demonstrating that it had been scheduled. - await pips.rescheduleProposal(govCommittee1, secondPipCount); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: GOVERNANCE MANAGEMENT"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/11_A_settlement.ts b/scripts/cli/src/tests/11_A_settlement.ts deleted file mode 100644 index 893e0b2bfd..0000000000 --- a/scripts/cli/src/tests/11_A_settlement.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as init from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePoly } from "../helpers/poly_helper"; -import { assetBalance, issueTokenToDid } from "../helpers/asset_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; -import * as settlement from "../helpers/settlement_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("11ATICKER"); - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const bob = await init.generateEntityFromUri("11A_bob"); - const bobDid = (await createIdentities(alice, [bob]))[0]; - const aliceDid = await init.keyToIdentityIds(alice.publicKey); - await distributePoly(alice, bob, init.transferAmount); - await issueTokenToDid(alice, ticker, 1000000, null); - await addComplianceRequirement(alice, ticker); - - let aliceBalance = await assetBalance(ticker, aliceDid); - let bobBalance = await assetBalance(ticker, bobDid); - - console.log("Balance for Asset (Before)"); - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); - console.log(" "); - - let venueCounter = await settlement.createVenue(alice); - - let intructionCounterAB = await settlement.addInstruction( - alice, - venueCounter, - aliceDid, - bobDid, - ticker, - 100 - ); - - await settlement.affirmInstruction(alice, intructionCounterAB, aliceDid, 1); - await settlement.affirmInstruction(bob, intructionCounterAB, bobDid, 0); - - // Wait for settlement to be executed - happens in the next block - await init.waitBlocks(2); - - //await rejectInstruction(bob, intructionCounter); - //await unathorizeInstruction(alice, instructionCounter); - - aliceBalance = await assetBalance(ticker, aliceDid); - bobBalance = await assetBalance(ticker, bobDid); - - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: SETTLEMENT A"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/11_B_settlement.ts b/scripts/cli/src/tests/11_B_settlement.ts deleted file mode 100644 index 97f0f5baa8..0000000000 --- a/scripts/cli/src/tests/11_B_settlement.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as init from "../util/init"; - -import { createIdentities } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { - assetBalance, - issueTokenToDid, - mintingAsset, -} from "../helpers/asset_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; -import * as settlement from "../helpers/settlement_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("11BTICKER1"); - const ticker2 = init.padTicker("11BTICKER2"); - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const bob = await init.generateEntityFromUri("11B_bob"); - const charlie = await init.generateEntityFromUri("11B_charlie"); - const dave = await init.generateEntityFromUri("11B_dave"); - const eve = await init.generateEntityFromUri("11B_eve"); - const aliceDid = await init.keyToIdentityIds(alice.publicKey); - const bobDid = (await createIdentities(alice, [bob]))[0]; - const charlieDid = (await createIdentities(alice, [charlie]))[0]; - const daveDid = (await createIdentities(alice, [dave]))[0]; - const eveDid = (await createIdentities(alice, [eve]))[0]; - console.log("DIDs Created"); - await distributePolyBatch( - alice, - [bob, charlie, dave, eve], - init.transferAmount - ); - console.log("POLY Distributed"); - await issueTokenToDid(alice, ticker, 1000000, null); - await issueTokenToDid(bob, ticker2, 1000000, null); - console.log("Assets Created"); - await addComplianceRequirement(alice, ticker); - await addComplianceRequirement(bob, ticker2); - console.log("Compliance Rules Added"); - - let aliceBalance = await assetBalance(ticker, aliceDid); - let bobBalance = await assetBalance(ticker, bobDid); - let charlieBalance = await assetBalance(ticker, charlieDid); - let daveBalance = await assetBalance(ticker, daveDid); - let eveBalance = await assetBalance(ticker, eveDid); - console.log("Asset balances generated"); - - console.log("Balance for Alice Asset (Before)"); - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); - console.log(`charlie asset balance --------> ${charlieBalance}`); - console.log(`dave asset balance --------> ${daveBalance}`); - console.log(`eve asset balance --------> ${eveBalance}`); - console.log(" "); - - aliceBalance = await assetBalance(ticker2, aliceDid); - bobBalance = await assetBalance(ticker2, bobDid); - charlieBalance = await assetBalance(ticker2, charlieDid); - daveBalance = await assetBalance(ticker2, daveDid); - eveBalance = await assetBalance(ticker2, eveDid); - - console.log("Balance for Bob's Asset (Before)"); - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); - console.log(`charlie asset balance --------> ${charlieBalance}`); - console.log(`dave asset balance --------> ${daveBalance}`); - console.log(`eve asset balance --------> ${eveBalance}`); - console.log(" "); - - const venueCounter = await settlement.createVenue(alice); - let instructionCounter = await settlement.addGroupInstruction( - alice, - venueCounter, - [aliceDid, bobDid, charlieDid, daveDid, eveDid], - ticker, - ticker2, - 100 - ); - - await settlement.affirmInstruction(alice, instructionCounter, aliceDid, 4); - await settlement.affirmInstruction(bob, instructionCounter, bobDid, 1); - await settlement.affirmInstruction( - charlie, - instructionCounter, - charlieDid, - 0 - ); - await settlement.affirmInstruction(dave, instructionCounter, daveDid, 0); - //await settlement.rejectInstruction(eve, instructionCounter); - await settlement.affirmInstruction(eve, instructionCounter, eveDid, 0); - - // Wait for settlement to be executed - happens in the next block - await init.waitBlocks(2); - - aliceBalance = await assetBalance(ticker, aliceDid); - bobBalance = await assetBalance(ticker, bobDid); - charlieBalance = await assetBalance(ticker, charlieDid); - daveBalance = await assetBalance(ticker, daveDid); - eveBalance = await assetBalance(ticker, eveDid); - - console.log("Balance for Alice Asset (After)"); - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); - console.log(`charlie asset balance --------> ${charlieBalance}`); - console.log(`dave asset balance --------> ${daveBalance}`); - console.log(`eve asset balance --------> ${eveBalance}`); - console.log(" "); - - aliceBalance = await assetBalance(ticker2, aliceDid); - bobBalance = await assetBalance(ticker2, bobDid); - charlieBalance = await assetBalance(ticker2, charlieDid); - daveBalance = await assetBalance(ticker2, daveDid); - eveBalance = await assetBalance(ticker2, eveDid); - - console.log("Balance for Bob's ASSET (After)"); - console.log(`alice asset balance --------> ${aliceBalance}`); - console.log(`bob asset balance --------> ${bobBalance}`); - console.log(`charlie asset balance --------> ${charlieBalance}`); - console.log(`dave asset balance --------> ${daveBalance}`); - console.log(`eve asset balance --------> ${eveBalance}`); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: SETTLEMENT B"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/12_external_agents.ts b/scripts/cli/src/tests/12_external_agents.ts deleted file mode 100644 index 0fcda8563f..0000000000 --- a/scripts/cli/src/tests/12_external_agents.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { - initMain, - transferAmount, - keyToIdentityIds, - generateEntityFromUri, - padTicker, - sendTx, - ApiSingleton, - waitNextBlock, -} from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { issueTokenToDid } from "../helpers/asset_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { - createGroup, - setGroupPermissions, - acceptBecomeAgent, - nextAgId, - abdicate, - removeAgent, - changeGroup, -} from "../helpers/external_agent_helper"; -import { ExtrinsicPermissions } from "../types"; -import PrettyError from "pretty-error"; -import { - addInstruction, - affirmInstruction, - createVenue, -} from "../helpers/settlement_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; - -async function main(): Promise { - const api = await ApiSingleton.getInstance(); - const testEntities = await initMain(); - const alice = testEntities[0]; - const aliceDid = await keyToIdentityIds(alice.publicKey); - const bob = await generateEntityFromUri("12_bob"); - const dave = await generateEntityFromUri("12_dave"); - const [bobDid, daveDid] = await createIdentities(alice, [bob, dave]); - let extrinsics: ExtrinsicPermissions = { These: [] }; - console.log("Identities Created"); - await distributePolyBatch(alice, [bob, dave], transferAmount * 10); - const ticker = padTicker("12TICKER"); - const raisingTicker = padTicker("12TICKERRAIS"); - await issueTokenToDid(alice, ticker, 1000000, null); - console.log("EA: Group"); - await createGroup(alice, ticker, extrinsics); - - let agId = await nextAgId(ticker); - console.log("EA: Group Permissions"); - await setGroupPermissions(alice, ticker, agId, extrinsics); - console.log("EA: Become Agent"); - await acceptBecomeAgent(bob, bobDid, alice, ticker, { Full: "" }); - await acceptBecomeAgent(dave, daveDid, alice, ticker, { Full: "" }); - await addComplianceRequirement(alice, ticker); - - await abdicate(alice, ticker); - - console.log("EA: Accept Agent"); - await acceptBecomeAgent(alice, aliceDid, bob, ticker, { Full: "" }); - await removeAgent(alice, ticker, bobDid); - console.log("EA: Group"); - await createGroup(alice, ticker, extrinsics); - agId = await nextAgId(ticker); - await setGroupPermissions(alice, ticker, agId, extrinsics); - console.log("EA: Change Group"); - await changeGroup(alice, ticker, aliceDid, { Full: "" }); - - // External agent authorized extrinsics - - let venueCounter = await createVenue(alice); - let intructionCounterAB = await addInstruction( - alice, - venueCounter, - aliceDid, - daveDid, - ticker, - 1000 - ); - - await affirmInstruction(alice, intructionCounterAB, aliceDid, 1); - await affirmInstruction(dave, intructionCounterAB, daveDid, 0); - await waitNextBlock(); - - await sendTx( - dave, - api.tx.settlement.createVenue("", [dave.publicKey], "Sto") - ); - venueCounter++; - await sendTx( - dave, - api.tx.sto.createFundraiser( - { did: daveDid, kind: { Default: null } }, - ticker, - { did: daveDid, kind: { Default: null } }, - raisingTicker, - [{ total: 3, price: 4 }], - venueCounter, - null, - null, - 0, - "mySto" - ) - ); - await sendTx(dave, api.tx.sto.freezeFundraiser(ticker, 0)); - await sendTx(dave, api.tx.sto.unfreezeFundraiser(ticker, 0)); - await sendTx( - dave, - api.tx.sto.modifyFundraiserWindow(ticker, 0, Date.now() as any, null) - ); - await sendTx(dave, api.tx.sto.stop(ticker, 0)); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: EXTERNAL AGENTS"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/13_corporate_actions.ts b/scripts/cli/src/tests/13_corporate_actions.ts deleted file mode 100644 index 5227eb42a3..0000000000 --- a/scripts/cli/src/tests/13_corporate_actions.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { - generateKeys, - transferAmount, - initMain, - keyToIdentityIds, - generateEntityFromUri, - padTicker, -} from "../util/init"; -import PrettyError from "pretty-error"; -import { - changeDefaultTargetIdentitites, - changeWithholdingTax, - claimDistribution, - createDistribution, - initiateCorporateAction, -} from "../helpers/corporate_actions_helper"; -import { - authorizeJoinToIdentities, - createIdentities, -} from "../helpers/identity_helper"; -import { assetBalance, issueTokenToDid } from "../helpers/asset_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { addSecondaryKeys } from "../helpers/key_management_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; -import { - addInstruction, - affirmInstruction, - createVenue, -} from "../helpers/settlement_helper"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const aliceDid = await keyToIdentityIds(alice.publicKey); - const bob = await generateEntityFromUri("13_bob"); - const bobDid = (await createIdentities(alice, [bob]))[0]; - const primaryDevSeed = "13_primary"; - const secondaryDevSeed = "13_secondary"; - const primaryKeys = await generateKeys(1, primaryDevSeed); - const secondaryKeys = await generateKeys(1, secondaryDevSeed); - await createIdentities(alice, primaryKeys); - - const ticker = padTicker("13TICKER"); - const earnedTicker = padTicker("13EARNED"); - - await distributePolyBatch(alice, [primaryKeys[0]], transferAmount); - await addSecondaryKeys(primaryKeys, secondaryKeys); - await authorizeJoinToIdentities(secondaryKeys, primaryKeys); - await distributePolyBatch(alice, [secondaryKeys[0], bob], transferAmount); - - console.log("Distributing tokens"); - await Promise.all([ - issueTokenToDid(alice, ticker, 1000000000, null), - issueTokenToDid(alice, earnedTicker, 20000000000, null), - ]); - - console.log("adding compliance requirement"); - await Promise.all([ - addComplianceRequirement(alice, ticker), - addComplianceRequirement(alice, earnedTicker), - ]); - - console.log("transfering token to Bob"); - let venueCounter = await createVenue(alice); - let intructionCounterAB = await addInstruction( - alice, - venueCounter, - aliceDid, - bobDid, - ticker, - 100000000 - ); - console.log("affirming transfer"); - await Promise.all([ - affirmInstruction(alice, intructionCounterAB, aliceDid, 1), - affirmInstruction(bob, intructionCounterAB, bobDid, 0), - ]); - - console.log("changing default target and taxes for corporate action"); - await Promise.all([ - changeDefaultTargetIdentitites(alice, ticker, [bob], "include"), - changeWithholdingTax(alice, ticker, 15), - ]); - - await initiateCorporateAction( - alice, - ticker, - "PredictableBenefit", - "100", - { existing: 1 }, - "Regular dividend", - null, - null, - null - ); - - console.log("creating distribution"); - await createDistribution( - alice, - ticker, - "0", - null, - earnedTicker, - 1000000, - 2000000000, - null - ); - - await claimDistribution(bob, ticker, 0); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: CORPORATE_ACTIONS"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/14_investment.ts b/scripts/cli/src/tests/14_investment.ts deleted file mode 100644 index 4921a3a531..0000000000 --- a/scripts/cli/src/tests/14_investment.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { - initMain, - transferAmount, - keyToIdentityIds, - generateEntityFromUri, - padTicker, - sendTx, - ApiSingleton, - waitNextBlock, -} from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { issueTokenToDid } from "../helpers/asset_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { - createGroup, - setGroupPermissions, - acceptBecomeAgent, - nextAgId, - abdicate, - removeAgent, - changeGroup, -} from "../helpers/external_agent_helper"; -import { ExtrinsicPermissions } from "../types"; -import PrettyError from "pretty-error"; -import { - addInstruction, - affirmInstruction, - createVenue, -} from "../helpers/settlement_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; - -async function main(): Promise { - const api = await ApiSingleton.getInstance(); - const testEntities = await initMain(); - const alice = testEntities[0]; - const aliceDid = await keyToIdentityIds(alice.publicKey); - const bob = await generateEntityFromUri("14_bob"); - const dave = await generateEntityFromUri("14_dave"); - const [bobDid, daveDid] = await createIdentities(alice, [bob, dave]); - - console.log("Identities Created"); - await distributePolyBatch(alice, [bob, dave], transferAmount * 10); - const ticker = padTicker("14TICKER"); - const raisingTicker = padTicker("14TICKERRAIS"); - await issueTokenToDid(alice, ticker, 1000000, null); - await issueTokenToDid(dave, raisingTicker, 1000000, null); - - await addComplianceRequirement(alice, ticker); - await addComplianceRequirement(dave, raisingTicker); - - let venueCounter = await createVenue(dave); - let intructionCounterAB = await addInstruction( - dave, - venueCounter, - daveDid, - bobDid, - raisingTicker, - 1000 - ); - - await affirmInstruction(dave, intructionCounterAB, daveDid, 1); - await affirmInstruction(bob, intructionCounterAB, bobDid, 0); - await waitNextBlock(); - - await sendTx( - alice, - api.tx.settlement.createVenue("", [alice.publicKey], "Sto") - ); - venueCounter++; - await sendTx( - alice, - api.tx.sto.createFundraiser( - { did: aliceDid, kind: { Default: null } }, - ticker, - { did: aliceDid, kind: { Default: null } }, - raisingTicker, - [{ total: 3000, price: 4 }], - venueCounter, - null, - null, - 0, - "mySto" - ) - ); - await sendTx( - dave, - api.tx.sto.invest( - { did: daveDid, kind: { Default: null } }, - { did: daveDid, kind: { Default: null } }, - ticker, - 0, - 40, - null, - null - ) - ); - await sendTx( - bob, - api.tx.sto.invest( - { did: bobDid, kind: { Default: null } }, - { did: bobDid, kind: { Default: null } }, - ticker, - 0, - 10, - null, - null - ) - ); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: INVESTMENTS"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/15_itn_rewards.ts b/scripts/cli/src/tests/15_itn_rewards.ts deleted file mode 100644 index 5ec3ef4872..0000000000 --- a/scripts/cli/src/tests/15_itn_rewards.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { - initMain, - transferAmount, - keyToIdentityIds, - generateEntityFromUri, - padTicker, - sendTx, - ApiSingleton, - waitNextBlock, - waitNextEra, -} from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { issueTokenToDid } from "../helpers/asset_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { ExtrinsicPermissions } from "../types"; -import PrettyError from "pretty-error"; -import { - addInstruction, - affirmInstruction, - createVenue, -} from "../helpers/settlement_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; -import { send } from "process"; - -async function main(): Promise { - const api = await ApiSingleton.getInstance(); - const testEntities = await initMain(); - const alice = testEntities[0]; - const bob = testEntities[4]; - const aliceDid = await keyToIdentityIds(alice.publicKey); - const bobDid = await keyToIdentityIds(bob.publicKey); - const dave = await generateEntityFromUri("15_dave"); - const dave2 = await generateEntityFromUri("15_dave2"); - const [daveDid] = await createIdentities(alice, [dave]); - - console.log("Identities Created"); - await distributePolyBatch(alice, [bob, dave], transferAmount * 10); - - // Staking - await sendTx( - dave, - api.tx.staking.bond(dave.publicKey, 1000000, { Staked: null }) - ); - await sendTx(dave, api.tx.staking.nominate([bob.publicKey])); - console.log("Nominated validators"); - - await waitNextEra(); - console.log("New era, rewards paid out"); - - // SecondaryKey - await sendTx( - dave, - api.tx.identity.addAuthorization( - { Account: dave2.publicKey }, - { JoinIdentity: { Whole: null } }, - null - ) - ); - console.log("Added JoinIdentity authorization"); - const authorization = ( - await api.query.identity.authorizations.entries({ - Account: dave2.publicKey, - }) - )[0][1].unwrap().auth_id; - await sendTx(dave2, api.tx.identity.joinIdentityAsKey(authorization)); - - console.log("ItnRewards: TrustedDefaultClaimIssuerAdded"); - const ticker = padTicker("15TICKER"); - issueTokenToDid(dave, ticker, 100000, null); - await addComplianceRequirement(dave, ticker); - await sendTx( - dave, - api.tx.complianceManager.addDefaultTrustedClaimIssuer(ticker, { - issuer: bobDid, - trusted_for: { Any: null }, - }) - ); - - console.log("ItnRewards: ClaimAdded"); - await sendTx( - bob, - api.tx.identity.addClaim(daveDid, { Accredited: { Ticker: ticker } }, null) - ); - - console.log("ItnRewards: ConfigureAdvancedTokenRules"); - await sendTx( - dave, - api.tx.statistics.addTransferManager(ticker, { CountTransferManager: 10 }) - ); - - console.log("ItnRewards: PortfolioCreated"); - await sendTx(dave, api.tx.portfolio.createPortfolio("foobar")); - - console.log("ItnRewards: AddAssetToAPortfolio"); - const portfolioId = await api.query.portfolio.nameToNumber(daveDid, "foobar"); - - await sendTx( - dave, - api.tx.portfolio.movePortfolioFunds( - { did: daveDid, kind: { Default: null } }, - { did: daveDid, kind: { User: portfolioId } }, - [{ amount: 10, ticker }] - ) - ); - - // AddAPortfolioManager is not possible because of old permission format - - console.log("ItnRewards: StopStakingAPortion"); - await sendTx(dave, api.tx.staking.unbond(100)); - - console.log("ItnRewards: StartStakingANewOperator"); - await sendTx(dave, api.tx.staking.nominate([alice.publicKey])); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: ITN REWARDS"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/16_relayer.ts b/scripts/cli/src/tests/16_relayer.ts deleted file mode 100644 index 5097bc4831..0000000000 --- a/scripts/cli/src/tests/16_relayer.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { generateEntityFromUri, initMain, transferAmount } from "../util/init"; -import { createIdentities, getAuthId } from "../helpers/identity_helper"; -import { distributePoly } from "../helpers/poly_helper"; -import * as relayer from "../helpers/relayer_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const bob = await generateEntityFromUri("16_bob"); - await createIdentities(alice, [bob]); - await distributePoly(alice, bob, transferAmount); - console.log("Set Paying Key"); - await relayer.setPayingKey(alice, bob.publicKey, 100000); - const authId = await getAuthId(); - console.log("Accept Paying Key"); - await relayer.acceptPayingKey(bob, authId.toNumber()); - console.log("Update POLYX Limit"); - await relayer.updatePolyxLimit(alice, bob.publicKey, 500000); - console.log("Increase POLYX Limit"); - await relayer.increasePolyxLimit(alice, bob.publicKey, 70000); - console.log("Decrease POLYX Limit"); - await relayer.decreasePolyxLimit(alice, bob.publicKey, 30000); - console.log("Remove Paying Key"); - await relayer.removePayingKey(alice, bob, "userKey"); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => process.exit()); diff --git a/scripts/cli/src/tests/1_poly_transfer.ts b/scripts/cli/src/tests/1_poly_transfer.ts deleted file mode 100644 index de93e04b09..0000000000 --- a/scripts/cli/src/tests/1_poly_transfer.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { initMain, generateKeys, transferAmount, throws } from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePoly, distributePolyBatch } from "../helpers/poly_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "1_primary"; - const keys = await generateKeys(2, primaryDevSeed); - await createIdentities(alice, keys); - await distributePolyBatch(alice, keys, transferAmount); - - // fail transfers - await throws( - async () => await distributePoly(keys[0], keys[1], transferAmount * 10) - ); - await throws( - async () => await distributePoly(keys[1], keys[0], transferAmount * 10) - ); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: POLY TRANSFERS"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/2_key_management.ts b/scripts/cli/src/tests/2_key_management.ts deleted file mode 100644 index 6c73e47bc1..0000000000 --- a/scripts/cli/src/tests/2_key_management.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as init from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { - addSecondaryKeys, - createMultiSig, -} from "../helpers/key_management_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await init.initMain(); - const primaryDevSeed = "2_primary"; - const secondaryDevSeed = "2_secondary"; - const alice = testEntities[0]; - const bob = await init.generateEntityFromUri("2_bob"); - const charlie = await init.generateEntityFromUri("2_charlie"); - const dave = await init.generateEntityFromUri("2_dave"); - const primaryKeys = await init.generateKeys(2, primaryDevSeed); - const secondaryKeys = await init.generateKeys(2, secondaryDevSeed); - const bobSignatory = await init.signatory(alice, bob); - const charlieSignatory = await init.signatory(alice, charlie); - const daveSignatory = await init.signatory(alice, dave); - const signatoryArray = [bobSignatory, charlieSignatory, daveSignatory]; - await createIdentities(alice, primaryKeys); - await distributePolyBatch(alice, primaryKeys, init.transferAmount); - await addSecondaryKeys(primaryKeys, secondaryKeys); - await createMultiSig(alice, signatoryArray, 2); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: KEY MANAGEMENT"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/3_auth_join_did.ts b/scripts/cli/src/tests/3_auth_join_did.ts deleted file mode 100644 index 9254ee6fd0..0000000000 --- a/scripts/cli/src/tests/3_auth_join_did.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { initMain, generateKeys, transferAmount } from "../util/init"; -import { - createIdentities, - authorizeJoinToIdentities, -} from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { addSecondaryKeys } from "../helpers/key_management_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "3_primary"; - const secondaryDevSeed = "3_secondary"; - const primaryKeys = await generateKeys(2, primaryDevSeed); - const secondaryKeys = await generateKeys(2, secondaryDevSeed); - await createIdentities(alice, primaryKeys); - await distributePolyBatch(alice, primaryKeys, transferAmount); - await addSecondaryKeys(primaryKeys, secondaryKeys); - await authorizeJoinToIdentities(secondaryKeys, primaryKeys); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: AUTH JOIN DID"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/4_permission_management.ts b/scripts/cli/src/tests/4_permission_management.ts deleted file mode 100644 index 4492421c61..0000000000 --- a/scripts/cli/src/tests/4_permission_management.ts +++ /dev/null @@ -1,135 +0,0 @@ -import * as init from "../util/init"; -import { - createIdentities, - authorizeJoinToIdentities, - setPermissionToSigner, -} from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { addSecondaryKeys } from "../helpers/key_management_helper"; -import { - setAsset, - setExtrinsic, - setPortfolio, - setDoc, -} from "../helpers/permission_helper"; -import { - createPortfolio, - movePortfolioFunds, -} from "../helpers/portfolio_helper"; -import { addDocuments, issueTokenToDid } from "../helpers/asset_helper"; -import { - AssetPermissions, - Document, - ExtrinsicPermissions, - LegacyPalletPermissions, - PortfolioId, - PortfolioPermissions, - Ticker, -} from "../types"; -import { assert } from "chai"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("4TICKER"); - const portfolioName = "4_portfolio"; - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "4_primary"; - const secondaryDevSeed = "4_secondary"; - const primaryKeys = await init.generateKeys(1, primaryDevSeed); - const secondaryKeys = await init.generateKeys(1, secondaryDevSeed); - await createIdentities(alice, primaryKeys); - let extrinsics: ExtrinsicPermissions = { These: [] }; - let portfolios: PortfolioPermissions = { These: [] }; - let assets: AssetPermissions = { These: [] }; - let documents: Document[] = []; - - await distributePolyBatch(alice, [primaryKeys[0]], init.transferAmount); - await addSecondaryKeys(primaryKeys, secondaryKeys); - await authorizeJoinToIdentities(secondaryKeys, primaryKeys); - await distributePolyBatch(alice, [secondaryKeys[0]], init.transferAmount); - await issueTokenToDid(primaryKeys[0], ticker, 1000000, null); - - let portfolioOutput = await createPortfolio(secondaryKeys[0], portfolioName); - assert.equal(portfolioOutput, false); - - setExtrinsic(extrinsics, "Portfolio", "create_portfolio"); - await setPermissionToSigner( - primaryKeys, - secondaryKeys, - extrinsics, - portfolios, - assets - ); - portfolioOutput = await createPortfolio(secondaryKeys[0], portfolioName); - assert.equal(portfolioOutput, true); - - setExtrinsic(extrinsics, "Portfolio", "move_portfolio_funds"); - await setPermissionToSigner( - primaryKeys, - secondaryKeys, - extrinsics, - portfolios, - assets - ); - let portfolioFundsOutput = await movePortfolioFunds( - secondaryKeys[0], - primaryKeys[0], - ticker, - 100 - ); - assert.equal(portfolioFundsOutput, false); - - await setPortfolio(portfolios, primaryKeys[0], "Default"); - await setPortfolio(portfolios, secondaryKeys[0], "User"); - await setPermissionToSigner( - primaryKeys, - secondaryKeys, - extrinsics, - portfolios, - assets - ); - - portfolioFundsOutput = await movePortfolioFunds( - secondaryKeys[0], - primaryKeys[0], - ticker, - 100 - ); - assert.equal(portfolioFundsOutput, true); - - setExtrinsic(extrinsics, "Asset", "add_documents"); - await setPermissionToSigner( - primaryKeys, - secondaryKeys, - extrinsics, - portfolios, - assets - ); - setDoc(documents, "www.google.com", { None: "" }, "google"); - let addDocsOutput = await addDocuments(secondaryKeys[0], ticker, documents); - assert.equal(addDocsOutput, false); - console.log("after docs"); - - setAsset(ticker, assets); - await setPermissionToSigner( - primaryKeys, - secondaryKeys, - extrinsics, - portfolios, - assets - ); - addDocsOutput = await addDocuments(secondaryKeys[0], ticker, documents); - assert.equal(addDocsOutput, true); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: PERMISSION MANAGEMENT"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/5_claim_management.ts b/scripts/cli/src/tests/5_claim_management.ts deleted file mode 100644 index 71ba961d72..0000000000 --- a/scripts/cli/src/tests/5_claim_management.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { - initMain, - generateKeys, - transferAmount, - ApiSingleton, - sendTx, - padTicker, -} from "../util/init"; -import { createIdentities, addClaimsToDids } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const api = await ApiSingleton.getInstance(); - - const testEntities = await initMain(); - const alice = testEntities[0]; - - const issuerSeed1 = "5_issuer_1"; - const issuerSeed2 = "5_issuer_2"; - const claimeeSeed = "5_claimee"; - - const issuerKeys1 = await generateKeys(2, issuerSeed1); - const issuerKeys2 = await generateKeys(2, issuerSeed2); - const claimeeKeys = await generateKeys(2, claimeeSeed); - - await createIdentities(alice, issuerKeys1); - await createIdentities(alice, issuerKeys2); - const claimeeDids = await createIdentities(alice, claimeeKeys); - - const ticker = padTicker("5TICKER"); - - await distributePolyBatch( - alice, - issuerKeys1.concat(issuerKeys2).concat(claimeeKeys), - transferAmount - ); - - console.log("Adding Exempted claim"); - await sendTx( - issuerKeys1[0], - api.tx.identity.addClaim( - claimeeDids[0], - { Exempted: { Identity: claimeeDids[1] } }, - null - ) - ); - - console.log("Adding SellLockup claim"); - await sendTx( - issuerKeys1[0], - api.tx.identity.addClaim( - claimeeDids[0], - { SellLockup: { Ticker: ticker } }, - null - ) - ); - - console.log("Adding Accredited claim"); - await sendTx( - issuerKeys2[0], - api.tx.identity.addClaim( - claimeeDids[0], - { Accredited: { Ticker: ticker } }, - null - ) - ); - - console.log("Adding Affiliate claim"); - await sendTx( - issuerKeys2[0], - api.tx.identity.addClaim( - claimeeDids[0], - { Affiliate: { Ticker: ticker } }, - Date.now() as any - ) - ); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: CLAIM MANAGEMENT"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/6_create_assets.ts b/scripts/cli/src/tests/6_create_assets.ts deleted file mode 100644 index bda295fbb4..0000000000 --- a/scripts/cli/src/tests/6_create_assets.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as init from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { issueTokenToDid } from "../helpers/asset_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("6TICKER"); - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "6_primary"; - const primaryKeys = await init.generateKeys(1, primaryDevSeed); - await createIdentities(alice, primaryKeys); - await distributePolyBatch(alice, primaryKeys, init.transferAmount); - await issueTokenToDid(primaryKeys[0], ticker, 1000000, null); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: CREATE ASSET"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/7_create_claim_compliance.ts b/scripts/cli/src/tests/7_create_claim_compliance.ts deleted file mode 100644 index 68e743ea76..0000000000 --- a/scripts/cli/src/tests/7_create_claim_compliance.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as init from "../util/init"; -import { createIdentities } from "../helpers/identity_helper"; -import { distributePolyBatch } from "../helpers/poly_helper"; -import { issueTokenToDid } from "../helpers/asset_helper"; -import { createClaimCompliance } from "../helpers/compliance_manager_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("7TICKER"); - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "7_primary"; - const primaryKeys = await init.generateKeys(1, primaryDevSeed); - let issuerDid = await createIdentities(alice, primaryKeys); - await distributePolyBatch(alice, primaryKeys, init.transferAmount); - await issueTokenToDid(primaryKeys[0], ticker, 1000000, null); - await createClaimCompliance(primaryKeys[0], issuerDid[0], ticker); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: CREATE CLAIM COMPLIANCE"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/8_asset_minting.ts b/scripts/cli/src/tests/8_asset_minting.ts deleted file mode 100644 index ffd36e33c8..0000000000 --- a/scripts/cli/src/tests/8_asset_minting.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as init from "../util/init"; -import { createIdentities, addClaimsToDids } from "../helpers/identity_helper"; -import { distributePoly } from "../helpers/poly_helper"; -import { issueTokenToDid, mintingAsset } from "../helpers/asset_helper"; -import { addComplianceRequirement } from "../helpers/compliance_manager_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const ticker = init.padTicker("8TICKER"); - const testEntities = await init.initMain(); - const alice = testEntities[0]; - const primaryDevSeed = "8_primary"; - const primaryKey = (await init.generateKeys(1, primaryDevSeed))[0]; - let issuerDid = await createIdentities(alice, [primaryKey]); - await distributePoly(alice, primaryKey, init.transferAmount); - await issueTokenToDid(primaryKey, ticker, 1000000, "first"); - await addClaimsToDids( - primaryKey, - issuerDid[0], - "Exempted", - { Ticker: ticker }, - null - ); - await addComplianceRequirement(primaryKey, ticker); - await mintingAsset(primaryKey, ticker); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: ASSET MINTING"); - process.exit(); - }); diff --git a/scripts/cli/src/tests/9_bridge_transfer.ts b/scripts/cli/src/tests/9_bridge_transfer.ts deleted file mode 100644 index 07190a4b8d..0000000000 --- a/scripts/cli/src/tests/9_bridge_transfer.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { initMain, sleep } from "../util/init"; -import { - bridgeTransfer, - freezeTransaction, - unfreezeTransaction, -} from "../helpers/bridge_helper"; -import PrettyError from "pretty-error"; - -async function main(): Promise { - const testEntities = await initMain(); - const relay = testEntities[1]; - const admin = testEntities[2]; - await bridgeTransfer(relay, admin); - await freezeTransaction(admin); - await sleep(5000); - await unfreezeTransaction(admin); -} - -main() - .catch((err: any) => { - const pe = new PrettyError(); - console.error(pe.render(err)); - process.exit(1); - }) - .finally(() => { - console.log("Completed: BRIDGE TRANSFERS"); - process.exit(); - }); \ No newline at end of file diff --git a/scripts/cli/src/types.ts b/scripts/cli/src/types.ts index 05638ce844..09cc16fb5a 100644 --- a/scripts/cli/src/types.ts +++ b/scripts/cli/src/types.ts @@ -37,20 +37,6 @@ export interface TargetIdentity { Specific?: IdentityId; } -export interface Claim { - Accredited?: Scope; - Affiliate?: Scope; - BuyLockup?: Scope; - SellLockup?: Scope; - CustomerDueDiligence?: CddId; - KnowYourCustomer?: Scope; - Jurisdiction?: [CountryCode, Scope]; - Exempted?: Scope; - Blocked?: Scope; - InvestorUniqueness?: [Scope, ScopeId, CddId]; - NoData?: string; -} - export interface ClaimType { Accredited?: string; Affiliate?: string; @@ -66,26 +52,26 @@ export interface ClaimType { } export interface AuthorizationData { - AttestPrimaryKeyRotation?: IdentityId; - RotatePrimaryKey?: IdentityId; - TransferTicker?: Ticker; - TransferPrimaryIssuanceAgent?: Ticker; - AddMultiSigSigner?: AccountId; - TransferAssetOwnership?: Ticker; - JoinIdentity?: Permissions; - PortfolioCustody?: PortfolioId; - Custom?: Ticker; - NoData?: string; - TransferCorporateActionAgent?: Ticker; - BecomeAgent?: (string | AgentGroup)[]; + AttestPrimaryKeyRotation?: IdentityId; + RotatePrimaryKey?: IdentityId; + TransferTicker?: Ticker; + TransferPrimaryIssuanceAgent?: Ticker; + AddMultiSigSigner?: AccountId; + TransferAssetOwnership?: Ticker; + JoinIdentity?: Permissions; + PortfolioCustody?: PortfolioId; + Custom?: Ticker; + NoData?: string; + TransferCorporateActionAgent?: Ticker; + BecomeAgent?: (string | AgentGroup)[]; } export interface AgentGroup { - Full?: string; - Custom?: number; - ExceptMeta?: string; - PolymeshV1CAA?: string; - PolymeshV1PIA?: string; + Full?: string; + Custom?: number; + ExceptMeta?: string; + PolymeshV1CAA?: string; + PolymeshV1PIA?: string; } export interface ConditionType { @@ -111,7 +97,22 @@ export type DispatchableName = string; export type Expiry = string | object | Uint8Array | null; export type DocumentName = string; export type DocumentUri = string; -export type Signatory = { Identity: IdentityId } | { Account: AccountId }; +export type Signatory = { Identity: IdentityId } | { Account: AccountId | Uint8Array}; +export type ItnRewardStatus = { Unclaimed: number } | { Claimed: "" }; +export type venueType = "Other" | "Distribution" | "Sto" | "Exchange" | number | Uint8Array; + +export type Claim = + | { Accredited: Scope } + | { Affiliate: Scope } + | { BuyLockup: Scope } + | { SellLockup: Scope } + | { CustomerDueDiligence: CddId } + | { KnowYourCustomer: Scope } + | { Jurisdiction: [CountryCode, Scope] } + | { Exempted: Scope } + | { Blocked: Scope } + | { InvestorUniqueness: [Scope, ScopeId, CddId] } + | { NoData: string }; export type MovePortfolioItem = { ticker: Ticker; @@ -142,12 +143,6 @@ export type PalletPermissions = { dispatchable_names: SubsetRestriction; }; -export type LegacyPalletPermissions = { - pallet_name: PalletName; - total: Boolean; - dispatchable_names: DispatchableName[]; -}; - export type PortfolioId = { did: IdentityId; kind: PortfolioKind; @@ -185,3 +180,8 @@ export type AssetCompliance = { is_paused: Boolean; requirements: ComplianceRequirement[]; }; + +export type PriceTier = { + total: number; + price: number; +} diff --git a/scripts/cli/src/util/init.ts b/scripts/cli/src/util/init.ts index 7d5bfb2e00..64875cc66f 100644 --- a/scripts/cli/src/util/init.ts +++ b/scripts/cli/src/util/init.ts @@ -1,3 +1,4 @@ +import "@polkadot/api/augment"; import { ApiPromise, WsProvider, Keyring } from "@polkadot/api"; import { cryptoWaitReady, @@ -17,17 +18,18 @@ import path from "path"; import type { AccountId } from "@polkadot/types/interfaces/runtime"; import type { SubmittableExtrinsic } from "@polkadot/api/types"; import type { KeyringPair } from "@polkadot/keyring/types"; -import type { DispatchError } from "@polkadot/types/interfaces"; +import type { DispatchError, EventRecord, AccountInfo, ActiveEraInfo } from "@polkadot/types/interfaces"; import type { ISubmittableResult } from "@polkadot/types/types"; -import type { Ticker, NonceObject } from "../types"; +import type { Ticker } from "../types"; import { createIdentities } from "../helpers/identity_helper"; import { distributePoly } from "../helpers/poly_helper"; import type { IdentityId } from "../interfaces"; import { assert } from "chai"; +import { Option } from "@polkadot/types-codec"; -let nonces = new Map(); let block_sizes: Number[] = []; let block_times: Number[] = []; +let genesisEntities: KeyringPair[] = []; let synced_block = 0; let synced_block_ts = 0; @@ -69,13 +71,20 @@ export class ApiSingleton { } } +export async function disconnect() { + const api = await ApiSingleton.getInstance(); + await api.disconnect(); +} + export async function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getEra = async () => - (await (await ApiSingleton.getInstance()).query.staking.activeEra()) - .unwrap() - .index.toJSON(); +const getEra = async () => { + const api = await ApiSingleton.getInstance(); + const activeEra = await api.query.staking.activeEra(); + activeEra.unwrap().index.toJSON(); +} + export async function waitNextEra() { const era = await getEra(); while ((await getEra()) === era) { @@ -101,13 +110,16 @@ export async function waitNextBlock() { // Initialization Main is used to generate all entities e.g (Alice, Bob, Dave) export async function initMain(): Promise { - return [ - await generateEntity("Alice"), - await generateEntity("relay_1"), - await generateEntity("polymath_1"), - await generateEntity("polymath_2"), - await generateEntity("Bob"), - ]; + if (genesisEntities.length === 0) { + genesisEntities = [ + await generateEntity("Alice"), + await generateEntity("relay_1"), + await generateEntity("polymath_1"), + await generateEntity("polymath_2"), + await generateEntity("Bob"), + ]; + } + return genesisEntities; } export async function generateEntities(accounts: string[]) { @@ -120,23 +132,16 @@ export async function generateEntities(accounts: string[]) { } export async function generateEntity(name: string): Promise { - const api = await ApiSingleton.getInstance(); await cryptoWaitReady(); - let entity = new Keyring({ type: "sr25519" }).addFromUri(`//${name}`, { + return new Keyring({ type: "sr25519" }).addFromUri(`//${name}`, { name: `${name}`, }); - let entityRawNonce = (await api.query.system.account(entity.address)).nonce; - let entity_nonce = new BN(entityRawNonce.toString()); - nonces.set(entity.address, entity_nonce); - - return entity; } export async function generateKeys( numberOfKeys: Number, keyPrepend: String ): Promise { - const api = await ApiSingleton.getInstance(); let keys = []; await cryptoWaitReady(); for (let i = 0; i < numberOfKeys; i++) { @@ -148,22 +153,13 @@ export async function generateKeys( } ) ); - let accountRawNonce = (await api.query.system.account(keys[i].address)) - .nonce; - let account_nonce = new BN(accountRawNonce.toString()); - nonces.set(keys[i].address, account_nonce); } return keys; } export async function generateEntityFromUri(uri: string): Promise { - const api = await ApiSingleton.getInstance(); await cryptoWaitReady(); - let entity = new Keyring({ type: "sr25519" }).addFromUri(uri); - let accountRawNonce = (await api.query.system.account(entity.address)).nonce; - let account_nonce = new BN(accountRawNonce.toString()); - nonces.set(entity.address, account_nonce); - return entity; + return new Keyring({ type: "sr25519" }).addFromUri(uri); } const NULL_12 = "\0".repeat(12); export function padTicker(ticker: string) { @@ -222,8 +218,16 @@ export async function keyToIdentityIds( accountKey: AccountId | KeyringPair["publicKey"] ): Promise { const api = await ApiSingleton.getInstance(); - let account_did = await api.query.identity.keyToIdentityIds(accountKey); - return account_did; + let opt_rec = await api.query.identity.keyRecords(accountKey); + if (opt_rec.isSome) { + const rec = opt_rec.unwrap(); + if (rec.isPrimaryKey) { + return rec.asPrimaryKey; + } else if (rec.isSecondaryKey) { + return rec.asSecondaryKey[0]; + } + } + return (0 as unknown); } // Returns the asset did @@ -241,35 +245,35 @@ export function tickerToDid(ticker: Ticker) { export async function generateStashKeys( accounts: string[] ): Promise { - const api = await ApiSingleton.getInstance(); let keys = []; await cryptoWaitReady(); - for (let i = 0; i < accounts.length; i++) { + for (let account of accounts) { keys.push( - new Keyring({ type: "sr25519" }).addFromUri(`//${accounts[i]}//stash`, { - name: `${accounts[i] + "_stash"}`, + new Keyring({ type: "sr25519" }).addFromUri(`//${account}//stash`, { + name: `${account + "_stash"}`, }) ); - let accountRawNonce = (await api.query.system.account(keys[i].address)) - .nonce; - let account_nonce = new BN(accountRawNonce.toString()); - nonces.set(keys[i].address, account_nonce); } return keys; } +export async function sendTx( + signer: KeyringPair, + tx: SubmittableExtrinsic<"promise"> +) { + return sendTransaction(signer, tx, -1); +} + export function sendTransaction( signer: KeyringPair, transaction: SubmittableExtrinsic<"promise">, - nonceObj: NonceObject + nonceObj: any ) { return new Promise((resolve, reject) => { const gettingUnsub = transaction.signAndSend( signer, nonceObj, (receipt) => { - const { status } = receipt; - if (receipt.isCompleted) { /* * isCompleted === isFinalized || isError, which means @@ -290,12 +294,10 @@ export function sendTransaction( if (dispatchError.isModule) { // known error const mod = dispatchError.asModule; - const { section, name, documentation } = - mod.registry.findMetaError( - new Uint8Array([mod.index.toNumber(), mod.error.toNumber()]) - ); + const { section, name, docs } = + mod.registry.findMetaError(mod); - message = `${section}.${name}: ${documentation.join(" ")}`; + message = `${section}.${name}: ${docs.join(" ")}`; } else if (dispatchError.isBadOrigin) { message = "Bad origin"; } else if (dispatchError.isCannotLookup) { @@ -336,18 +338,8 @@ export async function signatory(signer: KeyringPair, entity: KeyringPair) { return signatoryObj; } -export async function sendTx( - signer: KeyringPair, - tx: SubmittableExtrinsic<"promise"> -) { - let nonceObj = { nonce: nonces.get(signer.address) }; - nonces.set(signer.address, nonces.get(signer.address).addn(1)); - const result = await sendTransaction(signer, tx, nonceObj); - return result; -} - export function getDefaultPortfolio(did: IdentityId) { - return { did: did, kind: "Default" }; + return { did: did, kind: { Default: ""} }; } export async function getValidCddProvider(alice: KeyringPair) { @@ -388,22 +380,22 @@ export async function getValidCddProvider(alice: KeyringPair) { export async function getExpiries(length: number) { const api = await ApiSingleton.getInstance(); - let blockTime = api.consts.babe.expectedBlockTime; - let bondingDuration = api.consts.staking.bondingDuration; - let sessionPerEra = api.consts.staking.sessionsPerEra; - let session_length = api.consts.babe.epochDuration; - const currentBlockTime = await api.query.timestamp.now(); + let blockTime = (api.consts.babe.expectedBlockTime).toNumber(); + let bondingDuration = (api.consts.staking.bondingDuration).toNumber(); + let sessionPerEra = (api.consts.staking.sessionsPerEra).toNumber(); + let session_length = (api.consts.babe.epochDuration).toNumber(); + const currentBlockTime = (await api.query.timestamp.now()).toNumber(); const bondingTime = - bondingDuration.toNumber() * - sessionPerEra.toNumber() * - session_length.toNumber(); - let expiryTime = currentBlockTime.toNumber() + bondingTime * 1000; + bondingDuration * + sessionPerEra * + session_length; + let expiryTime = currentBlockTime + bondingTime * 1000; let expiries = []; for (let i = 1; i <= length; i++) { // Providing 15 block as the extra time - let temp = expiryTime + i * 5 * blockTime.toNumber(); + let temp = expiryTime + i * 5 * blockTime; expiries.push(temp); } return expiries; diff --git a/scripts/cli/tsconfig.json b/scripts/cli/tsconfig.json index e99f24c832..1bc6e37fcf 100644 --- a/scripts/cli/tsconfig.json +++ b/scripts/cli/tsconfig.json @@ -2,9 +2,10 @@ "compilerOptions": { "baseUrl": "", "paths": { - "polymesh-typegen/*": ["src/*"], + "polymesh-typegen/*": ["src/interfaces/*"], "@polkadot/api/augment": ["src/interfaces/augment-api.ts"], - "@polkadot/types/augment": ["src/interfaces/augment-types.ts"] + "@polkadot/types/augment": ["src/interfaces/augment-types.ts"], + "@polkadot/types/lookup": ["src/interfaces/types-lookup.ts"] }, "lib": ["ES2020"], "module": "commonjs", @@ -18,6 +19,6 @@ "resolveJsonModule": true, "skipLibCheck": true, }, - "include": ["src/tests/*", "src/util/*", "src/types.ts"], - "exclude": ["node_modules", "dist"] + "include": ["src/tests/*", "src/util/*", "src/types.ts", "src/__tests__"], + "exclude": ["node_modules"] } diff --git a/scripts/cli/util/init.js b/scripts/cli/util/init.mjs similarity index 96% rename from scripts/cli/util/init.js rename to scripts/cli/util/init.mjs index 1b98ca66a8..9c62a55f23 100644 --- a/scripts/cli/util/init.js +++ b/scripts/cli/util/init.mjs @@ -1,20 +1,24 @@ -const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api"); -const { +import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'; +import { cryptoWaitReady, blake2AsHex, mnemonicGenerate, -} = require("@polkadot/util-crypto"); -const { +} from "@polkadot/util-crypto"; +import { stringToU8a, u8aConcat, u8aFixLength, u8aToHex, -} = require("@polkadot/util"); -const BN = require("bn.js"); -const assert = require("assert"); -const fs = require("fs"); -const path = require("path"); -const cryptoRandomString = require('crypto-random-string'); +} from "@polkadot/util"; +import BN from "bn.js"; +import assert from "assert"; +import fs from "fs"; +import path from "path"; +import cryptoRandomString from 'crypto-random-string'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); let nonces = new Map(); @@ -233,8 +237,16 @@ const createIdentitiesWithExpiry = async function ( // Fetches DID that belongs to the Account Key async function keyToIdentityIds(api, accountKey) { - let account_did = await api.query.identity.keyToIdentityIds(accountKey); - return account_did.toHuman(); + let opt_rec = await api.query.identity.keyRecords(accountKey); + if (opt_rec.isSome) { + const rec = opt_rec.unwrap(); + if (rec.isPrimaryKey) { + return rec.asPrimaryKey.toHuman(); + } else if (rec.isPrimaryKey) { + return rec.asSecondaryKey[0].toHuman(); + } + } + return ""; } // Sends transfer_amount to accounts[] from alice diff --git a/scripts/cli/util/schema_check.js b/scripts/cli/util/schema_check.mjs similarity index 52% rename from scripts/cli/util/schema_check.js rename to scripts/cli/util/schema_check.mjs index fbb2971bf7..1284bb9e23 100644 --- a/scripts/cli/util/schema_check.js +++ b/scripts/cli/util/schema_check.mjs @@ -1,8 +1,4 @@ -// Set options as a parameter, environment variable, or rc file. -require = require("esm")(module /*, options*/); -module.exports = require("./init.js"); - -let { reqImports } = require("./init.js"); +import { reqImports } from "./init.mjs"; async function main() { try { diff --git a/scripts/cli/util/schema_test.sh b/scripts/cli/util/schema_test.sh index b698d02ba2..463a228112 100755 --- a/scripts/cli/util/schema_test.sh +++ b/scripts/cli/util/schema_test.sh @@ -2,7 +2,7 @@ set -e -( set -x; node ./util/schema_check.js args...; ) 2>&1 | tee output.log +( set -x; node ./util/schema_check.mjs args...; ) 2>&1 | tee output.log errLen=$(cat output.log | grep 'Unknown\ types\ found\|ErrorOccurred' | wc -l) diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 9f588c6b04..533cb184a6 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -3,16 +3,19 @@ function run_tests() { RUSTFLAGS="-Zinstrument-coverage -Clink-dead-code" \ LLVM_PROFILE_FILE="json5format-%m.profraw" \ - BUILD_DUMMY_WASM_BINARY=1 \ + SKIP_WASM_BUILD=1 RUST_BACKTRACE=1 \ + INTEGRATION_TEST=1 \ cargo test --tests \ --package pallet-staking \ --package pallet-group \ --package pallet-sudo \ + --package pallet-pips \ --package polymesh-primitives \ --package node-rpc-runtime-api \ --package pallet-transaction-payment \ --package polymesh-runtime-tests \ --package pallet-balances:0.1.0 \ + --package asset-metadata \ --features default_identity $* } diff --git a/scripts/event-listener/package.json b/scripts/event-listener/package.json index 64ff3b43c8..8e7d80ede3 100644 --- a/scripts/event-listener/package.json +++ b/scripts/event-listener/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "@polkadot/api": "0.81.1", + "@polkadot/api": "7.11.1", "bn.js": "^4.11.8", "bs58": "^4.0.1", "inquirer": "^6.3.1", diff --git a/scripts/event-listener/yarn.lock b/scripts/event-listener/yarn.lock index f4435d2dcf..2ba561b5cd 100644 --- a/scripts/event-listener/yarn.lock +++ b/scripts/event-listener/yarn.lock @@ -2,342 +2,433 @@ # yarn lockfile v1 -"@babel/runtime@^7.3.1", "@babel/runtime@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12" - dependencies: - regenerator-runtime "^0.13.2" - -"@polkadot/api-derive@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.81.1.tgz#0b29de12c024fffab196a7f9c0a48ea80311a418" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/api" "^0.81.1" - "@polkadot/types" "^0.81.1" - "@types/memoizee" "^0.4.2" - memoizee "^0.4.14" - -"@polkadot/api@0.81.1", "@polkadot/api@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.81.1.tgz#bc4feefd6d3aa2c69093a9f8a79bbc581ea72f2b" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/api-derive" "^0.81.1" - "@polkadot/extrinsics" "^0.81.1" - "@polkadot/rpc-provider" "^0.81.1" - "@polkadot/rpc-rx" "^0.81.1" - "@polkadot/storage" "^0.81.1" - "@polkadot/types" "^0.81.1" - "@polkadot/util-crypto" "^0.93.1" - -"@polkadot/extrinsics@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.81.1.tgz#5834c929151d201e8e0edc044131ed01f20c85f9" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/types" "^0.81.1" - "@polkadot/util" "^0.93.1" - -"@polkadot/jsonrpc@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.81.1.tgz#804bac1c698859220085d8bc3cb37725519b0dee" - dependencies: - "@babel/runtime" "^7.4.5" - -"@polkadot/rpc-core@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.81.1.tgz#85421218378090c507590a84afae89576cf786be" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/jsonrpc" "^0.81.1" - "@polkadot/rpc-provider" "^0.81.1" - "@polkadot/types" "^0.81.1" - "@polkadot/util" "^0.93.1" - -"@polkadot/rpc-provider@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.81.1.tgz#1605c858d3732dd28415d209ff9162dace49df6f" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/storage" "^0.81.1" - "@polkadot/util" "^0.93.1" - "@polkadot/util-crypto" "^0.93.1" - "@types/nock" "^10.0.3" - eventemitter3 "^3.1.0" - isomorphic-fetch "^2.2.1" - websocket "^1.0.28" - -"@polkadot/rpc-rx@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.81.1.tgz#08610053e7a68e15881d0def3f4d793d4821ef0a" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/rpc-core" "^0.81.1" - "@polkadot/rpc-provider" "^0.81.1" - "@types/memoizee" "^0.4.2" - "@types/rx" "^4.1.1" - memoizee "^0.4.14" - rxjs "^6.5.2" - -"@polkadot/storage@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.81.1.tgz#ffb5b7f63fcb35043c5cad52b7f6ff3c9e0e6070" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/types" "^0.81.1" - "@polkadot/util" "^0.93.1" - "@polkadot/util-crypto" "^0.93.1" - -"@polkadot/types@^0.81.1": - version "0.81.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.81.1.tgz#63505692224e047dd7b4631e7dbbd0b095f9149c" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/util" "^0.93.1" - "@polkadot/util-crypto" "^0.93.1" - -"@polkadot/util-crypto@^0.93.1": - version "0.93.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.93.1.tgz#5cd2506f601cd80b28f0556bb8dd3187857059a4" - dependencies: - "@babel/runtime" "^7.4.5" - "@polkadot/util" "^0.93.1" - "@polkadot/wasm-crypto" "^0.11.1" - "@types/bip39" "^2.4.2" - "@types/pbkdf2" "^3.0.0" - "@types/secp256k1" "^3.5.0" - "@types/xxhashjs" "^0.2.1" - bip39 "^2.5.0" - blakejs "^1.1.0" - js-sha3 "^0.8.0" - secp256k1 "^3.7.0" - tweetnacl "^1.0.1" - xxhashjs "^0.2.2" - -"@polkadot/util@^0.93.1": - version "0.93.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.93.1.tgz#d07d633b35e02640da1361259750c061022d4e05" - dependencies: - "@babel/runtime" "^7.4.5" - "@types/bn.js" "^4.11.5" - "@types/deasync" "^0.1.0" - bn.js "^4.11.8" - camelcase "^5.3.1" - chalk "^2.4.2" - ip-regex "^4.1.0" - moment "^2.24.0" - -"@polkadot/wasm-crypto@^0.11.1": - version "0.11.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-0.11.1.tgz#5f5544659a81b5706e757577f880001de21cd298" - -"@types/bip39@^2.4.2": - version "2.4.2" - resolved "https://registry.yarnpkg.com/@types/bip39/-/bip39-2.4.2.tgz#f5d6617212be496bb998d3969f657f77a10c5287" +"@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.9.tgz#d19fbf802d01a8cb6cf053a64e472d42c434ba72" + integrity sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg== dependencies: - "@types/node" "*" + regenerator-runtime "^0.13.4" -"@types/bn.js@^4.11.4", "@types/bn.js@^4.11.5": - version "4.11.5" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.5.tgz#40e36197433f78f807524ec623afcf0169ac81dc" +"@noble/hashes@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.0.0.tgz#d5e38bfbdaba174805a4e649f13be9a9ed3351ae" + integrity sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg== + +"@noble/secp256k1@1.5.5": + version "1.5.5" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.5.5.tgz#315ab5745509d1a8c8e90d0bdf59823ccf9bcfc3" + integrity sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ== + +"@polkadot/api-augment@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-7.11.1.tgz#9866afe3281ae8371c8c645e73e848bac1f6fcd3" + integrity sha512-CqtmRZsr7va45r/wnsH+NZMqPyUQv46fmiHxt5gq6NC4p0ziDEVVDDHLlABx5RhQzCvdiBAccZ/X8DyMCFFGEA== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/api-base" "7.11.1" + "@polkadot/rpc-augment" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-augment" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/util" "^8.4.1" + +"@polkadot/api-base@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-7.11.1.tgz#fb27a7c33808a8f6542b322ffb3c6702a9e15ea8" + integrity sha512-MATI9tm0x3rRlipLMevWzJ4cGvMyrUGyOfwjMg3Z67U7atZgZ93LzowjzDcvSgFVM14d1tBOVWBKkCKnk7C6Zg== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/rpc-core" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/util" "^8.4.1" + rxjs "^7.5.4" + +"@polkadot/api-derive@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-7.11.1.tgz#ede6119577b08d6c94767551dc6ad17c6be64149" + integrity sha512-py7pqs5mLaKPNDvRZ7BcUC7obsbLIuzJT/kZFiGzJXmaObSzU2lJkGD7fV34QlpmGP+Bqb4KtlhtY+Tnq33C0w== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/api" "7.11.1" + "@polkadot/api-augment" "7.11.1" + "@polkadot/api-base" "7.11.1" + "@polkadot/rpc-core" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/util" "^8.4.1" + "@polkadot/util-crypto" "^8.4.1" + rxjs "^7.5.4" + +"@polkadot/api@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-7.11.1.tgz#0aeb86319a14a9a2a071476e6a47ee3d6b8e116c" + integrity sha512-VTrhVuSJrWhIww1ofYPd7EhJd1UwKntfdPNRuy/abfb6GPzYCglKV6Sze3CsbI2KawC5oo1K7Ffrdf/lJy81kg== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/api-augment" "7.11.1" + "@polkadot/api-base" "7.11.1" + "@polkadot/api-derive" "7.11.1" + "@polkadot/keyring" "^8.4.1" + "@polkadot/rpc-augment" "7.11.1" + "@polkadot/rpc-core" "7.11.1" + "@polkadot/rpc-provider" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-augment" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/types-create" "7.11.1" + "@polkadot/types-known" "7.11.1" + "@polkadot/util" "^8.4.1" + "@polkadot/util-crypto" "^8.4.1" + eventemitter3 "^4.0.7" + rxjs "^7.5.4" + +"@polkadot/keyring@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-8.7.1.tgz#07cf6d6ee351dcf70fbf965b1d6d96c5025ae1b8" + integrity sha512-t6ZgQVC+nQT7XwbWtEhkDpiAzxKVJw8Xd/gWdww6xIrawHu7jo3SGB4QNdPgkf8TvDHYAAJiupzVQYAlOIq3GA== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "8.7.1" + "@polkadot/util-crypto" "8.7.1" + +"@polkadot/networks@8.7.1", "@polkadot/networks@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-8.7.1.tgz#26c2ec6158c985bb77c510d98a3ab1c7e049f89c" + integrity sha512-8xAmhDW0ry5EKcEjp6VTuwoTm0DdDo/zHsmx88P6sVL87gupuFsL+B6TrsYLl8GcaqxujwrOlKB+CKTUg7qFKg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "8.7.1" + "@substrate/ss58-registry" "^1.17.0" + +"@polkadot/rpc-augment@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-7.11.1.tgz#c77bbdae20e3933ddd2d8eea243a215e35a6861f" + integrity sha512-cP/g6dM5Rmdeno+sOi/PBvAEycRoi/UI1MOKb0lVhlFJayw/uyGOhHtPKOnLh2fyDJ/q66HO3pu6aem3ORFwhQ== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/rpc-core" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/util" "^8.4.1" + +"@polkadot/rpc-core@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-7.11.1.tgz#079f2c70e09015d01bfec92f06993a5538399072" + integrity sha512-Bp71BwOSPT4/xmYWn9e9/ikGKYYmltbceVwa0MJiuKI0Xd5YntjtJVov17Fqlt+eddkLGt74750paykvHDJWWQ== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/rpc-augment" "7.11.1" + "@polkadot/rpc-provider" "7.11.1" + "@polkadot/types" "7.11.1" + "@polkadot/util" "^8.4.1" + rxjs "^7.5.4" + +"@polkadot/rpc-provider@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-7.11.1.tgz#f0cf70c4fa3b69fb96aafbed07f8d5725db9cca8" + integrity sha512-07Mg+r9swMjNISDK8ntDI5gFZU8rtHeoB27/qQwZzcWugogva8rNhaInBikZPKlF7yxM6l2VMaQnOziKUNsnRw== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/keyring" "^8.4.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-support" "7.11.1" + "@polkadot/util" "^8.4.1" + "@polkadot/util-crypto" "^8.4.1" + "@polkadot/x-fetch" "^8.4.1" + "@polkadot/x-global" "^8.4.1" + "@polkadot/x-ws" "^8.4.1" + eventemitter3 "^4.0.7" + mock-socket "^9.1.2" + nock "^13.2.4" + +"@polkadot/types-augment@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-7.11.1.tgz#2c56779dbd1cff509609db912fcc2575e0983828" + integrity sha512-jCnZ/eMkLaqSKl5q4JwBxslhAaJSSNHt04reZRs1i2jlC2UVgiFN1Rr5GJmHYAwDPoFcge/rAm6bckfhXUIdOw== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/types" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/util" "^8.4.1" + +"@polkadot/types-codec@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-7.11.1.tgz#4cfcd8ab81f6ba510a984c08eb11861b33acab38" + integrity sha512-rDM/FYcnou2Chy+urd7U41lcjM6jWUEUydyP9NuTOSAamCGtH0eKw52GURKTsKTT5r8wJdPMKv/yNxs1i+l5Lw== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/util" "^8.4.1" + +"@polkadot/types-create@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-7.11.1.tgz#878b5bdf278ca9456195980aa91957979a4e9342" + integrity sha512-nVYaJC/IDsM4WM9WGjAI7qQ9scPSlBqqzwqLdvXCJeq3trOTt68x39DD0zp0hzJ/7MeXjPToDDWjpAF0B9mWSQ== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/types-codec" "7.11.1" + "@polkadot/util" "^8.4.1" + +"@polkadot/types-known@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-7.11.1.tgz#55c42aae31813360ea54e438a761b0c48392f148" + integrity sha512-BBqQxG7I+wUjeLby1u5p9aSoZ5Vy0oCwmm/aKN64JH9vBEz1OOA0pRdcCooGCG/884Wb5pRpacWTepQMQkOTLw== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/networks" "^8.4.1" + "@polkadot/types" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/types-create" "7.11.1" + "@polkadot/util" "^8.4.1" + +"@polkadot/types-support@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-7.11.1.tgz#509d942c8a9c0670a20b77fc1c98c97b7151b75e" + integrity sha512-pJmDUHK7DOO6mjpntxq9Lq0tjvqwc15FrrrNbuENgRiOueRqcAlzv+V80wdzoIBUwINgKphtpzu+rdQIYsVVQg== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/util" "^8.4.1" + +"@polkadot/types@7.11.1": + version "7.11.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-7.11.1.tgz#aefdd0efa98b43ebf516947a845e12fc5d63e9ae" + integrity sha512-jxVrxIbsSfH9xK1Q3vaCfJmbkm0OlvoXz0GxdP5RJ7dQnxlNYWQUXanFkKebbRL8gSEs1wSRVccil/TSH65Nvg== + dependencies: + "@babel/runtime" "^7.17.2" + "@polkadot/keyring" "^8.4.1" + "@polkadot/types-augment" "7.11.1" + "@polkadot/types-codec" "7.11.1" + "@polkadot/types-create" "7.11.1" + "@polkadot/util" "^8.4.1" + "@polkadot/util-crypto" "^8.4.1" + rxjs "^7.5.4" + +"@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-8.7.1.tgz#f9fcca2895b5f160ce1c2faa0aa3054cc7aa4655" + integrity sha512-TaSuJ2aNrB5sYK7YXszkEv24nYJKRFqjF2OrggoMg6uYxUAECvTkldFnhtgeizMweRMxJIBu6bMHlSIutbWgjw== + dependencies: + "@babel/runtime" "^7.17.8" + "@noble/hashes" "1.0.0" + "@noble/secp256k1" "1.5.5" + "@polkadot/networks" "8.7.1" + "@polkadot/util" "8.7.1" + "@polkadot/wasm-crypto" "^5.1.1" + "@polkadot/x-bigint" "8.7.1" + "@polkadot/x-randomvalues" "8.7.1" + "@scure/base" "1.0.0" + ed2curve "^0.3.0" + tweetnacl "^1.0.3" + +"@polkadot/util@8.7.1", "@polkadot/util@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-8.7.1.tgz#27fe93bf7b8345276f10cfe9c0380510cd4584f6" + integrity sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-bigint" "8.7.1" + "@polkadot/x-global" "8.7.1" + "@polkadot/x-textdecoder" "8.7.1" + "@polkadot/x-textencoder" "8.7.1" + "@types/bn.js" "^5.1.0" + bn.js "^5.2.0" + ip-regex "^4.3.0" + +"@polkadot/wasm-crypto-asmjs@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-5.1.1.tgz#6648e9c6f627501f61aef570e110022f2be1eff2" + integrity sha512-1WBwc2G3pZMKW1T01uXzKE30Sg22MXmF3RbbZiWWk3H2d/Er4jZQRpjumxO5YGWan+xOb7HQQdwnrUnrPgbDhg== dependencies: - "@types/node" "*" - -"@types/deasync@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@types/deasync/-/deasync-0.1.0.tgz#b2bd6c3fcde3cf67b8be4c2f70136ba8f157b45a" + "@babel/runtime" "^7.17.8" -"@types/memoizee@^0.4.2": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@types/memoizee/-/memoizee-0.4.2.tgz#a500158999a8144a9b46cf9a9fb49b15f1853573" - -"@types/nock@^10.0.3": - version "10.0.3" - resolved "https://registry.yarnpkg.com/@types/nock/-/nock-10.0.3.tgz#dab1d18ffbccfbf2db811dab9584304eeb6e1c4c" +"@polkadot/wasm-crypto-wasm@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-5.1.1.tgz#dc371755a05fe93f87a2754a2bcf1ff42e4bb541" + integrity sha512-F9PZ30J2S8vUNl2oY7Myow5Xsx5z5uNVpnNlJwlmY8IXBvyucvyQ4HSdhJsrbs4W1BfFc0mHghxgp0FbBCnf/Q== dependencies: - "@types/node" "*" + "@babel/runtime" "^7.17.8" -"@types/node@*": - version "12.0.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.8.tgz#551466be11b2adc3f3d47156758f610bd9f6b1d8" - -"@types/node@^10.12.18": - version "10.14.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.9.tgz#2e8d678039d27943ce53a1913386133227fd9066" - -"@types/pbkdf2@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.0.0.tgz#5d9ca5f12a78a08cc89ad72883ad4a30af359229" +"@polkadot/wasm-crypto@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-5.1.1.tgz#d1f8a0da631028ba904c374c1e8496ab3ba4636b" + integrity sha512-JCcAVfH8DhYuEyd4oX1ouByxhou0TvpErKn8kHjtzt7+tRoFi0nzWlmK4z49vszsV3JJgXxV81i10C0BYlwTcQ== dependencies: - "@types/node" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/wasm-crypto-asmjs" "^5.1.1" + "@polkadot/wasm-crypto-wasm" "^5.1.1" -"@types/rx-core-binding@*": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz#d969d32f15a62b89e2862c17b3ee78fe329818d3" +"@polkadot/x-bigint@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-8.7.1.tgz#a496225def32e98c430c76b91c1579f48acf501a" + integrity sha512-ClkhgdB/KqcAKk3zA6Qw8wBL6Wz67pYTPkrAtImpvoPJmR+l4RARauv+MH34JXMUNlNb3aUwqN6lq2Z1zN+mJg== dependencies: - "@types/rx-core" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" -"@types/rx-core@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-core/-/rx-core-4.0.3.tgz#0b3354b1238cedbe2b74f6326f139dbc7a591d60" - -"@types/rx-lite-aggregates@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz#6efb2b7f3d5f07183a1cb2bd4b1371d7073384c2" +"@polkadot/x-fetch@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-8.7.1.tgz#dc866e7aa87c39b2e64c87f734b8fbaf1b9190e1" + integrity sha512-ygNparcalYFGbspXtdtZOHvNXZBkNgmNO+um9C0JYq74K5OY9/be93uyfJKJ8JcRJtOqBfVDsJpbiRkuJ1PRfg== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + "@types/node-fetch" "^2.6.1" + node-fetch "^2.6.7" -"@types/rx-lite-async@*": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz#27fbf0caeff029f41e2d2aae638b05e91ceb600c" +"@polkadot/x-global@8.7.1", "@polkadot/x-global@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-8.7.1.tgz#b972044125a4fe059f4aef7c15a4e22d18179095" + integrity sha512-WOgUor16IihgNVdiTVGAWksYLUAlqjmODmIK1cuWrLOZtV1VBomWcb3obkO9sh5P6iWziAvCB/i+L0vnTN9ZCA== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" -"@types/rx-lite-backpressure@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz#05abb19bdf87cc740196c355e5d0b37bb50b5d56" +"@polkadot/x-randomvalues@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-8.7.1.tgz#b7cc358c2a6d20f7e7798d45d1d5c7ac8c9ab4f2" + integrity sha512-njt17MlfN6yNyNEti7fL12lr5qM6A1aSGkWKVuqzc7XwSBesifJuW4km5u6r2gwhXjH2eHDv9SoQ7WXu8vrrkg== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" -"@types/rx-lite-coincidence@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz#80bd69acc4054a15cdc1638e2dc8843498cd85c0" +"@polkadot/x-textdecoder@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz#b706ef98d5a033d02c633009fb8dab4a4f9d7d55" + integrity sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" -"@types/rx-lite-experimental@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz#c532f5cbdf3f2c15da16ded8930d1b2984023cbd" +"@polkadot/x-textencoder@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz#7820e30081e8e0a607c1c27b9e3486d82d1a723e" + integrity sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" -"@types/rx-lite-joinpatterns@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz#f70fe370518a8432f29158cc92ffb56b4e4afc3e" +"@polkadot/x-ws@^8.4.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-8.7.1.tgz#501c63c575e04bba68bdc32448e2c9b692f0411e" + integrity sha512-Mt0tcNzGXyKnN3DQ06alkv+JLtTfXWu6zSypFrrKHSQe3u79xMQ1nSicmpT3gWLhIa8YF+8CYJXMrqaXgCnDhw== dependencies: - "@types/rx-lite" "*" + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + "@types/websocket" "^1.0.5" + websocket "^1.0.34" -"@types/rx-lite-testing@*": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz#21b19d11f4dfd6ffef5a9d1648e9c8879bfe21e9" - dependencies: - "@types/rx-lite-virtualtime" "*" +"@scure/base@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.0.0.tgz#109fb595021de285f05a7db6806f2f48296fcee7" + integrity sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA== -"@types/rx-lite-time@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz#0eda65474570237598f3448b845d2696f2dbb1c4" +"@substrate/ss58-registry@^1.17.0": + version "1.18.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.18.0.tgz#0744480e880ae8e557327557a2a7fc95577292ec" + integrity sha512-nAA1qsorxgdDnx5ie/FL90nM2riTNn72wIq8jtWsR8trsk1uTIHJgQQjEgviFCtMg4Ws9bEjo8DkWBgVGdPFmw== + +"@types/bn.js@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68" + integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA== dependencies: - "@types/rx-lite" "*" + "@types/node" "*" -"@types/rx-lite-virtualtime@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz#4b30cacd0fe2e53af29f04f7438584c7d3959537" +"@types/node-fetch@^2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975" + integrity sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA== dependencies: - "@types/rx-lite" "*" + "@types/node" "*" + form-data "^3.0.0" -"@types/rx-lite@*": - version "4.0.6" - resolved "https://registry.yarnpkg.com/@types/rx-lite/-/rx-lite-4.0.6.tgz#3c02921c4244074234f26b772241bcc20c18c253" +"@types/node@*": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" + integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== + +"@types/pbkdf2@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" + integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== dependencies: - "@types/rx-core" "*" - "@types/rx-core-binding" "*" + "@types/node" "*" -"@types/rx@^4.1.1": - version "4.1.1" - resolved "https://registry.yarnpkg.com/@types/rx/-/rx-4.1.1.tgz#598fc94a56baed975f194574e0f572fd8e627a48" - dependencies: - "@types/rx-core" "*" - "@types/rx-core-binding" "*" - "@types/rx-lite" "*" - "@types/rx-lite-aggregates" "*" - "@types/rx-lite-async" "*" - "@types/rx-lite-backpressure" "*" - "@types/rx-lite-coincidence" "*" - "@types/rx-lite-experimental" "*" - "@types/rx-lite-joinpatterns" "*" - "@types/rx-lite-testing" "*" - "@types/rx-lite-time" "*" - "@types/rx-lite-virtualtime" "*" - -"@types/secp256k1@^3.5.0": - version "3.5.0" - resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-3.5.0.tgz#0f3baf16b07488c6da2633a63b4160bcf8d0fd5b" +"@types/secp256k1@^4.0.1": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz#1b8e55d8e00f08ee7220b4d59a6abe89c37a901c" + integrity sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w== dependencies: "@types/node" "*" -"@types/xxhashjs@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@types/xxhashjs/-/xxhashjs-0.2.1.tgz#6cd06b2eca5228765ff45960cf2c2a557ddf109a" +"@types/websocket@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.5.tgz#3fb80ed8e07f88e51961211cd3682a3a4a81569c" + integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== dependencies: "@types/node" "*" ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" + integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" -base-x@^3.0.2: - version "3.0.7" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.7.tgz#1c5a7fafe8f66b4114063e8da102799d4e7c408f" - integrity sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw== - dependencies: - safe-buffer "^5.0.1" - -bindings@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - dependencies: - file-uri-to-path "1.0.0" +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -bip39@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.6.0.tgz#9e3a720b42ec8b3fbe4038f1e445317b6a99321c" - dependencies: - create-hash "^1.1.0" - pbkdf2 "^3.0.9" - randombytes "^2.0.1" - safe-buffer "^5.0.1" - unorm "^1.3.3" - -bip66@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/bip66/-/bip66-1.1.5.tgz#01fa8748785ca70955d5011217d1b3139969ca22" +base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== dependencies: safe-buffer "^5.0.1" blakejs@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== bn.js@4.11.6: version "4.11.6" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= -bn.js@4.11.8, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" +bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -brorand@^1.0.1: +bn.js@^5.1.2, bn.js@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + +brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= -browserify-aes@^1.0.6: +browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== dependencies: buffer-xor "^1.0.3" cipher-base "^1.0.0" @@ -346,28 +437,38 @@ browserify-aes@^1.0.6: inherits "^2.0.1" safe-buffer "^5.0.1" -bs58@^4.0.1: +bs58@^4.0.0, bs58@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo= dependencies: base-x "^3.0.2" -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" +bufferutil@^4.0.1: + version "4.0.6" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.6.tgz#ebd6c67c7922a0e902f053e5d8be5ec850e48433" + integrity sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw== + dependencies: + node-gyp-build "^4.3.0" chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" @@ -376,10 +477,12 @@ chalk@^2.4.2: chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -387,26 +490,38 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= dependencies: restore-cursor "^2.0.0" cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" + integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== dependencies: cipher-base "^1.0.1" inherits "^2.0.1" @@ -414,9 +529,10 @@ create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: ripemd160 "^2.0.1" sha.js "^2.4.0" -create-hmac@^1.1.4: +create-hmac@^1.1.4, create-hmac@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== dependencies: cipher-base "^1.0.3" create-hash "^1.1.0" @@ -425,13 +541,10 @@ create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cuint@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" - -d@1: +d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== dependencies: es5-ext "^0.10.50" type "^1.0.1" @@ -439,146 +552,144 @@ d@1: debug@^2.2.0: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" - dependencies: - mimic-response "^1.0.0" - -define-properties@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" +debug@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: - object-keys "^1.0.12" + ms "2.1.2" -dom-walk@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -drbg.js@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b" +ed2curve@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/ed2curve/-/ed2curve-0.3.0.tgz#322b575152a45305429d546b071823a93129a05d" + integrity sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ== dependencies: - browserify-aes "^1.0.6" - create-hash "^1.1.2" - create-hmac "^1.1.4" + tweetnacl "1.x.x" -elliptic@^6.4.0, elliptic@^6.4.1: - version "6.4.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" +elliptic@^6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" + bn.js "^4.11.9" + brorand "^1.1.0" hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - -es-abstract@^1.5.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" - dependencies: - es-to-primitive "^1.2.0" - function-bind "^1.1.1" - has "^1.0.3" - is-callable "^1.1.4" - is-regex "^1.0.4" - object-keys "^1.0.12" - -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" -es5-ext@^0.10.35, es5-ext@^0.10.45, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.50" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.50.tgz#6d0e23a0abdb27018e5ac4fd09b412bc5517a778" +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.61" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" + integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.1" - next-tick "^1.0.0" + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" -es6-iterator@^2.0.3, es6-iterator@~2.0.3: +es6-iterator@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= dependencies: d "1" es5-ext "^0.10.35" es6-symbol "^3.1.1" -es6-symbol@^3.1.1, es6-symbol@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== dependencies: - d "1" - es5-ext "~0.10.14" - -es6-weak-map@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" - dependencies: - d "1" - es5-ext "^0.10.46" - es6-iterator "^2.0.3" - es6-symbol "^3.1.1" + d "^1.0.1" + ext "^1.1.2" escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" +ethereum-bloom-filters@^1.0.6: + version "1.0.10" + resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz#3ca07f4aed698e75bd134584850260246a5fed8a" + integrity sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA== dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" + js-sha3 "^0.8.0" -ethjs-unit@^0.1.6: +ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereumjs-util@^7.1.0: + version "7.1.4" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz#a6885bcdd92045b06f596c7626c3e89ab3312458" + integrity sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + +ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= dependencies: bn.js "4.11.6" number-to-bn "1.7.0" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - dependencies: - d "1" - es5-ext "~0.10.14" - -eventemitter3@^3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" +eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== dependencies: md5.js "^1.3.4" safe-buffer "^5.1.1" +ext@^1.1.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== + dependencies: + type "^2.5.0" + external-editor@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" @@ -587,79 +698,66 @@ external-editor@^3.0.3: figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= dependencies: escape-string-regexp "^1.0.5" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - -for-each@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" - dependencies: - is-callable "^1.1.3" - -function-bind@^1.0.2, function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - -global@~4.3.0: - version "4.3.2" - resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f" +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== dependencies: - min-document "^2.19.0" - process "~0.5.1" + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - -has@^1.0.1, has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - dependencies: - function-bind "^1.1.1" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= hash-base@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" -hash.js@^1.0.0, hash.js@^1.0.3: +hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hmac-drbg@^1.0.0: +hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= dependencies: hash.js "^1.0.3" minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -iconv-lite@^0.4.24, iconv-lite@~0.4.13: +iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" -inherits@^2.0.1, inherits@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== inquirer@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.3.1.tgz#7a413b5e7950811013a3db491c61d1f3b776e8e7" + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== dependencies: ansi-escapes "^3.2.0" chalk "^2.4.2" @@ -667,7 +765,7 @@ inquirer@^6.3.1: cli-width "^2.0.0" external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.17.11" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" rxjs "^6.4.0" @@ -675,187 +773,167 @@ inquirer@^6.3.1: strip-ansi "^5.1.0" through "^2.3.6" -ip-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.1.0.tgz#5ad62f685a14edb421abebc2fff8db94df67b455" - -is-callable@^1.1.3, is-callable@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" +ip-regex@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" + integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-function@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= is-hex-prefixed@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" - -is-promise@^2.1, is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-regex@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - dependencies: - has "^1.0.1" - -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - dependencies: - has-symbols "^1.0.0" + integrity sha1-fY035q135dEnFIkTxXPggtd39VQ= is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - -isomorphic-fetch@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -lodash@^4.17.11: +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +keccak@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" + integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + +lodash.set@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" + integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= + +lodash@^4.17.12: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -lru-queue@0.1: - version "0.1.0" - resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" - dependencies: - es5-ext "~0.10.2" - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== dependencies: hash-base "^3.0.0" inherits "^2.0.1" safe-buffer "^5.1.2" -memoizee@^0.4.14: - version "0.4.14" - resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.14.tgz#07a00f204699f9a95c2d9e77218271c7cd610d57" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: - d "1" - es5-ext "^0.10.45" - es6-weak-map "^2.0.2" - event-emitter "^0.3.5" - is-promise "^2.1" - lru-queue "0.1" - next-tick "1" - timers-ext "^0.1.5" + mime-db "1.52.0" mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" - -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" - dependencies: - dom-walk "^0.1.0" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: +minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -moment@^2.24.0: - version "2.24.0" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" +mock-socket@^9.1.2: + version "9.1.3" + resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.1.3.tgz#bcb106c6b345001fa7619466fcf2f8f5a156b10f" + integrity sha512-uz8lx8c5wuJYJ21f5UtovqpV0+KJuVwE7cVOLNhrl2QW/CvmstOLRfjXnLSbfFHZtJtiaSGQu0oCJA8SmRcK6A== ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -nan@^2.11.0, nan@^2.14.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== -next-tick@1, next-tick@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" +nock@^13.2.4: + version "13.2.4" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.4.tgz#43a309d93143ee5cdcca91358614e7bde56d20e1" + integrity sha512-8GPznwxcPNCH/h8B+XZcKjYPXnUV5clOKCjAqyjsiqA++MpNx9E9+t8YPp0MbThO+KauRo7aZJ1WuIZmOrT2Ug== + dependencies: + debug "^4.1.0" + json-stringify-safe "^5.0.1" + lodash.set "^4.3.2" + propagate "^2.0.0" -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + +node-fetch@^2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" + whatwg-url "^5.0.0" + +node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" + integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== number-to-bn@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" + integrity sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= dependencies: bn.js "4.11.6" strip-hex-prefix "1.0.0" -object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-keys@^1.0.12: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - -once@^1.3.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= dependencies: mimic-fn "^1.0.0" os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -parse-headers@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.2.tgz#9545e8a4c1ae5eaea7d24992bca890281ed26e34" - dependencies: - for-each "^0.3.3" - string.prototype.trim "^1.1.2" - -pbkdf2@^3.0.9: - version "3.0.17" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" +pbkdf2@^3.0.17: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" + integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== dependencies: create-hash "^1.1.2" create-hmac "^1.1.4" @@ -863,31 +941,36 @@ pbkdf2@^3.0.9: safe-buffer "^5.0.1" sha.js "^2.4.8" -process@~0.5.1: - version "0.5.2" - resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" +propagate@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" + integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== -randombytes@^2.0.1, randombytes@^2.1.0: +randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -regenerator-runtime@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +regenerator-runtime@^0.13.4: + version "0.13.9" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= dependencies: onetime "^2.0.0" signal-exit "^3.0.2" @@ -895,229 +978,227 @@ restore-cursor@^2.0.0: ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== dependencies: hash-base "^3.0.0" inherits "^2.0.1" -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" +rlp@^2.2.4: + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: - is-promise "^2.1.0" + bn.js "^5.2.0" -rxjs@^6.4.0, rxjs@^6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" +run-async@^2.2.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + +rxjs@^6.4.0: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" +rxjs@^7.5.4: + version "7.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f" + integrity sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw== + dependencies: + tslib "^2.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -secp256k1@^3.7.0: - version "3.7.1" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.7.1.tgz#12e473e0e9a7c2f2d4d4818e722ad0e14cc1e2f1" +scrypt-js@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== dependencies: - bindings "^1.5.0" - bip66 "^1.1.5" - bn.js "^4.11.8" - create-hash "^1.2.0" - drbg.js "^1.0.1" - elliptic "^6.4.1" - nan "^2.14.0" - safe-buffer "^5.1.2" + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -simple-concat@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" - -simple-get@^2.7.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string.prototype.trim@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== dependencies: - define-properties "^1.1.2" - es-abstract "^1.5.0" - function-bind "^1.0.2" + safe-buffer "~5.2.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" strip-ansi@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: ansi-regex "^4.1.0" strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha1-DF8VX+8RUTczd96du1iNoFUA428= dependencies: is-hex-prefixed "1.0.0" supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - -timers-ext@^0.1.5: - version "0.1.7" - resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" - dependencies: - es5-ext "~0.10.46" - next-tick "1" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + tslib@^1.9.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tweetnacl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" +tslib@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +tweetnacl@1.x.x, tweetnacl@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== type@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/type/-/type-1.0.1.tgz#084c9a17fcc9151a2cdb1459905c2e45e4bb7d61" + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" + integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== dependencies: is-typedarray "^1.0.0" -unorm@^1.3.3: - version "1.5.0" - resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.5.0.tgz#01fa9b76f1c60f7916834605c032aa8962c3f00a" +utf-8-validate@^5.0.2: + version "5.0.9" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.9.tgz#ba16a822fbeedff1a58918f2a6a6b36387493ea3" + integrity sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q== + dependencies: + node-gyp-build "^4.3.0" -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" +utf8@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== -utf8@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.1.tgz#2e01db02f7d8d0944f77104f1609eb0c304cf768" +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= web3-utils@^1.0.0-beta.55: - version "1.0.0-beta.55" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.0.0-beta.55.tgz#beb40926b7c04208b752d36a9bc959d27a04b308" - dependencies: - "@babel/runtime" "^7.3.1" - "@types/bn.js" "^4.11.4" - "@types/node" "^10.12.18" - bn.js "4.11.8" - eth-lib "0.2.8" - ethjs-unit "^0.1.6" - lodash "^4.17.11" + version "1.7.3" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.7.3.tgz#b214d05f124530d8694ad364509ac454d05f207c" + integrity sha512-g6nQgvb/bUpVUIxJE+ezVN+rYwYmlFyMvMIRSuqpi1dk6ApDD00YNArrk7sPcZnjvxOJ76813Xs2vIN2rgh4lg== + dependencies: + bn.js "^4.11.9" + ethereum-bloom-filters "^1.0.6" + ethereumjs-util "^7.1.0" + ethjs-unit "0.1.6" number-to-bn "1.7.0" randombytes "^2.1.0" - utf8 "2.1.1" + utf8 "3.0.0" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= -websocket@^1.0.28: - version "1.0.28" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.28.tgz#9e5f6fdc8a3fe01d4422647ef93abdd8d45a78d3" +websocket@^1.0.34: + version "1.0.34" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" + integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== dependencies: + bufferutil "^4.0.1" debug "^2.2.0" - nan "^2.11.0" + es5-ext "^0.10.50" typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" yaeti "^0.0.6" -whatwg-fetch@>=0.10.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -xhr-request-promise@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz#343c44d1ee7726b8648069682d0f840c83b4261d" - dependencies: - xhr-request "^1.0.1" - -xhr-request@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.5.0.tgz#bed8d1676d5ca36108667692b74b316c496e49dd" - dependencies: - global "~4.3.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" - -xtend@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - -xxhashjs@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/xxhashjs/-/xxhashjs-0.2.2.tgz#8a6251567621a1c46a5ae204da0249c7f8caa9d8" +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= dependencies: - cuint "^0.2.2" + tr46 "~0.0.3" + webidl-conversions "^3.0.0" yaeti@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..19e2e1eb1c --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,7 @@ +sonar.organization=polymathnetwork-1 +sonar.projectKey=PolymathNetwork_Polymesh +sonar.projectName=Polymesh +sonar.sources=. +sonar.host.url=https://sonarcloud.io +sonar.sourceEncoding=UTF-8 +sonar.externalIssuesReportPaths=sonar.json diff --git a/src/chain_spec.rs b/src/chain_spec.rs index 797890d856..e704572bcf 100644 --- a/src/chain_spec.rs +++ b/src/chain_spec.rs @@ -5,7 +5,7 @@ use pallet_bridge::BridgeTx; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_staking::StakerStatus; use polymesh_common_utilities::{ - constants::{currency::POLY, REWARDS_MODULE_ID, TREASURY_MODULE_ID}, + constants::{currency::POLY, REWARDS_PALLET_ID, TREASURY_PALLET_ID}, protocol_fee::ProtocolOp, MaybeBlock, SystematicIssuers, }; @@ -13,7 +13,7 @@ use polymesh_primitives::{ identity_id::GenesisIdentityRecord, AccountId, Balance, HexAccountId, IdentityId, Moment, PosRatio, SecondaryKey, Signatory, Signature, Ticker, }; -use sc_chain_spec::ChainType; +use sc_chain_spec::{ChainSpecExtension, ChainType}; use sc_service::Properties; use sc_telemetry::TelemetryEndpoints; use serde_json::json; @@ -46,6 +46,33 @@ const DEV_TREASURY: u128 = 50_000_000 * POLY; const INITIAL_BOND: u128 = 500 * POLY; +// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. +const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); +const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = + sp_consensus_babe::BabeEpochConfiguration { + c: PRIMARY_PROBABILITY, + allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots, + }; +const BABE_GENESIS: pallet_babe::GenesisConfig = pallet_babe::GenesisConfig { + authorities: vec![], + epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), +}; + +/// Node `ChainSpec` extensions. +/// +/// Additional parameters for some Substrate core modules, +/// customizable from the chain spec. +#[derive(Default, Clone, Serialize, Deserialize, ChainSpecExtension)] +#[serde(rename_all = "camelCase")] +pub struct Extensions { + /// The light sync state. + /// + /// This value will be set by the `sync-state rpc` implementation. + pub light_sync_state: sc_sync_state_rpc::LightSyncStateExtension, +} + +pub type GenericChainSpec = sc_service::GenericChainSpec; + /// Generate a crypto pair from seed. pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) @@ -355,14 +382,14 @@ fn genesis_processed_data( complete_txs.push(BridgeTx { nonce: treasury_bridge_lock.nonce, - recipient: TREASURY_MODULE_ID.into_account(), + recipient: TREASURY_PALLET_ID.into_account(), amount: treasury_bridge_lock.amount, tx_hash: treasury_bridge_lock.tx_hash, }); complete_txs.push(BridgeTx { nonce: rewards_bridge_lock.nonce, - recipient: REWARDS_MODULE_ID.into_account(), + recipient: REWARDS_PALLET_ID.into_account(), amount: rewards_bridge_lock.amount, tx_hash: rewards_bridge_lock.tx_hash, }); @@ -418,12 +445,7 @@ fn dev_genesis_processed_data( let mut complete_txs: Vec<_> = key_bridge_locks .iter() .cloned() - .zip( - identity - .secondary_keys - .iter() - .map(|sk| sk.signer.as_account().unwrap().clone()), - ) + .zip(identity.secondary_keys.iter().map(|sk| sk.key.clone())) .map( |( BridgeLockId { @@ -443,14 +465,14 @@ fn dev_genesis_processed_data( complete_txs.push(BridgeTx { nonce: treasury_bridge_lock.nonce, - recipient: TREASURY_MODULE_ID.into_account(), + recipient: TREASURY_PALLET_ID.into_account(), amount: BOOTSTRAP_TREASURY, tx_hash: treasury_bridge_lock.tx_hash, }); complete_txs.push(BridgeTx { nonce: rewards_bridge_lock.nonce, - recipient: REWARDS_MODULE_ID.into_account(), + recipient: REWARDS_PALLET_ID.into_account(), amount: itn_rewards().into_iter().map(|(_, b)| b + (1 * POLY)).sum(), tx_hash: rewards_bridge_lock.tx_hash, }); @@ -476,7 +498,6 @@ fn bridge_signers() -> Vec> { fn frame(wasm_binary: Option<&[u8]>) -> frame_system::GenesisConfig { frame_system::GenesisConfig { code: wasm_binary.expect("WASM binary was not generated").to_vec(), - changes_trie_config: Default::default(), } } @@ -596,7 +617,7 @@ pub mod general { use super::*; use polymesh_runtime_develop::{self as rt, constants::time}; - pub type ChainSpec = sc_service::GenericChainSpec; + pub type ChainSpec = GenericChainSpec; session_keys!(); @@ -618,15 +639,15 @@ pub mod general { ); rt::runtime::GenesisConfig { - frame_system: Some(frame(rt::WASM_BINARY)), - pallet_asset: Some(asset!()), - pallet_checkpoint: Some(checkpoint!()), - pallet_identity: Some(pallet_identity::GenesisConfig { + system: frame(rt::WASM_BINARY), + asset: asset!(), + checkpoint: checkpoint!(), + identity: pallet_identity::GenesisConfig { identities: vec![identity], ..Default::default() - }), - pallet_balances: Some(Default::default()), - pallet_bridge: Some(pallet_bridge::GenesisConfig { + }, + balances: Default::default(), + bridge: pallet_bridge::GenesisConfig { admin: initial_authorities[0].1.clone(), creator: initial_authorities[0].1.clone(), signatures_required: 1, @@ -634,20 +655,20 @@ pub mod general { timelock: 10, bridge_limit: (100_000_000 * POLY, 1000), complete_txs, - }), - pallet_indices: Some(pallet_indices::GenesisConfig { indices: vec![] }), - pallet_sudo: Some(pallet_sudo::GenesisConfig { key: root_key }), - pallet_session: Some(session!(initial_authorities, session_keys)), - pallet_staking: Some(staking!( + }, + indices: pallet_indices::GenesisConfig { indices: vec![] }, + sudo: pallet_sudo::GenesisConfig { key: root_key }, + session: session!(initial_authorities, session_keys), + staking: staking!( initial_authorities, stakers, - PerThing::from_rational_approximation(1u64, 4u64) - )), - pallet_pips: Some(pips!(time::MINUTES, MaybeBlock::None, 25)), - pallet_im_online: Some(Default::default()), - pallet_authority_discovery: Some(Default::default()), - pallet_babe: Some(Default::default()), - pallet_grandpa: Some(Default::default()), + PerThing::from_rational(1u64, 4u64) + ), + pips: pips!(time::MINUTES, MaybeBlock::None, 25), + im_online: Default::default(), + authority_discovery: Default::default(), + babe: BABE_GENESIS, + grandpa: Default::default(), /* pallet_contracts: Some(pallet_contracts::GenesisConfig { current_schedule: pallet_contracts::Schedule { @@ -657,23 +678,23 @@ pub mod general { }), */ // Governance Council: - pallet_group_Instance1: Some(group_membership!(1)), - pallet_committee_Instance1: Some(committee!(1)), + committee_membership: group_membership!(1), + polymesh_committee: committee!(1), // CDD providers - pallet_group_Instance2: Some(group_membership!(1)), + cdd_service_providers: group_membership!(1), // Technical Committee: - pallet_group_Instance3: Some(group_membership!(1)), - pallet_committee_Instance3: Some(committee!(1)), + technical_committee_membership: group_membership!(1), + technical_committee: committee!(1), // Upgrade Committee: - pallet_group_Instance4: Some(group_membership!(1)), - pallet_committee_Instance4: Some(committee!(1)), - pallet_protocol_fee: Some(protocol_fee!()), - pallet_settlement: Some(Default::default()), - pallet_multisig: Some(pallet_multisig::GenesisConfig { + upgrade_committee_membership: group_membership!(1), + upgrade_committee: committee!(1), + protocol_fee: protocol_fee!(), + settlement: Default::default(), + multi_sig: pallet_multisig::GenesisConfig { transaction_version: 1, - }), - pallet_corporate_actions: Some(corporate_actions!()), - pallet_rewards: Some(rewards!()), + }, + corporate_action: corporate_actions!(), + rewards: rewards!(), } } @@ -705,7 +726,18 @@ pub mod general { genesis: impl 'static + Sync + Send + Fn() -> rt::runtime::GenesisConfig, ) -> ChainSpec { let props = Some(polymath_props(42)); - ChainSpec::from_genesis(name, id, ctype, genesis, vec![], None, None, props, None) + ChainSpec::from_genesis( + name, + id, + ctype, + genesis, + vec![], + None, + None, + None, + props, + <_>::default(), + ) } pub fn develop_config() -> ChainSpec { @@ -722,6 +754,7 @@ pub mod general { vec![ get_authority_keys_from_seed("Alice", false), get_authority_keys_from_seed("Bob", false), + get_authority_keys_from_seed("Charlie", false), ], seeded_acc_id("Alice"), true, @@ -732,11 +765,7 @@ pub mod general { REWARDS_LOCK_HASH, ), BridgeLockId::generate_bridge_locks(3, 20, DEV_KEYS, KEY_LOCK_HASH), - vec![ - seeded_acc_id("Charlie"), - seeded_acc_id("Dave"), - seeded_acc_id("Eve"), - ], + vec![seeded_acc_id("Dave"), seeded_acc_id("Eve")], ) } @@ -754,7 +783,7 @@ pub mod testnet { use super::*; use polymesh_runtime_testnet::{self as rt, constants::time}; - pub type ChainSpec = sc_service::GenericChainSpec; + pub type ChainSpec = GenericChainSpec; session_keys!(); @@ -775,15 +804,15 @@ pub mod testnet { ); rt::runtime::GenesisConfig { - frame_system: Some(frame(rt::WASM_BINARY)), - pallet_asset: Some(asset!()), - pallet_checkpoint: Some(checkpoint!()), - pallet_identity: Some(pallet_identity::GenesisConfig { + system: frame(rt::WASM_BINARY), + asset: asset!(), + checkpoint: checkpoint!(), + identity: pallet_identity::GenesisConfig { identities, ..Default::default() - }), - pallet_balances: Some(Default::default()), - pallet_bridge: Some(pallet_bridge::GenesisConfig { + }, + balances: Default::default(), + bridge: pallet_bridge::GenesisConfig { admin: root_key.clone(), creator: root_key.clone(), signatures_required: 3, @@ -791,20 +820,20 @@ pub mod testnet { timelock: time::MINUTES * 15, bridge_limit: (30_000 * POLY, 1 * time::DAYS), complete_txs, - }), - pallet_indices: Some(pallet_indices::GenesisConfig { indices: vec![] }), - pallet_sudo: Some(pallet_sudo::GenesisConfig { key: root_key }), - pallet_session: Some(session!(initial_authorities, session_keys)), - pallet_staking: Some(staking!( + }, + indices: pallet_indices::GenesisConfig { indices: vec![] }, + sudo: pallet_sudo::GenesisConfig { key: root_key }, + session: session!(initial_authorities, session_keys), + staking: staking!( initial_authorities, stakers, - PerThing::from_rational_approximation(1u64, 10u64) - )), - pallet_pips: Some(pips!(time::DAYS * 30, MaybeBlock::None, 1000)), - pallet_im_online: Some(Default::default()), - pallet_authority_discovery: Some(Default::default()), - pallet_babe: Some(Default::default()), - pallet_grandpa: Some(Default::default()), + PerThing::from_rational(1u64, 10u64) + ), + pips: pips!(time::DAYS * 30, MaybeBlock::None, 1000), + im_online: Default::default(), + authority_discovery: Default::default(), + babe: BABE_GENESIS, + grandpa: Default::default(), /* pallet_contracts: Some(pallet_contracts::GenesisConfig { current_schedule: pallet_contracts::Schedule { @@ -814,23 +843,23 @@ pub mod testnet { }), */ // Governing council - pallet_group_Instance1: Some(group_membership!(1, 2, 3)), // 3 GC members - pallet_committee_Instance1: Some(committee!(1, (2, 3))), // RC = 1, 2/3 votes required + committee_membership: group_membership!(1, 2, 3), // 3 GC members + polymesh_committee: committee!(1, (2, 3)), // RC = 1, 2/3 votes required // CDD providers - pallet_group_Instance2: Some(group_membership!(1)), + cdd_service_providers: group_membership!(1), // Technical Committee: - pallet_group_Instance3: Some(group_membership!(3, 4, 5)), // One GC member + genesis operator + Bridge Multisig - pallet_committee_Instance3: Some(committee!(3)), // RC = 3, 1/2 votes required + technical_committee_membership: group_membership!(3, 4, 5), // One GC member + genesis operator + Bridge Multisig + technical_committee: committee!(3), // RC = 3, 1/2 votes required // Upgrade Committee: - pallet_group_Instance4: Some(group_membership!(1)), // One GC member - pallet_committee_Instance4: Some(committee!(1)), // RC = 1, 1/2 votes required - pallet_protocol_fee: Some(protocol_fee!()), - pallet_settlement: Some(Default::default()), - pallet_multisig: Some(pallet_multisig::GenesisConfig { + upgrade_committee_membership: group_membership!(1), // One GC member + upgrade_committee: committee!(1), // RC = 1, 1/2 votes required + protocol_fee: protocol_fee!(), + settlement: Default::default(), + multi_sig: pallet_multisig::GenesisConfig { transaction_version: 1, - }), - pallet_corporate_actions: Some(corporate_actions!()), - pallet_rewards: Some(rewards!()), + }, + corporate_action: corporate_actions!(), + rewards: rewards!(), } } @@ -871,6 +900,7 @@ pub mod testnet { .expect("Testnet bootstrap telemetry url is valid; qed"), ), Some(&*"/polymesh/testnet"), + None, Some(polymath_props(42)), Default::default(), ) @@ -902,6 +932,7 @@ pub mod testnet { boot_nodes, None, None, + None, Some(polymath_props(42)), Default::default(), ) @@ -912,6 +943,7 @@ pub mod testnet { vec![ get_authority_keys_from_seed("Alice", false), get_authority_keys_from_seed("Bob", false), + get_authority_keys_from_seed("Charlie", false), ], seeded_acc_id("Eve"), true, @@ -936,6 +968,7 @@ pub mod testnet { boot_nodes, None, None, + None, Some(polymath_props(42)), Default::default(), ) @@ -946,7 +979,7 @@ pub mod mainnet { use super::*; use polymesh_runtime_mainnet::{self as rt, constants::time}; - pub type ChainSpec = sc_service::GenericChainSpec; + pub type ChainSpec = GenericChainSpec; session_keys!(); @@ -967,15 +1000,15 @@ pub mod mainnet { ); rt::runtime::GenesisConfig { - frame_system: Some(frame(rt::WASM_BINARY)), - pallet_asset: Some(asset!()), - pallet_checkpoint: Some(checkpoint!()), - pallet_identity: Some(pallet_identity::GenesisConfig { + system: frame(rt::WASM_BINARY), + asset: asset!(), + checkpoint: checkpoint!(), + identity: pallet_identity::GenesisConfig { identities, ..Default::default() - }), - pallet_balances: Some(Default::default()), - pallet_bridge: Some(pallet_bridge::GenesisConfig { + }, + balances: Default::default(), + bridge: pallet_bridge::GenesisConfig { admin: root_key.clone(), creator: root_key.clone(), signatures_required: 4, @@ -983,24 +1016,20 @@ pub mod mainnet { timelock: time::HOURS * 24, bridge_limit: (1_000_000_000 * POLY, 365 * time::DAYS), complete_txs, - }), - pallet_indices: Some(pallet_indices::GenesisConfig { indices: vec![] }), - pallet_sudo: Some(pallet_sudo::GenesisConfig { key: root_key }), - pallet_session: Some(session!(initial_authorities, session_keys)), - pallet_staking: Some(staking!( + }, + indices: pallet_indices::GenesisConfig { indices: vec![] }, + sudo: pallet_sudo::GenesisConfig { key: root_key }, + session: session!(initial_authorities, session_keys), + staking: staking!( initial_authorities, stakers, - PerThing::from_rational_approximation(1u64, 10u64) - )), - pallet_pips: Some(pips!( - time::DAYS * 30, - MaybeBlock::Some(time::DAYS * 90), - 1000 - )), - pallet_im_online: Some(Default::default()), - pallet_authority_discovery: Some(Default::default()), - pallet_babe: Some(Default::default()), - pallet_grandpa: Some(Default::default()), + PerThing::from_rational(1u64, 10u64) + ), + pips: pips!(time::DAYS * 30, MaybeBlock::Some(time::DAYS * 90), 1000), + im_online: Default::default(), + authority_discovery: Default::default(), + babe: BABE_GENESIS, + grandpa: Default::default(), /* pallet_contracts: Some(pallet_contracts::GenesisConfig { current_schedule: pallet_contracts::Schedule { @@ -1010,23 +1039,23 @@ pub mod mainnet { }), */ // Governing council - pallet_group_Instance1: Some(group_membership!(1, 2, 3)), // 3 GC members - pallet_committee_Instance1: Some(committee!(1, (2, 3))), // RC = 1, 2/3 votes required + committee_membership: group_membership!(1, 2, 3), // 3 GC members + polymesh_committee: committee!(1, (2, 3)), // RC = 1, 2/3 votes required // CDD providers - pallet_group_Instance2: Some(group_membership!(1)), // GC_1 is also a CDD provider + cdd_service_providers: group_membership!(1), // GC_1 is also a CDD provider // Technical Committee: - pallet_group_Instance3: Some(group_membership!(1)), // One GC member - pallet_committee_Instance3: Some(committee!(1)), // 1/2 votes required + technical_committee_membership: group_membership!(1), // One GC member + technical_committee: committee!(1), // 1/2 votes required // Upgrade Committee: - pallet_group_Instance4: Some(group_membership!(1)), // One GC member - pallet_committee_Instance4: Some(committee!(1)), // 1/2 votes required - pallet_protocol_fee: Some(protocol_fee!()), - pallet_settlement: Some(Default::default()), - pallet_multisig: Some(pallet_multisig::GenesisConfig { + upgrade_committee_membership: group_membership!(1), // One GC member + upgrade_committee: committee!(1), // 1/2 votes required + protocol_fee: protocol_fee!(), + settlement: Default::default(), + multi_sig: pallet_multisig::GenesisConfig { transaction_version: 1, - }), - pallet_corporate_actions: Some(corporate_actions!()), - pallet_rewards: Some(rewards!()), + }, + corporate_action: corporate_actions!(), + rewards: rewards!(), } } @@ -1071,6 +1100,7 @@ pub mod mainnet { .expect("Mainnet bootstrap telemetry url is valid; qed"), ), Some(&*"/polymesh/mainnet"), + None, Some(polymath_props(12)), Default::default(), ) @@ -1102,6 +1132,7 @@ pub mod mainnet { boot_nodes, None, None, + None, Some(polymath_props(12)), Default::default(), ) @@ -1112,6 +1143,7 @@ pub mod mainnet { vec![ get_authority_keys_from_seed("Alice", false), get_authority_keys_from_seed("Bob", false), + get_authority_keys_from_seed("Charlie", false), ], seeded_acc_id("Eve"), true, @@ -1136,6 +1168,7 @@ pub mod mainnet { boot_nodes, None, None, + None, Some(polymath_props(12)), Default::default(), ) @@ -1146,7 +1179,7 @@ pub mod ci { use super::*; use polymesh_runtime_ci::{self as rt, constants::time}; - pub type ChainSpec = sc_service::GenericChainSpec; + pub type ChainSpec = GenericChainSpec; session_keys!(); @@ -1167,15 +1200,15 @@ pub mod ci { ); rt::runtime::GenesisConfig { - frame_system: Some(frame(rt::WASM_BINARY)), - pallet_asset: Some(asset!()), - pallet_checkpoint: Some(checkpoint!()), - pallet_identity: Some(pallet_identity::GenesisConfig { + system: frame(rt::WASM_BINARY), + asset: asset!(), + checkpoint: checkpoint!(), + identity: pallet_identity::GenesisConfig { identities, ..Default::default() - }), - pallet_balances: Some(Default::default()), - pallet_bridge: Some(pallet_bridge::GenesisConfig { + }, + balances: Default::default(), + bridge: pallet_bridge::GenesisConfig { admin: seeded_acc_id("polymath_1"), creator: seeded_acc_id("polymath_1"), signatures_required: 3, @@ -1183,16 +1216,16 @@ pub mod ci { timelock: time::MINUTES * 15, bridge_limit: (30_000_000_000, time::DAYS), complete_txs, - }), - pallet_indices: Some(pallet_indices::GenesisConfig { indices: vec![] }), - pallet_sudo: Some(pallet_sudo::GenesisConfig { key: root_key }), - pallet_session: Some(session!(initial_authorities, session_keys)), - pallet_staking: Some(staking!(initial_authorities, stakers, PerThing::zero())), - pallet_pips: Some(pips!(time::DAYS * 7, MaybeBlock::None, 1000)), - pallet_im_online: Some(Default::default()), - pallet_authority_discovery: Some(Default::default()), - pallet_babe: Some(Default::default()), - pallet_grandpa: Some(Default::default()), + }, + indices: pallet_indices::GenesisConfig { indices: vec![] }, + sudo: pallet_sudo::GenesisConfig { key: root_key }, + session: session!(initial_authorities, session_keys), + staking: staking!(initial_authorities, stakers, PerThing::zero()), + pips: pips!(time::DAYS * 7, MaybeBlock::None, 1000), + im_online: Default::default(), + authority_discovery: Default::default(), + babe: BABE_GENESIS, + grandpa: Default::default(), /* pallet_contracts: Some(pallet_contracts::GenesisConfig { current_schedule: pallet_contracts::Schedule { @@ -1202,23 +1235,23 @@ pub mod ci { }), */ // Governing council - pallet_group_Instance1: Some(group_membership!(1, 2, 3, 5)), - pallet_committee_Instance1: Some(committee!(1, (2, 4))), + committee_membership: group_membership!(1, 2, 3, 5), + polymesh_committee: committee!(1, (2, 4)), // CDD providers - pallet_group_Instance2: Some(group_membership!(1, 2, 3, 5)), + cdd_service_providers: group_membership!(1, 2, 3, 5), // Technical Committee: - pallet_group_Instance3: Some(group_membership!(3, 5)), - pallet_committee_Instance3: Some(committee!(5)), + technical_committee_membership: group_membership!(3, 5), + technical_committee: committee!(5), // Upgrade Committee: - pallet_group_Instance4: Some(group_membership!(1, 5)), - pallet_committee_Instance4: Some(committee!(5)), - pallet_protocol_fee: Some(protocol_fee!()), - pallet_settlement: Some(Default::default()), - pallet_multisig: Some(pallet_multisig::GenesisConfig { + upgrade_committee_membership: group_membership!(1, 5), + upgrade_committee: committee!(5), + protocol_fee: protocol_fee!(), + settlement: Default::default(), + multi_sig: pallet_multisig::GenesisConfig { transaction_version: 1, - }), - pallet_corporate_actions: Some(corporate_actions!()), - pallet_rewards: Some(rewards!()), + }, + corporate_action: corporate_actions!(), + rewards: rewards!(), } } @@ -1248,6 +1281,7 @@ pub mod ci { boot_nodes, None, None, + None, Some(polymath_props(42)), Default::default(), ) @@ -1258,6 +1292,7 @@ pub mod ci { vec![ get_authority_keys_from_seed("Alice", false), get_authority_keys_from_seed("Bob", false), + get_authority_keys_from_seed("Charlie", false), ], seeded_acc_id("Alice"), true, @@ -1282,6 +1317,7 @@ pub mod ci { boot_nodes, None, None, + None, Some(polymath_props(42)), Default::default(), ) diff --git a/src/cli.rs b/src/cli.rs index d4ff30edf9..206a1914a5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,30 +1,28 @@ -use structopt::StructOpt; - -#[derive(Debug, StructOpt)] +#[derive(Debug, clap::Parser)] pub struct Cli { /// Possible subcommand with parameters. - #[structopt(subcommand)] + #[clap(subcommand)] pub subcommand: Option, #[allow(missing_docs)] - #[structopt(flatten)] + #[clap(flatten)] pub run: RunCmd, } #[allow(missing_docs)] -#[derive(Debug, StructOpt)] +#[derive(Debug, clap::Parser)] pub struct RunCmd { #[allow(missing_docs)] - #[structopt(flatten)] + #[clap(flatten)] pub base: sc_cli::RunCmd, /// Enable validator mode. /// /// It is an alias of the `--validator` flag. User has the choice to use either `--validator` or `--operator` flag both works same. - #[structopt(long)] + #[clap(long)] pub operator: bool, } /// Possible subcommands of the main binary. -#[derive(Debug, StructOpt)] +#[derive(Debug, clap::Subcommand)] pub enum Subcommand { /// Build a chain specification. BuildSpec(sc_cli::BuildSpecCmd), @@ -48,6 +46,7 @@ pub enum Subcommand { Revert(sc_cli::RevertCmd), /// The custom benchmark subcommmand benchmarking runtime pallets. - #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] + #[clap(name = "benchmark", about = "Benchmark runtime pallets.")] + #[clap(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), } diff --git a/src/command.rs b/src/command.rs index c7effb3ea8..78d810d07d 100644 --- a/src/command.rs +++ b/src/command.rs @@ -18,15 +18,18 @@ use crate::chain_spec; use crate::cli::{Cli, Subcommand}; use crate::service::{ - self, ci_chain_ops, general_chain_ops, mainnet_chain_ops, testnet_chain_ops, CIExecutor, - GeneralExecutor, IsNetwork, MainnetExecutor, Network, NewChainOps, TestnetExecutor, + self, ci_chain_ops, general_chain_ops, mainnet_chain_ops, new_partial, testnet_chain_ops, + CIExecutor, FullClient, FullServiceComponents, GeneralExecutor, IsNetwork, MainnetExecutor, + Network, NewChainOps, TestnetExecutor, }; +use frame_benchmarking_cli::*; use sc_cli::{ChainSpec, Result, RuntimeVersion, SubstrateCli}; -use sc_service::{config::Role, Configuration, TaskManager}; +use sc_service::{Configuration, TaskManager}; use core::future::Future; use log::info; use polymesh_primitives::Block; +use std::sync::Arc; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -109,15 +112,11 @@ pub fn run() -> Result<()> { ); runner.run_node_until_exit(|config| async move { - match (network, &config.role) { - (Network::Testnet, Role::Light) => service::testnet_new_light(config), - (Network::Testnet, _) => service::testnet_new_full(config), - (Network::Other, Role::Light) => service::general_new_light(config), - (Network::Other, _) => service::general_new_full(config), - (Network::CI, Role::Light) => service::ci_new_light(config), - (Network::CI, _) => service::ci_new_full(config), - (Network::Mainnet, Role::Light) => service::mainnet_new_light(config), - (Network::Mainnet, _) => service::mainnet_new_full(config), + match network { + Network::Testnet => service::testnet_new_full(config), + Network::Other => service::general_new_full(config), + Network::CI => service::ci_new_full(config), + Network::Mainnet => service::mainnet_new_full(config), } .map_err(sc_cli::Error::Service) }) @@ -165,35 +164,90 @@ pub fn run() -> Result<()> { Some(Subcommand::Revert(cmd)) => async_run( &cli, cmd, - |(c, b, _, tm), _| Ok((cmd.run(c, b), tm)), - |(c, b, _, tm), _| Ok((cmd.run(c, b), tm)), - |(c, b, _, tm), _| Ok((cmd.run(c, b), tm)), - |(c, b, _, tm), _| Ok((cmd.run(c, b), tm)), + |(c, b, _, tm), _| { + let aux_revert = Box::new(|client: Arc>, backend, blocks| { + sc_consensus_babe::revert(client.clone(), backend, blocks)?; + grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok((cmd.run(c, b, Some(aux_revert)), tm)) + }, + |(c, b, _, tm), _| { + let aux_revert = Box::new(|client: Arc>, backend, blocks| { + sc_consensus_babe::revert(client.clone(), backend, blocks)?; + grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok((cmd.run(c, b, Some(aux_revert)), tm)) + }, + |(c, b, _, tm), _| { + let aux_revert = Box::new(|client: Arc>, backend, blocks| { + sc_consensus_babe::revert(client.clone(), backend, blocks)?; + grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok((cmd.run(c, b, Some(aux_revert)), tm)) + }, + |(c, b, _, tm), _| { + let aux_revert = Box::new(|client: Arc>, backend, blocks| { + sc_consensus_babe::revert(client.clone(), backend, blocks)?; + grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok((cmd.run(c, b, Some(aux_revert)), tm)) + }, ), Some(Subcommand::Benchmark(cmd)) => { - if cfg!(feature = "runtime-benchmarks") { - let runner = cli.create_runner(cmd)?; - let network = runner.config().chain_spec.network(); + let runner = cli.create_runner(cmd)?; + let network = runner.config().chain_spec.network(); - match network { - Network::Testnet => { - runner.sync_run(|config| cmd.run::(config)) + runner.sync_run(|mut config| { + match (cmd, network) { + (BenchmarkCmd::Pallet(cmd), Network::Other) => { + if !cfg!(feature = "runtime-benchmarks") { + return Err("Benchmarking wasn't enabled when building the node. \ + You can enable it with `--features runtime-benchmarks`." + .into()); + } + + cmd.run::(config) } - Network::Other => { - runner.sync_run(|config| cmd.run::(config)) + (BenchmarkCmd::Block(cmd), Network::Other) => { + let FullServiceComponents { client, .. } = new_partial::< + polymesh_runtime_develop::RuntimeApi, + GeneralExecutor, + _, + >( + &mut config + )?; + cmd.run(client) } - Network::CI => { - runner.sync_run(|config| cmd.run::(config)) + (BenchmarkCmd::Storage(cmd), Network::Other) => { + let FullServiceComponents { + client, backend, .. + } = new_partial::( + &mut config, + )?; + let db = backend.expose_db(); + let storage = backend.expose_storage(); + + cmd.run(config, client, db, storage) + } + (BenchmarkCmd::Overhead(_cmd), Network::Other) => { + unimplemented!(); + /* + let FullServiceComponents { client, .. } = new_partial::(&mut config)?; + let ext_builder = BenchmarkExtrinsicBuilder::new(client.clone()); + + cmd.run(config, client, inherent_benchmark_data()?, Arc::new(ext_builder)) + */ } - Network::Mainnet => { - runner.sync_run(|config| cmd.run::(config)) + (BenchmarkCmd::Machine(cmd), Network::Other) => { + cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()) } + (_, _) => Err("Benchmarking is only supported with the `develop` runtime.")?, } - } else { - Err("Benchmarking wasn't enabled when building the node. \ - You can enable it with `--features runtime-benchmarks`." - .into()) - } + }) } } } diff --git a/src/service.rs b/src/service.rs index 6887392bce..eb241ab325 100644 --- a/src/service.rs +++ b/src/service.rs @@ -9,30 +9,30 @@ use futures::stream::StreamExt; use polymesh_node_rpc as node_rpc; pub use polymesh_primitives::{ crypto::native_schnorrkel, host_functions::native_rng::native_rng, AccountId, Balance, Block, - BlockNumber, Hash, IdentityId, Index as Nonce, Moment, SecondaryKey, Signatory, Ticker, + BlockNumber, Hash, IdentityId, Index as Nonce, Moment, Ticker, }; pub use polymesh_runtime_ci; pub use polymesh_runtime_develop; pub use polymesh_runtime_mainnet; pub use polymesh_runtime_testnet; use prometheus_endpoint::Registry; -use sc_client_api::ExecutorProvider; -pub use sc_client_api::{backend::Backend, RemoteBackend}; +pub use sc_client_api::backend::Backend; +use sc_client_api::{BlockBackend, ExecutorProvider}; pub use sc_consensus::LongestChain; -use sc_executor::native_executor_instance; -pub use sc_executor::{NativeExecutionDispatch, NativeExecutor}; +use sc_consensus_slots::SlotProportion; +use sc_executor::NativeElseWasmExecutor; +pub use sc_executor::{NativeExecutionDispatch, RuntimeVersionOf}; use sc_network::{Event, NetworkService}; +use sc_service::TaskManager; pub use sc_service::{ - config::{DatabaseConfig, PrometheusConfig, Role}, + config::{PrometheusConfig, Role}, error::Error as ServiceError, ChainSpec, Configuration, Error, PruningMode, RuntimeGenesis, TFullBackend, TFullCallExecutor, - TFullClient, TLightBackend, TLightCallExecutor, TLightClient, TransactionPoolOptions, + TFullClient, TransactionPoolOptions, }; -use sc_service::{RpcHandlers, TaskManager}; -use sc_telemetry::TelemetryConnectionNotifier; +use sc_telemetry::{Telemetry, TelemetryWorker}; pub use sp_api::{ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi, StateBackend}; pub use sp_consensus::SelectChain; -use sp_inherents::InherentDataProviders; pub use sp_runtime::traits::BlakeTwo256; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; @@ -64,41 +64,41 @@ impl IsNetwork for dyn ChainSpec { } } -// Our native executor instance. -native_executor_instance!( - pub TestnetExecutor, - polymesh_runtime_testnet::api::dispatch, - polymesh_runtime_testnet::native_version, - (frame_benchmarking::benchmarking::HostFunctions, native_rng::HostFunctions) -); +macro_rules! native_executor_instance { + ($exec:ident, $module:ident, $ehf:ty) => { + pub struct $exec; + impl NativeExecutionDispatch for $exec { + type ExtendHostFunctions = $ehf; -// Our native executor instance. -native_executor_instance!( - pub GeneralExecutor, - polymesh_runtime_develop::api::dispatch, - polymesh_runtime_develop::native_version, - (frame_benchmarking::benchmarking::HostFunctions, native_rng::HostFunctions, native_schnorrkel::HostFunctions) -); + fn dispatch(method: &str, data: &[u8]) -> Option> { + $module::api::dispatch(method, data) + } -native_executor_instance!( - pub CIExecutor, - polymesh_runtime_ci::api::dispatch, - polymesh_runtime_ci::native_version, - (frame_benchmarking::benchmarking::HostFunctions, native_rng::HostFunctions) + fn native_version() -> sc_executor::NativeVersion { + $module::native_version() + } + } + }; +} + +type EHF = ( + frame_benchmarking::benchmarking::HostFunctions, + native_rng::HostFunctions, ); native_executor_instance!( - pub MainnetExecutor, - polymesh_runtime_mainnet::api::dispatch, - polymesh_runtime_mainnet::native_version, - (frame_benchmarking::benchmarking::HostFunctions, native_rng::HostFunctions) + GeneralExecutor, + polymesh_runtime_develop, + (EHF, native_schnorrkel::HostFunctions) ); +native_executor_instance!(TestnetExecutor, polymesh_runtime_testnet, EHF); +native_executor_instance!(CIExecutor, polymesh_runtime_ci, EHF); +native_executor_instance!(MainnetExecutor, polymesh_runtime_mainnet, EHF); /// A set of APIs that polkadot-like runtimes must implement. pub trait RuntimeApiCollection: sp_transaction_pool::runtime_api::TaggedTransactionQueue + sp_api::ApiExt - + sp_api::ApiErrorExt + sp_consensus_babe::BabeApi + grandpa::GrandpaApi + sp_block_builder::BlockBuilder @@ -108,18 +108,11 @@ pub trait RuntimeApiCollection: + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - //+ pallet_contracts_rpc_runtime_api::ContractsApi + + pallet_contracts_rpc_runtime_api::ContractsApi + pallet_staking_rpc_runtime_api::StakingApi + node_rpc_runtime_api::pips::PipsApi - + node_rpc_runtime_api::identity::IdentityApi< - Block, - IdentityId, - Ticker, - AccountId, - SecondaryKey, - Signatory, - Moment, - > + pallet_protocol_fee_rpc_runtime_api::ProtocolFeeApi + + node_rpc_runtime_api::identity::IdentityApi + + pallet_protocol_fee_rpc_runtime_api::ProtocolFeeApi + node_rpc_runtime_api::asset::AssetApi + pallet_group_rpc_runtime_api::GroupApi + node_rpc_runtime_api::compliance_manager::ComplianceManagerApi @@ -132,7 +125,6 @@ impl RuntimeApiCollection for Api where Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue + sp_api::ApiExt - + sp_api::ApiErrorExt + sp_consensus_babe::BabeApi + grandpa::GrandpaApi + sp_block_builder::BlockBuilder @@ -142,18 +134,11 @@ where + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - //+ pallet_contracts_rpc_runtime_api::ContractsApi + + pallet_contracts_rpc_runtime_api::ContractsApi + pallet_staking_rpc_runtime_api::StakingApi + node_rpc_runtime_api::pips::PipsApi - + node_rpc_runtime_api::identity::IdentityApi< - Block, - IdentityId, - Ticker, - AccountId, - SecondaryKey, - Signatory, - Moment, - > + pallet_protocol_fee_rpc_runtime_api::ProtocolFeeApi + + node_rpc_runtime_api::identity::IdentityApi + + pallet_protocol_fee_rpc_runtime_api::ProtocolFeeApi + node_rpc_runtime_api::asset::AssetApi + pallet_group_rpc_runtime_api::GroupApi + node_rpc_runtime_api::compliance_manager::ComplianceManagerApi, @@ -178,15 +163,15 @@ type BabeLink = sc_consensus_babe::BabeLink; type IoHandler = jsonrpc_core::IoHandler; type FullLinkHalf = grandpa::LinkHalf, FullSelectChain>; -type FullClient = sc_service::TFullClient; +pub type FullClient = sc_service::TFullClient>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; type FullGrandpaBlockImport = grandpa::GrandpaBlockImport, FullSelectChain>; -type FullBabeImportQueue = sp_consensus::DefaultImportQueue>; +type FullBabeImportQueue = sc_consensus::DefaultImportQueue>; type FullStateBackend = sc_client_api::StateBackendFor; type FullPool = sc_transaction_pool::FullPool>; -type FullServiceComponents = sc_service::PartialComponents< +pub type FullServiceComponents = sc_service::PartialComponents< FullClient, FullBackend, FullSelectChain, @@ -196,6 +181,7 @@ type FullServiceComponents = sc_service::PartialComponents< F, (FullBabeBlockImport, FullLinkHalf, BabeLink), grandpa::SharedVoterState, + Option, ), >; type FullBabeBlockImport = @@ -207,7 +193,7 @@ pub fn new_partial( FullServiceComponents< R, D, - impl Fn(sc_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> IoHandler, + impl Fn(sc_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> Result, >, Error, > @@ -219,17 +205,46 @@ where { set_prometheus_registry(config)?; + let telemetry = config + .telemetry_endpoints + .clone() + .filter(|x| !x.is_empty()) + .map(|endpoints| -> Result<_, sc_telemetry::Error> { + let worker = TelemetryWorker::new(16)?; + let telemetry = worker.handle().new_telemetry(endpoints); + Ok((worker, telemetry)) + }) + .transpose()?; + + let executor = NativeElseWasmExecutor::::new( + config.wasm_method, + config.default_heap_pages, + config.max_runtime_instances, + config.runtime_cache_size, + ); + let (client, backend, keystore_container, task_manager) = - sc_service::new_full_parts::(&config)?; + sc_service::new_full_parts::>( + config, + telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), + executor, + )?; let client = Arc::new(client); + let telemetry = telemetry.map(|(worker, telemetry)| { + task_manager + .spawn_handle() + .spawn("telemetry", None, worker.run()); + telemetry + }); + let select_chain = sc_consensus::LongestChain::new(backend.clone()); let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), config.prometheus_registry(), - task_manager.spawn_handle(), + task_manager.spawn_essential_handle(), client.clone(), ); @@ -237,27 +252,41 @@ where client.clone(), &(client.clone() as Arc<_>), select_chain.clone(), + telemetry.as_ref().map(|x| x.handle()), )?; let justification_import = grandpa_block_import.clone(); let (block_import, babe_link) = sc_consensus_babe::block_import( - sc_consensus_babe::Config::get_or_compute(&*client)?, + sc_consensus_babe::Config::get(&*client)?, grandpa_block_import, client.clone(), )?; - let inherent_data_providers = sp_inherents::InherentDataProviders::new(); - + let slot_duration = babe_link.config().slot_duration(); let import_queue = sc_consensus_babe::import_queue( babe_link.clone(), block_import.clone(), Some(Box::new(justification_import)), client.clone(), select_chain.clone(), - inherent_data_providers.clone(), - &task_manager.spawn_handle(), + move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + + let uncles = + sp_authorship::InherentDataProvider::<::Header>::check_inherents(); + + Ok((timestamp, slot, uncles)) + }, + &task_manager.spawn_essential_handle(), config.prometheus_registry(), sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), + telemetry.as_ref().map(|x| x.handle()), )?; let import_setup = (block_import, grandpa_link, babe_link); @@ -308,7 +337,7 @@ where }, }; - node_rpc::create_full(deps) + node_rpc::create_full(deps).map_err(Into::into) }; (rpc_extensions_builder, rpc_setup) @@ -322,8 +351,7 @@ where select_chain, import_queue, transaction_pool, - inherent_data_providers, - other: (rpc_extensions_builder, import_setup, rpc_setup), + other: (rpc_extensions_builder, import_setup, rpc_setup, telemetry), }) } @@ -335,10 +363,8 @@ where E: RuntimeExtrinsic, { pub task_manager: TaskManager, - pub inherent_data_providers: InherentDataProviders, pub client: Arc>, pub network: Arc::Hash>>, - pub network_status_sinks: sc_service::NetworkStatusSinks, pub transaction_pool: Arc>, marker: PhantomData, } @@ -363,16 +389,31 @@ where keystore_container, select_chain, transaction_pool, - inherent_data_providers, - other: (rpc_extensions_builder, import_setup, rpc_setup), + other: (rpc_extensions_builder, import_setup, rpc_setup, mut telemetry), } = new_partial(&mut config)?; let shared_voter_state = rpc_setup; + let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; + let grandpa_protocol_name = grandpa::protocol_standard_name( + &client + .block_hash(0) + .ok() + .flatten() + .expect("Genesis block exists; qed"), + &config.chain_spec, + ); config .network .extra_sets - .push(grandpa::grandpa_peers_set_config()); + .push(grandpa::grandpa_peers_set_config( + grandpa_protocol_name.clone(), + )); + let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new( + backend.clone(), + import_setup.1.shared_authority_set().clone(), + Vec::default(), + )); #[cfg(feature = "cli")] config.network.request_response_protocols.push( @@ -383,21 +424,20 @@ where ), ); - let (network, network_status_sinks, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), transaction_pool: transaction_pool.clone(), spawn_handle: task_manager.spawn_handle(), import_queue, - on_demand: None, block_announce_validator_builder: None, + warp_sync: Some(warp_sync), })?; if config.offchain_worker.enabled { sc_service::build_offchain_workers( &config, - backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(), @@ -412,21 +452,18 @@ where let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); - let (_rpc_handlers, telemetry_connection_notifier) = - sc_service::spawn_tasks(sc_service::SpawnTasksParams { - config, - backend: backend.clone(), - client: client.clone(), - keystore: keystore_container.sync_keystore(), - network: network.clone(), - rpc_extensions_builder: Box::new(rpc_extensions_builder), - transaction_pool: transaction_pool.clone(), - task_manager: &mut task_manager, - on_demand: None, - remote_blockchain: None, - network_status_sinks: network_status_sinks.clone(), - system_rpc_tx, - })?; + let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { + config, + backend: backend.clone(), + client: client.clone(), + keystore: keystore_container.sync_keystore(), + network: network.clone(), + rpc_extensions_builder: Box::new(rpc_extensions_builder), + transaction_pool: transaction_pool.clone(), + task_manager: &mut task_manager, + system_rpc_tx, + telemetry: telemetry.as_mut(), + })?; let (block_import, grandpa_link, babe_link) = import_setup; @@ -438,11 +475,14 @@ where client.clone(), transaction_pool.clone(), prometheus_registry.as_ref(), + telemetry.as_ref().map(|x| x.handle()), ); let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); + let client_clone = client.clone(); + let slot_duration = babe_link.config().slot_duration(); let babe_config = sc_consensus_babe::BabeParams { keystore: keystore_container.sync_keystore(), client: client.clone(), @@ -450,17 +490,47 @@ where env: proposer, block_import, sync_oracle: network.clone(), - inherent_data_providers: inherent_data_providers.clone(), + justification_sync_link: network.clone(), + create_inherent_data_providers: move |parent, ()| { + let client_clone = client_clone.clone(); + async move { + let uncles = sc_consensus_uncles::create_uncles_inherent_data_provider( + &*client_clone, + parent, + )?; + + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + + let storage_proof = + sp_transaction_storage_proof::registration::new_data_provider( + &*client_clone, + &parent, + )?; + + Ok((timestamp, slot, uncles, storage_proof)) + } + }, force_authoring, backoff_authoring_blocks, babe_link, can_author_with, + block_proposal_slot_portion: SlotProportion::new(0.5), + max_block_proposal_slot_portion: None, + telemetry: telemetry.as_ref().map(|x| x.handle()), }; let babe = sc_consensus_babe::start_babe(babe_config)?; - task_manager - .spawn_essential_handle() - .spawn_blocking("babe-proposer", babe); + task_manager.spawn_essential_handle().spawn_blocking( + "babe-proposer", + Some("block-authoring"), + babe, + ); } // Spawn authority discovery module. @@ -476,16 +546,22 @@ where _ => None, } }); - let (authority_discovery_worker, _service) = sc_authority_discovery::new_worker_and_service( - client.clone(), - network.clone(), - Box::pin(dht_event_stream), - authority_discovery_role, - prometheus_registry.clone(), - ); + let (authority_discovery_worker, _service) = + sc_authority_discovery::new_worker_and_service_with_config( + sc_authority_discovery::WorkerConfig { + publish_non_global_ips: auth_disc_publish_non_global_ips, + ..Default::default() + }, + client.clone(), + network.clone(), + Box::pin(dht_event_stream), + authority_discovery_role, + prometheus_registry.clone(), + ); task_manager.spawn_handle().spawn( "authority-discovery-worker", + Some("networking"), authority_discovery_worker.run(), ); } @@ -505,7 +581,9 @@ where name: Some(name), observer_enabled: false, keystore, - is_authority: role.is_authority(), + local_role: role, + telemetry: telemetry.as_ref().map(|x| x.handle()), + protocol_name: grandpa_protocol_name, }; if enable_grandpa { @@ -519,7 +597,7 @@ where config, link: grandpa_link, network: network.clone(), - telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()), + telemetry: telemetry.as_ref().map(|x| x.handle()), voting_rule: grandpa::VotingRulesBuilder::default().build(), prometheus_registry, shared_voter_state, @@ -527,18 +605,18 @@ where // the GRANDPA voter task is considered infallible, i.e. // if it fails we take down the service with it. - task_manager - .spawn_essential_handle() - .spawn_blocking("grandpa-voter", grandpa::run_grandpa_voter(grandpa_config)?); + task_manager.spawn_essential_handle().spawn_blocking( + "grandpa-voter", + None, + grandpa::run_grandpa_voter(grandpa_config)?, + ); } network_starter.start_network(); Ok(NewFullBase { task_manager, - inherent_data_providers, client, network, - network_status_sinks, transaction_pool, marker: PhantomData, }) @@ -619,158 +697,3 @@ pub fn mainnet_chain_ops( ) -> Result, ServiceError> { chain_ops::<_, _, polymesh_runtime_mainnet::UncheckedExtrinsic>(config) } - -type LightStorage = sc_client_db::light::LightStorage; -type LightBackend = sc_light::backend::Backend; -type LightClient = sc_service::TLightClient; -type LightStateBackend = sc_client_api::StateBackendFor; -type LightPool = - sc_transaction_pool::LightPool, sc_network::config::OnDemand>; - -pub fn new_light_base( - mut config: Configuration, -) -> Result< - ( - TaskManager, - RpcHandlers, - Option, - Arc>, - Arc::Hash>>, - Arc>, - ), - ServiceError, -> -where - R::RuntimeApi: RuntimeApiCollection, - D: NativeExecutionDispatch + 'static, - E: RuntimeExtrinsic, - R: Send - + Sync - + 'static - + sp_api::ConstructRuntimeApi< - Block, - sc_service::TLightClientWithBackend, - >, -{ - let (client, backend, keystore_container, mut task_manager, on_demand) = - sc_service::new_light_parts::(&config)?; - - config - .network - .extra_sets - .push(grandpa::grandpa_peers_set_config()); - - let select_chain = sc_consensus::LongestChain::new(backend.clone()); - - let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light( - config.transaction_pool.clone(), - config.prometheus_registry(), - task_manager.spawn_handle(), - client.clone(), - on_demand.clone(), - )); - - let (grandpa_block_import, _) = grandpa::block_import( - client.clone(), - &(client.clone() as Arc<_>), - select_chain.clone(), - )?; - let justification_import = grandpa_block_import.clone(); - - let (babe_block_import, babe_link) = sc_consensus_babe::block_import( - sc_consensus_babe::Config::get_or_compute(&*client)?, - grandpa_block_import, - client.clone(), - )?; - - let inherent_data_providers = sp_inherents::InherentDataProviders::new(); - - let import_queue = sc_consensus_babe::import_queue( - babe_link, - babe_block_import, - Some(Box::new(justification_import)), - client.clone(), - select_chain.clone(), - inherent_data_providers.clone(), - &task_manager.spawn_handle(), - config.prometheus_registry(), - sp_consensus::NeverCanAuthor, - )?; - - let (network, network_status_sinks, system_rpc_tx, network_starter) = - sc_service::build_network(sc_service::BuildNetworkParams { - config: &config, - client: client.clone(), - transaction_pool: transaction_pool.clone(), - spawn_handle: task_manager.spawn_handle(), - import_queue, - on_demand: Some(on_demand.clone()), - block_announce_validator_builder: None, - })?; - network_starter.start_network(); - - if config.offchain_worker.enabled { - sc_service::build_offchain_workers( - &config, - backend.clone(), - task_manager.spawn_handle(), - client.clone(), - network.clone(), - ); - } - - let light_deps = node_rpc::LightDeps { - remote_blockchain: backend.remote_blockchain(), - fetcher: on_demand.clone(), - client: client.clone(), - pool: transaction_pool.clone(), - }; - - let rpc_extensions = node_rpc::create_light(light_deps); - - let (rpc_handlers, telemetry_connection_notifier) = - sc_service::spawn_tasks(sc_service::SpawnTasksParams { - on_demand: Some(on_demand), - remote_blockchain: Some(backend.remote_blockchain()), - rpc_extensions_builder: Box::new(sc_service::NoopRpcExtensionBuilder(rpc_extensions)), - client: client.clone(), - transaction_pool: transaction_pool.clone(), - keystore: keystore_container.sync_keystore(), - config, - backend, - network_status_sinks, - system_rpc_tx, - network: network.clone(), - task_manager: &mut task_manager, - })?; - - Ok(( - task_manager, - rpc_handlers, - telemetry_connection_notifier, - client, - network, - transaction_pool, - )) -} - -/// Create a new Polymesh services for light clients. -pub fn testnet_new_light(config: Configuration) -> TaskResult { - new_light_base::(config) - .map(|(task_manager, _, _, _, _, _)| task_manager) -} - -pub fn ci_new_light(config: Configuration) -> TaskResult { - new_light_base::(config) - .map(|(task_manager, _, _, _, _, _)| task_manager) -} - -pub fn general_new_light(config: Configuration) -> TaskResult { - new_light_base::(config) - .map(|(task_manager, ..)| task_manager) -} - -pub fn mainnet_new_light(config: Configuration) -> TaskResult { - new_light_base::(config) - .map(|(task_manager, ..)| task_manager) -} diff --git a/utils/permissions/Cargo.toml b/utils/permissions/Cargo.toml index f12b51b11c..500039e7c0 100644 --- a/utils/permissions/Cargo.toml +++ b/utils/permissions/Cargo.toml @@ -2,7 +2,7 @@ name = "permissions" version = "0.1.0" authors = ["Polymath"] -edition = "2018" +edition = "2021" [dependencies] scraper = "0.12"