git.delta.rocks / unique-network / refs/commits / 46fa52585478

difftreelog

Merge branch 'develop' into feature/NFTPAR-96

Greg Zaitsev2020-11-24parents: #31f6053 #3f1f974.patch.diff
in: master

34 files changed

modified.dockerignorediffbeforeafterboth
--- a/.dockerignore
+++ b/.dockerignore
@@ -3,4 +3,4 @@
 doc/
 target/
 chain-data*/
-smart_contract/
\ No newline at end of file
+smart_contract/
modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,7 +16,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
 dependencies = [
- "gimli",
+ "gimli 0.22.0",
 ]
 
 [[package]]
@@ -24,12 +24,6 @@
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
-
-[[package]]
-name = "adler32"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
 
 [[package]]
 name = "aead"
@@ -37,14 +31,14 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331"
 dependencies = [
- "generic-array 0.14.3",
+ "generic-array 0.14.4",
 ]
 
 [[package]]
 name = "aes"
-version = "0.4.0"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5"
+checksum = "dd2bc6d3f370b5666245ff421e231cba4353df936e26986d2918e61a8fd6aef6"
 dependencies = [
  "aes-soft",
  "aesni",
@@ -53,52 +47,58 @@
 
 [[package]]
 name = "aes-gcm"
-version = "0.6.0"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1"
+checksum = "0301c9e9c443494d970a07885e8cf3e587bae8356a1d5abd0999068413f7205f"
 dependencies = [
  "aead",
  "aes",
  "block-cipher",
  "ghash",
- "subtle 2.2.3",
+ "subtle 2.3.0",
 ]
 
 [[package]]
 name = "aes-soft"
-version = "0.4.0"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7"
+checksum = "63dd91889c49327ad7ef3b500fd1109dbd3c509a03db0d4a9ce413b79f575cb6"
 dependencies = [
  "block-cipher",
- "byteorder",
- "opaque-debug 0.2.3",
+ "byteorder 1.3.4",
+ "opaque-debug 0.3.0",
 ]
 
 [[package]]
 name = "aesni"
-version = "0.7.0"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264"
+checksum = "0a6fe808308bb07d393e2ea47780043ec47683fcf19cf5efc8ca51c50cc8c68a"
 dependencies = [
  "block-cipher",
- "opaque-debug 0.2.3",
+ "opaque-debug 0.3.0",
 ]
 
 [[package]]
 name = "ahash"
-version = "0.2.18"
+version = "0.2.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3"
+checksum = "29661b60bec623f0586702976ff4d0c9942dcb6723161c2df0eea78455cfedfb"
 dependencies = [
  "const-random",
 ]
 
 [[package]]
+name = "ahash"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
+
+[[package]]
 name = "aho-corasick"
-version = "0.7.13"
+version = "0.7.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
+checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d"
 dependencies = [
  "memchr",
 ]
@@ -111,7 +111,7 @@
 dependencies = [
  "approx",
  "num-complex",
- "num-traits 0.2.12",
+ "num-traits",
 ]
 
 [[package]]
@@ -134,9 +134,9 @@
 
 [[package]]
 name = "anyhow"
-version = "1.0.31"
+version = "1.0.33"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
+checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c"
 
 [[package]]
 name = "approx"
@@ -144,7 +144,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
 dependencies = [
- "num-traits 0.2.12",
+ "num-traits",
 ]
 
 [[package]]
@@ -189,65 +189,146 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502"
 dependencies = [
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
-name = "assert_matches"
+name = "async-channel"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9"
+dependencies = [
+ "concurrent-queue",
+ "event-listener",
+ "futures-core",
+]
+
+[[package]]
+name = "async-executor"
 version = "1.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5"
+checksum = "d373d78ded7d0b3fa8039375718cde0aace493f2e34fb60f51cbf567562ca801"
+dependencies = [
+ "async-task",
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "once_cell 1.4.1",
+ "vec-arena",
+]
+
+[[package]]
+name = "async-global-executor"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0659b83a146398616883aa5199cdd1b055ec088a83c9a338eab3534f33f0622e"
+dependencies = [
+ "async-executor",
+ "async-io",
+ "futures-lite",
+ "num_cpus",
+ "once_cell 1.4.1",
+]
 
 [[package]]
+name = "async-io"
+version = "1.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d54bc4c1c7292475efb2253227dbcfad8fe1ca4c02bc62c510cc2f3da5c4704e"
+dependencies = [
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "libc",
+ "log",
+ "nb-connect",
+ "once_cell 1.4.1",
+ "parking",
+ "polling",
+ "vec-arena",
+ "waker-fn",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "async-mutex"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e"
+dependencies = [
+ "event-listener",
+]
+
+[[package]]
 name = "async-std"
-version = "1.5.0"
+version = "1.6.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267"
+checksum = "a9fa76751505e8df1c7a77762f60486f60c71bbd9b8557f4da6ad47d083732ed"
 dependencies = [
- "async-task",
- "broadcaster",
- "crossbeam-channel",
- "crossbeam-deque",
+ "async-global-executor",
+ "async-io",
+ "async-mutex",
+ "blocking",
  "crossbeam-utils",
+ "futures-channel",
  "futures-core",
  "futures-io",
- "futures-timer 2.0.2",
+ "futures-lite",
+ "gloo-timers",
  "kv-log-macro",
  "log",
  "memchr",
- "mio",
- "mio-uds",
  "num_cpus",
- "once_cell",
+ "once_cell 1.4.1",
  "pin-project-lite",
  "pin-utils",
  "slab",
+ "wasm-bindgen-futures",
 ]
 
 [[package]]
 name = "async-task"
-version = "1.3.1"
+version = "4.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
+checksum = "8ab27c1aa62945039e44edaeee1dc23c74cc0c303dd5fe0fb462a184f1c3a518"
 
 [[package]]
 name = "async-tls"
-version = "0.7.0"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95fd83426b89b034bf4e9ceb9c533c2f2386b813fd3dcae0a425ec6f1837d78a"
+checksum = "df097e3f506bec0e1a24f06bb3c962c228f36671de841ff579cb99f371772634"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "rustls",
  "webpki",
  "webpki-roots 0.19.0",
 ]
 
 [[package]]
+name = "async-trait"
+version = "0.1.41"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "atomic"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e"
+
+[[package]]
+name = "atomic-waker"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
+
+[[package]]
 name = "atty"
 version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -266,21 +347,21 @@
 
 [[package]]
 name = "autocfg"
-version = "1.0.0"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
 
 [[package]]
 name = "backtrace"
-version = "0.3.50"
+version = "0.3.53"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293"
+checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e"
 dependencies = [
  "addr2line",
- "cfg-if",
+ "cfg-if 1.0.0",
  "libc",
  "miniz_oxide",
- "object",
+ "object 0.21.1",
  "rustc-demangle",
 ]
 
@@ -297,14 +378,30 @@
 checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
 
 [[package]]
+name = "base64"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
+
+[[package]]
+name = "bincode"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d"
+dependencies = [
+ "byteorder 1.3.4",
+ "serde",
+]
+
+[[package]]
 name = "bindgen"
-version = "0.53.3"
+version = "0.54.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5"
+checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36"
 dependencies = [
  "bitflags",
  "cexpr",
- "cfg-if",
+ "cfg-if 0.1.10",
  "clang-sys",
  "clap",
  "env_logger",
@@ -313,7 +410,7 @@
  "log",
  "peeking_take_while",
  "proc-macro2",
- "quote 1.0.7",
+ "quote",
  "regex",
  "rustc-hash",
  "shlex",
@@ -321,6 +418,21 @@
 ]
 
 [[package]]
+name = "bip39"
+version = "0.6.0-beta.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7059804e226b3ac116519a252d7f5fb985a5ccc0e93255e036a5f7e7283323f4"
+dependencies = [
+ "failure",
+ "hashbrown 0.1.8",
+ "hmac",
+ "once_cell 0.1.8",
+ "pbkdf2",
+ "rand 0.6.5",
+ "sha2 0.8.2",
+]
+
+[[package]]
 name = "bitflags"
 version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -340,18 +452,6 @@
 dependencies = [
  "either",
  "radium",
-]
-
-[[package]]
-name = "blake2"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330"
-dependencies = [
- "byte-tools",
- "crypto-mac 0.7.0",
- "digest 0.8.1",
- "opaque-debug 0.2.3",
 ]
 
 [[package]]
@@ -361,7 +461,7 @@
 checksum = "84ce5b6108f8e154604bd4eb76a2f726066c3464d5a552a4229262a18c9bb471"
 dependencies = [
  "byte-tools",
- "byteorder",
+ "byteorder 1.3.4",
  "crypto-mac 0.8.0",
  "digest 0.9.0",
  "opaque-debug 0.2.3",
@@ -405,9 +505,9 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
 dependencies = [
- "block-padding",
+ "block-padding 0.1.5",
  "byte-tools",
- "byteorder",
+ "byteorder 1.3.4",
  "generic-array 0.12.3",
 ]
 
@@ -417,16 +517,17 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
 dependencies = [
- "generic-array 0.14.3",
+ "block-padding 0.2.1",
+ "generic-array 0.14.4",
 ]
 
 [[package]]
 name = "block-cipher"
-version = "0.7.1"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10"
+checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80"
 dependencies = [
- "generic-array 0.14.3",
+ "generic-array 0.14.4",
 ]
 
 [[package]]
@@ -439,17 +540,23 @@
 ]
 
 [[package]]
-name = "broadcaster"
-version = "1.0.0"
+name = "block-padding"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9c972e21e0d055a36cf73e4daae870941fe7a8abcd5ac3396aab9e4c126bd87"
+checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
+
+[[package]]
+name = "blocking"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"
 dependencies = [
- "futures-channel",
- "futures-core",
- "futures-sink",
- "futures-util",
- "parking_lot 0.10.2",
- "slab",
+ "async-channel",
+ "async-task",
+ "atomic-waker",
+ "fastrand",
+ "futures-lite",
+ "once_cell 1.4.1",
 ]
 
 [[package]]
@@ -487,6 +594,12 @@
 
 [[package]]
 name = "byteorder"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
+
+[[package]]
+name = "byteorder"
 version = "1.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
@@ -497,7 +610,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "either",
  "iovec",
 ]
@@ -515,10 +628,16 @@
 checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"
 
 [[package]]
+name = "cache-padded"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
+
+[[package]]
 name = "cc"
-version = "1.0.58"
+version = "1.0.61"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
+checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
 dependencies = [
  "jobserver",
 ]
@@ -539,37 +658,45 @@
 checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
 [[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
 name = "chacha20"
-version = "0.4.3"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "086c0f07ac275808b7bf9a39f2fd013aae1498be83632814c8c4e0bd53f2dc58"
+checksum = "244fbce0d47e97e8ef2f63b81d5e05882cb518c68531eb33194990d7b7e85845"
 dependencies = [
- "stream-cipher",
+ "stream-cipher 0.7.1",
  "zeroize",
 ]
 
 [[package]]
 name = "chacha20poly1305"
-version = "0.5.1"
+version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "18b0c90556d8e3fec7cf18d84a2f53d27b21288f2fe481b830fadcf809e48205"
+checksum = "9bf18d374d66df0c05cdddd528a7db98f78c28e2519b120855c4f84c5027b1f5"
 dependencies = [
  "aead",
  "chacha20",
  "poly1305",
- "stream-cipher",
+ "stream-cipher 0.7.1",
  "zeroize",
 ]
 
 [[package]]
 name = "chrono"
-version = "0.4.13"
+version = "0.4.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6"
+checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
 dependencies = [
+ "libc",
  "num-integer",
- "num-traits 0.2.12",
+ "num-traits",
  "time",
+ "winapi 0.3.9",
 ]
 
 [[package]]
@@ -585,9 +712,9 @@
 
 [[package]]
 name = "clap"
-version = "2.33.1"
+version = "2.33.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
+checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
 dependencies = [
  "ansi_term 0.11.0",
  "atty",
@@ -599,28 +726,37 @@
 ]
 
 [[package]]
-name = "clear_on_drop"
-version = "0.2.4"
+name = "cloudabi"
+version = "0.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08"
+checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
 dependencies = [
- "cc",
+ "bitflags",
 ]
 
 [[package]]
 name = "cloudabi"
-version = "0.0.3"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
+checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
 dependencies = [
  "bitflags",
 ]
 
 [[package]]
+name = "concurrent-queue"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
+dependencies = [
+ "cache-padded",
+]
+
+[[package]]
 name = "const-random"
-version = "0.1.8"
+version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a"
+checksum = "02dc82c12dc2ee6e1ded861cf7d582b46f66f796d1b6c93fa28b911ead95da02"
 dependencies = [
  "const-random-macro",
  "proc-macro-hack",
@@ -628,11 +764,11 @@
 
 [[package]]
 name = "const-random-macro"
-version = "0.1.8"
+version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a"
+checksum = "fc757bbb9544aa296c2ae00c679e81f886b37e28e59097defe0cf524306f6685"
 dependencies = [
- "getrandom",
+ "getrandom 0.2.0",
  "proc-macro-hack",
 ]
 
@@ -665,19 +801,111 @@
 checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
 
 [[package]]
+name = "cranelift-bforest"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8dcc286b052ee24a1e5a222e7c1125e6010ad35b0f248709b9b3737a8fedcfdf"
+dependencies = [
+ "cranelift-entity",
+]
+
+[[package]]
+name = "cranelift-codegen"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d9badfe36176cb653506091693bc2bb1970c9bddfcd6ec7fac404f7eaec6f38"
+dependencies = [
+ "byteorder 1.3.4",
+ "cranelift-bforest",
+ "cranelift-codegen-meta",
+ "cranelift-codegen-shared",
+ "cranelift-entity",
+ "gimli 0.21.0",
+ "log",
+ "regalloc",
+ "serde",
+ "smallvec 1.4.2",
+ "target-lexicon",
+ "thiserror",
+]
+
+[[package]]
+name = "cranelift-codegen-meta"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c3f460031861e4f4ad510be62b2ae50bba6cc886b598a36f9c0a970feab9598"
+dependencies = [
+ "cranelift-codegen-shared",
+ "cranelift-entity",
+]
+
+[[package]]
+name = "cranelift-codegen-shared"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76ad12409e922e7697cd0bdc7dc26992f64a77c31880dfe5e3c7722f4710206d"
+
+[[package]]
+name = "cranelift-entity"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d97cdc58972ea065d107872cfb9079f4c92ade78a8af85aaff519a65b5d13f71"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "cranelift-frontend"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ef419efb4f94ecc02e5d9fbcc910d2bb7f0040e2de570e63a454f883bc891d6"
+dependencies = [
+ "cranelift-codegen",
+ "log",
+ "smallvec 1.4.2",
+ "target-lexicon",
+]
+
+[[package]]
+name = "cranelift-native"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e69d44d59826eef6794066ac2c0f4ad3975f02d97030c60dbc04e3886adf36e"
+dependencies = [
+ "cranelift-codegen",
+ "raw-cpuid",
+ "target-lexicon",
+]
+
+[[package]]
+name = "cranelift-wasm"
+version = "0.66.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "979df666b1304624abe99738e9e0e7c7479ee5523ba4b8b237df9ff49996acbb"
+dependencies = [
+ "cranelift-codegen",
+ "cranelift-entity",
+ "cranelift-frontend",
+ "log",
+ "serde",
+ "thiserror",
+ "wasmparser 0.59.0",
+]
+
+[[package]]
 name = "crc32fast"
 version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
 ]
 
 [[package]]
 name = "crossbeam-channel"
-version = "0.4.2"
+version = "0.4.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
+checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
 dependencies = [
  "crossbeam-utils",
  "maybe-uninit",
@@ -700,13 +928,13 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
 dependencies = [
- "autocfg 1.0.0",
- "cfg-if",
+ "autocfg 1.0.1",
+ "cfg-if 0.1.10",
  "crossbeam-utils",
  "lazy_static",
  "maybe-uninit",
  "memoffset",
- "scopeguard",
+ "scopeguard 1.1.0",
 ]
 
 [[package]]
@@ -715,7 +943,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "crossbeam-utils",
  "maybe-uninit",
 ]
@@ -726,8 +954,8 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
 dependencies = [
- "autocfg 1.0.0",
- "cfg-if",
+ "autocfg 1.0.1",
+ "cfg-if 0.1.10",
  "lazy_static",
 ]
 
@@ -753,47 +981,70 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
 dependencies = [
- "generic-array 0.14.3",
- "subtle 2.2.3",
+ "generic-array 0.14.4",
+ "subtle 2.3.0",
 ]
 
 [[package]]
 name = "ct-logs"
-version = "0.6.0"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113"
+checksum = "8c8e13110a84b6315df212c045be706af261fd364791cad863285439ebba672e"
 dependencies = [
  "sct",
 ]
 
 [[package]]
+name = "cuckoofilter"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f"
+dependencies = [
+ "byteorder 0.5.3",
+ "rand 0.3.23",
+]
+
+[[package]]
 name = "curve25519-dalek"
 version = "2.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "digest 0.8.1",
  "rand_core 0.5.1",
- "subtle 2.2.3",
+ "subtle 2.3.0",
  "zeroize",
 ]
 
 [[package]]
+name = "curve25519-dalek"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307"
+dependencies = [
+ "byteorder 1.3.4",
+ "digest 0.9.0",
+ "rand_core 0.5.1",
+ "subtle 2.3.0",
+ "zeroize",
+]
+
+[[package]]
 name = "data-encoding"
-version = "2.2.1"
+version = "2.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72aa14c04dfae8dd7d8a2b1cb7ca2152618cd01336dbfe704b8dcbf8d41dbd69"
+checksum = "d4d0e2d24e5ee3b23a01de38eefdcd978907890701f08ffffd4cb457ca4ee8d6"
 
 [[package]]
 name = "derive_more"
-version = "0.99.9"
+version = "0.99.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76"
+checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -811,7 +1062,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
 dependencies = [
- "generic-array 0.14.3",
+ "generic-array 0.14.4",
 ]
 
 [[package]]
@@ -820,7 +1071,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "dirs-sys",
 ]
 
@@ -841,46 +1092,67 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "quick-error",
 ]
 
 [[package]]
-name = "doc-comment"
-version = "0.3.3"
+name = "dyn-clonable"
+version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
+checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4"
+dependencies = [
+ "dyn-clonable-impl",
+ "dyn-clone",
+]
 
 [[package]]
-name = "ed25519-dalek"
-version = "1.0.0-pre.3"
+name = "dyn-clonable-impl"
+version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2"
+checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5"
 dependencies = [
- "clear_on_drop",
- "curve25519-dalek",
- "rand 0.7.3",
- "sha2 0.8.2",
+ "proc-macro2",
+ "quote",
+ "syn",
 ]
 
 [[package]]
-name = "either"
-version = "1.5.3"
+name = "dyn-clone"
+version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
+checksum = "4c53dc3a653e0f64081026e4bf048d48fec9fce90c66e8326ca7292df0ff2d82"
+
+[[package]]
+name = "ed25519"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef"
+dependencies = [
+ "signature",
+]
 
 [[package]]
-name = "enum-primitive-derive"
-version = "0.1.2"
+name = "ed25519-dalek"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd"
+checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
 dependencies = [
- "num-traits 0.1.43",
- "quote 0.3.15",
- "syn 0.11.11",
+ "curve25519-dalek 3.0.0",
+ "ed25519",
+ "rand 0.7.3",
+ "serde",
+ "sha2 0.9.1",
+ "zeroize",
 ]
 
 [[package]]
+name = "either"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
+
+[[package]]
 name = "env_logger"
 version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -895,9 +1167,9 @@
 
 [[package]]
 name = "environmental"
-version = "1.1.1"
+version = "1.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4"
+checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e"
 
 [[package]]
 name = "erased-serde"
@@ -909,12 +1181,39 @@
 ]
 
 [[package]]
+name = "errno"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6eab5ee3df98a279d9b316b1af6ac95422127b1290317e6d18c1743c99418b01"
+dependencies = [
+ "errno-dragonfly",
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
+dependencies = [
+ "gcc",
+ "libc",
+]
+
+[[package]]
+name = "event-listener"
+version = "2.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59"
+
+[[package]]
 name = "exit-future"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
 ]
 
 [[package]]
@@ -934,8 +1233,8 @@
 checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
  "synstructure",
 ]
 
@@ -946,12 +1245,37 @@
 checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
 
 [[package]]
+name = "fallible-iterator"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
+
+[[package]]
+name = "fastrand"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3"
+dependencies = [
+ "instant",
+]
+
+[[package]]
 name = "fdlimit"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "file-per-thread-logger"
 version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0da54a593b34c71b889ee45f5b5bb900c74148c5f7f8c6a9479ee7899f69603c"
+checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126"
 dependencies = [
- "libc",
+ "env_logger",
+ "log",
 ]
 
 [[package]]
@@ -961,10 +1285,10 @@
 checksum = "8feb87a63249689640ac9c011742c33139204e3c134293d3054022276869133b"
 dependencies = [
  "either",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 2.0.2",
  "log",
- "num-traits 0.2.12",
+ "num-traits",
  "parity-scale-codec",
  "parking_lot 0.9.0",
 ]
@@ -975,7 +1299,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "rand 0.7.3",
  "rustc-hex",
  "static_assertions",
@@ -989,11 +1313,11 @@
 
 [[package]]
 name = "flate2"
-version = "1.0.16"
+version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e"
+checksum = "da80be589a72651dcda34d8b35bcdc9b7254ad06325611074d9cc0fbb19f60ee"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "crc32fast",
  "libc",
  "libz-sys",
@@ -1008,16 +1332,16 @@
 
 [[package]]
 name = "fork-tree"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
 ]
 
 [[package]]
 name = "frame-benchmarking"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -1029,17 +1353,37 @@
  "sp-runtime",
  "sp-runtime-interface",
  "sp-std",
+ "sp-storage",
 ]
 
 [[package]]
+name = "frame-benchmarking-cli"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "frame-benchmarking",
+ "parity-scale-codec",
+ "sc-cli",
+ "sc-client-db",
+ "sc-executor",
+ "sc-service",
+ "sp-core",
+ "sp-externalities",
+ "sp-runtime",
+ "sp-state-machine",
+ "structopt",
+]
+
+[[package]]
 name = "frame-executive"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
  "parity-scale-codec",
  "serde",
+ "sp-core",
  "sp-io",
  "sp-runtime",
  "sp-std",
@@ -1048,8 +1392,8 @@
 
 [[package]]
 name = "frame-metadata"
-version = "11.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "12.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "serde",
@@ -1059,19 +1403,19 @@
 
 [[package]]
 name = "frame-support"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "bitmask",
  "frame-metadata",
  "frame-support-procedural",
  "impl-trait-for-tuples",
  "log",
- "once_cell",
+ "once_cell 1.4.1",
  "parity-scale-codec",
  "paste",
  "serde",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "sp-arithmetic",
  "sp-core",
  "sp-inherents",
@@ -1084,41 +1428,41 @@
 
 [[package]]
 name = "frame-support-procedural"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support-procedural-tools",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "frame-support-procedural-tools"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support-procedural-tools-derive",
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "frame-support-procedural-tools-derive"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "frame-system"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "impl-trait-for-tuples",
@@ -1132,6 +1476,29 @@
 ]
 
 [[package]]
+name = "frame-system-benchmarking"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
+name = "frame-system-rpc-runtime-api"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "parity-scale-codec",
+ "sp-api",
+]
+
+[[package]]
 name = "fs-swap"
 version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1167,15 +1534,15 @@
 
 [[package]]
 name = "futures"
-version = "0.1.29"
+version = "0.1.30"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
+checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed"
 
 [[package]]
 name = "futures"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
+checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e"
 dependencies = [
  "futures-channel",
  "futures-core",
@@ -1188,9 +1555,9 @@
 
 [[package]]
 name = "futures-channel"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
+checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74"
 dependencies = [
  "futures-core",
  "futures-sink",
@@ -1207,9 +1574,9 @@
 
 [[package]]
 name = "futures-core"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
+checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b"
 
 [[package]]
 name = "futures-core-preview"
@@ -1223,7 +1590,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "num_cpus",
 ]
 
@@ -1233,8 +1600,8 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9"
 dependencies = [
- "futures 0.1.29",
- "futures 0.3.5",
+ "futures 0.1.30",
+ "futures 0.3.6",
  "lazy_static",
  "log",
  "parking_lot 0.9.0",
@@ -1245,9 +1612,9 @@
 
 [[package]]
 name = "futures-executor"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
+checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab"
 dependencies = [
  "futures-core",
  "futures-task",
@@ -1257,35 +1624,50 @@
 
 [[package]]
 name = "futures-io"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
+checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c"
+
+[[package]]
+name = "futures-lite"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "381a7ad57b1bad34693f63f6f377e1abded7a9c85c9d3eb6771e11c60aaadab9"
+dependencies = [
+ "fastrand",
+ "futures-core",
+ "futures-io",
+ "memchr",
+ "parking",
+ "pin-project-lite",
+ "waker-fn",
+]
 
 [[package]]
 name = "futures-macro"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
+checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b"
 dependencies = [
  "proc-macro-hack",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "futures-sink"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
+checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd"
 
 [[package]]
 name = "futures-task"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
+checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94"
 dependencies = [
- "once_cell",
+ "once_cell 1.4.1",
 ]
 
 [[package]]
@@ -1302,11 +1684,11 @@
 
 [[package]]
 name = "futures-util"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
+checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "futures-channel",
  "futures-core",
  "futures-io",
@@ -1335,24 +1717,12 @@
 
 [[package]]
 name = "futures_codec"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0a73299e4718f5452e45980fc1d6957a070abe308d3700b63b8673f47e1c2b3"
-dependencies = [
- "bytes 0.5.6",
- "futures 0.3.5",
- "memchr",
- "pin-project",
-]
-
-[[package]]
-name = "futures_codec"
 version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b"
 dependencies = [
  "bytes 0.5.6",
- "futures 0.3.5",
+ "futures 0.3.6",
  "memchr",
  "pin-project",
 ]
@@ -1374,9 +1744,9 @@
 
 [[package]]
 name = "generic-array"
-version = "0.14.3"
+version = "0.14.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63"
+checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
 dependencies = [
  "typenum",
  "version_check",
@@ -1406,13 +1776,24 @@
 
 [[package]]
 name = "getrandom"
-version = "0.1.14"
+version = "0.1.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "wasi 0.9.0+wasi-snapshot-preview1",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
+checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
- "wasi",
+ "wasi 0.9.0+wasi-snapshot-preview1",
 ]
 
 [[package]]
@@ -1426,6 +1807,17 @@
 
 [[package]]
 name = "gimli"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+dependencies = [
+ "fallible-iterator",
+ "indexmap",
+ "stable_deref_trait",
+]
+
+[[package]]
+name = "gimli"
 version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
@@ -1450,15 +1842,28 @@
 ]
 
 [[package]]
+name = "gloo-timers"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
 name = "h2"
 version = "0.1.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "bytes 0.4.12",
  "fnv",
- "futures 0.1.29",
+ "futures 0.1.30",
  "http 0.1.21",
  "indexmap",
  "log",
@@ -1481,7 +1886,7 @@
  "http 0.2.1",
  "indexmap",
  "slab",
- "tokio 0.2.21",
+ "tokio 0.2.22",
  "tokio-util",
  "tracing",
 ]
@@ -1503,24 +1908,41 @@
 
 [[package]]
 name = "hashbrown"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da"
+dependencies = [
+ "byteorder 1.3.4",
+ "scopeguard 0.3.3",
+]
+
+[[package]]
+name = "hashbrown"
 version = "0.6.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead"
 dependencies = [
- "ahash",
+ "ahash 0.2.19",
  "autocfg 0.1.7",
 ]
 
 [[package]]
 name = "hashbrown"
-version = "0.8.1"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb"
+checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
 dependencies = [
- "autocfg 1.0.0",
+ "ahash 0.3.8",
+ "autocfg 1.0.1",
 ]
 
 [[package]]
+name = "hashbrown"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
+
+[[package]]
 name = "heck"
 version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1531,9 +1953,9 @@
 
 [[package]]
 name = "hermit-abi"
-version = "0.1.15"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
+checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
 dependencies = [
  "libc",
 ]
@@ -1546,22 +1968,15 @@
 
 [[package]]
 name = "hex-literal"
-version = "0.2.1"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0"
-dependencies = [
- "hex-literal-impl",
- "proc-macro-hack",
-]
+checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8"
 
 [[package]]
-name = "hex-literal-impl"
-version = "0.2.2"
+name = "hex_fmt"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "853f769599eb31de176303197b7ba4973299c38c7a7604a6bc88c3eef05b9b46"
-dependencies = [
- "proc-macro-hack",
-]
+checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f"
 
 [[package]]
 name = "hmac"
@@ -1613,7 +2028,7 @@
 checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "http 0.1.21",
  "tokio-buf",
 ]
@@ -1635,6 +2050,12 @@
 checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
 
 [[package]]
+name = "httpdate"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
+
+[[package]]
 name = "humantime"
 version = "1.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1650,7 +2071,7 @@
 checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "futures-cpupool",
  "h2 0.1.26",
  "http 0.1.21",
@@ -1675,9 +2096,9 @@
 
 [[package]]
 name = "hyper"
-version = "0.13.7"
+version = "0.13.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb"
+checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835"
 dependencies = [
  "bytes 0.5.6",
  "futures-channel",
@@ -1687,11 +2108,11 @@
  "http 0.2.1",
  "http-body 0.3.1",
  "httparse",
+ "httpdate",
  "itoa",
  "pin-project",
  "socket2",
- "time",
- "tokio 0.2.21",
+ "tokio 0.2.22",
  "tower-service",
  "tracing",
  "want 0.3.0",
@@ -1699,18 +2120,18 @@
 
 [[package]]
 name = "hyper-rustls"
-version = "0.20.0"
+version = "0.21.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08"
+checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6"
 dependencies = [
  "bytes 0.5.6",
  "ct-logs",
  "futures-util",
- "hyper 0.13.7",
+ "hyper 0.13.8",
  "log",
  "rustls",
  "rustls-native-certs",
- "tokio 0.2.21",
+ "tokio 0.2.22",
  "tokio-rustls",
  "webpki",
 ]
@@ -1744,15 +2165,6 @@
 checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53"
 dependencies = [
  "parity-scale-codec",
-]
-
-[[package]]
-name = "impl-serde"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8"
-dependencies = [
- "serde",
 ]
 
 [[package]]
@@ -1771,25 +2183,38 @@
 checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "indexmap"
-version = "1.5.0"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
+dependencies = [
+ "autocfg 1.0.1",
+ "hashbrown 0.9.1",
+ "serde",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7"
+checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66"
 dependencies = [
- "autocfg 1.0.0",
- "hashbrown 0.8.1",
+ "cfg-if 0.1.10",
 ]
 
 [[package]]
 name = "integer-sqrt"
-version = "0.1.3"
+version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b"
+checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770"
+dependencies = [
+ "num-traits",
+]
 
 [[package]]
 name = "intervalier"
@@ -1797,7 +2222,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 2.0.2",
 ]
 
@@ -1857,21 +2282,21 @@
 
 [[package]]
 name = "js-sys"
-version = "0.3.42"
+version = "0.3.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
+checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
 dependencies = [
  "wasm-bindgen",
 ]
 
 [[package]]
 name = "jsonrpc-client-transports"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecbdaacc17243168d9d1fa6b2bd7556a27e1e60a621d8a2a6e590ae2b145d158"
+checksum = "489b9c612e60c766f751ab40fcb43cbb55a1e10bb44a9b4307ed510ca598cbd7"
 dependencies = [
  "failure",
- "futures 0.1.29",
+ "futures 0.1.30",
  "jsonrpc-core",
  "jsonrpc-pubsub",
  "log",
@@ -1882,11 +2307,11 @@
 
 [[package]]
 name = "jsonrpc-core"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62"
+checksum = "0745a6379e3edc893c84ec203589790774e4247420033e71a76d3ab4687991fa"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "log",
  "serde",
  "serde_derive",
@@ -1895,30 +2320,30 @@
 
 [[package]]
 name = "jsonrpc-core-client"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34221123bc79b66279a3fde2d3363553835b43092d629b34f2e760c44dc94713"
+checksum = "6f764902d7b891344a0acb65625f32f6f7c6db006952143bd650209fbe7d94db"
 dependencies = [
  "jsonrpc-client-transports",
 ]
 
 [[package]]
 name = "jsonrpc-derive"
-version = "14.2.1"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fadf6945e227246825a583514534d864554e9f23d80b3c77d034b10983db5ef"
+checksum = "99a847f9ec7bb52149b2786a17c9cb260d6effc6b8eeb8c16b343a487a7563a3"
 dependencies = [
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "jsonrpc-http-server"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0da906d682799df05754480dac1b9e70ec92e12c19ebafd2662a5ea1c9fd6522"
+checksum = "4fb5c4513b7b542f42da107942b7b759f27120b5cc894729f88254b28dff44b7"
 dependencies = [
  "hyper 0.12.35",
  "jsonrpc-core",
@@ -1931,9 +2356,9 @@
 
 [[package]]
 name = "jsonrpc-ipc-server"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dedccd693325d833963b549e959137f30a7a0ea650cde92feda81dc0c1393cb5"
+checksum = "cf50e53e4eea8f421a7316c5f63e395f7bc7c4e786a6dc54d76fab6ff7aa7ce7"
 dependencies = [
  "jsonrpc-core",
  "jsonrpc-server-utils",
@@ -1945,9 +2370,9 @@
 
 [[package]]
 name = "jsonrpc-pubsub"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d44f5602a11d657946aac09357956d2841299ed422035edf140c552cb057986"
+checksum = "639558e0604013be9787ae52f798506ae42bf4220fe587bdc5625871cc8b9c77"
 dependencies = [
  "jsonrpc-core",
  "log",
@@ -1958,9 +2383,9 @@
 
 [[package]]
 name = "jsonrpc-server-utils"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56cbfb462e7f902e21121d9f0d1c2b77b2c5b642e1a4e8f4ebfa2e15b94402bb"
+checksum = "72f1f3990650c033bd8f6bd46deac76d990f9bbfb5f8dc8c4767bf0a00392176"
 dependencies = [
  "bytes 0.4.12",
  "globset",
@@ -1974,16 +2399,16 @@
 
 [[package]]
 name = "jsonrpc-ws-server"
-version = "14.2.0"
+version = "15.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "903d3109fe7c4acb932b567e1e607e0f524ed04741b09fb0e61841bc40a022fc"
+checksum = "6596fe75209b73a2a75ebe1dce4e60e03b88a2b25e8807b667597f6315150d22"
 dependencies = [
  "jsonrpc-core",
  "jsonrpc-server-utils",
  "log",
+ "parity-ws",
  "parking_lot 0.10.2",
  "slab",
- "ws",
 ]
 
 [[package]]
@@ -2013,19 +2438,19 @@
 
 [[package]]
 name = "kvdb"
-version = "0.6.0"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e763b2a9b500ba47948061d1e8bc3b5f03a8a1f067dbcf822a4d2c84d2b54a3a"
+checksum = "0315ef2f688e33844400b31f11c263f2b3dc21d8b9355c6891c5f185fae43f9a"
 dependencies = [
  "parity-util-mem",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
 ]
 
 [[package]]
 name = "kvdb-memorydb"
-version = "0.6.0"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73027d5e228de6f503b5b7335d530404fc26230a6ae3e09b33ec6e45408509a4"
+checksum = "73de822b260a3bdfb889dbbb65bb2d473eee2253973d6fa4a5d149a2a4a7c66e"
 dependencies = [
  "kvdb",
  "parity-util-mem",
@@ -2034,9 +2459,9 @@
 
 [[package]]
 name = "kvdb-rocksdb"
-version = "0.8.0"
+version = "0.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84384eca250c7ff67877eda5336f28a86586aaee24acb945643590671f6bfce1"
+checksum = "44947dd392f09475af614d740fe0320b66d01cb5b977f664bbbb5e45a70ea4c1"
 dependencies = [
  "fs-swap",
  "kvdb",
@@ -2047,7 +2472,7 @@
  "parking_lot 0.10.2",
  "regex",
  "rocksdb",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
 ]
 
 [[package]]
@@ -2058,33 +2483,21 @@
 
 [[package]]
 name = "lazycell"
-version = "1.2.1"
+version = "1.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
 
 [[package]]
-name = "libc"
-version = "0.2.73"
+name = "leb128"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
+checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a"
 
 [[package]]
-name = "libflate"
-version = "1.0.2"
+name = "libc"
+version = "0.2.79"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9bac9023e1db29c084f9f8cd9d3852e5e8fddf98fb47c4964a0ea4663d95949"
-dependencies = [
- "adler32",
- "crc32fast",
- "libflate_lz77",
- "rle-decode-fast",
-]
-
-[[package]]
-name = "libflate_lz77"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b"
+checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
 
 [[package]]
 name = "libloading"
@@ -2104,54 +2517,62 @@
 
 [[package]]
 name = "libp2p"
-version = "0.19.1"
+version = "0.28.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "057eba5432d3e740e313c6e13c9153d0cb76b4f71bfc2e5242ae5bdb7d41af67"
+checksum = "571f5a4604c1a40d75651da141dfde29ad15329f537a779528803297d2220274"
 dependencies = [
+ "atomic",
  "bytes 0.5.6",
- "futures 0.3.5",
+ "futures 0.3.6",
  "lazy_static",
  "libp2p-core",
  "libp2p-core-derive",
+ "libp2p-deflate",
  "libp2p-dns",
+ "libp2p-floodsub",
+ "libp2p-gossipsub",
  "libp2p-identify",
  "libp2p-kad",
  "libp2p-mdns",
  "libp2p-mplex",
  "libp2p-noise",
  "libp2p-ping",
+ "libp2p-plaintext",
+ "libp2p-pnet",
+ "libp2p-request-response",
  "libp2p-swarm",
  "libp2p-tcp",
+ "libp2p-uds",
  "libp2p-wasm-ext",
  "libp2p-websocket",
  "libp2p-yamux",
  "multihash",
- "parity-multiaddr 0.9.1",
+ "parity-multiaddr",
  "parking_lot 0.10.2",
  "pin-project",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-core"
-version = "0.19.2"
+version = "0.22.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a0387b930c3d4c2533dc4893c1e0394185ddcc019846121b1b27491e45a2c08"
+checksum = "52f13ba8c7df0768af2eb391696d562c7de88cc3a35122531aaa6a7d77754d25"
 dependencies = [
  "asn1_der",
  "bs58",
  "ed25519-dalek",
  "either",
  "fnv",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "lazy_static",
  "libsecp256k1",
  "log",
  "multihash",
  "multistream-select",
- "parity-multiaddr 0.9.1",
+ "parity-multiaddr",
  "parking_lot 0.10.2",
  "pin-project",
  "prost",
@@ -2160,7 +2581,7 @@
  "ring",
  "rw-stream-sink",
  "sha2 0.8.2",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "thiserror",
  "unsigned-varint 0.4.0",
  "void",
@@ -2169,53 +2590,107 @@
 
 [[package]]
 name = "libp2p-core-derive"
-version = "0.19.1"
+version = "0.20.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f09548626b737ed64080fde595e06ce1117795b8b9fc4d2629fa36561c583171"
+checksum = "f753d9324cd3ec14bf04b8a8cd0d269c87f294153d6bf2a84497a63a5ad22213"
 dependencies = [
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
+name = "libp2p-deflate"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74029ae187f35f4b8ddf26b9779a68b340045d708528a103917cdca49a296db5"
+dependencies = [
+ "flate2",
+ "futures 0.3.6",
+ "libp2p-core",
+]
+
+[[package]]
 name = "libp2p-dns"
-version = "0.19.0"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cc186d9a941fd0207cf8f08ef225a735e2d7296258f570155e525f6ee732f87"
+checksum = "7cf319822e08dd65c8e060d2354e9f952895bbc433f5706c75ed010c152aee5e"
+dependencies = [
+ "futures 0.3.6",
+ "libp2p-core",
+ "log",
+]
+
+[[package]]
+name = "libp2p-floodsub"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8a9acb43a3e4a4e413e0c4abe0fa49308df7c6335c88534757b647199cb8a51"
+dependencies = [
+ "cuckoofilter",
+ "fnv",
+ "futures 0.3.6",
+ "libp2p-core",
+ "libp2p-swarm",
+ "prost",
+ "prost-build",
+ "rand 0.7.3",
+ "smallvec 1.4.2",
+]
+
+[[package]]
+name = "libp2p-gossipsub"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab20fcb60edebe3173bbb708c6ac3444afdf1e3152dc2866b10c4f5497f17467"
 dependencies = [
- "futures 0.3.5",
+ "base64 0.11.0",
+ "byteorder 1.3.4",
+ "bytes 0.5.6",
+ "fnv",
+ "futures 0.3.6",
+ "futures_codec",
+ "hex_fmt",
  "libp2p-core",
+ "libp2p-swarm",
  "log",
+ "lru_time_cache",
+ "prost",
+ "prost-build",
+ "rand 0.7.3",
+ "sha2 0.8.2",
+ "smallvec 1.4.2",
+ "unsigned-varint 0.4.0",
+ "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-identify"
-version = "0.19.2"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f76075b170d908bae616f550ade410d9d27c013fa69042551dbfc757c7c094"
+checksum = "56396ee63aa9164eacf40c2c5d2bda8c4133c2f57e1b0425d51d3a4e362583b1"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "libp2p-core",
  "libp2p-swarm",
  "log",
  "prost",
  "prost-build",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-kad"
-version = "0.19.0"
+version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41d6c1d5100973527ae70d82687465b17049c1b717a7964de38b8e65000878ff"
+checksum = "cc7fa9047f8b8f544278a35c2d9d45d3b2c1785f2d86d4e1629d6edf97be3955"
 dependencies = [
  "arrayvec 0.5.1",
  "bytes 0.5.6",
  "either",
  "fnv",
- "futures 0.3.5",
- "futures_codec 0.3.4",
+ "futures 0.3.6",
+ "futures_codec",
  "libp2p-core",
  "libp2p-swarm",
  "log",
@@ -2224,45 +2699,45 @@
  "prost-build",
  "rand 0.7.3",
  "sha2 0.8.2",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "uint",
- "unsigned-varint 0.3.3",
+ "unsigned-varint 0.4.0",
  "void",
  "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-mdns"
-version = "0.19.2"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f55b2d4b80986e5bf158270ab23268ec0e7f644ece5436fbaabc5155472f357"
+checksum = "3173b5a6b2f690c29ae07798d85b9441a131ac76ddae9015ef22905b623d0c69"
 dependencies = [
  "async-std",
  "data-encoding",
  "dns-parser",
  "either",
- "futures 0.3.5",
+ "futures 0.3.6",
  "lazy_static",
  "libp2p-core",
  "libp2p-swarm",
  "log",
  "net2",
  "rand 0.7.3",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "void",
  "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-mplex"
-version = "0.19.2"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be7d913a4cd57de2013257ec73f07d77bfce390b370023e2d59083e5ca079864"
+checksum = "8a73a799cc8410b36e40b8f4c4b6babbcb9efd3727111bf517876e4acfa612d3"
 dependencies = [
  "bytes 0.5.6",
  "fnv",
- "futures 0.3.5",
- "futures_codec 0.4.1",
+ "futures 0.3.6",
+ "futures_codec",
  "libp2p-core",
  "log",
  "parking_lot 0.10.2",
@@ -2271,12 +2746,13 @@
 
 [[package]]
 name = "libp2p-noise"
-version = "0.19.1"
+version = "0.24.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a03db664653369f46ee03fcec483a378c20195089bb43a26cb9fb0058009ac88"
+checksum = "6ef6c490042f549fb1025f2892dfe6083d97a77558f450c1feebe748ca9eb15a"
 dependencies = [
- "curve25519-dalek",
- "futures 0.3.5",
+ "bytes 0.5.6",
+ "curve25519-dalek 2.1.0",
+ "futures 0.3.6",
  "lazy_static",
  "libp2p-core",
  "log",
@@ -2286,17 +2762,17 @@
  "sha2 0.8.2",
  "snow",
  "static_assertions",
- "x25519-dalek",
+ "x25519-dalek 0.6.0",
  "zeroize",
 ]
 
 [[package]]
 name = "libp2p-ping"
-version = "0.19.3"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8dedd34e35a9728d52d59ef36a218e411359a353f9011b2574b86ee790978f6"
+checksum = "ad063c21dfcea4518ac9e8bd4119d33a5b26c41e674f602f41f05617a368a5c8"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "libp2p-core",
  "libp2p-swarm",
  "log",
@@ -2306,28 +2782,81 @@
 ]
 
 [[package]]
-name = "libp2p-swarm"
+name = "libp2p-plaintext"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "903a12e99c72dbebefea258de887982adeacc7025baa1ceb10b7fa9928f54791"
+dependencies = [
+ "bytes 0.5.6",
+ "futures 0.3.6",
+ "futures_codec",
+ "libp2p-core",
+ "log",
+ "prost",
+ "prost-build",
+ "rw-stream-sink",
+ "unsigned-varint 0.4.0",
+ "void",
+]
+
+[[package]]
+name = "libp2p-pnet"
 version = "0.19.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce53ff4d127cf8b39adf84dbd381ca32d49bd85788cee08e6669da2495993930"
+checksum = "37d0db10e139d22d7af0b23ed7949449ec86262798aa0fd01595abdbcb02dc87"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
+ "log",
+ "pin-project",
+ "rand 0.7.3",
+ "salsa20",
+ "sha3 0.8.2",
+]
+
+[[package]]
+name = "libp2p-request-response"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c0c9e8a4cd69d97e9646c54313d007512f411aba8c5226cfcda16df6a6e84a3"
+dependencies = [
+ "async-trait",
+ "bytes 0.5.6",
+ "futures 0.3.6",
  "libp2p-core",
+ "libp2p-swarm",
  "log",
+ "lru 0.6.0",
+ "minicbor",
  "rand 0.7.3",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
+ "unsigned-varint 0.5.1",
+ "wasm-timer",
+]
+
+[[package]]
+name = "libp2p-swarm"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7193e444210132237b81b755ec7fe53f1c4bd2f53cf719729b94c0c72eb6eaa1"
+dependencies = [
+ "either",
+ "futures 0.3.6",
+ "libp2p-core",
+ "log",
+ "rand 0.7.3",
+ "smallvec 1.4.2",
  "void",
  "wasm-timer",
 ]
 
 [[package]]
 name = "libp2p-tcp"
-version = "0.19.2"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9481500c5774c62e8c413e9535b3f33a0e3dbacf2da63b8d3056c686a9df4146"
+checksum = "44f42ec130d7a37a7e47bf4398026b7ad9185c08ed26972e2720f8b94112796f"
 dependencies = [
  "async-std",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "get_if_addrs",
  "ipnet",
@@ -2337,12 +2866,24 @@
 ]
 
 [[package]]
+name = "libp2p-uds"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dea7acb0a034f70d7db94c300eba3f65c0f6298820105624088a9609c9974d77"
+dependencies = [
+ "async-std",
+ "futures 0.3.6",
+ "libp2p-core",
+ "log",
+]
+
+[[package]]
 name = "libp2p-wasm-ext"
-version = "0.19.0"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f59fdbb5706f2723ca108c088b1c7a37f735a8c328021f0508007162627e9885"
+checksum = "34c1faac6f92c21fbe155417957863ea822fba9e9fd5eb24c0912336a100e63f"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "js-sys",
  "libp2p-core",
  "parity-send-wrapper",
@@ -2352,14 +2893,13 @@
 
 [[package]]
 name = "libp2p-websocket"
-version = "0.19.0"
+version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "085fbe4c05c4116c2164ab4d5a521eb6e00516c444f61b3ee9f68c7b1e53580b"
+checksum = "d650534ebd99f48f6fa292ed5db10d30df2444943afde4407ceeddab8e513fca"
 dependencies = [
  "async-tls",
- "bytes 0.5.6",
  "either",
- "futures 0.3.5",
+ "futures 0.3.6",
  "libp2p-core",
  "log",
  "quicksink",
@@ -2373,22 +2913,22 @@
 
 [[package]]
 name = "libp2p-yamux"
-version = "0.19.1"
+version = "0.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da33e7b5f49c75c6a8afb0b8d1e229f5fa48be9f39bd14cdbc21459a02ac6fc"
+checksum = "781d9b9f043dcdabc40640807125368596b849fd4d96cdca2dcf052fdf6f33fd"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "libp2p-core",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.0",
  "thiserror",
  "yamux",
 ]
 
 [[package]]
 name = "librocksdb-sys"
-version = "6.7.4"
+version = "6.11.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005"
+checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09"
 dependencies = [
  "bindgen",
  "cc",
@@ -2408,18 +2948,17 @@
  "hmac-drbg",
  "rand 0.7.3",
  "sha2 0.8.2",
- "subtle 2.2.3",
+ "subtle 2.3.0",
  "typenum",
 ]
 
 [[package]]
 name = "libz-sys"
-version = "1.0.25"
+version = "1.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
+checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
 dependencies = [
  "cc",
- "libc",
  "pkg-config",
  "vcpkg",
 ]
@@ -2432,9 +2971,9 @@
 
 [[package]]
 name = "linked_hash_set"
-version = "0.1.3"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c"
+checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588"
 dependencies = [
  "linked-hash-map",
 ]
@@ -2452,11 +2991,29 @@
 
 [[package]]
 name = "lock_api"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
+dependencies = [
+ "scopeguard 0.3.3",
+]
+
+[[package]]
+name = "lock_api"
 version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
 dependencies = [
- "scopeguard",
+ "scopeguard 1.1.0",
+]
+
+[[package]]
+name = "lock_api"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
+dependencies = [
+ "scopeguard 1.1.0",
 ]
 
 [[package]]
@@ -2465,7 +3022,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
 ]
 
 [[package]]
@@ -2478,6 +3035,39 @@
 ]
 
 [[package]]
+name = "lru"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "111b945ac72ec09eb7bc62a0fbdc3cc6e80555a7245f52a69d3921a75b53b153"
+dependencies = [
+ "hashbrown 0.8.2",
+]
+
+[[package]]
+name = "lru_time_cache"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adb241df5c4caeb888755363fc95f8a896618dc0d435e9e775f7930cb099beab"
+
+[[package]]
+name = "mach"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "matchers"
+version = "0.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
+dependencies = [
+ "regex-automata",
+]
+
+[[package]]
 name = "matches"
 version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2516,22 +3106,21 @@
 
 [[package]]
 name = "memoffset"
-version = "0.5.5"
+version = "0.5.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f"
+checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
 dependencies = [
- "autocfg 1.0.0",
+ "autocfg 1.0.1",
 ]
 
 [[package]]
 name = "memory-db"
-version = "0.21.0"
+version = "0.24.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb2999ff7a65d5a1d72172f6d51fa2ea03024b51aee709ba5ff81c3c629a2410"
+checksum = "36f36ddb0b2cdc25d38babba472108798e3477f02be5165f038c5e393e50c57a"
 dependencies = [
- "ahash",
  "hash-db",
- "hashbrown 0.6.3",
+ "hashbrown 0.8.2",
  "parity-util-mem",
 ]
 
@@ -2547,19 +3136,40 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c6feca46f4fa3443a01769d768727f10c10a20fdb65e52dc16a81f0c8269bb78"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "keccak",
  "rand_core 0.5.1",
  "zeroize",
 ]
 
 [[package]]
+name = "minicbor"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fc03ad6f8f548db7194a5ff5a6f96342ecae4e3ef67d2bf18bacc0e245cd041"
+dependencies = [
+ "minicbor-derive",
+]
+
+[[package]]
+name = "minicbor-derive"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c214bf3d90099b52f3e4b328ae0fe34837fd0fab683ad1e10fceb4629106df48"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
 name = "miniz_oxide"
-version = "0.4.0"
+version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f"
+checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
 dependencies = [
  "adler",
+ "autocfg 1.0.1",
 ]
 
 [[package]]
@@ -2568,7 +3178,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "fuchsia-zircon",
  "fuchsia-zircon-sys",
  "iovec",
@@ -2639,25 +3249,31 @@
 ]
 
 [[package]]
+name = "more-asserts"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
+
+[[package]]
 name = "multihash"
-version = "0.11.2"
+version = "0.11.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f75db05d738947aa5389863aadafbcf2e509d7ba099dc2ddcdf4fc66bf7a9e03"
+checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6"
 dependencies = [
  "blake2b_simd",
  "blake2s_simd",
- "digest 0.8.1",
- "sha-1",
- "sha2 0.8.2",
- "sha3",
- "unsigned-varint 0.3.3",
+ "digest 0.9.0",
+ "sha-1 0.9.1",
+ "sha2 0.9.1",
+ "sha3 0.9.1",
+ "unsigned-varint 0.5.1",
 ]
 
 [[package]]
 name = "multimap"
-version = "0.8.1"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce"
+checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333"
 
 [[package]]
 name = "multistream-select"
@@ -2666,10 +3282,10 @@
 checksum = "c9157e87afbc2ef0d84cc0345423d715f445edde00141c93721c162de35a05e5"
 dependencies = [
  "bytes 0.5.6",
- "futures 0.3.5",
+ "futures 0.3.6",
  "log",
  "pin-project",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "unsigned-varint 0.4.0",
 ]
 
@@ -2685,7 +3301,7 @@
  "matrixmultiply",
  "num-complex",
  "num-rational",
- "num-traits 0.2.12",
+ "num-traits",
  "rand 0.6.5",
  "typenum",
 ]
@@ -2700,39 +3316,38 @@
 ]
 
 [[package]]
-name = "net2"
-version = "0.2.34"
+name = "nb-connect"
+version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
+checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998"
 dependencies = [
- "cfg-if",
  "libc",
  "winapi 0.3.9",
 ]
 
 [[package]]
-name = "netstat2"
-version = "0.8.1"
+name = "net2"
+version = "0.2.35"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29449d242064c48d3057a194b049a2bdcccadda16faa18a91468677b44e8d422"
+checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853"
 dependencies = [
- "bitflags",
- "byteorder",
- "enum-primitive-derive",
+ "cfg-if 0.1.10",
  "libc",
- "num-traits 0.2.12",
- "thiserror",
+ "winapi 0.3.9",
 ]
 
 [[package]]
 name = "nft"
-version = "2.0.0-rc4"
+version = "2.0.0"
 dependencies = [
- "futures 0.3.5",
+ "frame-benchmarking",
+ "frame-benchmarking-cli",
+ "futures 0.3.6",
  "jsonrpc-core",
  "log",
  "nft-runtime",
  "pallet-contracts-rpc",
+ "pallet-transaction-payment-rpc",
  "parking_lot 0.10.2",
  "sc-basic-authorship",
  "sc-cli",
@@ -2743,8 +3358,12 @@
  "sc-finality-grandpa",
  "sc-network",
  "sc-rpc",
+ "sc-rpc-api",
  "sc-service",
  "sc-transaction-pool",
+ "sp-api",
+ "sp-block-builder",
+ "sp-blockchain",
  "sp-consensus",
  "sp-consensus-aura",
  "sp-core",
@@ -2754,15 +3373,20 @@
  "sp-transaction-pool",
  "structopt",
  "substrate-build-script-utils",
+ "substrate-frame-rpc-system",
 ]
 
 [[package]]
 name = "nft-runtime"
-version = "2.0.0-rc4"
+version = "2.0.0"
 dependencies = [
+ "frame-benchmarking",
  "frame-executive",
  "frame-support",
  "frame-system",
+ "frame-system-benchmarking",
+ "frame-system-rpc-runtime-api",
+ "hex-literal",
  "pallet-aura",
  "pallet-balances",
  "pallet-contracts",
@@ -2774,6 +3398,7 @@
  "pallet-sudo",
  "pallet-timestamp",
  "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc-runtime-api",
  "parity-scale-codec",
  "serde",
  "sp-api",
@@ -2781,7 +3406,6 @@
  "sp-consensus-aura",
  "sp-core",
  "sp-inherents",
- "sp-io",
  "sp-offchain",
  "sp-runtime",
  "sp-session",
@@ -2799,7 +3423,7 @@
 dependencies = [
  "bitflags",
  "cc",
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
  "void",
 ]
@@ -2827,23 +3451,14 @@
 ]
 
 [[package]]
-name = "ntapi"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
 name = "num-bigint"
 version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
 dependencies = [
- "autocfg 1.0.0",
+ "autocfg 1.0.1",
  "num-integer",
- "num-traits 0.2.12",
+ "num-traits",
 ]
 
 [[package]]
@@ -2852,8 +3467,8 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
 dependencies = [
- "autocfg 1.0.0",
- "num-traits 0.2.12",
+ "autocfg 1.0.1",
+ "num-traits",
 ]
 
 [[package]]
@@ -2862,8 +3477,8 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
 dependencies = [
- "autocfg 1.0.0",
- "num-traits 0.2.12",
+ "autocfg 1.0.1",
+ "num-traits",
 ]
 
 [[package]]
@@ -2872,19 +3487,10 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
 dependencies = [
- "autocfg 1.0.0",
+ "autocfg 1.0.1",
  "num-bigint",
  "num-integer",
- "num-traits 0.2.12",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.1.43"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
-dependencies = [
- "num-traits 0.2.12",
+ "num-traits",
 ]
 
 [[package]]
@@ -2893,7 +3499,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
 dependencies = [
- "autocfg 1.0.0",
+ "autocfg 1.0.1",
  "libm",
 ]
 
@@ -2909,17 +3515,43 @@
 
 [[package]]
 name = "object"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
+
+[[package]]
+name = "object"
 version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
+dependencies = [
+ "crc32fast",
+ "indexmap",
+ "wasmparser 0.57.0",
+]
 
 [[package]]
+name = "object"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
+
+[[package]]
+name = "once_cell"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37"
+dependencies = [
+ "parking_lot 0.7.1",
+]
+
+[[package]]
 name = "once_cell"
-version = "1.4.0"
+version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
+checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
 dependencies = [
- "parking_lot 0.10.2",
+ "parking_lot 0.11.0",
 ]
 
 [[package]]
@@ -2951,8 +3583,8 @@
 
 [[package]]
 name = "pallet-aura"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -2969,9 +3601,24 @@
 ]
 
 [[package]]
+name = "pallet-authorship"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "frame-support",
+ "frame-system",
+ "impl-trait-for-tuples",
+ "parity-scale-codec",
+ "sp-authorship",
+ "sp-inherents",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "pallet-balances"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
@@ -2984,9 +3631,10 @@
 
 [[package]]
 name = "pallet-contracts"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
+ "bitflags",
  "frame-support",
  "frame-system",
  "pallet-contracts-primitives",
@@ -3004,8 +3652,8 @@
 
 [[package]]
 name = "pallet-contracts-primitives"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-runtime",
@@ -3014,8 +3662,8 @@
 
 [[package]]
 name = "pallet-contracts-rpc"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "jsonrpc-core",
  "jsonrpc-core-client",
@@ -3033,8 +3681,8 @@
 
 [[package]]
 name = "pallet-contracts-rpc-runtime-api"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "pallet-contracts-primitives",
  "parity-scale-codec",
@@ -3045,8 +3693,8 @@
 
 [[package]]
 name = "pallet-finality-tracker"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3061,11 +3709,13 @@
 
 [[package]]
 name = "pallet-grandpa"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
+ "frame-benchmarking",
  "frame-support",
  "frame-system",
+ "pallet-authorship",
  "pallet-finality-tracker",
  "pallet-session",
  "parity-scale-codec",
@@ -3081,8 +3731,9 @@
 
 [[package]]
 name = "pallet-nft"
-version = "2.0.0-rc4"
+version = "2.0.0"
 dependencies = [
+ "frame-benchmarking",
  "frame-support",
  "frame-system",
  "log",
@@ -3097,8 +3748,8 @@
 
 [[package]]
 name = "pallet-randomness-collective-flip"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3110,8 +3761,8 @@
 
 [[package]]
 name = "pallet-session"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3130,8 +3781,8 @@
 
 [[package]]
 name = "pallet-sudo"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
@@ -3144,8 +3795,8 @@
 
 [[package]]
 name = "pallet-timestamp"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
@@ -3154,6 +3805,7 @@
  "parity-scale-codec",
  "serde",
  "sp-inherents",
+ "sp-io",
  "sp-runtime",
  "sp-std",
  "sp-timestamp",
@@ -3161,23 +3813,43 @@
 
 [[package]]
 name = "pallet-transaction-payment"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "frame-system",
  "pallet-transaction-payment-rpc-runtime-api",
  "parity-scale-codec",
  "serde",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
+ "sp-core",
+ "sp-io",
  "sp-runtime",
  "sp-std",
 ]
 
 [[package]]
+name = "pallet-transaction-payment-rpc"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "jsonrpc-core",
+ "jsonrpc-core-client",
+ "jsonrpc-derive",
+ "pallet-transaction-payment-rpc-runtime-api",
+ "parity-scale-codec",
+ "serde",
+ "sp-api",
+ "sp-blockchain",
+ "sp-core",
+ "sp-rpc",
+ "sp-runtime",
+]
+
+[[package]]
 name = "pallet-transaction-payment-rpc-runtime-api"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "frame-support",
  "parity-scale-codec",
@@ -3203,31 +3875,13 @@
 
 [[package]]
 name = "parity-multiaddr"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f77055f9e81921a8cc7bebeb6cded3d128931d51f1e3dd6251f0770a6d431477"
-dependencies = [
- "arrayref",
- "bs58",
- "byteorder",
- "data-encoding",
- "parity-multihash",
- "percent-encoding 2.1.0",
- "serde",
- "static_assertions",
- "unsigned-varint 0.3.3",
- "url 2.1.1",
-]
-
-[[package]]
-name = "parity-multiaddr"
-version = "0.9.1"
+version = "0.9.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc20af3143a62c16e7c9e92ea5c6ae49f7d271d97d4d8fe73afc28f0514a3d0f"
+checksum = "2165a93382a93de55868dcbfa11e4a8f99676a9164eee6a2b4a9479ad319c257"
 dependencies = [
  "arrayref",
  "bs58",
- "byteorder",
+ "byteorder 1.3.4",
  "data-encoding",
  "multihash",
  "percent-encoding 2.1.0",
@@ -3235,28 +3889,13 @@
  "static_assertions",
  "unsigned-varint 0.4.0",
  "url 2.1.1",
-]
-
-[[package]]
-name = "parity-multihash"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a1cd2ba02391b81367bec529fb209019d718684fdc8ad6a712c2b536e46f775"
-dependencies = [
- "blake2 0.8.1",
- "bytes 0.5.6",
- "rand 0.7.3",
- "sha-1",
- "sha2 0.8.2",
- "sha3",
- "unsigned-varint 0.3.3",
 ]
 
 [[package]]
 name = "parity-scale-codec"
-version = "1.3.1"
+version = "1.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a74f02beb35d47e0706155c9eac554b50c671e0d868fe8296bcdf44a9a4847bf"
+checksum = "7c740e5fbcb6847058b40ac7e5574766c6388f585e184d769910fe0d3a2ca861"
 dependencies = [
  "arrayvec 0.5.1",
  "bitvec",
@@ -3267,14 +3906,14 @@
 
 [[package]]
 name = "parity-scale-codec-derive"
-version = "1.2.0"
+version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a0ec292e92e8ec7c58e576adacc1e3f399c597c8f263c42f18420abe58e7245"
+checksum = "198db82bb1c18fc00176004462dd809b2a6d851669550aa17af6dacd21ae0c14"
 dependencies = [
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -3290,7 +3929,7 @@
 checksum = "1e57fea504fea33f9fbb5f49f378359030e7e026a6ab849bb9e8f0787376f1bf"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "libc",
  "log",
  "mio-named-pipes",
@@ -3304,16 +3943,17 @@
 
 [[package]]
 name = "parity-util-mem"
-version = "0.6.1"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c6e2583649a3ca84894d1d71da249abcfda54d5aca24733d72ca10d0f02361c"
+checksum = "297ff91fa36aec49ce183484b102f6b75b46776822bd81525bfc4cc9b0dd0f5c"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
+ "hashbrown 0.8.2",
  "impl-trait-for-tuples",
  "parity-util-mem-derive",
  "parking_lot 0.10.2",
  "primitive-types",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "winapi 0.3.9",
 ]
 
@@ -3324,7 +3964,7 @@
 checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2"
 dependencies = [
  "proc-macro2",
- "syn 1.0.34",
+ "syn",
  "synstructure",
 ]
 
@@ -3335,12 +3975,46 @@
 checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865"
 
 [[package]]
+name = "parity-ws"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e02a625dd75084c2a7024f07c575b61b782f729d18702dabb3cdbf31911dc61"
+dependencies = [
+ "byteorder 1.3.4",
+ "bytes 0.4.12",
+ "httparse",
+ "log",
+ "mio",
+ "mio-extras",
+ "rand 0.7.3",
+ "sha-1 0.8.2",
+ "slab",
+ "url 2.1.1",
+]
+
+[[package]]
+name = "parking"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
+
+[[package]]
+name = "parking_lot"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
+dependencies = [
+ "lock_api 0.1.5",
+ "parking_lot_core 0.4.0",
+]
+
+[[package]]
 name = "parking_lot"
 version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
 dependencies = [
- "lock_api",
+ "lock_api 0.3.4",
  "parking_lot_core 0.6.2",
  "rustc_version",
 ]
@@ -3351,18 +4025,42 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
 dependencies = [
- "lock_api",
+ "lock_api 0.3.4",
  "parking_lot_core 0.7.2",
 ]
 
 [[package]]
+name = "parking_lot"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
+dependencies = [
+ "instant",
+ "lock_api 0.4.1",
+ "parking_lot_core 0.8.0",
+]
+
+[[package]]
 name = "parking_lot_core"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
+dependencies = [
+ "libc",
+ "rand 0.6.5",
+ "rustc_version",
+ "smallvec 0.6.13",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "parking_lot_core"
 version = "0.6.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
 dependencies = [
- "cfg-if",
- "cloudabi",
+ "cfg-if 0.1.10",
+ "cloudabi 0.0.3",
  "libc",
  "redox_syscall",
  "rustc_version",
@@ -3376,11 +4074,26 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
 dependencies = [
- "cfg-if",
- "cloudabi",
+ "cfg-if 0.1.10",
+ "cloudabi 0.0.3",
+ "libc",
+ "redox_syscall",
+ "smallvec 1.4.2",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
+dependencies = [
+ "cfg-if 0.1.10",
+ "cloudabi 0.1.0",
+ "instant",
  "libc",
  "redox_syscall",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "winapi 0.3.9",
 ]
 
@@ -3409,8 +4122,9 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "crypto-mac 0.7.0",
+ "rayon",
 ]
 
 [[package]]
@@ -3443,29 +4157,29 @@
 
 [[package]]
 name = "pin-project"
-version = "0.4.22"
+version = "0.4.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
+checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15"
 dependencies = [
  "pin-project-internal",
 ]
 
 [[package]]
 name = "pin-project-internal"
-version = "0.4.22"
+version = "0.4.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
+checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "pin-project-lite"
-version = "0.1.7"
+version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
+checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95"
 
 [[package]]
 name = "pin-utils"
@@ -3475,9 +4189,9 @@
 
 [[package]]
 name = "pkg-config"
-version = "0.3.18"
+version = "0.3.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
+checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
 
 [[package]]
 name = "platforms"
@@ -3486,29 +4200,42 @@
 checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e"
 
 [[package]]
+name = "polling"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab773feb154f12c49ffcfd66ab8bdcf9a1843f950db48b0d8be9d4393783b058"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "log",
+ "wepoll-sys",
+ "winapi 0.3.9",
+]
+
+[[package]]
 name = "poly1305"
-version = "0.6.0"
+version = "0.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b42192ab143ed7619bf888a7f9c6733a9a2153b218e2cd557cfdb52fbf9bb1"
+checksum = "22ce46de8e53ee414ca4d02bfefac75d8c12fba948b76622a40b4be34dfce980"
 dependencies = [
  "universal-hash",
 ]
 
 [[package]]
 name = "polyval"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc"
+checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "universal-hash",
 ]
 
 [[package]]
 name = "ppv-lite86"
-version = "0.2.8"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
+checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
 
 [[package]]
 name = "primitive-types"
@@ -3518,7 +4245,7 @@
 dependencies = [
  "fixed-hash",
  "impl-codec",
- "impl-serde 0.3.1",
+ "impl-serde",
  "uint",
 ]
 
@@ -3533,35 +4260,33 @@
 
 [[package]]
 name = "proc-macro-error"
-version = "1.0.3"
+version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
 dependencies = [
  "proc-macro-error-attr",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
  "version_check",
 ]
 
 [[package]]
 name = "proc-macro-error-attr"
-version = "1.0.3"
+version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
- "syn-mid",
+ "quote",
  "version_check",
 ]
 
 [[package]]
 name = "proc-macro-hack"
-version = "0.5.16"
+version = "0.5.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
+checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
 
 [[package]]
 name = "proc-macro-nested"
@@ -3571,39 +4296,24 @@
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
-dependencies = [
- "unicode-xid 0.2.1",
-]
-
-[[package]]
-name = "procfs"
-version = "0.7.9"
+version = "1.0.24"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c434e93ef69c216e68e4f417c927b4f31502c3560b72cfdb6827e2321c5c6b3e"
+checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
 dependencies = [
- "bitflags",
- "byteorder",
- "chrono",
- "hex",
- "lazy_static",
- "libc",
- "libflate",
+ "unicode-xid",
 ]
 
 [[package]]
 name = "prometheus"
-version = "0.8.0"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20"
+checksum = "30d70cf4412832bcac9cffe27906f4a66e450d323525e977168c70d1b36120ae"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "fnv",
  "lazy_static",
- "protobuf",
- "spin",
+ "parking_lot 0.11.0",
+ "regex",
  "thiserror",
 ]
 
@@ -3644,8 +4354,8 @@
  "anyhow",
  "itertools 0.8.2",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -3657,20 +4367,14 @@
  "bytes 0.5.6",
  "prost",
 ]
-
-[[package]]
-name = "protobuf"
-version = "2.16.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d883f78645c21b7281d21305181aa1f4dd9e9363e7cf2566c93121552cff003e"
 
 [[package]]
 name = "pwasm-utils"
-version = "0.12.0"
+version = "0.14.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192"
+checksum = "0f53bc2558e8376358ebdc28301546471d67336584f6438ed4b7c7457a055fd7"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "log",
  "parity-wasm",
 ]
@@ -3694,12 +4398,6 @@
 
 [[package]]
 name = "quote"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
-
-[[package]]
-name = "quote"
 version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
@@ -3742,7 +4440,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
 dependencies = [
- "cloudabi",
+ "cloudabi 0.0.3",
  "fuchsia-cprng",
  "libc",
  "rand_core 0.3.1",
@@ -3774,7 +4472,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
 dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
  "libc",
  "rand_chacha 0.2.2",
  "rand_core 0.5.1",
@@ -3823,7 +4521,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
 dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
 ]
 
 [[package]]
@@ -3870,7 +4568,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
 dependencies = [
- "cloudabi",
+ "cloudabi 0.0.3",
  "fuchsia-cprng",
  "libc",
  "rand_core 0.4.2",
@@ -3907,6 +4605,17 @@
 ]
 
 [[package]]
+name = "raw-cpuid"
+version = "7.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
+dependencies = [
+ "bitflags",
+ "cc",
+ "rustc_version",
+]
+
+[[package]]
 name = "rawpointer"
 version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3914,11 +4623,11 @@
 
 [[package]]
 name = "rayon"
-version = "1.3.1"
+version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
+checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032"
 dependencies = [
- "autocfg 1.0.0",
+ "autocfg 1.0.1",
  "crossbeam-deque",
  "either",
  "rayon-core",
@@ -3926,12 +4635,12 @@
 
 [[package]]
 name = "rayon-core"
-version = "1.7.1"
+version = "1.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
+checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf"
 dependencies = [
+ "crossbeam-channel",
  "crossbeam-deque",
- "crossbeam-queue",
  "crossbeam-utils",
  "lazy_static",
  "num_cpus",
@@ -3954,11 +4663,11 @@
 
 [[package]]
 name = "redox_users"
-version = "0.3.4"
+version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
+checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
 dependencies = [
- "getrandom",
+ "getrandom 0.1.15",
  "redox_syscall",
  "rust-argon2",
 ]
@@ -3979,15 +4688,26 @@
 checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "regalloc"
+version = "0.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9ba8aaf5fe7cf307c6dbdaeed85478961d29e25e3bee5169e11b92fa9f027a8"
+dependencies = [
+ "log",
+ "rustc-hash",
+ "smallvec 1.4.2",
 ]
 
 [[package]]
 name = "regex"
-version = "1.3.9"
+version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
+checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -3996,40 +4716,47 @@
 ]
 
 [[package]]
+name = "regex-automata"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
+dependencies = [
+ "byteorder 1.3.4",
+ "regex-syntax",
+]
+
+[[package]]
 name = "regex-syntax"
-version = "0.6.18"
+version = "0.6.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
+checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c"
 
 [[package]]
-name = "remove_dir_all"
-version = "0.5.3"
+name = "region"
+version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
+checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0"
 dependencies = [
+ "bitflags",
+ "libc",
+ "mach",
  "winapi 0.3.9",
 ]
 
 [[package]]
-name = "rental"
-version = "0.5.5"
+name = "remove_dir_all"
+version = "0.5.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f"
+checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
 dependencies = [
- "rental-impl",
- "stable_deref_trait",
+ "winapi 0.3.9",
 ]
 
 [[package]]
-name = "rental-impl"
-version = "0.5.5"
+name = "retain_mut"
+version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de"
-dependencies = [
- "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
-]
+checksum = "e005d658ad26eacc2b6c506dfde519f4e277e328d0eb3379ca61647d70a8f531"
 
 [[package]]
 name = "ring"
@@ -4039,7 +4766,7 @@
 dependencies = [
  "cc",
  "libc",
- "once_cell",
+ "once_cell 1.4.1",
  "spin",
  "untrusted",
  "web-sys",
@@ -4047,16 +4774,10 @@
 ]
 
 [[package]]
-name = "rle-decode-fast"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
-
-[[package]]
 name = "rocksdb"
-version = "0.14.0"
+version = "0.15.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61aa17a99a2413cd71c1106691bf59dad7de0cd5099127f90e9d99c429c40d4a"
+checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6"
 dependencies = [
  "libc",
  "librocksdb-sys",
@@ -4074,11 +4795,11 @@
 
 [[package]]
 name = "rust-argon2"
-version = "0.7.0"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
+checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19"
 dependencies = [
- "base64",
+ "base64 0.12.3",
  "blake2b_simd",
  "constant_time_eq",
  "crossbeam-utils",
@@ -4086,9 +4807,9 @@
 
 [[package]]
 name = "rustc-demangle"
-version = "0.1.16"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
+checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b"
 
 [[package]]
 name = "rustc-hash"
@@ -4113,11 +4834,11 @@
 
 [[package]]
 name = "rustls"
-version = "0.17.0"
+version = "0.18.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1"
+checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81"
 dependencies = [
- "base64",
+ "base64 0.12.3",
  "log",
  "ring",
  "sct",
@@ -4126,9 +4847,9 @@
 
 [[package]]
 name = "rustls-native-certs"
-version = "0.3.0"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5"
+checksum = "629d439a7672da82dd955498445e496ee2096fe2117b9f796558a43fdb9e59b8"
 dependencies = [
  "openssl-probe",
  "rustls",
@@ -4142,7 +4863,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "pin-project",
  "static_assertions",
 ]
@@ -4163,11 +4884,31 @@
 ]
 
 [[package]]
+name = "salsa20"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2324b0e8c3bb9a586a571fdb3136f70e7e2c748de00a78043f86e0cff91f91fe"
+dependencies = [
+ "byteorder 1.3.4",
+ "salsa20-core",
+ "stream-cipher 0.3.2",
+]
+
+[[package]]
+name = "salsa20-core"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fe6cc1b9f5a5867853ade63099de70f042f7679e408d1ffe52821c9248e6e69"
+dependencies = [
+ "stream-cipher 0.3.2",
+]
+
+[[package]]
 name = "sc-basic-authorship"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "log",
  "parity-scale-codec",
@@ -4188,8 +4929,8 @@
 
 [[package]]
 name = "sc-block-builder"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sc-client-api",
@@ -4198,16 +4939,18 @@
  "sp-blockchain",
  "sp-consensus",
  "sp-core",
+ "sp-inherents",
  "sp-runtime",
  "sp-state-machine",
 ]
 
 [[package]]
 name = "sc-chain-spec"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "impl-trait-for-tuples",
+ "parity-scale-codec",
  "sc-chain-spec-derive",
  "sc-network",
  "sc-telemetry",
@@ -4220,40 +4963,46 @@
 
 [[package]]
 name = "sc-chain-spec-derive"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "sc-cli"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "ansi_term 0.12.1",
  "atty",
+ "bip39",
  "chrono",
  "derive_more",
- "env_logger",
  "fdlimit",
- "futures 0.3.5",
+ "futures 0.3.6",
+ "hex",
  "lazy_static",
+ "libp2p",
  "log",
  "names",
  "nix",
+ "parity-scale-codec",
  "parity-util-mem",
+ "rand 0.7.3",
  "regex",
  "rpassword",
  "sc-client-api",
  "sc-informant",
+ "sc-keystore",
  "sc-network",
  "sc-service",
  "sc-telemetry",
  "sc-tracing",
+ "serde",
  "serde_json",
  "sp-blockchain",
  "sp-core",
@@ -4266,17 +5015,20 @@
  "structopt",
  "substrate-prometheus-endpoint",
  "time",
- "tokio 0.2.21",
+ "tokio 0.2.22",
+ "tracing",
+ "tracing-log",
+ "tracing-subscriber",
 ]
 
 [[package]]
 name = "sc-client-api"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "fnv",
- "futures 0.3.5",
+ "futures 0.3.6",
  "hash-db",
  "hex-literal",
  "kvdb",
@@ -4307,8 +5059,8 @@
 
 [[package]]
 name = "sc-client-db"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "blake2-rfc",
  "hash-db",
@@ -4324,6 +5076,7 @@
  "sc-client-api",
  "sc-executor",
  "sc-state-db",
+ "sp-arithmetic",
  "sp-blockchain",
  "sp-consensus",
  "sp-core",
@@ -4336,8 +5089,8 @@
 
 [[package]]
 name = "sc-consensus"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "sc-client-api",
  "sp-blockchain",
@@ -4347,11 +5100,11 @@
 
 [[package]]
 name = "sc-consensus-aura"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "log",
  "parity-scale-codec",
@@ -4378,10 +5131,10 @@
 
 [[package]]
 name = "sc-consensus-slots"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "log",
  "parity-scale-codec",
@@ -4392,6 +5145,7 @@
  "sp-application-crypto",
  "sp-blockchain",
  "sp-consensus",
+ "sp-consensus-slots",
  "sp-core",
  "sp-inherents",
  "sp-runtime",
@@ -4400,8 +5154,8 @@
 
 [[package]]
 name = "sc-executor"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "lazy_static",
@@ -4412,6 +5166,7 @@
  "parking_lot 0.10.2",
  "sc-executor-common",
  "sc-executor-wasmi",
+ "sc-executor-wasmtime",
  "sp-api",
  "sp-core",
  "sp-externalities",
@@ -4427,8 +5182,8 @@
 
 [[package]]
 name = "sc-executor-common"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "log",
@@ -4444,8 +5199,8 @@
 
 [[package]]
 name = "sc-executor-wasmi"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "log",
  "parity-scale-codec",
@@ -4458,15 +5213,32 @@
 ]
 
 [[package]]
+name = "sc-executor-wasmtime"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "log",
+ "parity-scale-codec",
+ "parity-wasm",
+ "pwasm-utils",
+ "sc-executor-common",
+ "scoped-tls",
+ "sp-allocator",
+ "sp-core",
+ "sp-runtime-interface",
+ "sp-wasm-interface",
+ "wasmtime",
+]
+
+[[package]]
 name = "sc-finality-grandpa"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "assert_matches",
  "derive_more",
  "finality-grandpa",
  "fork-tree",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "log",
  "parity-scale-codec",
@@ -4497,14 +5269,13 @@
 
 [[package]]
 name = "sc-informant"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "ansi_term 0.12.1",
- "futures 0.3.5",
+ "futures 0.3.6",
  "log",
  "parity-util-mem",
- "parking_lot 0.10.2",
  "sc-client-api",
  "sc-network",
  "sp-blockchain",
@@ -4516,8 +5287,8 @@
 
 [[package]]
 name = "sc-keystore"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "hex",
@@ -4527,13 +5298,13 @@
  "serde_json",
  "sp-application-crypto",
  "sp-core",
- "subtle 2.2.3",
+ "subtle 2.3.0",
 ]
 
 [[package]]
 name = "sc-light"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "hash-db",
  "lazy_static",
@@ -4551,9 +5322,11 @@
 
 [[package]]
 name = "sc-network"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
+ "async-std",
+ "async-trait",
  "bitflags",
  "bs58",
  "bytes 0.5.6",
@@ -4562,16 +5335,16 @@
  "erased-serde",
  "fnv",
  "fork-tree",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
- "futures_codec 0.3.4",
+ "futures_codec",
  "hex",
  "ip_network",
  "libp2p",
  "linked-hash-map",
  "linked_hash_set",
  "log",
- "lru",
+ "lru 0.4.3",
  "nohash-hasher",
  "parity-scale-codec",
  "parking_lot 0.10.2",
@@ -4595,7 +5368,7 @@
  "sp-utils",
  "substrate-prometheus-endpoint",
  "thiserror",
- "unsigned-varint 0.3.3",
+ "unsigned-varint 0.4.0",
  "void",
  "wasm-timer",
  "zeroize",
@@ -4603,14 +5376,14 @@
 
 [[package]]
 name = "sc-network-gossip"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "libp2p",
  "log",
- "lru",
+ "lru 0.4.3",
  "sc-network",
  "sp-runtime",
  "wasm-timer",
@@ -4618,14 +5391,14 @@
 
 [[package]]
 name = "sc-offchain"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "bytes 0.5.6",
  "fnv",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
- "hyper 0.13.7",
+ "hyper 0.13.8",
  "hyper-rustls",
  "log",
  "num_cpus",
@@ -4645,10 +5418,10 @@
 
 [[package]]
 name = "sc-peerset"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "libp2p",
  "log",
  "serde_json",
@@ -4658,8 +5431,8 @@
 
 [[package]]
 name = "sc-proposer-metrics"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "log",
  "substrate-prometheus-endpoint",
@@ -4667,10 +5440,10 @@
 
 [[package]]
 name = "sc-rpc"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "hash-db",
  "jsonrpc-core",
  "jsonrpc-pubsub",
@@ -4699,11 +5472,11 @@
 
 [[package]]
 name = "sc-rpc-api"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "jsonrpc-core",
  "jsonrpc-core-client",
  "jsonrpc-derive",
@@ -4723,9 +5496,10 @@
 
 [[package]]
 name = "sc-rpc-server"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
+ "futures 0.1.30",
  "jsonrpc-core",
  "jsonrpc-http-server",
  "jsonrpc-ipc-server",
@@ -4735,30 +5509,29 @@
  "serde",
  "serde_json",
  "sp-runtime",
+ "substrate-prometheus-endpoint",
 ]
 
 [[package]]
 name = "sc-service"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "directories",
  "exit-future",
- "futures 0.1.29",
- "futures 0.3.5",
+ "futures 0.1.30",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "hash-db",
+ "jsonrpc-core",
  "jsonrpc-pubsub",
  "lazy_static",
  "log",
- "netstat2",
- "parity-multiaddr 0.7.3",
  "parity-scale-codec",
  "parity-util-mem",
  "parking_lot 0.10.2",
  "pin-project",
- "procfs",
  "rand 0.7.3",
  "sc-block-builder",
  "sc-chain-spec",
@@ -4785,16 +5558,17 @@
  "sp-consensus",
  "sp-core",
  "sp-externalities",
+ "sp-inherents",
  "sp-io",
  "sp-runtime",
  "sp-session",
  "sp-state-machine",
+ "sp-tracing",
  "sp-transaction-pool",
  "sp-trie",
  "sp-utils",
  "sp-version",
  "substrate-prometheus-endpoint",
- "sysinfo",
  "tempfile",
  "tracing",
  "wasm-timer",
@@ -4802,8 +5576,8 @@
 
 [[package]]
 name = "sc-state-db"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "log",
  "parity-scale-codec",
@@ -4816,11 +5590,10 @@
 
 [[package]]
 name = "sc-telemetry"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "bytes 0.5.6",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "libp2p",
  "log",
@@ -4838,8 +5611,8 @@
 
 [[package]]
 name = "sc-tracing"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "erased-serde",
  "log",
@@ -4850,20 +5623,23 @@
  "serde_json",
  "slog",
  "sp-tracing",
+ "tracing",
  "tracing-core",
+ "tracing-subscriber",
 ]
 
 [[package]]
 name = "sc-transaction-graph"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "linked-hash-map",
  "log",
  "parity-util-mem",
  "parking_lot 0.10.2",
+ "retain_mut",
  "serde",
  "sp-blockchain",
  "sp-core",
@@ -4875,11 +5651,11 @@
 
 [[package]]
 name = "sc-transaction-pool"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-diagnose",
  "intervalier",
  "log",
@@ -4917,23 +5693,55 @@
 dependencies = [
  "arrayref",
  "arrayvec 0.5.1",
- "curve25519-dalek",
- "getrandom",
+ "curve25519-dalek 2.1.0",
+ "getrandom 0.1.15",
  "merlin",
  "rand 0.7.3",
  "rand_core 0.5.1",
  "sha2 0.8.2",
- "subtle 2.2.3",
+ "subtle 2.3.0",
  "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 = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
+
+[[package]]
 name = "scopeguard"
 version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
 
 [[package]]
+name = "scroll"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec"
+dependencies = [
+ "scroll_derive",
+]
+
+[[package]]
+name = "scroll_derive"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dfde5d1531034db129e95c76ac857e2baecea3443579d493d02224950b0fb6d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
 name = "sct"
 version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4944,10 +5752,19 @@
 ]
 
 [[package]]
+name = "secrecy"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f"
+dependencies = [
+ "zeroize",
+]
+
+[[package]]
 name = "security-framework"
-version = "0.4.4"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
+checksum = "ad502866817f0575705bd7be36e2b2535cc33262d493aa733a2ec862baa2bc2b"
 dependencies = [
  "bitflags",
  "core-foundation",
@@ -4958,9 +5775,9 @@
 
 [[package]]
 name = "security-framework-sys"
-version = "0.4.3"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405"
+checksum = "51ceb04988b17b6d1dcd555390fa822ca5637b4a14e1f5099f13d351bed4d6c7"
 dependencies = [
  "core-foundation-sys",
  "libc",
@@ -4980,38 +5797,32 @@
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-
-[[package]]
-name = "send_wrapper"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0eddf2e8f50ced781f288c19f18621fa72a3779e3cb58dbf23b07469b0abeb4"
 
 [[package]]
 name = "serde"
-version = "1.0.114"
+version = "1.0.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
+checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.114"
+version = "1.0.117"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
+checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "serde_json"
-version = "1.0.56"
+version = "1.0.59"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3"
+checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
 dependencies = [
  "itoa",
  "ryu",
@@ -5031,10 +5842,17 @@
 ]
 
 [[package]]
-name = "sha1"
-version = "0.6.0"
+name = "sha-1"
+version = "0.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
+checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770"
+dependencies = [
+ "block-buffer 0.9.0",
+ "cfg-if 0.1.10",
+ "cpuid-bool",
+ "digest 0.9.0",
+ "opaque-debug 0.3.0",
+]
 
 [[package]]
 name = "sha2"
@@ -5055,7 +5873,7 @@
 checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
 dependencies = [
  "block-buffer 0.9.0",
- "cfg-if",
+ "cfg-if 0.1.10",
  "cpuid-bool",
  "digest 0.9.0",
  "opaque-debug 0.3.0",
@@ -5075,6 +5893,27 @@
 ]
 
 [[package]]
+name = "sha3"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
+dependencies = [
+ "block-buffer 0.9.0",
+ "digest 0.9.0",
+ "keccak",
+ "opaque-debug 0.3.0",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
 name = "shlex"
 version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5082,15 +5921,21 @@
 
 [[package]]
 name = "signal-hook-registry"
-version = "1.2.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
+checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035"
 dependencies = [
  "arc-swap",
  "libc",
 ]
 
 [[package]]
+name = "signature"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210"
+
+[[package]]
 name = "slab"
 version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5136,8 +5981,8 @@
 checksum = "a945ec7f7ce853e89ffa36be1e27dce9a43e82ff9093bf3461c30d5da74ed11b"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -5151,35 +5996,35 @@
 
 [[package]]
 name = "smallvec"
-version = "1.4.1"
+version = "1.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
+checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
 
 [[package]]
 name = "snow"
-version = "0.7.1"
+version = "0.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32bf8474159a95551661246cda4976e89356999e3cbfef36f493dacc3fae1e8e"
+checksum = "795dd7aeeee24468e5a32661f6d27f7b5cbed802031b2d7640c7b10f8fb2dd50"
 dependencies = [
  "aes-gcm",
- "blake2 0.9.0",
+ "blake2",
  "chacha20poly1305",
  "rand 0.7.3",
  "rand_core 0.5.1",
  "ring",
  "rustc_version",
  "sha2 0.9.1",
- "subtle 2.2.3",
- "x25519-dalek",
+ "subtle 2.3.0",
+ "x25519-dalek 1.1.0",
 ]
 
 [[package]]
 name = "socket2"
-version = "0.3.12"
+version = "0.3.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
+checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
  "redox_syscall",
  "winapi 0.3.9",
@@ -5187,28 +6032,24 @@
 
 [[package]]
 name = "soketto"
-version = "0.3.2"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b"
+checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88"
 dependencies = [
- "base64",
+ "base64 0.12.3",
  "bytes 0.5.6",
  "flate2",
- "futures 0.3.5",
- "http 0.2.1",
+ "futures 0.3.6",
  "httparse",
  "log",
  "rand 0.7.3",
- "sha1",
- "smallvec 1.4.1",
- "static_assertions",
- "thiserror",
+ "sha-1 0.9.1",
 ]
 
 [[package]]
 name = "sp-allocator"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "log",
@@ -5219,8 +6060,8 @@
 
 [[package]]
 name = "sp-api"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "hash-db",
  "parity-scale-codec",
@@ -5234,20 +6075,20 @@
 
 [[package]]
 name = "sp-api-proc-macro"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "blake2-rfc",
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "sp-application-crypto"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "serde",
@@ -5258,11 +6099,11 @@
 
 [[package]]
 name = "sp-arithmetic"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "integer-sqrt",
- "num-traits 0.2.12",
+ "num-traits",
  "parity-scale-codec",
  "serde",
  "sp-debug-derive",
@@ -5270,9 +6111,20 @@
 ]
 
 [[package]]
+name = "sp-authorship"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "parity-scale-codec",
+ "sp-inherents",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "sp-block-builder"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-api",
@@ -5283,24 +6135,25 @@
 
 [[package]]
 name = "sp-blockchain"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "log",
- "lru",
+ "lru 0.4.3",
  "parity-scale-codec",
  "parking_lot 0.10.2",
  "sp-block-builder",
  "sp-consensus",
+ "sp-database",
  "sp-runtime",
  "sp-state-machine",
 ]
 
 [[package]]
 name = "sp-chain-spec"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "serde",
  "serde_json",
@@ -5308,22 +6161,24 @@
 
 [[package]]
 name = "sp-consensus"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-timer 3.0.2",
  "libp2p",
  "log",
  "parity-scale-codec",
  "parking_lot 0.10.2",
  "serde",
+ "sp-api",
  "sp-core",
  "sp-inherents",
  "sp-runtime",
  "sp-state-machine",
  "sp-std",
+ "sp-trie",
  "sp-utils",
  "sp-version",
  "substrate-prometheus-endpoint",
@@ -5332,8 +6187,8 @@
 
 [[package]]
 name = "sp-consensus-aura"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-api",
@@ -5345,25 +6200,35 @@
 ]
 
 [[package]]
+name = "sp-consensus-slots"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "parity-scale-codec",
+ "sp-runtime",
+]
+
+[[package]]
 name = "sp-core"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "base58",
  "blake2-rfc",
- "byteorder",
+ "byteorder 1.3.4",
  "derive_more",
+ "dyn-clonable",
  "ed25519-dalek",
- "futures 0.3.5",
+ "futures 0.3.6",
  "hash-db",
  "hash256-std-hasher",
  "hex",
- "impl-serde 0.3.1",
+ "impl-serde",
  "lazy_static",
  "libsecp256k1",
  "log",
  "merlin",
- "num-traits 0.2.12",
+ "num-traits",
  "parity-scale-codec",
  "parity-util-mem",
  "parking_lot 0.10.2",
@@ -5371,6 +6236,7 @@
  "rand 0.7.3",
  "regex",
  "schnorrkel",
+ "secrecy",
  "serde",
  "sha2 0.8.2",
  "sp-debug-derive",
@@ -5388,8 +6254,8 @@
 
 [[package]]
 name = "sp-database"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "kvdb",
  "parking_lot 0.10.2",
@@ -5397,18 +6263,18 @@
 
 [[package]]
 name = "sp-debug-derive"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "sp-externalities"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "environmental",
  "parity-scale-codec",
@@ -5418,8 +6284,8 @@
 
 [[package]]
 name = "sp-finality-grandpa"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "finality-grandpa",
  "log",
@@ -5434,8 +6300,8 @@
 
 [[package]]
 name = "sp-finality-tracker"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-inherents",
@@ -5444,8 +6310,8 @@
 
 [[package]]
 name = "sp-inherents"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
  "parity-scale-codec",
@@ -5456,10 +6322,10 @@
 
 [[package]]
 name = "sp-io"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "hash-db",
  "libsecp256k1",
  "log",
@@ -5473,12 +6339,14 @@
  "sp-tracing",
  "sp-trie",
  "sp-wasm-interface",
+ "tracing",
+ "tracing-core",
 ]
 
 [[package]]
 name = "sp-keyring"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "lazy_static",
  "sp-core",
@@ -5488,8 +6356,8 @@
 
 [[package]]
 name = "sp-offchain"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "sp-api",
  "sp-core",
@@ -5498,8 +6366,8 @@
 
 [[package]]
 name = "sp-panic-handler"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "backtrace",
  "log",
@@ -5507,8 +6375,8 @@
 
 [[package]]
 name = "sp-rpc"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "serde",
  "sp-core",
@@ -5516,8 +6384,8 @@
 
 [[package]]
 name = "sp-runtime"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "either",
  "hash256-std-hasher",
@@ -5538,14 +6406,15 @@
 
 [[package]]
 name = "sp-runtime-interface"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "primitive-types",
  "sp-externalities",
  "sp-runtime-interface-proc-macro",
  "sp-std",
+ "sp-storage",
  "sp-tracing",
  "sp-wasm-interface",
  "static_assertions",
@@ -5553,20 +6422,20 @@
 
 [[package]]
 name = "sp-runtime-interface-proc-macro"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "Inflector",
  "proc-macro-crate",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "sp-sandbox"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-core",
@@ -5578,8 +6447,8 @@
 
 [[package]]
 name = "sp-serializer"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "serde",
  "serde_json",
@@ -5587,8 +6456,8 @@
 
 [[package]]
 name = "sp-session"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-api",
@@ -5600,8 +6469,8 @@
 
 [[package]]
 name = "sp-staking"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "parity-scale-codec",
  "sp-runtime",
@@ -5610,20 +6479,20 @@
 
 [[package]]
 name = "sp-state-machine"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "hash-db",
- "itertools 0.9.0",
  "log",
- "num-traits 0.2.12",
+ "num-traits",
  "parity-scale-codec",
  "parking_lot 0.10.2",
  "rand 0.7.3",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
  "sp-core",
  "sp-externalities",
  "sp-panic-handler",
+ "sp-std",
  "sp-trie",
  "trie-db",
  "trie-root",
@@ -5631,15 +6500,16 @@
 
 [[package]]
 name = "sp-std"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 
 [[package]]
 name = "sp-storage"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "impl-serde 0.2.3",
+ "impl-serde",
+ "parity-scale-codec",
  "ref-cast",
  "serde",
  "sp-debug-derive",
@@ -5648,8 +6518,8 @@
 
 [[package]]
 name = "sp-timestamp"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "impl-trait-for-tuples",
  "parity-scale-codec",
@@ -5662,34 +6532,36 @@
 
 [[package]]
 name = "sp-tracing"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "log",
- "rental",
+ "parity-scale-codec",
+ "sp-std",
  "tracing",
+ "tracing-core",
+ "tracing-subscriber",
 ]
 
 [[package]]
 name = "sp-transaction-pool"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "derive_more",
- "futures 0.3.5",
+ "futures 0.3.6",
  "log",
  "parity-scale-codec",
  "serde",
  "sp-api",
  "sp-blockchain",
  "sp-runtime",
- "sp-utils",
 ]
 
 [[package]]
 name = "sp-trie"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "hash-db",
  "memory-db",
@@ -5702,10 +6574,10 @@
 
 [[package]]
 name = "sp-utils"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "futures-core",
  "futures-timer 3.0.2",
  "lazy_static",
@@ -5714,10 +6586,10 @@
 
 [[package]]
 name = "sp-version"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
- "impl-serde 0.2.3",
+ "impl-serde",
  "parity-scale-codec",
  "serde",
  "sp-runtime",
@@ -5726,8 +6598,8 @@
 
 [[package]]
 name = "sp-wasm-interface"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "impl-trait-for-tuples",
  "parity-scale-codec",
@@ -5764,14 +6636,24 @@
 
 [[package]]
 name = "stream-cipher"
-version = "0.4.1"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09f8ed9974042b8c3672ff3030a69fcc03b74c47c3d1ecb7755e8a3626011e88"
+checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c"
 dependencies = [
- "generic-array 0.14.3",
+ "generic-array 0.12.3",
 ]
 
 [[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"
@@ -5788,9 +6670,9 @@
 
 [[package]]
 name = "structopt"
-version = "0.3.15"
+version = "0.3.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de2f5e239ee807089b62adce73e48c625e0ed80df02c7ab3f068f5db5281065c"
+checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8"
 dependencies = [
  "clap",
  "lazy_static",
@@ -5799,15 +6681,15 @@
 
 [[package]]
 name = "structopt-derive"
-version = "0.4.8"
+version = "0.4.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "510413f9de616762a4fbeab62509bf15c729603b72d7cd71280fbca431b1c118"
+checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8"
 dependencies = [
  "heck",
  "proc-macro-error",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -5827,48 +6709,73 @@
 dependencies = [
  "heck",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "substrate-bip39"
-version = "0.4.1"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c004e8166d6e0aa3a9d5fa673e5b7098ff25f930de1013a21341988151e681bb"
+checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236"
 dependencies = [
  "hmac",
  "pbkdf2",
  "schnorrkel",
  "sha2 0.8.2",
+ "zeroize",
 ]
 
 [[package]]
 name = "substrate-build-script-utils"
-version = "2.0.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "platforms",
 ]
 
 [[package]]
+name = "substrate-frame-rpc-system"
+version = "2.0.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
+dependencies = [
+ "frame-system-rpc-runtime-api",
+ "futures 0.3.6",
+ "jsonrpc-core",
+ "jsonrpc-core-client",
+ "jsonrpc-derive",
+ "log",
+ "parity-scale-codec",
+ "sc-client-api",
+ "sc-rpc-api",
+ "serde",
+ "sp-api",
+ "sp-block-builder",
+ "sp-blockchain",
+ "sp-core",
+ "sp-runtime",
+ "sp-transaction-pool",
+]
+
+[[package]]
 name = "substrate-prometheus-endpoint"
-version = "0.8.0-rc4"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+version = "0.8.0"
+source = "git+https://github.com/usetech-llc/substrate.git?branch=v2.0.0_release#a200cdb93c6af5763b9c7bf313fa708764ac88ca"
 dependencies = [
  "async-std",
  "derive_more",
  "futures-util",
- "hyper 0.13.7",
+ "hyper 0.13.8",
  "log",
  "prometheus",
- "tokio 0.2.21",
+ "tokio 0.2.22",
 ]
 
 [[package]]
 name = "substrate-wasm-builder-runner"
 version = "1.0.6"
-source = "git+https://github.com/usetech-llc/substrate.git?branch=rc4_ext_dispatch_reenabled#b161460bf73e4cc73e29b8e01ab0323bb3d95e84"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2a965994514ab35d3893e9260245f2947fd1981cdd4fffd2c6e6d1a9ce02e6a"
 
 [[package]]
 name = "subtle"
@@ -5878,50 +6785,19 @@
 
 [[package]]
 name = "subtle"
-version = "2.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
-
-[[package]]
-name = "syn"
-version = "0.11.11"
+version = "2.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
-dependencies = [
- "quote 0.3.15",
- "synom",
- "unicode-xid 0.0.4",
-]
+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 1.0.7",
- "unicode-xid 0.2.1",
-]
-
-[[package]]
-name = "syn-mid"
-version = "0.5.0"
+version = "1.0.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
+checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
-]
-
-[[package]]
-name = "synom"
-version = "0.11.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
-dependencies = [
- "unicode-xid 0.0.4",
+ "quote",
+ "unicode-xid",
 ]
 
 [[package]]
@@ -5931,31 +6807,22 @@
 checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
- "unicode-xid 0.2.1",
+ "quote",
+ "syn",
+ "unicode-xid",
 ]
 
 [[package]]
-name = "sysinfo"
-version = "0.13.4"
+name = "take_mut"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cac193374347e7c263c5f547524f36ff8ec6702d56c8799c8331d26dffe8c1e"
-dependencies = [
- "cfg-if",
- "doc-comment",
- "libc",
- "ntapi",
- "once_cell",
- "rayon",
- "winapi 0.3.9",
-]
+checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
 
 [[package]]
-name = "take_mut"
-version = "0.2.2"
+name = "target-lexicon"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
+checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
 
 [[package]]
 name = "tempfile"
@@ -5963,7 +6830,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "libc",
  "rand 0.7.3",
  "redox_syscall",
@@ -5991,22 +6858,22 @@
 
 [[package]]
 name = "thiserror"
-version = "1.0.20"
+version = "1.0.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
+checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42"
 dependencies = [
  "thiserror-impl",
 ]
 
 [[package]]
 name = "thiserror-impl"
-version = "1.0.20"
+version = "1.0.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
+checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
@@ -6029,11 +6896,12 @@
 
 [[package]]
 name = "time"
-version = "0.1.43"
+version = "0.1.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
+checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
 dependencies = [
  "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
  "winapi 0.3.9",
 ]
 
@@ -6045,7 +6913,7 @@
 dependencies = [
  "failure",
  "hmac",
- "once_cell",
+ "once_cell 1.4.1",
  "pbkdf2",
  "rand 0.7.3",
  "rustc-hash",
@@ -6064,9 +6932,9 @@
 
 [[package]]
 name = "tinyvec"
-version = "0.3.3"
+version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed"
+checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117"
 
 [[package]]
 name = "tokio"
@@ -6075,7 +6943,7 @@
 checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "mio",
  "num_cpus",
  "tokio-codec",
@@ -6094,9 +6962,9 @@
 
 [[package]]
 name = "tokio"
-version = "0.2.21"
+version = "0.2.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58"
+checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd"
 dependencies = [
  "bytes 0.5.6",
  "fnv",
@@ -6122,7 +6990,7 @@
 dependencies = [
  "bytes 0.4.12",
  "either",
- "futures 0.1.29",
+ "futures 0.1.30",
 ]
 
 [[package]]
@@ -6132,7 +7000,7 @@
 checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "tokio-io",
 ]
 
@@ -6142,7 +7010,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "tokio-executor 0.1.10",
 ]
 
@@ -6153,7 +7021,7 @@
 checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671"
 dependencies = [
  "crossbeam-utils",
- "futures 0.1.29",
+ "futures 0.1.30",
 ]
 
 [[package]]
@@ -6173,7 +7041,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "tokio-io",
  "tokio-threadpool",
 ]
@@ -6185,7 +7053,7 @@
 checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "log",
 ]
 
@@ -6196,7 +7064,7 @@
 checksum = "9d282d483052288b2308ba5ee795f5673b159c9bdf63c385a05609da782a5eae"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "mio",
  "mio-named-pipes",
  "tokio 0.1.22",
@@ -6209,7 +7077,7 @@
 checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351"
 dependencies = [
  "crossbeam-utils",
- "futures 0.1.29",
+ "futures 0.1.30",
  "lazy_static",
  "log",
  "mio",
@@ -6223,13 +7091,13 @@
 
 [[package]]
 name = "tokio-rustls"
-version = "0.13.1"
+version = "0.14.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4"
+checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a"
 dependencies = [
  "futures-core",
  "rustls",
- "tokio 0.2.21",
+ "tokio 0.2.22",
  "webpki",
 ]
 
@@ -6239,7 +7107,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
 ]
 
 [[package]]
@@ -6249,7 +7117,7 @@
 checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee"
 dependencies = [
  "fnv",
- "futures 0.1.29",
+ "futures 0.1.30",
 ]
 
 [[package]]
@@ -6270,7 +7138,7 @@
 checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "iovec",
  "mio",
  "tokio-io",
@@ -6286,7 +7154,7 @@
  "crossbeam-deque",
  "crossbeam-queue",
  "crossbeam-utils",
- "futures 0.1.29",
+ "futures 0.1.30",
  "lazy_static",
  "log",
  "num_cpus",
@@ -6301,7 +7169,7 @@
 checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
 dependencies = [
  "crossbeam-utils",
- "futures 0.1.29",
+ "futures 0.1.30",
  "slab",
  "tokio-executor 0.1.10",
 ]
@@ -6313,7 +7181,7 @@
 checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "log",
  "mio",
  "tokio-codec",
@@ -6328,7 +7196,7 @@
 checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0"
 dependencies = [
  "bytes 0.4.12",
- "futures 0.1.29",
+ "futures 0.1.30",
  "iovec",
  "libc",
  "log",
@@ -6350,14 +7218,14 @@
  "futures-sink",
  "log",
  "pin-project-lite",
- "tokio 0.2.21",
+ "tokio 0.2.22",
 ]
 
 [[package]]
 name = "toml"
-version = "0.5.6"
+version = "0.5.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
+checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
 dependencies = [
  "serde",
 ]
@@ -6370,47 +7238,91 @@
 
 [[package]]
 name = "tracing"
-version = "0.1.16"
+version = "0.1.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd"
+checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "log",
+ "pin-project-lite",
  "tracing-attributes",
  "tracing-core",
 ]
 
 [[package]]
 name = "tracing-attributes"
-version = "0.1.9"
+version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b"
+checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "tracing-core"
-version = "0.1.11"
+version = "0.1.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9"
+dependencies = [
+ "lazy_static",
+ "log",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-serde"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f"
+checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b"
 dependencies = [
+ "serde",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ef0a5e15477aa303afbfac3a44cba9b6430fdaad52423b1e6c0dbbe28c3eedd"
+dependencies = [
+ "ansi_term 0.12.1",
+ "chrono",
  "lazy_static",
+ "matchers",
+ "regex",
+ "serde",
+ "serde_json",
+ "sharded-slab",
+ "smallvec 1.4.2",
+ "thread_local",
+ "tracing",
+ "tracing-core",
+ "tracing-log",
+ "tracing-serde",
 ]
 
 [[package]]
 name = "trie-db"
-version = "0.21.0"
+version = "0.22.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb230c24c741993b04cfccbabb45acff6f6480c5f00d3ed8794ea43db3a9d727"
+checksum = "9e55f7ace33d6237e14137e386f4e1672e2a5c6bbc97fef9f438581a143971f0"
 dependencies = [
  "hash-db",
- "hashbrown 0.6.3",
+ "hashbrown 0.8.2",
  "log",
  "rustc-hex",
- "smallvec 1.4.1",
+ "smallvec 1.4.2",
 ]
 
 [[package]]
@@ -6430,11 +7342,13 @@
 
 [[package]]
 name = "twox-hash"
-version = "1.5.0"
+version = "1.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56"
+checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59"
 dependencies = [
+ "cfg-if 0.1.10",
  "rand 0.7.3",
+ "static_assertions",
 ]
 
 [[package]]
@@ -6445,11 +7359,11 @@
 
 [[package]]
 name = "uint"
-version = "0.8.3"
+version = "0.8.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681"
+checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177"
 dependencies = [
- "byteorder",
+ "byteorder 1.3.4",
  "crunchy",
  "rustc-hex",
  "static_assertions",
@@ -6493,12 +7407,6 @@
 version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
-
-[[package]]
-name = "unicode-xid"
-version = "0.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
 
 [[package]]
 name = "unicode-xid"
@@ -6512,30 +7420,30 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402"
 dependencies = [
- "generic-array 0.14.3",
- "subtle 2.2.3",
+ "generic-array 0.14.4",
+ "subtle 2.3.0",
 ]
 
 [[package]]
 name = "unsigned-varint"
-version = "0.3.3"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f67332660eb59a6f1eb24ff1220c9e8d01738a8503c6002e30bcfe4bd9f2b4a9"
+checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5"
 dependencies = [
  "bytes 0.5.6",
  "futures-io",
  "futures-util",
- "futures_codec 0.3.4",
+ "futures_codec",
 ]
 
 [[package]]
 name = "unsigned-varint"
-version = "0.4.0"
+version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "669d776983b692a906c881fcd0cfb34271a48e197e4d6cb8df32b05bfc3d3fa5"
+checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35"
 dependencies = [
- "bytes 0.5.6",
- "futures_codec 0.4.1",
+ "futures-io",
+ "futures-util",
 ]
 
 [[package]]
@@ -6573,6 +7481,12 @@
 checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
 
 [[package]]
+name = "vec-arena"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
+
+[[package]]
 name = "vec_map"
 version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6591,12 +7505,18 @@
 checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
 
 [[package]]
+name = "waker-fn"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
+
+[[package]]
 name = "want"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230"
 dependencies = [
- "futures 0.1.29",
+ "futures 0.1.30",
  "log",
  "try-lock",
 ]
@@ -6618,37 +7538,43 @@
 checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
 
 [[package]]
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+
+[[package]]
 name = "wasm-bindgen"
-version = "0.2.65"
+version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
+checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "wasm-bindgen-macro",
 ]
 
 [[package]]
 name = "wasm-bindgen-backend"
-version = "0.2.65"
+version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
+checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
 dependencies = [
  "bumpalo",
  "lazy_static",
  "log",
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
  "wasm-bindgen-shared",
 ]
 
 [[package]]
 name = "wasm-bindgen-futures"
-version = "0.4.15"
+version = "0.4.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41ad6e4e8b2b7f8c90b6e09a9b590ea15cb0d1dbe28502b5a405cd95d1981671"
+checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da"
 dependencies = [
- "cfg-if",
+ "cfg-if 0.1.10",
  "js-sys",
  "wasm-bindgen",
  "web-sys",
@@ -6656,44 +7582,43 @@
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.65"
+version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
+checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
 dependencies = [
- "quote 1.0.7",
+ "quote",
  "wasm-bindgen-macro-support",
 ]
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.65"
+version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
+checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
  "wasm-bindgen-backend",
  "wasm-bindgen-shared",
 ]
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.65"
+version = "0.2.68"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
+checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
 
 [[package]]
 name = "wasm-timer"
-version = "0.2.4"
+version = "0.2.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "324c5e65a08699c9c4334ba136597ab22b85dccd4b65dd1e36ccf8f723a95b54"
+checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "js-sys",
- "parking_lot 0.9.0",
+ "parking_lot 0.11.0",
  "pin-utils",
- "send_wrapper",
  "wasm-bindgen",
  "wasm-bindgen-futures",
  "web-sys",
@@ -6708,7 +7633,7 @@
  "libc",
  "memory_units",
  "num-rational",
- "num-traits 0.2.12",
+ "num-traits",
  "parity-wasm",
  "wasmi-validation",
 ]
@@ -6723,10 +7648,195 @@
 ]
 
 [[package]]
+name = "wasmparser"
+version = "0.57.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6"
+
+[[package]]
+name = "wasmparser"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a950e6a618f62147fd514ff445b2a0b53120d382751960797f85f058c7eda9b9"
+
+[[package]]
+name = "wasmtime"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1cd3c4f449382779ef6e0a7c3ec6752ae614e20a42e4100000c3efdc973100e2"
+dependencies = [
+ "anyhow",
+ "backtrace",
+ "cfg-if 0.1.10",
+ "lazy_static",
+ "libc",
+ "log",
+ "region",
+ "rustc-demangle",
+ "smallvec 1.4.2",
+ "target-lexicon",
+ "wasmparser 0.59.0",
+ "wasmtime-environ",
+ "wasmtime-jit",
+ "wasmtime-profiling",
+ "wasmtime-runtime",
+ "wat",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "wasmtime-debug"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e634af9067a3af6cf2c7d33dc3b84767ddaf5d010ba68e80eecbcea73d4a349"
+dependencies = [
+ "anyhow",
+ "gimli 0.21.0",
+ "more-asserts",
+ "object 0.20.0",
+ "target-lexicon",
+ "thiserror",
+ "wasmparser 0.59.0",
+ "wasmtime-environ",
+]
+
+[[package]]
+name = "wasmtime-environ"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08f85619a94ee4034bd5bb87fc3dcf71fd2237b81c840809da1201061eec9ab3"
+dependencies = [
+ "anyhow",
+ "base64 0.12.3",
+ "bincode",
+ "cfg-if 0.1.10",
+ "cranelift-codegen",
+ "cranelift-entity",
+ "cranelift-frontend",
+ "cranelift-wasm",
+ "directories",
+ "errno",
+ "file-per-thread-logger",
+ "indexmap",
+ "libc",
+ "log",
+ "more-asserts",
+ "rayon",
+ "serde",
+ "sha2 0.8.2",
+ "thiserror",
+ "toml",
+ "wasmparser 0.59.0",
+ "winapi 0.3.9",
+ "zstd",
+]
+
+[[package]]
+name = "wasmtime-jit"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e914c013c7a9f15f4e429d5431f2830fb8adb56e40567661b69c5ec1d645be23"
+dependencies = [
+ "anyhow",
+ "cfg-if 0.1.10",
+ "cranelift-codegen",
+ "cranelift-entity",
+ "cranelift-frontend",
+ "cranelift-native",
+ "cranelift-wasm",
+ "gimli 0.21.0",
+ "log",
+ "more-asserts",
+ "object 0.20.0",
+ "region",
+ "target-lexicon",
+ "thiserror",
+ "wasmparser 0.59.0",
+ "wasmtime-debug",
+ "wasmtime-environ",
+ "wasmtime-obj",
+ "wasmtime-profiling",
+ "wasmtime-runtime",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "wasmtime-obj"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e81d8e02e9bc9fe2da9b6d48bbc217f96e089f7df613f11a28a3958abc44641e"
+dependencies = [
+ "anyhow",
+ "more-asserts",
+ "object 0.20.0",
+ "target-lexicon",
+ "wasmtime-debug",
+ "wasmtime-environ",
+]
+
+[[package]]
+name = "wasmtime-profiling"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e8d4d1af8dd5f7096cfcc89dd668d358e52980c38cce199643372ffd6590e27"
+dependencies = [
+ "anyhow",
+ "cfg-if 0.1.10",
+ "gimli 0.21.0",
+ "lazy_static",
+ "libc",
+ "object 0.19.0",
+ "scroll",
+ "serde",
+ "target-lexicon",
+ "wasmtime-environ",
+ "wasmtime-runtime",
+]
+
+[[package]]
+name = "wasmtime-runtime"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a25f140bbbaadb07c531cba99ce1a966dba216138dc1b2a0ddecec851a01a93"
+dependencies = [
+ "backtrace",
+ "cc",
+ "cfg-if 0.1.10",
+ "indexmap",
+ "lazy_static",
+ "libc",
+ "log",
+ "memoffset",
+ "more-asserts",
+ "region",
+ "thiserror",
+ "wasmtime-environ",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "wast"
+version = "26.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d54b3678343bfdf1768c16308a4b53823b70f7bb148d3d38225123d4306ec731"
+dependencies = [
+ "leb128",
+]
+
+[[package]]
+name = "wat"
+version = "1.0.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b2dccbce4d0e14875091846e110a2369267b18ddd0d6423479b88dad914d71"
+dependencies = [
+ "wast",
+]
+
+[[package]]
 name = "web-sys"
-version = "0.3.42"
+version = "0.3.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
+checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d"
 dependencies = [
  "js-sys",
  "wasm-bindgen",
@@ -6761,6 +7871,15 @@
 ]
 
 [[package]]
+name = "wepoll-sys"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "142bc2cba3fe88be1a8fcb55c727fa4cd5b0cf2d7438722792e22f26f04bc1e0"
+dependencies = [
+ "cc",
+]
+
+[[package]]
 name = "which"
 version = "3.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6811,24 +7930,6 @@
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "ws"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94"
-dependencies = [
- "byteorder",
- "bytes 0.4.12",
- "httparse",
- "log",
- "mio",
- "mio-extras",
- "rand 0.7.3",
- "sha-1",
- "slab",
- "url 2.1.1",
-]
 
 [[package]]
 name = "ws2_32-sys"
@@ -6846,42 +7947,84 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "637ff90c9540fa3073bb577e65033069e4bae7c79d49d74aa3ffdf5342a53217"
 dependencies = [
- "curve25519-dalek",
+ "curve25519-dalek 2.1.0",
  "rand_core 0.5.1",
  "zeroize",
 ]
 
 [[package]]
+name = "x25519-dalek"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088"
+dependencies = [
+ "curve25519-dalek 3.0.0",
+ "rand_core 0.5.1",
+ "zeroize",
+]
+
+[[package]]
 name = "yamux"
-version = "0.4.7"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd37e58a1256a0b328ce9c67d8b62ecdd02f4803ba443df478835cb1a41a637c"
+checksum = "9aeb8c4043cac71c3c299dff107171c220d179492350ea198e109a414981b83c"
 dependencies = [
- "futures 0.3.5",
+ "futures 0.3.6",
  "log",
  "nohash-hasher",
- "parking_lot 0.10.2",
+ "parking_lot 0.11.0",
  "rand 0.7.3",
  "static_assertions",
 ]
 
 [[package]]
 name = "zeroize"
-version = "1.1.0"
+version = "1.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8"
+checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a"
 dependencies = [
  "zeroize_derive",
 ]
 
 [[package]]
 name = "zeroize_derive"
-version = "1.0.0"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2"
+checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16"
 dependencies = [
  "proc-macro2",
- "quote 1.0.7",
- "syn 1.0.34",
+ "quote",
+ "syn",
  "synstructure",
 ]
+
+[[package]]
+name = "zstd"
+version = "0.5.3+zstd.1.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01b32eaf771efa709e8308605bbf9319bf485dc1503179ec0469b611937c0cd8"
+dependencies = [
+ "zstd-safe",
+]
+
+[[package]]
+name = "zstd-safe"
+version = "2.0.5+zstd.1.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1cfb642e0d27f64729a639c52db457e0ae906e7bc6f5fe8f5c453230400f1055"
+dependencies = [
+ "libc",
+ "zstd-sys",
+]
+
+[[package]]
+name = "zstd-sys"
+version = "1.4.17+zstd.1.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b89249644df056b522696b1bb9e7c18c87e8ffa3e2f0dc3b0155875d6498f01b"
+dependencies = [
+ "cc",
+ "glob",
+ "itertools 0.9.0",
+ "libc",
+]
modifiedDockerfilediffbeforeafterboth
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@
 FROM phusion/baseimage:0.10.2 as builder
 LABEL maintainer="gz@usetech.com"
 
-ENV WASM_TOOLCHAIN=nightly-2020-05-01
+ENV WASM_TOOLCHAIN=nightly-2020-10-01
 
 ARG PROFILE=release
 
@@ -17,19 +17,23 @@
 WORKDIR /nft_parachain
 COPY . .
 
-RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
-	export PATH="$PATH:$HOME/.cargo/bin" && \
+RUN export CARGO_HOME="/cargo-home" && curl https://sh.rustup.rs -sSf | sh -s -- -y
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
+	cargo fetch
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
 	rustup toolchain uninstall $(rustup toolchain list) && \
-	rustup default 1.44.0 && \
 	rustup toolchain install $WASM_TOOLCHAIN && \
 	rustup target add wasm32-unknown-unknown --toolchain $WASM_TOOLCHAIN && \
     rustup target list --installed && \
-    rustup show && \
-	cargo build "--$PROFILE" 
+    rustup show
+
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
+	cargo +$WASM_TOOLCHAIN build "--$PROFILE"
 	# && \
 	# cargo test
-
-RUN cd target/release && ls -la
 
 # ===== RUN ======
 
modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -115,6 +115,22 @@
 
 Additional CLI usage options are available and may be shown by running `cargo run -- --help`.
 
+## Benchmarks
+
+First of all, add rust toolchain and make it default.
+```bash
+rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-01
+```
+
+Then in "/node/src" run build command below
+```bash
+cargo +nightly-2020-10-01 build --release --features runtime-benchmarks
+```
+
+Run benchmark
+```bash
+target/release/nft benchmark --chain dev --pallet "pallet_nft" --extrinsic "*" --repeat 1
+```
 
 ## UI custom types
 ```
addeddoc/milestone_1.mddiffbeforeafterboth
--- /dev/null
+++ b/doc/milestone_1.md
@@ -0,0 +1,65 @@
+## Milestone 1
+
+**User Paid Fees and Sponsored. Finish/Debug white listing and spam/DOS protection**
+
+Implementation of two models 
+If collection sponsor is set and confirmed for collection instance that means Sponsored Economic Model has chosen. Otherwise default economic model User Paid Fees is set.
+For Sponsored Economic Model exists timeouts for token transactions. For every NFT type timeouts defined separately. Timeouts and white list limits together prevented spam and malicious actions.
+
+Set sponsor
+`nft`.`set_collection_sponsor`
+Confirm sponsor
+`nft`.`confirm_sponsorship`
+
+A white list mode presented by collection property `access` and can be enabled with `set_public_access_mode`. Rules provide spam/DOS protection
+While collection in the white list mode rules below are active:
+Owner can add address to white list
+Admin can add address to white list
+Non-privileged user cannot add address to white list
+Owner can remove address from white list
+Admin can remove address from white list
+Non-privileged user cannot remove address from white list
+If Public Access mode is set to WhiteList, tokens can’t be transferred from a non-whitelisted address with transfer or transferFrom
+If Public Access mode is set to WhiteList, tokens can’t be transferred to a non-whitelisted address with transfer or transferFrom
+If Public Access mode is set to WhiteList, tokens can’t be destroyed by a non-whitelisted address (even if it owned them before enabling WhiteList mode)
+If Public Access mode is set to WhiteList, token transfers can’t be Approved by a non-whitelisted address (see Approve method).
+If Public Access mode is set to WhiteList, tokens can be transferred to a whitelisted address with transfer or transferFrom
+If Public Access mode is set to WhiteList, tokens can be transferred from a whitelisted address with transfer or transferFrom 
+If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by owner.
+If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens can be created by admin.
+If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and white listed address.
+If Public Access mode is set to WhiteList, and Mint Permission is set to false, tokens cannot be created by non-privileged and non-white listed address.
+If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by owner.
+If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by admin.
+If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens cannot be created by non-privileged and non-white listed address.
+If Public Access mode is set to WhiteList, and Mint Permission is set to true, tokens can be created by non-privileged and white listed address.
+
+**Add missing custom types (CollectionMode, FungibleItemType, ReFungibleItemType)**
+
+Follow types defined
+```
+pub struct NftItemType<AccountId> {
+    pub collection: u64,
+    pub owner: AccountId,
+    pub data: Vec<u8>,
+}
+pub struct FungibleItemType<AccountId> {
+    pub collection: u64,
+    pub owner: AccountId,
+    pub value: u128,
+}
+pub struct ReFungibleItemType<AccountId> {
+    pub collection: u64,
+    pub owner: Vec<Ownership<AccountId>>,
+    pub data: Vec<u8>,
+}
+```
+
+**Add substrate bounds for number of collections, owned tokens, and number of collection admins.**
+
+Bounds defined in chain specification and can be set with 'sudo' privileges `nft`.`set_chain_limits`.
+
+**Add/document extra genesis**
+
+Extra genesis defined in `node/src/chain_spec.rs` file. Configuration consist from 5 items:
+Collection list,  Nft items list, Fungible items list, Refungible items list, Chain limits
\ No newline at end of file
modifiednode/Cargo.tomldiffbeforeafterboth
--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -1,7 +1,7 @@
 [build-dependencies.substrate-build-script-utils]
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
 [[bin]]
 name = 'nft'
@@ -15,7 +15,7 @@
 license = 'Unlicense'
 name = 'nft'
 repository = 'https://github.com/substrate-developer-hub/nft/'
-version = '2.0.0-rc4'
+version = '2.0.0'
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
@@ -25,102 +25,38 @@
 log = '0.4.8'
 parking_lot = '0.10.0'
 structopt = '0.3.8'
-jsonrpc-core = '14.0.5'
+jsonrpc-core = '15.0.0'
 
-[dependencies.nft-runtime]
-path = '../runtime'
-version = '2.0.0-rc4'
-
-[dependencies.sc-basic-authorship]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
+# Substrate dependencies
+nft-runtime = { path = '../runtime', version = '2.0.0' }
+frame-benchmarking = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+frame-benchmarking-cli = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+pallet-transaction-payment-rpc = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-basic-authorship = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-cli = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sc-client-api = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-consensus = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-consensus-aura = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-executor = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sc-finality-grandpa = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-rpc = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-rpc-api = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-service = { features = ['wasmtime'], version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sc-transaction-pool = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-api = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-block-builder = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-blockchain = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-consensus = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-consensus-aura = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-core = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-finality-grandpa = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-inherents = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-runtime = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sp-transaction-pool = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+sc-network = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} 
+substrate-frame-rpc-system = {version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'}
+pallet-contracts-rpc = {version = '0.8.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release'} 
 
-[dependencies.sc-cli]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-client-api]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sc-consensus]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.pallet-contracts-rpc]
-git = 'https://github.com/usetech-llc/substrate.git'
-version = '0.8.0-rc4'
-branch = 'rc4_ext_dispatch_reenabled'
-
-[dependencies.sc-rpc]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-
-[dependencies.sc-consensus-aura]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-executor]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-finality-grandpa]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-network]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-service]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sc-transaction-pool]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-consensus]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sp-consensus-aura]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sp-core]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-finality-grandpa]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-inherents]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-runtime]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-transaction-pool]
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+[features]
+default = []
+runtime-benchmarks = ['nft-runtime/runtime-benchmarks']
modifiednode/src/chain_spec.rsdiffbeforeafterboth
--- a/node/src/chain_spec.rs
+++ b/node/src/chain_spec.rs
@@ -38,70 +38,95 @@
     (get_from_seed::<AuraId>(s), get_from_seed::<GrandpaId>(s))
 }
 
-pub fn development_config() -> ChainSpec {
-    ChainSpec::from_genesis(
-        "Development",
-        "dev",
-        ChainType::Development,
-        || {
-            testnet_genesis(
-                vec![authority_keys_from_seed("Alice")],
-                get_account_id_from_seed::<sr25519::Public>("Alice"),
-                vec![
-                    get_account_id_from_seed::<sr25519::Public>("Alice"),
-                    get_account_id_from_seed::<sr25519::Public>("Bob"),
-                    get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
-                ],
-                true,
-            )
-        },
-        vec![],
-        None,
-        None,
-        None,
-        None,
-    )
+pub fn development_config() -> Result<ChainSpec, String> {
+	let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?;
+
+	Ok(ChainSpec::from_genesis(
+		// Name
+		"Development",
+		// ID
+		"dev",
+		ChainType::Development,
+		move || testnet_genesis(
+			wasm_binary,
+			// Initial PoA authorities
+			vec![
+				authority_keys_from_seed("Alice"),
+			],
+			// Sudo account
+			get_account_id_from_seed::<sr25519::Public>("Alice"),
+			// Pre-funded accounts
+			vec![
+				get_account_id_from_seed::<sr25519::Public>("Alice"),
+				get_account_id_from_seed::<sr25519::Public>("Bob"),
+				get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
+			],
+			true,
+		),
+		// Bootnodes
+		vec![],
+		// Telemetry
+		None,
+		// Protocol ID
+		None,
+		// Properties
+		None,
+		// Extensions
+		None,
+	))
 }
 
-pub fn local_testnet_config() -> ChainSpec {
-    ChainSpec::from_genesis(
-        "Local Testnet",
-        "local_testnet",
-        ChainType::Local,
-        || {
-            testnet_genesis(
-                vec![
-                    authority_keys_from_seed("Alice"),
-                    authority_keys_from_seed("Bob"),
-                ],
-                get_account_id_from_seed::<sr25519::Public>("Alice"),
-                vec![
-                    get_account_id_from_seed::<sr25519::Public>("Alice"),
-                    get_account_id_from_seed::<sr25519::Public>("Bob"),
-                    get_account_id_from_seed::<sr25519::Public>("Charlie"),
-                    get_account_id_from_seed::<sr25519::Public>("Dave"),
-                    get_account_id_from_seed::<sr25519::Public>("Eve"),
-                    get_account_id_from_seed::<sr25519::Public>("Ferdie"),
-                    get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
-                    get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
-                ],
-                true,
-            )
-        },
-        vec![],
-        None,
-        None,
-        None,
-        None,
-    )
+pub fn local_testnet_config() -> Result<ChainSpec, String> {
+	let wasm_binary = WASM_BINARY.ok_or("Development wasm binary not available".to_string())?;
+
+	Ok(ChainSpec::from_genesis(
+		// Name
+		"Local Testnet",
+		// ID
+		"local_testnet",
+		ChainType::Local,
+		move || testnet_genesis(
+			wasm_binary,
+			// Initial PoA authorities
+			vec![
+				authority_keys_from_seed("Alice"),
+				authority_keys_from_seed("Bob"),
+			],
+			// Sudo account
+			get_account_id_from_seed::<sr25519::Public>("Alice"),
+			// Pre-funded accounts
+			vec![
+				get_account_id_from_seed::<sr25519::Public>("Alice"),
+				get_account_id_from_seed::<sr25519::Public>("Bob"),
+				get_account_id_from_seed::<sr25519::Public>("Charlie"),
+				get_account_id_from_seed::<sr25519::Public>("Dave"),
+				get_account_id_from_seed::<sr25519::Public>("Eve"),
+				get_account_id_from_seed::<sr25519::Public>("Ferdie"),
+				get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
+				get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
+			],
+			true,
+		),
+		// Bootnodes
+		vec![],
+		// Telemetry
+		None,
+		// Protocol ID
+		None,
+		// Properties
+		None,
+		// Extensions
+		None,
+	))
 }
 
 fn testnet_genesis(
+    wasm_binary: &[u8],
     initial_authorities: Vec<(AuraId, GrandpaId)>,
     root_key: AccountId,
     endowed_accounts: Vec<AccountId>,
@@ -109,27 +134,27 @@
 ) -> GenesisConfig {
     GenesisConfig {
         system: Some(SystemConfig {
-            code: WASM_BINARY.to_vec(),
+            code: wasm_binary.to_vec(),
             changes_trie_config: Default::default(),
         }),
-        balances: Some(BalancesConfig {
+        pallet_balances: Some(BalancesConfig {
             balances: endowed_accounts
                 .iter()
                 .cloned()
                 .map(|k| (k, 1 << 100))
                 .collect(),
         }),
-        aura: Some(AuraConfig {
+        pallet_aura: Some(AuraConfig {
             authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
         }),
-        grandpa: Some(GrandpaConfig {
+        pallet_grandpa: Some(GrandpaConfig {
             authorities: initial_authorities
                 .iter()
                 .map(|x| (x.1.clone(), 1))
                 .collect(),
         }),
-        sudo: Some(SudoConfig { key: root_key }),
-        nft: Some(NftConfig {
+        pallet_sudo: Some(SudoConfig { key: root_key }),
+        pallet_nft: Some(NftConfig {
             collection: vec![(
                 1,
                 CollectionType {
@@ -160,7 +185,7 @@
                 refungible_sponsor_transfer_timeout: 15,
             },
         }),
-        contracts: Some(ContractsConfig {
+        pallet_contracts: Some(ContractsConfig {
             current_schedule: ContractsSchedule {
                 enable_println,
                 ..Default::default()
modifiednode/src/cli.rsdiffbeforeafterboth
--- a/node/src/cli.rs
+++ b/node/src/cli.rs
@@ -1,11 +1,39 @@
-use sc_cli::{RunCmd, Subcommand};
 use structopt::StructOpt;
+use sc_cli::RunCmd;
 
 #[derive(Debug, StructOpt)]
 pub struct Cli {
-    #[structopt(subcommand)]
-    pub subcommand: Option<Subcommand>,
+	#[structopt(subcommand)]
+	pub subcommand: Option<Subcommand>,
+
+	#[structopt(flatten)]
+	pub run: RunCmd,
+}
+
+#[derive(Debug, StructOpt)]
+pub enum Subcommand {
+	/// Build a chain specification.
+	BuildSpec(sc_cli::BuildSpecCmd),
+
+	/// Validate blocks.
+	CheckBlock(sc_cli::CheckBlockCmd),
+
+	/// Export blocks.
+	ExportBlocks(sc_cli::ExportBlocksCmd),
+
+	/// Export the state of a given block into a chain spec.
+	ExportState(sc_cli::ExportStateCmd),
+
+	/// Import blocks.
+	ImportBlocks(sc_cli::ImportBlocksCmd),
 
-    #[structopt(flatten)]
-    pub run: RunCmd,
+	/// Remove the whole chain.
+	PurgeChain(sc_cli::PurgeChainCmd),
+
+	/// Revert the chain to a previous state.
+	Revert(sc_cli::RevertCmd),
+
+	// The custom benchmark subcommmand benchmarking runtime pallets.
+	#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
+	Benchmark(frame_benchmarking_cli::BenchmarkCmd),
 }
modifiednode/src/command.rsdiffbeforeafterboth
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -15,63 +15,121 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use crate::chain_spec;
-use crate::cli::Cli;
-use crate::service;
-use sc_cli::SubstrateCli;
+use crate::{chain_spec, service};
+use crate::cli::{Cli, Subcommand};
+use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec};
+use sc_service::PartialComponents;
+use nft_runtime::Block;
 
 impl SubstrateCli for Cli {
-    fn impl_name() -> &'static str {
-        "Substrate Node"
-    }
+	fn impl_name() -> String {
+		"Substrate Node".into()
+	}
 
-    fn impl_version() -> &'static str {
-        env!("SUBSTRATE_CLI_IMPL_VERSION")
-    }
+	fn impl_version() -> String {
+		env!("SUBSTRATE_CLI_IMPL_VERSION").into()
+	}
 
-    fn description() -> &'static str {
-        env!("CARGO_PKG_DESCRIPTION")
-    }
+	fn description() -> String {
+		env!("CARGO_PKG_DESCRIPTION").into()
+	}
 
-    fn author() -> &'static str {
-        env!("CARGO_PKG_AUTHORS")
-    }
+	fn author() -> String {
+		env!("CARGO_PKG_AUTHORS").into()
+	}
 
-    fn support_url() -> &'static str {
-        "support.anonymous.an"
-    }
+	fn support_url() -> String {
+		"support.anonymous.an".into()
+	}
 
-    fn copyright_start_year() -> i32 {
-        2017
-    }
+	fn copyright_start_year() -> i32 {
+		2017
+	}
 
-    fn executable_name() -> &'static str {
-        env!("CARGO_PKG_NAME")
-    }
+	fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
+		Ok(match id {
+			"dev" => Box::new(chain_spec::development_config()?),
+			"" | "local" => Box::new(chain_spec::local_testnet_config()?),
+			path => Box::new(chain_spec::ChainSpec::from_json_file(
+				std::path::PathBuf::from(path),
+			)?),
+		})
+	}
 
-    fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
-        Ok(match id {
-            "dev" => Box::new(chain_spec::development_config()),
-            "" | "local" => Box::new(chain_spec::local_testnet_config()),
-            path => Box::new(chain_spec::ChainSpec::from_json_file(
-                std::path::PathBuf::from(path),
-            )?),
-        })
-    }
+	fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
+		&nft_runtime::VERSION
+	}
 }
 
 /// Parse and run command line arguments
 pub fn run() -> sc_cli::Result<()> {
-    let cli = Cli::from_args();
+	let cli = Cli::from_args();
+
+	match &cli.subcommand {
+		Some(Subcommand::BuildSpec(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
+		},
+		Some(Subcommand::CheckBlock(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.async_run(|config| {
+				let PartialComponents { client, task_manager, import_queue, ..}
+					= service::new_partial(&config)?;
+				Ok((cmd.run(client, import_queue), task_manager))
+			})
+		},
+		Some(Subcommand::ExportBlocks(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.async_run(|config| {
+				let PartialComponents { client, task_manager, ..}
+					= service::new_partial(&config)?;
+				Ok((cmd.run(client, config.database), task_manager))
+			})
+		},
+		Some(Subcommand::ExportState(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.async_run(|config| {
+				let PartialComponents { client, task_manager, ..}
+					= service::new_partial(&config)?;
+				Ok((cmd.run(client, config.chain_spec), task_manager))
+			})
+		},
+		Some(Subcommand::ImportBlocks(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.async_run(|config| {
+				let PartialComponents { client, task_manager, import_queue, ..}
+					= service::new_partial(&config)?;
+				Ok((cmd.run(client, import_queue), task_manager))
+			})
+		},
+		Some(Subcommand::PurgeChain(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.sync_run(|config| cmd.run(config.database))
+		},
+		Some(Subcommand::Revert(cmd)) => {
+			let runner = cli.create_runner(cmd)?;
+			runner.async_run(|config| {
+				let PartialComponents { client, task_manager, backend, ..}
+					= service::new_partial(&config)?;
+				Ok((cmd.run(client, backend), task_manager))
+			})
+		},
+		Some(Subcommand::Benchmark(cmd)) => {
+			if cfg!(feature = "runtime-benchmarks") {
+				let runner = cli.create_runner(cmd)?;
 
-    match &cli.subcommand {
-        Some(subcommand) => {
-            let runner = cli.create_runner(subcommand)?;
-            runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0))
-        }
-        None => {
-            let runner = cli.create_runner(&cli.run)?;
-            runner.run_node(service::new_light, service::new_full, nft_runtime::VERSION)
-        }
-    }
+				runner.sync_run(|config| cmd.run::<Block, service::Executor>(config))
+			} else {
+				Err("Benchmarking wasn't enabled when building the node. \
+				You can enable it with `--features runtime-benchmarks`.".into())
+			}
+		},
+		None => {
+			let runner = cli.create_runner(&cli.run)?;
+			runner.run_node_until_exit(|config| match config.role {
+				Role::Light => service::new_light(config),
+				_ => service::new_full(config),
+			})
+		}
+	}
 }
addednode/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/node/src/lib.rs
@@ -0,0 +1,3 @@
+pub mod chain_spec;
+pub mod service;
+pub mod rpc;
modifiednode/src/main.rsdiffbeforeafterboth
--- a/node/src/main.rs
+++ b/node/src/main.rs
@@ -6,6 +6,7 @@
 mod service;
 mod cli;
 mod command;
+mod rpc;
 
 fn main() -> sc_cli::Result<()> {
     command::run()
addednode/src/rpc.rsdiffbeforeafterboth
--- /dev/null
+++ b/node/src/rpc.rs
@@ -0,0 +1,69 @@
+//! A collection of node-specific RPC methods.
+//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
+//! used by Substrate nodes. This file extends those RPC definitions with
+//! capabilities that are specific to this project's runtime configuration.
+
+#![warn(missing_docs)]
+
+use std::sync::Arc;
+
+use nft_runtime::{opaque::Block, AccountId, Balance, Index, BlockNumber};
+use sp_api::ProvideRuntimeApi;
+use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend};
+use sp_block_builder::BlockBuilder;
+pub use sc_rpc_api::DenyUnsafe;
+use sp_transaction_pool::TransactionPool;
+use pallet_contracts_rpc::{Contracts, ContractsApi};
+
+/// Full client dependencies.
+pub struct FullDeps<C, P> {
+	/// The client instance to use.
+	pub client: Arc<C>,
+	/// Transaction pool instance.
+	pub pool: Arc<P>,
+	/// Whether to deny unsafe calls
+	pub deny_unsafe: DenyUnsafe,
+}
+
+/// Instantiate all full RPC extensions.
+pub fn create_full<C, P>(
+	deps: FullDeps<C, P>,
+) -> jsonrpc_core::IoHandler<sc_rpc::Metadata> where
+	C: ProvideRuntimeApi<Block>,
+	C: HeaderBackend<Block> + HeaderMetadata<Block, Error=BlockChainError> + 'static,
+	C: Send + Sync + 'static,
+	C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
+	C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
+	C::Api: BlockBuilder<Block>,
+	C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber>,
+	P: TransactionPool + 'static,
+{
+	use substrate_frame_rpc_system::{FullSystem, SystemApi};
+	use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
+
+	let mut io = jsonrpc_core::IoHandler::default();
+	let FullDeps {
+		client,
+		pool,
+		deny_unsafe,
+	} = deps;
+
+	io.extend_with(
+		SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe))
+	);
+
+	io.extend_with(
+		TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone()))
+	);
+
+    io.extend_with(
+        ContractsApi::to_delegate(Contracts::new(client.clone()))
+	);
+		
+	// Extend this RPC with a custom API by using the following syntax.
+	// `YourRpcStruct` should have a reference to a client, which is needed
+	// to call into the runtime.
+	// `io.extend_with(YourRpcTrait::to_delegate(YourRpcStruct::new(ReferenceToClient, ...)));`
+
+	io
+}
modifiednode/src/service.rsdiffbeforeafterboth
--- a/node/src/service.rs
+++ b/node/src/service.rs
@@ -1,274 +1,303 @@
 //! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
 
+use std::sync::Arc;
+use std::time::Duration;
+use sc_client_api::{ExecutorProvider, RemoteBackend};
 use nft_runtime::{self, opaque::Block, RuntimeApi};
-use sc_client_api::ExecutorProvider;
-use sc_consensus::LongestChain;
+use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
+use sp_inherents::InherentDataProviders;
 use sc_executor::native_executor_instance;
 pub use sc_executor::NativeExecutor;
-use sc_finality_grandpa::{
-    FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState,
-    StorageAndProofProvider,
-};
-use sc_service::{error::Error as ServiceError, AbstractService, Configuration, ServiceBuilder};
-use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
-use sp_inherents::InherentDataProviders;
-use std::sync::Arc;
-use std::time::Duration;
+use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
+use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState};
 
 // Our native executor instance.
 native_executor_instance!(
-    pub Executor,
+	pub Executor,
     nft_runtime::api::dispatch,
     nft_runtime::native_version,
+	frame_benchmarking::benchmarking::HostFunctions,
 );
 
-/// Starts a `ServiceBuilder` for a full service.
-///
-/// Use this macro if you don't actually need the full service, but just the builder in order to
-/// be able to perform chain operations.
-macro_rules! new_full_start {
-    ($config:expr) => {{
-        use jsonrpc_core::IoHandler;
-        use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
-        use std::sync::Arc;
-
-        let mut import_setup = None;
-        let inherent_data_providers = sp_inherents::InherentDataProviders::new();
+type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
+type FullBackend = sc_service::TFullBackend<Block>;
+type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
 
-        let builder = sc_service::ServiceBuilder::new_full::<
-            nft_runtime::opaque::Block,
-            nft_runtime::RuntimeApi,
-            crate::service::Executor,
-        >($config)?
-        .with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))?
-        .with_transaction_pool(|builder| {
-            let pool_api = sc_transaction_pool::FullChainApi::new(builder.client().clone());
-            Ok(sc_transaction_pool::BasicPool::new(
-                builder.config().transaction_pool.clone(),
-                std::sync::Arc::new(pool_api),
-                builder.prometheus_registry(),
-            ))
-        })?
-        .with_import_queue(
-            |_config, client, mut select_chain, _transaction_pool, spawn_task_handle, registry| {
-                let select_chain = select_chain
-                    .take()
-                    .ok_or_else(|| sc_service::Error::SelectChainRequired)?;
+pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponents<
+	FullClient, FullBackend, FullSelectChain,
+	sp_consensus::DefaultImportQueue<Block, FullClient>,
+	sc_transaction_pool::FullPool<Block, FullClient>,
+	(
+		sc_consensus_aura::AuraBlockImport<
+			Block,
+			FullClient,
+			sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,
+			AuraPair
+		>,
+		sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>
+	)
+>, ServiceError> {
+	let inherent_data_providers = sp_inherents::InherentDataProviders::new();
 
-                let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
-                    client.clone(),
-                    &(client.clone() as Arc<_>),
-                    select_chain,
-                )?;
+	let (client, backend, keystore, task_manager) =
+		sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
+	let client = Arc::new(client);
 
-                let aura_block_import =
-                    sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
-                        grandpa_block_import.clone(),
-                        client.clone(),
-                    );
+	let select_chain = sc_consensus::LongestChain::new(backend.clone());
 
-                let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
-                    sc_consensus_aura::slot_duration(&*client)?,
-                    aura_block_import,
-                    Some(Box::new(grandpa_block_import.clone())),
-                    None,
-                    client,
-                    inherent_data_providers.clone(),
-                    spawn_task_handle,
-                    registry,
-                )?;
+	let transaction_pool = sc_transaction_pool::BasicPool::new_full(
+		config.transaction_pool.clone(),
+		config.prometheus_registry(),
+		task_manager.spawn_handle(),
+		client.clone(),
+	);
 
-                import_setup = Some((grandpa_block_import, grandpa_link));
+	let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
+		client.clone(), &(client.clone() as Arc<_>), select_chain.clone(),
+	)?;
 
-                Ok(import_queue)
-            },
-        )?
-        .with_rpc_extensions(|builder| -> Result<IoHandler<sc_rpc::Metadata>, _> {
-            let handler = pallet_contracts_rpc::Contracts::new(builder.client().clone());
-            let delegate = pallet_contracts_rpc::ContractsApi::to_delegate(handler);
+	let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
+		grandpa_block_import.clone(), client.clone(),
+	);
 
-            let mut io = IoHandler::default();
-            io.extend_with(delegate);
-            Ok(io)
-        })?;
+	let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
+		sc_consensus_aura::slot_duration(&*client)?,
+		aura_block_import.clone(),
+		Some(Box::new(grandpa_block_import.clone())),
+		None,
+		client.clone(),
+		inherent_data_providers.clone(),
+		&task_manager.spawn_handle(),
+		config.prometheus_registry(),
+		sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
+	)?;
 
-        (builder, import_setup, inherent_data_providers)
-    }};
+	Ok(sc_service::PartialComponents {
+		client, backend, task_manager, import_queue, keystore, select_chain, transaction_pool,
+		inherent_data_providers,
+		other: (aura_block_import, grandpa_link),
+	})
 }
 
 /// Builds a new service for a full client.
-pub fn new_full(config: Configuration) -> Result<impl AbstractService, ServiceError> {
-    let role = config.role.clone();
-    let force_authoring = config.force_authoring;
-    let name = config.network.node_name.clone();
-    let disable_grandpa = config.disable_grandpa;
+pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
+	let sc_service::PartialComponents {
+		client, backend, mut task_manager, import_queue, keystore, select_chain, transaction_pool,
+		inherent_data_providers,
+		other: (block_import, grandpa_link),
+	} = new_partial(&config)?;
 
-    let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config);
+	let finality_proof_provider =
+		GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
 
-    let (block_import, grandpa_link) = import_setup.take().expect(
-        "Link Half and Block Import are present for Full Services or setup failed before. qed",
-    );
+	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: None,
+			block_announce_validator_builder: None,
+			finality_proof_request_builder: None,
+			finality_proof_provider: Some(finality_proof_provider.clone()),
+		})?;
 
-    let service = builder
-        .with_finality_proof_provider(|client, backend| {
-            // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider
-            let provider = client as Arc<dyn StorageAndProofProvider<_, _>>;
-            Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _)
-        })?
-        .build_full()?;
+	if config.offchain_worker.enabled {
+		sc_service::build_offchain_workers(
+			&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
+		);
+	}
 
-    if role.is_authority() {
-        let proposer = sc_basic_authorship::ProposerFactory::new(
-            service.client(),
-            service.transaction_pool(),
-            service.prometheus_registry().as_ref(),
-        );
+	let role = config.role.clone();
+	let force_authoring = config.force_authoring;
+	let name = config.network.node_name.clone();
+	let enable_grandpa = !config.disable_grandpa;
+	let prometheus_registry = config.prometheus_registry().cloned();
+	let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
 
-        let client = service.client();
-        let select_chain = service
-            .select_chain()
-            .ok_or(ServiceError::SelectChainRequired)?;
+	let rpc_extensions_builder = {
+		let client = client.clone();
+		let pool = transaction_pool.clone();
 
-        let can_author_with =
-            sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
+		Box::new(move |deny_unsafe, _| {
+			let deps = crate::rpc::FullDeps {
+				client: client.clone(),
+				pool: pool.clone(),
+				deny_unsafe,
+			};
 
-        let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>(
-            sc_consensus_aura::slot_duration(&*client)?,
-            client,
-            select_chain,
-            block_import,
-            proposer,
-            service.network(),
-            inherent_data_providers.clone(),
-            force_authoring,
-            service.keystore(),
-            can_author_with,
-        )?;
+			crate::rpc::create_full(deps)
+		})
+	};
 
-        // the AURA authoring task is considered essential, i.e. if it
-        // fails we take down the service with it.
-        service
-            .spawn_essential_task_handle()
-            .spawn_blocking("aura", aura);
-    }
+	sc_service::spawn_tasks(sc_service::SpawnTasksParams {
+		network: network.clone(),
+		client: client.clone(),
+		keystore: keystore.clone(),
+		task_manager: &mut task_manager,
+		transaction_pool: transaction_pool.clone(),
+		telemetry_connection_sinks: telemetry_connection_sinks.clone(),
+		rpc_extensions_builder: rpc_extensions_builder,
+		on_demand: None,
+		remote_blockchain: None,
+		backend, network_status_sinks, system_rpc_tx, config,
+	})?;
 
-    // if the node isn't actively participating in consensus then it doesn't
-    // need a keystore, regardless of which protocol we use below.
-    let keystore = if role.is_authority() {
-        Some(service.keystore() as sp_core::traits::BareCryptoStorePtr)
-    } else {
-        None
-    };
+	if role.is_authority() {
+		let proposer = sc_basic_authorship::ProposerFactory::new(
+			client.clone(),
+			transaction_pool,
+			prometheus_registry.as_ref(),
+		);
 
-    let grandpa_config = sc_finality_grandpa::Config {
-        // FIXME #1578 make this available through chainspec
-        gossip_duration: Duration::from_millis(333),
-        justification_period: 512,
-        name: Some(name),
-        observer_enabled: false,
-        keystore,
-        is_authority: role.is_network_authority(),
-    };
+		let can_author_with =
+			sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
 
-    let enable_grandpa = !disable_grandpa;
-    if enable_grandpa {
-        // start the full GRANDPA voter
-        // NOTE: non-authorities could run the GRANDPA observer protocol, but at
-        // this point the full voter should provide better guarantees of block
-        // and vote data availability than the observer. The observer has not
-        // been tested extensively yet and having most nodes in a network run it
-        // could lead to finality stalls.
-        let grandpa_config = sc_finality_grandpa::GrandpaParams {
-            config: grandpa_config,
-            link: grandpa_link,
-            network: service.network(),
-            inherent_data_providers: inherent_data_providers.clone(),
-            telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
-            voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
-            prometheus_registry: service.prometheus_registry(),
-            shared_voter_state: SharedVoterState::empty(),
-        };
+		let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>(
+			sc_consensus_aura::slot_duration(&*client)?,
+			client.clone(),
+			select_chain,
+			block_import,
+			proposer,
+			network.clone(),
+			inherent_data_providers.clone(),
+			force_authoring,
+			keystore.clone(),
+			can_author_with,
+		)?;
+
+		// the AURA authoring task is considered essential, i.e. if it
+		// fails we take down the service with it.
+		task_manager.spawn_essential_handle().spawn_blocking("aura", aura);
+	}
+
+	// if the node isn't actively participating in consensus then it doesn't
+	// need a keystore, regardless of which protocol we use below.
+	let keystore = if role.is_authority() {
+		Some(keystore as sp_core::traits::BareCryptoStorePtr)
+	} else {
+		None
+	};
+
+	let grandpa_config = sc_finality_grandpa::Config {
+		// FIXME #1578 make this available through chainspec
+		gossip_duration: Duration::from_millis(333),
+		justification_period: 512,
+		name: Some(name),
+		observer_enabled: false,
+		keystore,
+		is_authority: role.is_network_authority(),
+	};
+
+	if enable_grandpa {
+		// start the full GRANDPA voter
+		// NOTE: non-authorities could run the GRANDPA observer protocol, but at
+		// this point the full voter should provide better guarantees of block
+		// and vote data availability than the observer. The observer has not
+		// been tested extensively yet and having most nodes in a network run it
+		// could lead to finality stalls.
+		let grandpa_config = sc_finality_grandpa::GrandpaParams {
+			config: grandpa_config,
+			link: grandpa_link,
+			network,
+			inherent_data_providers,
+			telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
+			voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
+			prometheus_registry,
+			shared_voter_state: SharedVoterState::empty(),
+		};
 
-        // the GRANDPA voter task is considered infallible, i.e.
-        // if it fails we take down the service with it.
-        service.spawn_essential_task_handle().spawn_blocking(
-            "grandpa-voter",
-            sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
-        );
-    } else {
-        sc_finality_grandpa::setup_disabled_grandpa(
-            service.client(),
-            &inherent_data_providers,
-            service.network(),
-        )?;
-    }
+		// 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",
+			sc_finality_grandpa::run_grandpa_voter(grandpa_config)?
+		);
+	} else {
+		sc_finality_grandpa::setup_disabled_grandpa(
+			client,
+			&inherent_data_providers,
+			network,
+		)?;
+	}
 
-    Ok(service)
+	network_starter.start_network();
+	Ok(task_manager)
 }
 
 /// Builds a new service for a light client.
-pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceError> {
-    let inherent_data_providers = InherentDataProviders::new();
+pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
+	let (client, backend, keystore, mut task_manager, on_demand) =
+		sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
+
+	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(),
+	));
 
-    ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)?
-        .with_select_chain(|_config, backend| Ok(LongestChain::new(backend.clone())))?
-        .with_transaction_pool(|builder| {
-            let fetcher = builder
-                .fetcher()
-                .ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
+	let grandpa_block_import = sc_finality_grandpa::light_block_import(
+		client.clone(), backend.clone(), &(client.clone() as Arc<_>),
+		Arc::new(on_demand.checker().clone()) as Arc<_>,
+	)?;
+	let finality_proof_import = grandpa_block_import.clone();
+	let finality_proof_request_builder =
+		finality_proof_import.create_finality_proof_request_builder();
+
+	let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
+		sc_consensus_aura::slot_duration(&*client)?,
+		grandpa_block_import,
+		None,
+		Some(Box::new(finality_proof_import)),
+		client.clone(),
+		InherentDataProviders::new(),
+		&task_manager.spawn_handle(),
+		config.prometheus_registry(),
+		sp_consensus::NeverCanAuthor,
+	)?;
 
-            let pool_api =
-                sc_transaction_pool::LightChainApi::new(builder.client().clone(), fetcher.clone());
-            let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
-                builder.config().transaction_pool.clone(),
-                Arc::new(pool_api),
-                builder.prometheus_registry(),
-                sc_transaction_pool::RevalidationType::Light,
-            );
-            Ok(pool)
-        })?
-        .with_import_queue_and_fprb(
-            |_config,
-             client,
-             backend,
-             fetcher,
-             _select_chain,
-             _tx_pool,
-             spawn_task_handle,
-             prometheus_registry| {
-                let fetch_checker = fetcher
-                    .map(|fetcher| fetcher.checker().clone())
-                    .ok_or_else(|| {
-                        "Trying to start light import queue without active fetch checker"
-                    })?;
-                let grandpa_block_import = sc_finality_grandpa::light_block_import(
-                    client.clone(),
-                    backend,
-                    &(client.clone() as Arc<_>),
-                    Arc::new(fetch_checker),
-                )?;
-                let finality_proof_import = grandpa_block_import.clone();
-                let finality_proof_request_builder =
-                    finality_proof_import.create_finality_proof_request_builder();
+	let finality_proof_provider =
+		GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
+
+	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,
+			finality_proof_request_builder: Some(finality_proof_request_builder),
+			finality_proof_provider: Some(finality_proof_provider),
+		})?;
+
+	if config.offchain_worker.enabled {
+		sc_service::build_offchain_workers(
+			&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
+		);
+	}
+
+	sc_service::spawn_tasks(sc_service::SpawnTasksParams {
+		remote_blockchain: Some(backend.remote_blockchain()),
+		transaction_pool,
+		task_manager: &mut task_manager,
+		on_demand: Some(on_demand),
+		rpc_extensions_builder: Box::new(|_, _| ()),
+		telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
+		config,
+		client,
+		keystore,
+		backend,
+		network,
+		network_status_sinks,
+		system_rpc_tx,
+	 })?;
 
-                let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
-                    sc_consensus_aura::slot_duration(&*client)?,
-                    grandpa_block_import,
-                    None,
-                    Some(Box::new(finality_proof_import)),
-                    client,
-                    inherent_data_providers.clone(),
-                    spawn_task_handle,
-                    prometheus_registry,
-                )?;
+	 network_starter.start_network();
 
-                Ok((import_queue, finality_proof_request_builder))
-            },
-        )?
-        .with_finality_proof_provider(|client, backend| {
-            // GenesisAuthoritySetProvider is implemented for StorageAndProofProvider
-            let provider = client as Arc<dyn StorageAndProofProvider<_, _>>;
-            Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _)
-        })?
-        .build_light()
+	 Ok(task_manager)
 }
modifiedpallets/nft/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft/Cargo.toml
+++ b/pallets/nft/Cargo.toml
@@ -1,37 +1,52 @@
+[package]
+authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
+description = 'FRAME pallet nft'
+edition = '2018'
+homepage = 'https://substrate.io'
+license = 'Unlicense'
+name = 'pallet-nft'
+repository = 'https://github.com/substrate-developer-hub/nft/'
+version = '2.0.0'
+
+[package.metadata.docs.rs]
+targets = ['x86_64-unknown-linux-gnu']
+
+# alias "parity-scale-code" to "codec"
 [dependencies.codec]
 default-features = false
 features = ['derive']
 package = 'parity-scale-codec'
-version = '1.3.0'
+version = '1.3.4'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
+
 [dev-dependencies.sp-core]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
 [dev-dependencies.sp-io]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 	
 [dependencies]
 # third-party dependencies
@@ -41,27 +56,22 @@
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
 [dependencies.transaction-payment]
 default-features = false
 git = 'https://github.com/usetech-llc/substrate.git'
 package = 'pallet-transaction-payment'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
+branch = 'v2.0.0_release'
+version = '2.0.0'
 
-[package]
-authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
-description = 'FRAME pallet nft'
-edition = '2018'
-homepage = 'https://substrate.io'
-license = 'Unlicense'
-name = 'pallet-nft'
-repository = 'https://github.com/substrate-developer-hub/nft/'
-version = '2.0.0-rc4'
-[package.metadata.docs.rs]
-targets = ['x86_64-unknown-linux-gnu']
+[dependencies.frame-benchmarking]
+version = "2.0.0"
+default-features = false
+git = 'https://github.com/usetech-llc/substrate.git'
+branch = 'v2.0.0_release'
+optional = true
 
 [features]
 default = ['std']
@@ -70,6 +80,8 @@
     "serde/std",
     'frame-support/std',
     'frame-system/std',
+    'sp-std/std',
     'sp-runtime/std',
-    'sp-std/std',
+    'frame-benchmarking/std',
 ]
+runtime-benchmarks = ["frame-benchmarking"]
addedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/nft/src/benchmarking.rs
@@ -0,0 +1,294 @@
+#[cfg(feature = "runtime-benchmarks")]
+// mod benchmarking {
+    use super::*;
+    use sp_std::prelude::*;
+    use frame_system::RawOrigin;
+    // use frame_support::{ensure, traits::OnFinalize};
+    use frame_benchmarking::{benchmarks, account, whitelisted_caller};  // , TrackedStorageKey, 
+    use crate::Module as Nft;
+
+    const SEED: u32 = 1;
+
+    benchmarks! {
+
+        _ {}
+
+        create_collection {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = account("caller", 0, SEED);
+        }: create_collection(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)
+        verify {
+			assert_eq!(Nft::<T>::collection(2).owner, caller);
+        }
+
+        destroy_collection {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+        }: destroy_collection(RawOrigin::Signed(caller.clone()), 2)
+
+        add_to_white_list {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            let whitelist_account: T::AccountId = account("admin", 0, SEED);
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+        }: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
+
+        remove_from_white_list {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            let whitelist_account: T::AccountId = account("admin", 0, SEED);
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?;
+        }: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)
+
+        set_public_access_mode {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+        }: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList)
+
+        set_mint_permission {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+        }: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true)
+
+        change_collection_owner {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            let new_owner: T::AccountId = account("admin", 0, SEED);
+        }: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner)
+
+        add_collection_admin {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            let new_admin: T::AccountId = account("admin", 0, SEED);
+        }: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
+
+        remove_collection_admin {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            let new_admin: T::AccountId = account("admin", 0, SEED);
+            Nft::<T>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?;
+        }: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)
+
+        set_collection_sponsor {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+        }: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone())
+
+        confirm_sponsorship {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
+        }: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2)
+
+        remove_collection_sponsor {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
+            Nft::<T>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;
+        }: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2)
+
+        // nft item
+        create_item_nft {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec(), caller.clone())
+
+        #[extra]
+        create_item_nft_large {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            let mut item_large: Vec<u8> = Vec::new(); 
+            for i in 0..1998 {
+                item_large.push(10);
+            }
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, item_large, caller.clone())
+
+        // fungible item
+        create_item_fungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::Fungible(3);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, [].to_vec(), caller.clone())
+
+        // refungible item
+        create_item_refungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::ReFungible(3, 3);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec(), caller.clone())
+
+        burn_item {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1, 2, 3].to_vec(), caller.clone())?;
+
+        }: burn_item(RawOrigin::Signed(caller.clone()), 2, 1)
+
+        transfer_nft {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1, 2, 3].to_vec(), caller.clone())?;
+
+        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
+        
+        transfer_fungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::Fungible(3);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [].to_vec(), caller.clone())?;
+
+        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
+
+        transfer_refungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::ReFungible(3,3);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;
+
+        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
+
+        approve {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::ReFungible(3,3);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;
+
+        }: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1)
+
+        // Nft
+        transfer_from_nft {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(300);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;
+            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+
+        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+
+        // Fungible
+        transfer_from_fungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::Fungible(3);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [].to_vec(), caller.clone())?;
+            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+
+        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+
+        // ReFungible
+        transfer_from_refungible {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::ReFungible(3,3);
+            let recipient: T::AccountId = account("recipient", 0, SEED);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;
+            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
+
+        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
+
+        set_offchain_schema {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::ReFungible(3,3);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
+    }
\ No newline at end of file
addedpallets/nft/src/default_weights.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/nft/src/default_weights.rs
@@ -0,0 +1,95 @@
+use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
+
+impl crate::WeightInfo for () {
+	fn create_collection() -> Weight {
+		(70_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(7 as Weight))
+			.saturating_add(DbWeight::get().writes(5 as Weight))
+	}
+	fn destroy_collection() -> Weight {
+		(90_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(2 as Weight))
+			.saturating_add(DbWeight::get().writes(5 as Weight))
+	}
+	fn add_to_white_list() -> Weight {
+		(30_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(3 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn remove_from_white_list() -> Weight {
+		(35_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(3 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn set_public_access_mode() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn set_mint_permission() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn change_collection_owner() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn add_collection_admin() -> Weight {
+        (32_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(3 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_admin() -> Weight {
+		(50_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn set_collection_sponsor() -> Weight {
+		(32_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn confirm_sponsorship() -> Weight {
+		(22_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(1 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn remove_collection_sponsor() -> Weight {
+		(24_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(1 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn create_item(s: usize, ) -> Weight {
+        (130_000_000 as Weight)
+            .saturating_add((2135 as Weight).saturating_mul(s as Weight))
+            .saturating_add(DbWeight::get().reads(10 as Weight))
+            .saturating_add(DbWeight::get().writes(8 as Weight))
+    }  
+    fn burn_item() -> Weight {
+		(170_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(9 as Weight))
+            .saturating_add(DbWeight::get().writes(7 as Weight))
+    }  
+    fn transfer() -> Weight {
+        (125_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(7 as Weight))
+            .saturating_add(DbWeight::get().writes(7 as Weight))
+    }  
+    fn approve() -> Weight {
+        (45_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(3 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn transfer_from() -> Weight {
+        (150_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(9 as Weight))
+            .saturating_add(DbWeight::get().writes(8 as Weight))
+    }
+    fn set_offchain_schema() -> Weight {
+        (33_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+}
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
before · pallets/nft/src/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]23#[cfg(feature = "std")]4pub use std::*;56#[cfg(feature = "std")]7pub use serde::*;89use codec::{Decode, Encode};10pub use frame_support::{11    construct_runtime, decl_event, decl_module, decl_storage,12    dispatch::DispatchResult,13    ensure, fail, parameter_types,14    traits::{15        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,16        Randomness, WithdrawReason,17    },18    weights::{19        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},20        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,21        WeightToFeePolynomial,22    },23    IsSubType, StorageValue,24};2526use frame_system::{self as system, ensure_signed, ensure_root};27use sp_runtime::sp_std::prelude::Vec;28use sp_runtime::{29    traits::{30        DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SaturatedConversion, Saturating,31        SignedExtension, Zero,32    },33    transaction_validity::{34        InvalidTransaction, TransactionPriority, TransactionValidity, TransactionValidityError,35        ValidTransaction,36    },37    FixedPointOperand, FixedU128,38};3940#[cfg(test)]41mod mock;4243#[cfg(test)]44mod tests;4546// Structs47// #region4849#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]50#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]51pub enum CollectionMode {52    Invalid,53    // custom data size54    NFT(u32),55    // decimal points56    Fungible(u32),57    // custom data size and decimal points58    ReFungible(u32, u32),59}6061impl Into<u8> for CollectionMode {62    fn into(self) -> u8 {63        match self {64            CollectionMode::Invalid => 0,65            CollectionMode::NFT(_) => 1,66            CollectionMode::Fungible(_) => 2,67            CollectionMode::ReFungible(_, _) => 3,68        }69    }70}7172#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]73#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]74pub enum AccessMode {75    Normal,76    WhiteList,77}78impl Default for AccessMode {79    fn default() -> Self {80        Self::Normal81    }82}8384impl Default for CollectionMode {85    fn default() -> Self {86        Self::Invalid87    }88}8990#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]91#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]92pub struct Ownership<AccountId> {93    pub owner: AccountId,94    pub fraction: u128,95}9697#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]98#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]99pub struct CollectionType<AccountId> {100    pub owner: AccountId,101    pub mode: CollectionMode,102    pub access: AccessMode,103    pub decimal_points: u32,104    pub name: Vec<u16>,        // 64 include null escape char105    pub description: Vec<u16>, // 256 include null escape char106    pub token_prefix: Vec<u8>, // 16 include null escape char107    pub custom_data_size: u32,108    pub mint_mode: bool,109    pub offchain_schema: Vec<u8>,110    pub sponsor: AccountId, // Who pays fees. If set to default address, the fees are applied to the transaction sender111    pub unconfirmed_sponsor: AccountId, // Sponsor address that has not yet confirmed sponsorship112}113114#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]115#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]116pub struct CollectionAdminsType<AccountId> {117    pub admin: AccountId,118    pub collection_id: u64,119}120121#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]122#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]123pub struct NftItemType<AccountId> {124    pub collection: u64,125    pub owner: AccountId,126    pub data: Vec<u8>,127}128129#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]130#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]131pub struct FungibleItemType<AccountId> {132    pub collection: u64,133    pub owner: AccountId,134    pub value: u128,135}136137#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]138#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]139pub struct ReFungibleItemType<AccountId> {140    pub collection: u64,141    pub owner: Vec<Ownership<AccountId>>,142    pub data: Vec<u8>,143}144145#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]146#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]147pub struct ApprovePermissions<AccountId> {148    pub approved: AccountId,149    pub amount: u64,150}151152#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]153#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]154pub struct VestingItem<AccountId, Moment> {155    pub sender: AccountId,156    pub recipient: AccountId,157    pub collection_id: u64,158    pub item_id: u64,159    pub amount: u64,160    pub vesting_date: Moment,161}162163#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]164#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]165pub struct BasketItem<AccountId, BlockNumber> {166    pub address: AccountId,167    pub start_block: BlockNumber,168}169170#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]171#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]172pub struct ChainLimits {173    pub collection_numbers_limit: u64,174    pub account_token_ownership_limit: u64,175    pub collections_admins_limit: u64,176    pub custom_data_limit: u32,177178    // Timeouts for item types in passed blocks179    pub nft_sponsor_transfer_timeout: u32,180    pub fungible_sponsor_transfer_timeout: u32,181    pub refungible_sponsor_transfer_timeout: u32,182}183184pub trait Trait: system::Trait {185    type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;186}187188// #endregion189190decl_storage! {191    trait Store for Module<T: Trait> as Nft {192193        // Private members194        NextCollectionID: u64;195        CreatedCollectionCount: u64;196        ChainVersion: u64;197        ItemListIndex: map hasher(blake2_128_concat) u64 => u64;198199        // Chain limits struct200        pub ChainLimit get(fn chain_limit) config(): ChainLimits;201202        // Bound counters203        CollectionCount: u64;204        pub AccountItemCount get(fn account_item_count): map hasher(identity) T::AccountId => u64;205206        // Basic collections207        pub Collection get(fn collection) config(): map hasher(identity) u64 => CollectionType<T::AccountId>;208        pub AdminList get(fn admin_list_collection): map hasher(identity) u64 => Vec<T::AccountId>;209        pub WhiteList get(fn white_list): map hasher(identity) u64 => Vec<T::AccountId>;210211        /// Balance owner per collection map212        pub Balance get(fn balance_count): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) T::AccountId => u64;213214        /// second parameter: item id + owner account id215        pub ApprovedList get(fn approved): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) (u64, T::AccountId) => Vec<ApprovePermissions<T::AccountId>>;216217        /// Item collections218        pub NftItemList get(fn nft_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => NftItemType<T::AccountId>;219        pub FungibleItemList get(fn fungible_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => FungibleItemType<T::AccountId>;220        pub ReFungibleItemList get(fn refungible_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => ReFungibleItemType<T::AccountId>;221222        /// Index list223        pub AddressTokens get(fn address_tokens): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) T::AccountId => Vec<u64>;224225        /// Tokens transfer baskets226        pub NftTransferBasket get(fn nft_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => T::BlockNumber;227        pub FungibleTransferBasket get(fn fungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => Vec<BasketItem<T::AccountId, T::BlockNumber>>;228        pub ReFungibleTransferBasket get(fn refungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => T::BlockNumber;229230        // Sponsorship231        pub ContractSponsor get(fn contract_sponsor): map hasher(identity) T::AccountId => T::AccountId;232        pub UnconfirmedContractSponsor get(fn unconfirmed_contract_sponsor): map hasher(identity) T::AccountId => T::AccountId;233    }234    add_extra_genesis {235        build(|config: &GenesisConfig<T>| {236            // Modification of storage237            for (_num, _c) in &config.collection {238                <Module<T>>::init_collection(_c);239            }240241            for (_num, _q, _i) in &config.nft_item_id {242                <Module<T>>::init_nft_token(_i);243            }244245            for (_num, _q, _i) in &config.fungible_item_id {246                <Module<T>>::init_fungible_token(_i);247            }248249            for (_num, _q, _i) in &config.refungible_item_id {250                <Module<T>>::init_refungible_token(_i);251            }252        })253    }254}255256decl_event!(257    pub enum Event<T>258    where259        AccountId = <T as system::Trait>::AccountId,260    {261        /// New collection was created262        /// 263        /// # Arguments264        /// 265        /// * collection_id: Globally unique identifier of newly created collection.266        /// 267        /// * mode: [CollectionMode] converted into u8.268        /// 269        /// * account_id: Collection owner.270        Created(u64, u8, AccountId),271272        /// New item was created.273        /// 274        /// # Arguments275        /// 276        /// * collection_id: Id of the collection where item was created.277        /// 278        /// * item_id: Id of an item. Unique within the collection.279        ItemCreated(u64, u64),280281        /// Collection item was burned.282        /// 283        /// # Arguments284        /// 285        /// collection_id.286        /// 287        /// item_id: Identifier of burned NFT.288        ItemDestroyed(u64, u64),289    }290);291292decl_module! {293    pub struct Module<T: Trait> for enum Call where origin: T::Origin {294295        fn deposit_event() = default;296297        fn on_initialize(now: T::BlockNumber) -> Weight {298299            if ChainVersion::get() < 2300            {301                let value = NextCollectionID::get();302                CreatedCollectionCount::put(value);303                ChainVersion::put(2);304            }305306            0307        }308309        /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.310        /// 311        /// # Permissions312        /// 313        /// * Anyone.314        /// 315        /// # Arguments316        /// 317        /// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.318        /// 319        /// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.320        /// 321        /// * token_prefix: UTF-8 string with token prefix.322        /// 323        /// * mode: [CollectionMode] collection type and type dependent data.324        // returns collection ID325        #[weight = 0]326        pub fn create_collection(origin,327                                 collection_name: Vec<u16>,328                                 collection_description: Vec<u16>,329                                 token_prefix: Vec<u8>,330                                 mode: CollectionMode) -> DispatchResult {331332            // Anyone can create a collection333            let who = ensure_signed(origin)?;334            let custom_data_size = match mode {335                CollectionMode::NFT(size) => {336337                    // bound Custom data size338                    ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded");339                    size340                },341                CollectionMode::ReFungible(size, _) => {342343                    // bound Custom data size344                    ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded");345                    size346                },347                _ => 0348            };349350            let decimal_points = match mode {351                CollectionMode::Fungible(points) => points,352                CollectionMode::ReFungible(_, points) => points,353                _ => 0354            };355356            // bound Total number of collections357            ensure!(CollectionCount::get() < ChainLimit::get().collection_numbers_limit, "Total collections bound exceeded");358359            // check params360            ensure!(decimal_points <= 4, "decimal_points parameter must be lower than 4");361362            let mut name = collection_name.to_vec();363            name.push(0);364            ensure!(name.len() <= 64, "Collection name can not be longer than 63 char");365366            let mut description = collection_description.to_vec();367            description.push(0);368            ensure!(name.len() <= 256, "Collection description can not be longer than 255 char");369370            let mut prefix = token_prefix.to_vec();371            prefix.push(0);372            ensure!(prefix.len() <= 16, "Token prefix can not be longer than 15 char");373374            // Generate next collection ID375            let next_id = CreatedCollectionCount::get()376                .checked_add(1)377                .expect("collection id error");378379            // bound counter380            let total = CollectionCount::get()381                .checked_add(1)382                .expect("collection counter error");383384            CreatedCollectionCount::put(next_id);385            CollectionCount::put(total);386387            // Create new collection388            let new_collection = CollectionType {389                owner: who.clone(),390                name: name,391                mode: mode.clone(),392                mint_mode: false,393                access: AccessMode::Normal,394                description: description,395                decimal_points: decimal_points,396                token_prefix: prefix,397                offchain_schema: Vec::new(),398                custom_data_size: custom_data_size,399                sponsor: T::AccountId::default(),400                unconfirmed_sponsor: T::AccountId::default(),401            };402403            // Add new collection to map404            <Collection<T>>::insert(next_id, new_collection);405406            // call event407            Self::deposit_event(RawEvent::Created(next_id, mode.into(), who.clone()));408409            Ok(())410        }411412        /// **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.413        /// 414        /// # Permissions415        /// 416        /// * Collection Owner.417        /// 418        /// # Arguments419        /// 420        /// * collection_id: collection to destroy.421        #[weight = 0]422        pub fn destroy_collection(origin, collection_id: u64) -> DispatchResult {423424            let sender = ensure_signed(origin)?;425            Self::check_owner_permissions(collection_id, sender)?;426427            <AddressTokens<T>>::remove_prefix(collection_id);428            <ApprovedList<T>>::remove_prefix(collection_id);429            <Balance<T>>::remove_prefix(collection_id);430            <ItemListIndex>::remove(collection_id);431            <AdminList<T>>::remove(collection_id);432            <Collection<T>>::remove(collection_id);433            <WhiteList<T>>::remove(collection_id);434435            <NftItemList<T>>::remove_prefix(collection_id);436            <FungibleItemList<T>>::remove_prefix(collection_id);437            <ReFungibleItemList<T>>::remove_prefix(collection_id);438439            <NftTransferBasket<T>>::remove_prefix(collection_id);440            <FungibleTransferBasket<T>>::remove_prefix(collection_id);441            <ReFungibleTransferBasket<T>>::remove_prefix(collection_id);442443            if CollectionCount::get() > 0444            {445                // bound couter446                let total = CollectionCount::get()447                    .checked_sub(1)448                    .expect("collection counter error");449450                CollectionCount::put(total);451            }452453            Ok(())454        }455456        /// Add an address to white list.457        /// 458        /// # Permissions459        /// 460        /// * Collection Owner461        /// * Collection Admin462        /// 463        /// # Arguments464        /// 465        /// * collection_id.466        /// 467        /// * address.468        #[weight = 0]469        pub fn add_to_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{470471            let sender = ensure_signed(origin)?;472            Self::check_owner_or_admin_permissions(collection_id, sender)?;473474            let mut white_list_collection: Vec<T::AccountId>;475            if <WhiteList<T>>::contains_key(collection_id) {476                white_list_collection = <WhiteList<T>>::get(collection_id);477                if !white_list_collection.contains(&address.clone())478                {479                    white_list_collection.push(address.clone());480                }481            }482            else {483                white_list_collection = Vec::new();484                white_list_collection.push(address.clone());485            }486487            <WhiteList<T>>::insert(collection_id, white_list_collection);488            Ok(())489        }490491        /// Remove an address from white list.492        /// 493        /// # Permissions494        /// 495        /// * Collection Owner496        /// * Collection Admin497        /// 498        /// # Arguments499        /// 500        /// * collection_id.501        /// 502        /// * address.503        #[weight = 0]504        pub fn remove_from_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{505506            let sender = ensure_signed(origin)?;507            Self::check_owner_or_admin_permissions(collection_id, sender)?;508509            if <WhiteList<T>>::contains_key(collection_id) {510                let mut white_list_collection = <WhiteList<T>>::get(collection_id);511                if white_list_collection.contains(&address.clone())512                {513                    white_list_collection.retain(|i| *i != address.clone());514                    <WhiteList<T>>::insert(collection_id, white_list_collection);515                }516            }517518            Ok(())519        }520521        /// Toggle between normal and white list access for the methods with access for `Anyone`.522        /// 523        /// # Permissions524        /// 525        /// * Collection Owner.526        /// 527        /// # Arguments528        /// 529        /// * collection_id.530        /// 531        /// * mode: [AccessMode]532        #[weight = 0]533        pub fn set_public_access_mode(origin, collection_id: u64, mode: AccessMode) -> DispatchResult534        {535            let sender = ensure_signed(origin)?;536537            Self::check_owner_permissions(collection_id, sender)?;538            let mut target_collection = <Collection<T>>::get(collection_id);539            target_collection.access = mode;540            <Collection<T>>::insert(collection_id, target_collection);541542            Ok(())543        }544545        /// Allows Anyone to create tokens if:546        /// * White List is enabled, and547        /// * Address is added to white list, and548        /// * This method was called with True parameter549        /// 550        /// # Permissions551        /// * Collection Owner552        ///553        /// # Arguments554        /// 555        /// * collection_id.556        /// 557        /// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.558        #[weight = 0]559        pub fn set_mint_permission(origin, collection_id: u64, mint_permission: bool) -> DispatchResult560        {561            let sender = ensure_signed(origin)?;562563            Self::check_owner_permissions(collection_id, sender)?;564            let mut target_collection = <Collection<T>>::get(collection_id);565            target_collection.mint_mode = mint_permission;566            <Collection<T>>::insert(collection_id, target_collection);567568            Ok(())569        }570571        /// Change the owner of the collection.572        /// 573        /// # Permissions574        /// 575        /// * Collection Owner.576        /// 577        /// # Arguments578        /// 579        /// * collection_id.580        /// 581        /// * new_owner.582        #[weight = 0]583        pub fn change_collection_owner(origin, collection_id: u64, new_owner: T::AccountId) -> DispatchResult {584585            let sender = ensure_signed(origin)?;586            Self::check_owner_permissions(collection_id, sender)?;587            let mut target_collection = <Collection<T>>::get(collection_id);588            target_collection.owner = new_owner;589            <Collection<T>>::insert(collection_id, target_collection);590591            Ok(())592        }593594        /// Adds an admin of the Collection.595        /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership. 596        /// 597        /// # Permissions598        /// 599        /// * Collection Owner.600        /// * Collection Admin.601        /// 602        /// # Arguments603        /// 604        /// * collection_id: ID of the Collection to add admin for.605        /// 606        /// * new_admin_id: Address of new admin to add.607        #[weight = 0]608        pub fn add_collection_admin(origin, collection_id: u64, new_admin_id: T::AccountId) -> DispatchResult {609610            let sender = ensure_signed(origin)?;611            Self::check_owner_or_admin_permissions(collection_id, sender)?;612            let mut admin_arr: Vec<T::AccountId> = Vec::new();613614            if <AdminList<T>>::contains_key(collection_id)615            {616                admin_arr = <AdminList<T>>::get(collection_id);617                ensure!(!admin_arr.contains(&new_admin_id), "Account already has admin role");618            }619620            // Number of collection admins621            ensure!((admin_arr.len() as u64) < ChainLimit::get().collections_admins_limit, "Number of collection admins bound exceeded");622623            admin_arr.push(new_admin_id);624            <AdminList<T>>::insert(collection_id, admin_arr);625626            Ok(())627        }628629        /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.630        ///631        /// # Permissions632        /// 633        /// * Collection Owner.634        /// * Collection Admin.635        /// 636        /// # Arguments637        /// 638        /// * collection_id: ID of the Collection to remove admin for.639        /// 640        /// * account_id: Address of admin to remove.641        #[weight = 0]642        pub fn remove_collection_admin(origin, collection_id: u64, account_id: T::AccountId) -> DispatchResult {643644            let sender = ensure_signed(origin)?;645            Self::check_owner_or_admin_permissions(collection_id, sender)?;646647            if <AdminList<T>>::contains_key(collection_id)648            {649                let mut admin_arr = <AdminList<T>>::get(collection_id);650                admin_arr.retain(|i| *i != account_id);651                <AdminList<T>>::insert(collection_id, admin_arr);652            }653654            Ok(())655        }656657        /// # Permissions658        /// 659        /// * Collection Owner660        /// 661        /// # Arguments662        /// 663        /// * collection_id.664        /// 665        /// * new_sponsor.666        #[weight = 0]667        pub fn set_collection_sponsor(origin, collection_id: u64, new_sponsor: T::AccountId) -> DispatchResult {668669            let sender = ensure_signed(origin)?;670            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");671672            let mut target_collection = <Collection<T>>::get(collection_id);673            ensure!(sender == target_collection.owner, "You do not own this collection");674675            target_collection.unconfirmed_sponsor = new_sponsor;676            <Collection<T>>::insert(collection_id, target_collection);677678            Ok(())679        }680681        /// # Permissions682        /// 683        /// * Sponsor.684        /// 685        /// # Arguments686        /// 687        /// * collection_id.688        #[weight = 0]689        pub fn confirm_sponsorship(origin, collection_id: u64) -> DispatchResult {690691            let sender = ensure_signed(origin)?;692            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");693694            let mut target_collection = <Collection<T>>::get(collection_id);695            ensure!(sender == target_collection.unconfirmed_sponsor, "This address is not set as sponsor, use setCollectionSponsor first");696697            target_collection.sponsor = target_collection.unconfirmed_sponsor;698            target_collection.unconfirmed_sponsor = T::AccountId::default();699            <Collection<T>>::insert(collection_id, target_collection);700701            Ok(())702        }703704        /// Switch back to pay-per-own-transaction model.705        ///706        /// # Permissions707        ///708        /// * Collection owner.709        /// 710        /// # Arguments711        /// 712        /// * collection_id.713        #[weight = 0]714        pub fn remove_collection_sponsor(origin, collection_id: u64) -> DispatchResult {715716            let sender = ensure_signed(origin)?;717            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");718719            let mut target_collection = <Collection<T>>::get(collection_id);720            ensure!(sender == target_collection.owner, "You do not own this collection");721722            target_collection.sponsor = T::AccountId::default();723            <Collection<T>>::insert(collection_id, target_collection);724725            Ok(())726        }727728        /// This method creates a concrete instance of NFT Collection created with CreateCollection method.729        /// 730        /// # Permissions731        /// 732        /// * Collection Owner.733        /// * Collection Admin.734        /// * Anyone if735        ///     * White List is enabled, and736        ///     * Address is added to white list, and737        ///     * MintPermission is enabled (see SetMintPermission method)738        /// 739        /// # Arguments740        /// 741        /// * collection_id: ID of the collection.742        /// 743        /// * properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties meaning, it is treated purely as an array of bytes.744        /// 745        /// * owner: Address, initial owner of the NFT.746        #[weight = 0]747        pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {748749            let sender = ensure_signed(origin)?;750751            Self::collection_exists(collection_id)?;752753            let target_collection = <Collection<T>>::get(collection_id);754755            Self::can_create_items_in_collection(collection_id, &target_collection, &sender, &owner)?;756            Self::validate_create_item_args(&target_collection, &properties)?;757            Self::create_item_no_validation(collection_id, &target_collection, &properties, &owner)?;758759            Ok(())760        }761762        /// This method creates multiple instances of NFT Collection created with CreateCollection method.763        /// 764        /// # Permissions765        /// 766        /// * Collection Owner.767        /// * Collection Admin.768        /// * Anyone if769        ///     * White List is enabled, and770        ///     * Address is added to white list, and771        ///     * MintPermission is enabled (see SetMintPermission method)772        /// 773        /// # Arguments774        /// 775        /// * collection_id: ID of the collection.776        /// 777        /// * properties: Array items properties. Each property is an array of bytes itself, see [create_item].778        /// 779        /// * owner: Address, initial owner of the NFT.780        #[weight = 0]781        pub fn create_multiple_items(origin, collection_id: u64, properties: Vec<Vec<u8>>, owner: T::AccountId) -> DispatchResult {782783            ensure!(properties.len() > 0, "Length of items properties must be greater than 0.");784            let sender = ensure_signed(origin)?;785786            Self::collection_exists(collection_id)?;787            let target_collection = <Collection<T>>::get(collection_id);788789            Self::can_create_items_in_collection(collection_id, &target_collection, &sender, &owner)?;790791            for prop in &properties {792                Self::validate_create_item_args(&target_collection, prop)?;793            }794            for prop in &properties {795                Self::create_item_no_validation(collection_id, &target_collection, prop, &owner)?;796            }797798            Ok(())799        }800801        /// Destroys a concrete instance of NFT.802        /// 803        /// # Permissions804        /// 805        /// * Collection Owner.806        /// * Collection Admin.807        /// * Current NFT Owner.808        /// 809        /// # Arguments810        /// 811        /// * collection_id: ID of the collection.812        /// 813        /// * item_id: ID of NFT to burn.814        #[weight = 0]815        pub fn burn_item(origin, collection_id: u64, item_id: u64) -> DispatchResult {816817            let sender = ensure_signed(origin)?;818            Self::collection_exists(collection_id)?;819820            // Transfer permissions check821            let target_collection = <Collection<T>>::get(collection_id);822            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||823                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),824                "Only item owner, collection owner and admins can modify item");825826            if target_collection.access == AccessMode::WhiteList {827                Self::check_white_list(collection_id, &sender)?;828            }829830            match target_collection.mode831            {832                CollectionMode::NFT(_) => Self::burn_nft_item(collection_id, item_id)?,833                CollectionMode::Fungible(_)  => Self::burn_fungible_item(collection_id, item_id)?,834                CollectionMode::ReFungible(_, _)  => Self::burn_refungible_item(collection_id, item_id, sender.clone())?,835                _ => ()836            };837838            // call event839            Self::deposit_event(RawEvent::ItemDestroyed(collection_id, item_id));840841            Ok(())842        }843844        /// Change ownership of the token.845        /// 846        /// # Permissions847        /// 848        /// * Collection Owner849        /// * Collection Admin850        /// * Current NFT owner851        ///852        /// # Arguments853        /// 854        /// * recipient: Address of token recipient.855        /// 856        /// * collection_id.857        /// 858        /// * item_id: ID of the item859        ///     * Non-Fungible Mode: Required.860        ///     * Fungible Mode: Ignored.861        ///     * Re-Fungible Mode: Required.862        /// 863        /// * value: Amount to transfer.864        ///     * Non-Fungible Mode: Ignored865        ///     * Fungible Mode: Must specify transferred amount866        ///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)867        #[weight = 0]868        pub fn transfer(origin, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64) -> DispatchResult {869870            let sender = ensure_signed(origin)?;871872            // Transfer permissions check873            let target_collection = <Collection<T>>::get(collection_id);874            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||875                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),876                "Only item owner, collection owner and admins can modify item");877878            if target_collection.access == AccessMode::WhiteList {879                Self::check_white_list(collection_id, &sender)?;880                Self::check_white_list(collection_id, &recipient)?;881            }882883            match target_collection.mode884            {885                CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient)?,886                CollectionMode::Fungible(_)  => Self::transfer_fungible(collection_id, item_id, value, sender.clone(), recipient)?,887                CollectionMode::ReFungible(_, _)  => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient)?,888                _ => ()889            };890891            Ok(())892        }893894        /// Set, change, or remove approved address to transfer the ownership of the NFT.895        /// 896        /// # Permissions897        /// 898        /// * Collection Owner899        /// * Collection Admin900        /// * Current NFT owner901        /// 902        /// # Arguments903        /// 904        /// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).905        /// 906        /// * collection_id.907        /// 908        /// * item_id: ID of the item.909        #[weight = 0]910        pub fn approve(origin, approved: T::AccountId, collection_id: u64, item_id: u64) -> DispatchResult {911912            let sender = ensure_signed(origin)?;913914            // Transfer permissions check915            let target_collection = <Collection<T>>::get(collection_id);916            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||917                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),918                "Only item owner, collection owner and admins can approve");919920            if target_collection.access == AccessMode::WhiteList {921                Self::check_white_list(collection_id, &sender)?;922                Self::check_white_list(collection_id, &approved)?;923            }924925            // amount param stub926            let amount = 100000000;927928            let list_exists = <ApprovedList<T>>::contains_key(collection_id, (item_id, sender.clone()));929            if list_exists {930931                let mut list = <ApprovedList<T>>::get(collection_id, (item_id, sender.clone()));932                let item_contains = list.iter().any(|i| i.approved == approved);933934                if !item_contains {935                    list.push(ApprovePermissions { approved: approved.clone(), amount: amount });936                    <ApprovedList<T>>::insert(collection_id, (item_id, sender.clone()), list);937                }938            } else {939940                let mut list = Vec::new();941                list.push(ApprovePermissions { approved: approved.clone(), amount: amount });942                <ApprovedList<T>>::insert(collection_id, (item_id, sender.clone()), list);943            }944945            Ok(())946        }947        948        /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.949        /// 950        /// # Permissions951        /// * Collection Owner952        /// * Collection Admin953        /// * Current NFT owner954        /// * Address approved by current NFT owner955        /// 956        /// # Arguments957        /// 958        /// * from: Address that owns token.959        /// 960        /// * recipient: Address of token recipient.961        /// 962        /// * collection_id.963        /// 964        /// * item_id: ID of the item.965        /// 966        /// * value: Amount to transfer.967        #[weight = 0]968        pub fn transfer_from(origin, from: T::AccountId, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64 ) -> DispatchResult {969970            let sender = ensure_signed(origin)?;971            let mut appoved_transfer = false;972973            // Check approve974            if <ApprovedList<T>>::contains_key(collection_id, (item_id, from.clone())) {975                let list_itm = <ApprovedList<T>>::get(collection_id, (item_id, from.clone()));976                let opt_item = list_itm.iter().find(|i| i.approved == sender.clone());977                appoved_transfer = opt_item.is_some();978                ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved");979            }980981            // Transfer permissions check982            let target_collection = <Collection<T>>::get(collection_id);983            ensure!(appoved_transfer || Self::is_owner_or_admin_permissions(collection_id, sender.clone()),984                "Only item owner, collection owner and admins can modify items");985986            if target_collection.access == AccessMode::WhiteList {987                Self::check_white_list(collection_id, &sender)?;988                Self::check_white_list(collection_id, &recipient)?;989            }990991            // remove approve992            let approve_list: Vec<ApprovePermissions<T::AccountId>> = <ApprovedList<T>>::get(collection_id, (item_id, from.clone()))993                .into_iter().filter(|i| i.approved != sender.clone()).collect();994            <ApprovedList<T>>::insert(collection_id, (item_id, from.clone()), approve_list);995996997            match target_collection.mode998            {999                CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, from, recipient)?,1000                CollectionMode::Fungible(_)  => Self::transfer_fungible(collection_id, item_id, value, from.clone(), recipient)?,1001                CollectionMode::ReFungible(_, _)  => Self::transfer_refungible(collection_id, item_id, value, from.clone(), recipient)?,1002                _ => ()1003            };10041005            Ok(())1006        }10071008        ///1009        #[weight = 0]1010        pub fn safe_transfer_from(origin, collection_id: u64, item_id: u64, new_owner: T::AccountId) -> DispatchResult {10111012            // let no_perm_mes = "You do not have permissions to modify this collection";1013            // ensure!(<ApprovedList<T>>::contains_key((collection_id, item_id)), no_perm_mes);1014            // let list_itm = <ApprovedList<T>>::get((collection_id, item_id));1015            // ensure!(list_itm.contains(&new_owner.clone()), no_perm_mes);10161017            // // on_nft_received  call10181019            // Self::transfer(origin, collection_id, item_id, new_owner)?;10201021            Ok(())1022        }10231024        /// Set off-chain data schema.1025        /// 1026        /// # Permissions1027        /// 1028        /// * Collection Owner1029        /// * Collection Admin1030        /// 1031        /// # Arguments1032        /// 1033        /// * collection_id.1034        /// 1035        /// * schema: String representing the offchain data schema.1036        #[weight = 0]1037        pub fn set_offchain_schema(1038            origin,1039            collection_id: u64,1040            schema: Vec<u8>1041        ) -> DispatchResult {1042            let sender = ensure_signed(origin)?;1043            Self::check_owner_or_admin_permissions(collection_id, sender.clone())?;10441045            let mut target_collection = <Collection<T>>::get(collection_id);1046            target_collection.offchain_schema = schema;1047            <Collection<T>>::insert(collection_id, target_collection);10481049            Ok(())1050        }10511052        // Sudo permissions function1053        #[weight = 0]1054        pub fn set_chain_limits(1055            origin,1056            limits: ChainLimits1057        ) -> DispatchResult {1058            ensure_root(origin)?;1059            <ChainLimit>::put(limits);1060            Ok(())1061        }        1062    }1063}10641065impl<T: Trait> Module<T> {10661067    fn can_create_items_in_collection(collection_id: u64, collection: &CollectionType<T::AccountId>, sender: &T::AccountId, owner: &T::AccountId) -> DispatchResult {10681069        if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {1070            ensure!(collection.mint_mode == true, "Public minting is not allowed for this collection");1071            Self::check_white_list(collection_id, owner)?;1072            Self::check_white_list(collection_id, sender)?;1073        }10741075        Ok(())1076    }10771078    fn validate_create_item_args(collection: &CollectionType<T::AccountId>, properties: &Vec<u8>) -> DispatchResult {10791080        match collection.mode1081        {1082            CollectionMode::NFT(_) => {10831084                // check size1085                ensure!(collection.custom_data_size >= properties.len() as u32, "Size of item is too large")1086            },1087            CollectionMode::Fungible(_) => {10881089                // check size1090                ensure!(properties.len() as u32 == 0, "Size of item must be 0 with fungible type")1091            },1092            CollectionMode::ReFungible(_, _) => {10931094                // check size1095                ensure!(collection.custom_data_size >= properties.len() as u32, "Size of item is too large")1096            },1097            _ => {1098                fail!("Unexpected collection mode")1099            }1100        }11011102        Ok(())1103    }11041105    fn create_item_no_validation(collection_id: u64, collection: &CollectionType<T::AccountId>, properties: &Vec<u8>, owner: &T::AccountId) -> DispatchResult {1106        match collection.mode1107        {1108            CollectionMode::NFT(_) => {11091110                // Create nft item1111                let item = NftItemType {1112                    collection: collection_id,1113                    owner: owner.clone(),1114                    data: properties.clone(),1115                };11161117                Self::add_nft_item(item)?;11181119            },1120            CollectionMode::Fungible(_) => {11211122                let item = FungibleItemType {1123                    collection: collection_id,1124                    owner: owner.clone(),1125                    value: (10 as u128).pow(collection.decimal_points)1126                };11271128                Self::add_fungible_item(item)?;1129            },1130            CollectionMode::ReFungible(_, _) => {11311132                let mut owner_list = Vec::new();1133                let value = (10 as u128).pow(collection.decimal_points);1134                owner_list.push(Ownership {owner: owner.clone(), fraction: value});11351136                let item = ReFungibleItemType {1137                    collection: collection_id,1138                    owner: owner_list,1139                    data: properties.clone()1140                };11411142                Self::add_refungible_item(item)?;1143            },1144            _ => { ensure!(1 == 0,"just error"); }11451146        };11471148        // call event1149        Self::deposit_event(RawEvent::ItemCreated(collection_id, <ItemListIndex>::get(collection_id)));11501151        Ok(())1152    }11531154    fn add_fungible_item(item: FungibleItemType<T::AccountId>) -> DispatchResult {1155        let current_index = <ItemListIndex>::get(item.collection)1156            .checked_add(1)1157            .expect("Item list index id error");1158        let itemcopy = item.clone();1159        let owner = item.owner.clone();1160        let value = item.value as u64;11611162        Self::add_token_index(item.collection, current_index, owner.clone())?;11631164        <ItemListIndex>::insert(item.collection, current_index);1165        <FungibleItemList<T>>::insert(item.collection, current_index, itemcopy);11661167        // Add current block1168        let v: Vec<BasketItem<T::AccountId, T::BlockNumber>> = Vec::new();1169        <FungibleTransferBasket<T>>::insert(item.collection, current_index, v);1170        1171        // Update balance1172        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1173            .checked_add(value)1174            .unwrap();1175        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);11761177        Ok(())1178    }11791180    fn add_refungible_item(item: ReFungibleItemType<T::AccountId>) -> DispatchResult {1181        let current_index = <ItemListIndex>::get(item.collection)1182            .checked_add(1)1183            .expect("Item list index id error");1184        let itemcopy = item.clone();11851186        let value = item.owner.first().unwrap().fraction as u64;1187        let owner = item.owner.first().unwrap().owner.clone();11881189        Self::add_token_index(item.collection, current_index, owner.clone())?;11901191        <ItemListIndex>::insert(item.collection, current_index);1192        <ReFungibleItemList<T>>::insert(item.collection, current_index, itemcopy);11931194        // Add current block1195        let block_number: T::BlockNumber = 0.into();1196        <ReFungibleTransferBasket<T>>::insert(item.collection, current_index, block_number);11971198        // Update balance1199        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1200            .checked_add(value)1201            .unwrap();1202        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);12031204        Ok(())1205    }12061207    fn add_nft_item(item: NftItemType<T::AccountId>) -> DispatchResult {1208        let current_index = <ItemListIndex>::get(item.collection)1209            .checked_add(1)1210            .expect("Item list index id error");12111212        let item_owner = item.owner.clone();1213        let collection_id = item.collection.clone();1214        Self::add_token_index(collection_id, current_index, item.owner.clone())?;12151216        <ItemListIndex>::insert(collection_id, current_index);1217        <NftItemList<T>>::insert(collection_id, current_index, item);12181219        // Add current block1220        let block_number: T::BlockNumber = 0.into();1221        <NftTransferBasket<T>>::insert(collection_id, current_index, block_number);12221223        // Update balance1224        let new_balance = <Balance<T>>::get(collection_id, item_owner.clone())1225            .checked_add(1)1226            .unwrap();1227        <Balance<T>>::insert(collection_id, item_owner.clone(), new_balance);12281229        Ok(())1230    }12311232    fn burn_refungible_item(1233        collection_id: u64,1234        item_id: u64,1235        owner: T::AccountId,1236    ) -> DispatchResult {1237        ensure!(1238            <ReFungibleItemList<T>>::contains_key(collection_id, item_id),1239            "Item does not exists"1240        );1241        let collection = <ReFungibleItemList<T>>::get(collection_id, item_id);1242        let item = collection1243            .owner1244            .iter()1245            .filter(|&i| i.owner == owner)1246            .next()1247            .unwrap();1248        Self::remove_token_index(collection_id, item_id, owner.clone())?;12491250        // remove approve list1251        <ApprovedList<T>>::remove(collection_id, (item_id, owner.clone()));12521253        // update balance1254        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1255            .checked_sub(item.fraction as u64)1256            .unwrap();1257        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);12581259        <ReFungibleItemList<T>>::remove(collection_id, item_id);12601261        Ok(())1262    }12631264    fn burn_nft_item(collection_id: u64, item_id: u64) -> DispatchResult {1265        ensure!(1266            <NftItemList<T>>::contains_key(collection_id, item_id),1267            "Item does not exists"1268        );1269        let item = <NftItemList<T>>::get(collection_id, item_id);1270        Self::remove_token_index(collection_id, item_id, item.owner.clone())?;12711272        // remove approve list1273        <ApprovedList<T>>::remove(collection_id, (item_id, item.owner.clone()));12741275        // update balance1276        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1277            .checked_sub(1)1278            .unwrap();1279        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);1280        <NftItemList<T>>::remove(collection_id, item_id);12811282        Ok(())1283    }12841285    fn burn_fungible_item(collection_id: u64, item_id: u64) -> DispatchResult {1286        ensure!(1287            <FungibleItemList<T>>::contains_key(collection_id, item_id),1288            "Item does not exists"1289        );1290        let item = <FungibleItemList<T>>::get(collection_id, item_id);1291        Self::remove_token_index(collection_id, item_id, item.owner.clone())?;12921293        // remove approve list1294        <ApprovedList<T>>::remove(collection_id, (item_id, item.owner.clone()));12951296        // update balance1297        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1298            .checked_sub(item.value as u64)1299            .unwrap();1300        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);13011302        <FungibleItemList<T>>::remove(collection_id, item_id);13031304        Ok(())1305    }13061307    fn collection_exists(collection_id: u64) -> DispatchResult {1308        ensure!(1309            <Collection<T>>::contains_key(collection_id),1310            "This collection does not exist"1311        );1312        Ok(())1313    }13141315    fn check_owner_permissions(collection_id: u64, subject: T::AccountId) -> DispatchResult {1316        Self::collection_exists(collection_id)?;13171318        let target_collection = <Collection<T>>::get(collection_id);1319        ensure!(1320            subject == target_collection.owner,1321            "You do not own this collection"1322        );13231324        Ok(())1325    }13261327    fn is_owner_or_admin_permissions(collection_id: u64, subject: T::AccountId) -> bool {1328        let target_collection = <Collection<T>>::get(collection_id);1329        let mut result: bool = subject == target_collection.owner;1330        let exists = <AdminList<T>>::contains_key(collection_id);13311332        if !result & exists {1333            if <AdminList<T>>::get(collection_id).contains(&subject) {1334                result = true1335            }1336        }13371338        result1339    }13401341    fn check_owner_or_admin_permissions(1342        collection_id: u64,1343        subject: T::AccountId,1344    ) -> DispatchResult {1345        Self::collection_exists(collection_id)?;1346        let result = Self::is_owner_or_admin_permissions(collection_id, subject.clone());13471348        ensure!(1349            result,1350            "You do not have permissions to modify this collection"1351        );1352        Ok(())1353    }13541355    fn is_item_owner(subject: T::AccountId, collection_id: u64, item_id: u64) -> bool {1356        let target_collection = <Collection<T>>::get(collection_id);13571358        match target_collection.mode {1359            CollectionMode::NFT(_) => {1360                <NftItemList<T>>::get(collection_id, item_id).owner == subject1361            }1362            CollectionMode::Fungible(_) => {1363                <FungibleItemList<T>>::get(collection_id, item_id).owner == subject1364            }1365            CollectionMode::ReFungible(_, _) => {1366                <ReFungibleItemList<T>>::get(collection_id, item_id)1367                    .owner1368                    .iter()1369                    .any(|i| i.owner == subject)1370            }1371            CollectionMode::Invalid => false,1372        }1373    }13741375    fn check_white_list(collection_id: u64, address: &T::AccountId) -> DispatchResult {1376        let mes = "Address is not in white list";1377        ensure!(<WhiteList<T>>::contains_key(collection_id), mes);1378        let wl = <WhiteList<T>>::get(collection_id);1379        ensure!(wl.contains(address), mes);13801381        Ok(())1382    }13831384    fn transfer_fungible(1385        collection_id: u64,1386        item_id: u64,1387        value: u64,1388        owner: T::AccountId,1389        new_owner: T::AccountId,1390    ) -> DispatchResult {1391        ensure!(1392            <FungibleItemList<T>>::contains_key(collection_id, item_id),1393            "Item not exists"1394        );13951396        let full_item = <FungibleItemList<T>>::get(collection_id, item_id);1397        let amount = full_item.value;13981399        ensure!(amount >= value.into(), "Item balance not enouth");14001401        // update balance1402        let balance_old_owner = <Balance<T>>::get(collection_id, owner.clone())1403            .checked_sub(value)1404            .unwrap();1405        <Balance<T>>::insert(collection_id, owner.clone(), balance_old_owner);14061407        let mut new_owner_account_id = 0;1408        let new_owner_items = <AddressTokens<T>>::get(collection_id, new_owner.clone());1409        if new_owner_items.len() > 0 {1410            new_owner_account_id = new_owner_items[0];1411        }14121413        let val64 = value.into();14141415        // transfer1416        if amount == val64 && new_owner_account_id == 0 {1417            // change owner1418            // new owner do not have account1419            let mut new_full_item = full_item.clone();1420            new_full_item.owner = new_owner.clone();1421            <FungibleItemList<T>>::insert(collection_id, item_id, new_full_item);14221423            // update balance1424            let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1425                .checked_add(value)1426                .unwrap();1427            <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);14281429            // update index collection1430            Self::move_token_index(collection_id, item_id, owner.clone(), new_owner.clone())?;1431        } else {1432            let mut new_full_item = full_item.clone();1433            new_full_item.value -= val64;14341435            // separate amount1436            if new_owner_account_id > 0 {1437                // new owner has account1438                let mut item = <FungibleItemList<T>>::get(collection_id, new_owner_account_id);1439                item.value += val64;14401441                // update balance1442                let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1443                    .checked_add(value)1444                    .unwrap();1445                <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);14461447                <FungibleItemList<T>>::insert(collection_id, new_owner_account_id, item);1448            } else {1449                // new owner do not have account1450                let item = FungibleItemType {1451                    collection: collection_id,1452                    owner: new_owner.clone(),1453                    value: val64,1454                };14551456                Self::add_fungible_item(item)?;1457            }14581459            if amount == val64 {1460                Self::remove_token_index(collection_id, item_id, full_item.owner.clone())?;14611462                // remove approve list1463                <ApprovedList<T>>::remove(collection_id, (item_id, full_item.owner.clone()));1464                <FungibleItemList<T>>::remove(collection_id, item_id);1465            }14661467            <FungibleItemList<T>>::insert(collection_id, item_id, new_full_item);1468        }14691470        Ok(())1471    }14721473    fn transfer_refungible(1474        collection_id: u64,1475        item_id: u64,1476        value: u64,1477        owner: T::AccountId,1478        new_owner: T::AccountId,1479    ) -> DispatchResult {1480        ensure!(1481            <ReFungibleItemList<T>>::contains_key(collection_id, item_id),1482            "Item not exists"1483        );14841485        let full_item = <ReFungibleItemList<T>>::get(collection_id, item_id);1486        let item = full_item1487            .owner1488            .iter()1489            .filter(|i| i.owner == owner)1490            .next()1491            .unwrap();1492        let amount = item.fraction;14931494        ensure!(amount >= value.into(), "Item balance not enouth");14951496        // update balance1497        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.clone())1498            .checked_sub(value)1499            .unwrap();1500        <Balance<T>>::insert(collection_id, item.owner.clone(), balance_old_owner);15011502        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1503            .checked_add(value)1504            .unwrap();1505        <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);15061507        let old_owner = item.owner.clone();1508        let new_owner_has_account = full_item.owner.iter().any(|i| i.owner == new_owner);1509        let val64 = value.into();15101511        // transfer1512        if amount == val64 && !new_owner_has_account {1513            // change owner1514            // new owner do not have account1515            let mut new_full_item = full_item.clone();1516            new_full_item1517                .owner1518                .iter_mut()1519                .find(|i| i.owner == owner)1520                .unwrap()1521                .owner = new_owner.clone();1522            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);15231524            // update index collection1525            Self::move_token_index(collection_id, item_id, old_owner.clone(), new_owner.clone())?;1526        } else {1527            let mut new_full_item = full_item.clone();1528            new_full_item1529                .owner1530                .iter_mut()1531                .find(|i| i.owner == owner)1532                .unwrap()1533                .fraction -= val64;15341535            // separate amount1536            if new_owner_has_account {1537                // new owner has account1538                new_full_item1539                    .owner1540                    .iter_mut()1541                    .find(|i| i.owner == new_owner)1542                    .unwrap()1543                    .fraction += val64;1544            } else {1545                // new owner do not have account1546                new_full_item.owner.push(Ownership {1547                    owner: new_owner.clone(),1548                    fraction: val64,1549                });1550                Self::add_token_index(collection_id, item_id, new_owner.clone())?;1551            }15521553            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);1554        }15551556        Ok(())1557    }15581559    fn transfer_nft(1560        collection_id: u64,1561        item_id: u64,1562        sender: T::AccountId,1563        new_owner: T::AccountId,1564    ) -> DispatchResult {1565        ensure!(1566            <NftItemList<T>>::contains_key(collection_id, item_id),1567            "Item not exists"1568        );15691570        let mut item = <NftItemList<T>>::get(collection_id, item_id);15711572        ensure!(1573            sender == item.owner,1574            "sender parameter and item owner must be equal"1575        );15761577        // update balance1578        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.clone())1579            .checked_sub(1)1580            .unwrap();1581        <Balance<T>>::insert(collection_id, item.owner.clone(), balance_old_owner);15821583        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1584            .checked_add(1)1585            .unwrap();1586        <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);15871588        // change owner1589        let old_owner = item.owner.clone();1590        item.owner = new_owner.clone();1591        <NftItemList<T>>::insert(collection_id, item_id, item);15921593        // update index collection1594        Self::move_token_index(collection_id, item_id, old_owner.clone(), new_owner.clone())?;15951596        // reset approved list1597        <ApprovedList<T>>::remove(collection_id, (item_id, old_owner));1598        Ok(())1599    }16001601    fn init_collection(item: &CollectionType<T::AccountId>) {1602        // check params1603        assert!(1604            item.decimal_points <= 4,1605            "decimal_points parameter must be lower than 4"1606        );1607        assert!(1608            item.name.len() <= 64,1609            "Collection name can not be longer than 63 char"1610        );1611        assert!(1612            item.name.len() <= 256,1613            "Collection description can not be longer than 255 char"1614        );1615        assert!(1616            item.token_prefix.len() <= 16,1617            "Token prefix can not be longer than 15 char"1618        );16191620        // Generate next collection ID1621        let next_id = CreatedCollectionCount::get()1622            .checked_add(1)1623            .expect("collection id error");16241625        CreatedCollectionCount::put(next_id);1626    }16271628    fn init_nft_token(item: &NftItemType<T::AccountId>) {1629        let current_index = <ItemListIndex>::get(item.collection)1630            .checked_add(1)1631            .expect("Item list index id error");16321633        let item_owner = item.owner.clone();1634        let collection_id = item.collection.clone();1635        Self::add_token_index(collection_id, current_index, item.owner.clone()).unwrap();16361637        <ItemListIndex>::insert(collection_id, current_index);16381639        // Update balance1640        let new_balance = <Balance<T>>::get(collection_id, item_owner.clone())1641            .checked_add(1)1642            .unwrap();1643        <Balance<T>>::insert(collection_id, item_owner.clone(), new_balance);1644    }16451646    fn init_fungible_token(item: &FungibleItemType<T::AccountId>) {1647        let current_index = <ItemListIndex>::get(item.collection)1648            .checked_add(1)1649            .expect("Item list index id error");1650        let owner = item.owner.clone();1651        let value = item.value as u64;16521653        Self::add_token_index(item.collection, current_index, owner.clone()).unwrap();16541655        <ItemListIndex>::insert(item.collection, current_index);16561657        // Update balance1658        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1659            .checked_add(value)1660            .unwrap();1661        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);1662    }16631664    fn init_refungible_token(item: &ReFungibleItemType<T::AccountId>) {1665        let current_index = <ItemListIndex>::get(item.collection)1666            .checked_add(1)1667            .expect("Item list index id error");16681669        let value = item.owner.first().unwrap().fraction as u64;1670        let owner = item.owner.first().unwrap().owner.clone();16711672        Self::add_token_index(item.collection, current_index, owner.clone()).unwrap();16731674        <ItemListIndex>::insert(item.collection, current_index);16751676        // Update balance1677        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1678            .checked_add(value)1679            .unwrap();1680        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);1681    }16821683    fn add_token_index(collection_id: u64, item_index: u64, owner: T::AccountId) -> DispatchResult {16841685        // add to account limit1686        if <AccountItemCount<T>>::contains_key(owner.clone()) {16871688            // bound Owned tokens by a single address1689            let count = <AccountItemCount<T>>::get(owner.clone());1690            ensure!(count < ChainLimit::get().account_token_ownership_limit, "Owned tokens by a single address bound exceeded");16911692            <AccountItemCount<T>>::insert(owner.clone(), 1693                count.checked_add(1).unwrap());1694        }1695        else {1696            <AccountItemCount<T>>::insert(owner.clone(), 1);1697        }16981699        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.clone());1700        if list_exists {1701            let mut list = <AddressTokens<T>>::get(collection_id, owner.clone());1702            let item_contains = list.contains(&item_index.clone());17031704            if !item_contains {1705                list.push(item_index.clone());1706            }17071708            <AddressTokens<T>>::insert(collection_id, owner.clone(), list);1709        } else {1710            let mut itm = Vec::new();1711            itm.push(item_index.clone());1712            <AddressTokens<T>>::insert(collection_id, owner, itm);1713            1714        }17151716        Ok(())1717    }17181719    fn remove_token_index(1720        collection_id: u64,1721        item_index: u64,1722        owner: T::AccountId,1723    ) -> DispatchResult {17241725        // update counter1726        <AccountItemCount<T>>::insert(owner.clone(), 1727            <AccountItemCount<T>>::get(owner.clone()).checked_sub(1).unwrap());172817291730        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.clone());1731        if list_exists {1732            let mut list = <AddressTokens<T>>::get(collection_id, owner.clone());1733            let item_contains = list.contains(&item_index.clone());17341735            if item_contains {1736                list.retain(|&item| item != item_index);1737                <AddressTokens<T>>::insert(collection_id, owner, list);1738            }1739        }17401741        Ok(())1742    }17431744    fn move_token_index(1745        collection_id: u64,1746        item_index: u64,1747        old_owner: T::AccountId,1748        new_owner: T::AccountId,1749    ) -> DispatchResult {1750        Self::remove_token_index(collection_id, item_index, old_owner)?;1751        Self::add_token_index(collection_id, item_index, new_owner)?;17521753        Ok(())1754    }1755}17561757////////////////////////////////////////////////////////////////////////////////////////////////////1758// Economic models1759// #region17601761/// Fee multiplier.1762pub type Multiplier = FixedU128;17631764type BalanceOf<T> = <<T as transaction_payment::Trait>::Currency as Currency<1765    <T as system::Trait>::AccountId,1766>>::Balance;1767type NegativeImbalanceOf<T> = <<T as transaction_payment::Trait>::Currency as Currency<1768    <T as system::Trait>::AccountId,1769>>::NegativeImbalance;17701771/// Require the transactor pay for themselves and maybe include a tip to gain additional priority1772/// in the queue.1773#[derive(Encode, Decode, Clone, Eq, PartialEq)]1774pub struct ChargeTransactionPayment<T: transaction_payment::Trait + Send + Sync>(1775    #[codec(compact)] BalanceOf<T>,1776);17771778impl<T: Trait + transaction_payment::Trait + Send + Sync> sp_std::fmt::Debug1779    for ChargeTransactionPayment<T>1780{1781    #[cfg(feature = "std")]1782    fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {1783        write!(f, "ChargeTransactionPayment<{:?}>", self.0)1784    }1785    #[cfg(not(feature = "std"))]1786    fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {1787        Ok(())1788    }1789}17901791impl<T: Trait + transaction_payment::Trait + Send + Sync> ChargeTransactionPayment<T>1792where1793    T::Call:1794        Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo> + IsSubType<Module<T>, T>,1795    BalanceOf<T>: Send + Sync + FixedPointOperand,1796{1797    /// utility constructor. Used only in client/factory code.1798    pub fn from(fee: BalanceOf<T>) -> Self {1799        Self(fee)1800    }18011802    pub fn traditional_fee(1803        len: usize,1804        info: &DispatchInfoOf<T::Call>,1805        tip: BalanceOf<T>,1806    ) -> BalanceOf<T>1807    where1808        T::Call: Dispatchable<Info = DispatchInfo>,1809    {1810        <transaction_payment::Module<T>>::compute_fee(len as u32, info, tip)1811    }18121813    fn withdraw_fee(1814        &self,1815        who: &T::AccountId,1816        call: &T::Call,1817        info: &DispatchInfoOf<T::Call>,1818        len: usize,1819    ) -> Result<(BalanceOf<T>, Option<NegativeImbalanceOf<T>>), TransactionValidityError> {1820        let tip = self.0;18211822        // Set fee based on call type. Creating collection costs 1 Unique.1823        // All other transactions have traditional fees so far1824        let fee = match call.is_sub_type() {1825            Some(Call::create_collection(..)) => <BalanceOf<T>>::from(1_000_000_000),1826            _ => Self::traditional_fee(len, info, tip), // Flat fee model, use only for testing purposes1827                                                        // _ => <BalanceOf<T>>::from(100)1828        };18291830        // Determine who is paying transaction fee based on ecnomic model1831        // Parse call to extract collection ID and access collection sponsor1832        let sponsor: T::AccountId = match call.is_sub_type() {1833            Some(Call::create_item(collection_id, _properties, _owner)) => {1834                <Collection<T>>::get(collection_id).sponsor1835            }1836            Some(Call::transfer(_new_owner, collection_id, _item_id, _value)) => {1837                let _collection_mode = <Collection<T>>::get(collection_id).mode;18381839                // sponsor timeout1840                let sponsor_transfer = match _collection_mode {1841                    CollectionMode::NFT(_) => {1842                        let basket = <NftTransferBasket<T>>::get(collection_id, _item_id);1843                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1844                        let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into();1845                        if block_number >= limit_time {1846                            <NftTransferBasket<T>>::insert(collection_id, _item_id, block_number);1847                            true1848                        }1849                        else {1850                            false1851                        }1852                    }1853                    CollectionMode::Fungible(_) => {1854                        let mut basket = <FungibleTransferBasket<T>>::get(collection_id, _item_id);1855                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1856                        if basket.iter().any(|i| i.address == _new_owner.clone())1857                        {1858                            let item = basket.iter_mut().find(|i| i.address == _new_owner.clone()).unwrap().clone();1859                            let limit_time = item.start_block + ChainLimit::get().fungible_sponsor_transfer_timeout.into();1860                            if block_number >= limit_time {1861                                basket.retain(|x| x.address == item.address);1862                                basket.push(BasketItem { start_block: block_number, address: _new_owner.clone() });1863                                <FungibleTransferBasket<T>>::insert(collection_id, _item_id, basket);1864                                true1865                            }1866                            else {1867                                false1868                            }1869                        }1870                        else {1871                            basket.push(BasketItem { start_block: block_number, address: _new_owner.clone()});1872                            true1873                        }1874                    }1875                    CollectionMode::ReFungible(_, _) => {1876                        let basket = <ReFungibleTransferBasket<T>>::get(collection_id, _item_id);1877                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1878                        let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into();1879                        if block_number >= limit_time {1880                            <ReFungibleTransferBasket<T>>::insert(collection_id, _item_id, block_number);1881                            true1882                        } else {1883                            false1884                        }1885                    }1886                    _ => {1887                        false1888                    },1889                };18901891                if !sponsor_transfer {1892                    T::AccountId::default()1893                } else {1894                    <Collection<T>>::get(collection_id).sponsor1895                }1896            }18971898            _ => T::AccountId::default(),1899        };19001901        let mut who_pays_fee: T::AccountId = sponsor.clone();1902        if sponsor == T::AccountId::default() {1903            who_pays_fee = who.clone();1904        }19051906        // Only mess with balances if fee is not zero.1907        if fee.is_zero() {1908            return Ok((fee, None));1909        }19101911        match <T as transaction_payment::Trait>::Currency::withdraw(1912            &who_pays_fee,1913            fee,1914            if tip.is_zero() {1915                WithdrawReason::TransactionPayment.into()1916            } else {1917                WithdrawReason::TransactionPayment | WithdrawReason::Tip1918            },1919            ExistenceRequirement::KeepAlive,1920        ) {1921            Ok(imbalance) => Ok((fee, Some(imbalance))),1922            Err(_) => Err(InvalidTransaction::Payment.into()),1923        }1924    }1925}19261927impl<T: Trait + transaction_payment::Trait + Send + Sync> SignedExtension1928    for ChargeTransactionPayment<T>1929where1930    BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,1931    T::Call:1932        Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo> + IsSubType<Module<T>, T>,1933{1934    const IDENTIFIER: &'static str = "ChargeTransactionPayment";1935    type AccountId = T::AccountId;1936    type Call = T::Call;1937    type AdditionalSigned = ();1938    type Pre = (1939        BalanceOf<T>,1940        Self::AccountId,1941        Option<NegativeImbalanceOf<T>>,1942        BalanceOf<T>,1943    );1944    fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {1945        Ok(())1946    }19471948    fn validate(1949        &self,1950        who: &Self::AccountId,1951        call: &Self::Call,1952        info: &DispatchInfoOf<Self::Call>,1953        len: usize,1954    ) -> TransactionValidity {1955        let (fee, _) = self.withdraw_fee(who, call, info, len)?;19561957        let mut r = ValidTransaction::default();1958        // NOTE: we probably want to maximize the _fee (of any type) per weight unit_ here, which1959        // will be a bit more than setting the priority to tip. For now, this is enough.1960        r.priority = fee.saturated_into::<TransactionPriority>();1961        Ok(r)1962    }19631964    fn pre_dispatch(1965        self,1966        who: &Self::AccountId,1967        call: &Self::Call,1968        info: &DispatchInfoOf<Self::Call>,1969        len: usize,1970    ) -> Result<Self::Pre, TransactionValidityError> {1971        let (fee, imbalance) = self.withdraw_fee(who, call, info, len)?;1972        Ok((self.0, who.clone(), imbalance, fee))1973    }19741975    fn post_dispatch(1976        pre: Self::Pre,1977        info: &DispatchInfoOf<Self::Call>,1978        post_info: &PostDispatchInfoOf<Self::Call>,1979        len: usize,1980        _result: &DispatchResult,1981    ) -> Result<(), TransactionValidityError> {1982        let (tip, who, imbalance, fee) = pre;1983        if let Some(payed) = imbalance {1984            let actual_fee = <transaction_payment::Module<T>>::compute_actual_fee(1985                len as u32, info, post_info, tip,1986            );1987            let refund = fee.saturating_sub(actual_fee);1988            let actual_payment =1989                match <T as transaction_payment::Trait>::Currency::deposit_into_existing(1990                    &who, refund,1991                ) {1992                    Ok(refund_imbalance) => {1993                        // The refund cannot be larger than the up front payed max weight.1994                        // `PostDispatchInfo::calc_unspent` guards against such a case.1995                        match payed.offset(refund_imbalance) {1996                            Ok(actual_payment) => actual_payment,1997                            Err(_) => return Err(InvalidTransaction::Payment.into()),1998                        }1999                    }2000                    // We do not recreate the account using the refund. The up front payment2001                    // is gone in that case.2002                    Err(_) => payed,2003                };2004            let imbalances = actual_payment.split(tip);2005            <T as transaction_payment::Trait>::OnTransactionPayment::on_unbalanceds(2006                Some(imbalances.0).into_iter().chain(Some(imbalances.1)),2007            );2008        }2009        Ok(())2010    }2011}2012// #endregion
after · pallets/nft/src/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]23#[cfg(feature = "std")]4pub use std::*;56#[cfg(feature = "std")]7pub use serde::*;89use codec::{Decode, Encode};10pub use frame_support::{11    construct_runtime, decl_event, decl_module, decl_storage,12    dispatch::DispatchResult,13    ensure, fail, parameter_types,14    traits::{15        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,16        Randomness, WithdrawReason,17    },18    weights::{19        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},20        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,21        WeightToFeePolynomial,22    },23    IsSubType, StorageValue,24};25// use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};2627use frame_system::{self as system, ensure_signed, ensure_root};28use sp_runtime::sp_std::prelude::Vec;29use sp_runtime::{30    traits::{31        DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SaturatedConversion, Saturating,32        SignedExtension, Zero,33    },34    transaction_validity::{35        InvalidTransaction, TransactionPriority, TransactionValidity, TransactionValidityError,36        ValidTransaction,37    },38    FixedPointOperand, FixedU128,39};4041#[cfg(test)]42mod mock;4344#[cfg(test)]45mod tests;4647mod default_weights;4849// Structs50// #region5152#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]53#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]54pub enum CollectionMode {55    Invalid,56    // custom data size57    NFT(u32),58    // decimal points59    Fungible(u32),60    // custom data size and decimal points61    ReFungible(u32, u32),62}6364impl Into<u8> for CollectionMode {65    fn into(self) -> u8 {66        match self {67            CollectionMode::Invalid => 0,68            CollectionMode::NFT(_) => 1,69            CollectionMode::Fungible(_) => 2,70            CollectionMode::ReFungible(_, _) => 3,71        }72    }73}7475#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]76#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]77pub enum AccessMode {78    Normal,79    WhiteList,80}81impl Default for AccessMode {82    fn default() -> Self {83        Self::Normal84    }85}8687impl Default for CollectionMode {88    fn default() -> Self {89        Self::Invalid90    }91}9293#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]94#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]95pub struct Ownership<AccountId> {96    pub owner: AccountId,97    pub fraction: u128,98}99100#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]101#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]102pub struct CollectionType<AccountId> {103    pub owner: AccountId,104    pub mode: CollectionMode,105    pub access: AccessMode,106    pub decimal_points: u32,107    pub name: Vec<u16>,        // 64 include null escape char108    pub description: Vec<u16>, // 256 include null escape char109    pub token_prefix: Vec<u8>, // 16 include null escape char110    pub custom_data_size: u32,111    pub mint_mode: bool,112    pub offchain_schema: Vec<u8>,113    pub sponsor: AccountId, // Who pays fees. If set to default address, the fees are applied to the transaction sender114    pub unconfirmed_sponsor: AccountId, // Sponsor address that has not yet confirmed sponsorship115}116117#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]118#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]119pub struct CollectionAdminsType<AccountId> {120    pub admin: AccountId,121    pub collection_id: u64,122}123124#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]125#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]126pub struct NftItemType<AccountId> {127    pub collection: u64,128    pub owner: AccountId,129    pub data: Vec<u8>,130}131132#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]133#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]134pub struct FungibleItemType<AccountId> {135    pub collection: u64,136    pub owner: AccountId,137    pub value: u128,138}139140#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]141#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]142pub struct ReFungibleItemType<AccountId> {143    pub collection: u64,144    pub owner: Vec<Ownership<AccountId>>,145    pub data: Vec<u8>,146}147148#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]149#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]150pub struct ApprovePermissions<AccountId> {151    pub approved: AccountId,152    pub amount: u64,153}154155#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]156#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]157pub struct VestingItem<AccountId, Moment> {158    pub sender: AccountId,159    pub recipient: AccountId,160    pub collection_id: u64,161    pub item_id: u64,162    pub amount: u64,163    pub vesting_date: Moment,164}165166#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]167#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]168pub struct BasketItem<AccountId, BlockNumber> {169    pub address: AccountId,170    pub start_block: BlockNumber,171}172173#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]174#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]175pub struct ChainLimits {176    pub collection_numbers_limit: u64,177    pub account_token_ownership_limit: u64,178    pub collections_admins_limit: u64,179    pub custom_data_limit: u32,180181    // Timeouts for item types in passed blocks182    pub nft_sponsor_transfer_timeout: u32,183    pub fungible_sponsor_transfer_timeout: u32,184    pub refungible_sponsor_transfer_timeout: u32,185}186187pub trait WeightInfo {188	fn create_collection() -> Weight;189	fn destroy_collection() -> Weight;190	fn add_to_white_list() -> Weight;191	fn remove_from_white_list() -> Weight;192    fn set_public_access_mode() -> Weight;193    fn set_mint_permission() -> Weight;194    fn change_collection_owner() -> Weight;195    fn add_collection_admin() -> Weight;196    fn remove_collection_admin() -> Weight;197    fn set_collection_sponsor() -> Weight;198    fn confirm_sponsorship() -> Weight;199    fn remove_collection_sponsor() -> Weight;200    fn create_item(s: usize, ) -> Weight;201    fn burn_item() -> Weight;202    fn transfer() -> Weight;203    fn approve() -> Weight;204    fn transfer_from() -> Weight;205    fn set_offchain_schema() -> Weight;206}207208pub trait Trait: system::Trait + Sized  {209    type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;210211    /// Weight information for extrinsics in this pallet.212	type WeightInfo: WeightInfo;213}214215#[cfg(feature = "runtime-benchmarks")]216mod benchmarking;217218// #endregion219220decl_storage! {221    trait Store for Module<T: Trait> as Nft {222223        // Private members224        NextCollectionID: u64;225        CreatedCollectionCount: u64;226        ChainVersion: u64;227        ItemListIndex: map hasher(blake2_128_concat) u64 => u64;228229        // Chain limits struct230        pub ChainLimit get(fn chain_limit) config(): ChainLimits;231232        // Bound counters233        CollectionCount: u64;234        pub AccountItemCount get(fn account_item_count): map hasher(identity) T::AccountId => u64;235236        // Basic collections237        pub Collection get(fn collection) config(): map hasher(identity) u64 => CollectionType<T::AccountId>;238        pub AdminList get(fn admin_list_collection): map hasher(identity) u64 => Vec<T::AccountId>;239        pub WhiteList get(fn white_list): map hasher(identity) u64 => Vec<T::AccountId>;240241        /// Balance owner per collection map242        pub Balance get(fn balance_count): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) T::AccountId => u64;243244        /// second parameter: item id + owner account id245        pub ApprovedList get(fn approved): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) (u64, T::AccountId) => Vec<ApprovePermissions<T::AccountId>>;246247        /// Item collections248        pub NftItemList get(fn nft_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => NftItemType<T::AccountId>;249        pub FungibleItemList get(fn fungible_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => FungibleItemType<T::AccountId>;250        pub ReFungibleItemList get(fn refungible_item_id) config(): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => ReFungibleItemType<T::AccountId>;251252        /// Index list253        pub AddressTokens get(fn address_tokens): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) T::AccountId => Vec<u64>;254255        /// Tokens transfer baskets256        pub NftTransferBasket get(fn nft_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => T::BlockNumber;257        pub FungibleTransferBasket get(fn fungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => Vec<BasketItem<T::AccountId, T::BlockNumber>>;258        pub ReFungibleTransferBasket get(fn refungible_transfer_basket): double_map hasher(blake2_128_concat) u64, hasher(blake2_128_concat) u64 => T::BlockNumber;259260        // Sponsorship261        pub ContractSponsor get(fn contract_sponsor): map hasher(identity) T::AccountId => T::AccountId;262        pub UnconfirmedContractSponsor get(fn unconfirmed_contract_sponsor): map hasher(identity) T::AccountId => T::AccountId;263    }264    add_extra_genesis {265        build(|config: &GenesisConfig<T>| {266            // Modification of storage267            for (_num, _c) in &config.collection {268                <Module<T>>::init_collection(_c);269            }270271            for (_num, _q, _i) in &config.nft_item_id {272                <Module<T>>::init_nft_token(_i);273            }274275            for (_num, _q, _i) in &config.fungible_item_id {276                <Module<T>>::init_fungible_token(_i);277            }278279            for (_num, _q, _i) in &config.refungible_item_id {280                <Module<T>>::init_refungible_token(_i);281            }282        })283    }284}285286decl_event!(287    pub enum Event<T>288    where289        AccountId = <T as system::Trait>::AccountId,290    {291        /// New collection was created292        /// 293        /// # Arguments294        /// 295        /// * collection_id: Globally unique identifier of newly created collection.296        /// 297        /// * mode: [CollectionMode] converted into u8.298        /// 299        /// * account_id: Collection owner.300        Created(u64, u8, AccountId),301302        /// New item was created.303        /// 304        /// # Arguments305        /// 306        /// * collection_id: Id of the collection where item was created.307        /// 308        /// * item_id: Id of an item. Unique within the collection.309        ItemCreated(u64, u64),310311        /// Collection item was burned.312        /// 313        /// # Arguments314        /// 315        /// collection_id.316        /// 317        /// item_id: Identifier of burned NFT.318        ItemDestroyed(u64, u64),319    }320);321322decl_module! {323    pub struct Module<T: Trait> for enum Call where origin: T::Origin {324325        fn deposit_event() = default;326327        fn on_initialize(now: T::BlockNumber) -> Weight {328329            if ChainVersion::get() < 2330            {331                let value = NextCollectionID::get();332                CreatedCollectionCount::put(value);333                ChainVersion::put(2);334            }335336            0337        }338339        /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.340        /// 341        /// # Permissions342        /// 343        /// * Anyone.344        /// 345        /// # Arguments346        /// 347        /// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.348        /// 349        /// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.350        /// 351        /// * token_prefix: UTF-8 string with token prefix.352        /// 353        /// * mode: [CollectionMode] collection type and type dependent data.354        // returns collection ID355        #[weight = T::WeightInfo::create_collection()]356        pub fn create_collection(origin,357                                 collection_name: Vec<u16>,358                                 collection_description: Vec<u16>,359                                 token_prefix: Vec<u8>,360                                 mode: CollectionMode) -> DispatchResult {361362            // Anyone can create a collection363            let who = ensure_signed(origin)?;364            let custom_data_size = match mode {365                CollectionMode::NFT(size) => {366367                    // bound Custom data size368                    ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded");369                    size370                },371                CollectionMode::ReFungible(size, _) => {372373                    // bound Custom data size374                    ensure!(size < ChainLimit::get().custom_data_limit, "Custom data size bound exceeded");375                    size376                },377                _ => 0378            };379380            let decimal_points = match mode {381                CollectionMode::Fungible(points) => points,382                CollectionMode::ReFungible(_, points) => points,383                _ => 0384            };385386            // bound Total number of collections387            ensure!(CollectionCount::get() < ChainLimit::get().collection_numbers_limit, "Total collections bound exceeded");388389            // check params390            ensure!(decimal_points <= 4, "decimal_points parameter must be lower than 4");391392            let mut name = collection_name.to_vec();393            name.push(0);394            ensure!(name.len() <= 64, "Collection name can not be longer than 63 char");395396            let mut description = collection_description.to_vec();397            description.push(0);398            ensure!(name.len() <= 256, "Collection description can not be longer than 255 char");399400            let mut prefix = token_prefix.to_vec();401            prefix.push(0);402            ensure!(prefix.len() <= 16, "Token prefix can not be longer than 15 char");403404            // Generate next collection ID405            let next_id = CreatedCollectionCount::get()406                .checked_add(1)407                .expect("collection id error");408409            // bound counter410            let total = CollectionCount::get()411                .checked_add(1)412                .expect("collection counter error");413414            CreatedCollectionCount::put(next_id);415            CollectionCount::put(total);416417            // Create new collection418            let new_collection = CollectionType {419                owner: who.clone(),420                name: name,421                mode: mode.clone(),422                mint_mode: false,423                access: AccessMode::Normal,424                description: description,425                decimal_points: decimal_points,426                token_prefix: prefix,427                offchain_schema: Vec::new(),428                custom_data_size: custom_data_size,429                sponsor: T::AccountId::default(),430                unconfirmed_sponsor: T::AccountId::default(),431            };432433            // Add new collection to map434            <Collection<T>>::insert(next_id, new_collection);435436            // call event437            Self::deposit_event(RawEvent::Created(next_id, mode.into(), who.clone()));438439            Ok(())440        }441442        /// **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.443        /// 444        /// # Permissions445        /// 446        /// * Collection Owner.447        /// 448        /// # Arguments449        /// 450        /// * collection_id: collection to destroy.451        #[weight = T::WeightInfo::destroy_collection()]452        pub fn destroy_collection(origin, collection_id: u64) -> DispatchResult {453454            let sender = ensure_signed(origin)?;455            Self::check_owner_permissions(collection_id, sender)?;456457            <AddressTokens<T>>::remove_prefix(collection_id);458            <ApprovedList<T>>::remove_prefix(collection_id);459            <Balance<T>>::remove_prefix(collection_id);460            <ItemListIndex>::remove(collection_id);461            <AdminList<T>>::remove(collection_id);462            <Collection<T>>::remove(collection_id);463            <WhiteList<T>>::remove(collection_id);464465            <NftItemList<T>>::remove_prefix(collection_id);466            <FungibleItemList<T>>::remove_prefix(collection_id);467            <ReFungibleItemList<T>>::remove_prefix(collection_id);468469            <NftTransferBasket<T>>::remove_prefix(collection_id);470            <FungibleTransferBasket<T>>::remove_prefix(collection_id);471            <ReFungibleTransferBasket<T>>::remove_prefix(collection_id);472473            if CollectionCount::get() > 0474            {475                // bound couter476                let total = CollectionCount::get()477                    .checked_sub(1)478                    .expect("collection counter error");479480                CollectionCount::put(total);481            }482483            Ok(())484        }485486        /// Add an address to white list.487        /// 488        /// # Permissions489        /// 490        /// * Collection Owner491        /// * Collection Admin492        /// 493        /// # Arguments494        /// 495        /// * collection_id.496        /// 497        /// * address.498        #[weight = T::WeightInfo::add_to_white_list()]499        pub fn add_to_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{500501            let sender = ensure_signed(origin)?;502            Self::check_owner_or_admin_permissions(collection_id, sender)?;503504            let mut white_list_collection: Vec<T::AccountId>;505            if <WhiteList<T>>::contains_key(collection_id) {506                white_list_collection = <WhiteList<T>>::get(collection_id);507                if !white_list_collection.contains(&address.clone())508                {509                    white_list_collection.push(address.clone());510                }511            }512            else {513                white_list_collection = Vec::new();514                white_list_collection.push(address.clone());515            }516517            <WhiteList<T>>::insert(collection_id, white_list_collection);518            Ok(())519        }520521        /// Remove an address from white list.522        /// 523        /// # Permissions524        /// 525        /// * Collection Owner526        /// * Collection Admin527        /// 528        /// # Arguments529        /// 530        /// * collection_id.531        /// 532        /// * address.533        #[weight = T::WeightInfo::remove_from_white_list()]534        pub fn remove_from_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{535536            let sender = ensure_signed(origin)?;537            Self::check_owner_or_admin_permissions(collection_id, sender)?;538539            if <WhiteList<T>>::contains_key(collection_id) {540                let mut white_list_collection = <WhiteList<T>>::get(collection_id);541                if white_list_collection.contains(&address.clone())542                {543                    white_list_collection.retain(|i| *i != address.clone());544                    <WhiteList<T>>::insert(collection_id, white_list_collection);545                }546            }547548            Ok(())549        }550551        /// Toggle between normal and white list access for the methods with access for `Anyone`.552        /// 553        /// # Permissions554        /// 555        /// * Collection Owner.556        /// 557        /// # Arguments558        /// 559        /// * collection_id.560        /// 561        /// * mode: [AccessMode]562        #[weight = T::WeightInfo::set_public_access_mode()]563        pub fn set_public_access_mode(origin, collection_id: u64, mode: AccessMode) -> DispatchResult564        {565            let sender = ensure_signed(origin)?;566567            Self::check_owner_permissions(collection_id, sender)?;568            let mut target_collection = <Collection<T>>::get(collection_id);569            target_collection.access = mode;570            <Collection<T>>::insert(collection_id, target_collection);571572            Ok(())573        }574575        /// Allows Anyone to create tokens if:576        /// * White List is enabled, and577        /// * Address is added to white list, and578        /// * This method was called with True parameter579        /// 580        /// # Permissions581        /// * Collection Owner582        ///583        /// # Arguments584        /// 585        /// * collection_id.586        /// 587        /// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.588        #[weight = T::WeightInfo::set_mint_permission()]589        pub fn set_mint_permission(origin, collection_id: u64, mint_permission: bool) -> DispatchResult590        {591            let sender = ensure_signed(origin)?;592593            Self::check_owner_permissions(collection_id, sender)?;594            let mut target_collection = <Collection<T>>::get(collection_id);595            target_collection.mint_mode = mint_permission;596            <Collection<T>>::insert(collection_id, target_collection);597598            Ok(())599        }600601        /// Change the owner of the collection.602        /// 603        /// # Permissions604        /// 605        /// * Collection Owner.606        /// 607        /// # Arguments608        /// 609        /// * collection_id.610        /// 611        /// * new_owner.612        #[weight = T::WeightInfo::change_collection_owner()]613        pub fn change_collection_owner(origin, collection_id: u64, new_owner: T::AccountId) -> DispatchResult {614615            let sender = ensure_signed(origin)?;616            Self::check_owner_permissions(collection_id, sender)?;617            let mut target_collection = <Collection<T>>::get(collection_id);618            target_collection.owner = new_owner;619            <Collection<T>>::insert(collection_id, target_collection);620621            Ok(())622        }623624        /// Adds an admin of the Collection.625        /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership. 626        /// 627        /// # Permissions628        /// 629        /// * Collection Owner.630        /// * Collection Admin.631        /// 632        /// # Arguments633        /// 634        /// * collection_id: ID of the Collection to add admin for.635        /// 636        /// * new_admin_id: Address of new admin to add.637        #[weight = T::WeightInfo::add_collection_admin()]638        pub fn add_collection_admin(origin, collection_id: u64, new_admin_id: T::AccountId) -> DispatchResult {639640            let sender = ensure_signed(origin)?;641            Self::check_owner_or_admin_permissions(collection_id, sender)?;642            let mut admin_arr: Vec<T::AccountId> = Vec::new();643644            if <AdminList<T>>::contains_key(collection_id)645            {646                admin_arr = <AdminList<T>>::get(collection_id);647                ensure!(!admin_arr.contains(&new_admin_id), "Account already has admin role");648            }649650            // Number of collection admins651            ensure!((admin_arr.len() as u64) < ChainLimit::get().collections_admins_limit, "Number of collection admins bound exceeded");652653            admin_arr.push(new_admin_id);654            <AdminList<T>>::insert(collection_id, admin_arr);655656            Ok(())657        }658659        /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.660        ///661        /// # Permissions662        /// 663        /// * Collection Owner.664        /// * Collection Admin.665        /// 666        /// # Arguments667        /// 668        /// * collection_id: ID of the Collection to remove admin for.669        /// 670        /// * account_id: Address of admin to remove.671        #[weight = T::WeightInfo::remove_collection_admin()]672        pub fn remove_collection_admin(origin, collection_id: u64, account_id: T::AccountId) -> DispatchResult {673674            let sender = ensure_signed(origin)?;675            Self::check_owner_or_admin_permissions(collection_id, sender)?;676677            if <AdminList<T>>::contains_key(collection_id)678            {679                let mut admin_arr = <AdminList<T>>::get(collection_id);680                admin_arr.retain(|i| *i != account_id);681                <AdminList<T>>::insert(collection_id, admin_arr);682            }683684            Ok(())685        }686687        /// # Permissions688        /// 689        /// * Collection Owner690        /// 691        /// # Arguments692        /// 693        /// * collection_id.694        /// 695        /// * new_sponsor.696        #[weight = T::WeightInfo::set_collection_sponsor()]697        pub fn set_collection_sponsor(origin, collection_id: u64, new_sponsor: T::AccountId) -> DispatchResult {698699            let sender = ensure_signed(origin)?;700            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");701702            let mut target_collection = <Collection<T>>::get(collection_id);703            ensure!(sender == target_collection.owner, "You do not own this collection");704705            target_collection.unconfirmed_sponsor = new_sponsor;706            <Collection<T>>::insert(collection_id, target_collection);707708            Ok(())709        }710711        /// # Permissions712        /// 713        /// * Sponsor.714        /// 715        /// # Arguments716        /// 717        /// * collection_id.718        #[weight = T::WeightInfo::confirm_sponsorship()]719        pub fn confirm_sponsorship(origin, collection_id: u64) -> DispatchResult {720721            let sender = ensure_signed(origin)?;722            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");723724            let mut target_collection = <Collection<T>>::get(collection_id);725            ensure!(sender == target_collection.unconfirmed_sponsor, "This address is not set as sponsor, use setCollectionSponsor first");726727            target_collection.sponsor = target_collection.unconfirmed_sponsor;728            target_collection.unconfirmed_sponsor = T::AccountId::default();729            <Collection<T>>::insert(collection_id, target_collection);730731            Ok(())732        }733734        /// Switch back to pay-per-own-transaction model.735        ///736        /// # Permissions737        ///738        /// * Collection owner.739        /// 740        /// # Arguments741        /// 742        /// * collection_id.743        #[weight = T::WeightInfo::remove_collection_sponsor()]744        pub fn remove_collection_sponsor(origin, collection_id: u64) -> DispatchResult {745746            let sender = ensure_signed(origin)?;747            ensure!(<Collection<T>>::contains_key(collection_id), "This collection does not exist");748749            let mut target_collection = <Collection<T>>::get(collection_id);750            ensure!(sender == target_collection.owner, "You do not own this collection");751752            target_collection.sponsor = T::AccountId::default();753            <Collection<T>>::insert(collection_id, target_collection);754755            Ok(())756        }757758        /// This method creates a concrete instance of NFT Collection created with CreateCollection method.759        /// 760        /// # Permissions761        /// 762        /// * Collection Owner.763        /// * Collection Admin.764        /// * Anyone if765        ///     * White List is enabled, and766        ///     * Address is added to white list, and767        ///     * MintPermission is enabled (see SetMintPermission method)768        /// 769        /// # Arguments770        /// 771        /// * collection_id: ID of the collection.772        /// 773        /// * properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties meaning, it is treated purely as an array of bytes.774        /// 775        /// * owner: Address, initial owner of the NFT.776        // #[weight =777        // (130_000_000 as Weight)778        // .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight))779        // .saturating_add(RocksDbWeight::get().reads(10 as Weight))780        // .saturating_add(RocksDbWeight::get().writes(8 as Weight))]781782        #[weight = T::WeightInfo::create_item(properties.len())]783        pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {784785            let sender = ensure_signed(origin)?;786787            Self::collection_exists(collection_id)?;788789            let target_collection = <Collection<T>>::get(collection_id);790791            Self::can_create_items_in_collection(collection_id, &target_collection, &sender, &owner)?;792            Self::validate_create_item_args(&target_collection, &properties)?;793            Self::create_item_no_validation(collection_id, &target_collection, &properties, &owner)?;794795            Ok(())796        }797798        /// This method creates multiple instances of NFT Collection created with CreateCollection method.799        /// 800        /// # Permissions801        /// 802        /// * Collection Owner.803        /// * Collection Admin.804        /// * Anyone if805        ///     * White List is enabled, and806        ///     * Address is added to white list, and807        ///     * MintPermission is enabled (see SetMintPermission method)808        /// 809        /// # Arguments810        /// 811        /// * collection_id: ID of the collection.812        /// 813        /// * properties: Array items properties. Each property is an array of bytes itself, see [create_item].814        /// 815        /// * owner: Address, initial owner of the NFT.816        #[weight = 0]817        pub fn create_multiple_items(origin, collection_id: u64, properties: Vec<Vec<u8>>, owner: T::AccountId) -> DispatchResult {818819            ensure!(properties.len() > 0, "Length of items properties must be greater than 0.");820            let sender = ensure_signed(origin)?;821822            Self::collection_exists(collection_id)?;823            let target_collection = <Collection<T>>::get(collection_id);824825            Self::can_create_items_in_collection(collection_id, &target_collection, &sender, &owner)?;826827            for prop in &properties {828                Self::validate_create_item_args(&target_collection, prop)?;829            }830            for prop in &properties {831                Self::create_item_no_validation(collection_id, &target_collection, prop, &owner)?;832            }833834            Ok(())835        }836837        /// Destroys a concrete instance of NFT.838        /// 839        /// # Permissions840        /// 841        /// * Collection Owner.842        /// * Collection Admin.843        /// * Current NFT Owner.844        /// 845        /// # Arguments846        /// 847        /// * collection_id: ID of the collection.848        /// 849        /// * item_id: ID of NFT to burn.850        #[weight = T::WeightInfo::burn_item()]851        pub fn burn_item(origin, collection_id: u64, item_id: u64) -> DispatchResult {852853            let sender = ensure_signed(origin)?;854            Self::collection_exists(collection_id)?;855856            // Transfer permissions check857            let target_collection = <Collection<T>>::get(collection_id);858            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||859                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),860                "Only item owner, collection owner and admins can modify item");861862            if target_collection.access == AccessMode::WhiteList {863                Self::check_white_list(collection_id, &sender)?;864            }865866            match target_collection.mode867            {868                CollectionMode::NFT(_) => Self::burn_nft_item(collection_id, item_id)?,869                CollectionMode::Fungible(_)  => Self::burn_fungible_item(collection_id, item_id)?,870                CollectionMode::ReFungible(_, _)  => Self::burn_refungible_item(collection_id, item_id, sender.clone())?,871                _ => ()872            };873874            // call event875            Self::deposit_event(RawEvent::ItemDestroyed(collection_id, item_id));876877            Ok(())878        }879880        /// Change ownership of the token.881        /// 882        /// # Permissions883        /// 884        /// * Collection Owner885        /// * Collection Admin886        /// * Current NFT owner887        ///888        /// # Arguments889        /// 890        /// * recipient: Address of token recipient.891        /// 892        /// * collection_id.893        /// 894        /// * item_id: ID of the item895        ///     * Non-Fungible Mode: Required.896        ///     * Fungible Mode: Ignored.897        ///     * Re-Fungible Mode: Required.898        /// 899        /// * value: Amount to transfer.900        ///     * Non-Fungible Mode: Ignored901        ///     * Fungible Mode: Must specify transferred amount902        ///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)903        #[weight = T::WeightInfo::transfer()]904        pub fn transfer(origin, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64) -> DispatchResult {905906            let sender = ensure_signed(origin)?;907908            // Transfer permissions check909            let target_collection = <Collection<T>>::get(collection_id);910            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||911                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),912                "Only item owner, collection owner and admins can modify item");913914            if target_collection.access == AccessMode::WhiteList {915                Self::check_white_list(collection_id, &sender)?;916                Self::check_white_list(collection_id, &recipient)?;917            }918919            match target_collection.mode920            {921                CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, sender.clone(), recipient)?,922                CollectionMode::Fungible(_)  => Self::transfer_fungible(collection_id, item_id, value, sender.clone(), recipient)?,923                CollectionMode::ReFungible(_, _)  => Self::transfer_refungible(collection_id, item_id, value, sender.clone(), recipient)?,924                _ => ()925            };926927            Ok(())928        }929930        /// Set, change, or remove approved address to transfer the ownership of the NFT.931        /// 932        /// # Permissions933        /// 934        /// * Collection Owner935        /// * Collection Admin936        /// * Current NFT owner937        /// 938        /// # Arguments939        /// 940        /// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).941        /// 942        /// * collection_id.943        /// 944        /// * item_id: ID of the item.945        #[weight = T::WeightInfo::approve()]946        pub fn approve(origin, approved: T::AccountId, collection_id: u64, item_id: u64) -> DispatchResult {947948            let sender = ensure_signed(origin)?;949950            // Transfer permissions check951            let target_collection = <Collection<T>>::get(collection_id);952            ensure!(Self::is_item_owner(sender.clone(), collection_id, item_id) ||953                Self::is_owner_or_admin_permissions(collection_id, sender.clone()),954                "Only item owner, collection owner and admins can approve");955956            if target_collection.access == AccessMode::WhiteList {957                Self::check_white_list(collection_id, &sender)?;958                Self::check_white_list(collection_id, &approved)?;959            }960961            // amount param stub962            let amount = 100000000;963964            let list_exists = <ApprovedList<T>>::contains_key(collection_id, (item_id, sender.clone()));965            if list_exists {966967                let mut list = <ApprovedList<T>>::get(collection_id, (item_id, sender.clone()));968                let item_contains = list.iter().any(|i| i.approved == approved);969970                if !item_contains {971                    list.push(ApprovePermissions { approved: approved.clone(), amount: amount });972                    <ApprovedList<T>>::insert(collection_id, (item_id, sender.clone()), list);973                }974            } else {975976                let mut list = Vec::new();977                list.push(ApprovePermissions { approved: approved.clone(), amount: amount });978                <ApprovedList<T>>::insert(collection_id, (item_id, sender.clone()), list);979            }980981            Ok(())982        }983        984        /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.985        /// 986        /// # Permissions987        /// * Collection Owner988        /// * Collection Admin989        /// * Current NFT owner990        /// * Address approved by current NFT owner991        /// 992        /// # Arguments993        /// 994        /// * from: Address that owns token.995        /// 996        /// * recipient: Address of token recipient.997        /// 998        /// * collection_id.999        /// 1000        /// * item_id: ID of the item.1001        /// 1002        /// * value: Amount to transfer.1003        #[weight = T::WeightInfo::transfer_from()]1004        pub fn transfer_from(origin, from: T::AccountId, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64 ) -> DispatchResult {10051006            let sender = ensure_signed(origin)?;1007            let mut appoved_transfer = false;10081009            // Check approve1010            if <ApprovedList<T>>::contains_key(collection_id, (item_id, from.clone())) {1011                let list_itm = <ApprovedList<T>>::get(collection_id, (item_id, from.clone()));1012                let opt_item = list_itm.iter().find(|i| i.approved == sender.clone());1013                if opt_item.is_some()1014                {1015                    appoved_transfer = true;1016                    ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved");1017                }1018            }10191020            // Transfer permissions check1021            let target_collection = <Collection<T>>::get(collection_id);1022            ensure!(appoved_transfer || Self::is_owner_or_admin_permissions(collection_id, sender.clone()),1023                "Only item owner, collection owner and admins can modify items");10241025            if target_collection.access == AccessMode::WhiteList {1026                Self::check_white_list(collection_id, &sender)?;1027                Self::check_white_list(collection_id, &recipient)?;1028            }10291030            // remove approve1031            let approve_list: Vec<ApprovePermissions<T::AccountId>> = <ApprovedList<T>>::get(collection_id, (item_id, from.clone()))1032                .into_iter().filter(|i| i.approved != sender.clone()).collect();1033            <ApprovedList<T>>::insert(collection_id, (item_id, from.clone()), approve_list);103410351036            match target_collection.mode1037            {1038                CollectionMode::NFT(_) => Self::transfer_nft(collection_id, item_id, from, recipient)?,1039                CollectionMode::Fungible(_)  => Self::transfer_fungible(collection_id, item_id, value, from.clone(), recipient)?,1040                CollectionMode::ReFungible(_, _)  => Self::transfer_refungible(collection_id, item_id, value, from.clone(), recipient)?,1041                _ => ()1042            };10431044            Ok(())1045        }10461047        ///1048        #[weight = 0]1049        pub fn safe_transfer_from(origin, collection_id: u64, item_id: u64, new_owner: T::AccountId) -> DispatchResult {10501051            // let no_perm_mes = "You do not have permissions to modify this collection";1052            // ensure!(<ApprovedList<T>>::contains_key((collection_id, item_id)), no_perm_mes);1053            // let list_itm = <ApprovedList<T>>::get((collection_id, item_id));1054            // ensure!(list_itm.contains(&new_owner.clone()), no_perm_mes);10551056            // // on_nft_received  call10571058            // Self::transfer(origin, collection_id, item_id, new_owner)?;10591060            Ok(())1061        }10621063        /// Set off-chain data schema.1064        /// 1065        /// # Permissions1066        /// 1067        /// * Collection Owner1068        /// * Collection Admin1069        /// 1070        /// # Arguments1071        /// 1072        /// * collection_id.1073        /// 1074        /// * schema: String representing the offchain data schema.1075        #[weight = T::WeightInfo::set_offchain_schema()]1076        pub fn set_offchain_schema(1077            origin,1078            collection_id: u64,1079            schema: Vec<u8>1080        ) -> DispatchResult {1081            let sender = ensure_signed(origin)?;1082            Self::check_owner_or_admin_permissions(collection_id, sender.clone())?;10831084            let mut target_collection = <Collection<T>>::get(collection_id);1085            target_collection.offchain_schema = schema;1086            <Collection<T>>::insert(collection_id, target_collection);10871088            Ok(())1089        }10901091        // Sudo permissions function1092        #[weight = 0]1093        pub fn set_chain_limits(1094            origin,1095            limits: ChainLimits1096        ) -> DispatchResult {1097            ensure_root(origin)?;1098            <ChainLimit>::put(limits);1099            Ok(())1100        }        1101    }1102}11031104impl<T: Trait> Module<T> {11051106    fn can_create_items_in_collection(collection_id: u64, collection: &CollectionType<T::AccountId>, sender: &T::AccountId, owner: &T::AccountId) -> DispatchResult {11071108        if !Self::is_owner_or_admin_permissions(collection_id, sender.clone()) {1109            ensure!(collection.mint_mode == true, "Public minting is not allowed for this collection");1110            Self::check_white_list(collection_id, owner)?;1111            Self::check_white_list(collection_id, sender)?;1112        }11131114        Ok(())1115    }11161117    fn validate_create_item_args(collection: &CollectionType<T::AccountId>, properties: &Vec<u8>) -> DispatchResult {11181119        match collection.mode1120        {1121            CollectionMode::NFT(_) => {11221123                // check size1124                ensure!(collection.custom_data_size >= properties.len() as u32, "Size of item is too large")1125            },1126            CollectionMode::Fungible(_) => {11271128                // check size1129                ensure!(properties.len() as u32 == 0, "Size of item must be 0 with fungible type")1130            },1131            CollectionMode::ReFungible(_, _) => {11321133                // check size1134                ensure!(collection.custom_data_size >= properties.len() as u32, "Size of item is too large")1135            },1136            _ => {1137                fail!("Unexpected collection mode")1138            }1139        }11401141        Ok(())1142    }11431144    fn create_item_no_validation(collection_id: u64, collection: &CollectionType<T::AccountId>, properties: &Vec<u8>, owner: &T::AccountId) -> DispatchResult {1145        match collection.mode1146        {1147            CollectionMode::NFT(_) => {11481149                // Create nft item1150                let item = NftItemType {1151                    collection: collection_id,1152                    owner: owner.clone(),1153                    data: properties.clone(),1154                };11551156                Self::add_nft_item(item)?;11571158            },1159            CollectionMode::Fungible(_) => {11601161                let item = FungibleItemType {1162                    collection: collection_id,1163                    owner: owner.clone(),1164                    value: (10 as u128).pow(collection.decimal_points)1165                };11661167                Self::add_fungible_item(item)?;1168            },1169            CollectionMode::ReFungible(_, _) => {11701171                let mut owner_list = Vec::new();1172                let value = (10 as u128).pow(collection.decimal_points);1173                owner_list.push(Ownership {owner: owner.clone(), fraction: value});11741175                let item = ReFungibleItemType {1176                    collection: collection_id,1177                    owner: owner_list,1178                    data: properties.clone()1179                };11801181                Self::add_refungible_item(item)?;1182            },1183            _ => { ensure!(1 == 0,"just error"); }11841185        };11861187        // call event1188        Self::deposit_event(RawEvent::ItemCreated(collection_id, <ItemListIndex>::get(collection_id)));11891190        Ok(())1191    }11921193    fn add_fungible_item(item: FungibleItemType<T::AccountId>) -> DispatchResult {1194        let current_index = <ItemListIndex>::get(item.collection)1195            .checked_add(1)1196            .expect("Item list index id error");1197        let itemcopy = item.clone();1198        let owner = item.owner.clone();1199        let value = item.value as u64;12001201        Self::add_token_index(item.collection, current_index, owner.clone())?;12021203        <ItemListIndex>::insert(item.collection, current_index);1204        <FungibleItemList<T>>::insert(item.collection, current_index, itemcopy);12051206        // Add current block1207        let v: Vec<BasketItem<T::AccountId, T::BlockNumber>> = Vec::new();1208        <FungibleTransferBasket<T>>::insert(item.collection, current_index, v);1209        1210        // Update balance1211        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1212            .checked_add(value)1213            .unwrap();1214        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);12151216        Ok(())1217    }12181219    fn add_refungible_item(item: ReFungibleItemType<T::AccountId>) -> DispatchResult {1220        let current_index = <ItemListIndex>::get(item.collection)1221            .checked_add(1)1222            .expect("Item list index id error");1223        let itemcopy = item.clone();12241225        let value = item.owner.first().unwrap().fraction as u64;1226        let owner = item.owner.first().unwrap().owner.clone();12271228        Self::add_token_index(item.collection, current_index, owner.clone())?;12291230        <ItemListIndex>::insert(item.collection, current_index);1231        <ReFungibleItemList<T>>::insert(item.collection, current_index, itemcopy);12321233        // Add current block1234        let block_number: T::BlockNumber = 0.into();1235        <ReFungibleTransferBasket<T>>::insert(item.collection, current_index, block_number);12361237        // Update balance1238        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1239            .checked_add(value)1240            .unwrap();1241        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);12421243        Ok(())1244    }12451246    fn add_nft_item(item: NftItemType<T::AccountId>) -> DispatchResult {1247        let current_index = <ItemListIndex>::get(item.collection)1248            .checked_add(1)1249            .expect("Item list index id error");12501251        let item_owner = item.owner.clone();1252        let collection_id = item.collection.clone();1253        Self::add_token_index(collection_id, current_index, item.owner.clone())?;12541255        <ItemListIndex>::insert(collection_id, current_index);1256        <NftItemList<T>>::insert(collection_id, current_index, item);12571258        // Add current block1259        let block_number: T::BlockNumber = 0.into();1260        <NftTransferBasket<T>>::insert(collection_id, current_index, block_number);12611262        // Update balance1263        let new_balance = <Balance<T>>::get(collection_id, item_owner.clone())1264            .checked_add(1)1265            .unwrap();1266        <Balance<T>>::insert(collection_id, item_owner.clone(), new_balance);12671268        Ok(())1269    }12701271    fn burn_refungible_item(1272        collection_id: u64,1273        item_id: u64,1274        owner: T::AccountId,1275    ) -> DispatchResult {1276        ensure!(1277            <ReFungibleItemList<T>>::contains_key(collection_id, item_id),1278            "Item does not exists"1279        );1280        let collection = <ReFungibleItemList<T>>::get(collection_id, item_id);1281        let item = collection1282            .owner1283            .iter()1284            .filter(|&i| i.owner == owner)1285            .next()1286            .unwrap();1287        Self::remove_token_index(collection_id, item_id, owner.clone())?;12881289        // remove approve list1290        <ApprovedList<T>>::remove(collection_id, (item_id, owner.clone()));12911292        // update balance1293        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1294            .checked_sub(item.fraction as u64)1295            .unwrap();1296        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);12971298        <ReFungibleItemList<T>>::remove(collection_id, item_id);12991300        Ok(())1301    }13021303    fn burn_nft_item(collection_id: u64, item_id: u64) -> DispatchResult {1304        ensure!(1305            <NftItemList<T>>::contains_key(collection_id, item_id),1306            "Item does not exists"1307        );1308        let item = <NftItemList<T>>::get(collection_id, item_id);1309        Self::remove_token_index(collection_id, item_id, item.owner.clone())?;13101311        // remove approve list1312        <ApprovedList<T>>::remove(collection_id, (item_id, item.owner.clone()));13131314        // update balance1315        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1316            .checked_sub(1)1317            .unwrap();1318        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);1319        <NftItemList<T>>::remove(collection_id, item_id);13201321        Ok(())1322    }13231324    fn burn_fungible_item(collection_id: u64, item_id: u64) -> DispatchResult {1325        ensure!(1326            <FungibleItemList<T>>::contains_key(collection_id, item_id),1327            "Item does not exists"1328        );1329        let item = <FungibleItemList<T>>::get(collection_id, item_id);1330        Self::remove_token_index(collection_id, item_id, item.owner.clone())?;13311332        // remove approve list1333        <ApprovedList<T>>::remove(collection_id, (item_id, item.owner.clone()));13341335        // update balance1336        let new_balance = <Balance<T>>::get(collection_id, item.owner.clone())1337            .checked_sub(item.value as u64)1338            .unwrap();1339        <Balance<T>>::insert(collection_id, item.owner.clone(), new_balance);13401341        <FungibleItemList<T>>::remove(collection_id, item_id);13421343        Ok(())1344    }13451346    fn collection_exists(collection_id: u64) -> DispatchResult {1347        ensure!(1348            <Collection<T>>::contains_key(collection_id),1349            "This collection does not exist"1350        );1351        Ok(())1352    }13531354    fn check_owner_permissions(collection_id: u64, subject: T::AccountId) -> DispatchResult {1355        Self::collection_exists(collection_id)?;13561357        let target_collection = <Collection<T>>::get(collection_id);1358        ensure!(1359            subject == target_collection.owner,1360            "You do not own this collection"1361        );13621363        Ok(())1364    }13651366    fn is_owner_or_admin_permissions(collection_id: u64, subject: T::AccountId) -> bool {1367        let target_collection = <Collection<T>>::get(collection_id);1368        let mut result: bool = subject == target_collection.owner;1369        let exists = <AdminList<T>>::contains_key(collection_id);13701371        if !result & exists {1372            if <AdminList<T>>::get(collection_id).contains(&subject) {1373                result = true1374            }1375        }13761377        result1378    }13791380    fn check_owner_or_admin_permissions(1381        collection_id: u64,1382        subject: T::AccountId,1383    ) -> DispatchResult {1384        Self::collection_exists(collection_id)?;1385        let result = Self::is_owner_or_admin_permissions(collection_id, subject.clone());13861387        ensure!(1388            result,1389            "You do not have permissions to modify this collection"1390        );1391        Ok(())1392    }13931394    fn is_item_owner(subject: T::AccountId, collection_id: u64, item_id: u64) -> bool {1395        let target_collection = <Collection<T>>::get(collection_id);13961397        match target_collection.mode {1398            CollectionMode::NFT(_) => {1399                <NftItemList<T>>::get(collection_id, item_id).owner == subject1400            }1401            CollectionMode::Fungible(_) => {1402                <FungibleItemList<T>>::get(collection_id, item_id).owner == subject1403            }1404            CollectionMode::ReFungible(_, _) => {1405                <ReFungibleItemList<T>>::get(collection_id, item_id)1406                    .owner1407                    .iter()1408                    .any(|i| i.owner == subject)1409            }1410            CollectionMode::Invalid => false,1411        }1412    }14131414    fn check_white_list(collection_id: u64, address: &T::AccountId) -> DispatchResult {1415        let mes = "Address is not in white list";1416        ensure!(<WhiteList<T>>::contains_key(collection_id), mes);1417        let wl = <WhiteList<T>>::get(collection_id);1418        ensure!(wl.contains(address), mes);14191420        Ok(())1421    }14221423    fn transfer_fungible(1424        collection_id: u64,1425        item_id: u64,1426        value: u64,1427        owner: T::AccountId,1428        new_owner: T::AccountId,1429    ) -> DispatchResult {1430        ensure!(1431            <FungibleItemList<T>>::contains_key(collection_id, item_id),1432            "Item not exists"1433        );14341435        let full_item = <FungibleItemList<T>>::get(collection_id, item_id);1436        let amount = full_item.value;14371438        ensure!(amount >= value.into(), "Item balance not enouth");14391440        // update balance1441        let balance_old_owner = <Balance<T>>::get(collection_id, owner.clone())1442            .checked_sub(value)1443            .unwrap();1444        <Balance<T>>::insert(collection_id, owner.clone(), balance_old_owner);14451446        let mut new_owner_account_id = 0;1447        let new_owner_items = <AddressTokens<T>>::get(collection_id, new_owner.clone());1448        if new_owner_items.len() > 0 {1449            new_owner_account_id = new_owner_items[0];1450        }14511452        let val64 = value.into();14531454        // transfer1455        if amount == val64 && new_owner_account_id == 0 {1456            // change owner1457            // new owner do not have account1458            let mut new_full_item = full_item.clone();1459            new_full_item.owner = new_owner.clone();1460            <FungibleItemList<T>>::insert(collection_id, item_id, new_full_item);14611462            // update balance1463            let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1464                .checked_add(value)1465                .unwrap();1466            <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);14671468            // update index collection1469            Self::move_token_index(collection_id, item_id, owner.clone(), new_owner.clone())?;1470        } else {1471            let mut new_full_item = full_item.clone();1472            new_full_item.value -= val64;14731474            // separate amount1475            if new_owner_account_id > 0 {1476                // new owner has account1477                let mut item = <FungibleItemList<T>>::get(collection_id, new_owner_account_id);1478                item.value += val64;14791480                // update balance1481                let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1482                    .checked_add(value)1483                    .unwrap();1484                <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);14851486                <FungibleItemList<T>>::insert(collection_id, new_owner_account_id, item);1487            } else {1488                // new owner do not have account1489                let item = FungibleItemType {1490                    collection: collection_id,1491                    owner: new_owner.clone(),1492                    value: val64,1493                };14941495                Self::add_fungible_item(item)?;1496            }14971498            if amount == val64 {1499                Self::remove_token_index(collection_id, item_id, full_item.owner.clone())?;15001501                // remove approve list1502                <ApprovedList<T>>::remove(collection_id, (item_id, full_item.owner.clone()));1503                <FungibleItemList<T>>::remove(collection_id, item_id);1504            }15051506            <FungibleItemList<T>>::insert(collection_id, item_id, new_full_item);1507        }15081509        Ok(())1510    }15111512    fn transfer_refungible(1513        collection_id: u64,1514        item_id: u64,1515        value: u64,1516        owner: T::AccountId,1517        new_owner: T::AccountId,1518    ) -> DispatchResult {1519        ensure!(1520            <ReFungibleItemList<T>>::contains_key(collection_id, item_id),1521            "Item not exists"1522        );15231524        let full_item = <ReFungibleItemList<T>>::get(collection_id, item_id);1525        let item = full_item1526            .owner1527            .iter()1528            .filter(|i| i.owner == owner)1529            .next()1530            .unwrap();1531        let amount = item.fraction;15321533        ensure!(amount >= value.into(), "Item balance not enouth");15341535        // update balance1536        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.clone())1537            .checked_sub(value)1538            .unwrap();1539        <Balance<T>>::insert(collection_id, item.owner.clone(), balance_old_owner);15401541        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1542            .checked_add(value)1543            .unwrap();1544        <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);15451546        let old_owner = item.owner.clone();1547        let new_owner_has_account = full_item.owner.iter().any(|i| i.owner == new_owner);1548        let val64 = value.into();15491550        // transfer1551        if amount == val64 && !new_owner_has_account {1552            // change owner1553            // new owner do not have account1554            let mut new_full_item = full_item.clone();1555            new_full_item1556                .owner1557                .iter_mut()1558                .find(|i| i.owner == owner)1559                .unwrap()1560                .owner = new_owner.clone();1561            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);15621563            // update index collection1564            Self::move_token_index(collection_id, item_id, old_owner.clone(), new_owner.clone())?;1565        } else {1566            let mut new_full_item = full_item.clone();1567            new_full_item1568                .owner1569                .iter_mut()1570                .find(|i| i.owner == owner)1571                .unwrap()1572                .fraction -= val64;15731574            // separate amount1575            if new_owner_has_account {1576                // new owner has account1577                new_full_item1578                    .owner1579                    .iter_mut()1580                    .find(|i| i.owner == new_owner)1581                    .unwrap()1582                    .fraction += val64;1583            } else {1584                // new owner do not have account1585                new_full_item.owner.push(Ownership {1586                    owner: new_owner.clone(),1587                    fraction: val64,1588                });1589                Self::add_token_index(collection_id, item_id, new_owner.clone())?;1590            }15911592            <ReFungibleItemList<T>>::insert(collection_id, item_id, new_full_item);1593        }15941595        Ok(())1596    }15971598    fn transfer_nft(1599        collection_id: u64,1600        item_id: u64,1601        sender: T::AccountId,1602        new_owner: T::AccountId,1603    ) -> DispatchResult {1604        ensure!(1605            <NftItemList<T>>::contains_key(collection_id, item_id),1606            "Item not exists"1607        );16081609        let mut item = <NftItemList<T>>::get(collection_id, item_id);16101611        ensure!(1612            sender == item.owner,1613            "sender parameter and item owner must be equal"1614        );16151616        // update balance1617        let balance_old_owner = <Balance<T>>::get(collection_id, item.owner.clone())1618            .checked_sub(1)1619            .unwrap();1620        <Balance<T>>::insert(collection_id, item.owner.clone(), balance_old_owner);16211622        let balance_new_owner = <Balance<T>>::get(collection_id, new_owner.clone())1623            .checked_add(1)1624            .unwrap();1625        <Balance<T>>::insert(collection_id, new_owner.clone(), balance_new_owner);16261627        // change owner1628        let old_owner = item.owner.clone();1629        item.owner = new_owner.clone();1630        <NftItemList<T>>::insert(collection_id, item_id, item);16311632        // update index collection1633        Self::move_token_index(collection_id, item_id, old_owner.clone(), new_owner.clone())?;16341635        // reset approved list1636        <ApprovedList<T>>::remove(collection_id, (item_id, old_owner));1637        Ok(())1638    }16391640    fn init_collection(item: &CollectionType<T::AccountId>) {1641        // check params1642        assert!(1643            item.decimal_points <= 4,1644            "decimal_points parameter must be lower than 4"1645        );1646        assert!(1647            item.name.len() <= 64,1648            "Collection name can not be longer than 63 char"1649        );1650        assert!(1651            item.name.len() <= 256,1652            "Collection description can not be longer than 255 char"1653        );1654        assert!(1655            item.token_prefix.len() <= 16,1656            "Token prefix can not be longer than 15 char"1657        );16581659        // Generate next collection ID1660        let next_id = CreatedCollectionCount::get()1661            .checked_add(1)1662            .expect("collection id error");16631664        CreatedCollectionCount::put(next_id);1665    }16661667    fn init_nft_token(item: &NftItemType<T::AccountId>) {1668        let current_index = <ItemListIndex>::get(item.collection)1669            .checked_add(1)1670            .expect("Item list index id error");16711672        let item_owner = item.owner.clone();1673        let collection_id = item.collection.clone();1674        Self::add_token_index(collection_id, current_index, item.owner.clone()).unwrap();16751676        <ItemListIndex>::insert(collection_id, current_index);16771678        // Update balance1679        let new_balance = <Balance<T>>::get(collection_id, item_owner.clone())1680            .checked_add(1)1681            .unwrap();1682        <Balance<T>>::insert(collection_id, item_owner.clone(), new_balance);1683    }16841685    fn init_fungible_token(item: &FungibleItemType<T::AccountId>) {1686        let current_index = <ItemListIndex>::get(item.collection)1687            .checked_add(1)1688            .expect("Item list index id error");1689        let owner = item.owner.clone();1690        let value = item.value as u64;16911692        Self::add_token_index(item.collection, current_index, owner.clone()).unwrap();16931694        <ItemListIndex>::insert(item.collection, current_index);16951696        // Update balance1697        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1698            .checked_add(value)1699            .unwrap();1700        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);1701    }17021703    fn init_refungible_token(item: &ReFungibleItemType<T::AccountId>) {1704        let current_index = <ItemListIndex>::get(item.collection)1705            .checked_add(1)1706            .expect("Item list index id error");17071708        let value = item.owner.first().unwrap().fraction as u64;1709        let owner = item.owner.first().unwrap().owner.clone();17101711        Self::add_token_index(item.collection, current_index, owner.clone()).unwrap();17121713        <ItemListIndex>::insert(item.collection, current_index);17141715        // Update balance1716        let new_balance = <Balance<T>>::get(item.collection, owner.clone())1717            .checked_add(value)1718            .unwrap();1719        <Balance<T>>::insert(item.collection, owner.clone(), new_balance);1720    }17211722    fn add_token_index(collection_id: u64, item_index: u64, owner: T::AccountId) -> DispatchResult {17231724        // add to account limit1725        if <AccountItemCount<T>>::contains_key(owner.clone()) {17261727            // bound Owned tokens by a single address1728            let count = <AccountItemCount<T>>::get(owner.clone());1729            ensure!(count < ChainLimit::get().account_token_ownership_limit, "Owned tokens by a single address bound exceeded");17301731            <AccountItemCount<T>>::insert(owner.clone(), 1732                count.checked_add(1).unwrap());1733        }1734        else {1735            <AccountItemCount<T>>::insert(owner.clone(), 1);1736        }17371738        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.clone());1739        if list_exists {1740            let mut list = <AddressTokens<T>>::get(collection_id, owner.clone());1741            let item_contains = list.contains(&item_index.clone());17421743            if !item_contains {1744                list.push(item_index.clone());1745            }17461747            <AddressTokens<T>>::insert(collection_id, owner.clone(), list);1748        } else {1749            let mut itm = Vec::new();1750            itm.push(item_index.clone());1751            <AddressTokens<T>>::insert(collection_id, owner, itm);1752            1753        }17541755        Ok(())1756    }17571758    fn remove_token_index(1759        collection_id: u64,1760        item_index: u64,1761        owner: T::AccountId,1762    ) -> DispatchResult {17631764        // update counter1765        <AccountItemCount<T>>::insert(owner.clone(), 1766            <AccountItemCount<T>>::get(owner.clone()).checked_sub(1).unwrap());176717681769        let list_exists = <AddressTokens<T>>::contains_key(collection_id, owner.clone());1770        if list_exists {1771            let mut list = <AddressTokens<T>>::get(collection_id, owner.clone());1772            let item_contains = list.contains(&item_index.clone());17731774            if item_contains {1775                list.retain(|&item| item != item_index);1776                <AddressTokens<T>>::insert(collection_id, owner, list);1777            }1778        }17791780        Ok(())1781    }17821783    fn move_token_index(1784        collection_id: u64,1785        item_index: u64,1786        old_owner: T::AccountId,1787        new_owner: T::AccountId,1788    ) -> DispatchResult {1789        Self::remove_token_index(collection_id, item_index, old_owner)?;1790        Self::add_token_index(collection_id, item_index, new_owner)?;17911792        Ok(())1793    }1794}17951796////////////////////////////////////////////////////////////////////////////////////////////////////1797// Economic models1798// #region17991800/// Fee multiplier.1801pub type Multiplier = FixedU128;18021803type BalanceOf<T> = <<T as transaction_payment::Trait>::Currency as Currency<1804    <T as system::Trait>::AccountId,1805>>::Balance;1806type NegativeImbalanceOf<T> = <<T as transaction_payment::Trait>::Currency as Currency<1807    <T as system::Trait>::AccountId,1808>>::NegativeImbalance;18091810/// Require the transactor pay for themselves and maybe include a tip to gain additional priority1811/// in the queue.1812#[derive(Encode, Decode, Clone, Eq, PartialEq)]1813pub struct ChargeTransactionPayment<T: transaction_payment::Trait + Send + Sync>(1814    #[codec(compact)] BalanceOf<T>,1815);18161817impl<T: Trait + transaction_payment::Trait + Send + Sync> sp_std::fmt::Debug1818    for ChargeTransactionPayment<T>1819{1820    #[cfg(feature = "std")]1821    fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {1822        write!(f, "ChargeTransactionPayment<{:?}>", self.0)1823    }1824    #[cfg(not(feature = "std"))]1825    fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {1826        Ok(())1827    }1828}18291830impl<T: Trait + transaction_payment::Trait + Send + Sync> ChargeTransactionPayment<T>1831where1832    T::Call:1833        Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo> + IsSubType<Call<T>>,1834    BalanceOf<T>: Send + Sync + FixedPointOperand,1835{1836    /// utility constructor. Used only in client/factory code.1837    pub fn from(fee: BalanceOf<T>) -> Self {1838        Self(fee)1839    }18401841    pub fn traditional_fee(1842        len: usize,1843        info: &DispatchInfoOf<T::Call>,1844        tip: BalanceOf<T>,1845    ) -> BalanceOf<T>1846    where1847        T::Call: Dispatchable<Info = DispatchInfo>,1848    {1849        <transaction_payment::Module<T>>::compute_fee(len as u32, info, tip)1850    }18511852    fn withdraw_fee(1853        &self,1854        who: &T::AccountId,1855        call: &T::Call,1856        info: &DispatchInfoOf<T::Call>,1857        len: usize,1858    ) -> Result<(BalanceOf<T>, Option<NegativeImbalanceOf<T>>), TransactionValidityError> {1859        let tip = self.0;18601861        // Set fee based on call type. Creating collection costs 1 Unique.1862        // All other transactions have traditional fees so far1863        let fee = match call.is_sub_type() {1864            Some(Call::create_collection(..)) => <BalanceOf<T>>::from(1_000_000_000),1865            _ => Self::traditional_fee(len, info, tip), // Flat fee model, use only for testing purposes1866                                                        // _ => <BalanceOf<T>>::from(100)1867        };18681869        // Determine who is paying transaction fee based on ecnomic model1870        // Parse call to extract collection ID and access collection sponsor1871        let sponsor: T::AccountId = match call.is_sub_type() {1872            Some(Call::create_item(collection_id, _properties, _owner)) => {1873                <Collection<T>>::get(collection_id).sponsor1874            }1875            Some(Call::transfer(_new_owner, collection_id, _item_id, _value)) => {1876                let _collection_mode = <Collection<T>>::get(collection_id).mode;18771878                // sponsor timeout1879                let sponsor_transfer = match _collection_mode {1880                    CollectionMode::NFT(_) => {1881                        let basket = <NftTransferBasket<T>>::get(collection_id, _item_id);1882                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1883                        let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into();1884                        if block_number >= limit_time {1885                            <NftTransferBasket<T>>::insert(collection_id, _item_id, block_number);1886                            true1887                        }1888                        else {1889                            false1890                        }1891                    }1892                    CollectionMode::Fungible(_) => {1893                        let mut basket = <FungibleTransferBasket<T>>::get(collection_id, _item_id);1894                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1895                        if basket.iter().any(|i| i.address == _new_owner.clone())1896                        {1897                            let item = basket.iter_mut().find(|i| i.address == _new_owner.clone()).unwrap().clone();1898                            let limit_time = item.start_block + ChainLimit::get().fungible_sponsor_transfer_timeout.into();1899                            if block_number >= limit_time {1900                                basket.retain(|x| x.address == item.address);1901                                basket.push(BasketItem { start_block: block_number, address: _new_owner.clone() });1902                                <FungibleTransferBasket<T>>::insert(collection_id, _item_id, basket);1903                                true1904                            }1905                            else {1906                                false1907                            }1908                        }1909                        else {1910                            basket.push(BasketItem { start_block: block_number, address: _new_owner.clone()});1911                            true1912                        }1913                    }1914                    CollectionMode::ReFungible(_, _) => {1915                        let basket = <ReFungibleTransferBasket<T>>::get(collection_id, _item_id);1916                        let block_number = <system::Module<T>>::block_number() as T::BlockNumber;1917                        let limit_time = basket + ChainLimit::get().nft_sponsor_transfer_timeout.into();1918                        if block_number >= limit_time {1919                            <ReFungibleTransferBasket<T>>::insert(collection_id, _item_id, block_number);1920                            true1921                        } else {1922                            false1923                        }1924                    }1925                    _ => {1926                        false1927                    },1928                };19291930                if !sponsor_transfer {1931                    T::AccountId::default()1932                } else {1933                    <Collection<T>>::get(collection_id).sponsor1934                }1935            }19361937            _ => T::AccountId::default(),1938        };19391940        let mut who_pays_fee: T::AccountId = sponsor.clone();1941        if sponsor == T::AccountId::default() {1942            who_pays_fee = who.clone();1943        }19441945        // Only mess with balances if fee is not zero.1946        if fee.is_zero() {1947            return Ok((fee, None));1948        }19491950        match <T as transaction_payment::Trait>::Currency::withdraw(1951            &who_pays_fee,1952            fee,1953            if tip.is_zero() {1954                WithdrawReason::TransactionPayment.into()1955            } else {1956                WithdrawReason::TransactionPayment | WithdrawReason::Tip1957            },1958            ExistenceRequirement::KeepAlive,1959        ) {1960            Ok(imbalance) => Ok((fee, Some(imbalance))),1961            Err(_) => Err(InvalidTransaction::Payment.into()),1962        }1963    }1964}19651966impl<T: Trait + transaction_payment::Trait + Send + Sync> SignedExtension1967    for ChargeTransactionPayment<T>1968where1969    BalanceOf<T>: Send + Sync + From<u64> + FixedPointOperand,1970    T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo> + IsSubType<Call<T>>,1971{1972    const IDENTIFIER: &'static str = "ChargeTransactionPayment";1973    type AccountId = T::AccountId;1974    type Call = T::Call;1975    type AdditionalSigned = ();1976    type Pre = (1977        BalanceOf<T>,1978        Self::AccountId,1979        Option<NegativeImbalanceOf<T>>,1980        BalanceOf<T>,1981    );1982    fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {1983        Ok(())1984    }19851986    fn validate(1987        &self,1988        who: &Self::AccountId,1989        call: &Self::Call,1990        info: &DispatchInfoOf<Self::Call>,1991        len: usize,1992    ) -> TransactionValidity {1993        let (fee, _) = self.withdraw_fee(who, call, info, len)?;19941995        let mut r = ValidTransaction::default();1996        // NOTE: we probably want to maximize the _fee (of any type) per weight unit_ here, which1997        // will be a bit more than setting the priority to tip. For now, this is enough.1998        r.priority = fee.saturated_into::<TransactionPriority>();1999        Ok(r)2000    }20012002    fn pre_dispatch(2003        self,2004        who: &Self::AccountId,2005        call: &Self::Call,2006        info: &DispatchInfoOf<Self::Call>,2007        len: usize,2008    ) -> Result<Self::Pre, TransactionValidityError> {2009        let (fee, imbalance) = self.withdraw_fee(who, call, info, len)?;2010        Ok((self.0, who.clone(), imbalance, fee))2011    }20122013    fn post_dispatch(2014        pre: Self::Pre,2015        info: &DispatchInfoOf<Self::Call>,2016        post_info: &PostDispatchInfoOf<Self::Call>,2017        len: usize,2018        _result: &DispatchResult,2019    ) -> Result<(), TransactionValidityError> {2020        let (tip, who, imbalance, fee) = pre;2021        if let Some(payed) = imbalance {2022            let actual_fee = <transaction_payment::Module<T>>::compute_actual_fee(2023                len as u32, info, post_info, tip,2024            );2025            let refund = fee.saturating_sub(actual_fee);2026            let actual_payment =2027                match <T as transaction_payment::Trait>::Currency::deposit_into_existing(2028                    &who, refund,2029                ) {2030                    Ok(refund_imbalance) => {2031                        // The refund cannot be larger than the up front payed max weight.2032                        // `PostDispatchInfo::calc_unspent` guards against such a case.2033                        match payed.offset(refund_imbalance) {2034                            Ok(actual_payment) => actual_payment,2035                            Err(_) => return Err(InvalidTransaction::Payment.into()),2036                        }2037                    }2038                    // We do not recreate the account using the refund. The up front payment2039                    // is gone in that case.2040                    Err(_) => payed,2041                };2042            let imbalances = actual_payment.split(tip);2043            <T as transaction_payment::Trait>::OnTransactionPayment::on_unbalanceds(2044                Some(imbalances.0).into_iter().chain(Some(imbalances.1)),2045            );2046        }2047        Ok(())2048    }2049}2050// #endregion20512052
modifiedpallets/nft/src/mock.rsdiffbeforeafterboth
--- a/pallets/nft/src/mock.rs
+++ b/pallets/nft/src/mock.rs
@@ -35,30 +35,31 @@
 }
 
 impl system::Trait for Test {
-    type Origin = Origin;
-    type Call = ();
-    type Index = u64;
-    type BlockNumber = u64;
-    type Hash = H256;
-    type Hashing = BlakeTwo256;
-    type AccountId = u64;
-    type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
-    type Event = ();
-    type BlockHashCount = BlockHashCount;
-    type MaximumBlockWeight = MaximumBlockWeight;
-    type MaximumBlockLength = MaximumBlockLength;
-    type AvailableBlockRatio = AvailableBlockRatio;
-    type BaseCallFilter = ();
-    type DbWeight = RocksDbWeight;
-    type BlockExecutionWeight = BlockExecutionWeight;
-    type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
-    type MaximumExtrinsicWeight = MaximumExtrinsicWeight;
-    type Version = ();
-    type ModuleToIndex = ();
-    type AccountData = ();
-    type OnNewAccount = ();
-    type OnKilledAccount = ();
+	type BaseCallFilter = ();
+	type Origin = Origin;
+	type Call = ();
+	type Index = u64;
+	type BlockNumber = u64;
+	type Hash = H256;
+	type Hashing = BlakeTwo256;
+	type AccountId = u64;
+	type Lookup = IdentityLookup<Self::AccountId>;
+	type Header = Header;
+	type 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 = ();
+	type AccountData = ();
+	type OnNewAccount = ();
+	type OnKilledAccount = ();
+	type SystemWeightInfo = ();
 }
 impl Trait for Test {
     type Event = ();
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -315,7 +315,7 @@
         assert_eq!(TemplateModule::fungible_item_id(1, 1).value, 1000);
         assert_eq!(TemplateModule::balance_count(1, 1), 0);
         assert_eq!(TemplateModule::balance_count(1, 2), 1000);
-        assert_eq!(TemplateModule::address_tokens(1, 1), []);
+        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
         assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
 
         // split item scenario
@@ -398,7 +398,7 @@
         );
         assert_eq!(TemplateModule::balance_count(1, 1), 0);
         assert_eq!(TemplateModule::balance_count(1, 2), 1000);
-        assert_eq!(TemplateModule::address_tokens(1, 1), []);
+        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
         assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
 
         // split item scenario
@@ -488,7 +488,7 @@
         assert_eq!(TemplateModule::nft_item_id(1, 1).owner, 2);
         assert_eq!(TemplateModule::balance_count(1, 1), 0);
         assert_eq!(TemplateModule::balance_count(1, 2), 1);
-        assert_eq!(TemplateModule::address_tokens(1, 1), []);
+        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
         assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
     });
 }
@@ -770,7 +770,7 @@
         ));
         assert_eq!(TemplateModule::balance_count(1, 1), 0);
         assert_eq!(TemplateModule::balance_count(1, 3), 1000);
-        assert_eq!(TemplateModule::address_tokens(1, 1), []);
+        // assert_eq!(TemplateModule::address_tokens(1, 1), []);
         assert_eq!(TemplateModule::address_tokens(1, 3), [2]);
 
         assert_eq!(TemplateModule::approved(1, (1, 1)).len(), 0);
@@ -2300,7 +2300,7 @@
 
         assert_noop!(
             TemplateModule::create_item(origin2.clone(), 1, [1, 2, 3].to_vec(), 2),
-            "Collection is not in mint mode"
+            "Public minting is not allowed for this collection"
         );
     });
 }
@@ -2347,7 +2347,7 @@
 
         assert_noop!(
             TemplateModule::create_item(origin2.clone(), 1, [1, 2, 3].to_vec(), 2),
-            "Collection is not in mint mode"
+            "Public minting is not allowed for this collection"
         );
     });
 }
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -1,186 +1,3 @@
-[dependencies.aura]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-aura'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.balances]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-balances'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.codec]
-default-features = false
-features = ['derive']
-package = 'parity-scale-codec'
-version = '1.3.0'
-
-[dependencies.contracts]
-git = 'https://github.com/usetech-llc/substrate.git'
-default-features = false
-package = 'pallet-contracts'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.contracts-primitives]
-git = 'https://github.com/usetech-llc/substrate.git'
-default-features = false
-package = 'pallet-contracts-primitives'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.contracts-rpc-runtime-api]
-git = 'https://github.com/usetech-llc/substrate.git'
-default-features = false
-package = 'pallet-contracts-rpc-runtime-api'
-version = '0.8.0-rc4'
-branch = 'rc4_ext_dispatch_reenabled'
-
-[dependencies.frame-executive]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.frame-support]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.grandpa]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-grandpa'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.randomness-collective-flip]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-randomness-collective-flip'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.serde]
-features = ['derive']
-optional = true
-version = '1.0.101'
-
-[dependencies.sp-api]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-block-builder]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-consensus-aura]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '0.8.0-rc4'
-
-[dependencies.sp-core]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-inherents]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-io]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-offchain]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-runtime]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-session]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-std]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-transaction-pool]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sp-version]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.sudo]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-sudo'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.system]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'frame-system'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.nft]
-default-features = false
-package = 'pallet-nft'
-path = '../pallets/nft'
-version = '2.0.0-rc4'
-
-[dependencies.timestamp]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-timestamp'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-
-[dependencies.transaction-payment]
-default-features = false
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'pallet-transaction-payment'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '2.0.0-rc4'
-[build-dependencies.wasm-builder-runner]
-git = 'https://github.com/usetech-llc/substrate.git'
-package = 'substrate-wasm-builder-runner'
-branch = 'rc4_ext_dispatch_reenabled'
-version = '1.0.5'
-
 [package]
 authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
 edition = '2018'
@@ -188,39 +5,99 @@
 license = 'Unlicense'
 name = 'nft-runtime'
 repository = 'https://github.com/usetech-llc/nft_parachain/'
-version = '2.0.0-rc4'
+version = '2.0.0'
+
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
 
+[build-dependencies]
+wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' }
+
+# alias "parity-scale-code" to "codec"
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '1.3.4'
+
+[dependencies]
+hex-literal = { optional = true, version = '0.3.1' }
+serde = { features = ['derive'], optional = true, version = '1.0.101' }
+
+# local dependencies
+pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' }
+
+# Substrate dependencies
+frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }
+
 [features]
 default = ['std']
+runtime-benchmarks = [
+    'hex-literal',
+    'frame-benchmarking',
+    'frame-support/runtime-benchmarks',
+    'frame-system-benchmarking',
+    'frame-system/runtime-benchmarks',
+    'pallet-balances/runtime-benchmarks',
+    'pallet-timestamp/runtime-benchmarks',
+    'pallet-nft/runtime-benchmarks',
+    'sp-runtime/runtime-benchmarks',
+]
 std = [
-    'aura/std',
-    'balances/std',
     'codec/std',
-    'contracts/std',
-    'contracts-primitives/std',
-    'contracts-rpc-runtime-api/std',
+    'serde',
     'frame-executive/std',
     'frame-support/std',
-    'grandpa/std',
-    'randomness-collective-flip/std',
-    'serde',
+    'frame-system/std',
+    'frame-system-rpc-runtime-api/std',
+    'pallet-aura/std',
+    'pallet-balances/std',
+    'pallet-contracts/std',
+    'pallet-contracts-primitives/std',
+    'pallet-contracts-rpc-runtime-api/std',
+    'pallet-grandpa/std',
+    'pallet-randomness-collective-flip/std',
+    'pallet-sudo/std',
+    'pallet-timestamp/std',
+    'pallet-transaction-payment/std',
+    'pallet-transaction-payment-rpc-runtime-api/std',
+    'pallet-nft/std',
     'sp-api/std',
     'sp-block-builder/std',
     'sp-consensus-aura/std',
     'sp-core/std',
     'sp-inherents/std',
-    'sp-io/std',
     'sp-offchain/std',
     'sp-runtime/std',
     'sp-session/std',
     'sp-std/std',
     'sp-transaction-pool/std',
     'sp-version/std',
-    'sudo/std',
-    'system/std',
-    'timestamp/std',
-    'transaction-payment/std',
-    'nft/std',
 ]
modifiedruntime/build.rsdiffbeforeafterboth
--- a/runtime/build.rs
+++ b/runtime/build.rs
@@ -3,7 +3,7 @@
 fn main() {
     WasmBuilder::new()
         .with_current_project()
-        .with_wasm_builder_from_crates("1.0.11")
+        .with_wasm_builder_from_crates("2.0.0")
         .export_heap_base()
         .import_memory()
         .build()
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -8,9 +8,9 @@
 #[cfg(feature = "std")]
 include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
 
-use contracts_rpc_runtime_api::ContractExecResult;
-use grandpa::fg_primitives;
-use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
+use pallet_contracts_rpc_runtime_api::ContractExecResult;
+use pallet_grandpa::fg_primitives;
+use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
 use sp_api::impl_runtime_apis;
 use sp_consensus_aura::sr25519::AuthorityId as AuraId;
 use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
@@ -29,8 +29,8 @@
 use sp_version::RuntimeVersion;
 
 // A few exports that help ease life for downstream crates.
-pub use balances::Call as BalancesCall;
-pub use contracts::Schedule as ContractsSchedule;
+pub use pallet_balances::Call as BalancesCall;
+pub use pallet_contracts::Schedule as ContractsSchedule;
 pub use frame_support::{
     construct_runtime,
     dispatch::DispatchResult,
@@ -49,14 +49,14 @@
 #[cfg(any(feature = "std", test))]
 pub use sp_runtime::BuildStorage;
 use sp_runtime::Perbill;
-use system::{self as system};
+use frame_system::{self as system};
 
-pub use timestamp::Call as TimestampCall;
+pub use pallet_timestamp::Call as TimestampCall;
 
 /// Re-export a nft pallet
 /// TODO: Check this re-export. Is this safe and good style?
-extern crate nft;
-pub use nft::*;
+extern crate pallet_nft;
+pub use pallet_nft::*;
 
 /// An index to a block.
 pub type BlockNumber = u32;
@@ -84,6 +84,8 @@
 /// Digest item type.
 pub type DigestItem = generic::DigestItem<Hash>;
 
+mod nft_weights;
+
 /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
 /// the specifics of the runtime. They can then be made to be agnostic over specific formats
 /// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -194,62 +196,69 @@
     type AvailableBlockRatio = AvailableBlockRatio;
     /// Version of the runtime.
     type Version = Version;
-    /// Converts a module to the index of the module in `construct_runtime!`.
-    /// This type is being generated by `construct_runtime!`.
-    type ModuleToIndex = ModuleToIndex;
+ 	/// This type is being generated by `construct_runtime!`.
+    type PalletInfo = PalletInfo;
     /// What to do if a new account is created.
     type OnNewAccount = ();
     /// What to do if an account is fully reaped from the system.
     type OnKilledAccount = ();
     /// The data to be stored in an account.
-    type AccountData = balances::AccountData<Balance>;
+    type AccountData = pallet_balances::AccountData<Balance>;
+	/// Weight information for the extrinsics of this pallet.
+	type SystemWeightInfo = ();
 }
 
-impl aura::Trait for Runtime {
+impl pallet_aura::Trait for Runtime {
     type AuthorityId = AuraId;
 }
 
-impl grandpa::Trait for Runtime {
-    type Event = Event;
-    type Call = Call;
+impl pallet_grandpa::Trait for Runtime {
+	type Event = Event;
+	type Call = Call;
 
-    type KeyOwnerProofSystem = ();
+	type KeyOwnerProofSystem = ();
 
-    type KeyOwnerProof =
-        <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
+	type KeyOwnerProof =
+		<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
 
-    type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
-        KeyTypeId,
-        GrandpaId,
-    )>>::IdentificationTuple;
+	type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
+		KeyTypeId,
+		GrandpaId,
+	)>>::IdentificationTuple;
+
+	type HandleEquivocation = ();
 
-    type HandleEquivocation = ();
+	type WeightInfo = ();
 }
 
 parameter_types! {
     pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
 }
 
-impl timestamp::Trait for Runtime {
-    /// A timestamp: milliseconds since the unix epoch.
-    type Moment = u64;
-    type OnTimestampSet = Aura;
-    type MinimumPeriod = MinimumPeriod;
+impl pallet_timestamp::Trait for Runtime {
+	/// A timestamp: milliseconds since the unix epoch.
+	type Moment = u64;
+	type OnTimestampSet = Aura;
+	type MinimumPeriod = MinimumPeriod;
+	type WeightInfo = ();
 }
 
 parameter_types! {
     // pub const ExistentialDeposit: u128 = 500;
     pub const ExistentialDeposit: u128 = 0;
+	pub const MaxLocks: u32 = 50;
 }
 
-impl balances::Trait for Runtime {
-    /// The type for recording an account's balance.
-    type Balance = Balance;
-    /// The ubiquitous event type.
-    type Event = Event;
-    type DustRemoval = ();
-    type ExistentialDeposit = ExistentialDeposit;
-    type AccountStore = System;
+impl pallet_balances::Trait for Runtime {
+	type MaxLocks = MaxLocks;
+	/// The type for recording an account's balance.
+	type Balance = Balance;
+	/// The ubiquitous event type.
+	type Event = Event;
+	type DustRemoval = ();
+	type ExistentialDeposit = ExistentialDeposit;
+	type AccountStore = System;
+	type WeightInfo = ();
 }
 
 pub const MILLICENTS: Balance = 1_000_000_000;
@@ -263,46 +272,46 @@
     pub const SurchargeReward: Balance = 150 * MILLICENTS;
 }
 
-impl contracts::Trait for Runtime {
-    type Call = Call;
-    type Time = Timestamp;
-    type Randomness = RandomnessCollectiveFlip;
-    type Currency = Balances;
-    type Event = Event;
-    type DetermineContractAddress = contracts::SimpleAddressDeterminer<Runtime>;
-    type TrieIdGenerator = contracts::TrieIdFromParentCounter<Runtime>;
-    type RentPayment = ();
-    type SignedClaimHandicap = contracts::DefaultSignedClaimHandicap;
-    type TombstoneDeposit = TombstoneDeposit;
-    type StorageSizeOffset = contracts::DefaultStorageSizeOffset;
-    type RentByteFee = RentByteFee;
-    type RentDepositOffset = RentDepositOffset;
-    type SurchargeReward = SurchargeReward;
-    type MaxDepth = contracts::DefaultMaxDepth;
-    type MaxValueSize = contracts::DefaultMaxValueSize;
-    type WeightPrice = transaction_payment::Module<Self>;
+impl pallet_contracts::Trait for Runtime {
+	type Time = Timestamp;
+	type Randomness = RandomnessCollectiveFlip;
+	type Currency = Balances;
+	type Event = Event;
+	type DetermineContractAddress = pallet_contracts::SimpleAddressDeterminer<Runtime>;
+	type TrieIdGenerator = pallet_contracts::TrieIdFromParentCounter<Runtime>;
+	type RentPayment = ();
+	type SignedClaimHandicap = pallet_contracts::DefaultSignedClaimHandicap;
+	type TombstoneDeposit = TombstoneDeposit;
+	type StorageSizeOffset = pallet_contracts::DefaultStorageSizeOffset;
+	type RentByteFee = RentByteFee;
+	type RentDepositOffset = RentDepositOffset;
+	type SurchargeReward = SurchargeReward;
+	type MaxDepth = pallet_contracts::DefaultMaxDepth;
+	type MaxValueSize = pallet_contracts::DefaultMaxValueSize;
+	type WeightPrice = pallet_transaction_payment::Module<Self>;
 }
 
 parameter_types! {
-    pub const TransactionByteFee: Balance = 1;
+	pub const TransactionByteFee: Balance = 10 * MILLICENTS;
 }
 
-impl transaction_payment::Trait for Runtime {
-    type Currency = balances::Module<Runtime>;
+impl pallet_transaction_payment::Trait for Runtime {
+    type Currency = pallet_balances::Module<Runtime>;
     type OnTransactionPayment = ();
     type TransactionByteFee = TransactionByteFee;
     type WeightToFee = IdentityFee<Balance>;
-    type FeeMultiplierUpdate = ();
+    type FeeMultiplierUpdate =  ();
 }
 
-impl sudo::Trait for Runtime {
+impl pallet_sudo::Trait for Runtime {
     type Event = Event;
     type Call = Call;
 }
 
 /// Used for the module nft in `./nft.rs`
-impl nft::Trait for Runtime {
+impl pallet_nft::Trait for Runtime {
     type Event = Event;
+    type WeightInfo = nft_weights::WeightInfo;
 }
 
 construct_runtime!(
@@ -312,15 +321,15 @@
         UncheckedExtrinsic = UncheckedExtrinsic
     {
         System: system::{Module, Call, Config, Storage, Event<T>},
-        RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
-        Contracts: contracts::{Module, Call, Config, Storage, Event<T>},
-        Timestamp: timestamp::{Module, Call, Storage, Inherent},
-        Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
-        Grandpa: grandpa::{Module, Call, Storage, Config, Event},
-        Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
-        TransactionPayment: transaction_payment::{Module, Storage},
-        Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
-        Nft: nft::{Module, Call, Config<T>, Storage, Event<T>},
+        RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
+        Contracts: pallet_contracts::{Module, Call, Config, Storage, Event<T>},
+        Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
+        Aura: pallet_aura::{Module, Config<T>, Inherent},
+        Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
+        Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
+        TransactionPayment: pallet_transaction_payment::{Module, Storage},
+        Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
+        Nft: pallet_nft::{Module, Call, Config<T>, Storage, Event<T>},
     }
 );
 
@@ -342,7 +351,7 @@
     system::CheckEra<Runtime>,
     system::CheckNonce<Runtime>,
     system::CheckWeight<Runtime>,
-    nft::ChargeTransactionPayment<Runtime>,
+    pallet_nft::ChargeTransactionPayment<Runtime>,
 );
 /// Unchecked extrinsic type as expected by this runtime.
 pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
@@ -354,7 +363,7 @@
 
 impl_runtime_apis! {
 
-    impl contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>
+    impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>
     for Runtime
     {
         fn call(
@@ -364,27 +373,28 @@
             gas_limit: u64,
             input_data: Vec<u8>,
         ) -> ContractExecResult {
-            let exec_result =
-                Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data);
-            match exec_result {
-                Ok(v) => ContractExecResult::Success {
-                    status: v.status,
-                    data: v.data,
-                },
-                Err(_) => ContractExecResult::Error,
-            }
+			let (exec_result, gas_consumed) =
+				Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data);
+			match exec_result {
+				Ok(v) => ContractExecResult::Success {
+					flags: v.flags.bits(),
+					data: v.data,
+					gas_consumed: gas_consumed,
+				},
+				Err(_) => ContractExecResult::Error,
+			}
         }
 
         fn get_storage(
             address: AccountId,
             key: [u8; 32],
-        ) -> contracts_primitives::GetStorageResult {
+        ) -> pallet_contracts_primitives::GetStorageResult {
             Contracts::get_storage(address, key)
         }
 
         fn rent_projection(
             address: AccountId,
-        ) -> contracts_primitives::RentProjectionResult<BlockNumber> {
+        ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {
             Contracts::rent_projection(address)
         }
     }
@@ -471,29 +481,74 @@
         }
     }
 
-    impl fg_primitives::GrandpaApi<Block> for Runtime {
-        fn grandpa_authorities() -> GrandpaAuthorityList {
-            Grandpa::grandpa_authorities()
-        }
+	impl fg_primitives::GrandpaApi<Block> for Runtime {
+		fn grandpa_authorities() -> GrandpaAuthorityList {
+			Grandpa::grandpa_authorities()
+		}
 
-        fn submit_report_equivocation_extrinsic(
-            _equivocation_proof: fg_primitives::EquivocationProof<
-                <Block as BlockT>::Hash,
-                NumberFor<Block>,
-            >,
-            _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
-        ) -> Option<()> {
-            None
-        }
+		fn submit_report_equivocation_unsigned_extrinsic(
+			_equivocation_proof: fg_primitives::EquivocationProof<
+				<Block as BlockT>::Hash,
+				NumberFor<Block>,
+			>,
+			_key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
+		) -> Option<()> {
+			None
+		}
 
-        fn generate_key_ownership_proof(
-            _set_id: fg_primitives::SetId,
-            _authority_id: GrandpaId,
-        ) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
-            // NOTE: this is the only implementation possible since we've
-            // defined our key owner proof type as a bottom type (i.e. a type
-            // with no values).
-            None
-        }
+		fn generate_key_ownership_proof(
+			_set_id: fg_primitives::SetId,
+			_authority_id: GrandpaId,
+		) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
+			// NOTE: this is the only implementation possible since we've
+			// defined our key owner proof type as a bottom type (i.e. a type
+			// with no values).
+			None
+		}
     }
+    
+	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
+		fn account_nonce(account: AccountId) -> Index {
+			System::account_nonce(account)
+		}
+	}
+
+	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
+		fn query_info(
+			uxt: <Block as BlockT>::Extrinsic,
+			len: u32,
+		) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
+			TransactionPayment::query_info(uxt, len)
+		}
+	}
+
+    #[cfg(feature = "runtime-benchmarks")]
+	impl frame_benchmarking::Benchmark<Block> for Runtime {
+		fn dispatch_benchmark(
+			config: frame_benchmarking::BenchmarkConfig
+		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
+			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
+
+			let whitelist: Vec<TrackedStorageKey> = vec![
+				// Alice account
+				hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),
+				// // Total Issuance
+				// hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
+				// // Execution Phase
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
+				// // Event Count
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
+				// // System Events
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+            ];
+
+			let mut batches = Vec::<BenchmarkBatch>::new();
+			let params = (&config, &whitelist);
+
+			add_benchmark!(params, batches, pallet_nft, Nft);
+
+			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
+			Ok(batches)
+		}
+	}
 }
addedruntime/src/nft_weights.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/src/nft_weights.rs
@@ -0,0 +1,96 @@
+use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
+
+pub struct WeightInfo;
+impl pallet_nft::WeightInfo for WeightInfo {
+	fn create_collection() -> Weight {
+		(70_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(7 as Weight))
+			.saturating_add(DbWeight::get().writes(5 as Weight))
+	}
+	fn destroy_collection() -> Weight {
+		(90_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(2 as Weight))
+			.saturating_add(DbWeight::get().writes(5 as Weight))
+	}
+	fn add_to_white_list() -> Weight {
+		(30_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(3 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn remove_from_white_list() -> Weight {
+		(35_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(3 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn set_public_access_mode() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn set_mint_permission() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn change_collection_owner() -> Weight {
+		(27_000_000 as Weight)
+			.saturating_add(DbWeight::get().reads(1 as Weight))
+			.saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn add_collection_admin() -> Weight {
+        (32_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(3 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_admin() -> Weight {
+		(50_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn set_collection_sponsor() -> Weight {
+		(32_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn confirm_sponsorship() -> Weight {
+		(22_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(1 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn remove_collection_sponsor() -> Weight {
+		(24_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(1 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }  
+    fn create_item(s: usize, ) -> Weight {
+        (130_000_000 as Weight)
+            .saturating_add((2135 as Weight).saturating_mul(s as Weight))
+            .saturating_add(DbWeight::get().reads(10 as Weight))
+            .saturating_add(DbWeight::get().writes(8 as Weight))
+    }  
+    fn burn_item() -> Weight {
+		(170_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(9 as Weight))
+            .saturating_add(DbWeight::get().writes(7 as Weight))
+    }  
+    fn transfer() -> Weight {
+        (125_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(7 as Weight))
+            .saturating_add(DbWeight::get().writes(7 as Weight))
+    }  
+    fn approve() -> Weight {
+        (45_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(3 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+    fn transfer_from() -> Weight {
+        (150_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(9 as Weight))
+            .saturating_add(DbWeight::get().writes(8 as Weight))
+    }
+    fn set_offchain_schema() -> Weight {
+        (33_000_000 as Weight)
+            .saturating_add(DbWeight::get().reads(2 as Weight))
+            .saturating_add(DbWeight::get().writes(1 as Weight))
+    }
+}
modifiedtests/flipper-src/.gitignorediffbeforeafterboth
--- a/tests/flipper-src/.gitignore
+++ b/tests/flipper-src/.gitignore
@@ -6,4 +6,4 @@
 
 # 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
+Cargo.lock
\ No newline at end of file
deletedtests/flipper-src/.ink/abi_gen/Cargo.tomldiffbeforeafterboth
--- a/tests/flipper-src/.ink/abi_gen/Cargo.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-[package]
-name = "abi-gen"
-version = "0.1.0"
-authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
-publish = false
-
-[[bin]]
-name = "abi-gen"
-path = "main.rs"
-
-[dependencies]
-contract = { path = "../..", package = "flipper", default-features = false, features = ["ink-generate-abi"] }
-ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false, features = ["ink-generate-abi"] }
-serde = "1.0"
-serde_json = "1.0"
deletedtests/flipper-src/.ink/abi_gen/main.rsdiffbeforeafterboth
--- a/tests/flipper-src/.ink/abi_gen/main.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() -> Result<(), std::io::Error> {
-    let abi = <contract::Flipper as ink_lang::GenerateAbi>::generate_abi();
-    let contents = serde_json::to_string_pretty(&abi)?;
-    std::fs::create_dir("target").ok();
-    std::fs::write("target/metadata.json", contents)?;
-    Ok(())
-}
modifiedtests/flipper-src/Cargo.tomldiffbeforeafterboth
--- a/tests/flipper-src/Cargo.toml
+++ b/tests/flipper-src/Cargo.toml
@@ -1,67 +1,35 @@
 [package]
 name = "flipper"
-version = "0.1.0"
-authors = ["[your_name] <[your_email]>"]
+version = "3.0.0-rc1"
+authors = ["Parity Technologies <admin@parity.io>"]
 edition = "2018"
 
 [dependencies]
-ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }
-ink_primitives = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_primitives", default-features = false }
-ink_core = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_core", default-features = false }
-ink_lang = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_lang", default-features = false }
+ink_primitives = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }
+ink_metadata = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false, features = ["derive"], optional = true }
+ink_env = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }
+ink_storage = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }
+ink_lang = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }
 
-scale = { package = "parity-scale-codec", version = "1.2", default-features = false, features = ["derive"] }
-
-[dependencies.type-metadata]
-git = "https://github.com/type-metadata/type-metadata.git"
-rev = "02eae9f35c40c943b56af5b60616219f2b72b47d"
-default-features = false
-features = ["derive"]
-optional = true
+scale = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive"] }
+scale-info = { version = "0.4", default-features = false, features = ["derive"], optional = true }
 
 [lib]
 name = "flipper"
 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",
-]
+crate-type = ["cdylib"]
 
 [features]
-default = ["test-env"]
+default = ["std"]
 std = [
-    "ink_abi/std",
-    "ink_core/std",
     "ink_primitives/std",
+    "ink_metadata",
+    "ink_metadata/std",
+    "ink_env/std",
+    "ink_storage/std",
+    "ink_lang/std",
     "scale/std",
-    "type-metadata/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",
-]
-ink-as-dependency = []
-
-[profile.release]
-panic = "abort"
-lto = true
-opt-level = "z"
-overflow-checks = true
-
-[workspace]
-members = [
-	".ink/abi_gen"
+    "scale-info",
+    "scale-info/std",
 ]
-exclude = [
-	".ink"
-]
+ink-as-dependency = []
\ No newline at end of file
modifiedtests/flipper-src/build.shdiffbeforeafterboth
--- a/tests/flipper-src/build.sh
+++ b/tests/flipper-src/build.sh
@@ -1,2 +1,3 @@
+rustup component add rust-src --toolchain nightly
 cargo +nightly contract build
 cargo +nightly contract generate-metadata
modifiedtests/flipper-src/lib.rsdiffbeforeafterboth
--- a/tests/flipper-src/lib.rs
+++ b/tests/flipper-src/lib.rs
@@ -1,70 +1,64 @@
+// Copyright 2018-2020 Parity Technologies (UK) Ltd.
+//
+// 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.
+
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use ink_lang as ink;
 
-#[ink::contract(version = "0.1.0")]
-mod flipper {
-    use ink_core::storage;
-
-    /// 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::contract]
+pub mod flipper {
     #[ink(storage)]
-    struct Flipper {
-        /// Stores a single `bool` value on the storage.
-        value: storage::Value<bool>,
+    pub struct Flipper {
+        value: bool,
     }
 
     impl Flipper {
-        /// Constructor that initializes the `bool` value to the given `init_value`.
+        /// Creates a new flipper smart contract initialized with the given value.
         #[ink(constructor)]
-        fn new(&mut self, init_value: bool) {
-            self.value.set(init_value);
+        pub fn new(init_value: bool) -> Self {
+            Self { value: init_value }
         }
 
-        /// Constructor that initializes the `bool` value to `false`.
-        ///
-        /// Constructors can delegate to other constructors.
+        /// Creates a new flipper smart contract initialized to `false`.
         #[ink(constructor)]
-        fn default(&mut self) {
-            self.new(false)
+        pub fn default() -> Self {
+            Self::new(Default::default())
         }
 
-        /// A message that can be called on instantiated contracts.
-        /// This one flips the value of the stored `bool` from `true`
-        /// to `false` and vice versa.
+        /// Flips the current value of the Flipper's bool.
         #[ink(message)]
-        fn flip(&mut self) {
-            *self.value = !self.get();
+        pub fn flip(&mut self) {
+            self.value = !self.value;
         }
 
-        /// Simply returns the current value of our `bool`.
+        /// Returns the current value of the Flipper's bool.
         #[ink(message)]
-        fn get(&self) -> bool {
-            *self.value
+        pub fn get(&self) -> bool {
+            self.value
         }
     }
 
-    /// 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::*;
 
-        /// We test if the default constructor does its job.
         #[test]
         fn default_works() {
-            // Note that even though we defined our `#[ink(constructor)]`
-            // above as `&mut self` functions that return nothing we can call
-            // them in test code as if they were normal Rust constructors
-            // that take no `self` argument but return `Self`.
             let flipper = Flipper::default();
             assert_eq!(flipper.get(), false);
         }
 
-        /// We test a simple use case of our contract.
         #[test]
         fn it_works() {
             let mut flipper = Flipper::new(false);
@@ -73,4 +67,4 @@
             assert_eq!(flipper.get(), true);
         }
     }
-}
+}
\ No newline at end of file
modifiedtests/package-lock.jsondiffbeforeafterboth
--- a/tests/package-lock.json
+++ b/tests/package-lock.json
@@ -3916,282 +3916,143 @@
       }
     },
     "@polkadot/api": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz",
-      "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-2.3.1.tgz",
+      "integrity": "sha512-B9ZOb1PiPaAlke4wQHoivVQ5ZCQWn5bgLjhVIGdcEZ4WjIcxApmzTV4ruSfqVoRKpRiVOyV3Dx/VUQDD/WgBFw==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/api-derive": "1.34.1",
-        "@polkadot/keyring": "^3.4.1",
-        "@polkadot/metadata": "1.34.1",
-        "@polkadot/rpc-core": "1.34.1",
-        "@polkadot/rpc-provider": "1.34.1",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/types-known": "1.34.1",
-        "@polkadot/util": "^3.4.1",
-        "@polkadot/util-crypto": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/api-derive": "2.3.1",
+        "@polkadot/keyring": "^3.6.1",
+        "@polkadot/metadata": "2.3.1",
+        "@polkadot/rpc-core": "2.3.1",
+        "@polkadot/rpc-provider": "2.3.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/types-known": "2.3.1",
+        "@polkadot/util": "^3.6.1",
+        "@polkadot/util-crypto": "^3.6.1",
         "bn.js": "^5.1.3",
         "eventemitter3": "^4.0.7",
         "rxjs": "^6.6.3"
       },
       "dependencies": {
-        "@polkadot/metadata": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-          "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
-        "@polkadot/types": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-          "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@types/bn.js": "^4.11.6",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/types-known": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-          "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "bn.js": "^5.1.3"
+            "regenerator-runtime": "^0.13.4"
           }
         },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
     "@polkadot/api-contract": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-1.34.1.tgz",
-      "integrity": "sha512-oXh7An6E9wdbczXQhw+TfIkoKLQr4t0j3OwxubrhS5Qn6f99xGoAkk0BIKjsHPGIbMHEJoywmmLrDUAeTxExgg==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-2.3.1.tgz",
+      "integrity": "sha512-hqRU2mGkHK84dtqZSX71tFCuBmBiV/6H7pJwj5E7UPcd124LM2ETXYJ9T0ElxbAHmZQD7yv+2ZM/ncvGC/A68Q==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/api": "1.34.1",
-        "@polkadot/rpc-core": "1.34.1",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/util": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/api": "2.3.1",
+        "@polkadot/rpc-core": "2.3.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/util": "^3.6.1",
         "bn.js": "^5.1.3",
         "rxjs": "^6.6.3"
       },
       "dependencies": {
-        "@polkadot/api": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-1.34.1.tgz",
-          "integrity": "sha512-3gCibNRchH+XbEdULS1bwiV1RgarZW1PDw1Y1mAQBVqPrUpkYqntp1D52SQOpAbRzldkwk296Sj+mx9/IeDRXA==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/api-derive": "1.34.1",
-            "@polkadot/keyring": "^3.4.1",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/rpc-core": "1.34.1",
-            "@polkadot/rpc-provider": "1.34.1",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3",
-            "eventemitter3": "^4.0.7",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/api-derive": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz",
-          "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/api": "1.34.1",
-            "@polkadot/rpc-core": "1.34.1",
-            "@polkadot/rpc-provider": "1.34.1",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/metadata": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-          "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
-        "@polkadot/rpc-core": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz",
-          "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/rpc-provider": "1.34.1",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/rpc-provider": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz",
-          "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@polkadot/x-fetch": "^0.3.2",
-            "@polkadot/x-ws": "^0.3.2",
-            "bn.js": "^5.1.3",
-            "eventemitter3": "^4.0.7"
-          }
-        },
-        "@polkadot/types": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-          "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@types/bn.js": "^4.11.6",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/types-known": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-          "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "bn.js": "^5.1.3"
+            "regenerator-runtime": "^0.13.4"
           }
         },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
     "@polkadot/api-derive": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-1.34.1.tgz",
-      "integrity": "sha512-LMlCkNJRp29MwKa36crYuY6cZpnkHCFrPCv9dmJEuDbMqrK+EAhXM9/6sTDYJ4uKNhyetJKe9rXslkXdI6pidA==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-2.3.1.tgz",
+      "integrity": "sha512-FcDEx+/1Io7zOHPjbQAEzXB0KenA9emgY+96aHS4yPV/OVmAifU0IAxudZdMVp7uVC2dWq9iFvjxx84yCXgVRA==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/api": "1.34.1",
-        "@polkadot/rpc-core": "1.34.1",
-        "@polkadot/rpc-provider": "1.34.1",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/util": "^3.4.1",
-        "@polkadot/util-crypto": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/api": "2.3.1",
+        "@polkadot/rpc-core": "2.3.1",
+        "@polkadot/rpc-provider": "2.3.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/util": "^3.6.1",
+        "@polkadot/util-crypto": "^3.6.1",
         "bn.js": "^5.1.3",
         "memoizee": "^0.4.14",
         "rxjs": "^6.6.3"
       },
       "dependencies": {
-        "@polkadot/metadata": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-          "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
-        "@polkadot/types": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-          "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@types/bn.js": "^4.11.6",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/types-known": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-          "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "bn.js": "^5.1.3"
+            "regenerator-runtime": "^0.13.4"
           }
         },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
@@ -4277,193 +4138,193 @@
       }
     },
     "@polkadot/keyring": {
-      "version": "3.4.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.4.1.tgz",
-      "integrity": "sha512-x8FxzDzyFX5ai+tnPaxAFUBV/2Mw/om8sRoMh+fT6Jzh3nC7pXfecH5ticJPKe73v/y42hn9xM0tiAI5P8Ohcw==",
+      "version": "3.6.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-3.6.1.tgz",
+      "integrity": "sha512-JbW4M5Ct3HaX3vgoa/UWAQVF/0sc1PbbA2D6v0KKaJkXl+EYVP9uyOYAoRCppB6ENZThz7CUJVQp8trs8WTrFQ==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/util": "3.4.1",
-        "@polkadot/util-crypto": "3.4.1"
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/util": "3.6.1",
+        "@polkadot/util-crypto": "3.6.1"
       },
       "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
     "@polkadot/metadata": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-      "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-2.3.1.tgz",
+      "integrity": "sha512-F/QwDDR/d9mcqToDqndRTUYvMt/GYzjQ+kNGjQYBOIDRqF9zDbPHAXruqcHd0Y5MMpPMRBZGNaqPOb3BMrIdOQ==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/types-known": "1.34.1",
-        "@polkadot/util": "^3.4.1",
-        "@polkadot/util-crypto": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/types-known": "2.3.1",
+        "@polkadot/util": "^3.6.1",
+        "@polkadot/util-crypto": "^3.6.1",
         "bn.js": "^5.1.3"
       },
       "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
+    "@polkadot/networks": {
+      "version": "3.6.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-3.6.1.tgz",
+      "integrity": "sha512-PEEw/vTZaKf32vuAUeFXYNJei+b/s3hr7msMKfvoYeKDU/otgt9Mgkqrh6VCaE6+lHHgX8vLbH70pCqQrGG/uA==",
+      "requires": {
+        "@babel/runtime": "^7.12.1"
+      },
+      "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        }
+      }
+    },
     "@polkadot/rpc-core": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-1.34.1.tgz",
-      "integrity": "sha512-BVQDyBEkbRe5b/u8p9UPpTCj0sDZ32sTmPEP43Klc4s9+oHtiNvOFYvkjK5oyW9dlcOwXi8HpLsQxGAeMtM7Tw==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-2.3.1.tgz",
+      "integrity": "sha512-SWYU6azxNwWkhz6bm/wpRPQZ/5KJ2hnEXPS4EN77q7EFH4c4k9mNtVyjUQFkKJsG7T85vxaCCWwhx60aYCZVeA==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/metadata": "1.34.1",
-        "@polkadot/rpc-provider": "1.34.1",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/util": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/metadata": "2.3.1",
+        "@polkadot/rpc-provider": "2.3.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/util": "^3.6.1",
         "memoizee": "^0.4.14",
         "rxjs": "^6.6.3"
       },
       "dependencies": {
-        "@polkadot/metadata": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-          "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
-        "@polkadot/types": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-          "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@types/bn.js": "^4.11.6",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
+            "regenerator-runtime": "^0.13.4"
           }
         },
-        "@polkadot/types-known": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-          "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
     "@polkadot/rpc-provider": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-1.34.1.tgz",
-      "integrity": "sha512-bebeis9mB4LS9Spk1WSHoadZHsyHmK4gyyC6uKSLZxHZmnopWna6zWnOBIrYHRz7qDHSZC5eNTseuU8NJXtscA==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-2.3.1.tgz",
+      "integrity": "sha512-lRN68RosWvtBA844PWqhYEV2ifT3T9SUyAP2WvRYyWVPiMmXjw57qG1zHKQWgZk5aFzeaHKSYgsKTmkWz9IM4g==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/metadata": "1.34.1",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/util": "^3.4.1",
-        "@polkadot/util-crypto": "^3.4.1",
-        "@polkadot/x-fetch": "^0.3.2",
-        "@polkadot/x-ws": "^0.3.2",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/metadata": "2.3.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/util": "^3.6.1",
+        "@polkadot/util-crypto": "^3.6.1",
+        "@polkadot/x-fetch": "^0.3.3",
+        "@polkadot/x-ws": "^0.3.3",
         "bn.js": "^5.1.3",
         "eventemitter3": "^4.0.7"
       },
       "dependencies": {
-        "@polkadot/metadata": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/metadata/-/metadata-1.34.1.tgz",
-          "integrity": "sha512-uoaOhNHjECDaLBYvGRaLvF0mhZBFmsV3oikYDP4sZx3a5oD0xYsyXtr5bFPQDImwPFASP8/ltrMVqcYTX42xFg==",
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/types-known": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "bn.js": "^5.1.3"
-          }
-        },
-        "@polkadot/types": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-          "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/metadata": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "@polkadot/util-crypto": "^3.4.1",
-            "@types/bn.js": "^4.11.6",
-            "bn.js": "^5.1.3",
-            "memoizee": "^0.4.14",
-            "rxjs": "^6.6.3"
-          }
-        },
-        "@polkadot/types-known": {
-          "version": "1.34.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-          "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
-          "requires": {
-            "@babel/runtime": "^7.11.2",
-            "@polkadot/types": "1.34.1",
-            "@polkadot/util": "^3.4.1",
-            "bn.js": "^5.1.3"
+            "regenerator-runtime": "^0.13.4"
           }
         },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
@@ -4477,58 +4338,88 @@
       }
     },
     "@polkadot/types": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-1.34.1.tgz",
-      "integrity": "sha512-jPwix2y+ZXKYB4ghODXlqYmcI3Tnsl3iO3xIkiGsZhhs9PdrKibcNeAv4LUiRpPuGRnAM+mrlPrBbCuzguKSGg==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-2.3.1.tgz",
+      "integrity": "sha512-G3cyYYV+vYmpkMjPirwOA/zLreb1uBrKpEMWTvtTuCz/sNwcbCT5hI/KZCzNo1PueOQAowroKPe4yQ793dqVPw==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/metadata": "1.34.1",
-        "@polkadot/util": "^3.4.1",
-        "@polkadot/util-crypto": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/metadata": "2.3.1",
+        "@polkadot/util": "^3.6.1",
+        "@polkadot/util-crypto": "^3.6.1",
         "@types/bn.js": "^4.11.6",
         "bn.js": "^5.1.3",
         "memoizee": "^0.4.14",
         "rxjs": "^6.6.3"
       },
       "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
     "@polkadot/types-known": {
-      "version": "1.34.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-1.34.1.tgz",
-      "integrity": "sha512-H9V8u9cqbKjxU/dxEyLl7kJwoBImXpRskQ5+X0fq3BH7g1nQ6jrIg/buRPpbc3GxKivdFYUZWshPY9hbqE8y8A==",
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-2.3.1.tgz",
+      "integrity": "sha512-34yuvDraW9Sjy5ookQZf55sBKLOsTqos+WQdTu6DUxtRuwvMP9DEAGcs2m6AFvWxwZps+3zFGUvzn6SMHsSJ5Q==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/types": "1.34.1",
-        "@polkadot/util": "^3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/types": "2.3.1",
+        "@polkadot/util": "^3.6.1",
         "bn.js": "^5.1.3"
       },
       "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
@@ -4546,12 +4437,13 @@
       }
     },
     "@polkadot/util-crypto": {
-      "version": "3.4.1",
-      "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.4.1.tgz",
-      "integrity": "sha512-RdTAiJ6dFE8nQJ7/wQkvYa6aNZG3Lusf/r7UmPJ56dZldvDTP3OdekzcfYdogU8hSJrE/xX84ii4DrHLnXXfAQ==",
+      "version": "3.6.1",
+      "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-3.6.1.tgz",
+      "integrity": "sha512-mRCijOXrxTa2JD5vpNvr1MHSj3NaSGaImg1yzAf3l7nw7zNGjLy1K3qQNcFgr8+0NHyPKk5lCIehtwGTRZYsiA==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
-        "@polkadot/util": "3.4.1",
+        "@babel/runtime": "^7.12.1",
+        "@polkadot/networks": "3.6.1",
+        "@polkadot/util": "3.6.1",
         "@polkadot/wasm-crypto": "^1.4.1",
         "base-x": "^3.0.8",
         "bip39": "^3.0.2",
@@ -4565,18 +4457,33 @@
         "xxhashjs": "^0.2.2"
       },
       "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        },
         "@polkadot/util": {
-          "version": "3.4.1",
-          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.4.1.tgz",
-          "integrity": "sha512-CJo0wAzXR8vjAzs9mHDooZr5a3XRW8LlYWik8d/+bv1VDwCC/metSiBrYBOapFhYUjlS5IYIw5bhWS5dnpkXvQ==",
+          "version": "3.6.1",
+          "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-3.6.1.tgz",
+          "integrity": "sha512-ToGVghmTtC8s8cg8mCGG3I88UasrCg9VNm5JoUvBH4nTZCxc/dQEkU24nULXwHUpmd7d39p3RLpVbkLCVYIMZw==",
           "requires": {
-            "@babel/runtime": "^7.11.2",
+            "@babel/runtime": "^7.12.1",
+            "@polkadot/x-textdecoder": "^0.3.3",
+            "@polkadot/x-textencoder": "^0.3.3",
             "@types/bn.js": "^4.11.6",
             "bn.js": "^5.1.3",
             "camelcase": "^5.3.1",
             "chalk": "^4.1.0",
-            "ip-regex": "^4.1.0"
+            "ip-regex": "^4.2.0"
           }
+        },
+        "ip-regex": {
+          "version": "4.2.0",
+          "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz",
+          "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A=="
         }
       }
     },
@@ -4586,30 +4493,79 @@
       "integrity": "sha512-GPBCh8YvQmA5bobI4rqRkUhrEHkEWU1+lcJVPbZYsa7jiHFaZpzCLrGQfiqW/vtbU1aBS2wmJ0x1nlt33B9QqQ=="
     },
     "@polkadot/x-fetch": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.2.tgz",
-      "integrity": "sha512-lk9M8ql/kBBqiZ8KOWj7LFK7P9OxDgVn2fZPNELJzQbfFZwFF8umBPDIWlQIK7wTnlRsQlzOuf6MGEyMK5p42w==",
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-0.3.3.tgz",
+      "integrity": "sha512-Osa+ifkqlndIW5U5jLnuugLYTd6q/cHkjdfisyYgNev/etsEtXkqesbGvF/UKw5FgZBxhK8sj6jjfProfh2NZw==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
+        "@babel/runtime": "^7.12.1",
         "@types/node-fetch": "^2.5.7",
         "node-fetch": "^2.6.1"
       },
       "dependencies": {
-        "node-fetch": {
-          "version": "2.6.1",
-          "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
-          "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        }
+      }
+    },
+    "@polkadot/x-textdecoder": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-0.3.3.tgz",
+      "integrity": "sha512-ehbPUUNn34kJh/RV8eQwyLnAFcMQSbtGPKqGRB7GSa/bL7P6hh1QGxB4DwvtlFU//bDTlofsv44ydpjDNmfWLg==",
+      "requires": {
+        "@babel/runtime": "^7.12.1"
+      },
+      "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        }
+      }
+    },
+    "@polkadot/x-textencoder": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-0.3.3.tgz",
+      "integrity": "sha512-klbz82L5LxDJTFoCO64G/EFfY1mKXHDlteJMDGFTOim/1oK1ypLOG8/7BmncmQAw2BevA0r1YkvWN+F3muJSag==",
+      "requires": {
+        "@babel/runtime": "^7.12.1"
+      },
+      "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
         }
       }
     },
     "@polkadot/x-ws": {
-      "version": "0.3.2",
-      "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.2.tgz",
-      "integrity": "sha512-1aiG11Py8sgzJsz19melMzvBOn5zeMmfjCPoMryX4//063E0mcfnkujg4O6pTMygxJdFGAV1INB9wvMU9Dg9Wg==",
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-0.3.3.tgz",
+      "integrity": "sha512-t06ID5QLYi5B8bzlT2fcYsQ09yfLf5Uq9idunKRZj13EwSELaqvZFfn2UmiDFiIB1H5u7c2y+VDWbIdqE8ZxKw==",
       "requires": {
-        "@babel/runtime": "^7.11.2",
+        "@babel/runtime": "^7.12.1",
         "@types/websocket": "^1.0.1",
         "websocket": "^1.0.32"
+      },
+      "dependencies": {
+        "@babel/runtime": {
+          "version": "7.12.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
+          "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
+          "requires": {
+            "regenerator-runtime": "^0.13.4"
+          }
+        }
       }
     },
     "@sindresorhus/is": {
@@ -16840,6 +16796,11 @@
         "lower-case": "^1.1.1"
       }
     },
+    "node-fetch": {
+      "version": "2.6.1",
+      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
+      "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
+    },
     "node-fetch-npm": {
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz",
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -23,9 +23,9 @@
   "license": "Apache 2.0",
   "homepage": "",
   "dependencies": {
-    "@polkadot/api": "^1.34.1",
-    "@polkadot/api-contract": "^1.34.1",
-    "@polkadot/types": "^1.34.1",
+    "@polkadot/api": "^2.3.1",
+    "@polkadot/api-contract": "^2.3.1",
+    "@polkadot/types": "^2.3.1",
     "@polkadot/util": "^3.4.1",
     "@types/bn.js": "^4.11.6",
     "chai-as-promised": "^7.1.1"
modifiedtests/src/contracts.test.tsdiffbeforeafterboth
--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -1,129 +1,91 @@
 import { expect } from "chai";
 import usingApi from "./substrate/substrate-api";
-import promisifySubstrate from "./substrate/promisify-substrate";
 import fs from "fs";
-import privateKey from "./substrate/privateKey";
-import { compactAddLength, u8aToU8a } from '@polkadot/util';
-import { Hash, AccountId } from "@polkadot/types/interfaces";
-import { Abi, PromiseContract } from "@polkadot/api-contract";
-import { ISubmittableResult, IKeyringPair } from "@polkadot/types/types";
-import BN from "bn.js";
-import { alicesPublicKey, bobsPublicKey } from "./accounts";
-import { ApiPromise } from "@polkadot/api";
-import { GenericAccountId, u128 } from "@polkadot/types";
-import getBalance from "./substrate/get-balance";
+import { Abi, BlueprintPromise, CodePromise } from "@polkadot/api-contract";
+import { IKeyringPair } from "@polkadot/types/types";
+import { Keyring } from "@polkadot/api";
+import { ApiTypes, SubmittableExtrinsic } from "@polkadot/api/types";
 
+const value = 0;
+const gasLimit = 3000n * 1000000n;
 
-function deployContract(api: ApiPromise, contract: Uint8Array, privateKey: IKeyringPair): Promise<Hash> {
-  return promisifySubstrate(api, () => {
-    return new Promise<Hash>(async (resolve, reject) => {
-      const unsubscribe = api.tx.contracts.putCode(contract).signAndSend(privateKey, async result => {
-        if(!result.isInBlock){
-          return;
+function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<BlueprintPromise> {
+  return new Promise<BlueprintPromise>(async (resolve, reject) => {
+    const unsub = await code
+      .createBlueprint()
+      .signAndSend(alice, (result) => {
+        if (result.status.isInBlock || result.status.isFinalized) {
+          // here we have an additional field in the result, containing the blueprint
+          resolve(result.blueprint);
+          unsub();
         }
+      })
+  });
+}
 
-        const record = result.findRecord('contracts', 'CodeStored');
+function deployContract(alice: IKeyringPair, blueprint: BlueprintPromise) : Promise<any> {
+  return new Promise<any>(async (resolve, reject) => {
+    const endowment = 1000000000000000n;
+    const initValue = true;
 
-        if(record) {
-          (await unsubscribe)();
-          resolve(record.event.data[0] as unknown as Hash);
-        } else {
-          reject('Failed to find contract hash in putCode transaction result.');
-        }
-      });
-    })
-  })();
+    const unsub = await blueprint.tx
+    .new(endowment, gasLimit, initValue)
+    .signAndSend(alice, (result) => {
+      if (result.status.isInBlock || result.status.isFinalized) {
+        unsub();
+        resolve(result);
+      }
+    });    
+  });
 }
 
-function instantiateContract(api: ApiPromise, contractHash: Hash, args: Uint8Array, privateKey: IKeyringPair): Promise<AccountId> {
-  return promisifySubstrate(api, () => {
-    return new Promise<AccountId>((resolve, reject) => {
-      const unsubscribe = api.tx.contracts.instantiate(1000000000000000n, 1000000000000n, contractHash, args)
-        .signAndSend(privateKey, async (result:ISubmittableResult) => {
-          if(!result.isInBlock) {
-            return;
-          }
-          const record = result.findRecord('contracts', 'Instantiated');
-          if(record) {
-            (await unsubscribe)();
-            expect(alicesPublicKey).to.be.equal(record.event.data[0].toString());
-            resolve(record.event.data[1] as AccountId);
-          } else {
-            reject('Failed to find instantiated event.');
-          }
-        });
-    });
-  })();
-}
-
-function txContractCall(api: ApiPromise, privateKey: IKeyringPair, address: string, call: Uint8Array): Promise<void> {
-  return promisifySubstrate(api, async () => {
-    return new Promise<void>(async (resolve, reject) => {
-      api.tx.contracts.call(address, 0, 1000000000000n, call)
-        .signAndSend(privateKey, async result => {
-          if(!result.isInBlock) {
-            return;
-          }
+function runTransaction(privateKey: IKeyringPair, extrinsic: SubmittableExtrinsic<ApiTypes>) {
+  return new Promise<void>(async (resolve, reject) => {
+    extrinsic.signAndSend(privateKey, async result => {
+        if(!result.isInBlock) {
+          return;
+        }
 
-          if(result.findRecord('system', 'ExtrinsicSuccess')) {
-            resolve();
-          }
-          else {
-            reject('Failed to execute tx call.');
-          }
-        })
-    });
-  })();
+        if(result.findRecord('system', 'ExtrinsicSuccess')) {
+          resolve();
+        }
+        else {
+          reject('Failed to flip value.');
+        }
+      })
+  });
 }
 
 describe('Contracts', () => {
   it(`Can deploy smart contract Flipper, instantiate it and call it's get and flip messages.`, async () => {
     await usingApi(async api => {
+      const keyring = new Keyring({ type: 'sr25519' });
+      const alice = keyring.addFromUri("//Alice");
+      
       const wasm = fs.readFileSync('./src/flipper/flipper.wasm');
-      const contract = compactAddLength(u8aToU8a(wasm));
-
+      
       const metadata = JSON.parse(fs.readFileSync('./src/flipper/metadata.json').toString('utf-8'));
-      const abi = new Abi(api.registry as any, metadata);
+      const abi = new Abi(metadata);
 
-      const alicesPrivateKey = privateKey('//Alice');
+      const code = new CodePromise(api, abi, wasm);
 
-      const contractHash = await deployContract(api, contract, alicesPrivateKey);
-
-      const args = abi.constructors[0](true);
-      const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey);
+      const blueprint = await deployBlueprint(alice, code);
+      const contract = (await deployContract(alice, blueprint))['contract'];
 
-      const contractInstance = new PromiseContract(api, abi, instanceAccountId);
       const getFlipValue = async () => {
-        return await promisifySubstrate(api, async () => {
-          const result = await contractInstance.call('rpc', 'get', 0, new BN('1000000000000'))
-            .send(alicesPublicKey);
-          if(!result.isSuccess) {
-            throw 'Failed to get flipper value';
-          }
-          return result.output && result.output.valueOf && result.output.valueOf();
-        })();
+        const result = await contract.query.get(alice.address, value, gasLimit);
+
+        if(!result.result.isSuccess) {
+          throw `Failed to get flipper value`;
+        }
+        return (result.result.asSuccess.data[0] == 0x00) ? false : true;
       }
 
       const initialGetResponse = await getFlipValue();
       expect(initialGetResponse).to.be.true;
 
-      await promisifySubstrate(api, async () => {
-        return new Promise<void>(async (resolve, reject) => {
-          api.tx.contracts.call(contractInstance.address.toString(), 0, 1000000000000n, contractInstance.getMessage('flip').fn())
-            .signAndSend(alicesPrivateKey, async result => {
-              if(!result.isInBlock) {
-                return;
-              }
-
-              if(result.findRecord('system', 'ExtrinsicSuccess')) {
-                resolve();
-              }
-              else {
-                reject('Failed to flip value.');
-              }
-            })
-        });
-      })();
+      const flip = contract.exec('flip', value, gasLimit);
+      await runTransaction(alice, flip);
 
       const afterFlipGetResponse = await getFlipValue();
 
@@ -131,30 +93,31 @@
     });
   });
 
-  it('Can transfer balance using smart contract.', async () => {
+  it.skip('Can transfer balance using smart contract.', async () => {
     await usingApi(async api => {
-      const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
-      const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm');
-      const contract = compactAddLength(u8aToU8a(wasm));
+      // const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
+      // const wasm = fs.readFileSync('./src/balance-transfer-contract/calls.wasm');
+      // const contract = compactAddLength(u8aToU8a(wasm));
+
+      // const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8'));
+      // const abi = new Abi(api.registry as any, metadata);
 
-      const metadata = JSON.parse(fs.readFileSync('./src/balance-transfer-contract/metadata.json').toString('utf-8'));
-      const abi = new Abi(api.registry as any, metadata);
+      // const alicesPrivateKey = privateKey('//Alice');
 
-      const alicesPrivateKey = privateKey('//Alice');
+      // const contractHash = await deployContract(api, contract, alicesPrivateKey);
 
-      const contractHash = await deployContract(api, contract, alicesPrivateKey);
+      // // const args = abi.constructors[0]();
+      // const instanceAccountId = await instantiateContract(api, contractHash, /*args,*/ alicesPrivateKey);
+      // const contractInstance = new ContractPromise(api, abi, instanceAccountId);
+      // const bob = new GenericAccountId(api.registry, bobsPublicKey);
 
-      const args = abi.constructors[0]();
-      const instanceAccountId = await instantiateContract(api, contractHash, args, alicesPrivateKey);
-      const contractInstance = new PromiseContract(api, abi, instanceAccountId);
-      const bob = new GenericAccountId(api.registry, bobsPublicKey);
-      const call = contractInstance.getMessage('balance_transfer').fn(bob, new u128(api.registry, 1000000));
-      await txContractCall(api, alicesPrivateKey, contractInstance.address.toString(), call);
+      // const transfer = contractInstance.exec('balance_transfer', 0, 1000000000000n, [bob, new u128(api.registry, 1000000)]);
+      // await runTransaction(alicesPrivateKey, transfer);
 
-      const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
+      // const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
 
-      expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true;
-      expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true;
+      // expect(alicesBalanceAfter < alicesBalanceBefore).to.be.true;
+      // expect(bobsBalanceAfter > bobsBalanceBefore).to.be.true;
     });
   })
 });
modifiedtests/src/flipper/flipper.wasmdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/flipper/metadata.jsondiffbeforeafterboth
--- a/tests/src/flipper/metadata.json
+++ b/tests/src/flipper/metadata.json
@@ -1,204 +1,106 @@
 {
-  "registry": {
-    "strings": [
-      "Storage",
-      "flipper",
-      "__ink_private",
-      "__ink_storage",
-      "value",
-      "Value",
-      "ink_core",
-      "storage",
-      "cell",
-      "SyncCell",
-      "sync_cell",
-      "Key",
-      "ink_primitives",
-      "new",
-      "init_value",
-      "bool",
-      "default",
-      "flip",
-      "get"
-    ],
-    "types": [
-      {
-        "id": {
-          "custom.name": 1,
-          "custom.namespace": [
-            2,
-            2,
-            3,
-            4
-          ],
-          "custom.params": []
-        },
-        "def": {
-          "struct.fields": [
-            {
-              "name": 5,
-              "type": 2
-            }
-          ]
-        }
-      },
-      {
-        "id": {
-          "custom.name": 6,
-          "custom.namespace": [
-            7,
-            8,
-            5
-          ],
-          "custom.params": [
-            3
-          ]
-        },
-        "def": {
-          "struct.fields": [
-            {
-              "name": 9,
-              "type": 4
-            }
-          ]
-        }
-      },
-      {
-        "id": "bool",
-        "def": "builtin"
-      },
-      {
-        "id": {
-          "custom.name": 10,
-          "custom.namespace": [
-            7,
-            8,
-            9,
-            11
-          ],
-          "custom.params": [
-            3
-          ]
-        },
-        "def": {
-          "struct.fields": [
-            {
-              "name": 9,
-              "type": 5
-            }
-          ]
-        }
-      },
-      {
-        "id": {
-          "custom.name": 12,
-          "custom.namespace": [
-            13
-          ],
-          "custom.params": []
-        },
-        "def": {
-          "tuple_struct.types": [
-            6
-          ]
-        }
-      },
-      {
-        "id": {
-          "array.len": 32,
-          "array.type": 7
-        },
-        "def": "builtin"
-      },
-      {
-        "id": "u8",
-        "def": "builtin"
-      }
-    ]
+  "metadataVersion": "0.1.0",
+  "source": {
+    "hash": "0x36431d9da78a6bb099474e49c9e35a9c3a04272b58815634082626109826cac6",
+    "language": "ink! 3.0.0-rc1",
+    "compiler": "rustc 1.49.0-nightly"
   },
-  "storage": {
-    "struct.type": 1,
-    "struct.fields": [
-      {
-        "name": 5,
-        "layout": {
-          "struct.type": 2,
-          "struct.fields": [
-            {
-              "name": 9,
-              "layout": {
-                "range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
-                "range.len": 1,
-                "range.elem_type": 3
-              }
-            }
-          ]
-        }
-      }
+  "contract": {
+    "name": "flipper",
+    "version": "3.0.0-rc1",
+    "authors": [
+      "Parity Technologies <admin@parity.io>"
     ]
   },
-  "contract": {
-    "name": 2,
+  "spec": {
     "constructors": [
       {
-        "name": 14,
-        "selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
         "args": [
           {
-            "name": 15,
+            "name": "init_value",
             "type": {
-              "ty": 3,
-              "display_name": [
-                16
-              ]
+              "displayName": [
+                "bool"
+              ],
+              "type": 1
             }
           }
         ],
         "docs": [
-          "Constructor that initializes the `bool` value to the given `init_value`."
-        ]
+          " Creates a new flipper smart contract initialized with the given value."
+        ],
+        "name": [
+          "new"
+        ],
+        "selector": "0xd183512b"
       },
       {
-        "name": 17,
-        "selector": "[\"0x02\",\"0x22\",\"0xFF\",\"0x18\"]",
         "args": [],
         "docs": [
-          "Constructor that initializes the `bool` value to `false`.",
-          "",
-          "Constructors can delegate to other constructors."
-        ]
+          " Creates a new flipper smart contract initialized to `false`."
+        ],
+        "name": [
+          "default"
+        ],
+        "selector": "0x6a3712e2"
       }
     ],
+    "docs": [],
+    "events": [],
     "messages": [
       {
-        "name": 18,
-        "selector": "[\"0x8C\",\"0x97\",\"0xDB\",\"0x39\"]",
-        "mutates": true,
         "args": [],
-        "return_type": null,
         "docs": [
-          "A message that can be called on instantiated contracts.",
-          "This one flips the value of the stored `bool` from `true`",
-          "to `false` and vice versa."
-        ]
+          " Flips the current value of the Flipper's bool."
+        ],
+        "mutates": true,
+        "name": [
+          "flip"
+        ],
+        "payable": false,
+        "returnType": null,
+        "selector": "0xc096a5f3"
       },
       {
-        "name": 19,
-        "selector": "[\"0x25\",\"0x44\",\"0x4A\",\"0xFE\"]",
-        "mutates": false,
         "args": [],
-        "return_type": {
-          "ty": 3,
-          "display_name": [
-            16
-          ]
-        },
         "docs": [
-          "Simply returns the current value of our `bool`."
-        ]
+          " Returns the current value of the Flipper's bool."
+        ],
+        "mutates": false,
+        "name": [
+          "get"
+        ],
+        "payable": false,
+        "returnType": {
+          "displayName": [
+            "bool"
+          ],
+          "type": 1
+        },
+        "selector": "0x1e5ca456"
       }
-    ],
-    "events": [],
-    "docs": []
-  }
+    ]
+  },
+  "storage": {
+    "struct": {
+      "fields": [
+        {
+          "layout": {
+            "cell": {
+              "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
+              "ty": 1
+            }
+          },
+          "name": "value"
+        }
+      ]
+    }
+  },
+  "types": [
+    {
+      "def": {
+        "primitive": "bool"
+      }
+    }
+  ]
 }
\ No newline at end of file