diff --git a/Cargo.lock b/Cargo.lock index 4855698ca48..d751091be1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1179,7 +1179,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1203,7 +1203,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "async-trait", "dyn-clone", @@ -1228,7 +1228,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1253,7 +1253,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "derive_more", "futures 0.3.13", @@ -1277,7 +1277,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-client-collator", "cumulus-client-consensus-common", @@ -1302,7 +1302,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", @@ -1328,10 +1328,25 @@ dependencies = [ "trie-db", ] +[[package]] +name = "cumulus-pallet-xcm-handler" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "sp-std", + "xcm", + "xcm-executor", +] + [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "impl-trait-for-tuples 0.2.1", "parity-scale-codec", @@ -1346,7 +1361,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -1364,7 +1379,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#10887b728c563329845192915069a094b3f06139" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2022,7 +2037,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", ] @@ -2098,7 +2113,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "3.1.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -2140,7 +2155,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -2153,7 +2168,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -2169,7 +2184,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "serde", @@ -2180,7 +2195,7 @@ dependencies = [ [[package]] name = "frame-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "bitflags", "frame-metadata", @@ -2206,7 +2221,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2218,7 +2233,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", @@ -2230,7 +2245,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro2", "quote", @@ -2240,7 +2255,7 @@ dependencies = [ [[package]] name = "frame-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "impl-trait-for-tuples 0.2.1", @@ -2257,7 +2272,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-api", @@ -2266,7 +2281,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "parity-scale-codec", @@ -2757,6 +2772,19 @@ dependencies = [ "hmac 0.7.1", ] +[[package]] +name = "hrmp-channels" +version = "0.1.0" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "sp-runtime", + "sp-std", + "xcm", +] + [[package]] name = "http" version = "0.1.21" @@ -3382,7 +3410,7 @@ dependencies = [ [[package]] name = "kusama-runtime" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "frame-executive", @@ -4179,8 +4207,9 @@ dependencies = [ [[package]] name = "metered-channel" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ + "derive_more", "futures 0.3.13", "futures-timer 3.0.2", ] @@ -4333,7 +4362,7 @@ dependencies = [ "moonbeam-rpc-primitives-txpool", "moonbeam-rpc-txpool", "moonbeam-runtime", - "nix 0.17.0", + "nix", "pallet-ethereum", "pallet-evm", "pallet-sudo", @@ -4443,6 +4472,7 @@ dependencies = [ "account", "author-inherent", "cumulus-pallet-parachain-system", + "cumulus-pallet-xcm-handler", "cumulus-primitives-core", "fp-rpc", "frame-executive", @@ -4450,6 +4480,7 @@ dependencies = [ "frame-system", "frame-system-rpc-runtime-api", "hex-literal", + "hrmp-channels", "log", "moonbeam-rpc-primitives-txpool", "pallet-author-filter", @@ -4468,6 +4499,7 @@ dependencies = [ "parachain-info", "parachain-staking", "parity-scale-codec", + "polkadot-parachain", "precompiles", "serde", "sp-api", @@ -4482,6 +4514,11 @@ dependencies = [ "sp-transaction-pool", "sp-version", "substrate-wasm-builder 4.0.0", + "token-factory", + "xcm", + "xcm-builder", + "xcm-executor", + "xtransfer", ] [[package]] @@ -4613,18 +4650,6 @@ dependencies = [ "void", ] -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nodrop" version = "0.1.14" @@ -4860,7 +4885,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -4876,7 +4901,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -4891,7 +4916,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4915,7 +4940,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4930,7 +4955,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -4944,7 +4969,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -4960,7 +4985,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4975,7 +5000,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-election-provider-support", "frame-support", @@ -4994,7 +5019,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5109,7 +5134,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -5131,7 +5156,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5147,7 +5172,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5166,7 +5191,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5182,7 +5207,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5196,7 +5221,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5211,7 +5236,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5225,7 +5250,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5241,7 +5266,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5256,7 +5281,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5269,7 +5294,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "enumflags2", "frame-support", @@ -5284,7 +5309,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -5300,7 +5325,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5320,7 +5345,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5334,7 +5359,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-election-provider-support", "frame-support", @@ -5357,7 +5382,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -5368,7 +5393,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5382,7 +5407,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-benchmarking", "frame-support", @@ -5400,7 +5425,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5414,7 +5439,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5430,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "jsonrpc-core 15.1.0", "jsonrpc-core-client 15.1.0", @@ -5447,7 +5472,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5458,7 +5483,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5473,7 +5498,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-support", "frame-system", @@ -5488,7 +5513,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "enumflags2", "frame-support", @@ -5501,7 +5526,8 @@ dependencies = [ [[package]] name = "parachain-info" -version = "0.6.0" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus?branch=rococo-v1#9d89ed653217203810822483ae86fd8867f59620" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -5971,7 +5997,7 @@ checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" [[package]] name = "polkadot-approval-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-network-protocol", @@ -5985,7 +6011,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "parity-scale-codec", @@ -5999,7 +6025,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "lru", @@ -6021,18 +6047,17 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", - "futures-timer 3.0.2", "lru", + "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", "rand 0.8.3", - "streamunordered", "thiserror", "tracing", ] @@ -6060,7 +6085,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "always-assert", "futures 0.3.13", @@ -6070,6 +6095,8 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", + "sp-core", + "sp-runtime", "thiserror", "tracing", ] @@ -6077,7 +6104,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.7.30" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -6089,7 +6116,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -6102,7 +6129,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-network-protocol", @@ -6116,7 +6143,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "async-trait", "futures 0.3.13", @@ -6133,7 +6160,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-erasure-coding", @@ -6149,7 +6176,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "derive_more", @@ -6178,7 +6205,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "futures 0.3.13", @@ -6199,7 +6226,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "futures 0.3.13", @@ -6217,7 +6244,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-subsystem", @@ -6232,7 +6259,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-selection" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-primitives", @@ -6247,7 +6274,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "parity-scale-codec", @@ -6263,7 +6290,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-subsystem", @@ -6276,7 +6303,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-proposer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", @@ -6301,7 +6328,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "futures 0.3.13", @@ -6316,7 +6343,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "memory-lru", @@ -6333,7 +6360,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "async-std", "lazy_static", @@ -6350,7 +6377,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "parity-scale-codec", @@ -6364,7 +6391,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "parity-scale-codec", @@ -6382,7 +6409,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "async-std", "async-trait", @@ -6412,7 +6439,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "async-trait", "futures 0.3.13", @@ -6438,7 +6465,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "async-trait", "futures 0.3.13", @@ -6455,7 +6482,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "derive_more", "futures 0.3.13", @@ -6482,7 +6509,7 @@ dependencies = [ [[package]] name = "polkadot-pov-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "futures 0.3.13", "polkadot-node-network-protocol", @@ -6496,7 +6523,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "frame-system", @@ -6526,7 +6553,7 @@ dependencies = [ [[package]] name = "polkadot-procmacro-subsystem-dispatch-gen" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "assert_matches", "proc-macro2", @@ -6537,7 +6564,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "jsonrpc-core 15.1.0", "pallet-transaction-payment-rpc", @@ -6567,7 +6594,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "frame-executive", @@ -6634,7 +6661,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "frame-support", @@ -6671,7 +6698,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "derive_more", @@ -6708,7 +6735,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.8.3" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "frame-benchmarking", "frame-system-rpc-runtime-api", @@ -6792,7 +6819,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "arrayvec 0.5.2", "futures 0.3.13", @@ -6809,7 +6836,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -7451,8 +7478,8 @@ checksum = "2a34bde3561f980a51c70495164200569a11662644fe5af017f0b5d7015688cc" dependencies = [ "cfg-if 0.1.10", "libc", - "nix 0.20.0", - "rand 0.8.3", + "nix", + "rand 0.3.23", "winapi 0.3.9", ] @@ -7707,7 +7734,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "frame-executive", "frame-support", @@ -7892,7 +7919,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "async-trait", "derive_more", @@ -7920,7 +7947,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", @@ -7943,7 +7970,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -7959,7 +7986,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "impl-trait-for-tuples 0.2.1", "parity-scale-codec", @@ -7980,7 +8007,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -8029,7 +8056,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "fnv", @@ -8063,7 +8090,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "blake2-rfc", "hash-db", @@ -8093,7 +8120,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "sc-client-api", "sp-blockchain", @@ -8104,7 +8131,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "fork-tree", @@ -8150,7 +8177,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "futures 0.3.13", @@ -8174,7 +8201,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8221,7 +8248,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", @@ -8248,7 +8275,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "sc-client-api", @@ -8262,7 +8289,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "lazy_static", @@ -8291,7 +8318,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "parity-scale-codec", @@ -8307,7 +8334,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "parity-scale-codec", @@ -8322,7 +8349,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "parity-scale-codec", @@ -8340,7 +8367,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "dyn-clone", @@ -8379,7 +8406,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "finality-grandpa", @@ -8403,7 +8430,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-warp-sync" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "futures 0.3.13", @@ -8424,7 +8451,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "ansi_term 0.12.1", "futures 0.3.13", @@ -8442,7 +8469,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "async-trait", "derive_more", @@ -8462,7 +8489,7 @@ dependencies = [ [[package]] name = "sc-light" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "hash-db", "lazy_static", @@ -8481,7 +8508,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "async-std", "async-trait", @@ -8534,7 +8561,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", @@ -8551,7 +8578,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "bytes 0.5.6", "fnv", @@ -8579,7 +8606,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "libp2p", @@ -8592,7 +8619,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8601,7 +8628,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "hash-db", @@ -8635,7 +8662,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "futures 0.3.13", @@ -8659,7 +8686,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.1.31", "jsonrpc-core 15.1.0", @@ -8677,7 +8704,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "directories", "exit-future 0.2.0", @@ -8740,7 +8767,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "parity-scale-codec", @@ -8755,7 +8782,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "jsonrpc-core 15.1.0", "jsonrpc-core-client 15.1.0", @@ -8775,7 +8802,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "chrono", "futures 0.3.13", @@ -8795,7 +8822,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "ansi_term 0.12.1", "atty", @@ -8822,7 +8849,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -8833,7 +8860,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "futures 0.3.13", @@ -8855,7 +8882,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-diagnose", @@ -9153,9 +9180,9 @@ checksum = "b854a362375dfe8ab12ea8a98228040d37293c988f85fbac9fa0f83336387966" dependencies = [ "cfg-if 0.1.10", "libc", - "nix 0.20.0", + "nix", "quick-error 2.0.0", - "rand 0.8.3", + "rand 0.3.23", "winapi 0.3.9", ] @@ -9281,7 +9308,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "sp-core", @@ -9293,7 +9320,7 @@ dependencies = [ [[package]] name = "sp-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "hash-db", "log", @@ -9310,7 +9337,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "blake2-rfc", "proc-macro-crate 1.0.0", @@ -9322,7 +9349,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "serde", @@ -9334,7 +9361,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "integer-sqrt", "num-traits", @@ -9347,7 +9374,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-api", @@ -9359,7 +9386,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -9370,7 +9397,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-api", @@ -9382,7 +9409,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "log", @@ -9400,7 +9427,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "serde", "serde_json", @@ -9409,7 +9436,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-timer 3.0.2", @@ -9451,7 +9478,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "merlin", "parity-scale-codec", @@ -9472,7 +9499,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-arithmetic", @@ -9482,7 +9509,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -9494,7 +9521,7 @@ dependencies = [ [[package]] name = "sp-core" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "base58", "blake2-rfc", @@ -9538,7 +9565,7 @@ dependencies = [ [[package]] name = "sp-database" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "kvdb", "parking_lot 0.11.1", @@ -9547,7 +9574,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro2", "quote", @@ -9557,7 +9584,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "environmental", "parity-scale-codec", @@ -9568,7 +9595,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "finality-grandpa", "log", @@ -9585,7 +9612,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", @@ -9597,7 +9624,7 @@ dependencies = [ [[package]] name = "sp-io" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "hash-db", @@ -9621,7 +9648,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "lazy_static", "sp-core", @@ -9632,7 +9659,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "async-trait", "derive_more", @@ -9649,7 +9676,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "serde", @@ -9662,7 +9689,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2", @@ -9673,7 +9700,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "sp-api", "sp-core", @@ -9683,7 +9710,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "backtrace", ] @@ -9691,7 +9718,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "serde", "sp-core", @@ -9700,7 +9727,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "either", "hash256-std-hasher", @@ -9721,7 +9748,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "impl-trait-for-tuples 0.2.1", "parity-scale-codec", @@ -9738,7 +9765,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -9750,7 +9777,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "serde", "serde_json", @@ -9759,7 +9786,7 @@ dependencies = [ [[package]] name = "sp-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-api", @@ -9772,7 +9799,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -9782,7 +9809,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "hash-db", "log", @@ -9804,12 +9831,12 @@ dependencies = [ [[package]] name = "sp-std" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" [[package]] name = "sp-storage" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9822,7 +9849,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "sp-core", @@ -9835,7 +9862,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "parity-scale-codec", "sp-api", @@ -9848,7 +9875,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "log", "parity-scale-codec", @@ -9861,7 +9888,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "derive_more", "futures 0.3.13", @@ -9877,7 +9904,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "hash-db", "memory-db", @@ -9891,7 +9918,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "futures 0.3.13", "futures-core", @@ -9903,7 +9930,7 @@ dependencies = [ [[package]] name = "sp-version" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9915,7 +9942,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "impl-trait-for-tuples 0.2.1", "parity-scale-codec", @@ -10081,7 +10108,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.13", @@ -10104,7 +10131,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#1404f2af4cbe90d35b4c8a1405a9452feb789adc" +source = "git+https://github.com/paritytech/substrate?branch=rococo-v1#401c24e8a62cdf058882b0e92815faef966d9fa1" dependencies = [ "async-std", "derive_more", @@ -10453,6 +10480,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "token-factory" +version = "0.1.0" +dependencies = [ + "ethereum-types", + "fp-evm", + "frame-support", + "frame-system", + "hex-literal", + "pallet-balances", + "pallet-evm", + "pallet-sudo", + "pallet-timestamp", + "parity-scale-codec", + "rustc-hex", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "tokio" version = "0.1.22" @@ -10911,7 +10960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ "cfg-if 0.1.10", - "rand 0.7.3", + "rand 0.3.23", "static_assertions", ] @@ -11518,7 +11567,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.8.29" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "bitvec", "frame-executive", @@ -11677,7 +11726,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.8.22" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "parity-scale-codec", ] @@ -11685,7 +11734,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.8.22" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "frame-support", "parity-scale-codec", @@ -11701,7 +11750,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.8.22" -source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#0c9d4c9289e017b7589cc5f761d38545b833e1df" +source = "git+https://github.com/paritytech/polkadot?branch=rococo-v1#4dd62f1fb550736cead03d4adff948475df8abba" dependencies = [ "frame-support", "impl-trait-for-tuples 0.2.1", @@ -11715,6 +11764,23 @@ dependencies = [ "xcm", ] +[[package]] +name = "xtransfer" +version = "0.1.0" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "hrmp-channels", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", + "token-factory", + "xcm", + "xcm-executor", +] + [[package]] name = "yamux" version = "0.8.1" diff --git a/moonbeam-types-bundle/index.ts b/moonbeam-types-bundle/index.ts index dab3b42d7aa..f8184d8221a 100644 --- a/moonbeam-types-bundle/index.ts +++ b/moonbeam-types-bundle/index.ts @@ -212,6 +212,20 @@ export const moonbeamDefinitions = { nominators: "Vec", total: "Balance", }, + TokenId: { + _enum: ["DOT", "KSM", "ACA", "AUSD"], + }, + EvmCall: { + _enum: ["Register", "Mint", "Burn", "TotalIssuance", "BalanceOf"], + }, + AccountId32: "[u8; 32]", + ChainId: { + _enum: ["RelayChain", { Para: "u32" }], + }, + XCurrencyId: { + chain_id: "ChainId", + currency_id: "Vec", + }, SystemInherentData: { validation_data: "PersistedValidationData", relay_chain_state: "StorageProof", diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 995bce47de7..e14bc3d94b8 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -206,7 +206,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { ) } -pub fn moonbeam_inflation_config() -> InflationInfo { +fn moonbeam_inflation_config() -> InflationInfo { InflationInfo { expect: Range { min: 100_000 * GLMR, diff --git a/pallets/parachain-info/Cargo.toml b/pallets/hrmp-channels/Cargo.toml similarity index 57% rename from pallets/parachain-info/Cargo.toml rename to pallets/hrmp-channels/Cargo.toml index 5c5daeb9cae..6a9992e6ecb 100644 --- a/pallets/parachain-info/Cargo.toml +++ b/pallets/hrmp-channels/Cargo.toml @@ -1,24 +1,27 @@ [package] -authors = ["Parity Technologies "] +authors = ["PureStake"] edition = "2018" -name = "parachain-info" -version = "0.6.0" +name = "hrmp-channels" +version = "0.1.0" +description = "manage HRMP channels between other parachains" [dependencies] parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.101", optional = true, features = ["derive"] } - frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } - +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "rococo-v1" } cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } [features] default = ["std"] std = [ "parity-scale-codec/std", - "serde", - "cumulus-primitives-core/std", "frame-support/std", "frame-system/std", + "cumulus-primitives-core/std", + "sp-runtime/std", + "sp-std/std", + "xcm/std", ] diff --git a/pallets/hrmp-channels/src/lib.rs b/pallets/hrmp-channels/src/lib.rs new file mode 100644 index 00000000000..e5959c21de5 --- /dev/null +++ b/pallets/hrmp-channels/src/lib.rs @@ -0,0 +1,317 @@ +// Copyright 2019-2021 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Pallet for tracking HRMP channel events and dispatching HRMP channel actions. +//! - maximum one channel per relation is constraint placed by relay `hrmp` pallet by using +//! HrmpChannelId { sender: Id, recipient: Id } as unique key + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::pallet; +mod set; +pub use pallet::*; + +#[pallet] +pub mod pallet { + use crate::set::OrderedSet; + use cumulus_primitives_core::{DownwardMessageHandler, InboundDownwardMessage, ParaId}; + use frame_support::{pallet_prelude::*, traits::Get}; + use frame_system::pallet_prelude::*; + use sp_std::{convert::TryFrom, prelude::*}; + use xcm::{ + v0::{Junction, MultiLocation, OriginKind, SendXcm, Xcm}, + VersionedXcm, + }; + + /// Pallet for tracking and managing HRMP channels between other parachains + #[pallet::pallet] + pub struct Pallet(PhantomData); + + /// Configuration trait of this pallet. + #[pallet::config] + pub trait Config: frame_system::Config { + /// Overarching event type + type Event: From> + IsType<::Event>; + /// Moonbeam parachain identifier + type ParaId: Get; + /// XCM Sender for sending outgoing messages + type XcmSender: SendXcm; + } + + #[pallet::event] + #[pallet::generate_deposit(fn deposit_event)] + pub enum Event { + /// Sent channel open request to parachain \[recipient_para_id\] + SenderChannelRequested(ParaId), + /// Sender channel request accepted by parachain \[recipient_para_id\] + SenderChannelAccepted(ParaId), + /// Error with received sender channel accepted because one already exists locally + SenderChannelAlreadyExists(ParaId), + /// Error with recipient channel requested because request already exists locally + RecipientChannelAlreadyExists(ParaId), + /// Error closing sender channel because channel DNE + CloseSenderChannelDNE(ParaId), + /// Error closing recipient channel because channel DNE + CloseRecipientChannelDNE(ParaId), + /// Received new channel request with self as recipient + ReceivedRecipientChannelRequest(ParaId), + /// Accepted channel open request from parachain + AcceptedChannelRequest(ParaId), + /// Requested to close the channel with self as sender \[recipient_para_id\] + RequestedCloseSenderChannel(ParaId), + /// Requested to close the channel with self as recipient \[sender_para_id\] + RequestedCloseRecipientChannel(ParaId), + /// Closed channel with parachain as recipient and self as sender + ClosedSenderChannel(ParaId), + /// Closed channel with parachain as sender and self as recipient + ClosedRecipientChannel(ParaId), + } + + #[pallet::error] + pub enum Error { + /// Cannot send message from parachain to self + CannotSendToSelf, + /// Call to SendXcm failed + FailedToSendXcm, + /// Maximum one channel per relation ~ (sender,receiver) and direction matters + MaxOneChannelPerRelation, + /// Cannot accept a recipient channel request not in local storage + RecipientRequestDNE, + /// Requires existing open channel with self as sender + NoSenderChannelOpen, + /// Requires existing open channel with self as recipient + NoRecipientChannelOpen, + } + + #[pallet::storage] + #[pallet::getter(fn recipient_channel_requests)] + /// Open channel requests on the relay chain to self (recipient) from these parachains (sender) + pub type RecipientChannelRequests = StorageValue<_, OrderedSet, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn sender_channels)] + /// Stores all para IDs with which this parachain has opened a channel with self as sender + pub type SenderChannels = StorageValue<_, OrderedSet, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn recipient_channels)] + /// Stores all para IDs with which this parachain has accepted a channel with self as recipient + pub type RecipientChannels = StorageValue<_, OrderedSet, ValueQuery>; + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + /// Request to open HRMP channel with another parachain + pub fn open_channel( + origin: OriginFor, + recipient: ParaId, + // temporary until proper Xcm message variant is added with handler logic + call: Vec, + ) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + let sender = T::ParaId::get(); + ensure!(sender != recipient, Error::::CannotSendToSelf); + // TODO: could check if sender has already made the request; SenderChannelRequests vec + let channels = >::get(); + ensure!( + !channels.contains(&recipient), + Error::::MaxOneChannelPerRelation + ); + // call `hrmp_init_open_channel` on relay chain + let message = Xcm::Transact { + origin_type: OriginKind::Native, + call, + }; + // send message to relay chain + T::XcmSender::send_xcm( + MultiLocation::X1(Junction::Parachain { id: sender.into() }), + message, + ) + .map_err(|_| Error::::FailedToSendXcm)?; + // emit event + Self::deposit_event(Event::SenderChannelRequested(recipient)); + Ok(().into()) + } + #[pallet::weight(0)] + /// Accept a request to open HRMP channel + pub fn accept_channel( + origin: OriginFor, + sender: ParaId, + // temporary until proper Xcm message variant is added with handler logic + call: Vec, + ) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + let self_id = T::ParaId::get(); + ensure!(sender != self_id, Error::::CannotSendToSelf); + // first check if the request even exists (all requests are stored locally) + let mut requests = >::get(); + ensure!(requests.remove(&sender), Error::::RecipientRequestDNE); + let mut channels = >::get(); + ensure!( + channels.insert(sender), + Error::::MaxOneChannelPerRelation + ); + // call `hrmp_accept_open_channel` on relay chain + let message = Xcm::Transact { + origin_type: OriginKind::Native, + call, + }; + // send message to relay chain + T::XcmSender::send_xcm( + MultiLocation::X1(Junction::Parachain { id: self_id.into() }), + message, + ) + .map_err(|_| Error::::FailedToSendXcm)?; + // update recipient channel requests + >::put(requests); + // update recipient channels storage item + >::put(channels); + // emit event + Self::deposit_event(Event::AcceptedChannelRequest(sender)); + Ok(().into()) + } + #[pallet::weight(0)] + /// Close an open HRMP channel with self as sender + pub fn close_sender_channel( + origin: OriginFor, + recipient: ParaId, + // temporary until hrmp variants added to Xcm + call: Vec, + ) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + let self_id = T::ParaId::get(); + ensure!(recipient != self_id, Error::::CannotSendToSelf); + let channels = >::get(); + ensure!( + channels.contains(&recipient), + Error::::NoSenderChannelOpen + ); + // call `hrmp_close_channel` on relay chain + let message = Xcm::Transact { + origin_type: OriginKind::Native, + call, + }; + // send message to relay chain + T::XcmSender::send_xcm( + MultiLocation::X1(Junction::Parachain { id: self_id.into() }), + message, + ) + .map_err(|_| Error::::FailedToSendXcm)?; + Self::deposit_event(Event::RequestedCloseSenderChannel(recipient)); + Ok(().into()) + } + #[pallet::weight(0)] + /// Close an open HRMP channel with self as recipient + pub fn close_recipient_channel( + origin: OriginFor, + sender: ParaId, + // temporary until hrmp variants added to Xcm + call: Vec, + ) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + let self_id = T::ParaId::get(); + ensure!(sender != self_id, Error::::CannotSendToSelf); + let channels = >::get(); + ensure!( + channels.contains(&sender), + Error::::NoRecipientChannelOpen + ); + // call is to `hrmp_close_channel` on relay chain + let message = Xcm::Transact { + origin_type: OriginKind::Native, + call, + }; + // send message to accept the channel request + T::XcmSender::send_xcm( + MultiLocation::X1(Junction::Parachain { id: self_id.into() }), + message, + ) + .map_err(|_| Error::::FailedToSendXcm)?; + Self::deposit_event(Event::RequestedCloseRecipientChannel(sender)); + Ok(().into()) + } + } + + impl DownwardMessageHandler for Pallet { + fn handle_downward_message(msg: InboundDownwardMessage) { + match VersionedXcm::decode(&mut &msg.msg[..]).map(Xcm::try_from) { + Ok(Ok(xcm)) => { + match xcm { + Xcm::HrmpNewChannelOpenRequest { sender, .. } => { + let mut channels = >::get(); + let sender: ParaId = sender.into(); + // if request from id already exists, not added to requests + if channels.insert(sender) { + >::put(channels); + Self::deposit_event(Event::ReceivedRecipientChannelRequest(sender)); + } else { + // event error + Self::deposit_event(Event::RecipientChannelAlreadyExists(sender)); + } + } + Xcm::HrmpChannelAccepted { recipient } => { + let mut channels = >::get(); + let recipient: ParaId = recipient.into(); + // if channel with id already exists, not added to channels + if channels.insert(recipient) { + >::put(channels); + Self::deposit_event(Event::SenderChannelAccepted(recipient)); + } else { + // event error + Self::deposit_event(Event::SenderChannelAlreadyExists(recipient)); + } + } + Xcm::HrmpChannelClosing { + sender, recipient, .. + } => { + let self_id = T::ParaId::get(); + let sender: ParaId = sender.into(); + let recipient: ParaId = recipient.into(); + if sender == self_id { + let mut channels = >::get(); + // update storage + if channels.remove(&recipient) { + >::put(channels); + Self::deposit_event(Event::ClosedSenderChannel(recipient)); + } else { + // event error + Self::deposit_event(Event::CloseSenderChannelDNE(recipient)); + } + } + if recipient == self_id { + let mut channels = >::get(); + // update storage + if channels.remove(&sender) { + >::put(channels); + Self::deposit_event(Event::ClosedRecipientChannel(sender)); + } else { + // event error + Self::deposit_event(Event::CloseRecipientChannelDNE(sender)); + } + } + } + _ => (), + } + } + Ok(Err(..)) => (), + Err(..) => (), + } + } + } +} diff --git a/pallets/hrmp-channels/src/set.rs b/pallets/hrmp-channels/src/set.rs new file mode 100644 index 00000000000..e5d428ca514 --- /dev/null +++ b/pallets/hrmp-channels/src/set.rs @@ -0,0 +1,85 @@ +// Copyright 2019-2021 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +/* TODO: use orml_utilities::OrderedSet without leaking substrate dependencies*/ +use parity_scale_codec::{Decode, Encode}; +use sp_runtime::RuntimeDebug; +use sp_std::prelude::*; + +/// An ordered set backed by `Vec` +#[derive(RuntimeDebug, PartialEq, Eq, Encode, Decode, Default)] +pub struct OrderedSet(pub Vec); + +impl OrderedSet { + /// Create a new empty set + pub fn new() -> Self { + Self(Vec::new()) + } + + /// Create a set from a `Vec`. + /// `v` will be sorted and dedup first. + pub fn from(mut v: Vec) -> Self { + v.sort(); + v.dedup(); + Self::from_sorted_set(v) + } + + /// Create a set from a `Vec`. + /// Assume `v` is sorted and contain unique elements. + pub fn from_sorted_set(v: Vec) -> Self { + Self(v) + } + + /// Insert an element. + /// Return true if insertion happened. + pub fn insert(&mut self, value: T) -> bool { + match self.0.binary_search(&value) { + Ok(_) => false, + Err(loc) => { + self.0.insert(loc, value); + true + } + } + } + + /// Remove an element. + /// Return true if removal happened. + pub fn remove(&mut self, value: &T) -> bool { + match self.0.binary_search(&value) { + Ok(loc) => { + self.0.remove(loc); + true + } + Err(_) => false, + } + } + + /// Return if the set contains `value` + pub fn contains(&self, value: &T) -> bool { + self.0.binary_search(&value).is_ok() + } + + /// Clear the set + pub fn clear(&mut self) { + self.0.clear(); + } +} + +impl From> for OrderedSet { + fn from(v: Vec) -> Self { + Self::from(v) + } +} diff --git a/pallets/parachain-info/src/lib.rs b/pallets/parachain-info/src/lib.rs deleted file mode 100644 index 0610440159b..00000000000 --- a/pallets/parachain-info/src/lib.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2019-2021 PureStake Inc. -// This file is part of Moonbeam. - -// Moonbeam is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Moonbeam is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Moonbeam. If not, see . - -//! Minimal Pallet that injects a ParachainId into Runtime storage from - -#![cfg_attr(not(feature = "std"), no_std)] - -use frame_support::{decl_module, decl_storage, traits::Get}; - -use cumulus_primitives_core::ParaId; - -/// Configuration trait of this pallet. -pub trait Config: frame_system::Config {} - -impl Get for Module { - fn get() -> ParaId { - Self::parachain_id() - } -} - -decl_storage! { - trait Store for Module as ParachainUpgrade { - ParachainId get(fn parachain_id) config(): ParaId = 200.into(); - } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin {} -} diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 178503fe116..50900e4027a 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -60,7 +60,7 @@ pub use pallet::*; #[pallet] pub mod pallet { - use super::{InflationInfo, Range}; + use crate::inflation::{InflationInfo, Range}; use crate::set::OrderedSet; use frame_support::pallet_prelude::*; use frame_support::traits::{Currency, Get, Imbalance, ReservableCurrency}; diff --git a/pallets/parachain-staking/src/set.rs b/pallets/parachain-staking/src/set.rs index 5ea3dcf6146..e5d428ca514 100644 --- a/pallets/parachain-staking/src/set.rs +++ b/pallets/parachain-staking/src/set.rs @@ -14,15 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Moonbeam. If not, see . -/* TODO: use orml_utilities::OrderedSet without leaking substrate v2.0 dependencies*/ +/* TODO: use orml_utilities::OrderedSet without leaking substrate dependencies*/ use parity_scale_codec::{Decode, Encode}; -#[cfg(feature = "std")] -use serde::{Deserialize, Serialize}; use sp_runtime::RuntimeDebug; use sp_std::prelude::*; /// An ordered set backed by `Vec` -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[derive(RuntimeDebug, PartialEq, Eq, Encode, Decode, Default)] pub struct OrderedSet(pub Vec); diff --git a/pallets/token-dealer/Cargo.toml b/pallets/token-dealer/Cargo.toml deleted file mode 100644 index 1bbc4e6942c..00000000000 --- a/pallets/token-dealer/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -authors = ["Parity Technologies "] -edition = "2018" -name = "cumulus-token-dealer" -version = "0.6.0" - -[dependencies] -codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } - -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } - -# Cumulus dependencies -cumulus-upward-message = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } - -# Polkadot dependencies -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-v1", default-features = false } - -[features] -default = ["std"] -std = [ - "codec/std", - "cumulus-upward-message/std", - "cumulus-primitives-core/std", - "sp-runtime/std", - "frame-support/std", - "frame-system/std", - "polkadot-parachain/std", -] diff --git a/pallets/token-dealer/src/lib.rs b/pallets/token-dealer/src/lib.rs deleted file mode 100644 index 0ec620c0929..00000000000 --- a/pallets/token-dealer/src/lib.rs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2019-2021 PureStake Inc. -// This file is part of Moonbeam. - -// Moonbeam is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Moonbeam is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Moonbeam. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -use frame_support::{ - decl_event, decl_module, dispatch::DispatchResult, - traits::{Currency, ExistenceRequirement, WithdrawReason}, -}; -use frame_system::ensure_signed; - -use codec::{Decode, Encode}; -use cumulus_primitives::{ - relay_chain::DownwardMessage, - xcmp::{XCMPMessageHandler, XCMPMessageSender}, - DownwardMessageHandler, ParaId, UpwardMessageOrigin, UpwardMessageSender, -}; -use cumulus_upward_message::BalancesMessage; -use polkadot_parachain::primitives::AccountIdConversion; - -#[derive(Encode, Decode)] -pub enum XCMPMessage { - /// Transfer tokens to the given account from the Parachain account. - TransferToken(XAccountId, XBalance), -} - -type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; - -type RelayAccountId = sp_runtime::AccountId32; - -/// Configuration trait of this pallet. -pub trait Trait: frame_system::Trait { - /// Event type used by the runtime. - type Event: From> + Into<::Event>; - - /// The sender of upward messages. - type UpwardMessageSender: UpwardMessageSender; - - /// The upward message type used by the Parachain runtime. - type UpwardMessage: codec::Codec + BalancesMessage>; - - /// Currency of the runtime. - type Currency: Currency; - - /// The sender of XCMP messages. - type XCMPMessageSender: XCMPMessageSender>>; -} - -decl_event! { - pub enum Event where - AccountId = ::AccountId, - Balance = BalanceOf - { - /// Transferred tokens to the account on the relay chain. - TransferredTokensToRelayChain(RelayAccountId, Balance), - /// Transferred tokens to the account on request from the relay chain. - TransferredTokensFromRelayChain(AccountId, Balance), - /// Transferred tokens to the account from the given parachain account. - TransferredTokensViaXCMP(ParaId, AccountId, Balance, DispatchResult), - } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin, system = frame_system { - /// Transfer `amount` of tokens on the relay chain from the Parachain account to - /// the given `dest` account. - #[weight = 10] - fn transfer_tokens_to_relay_chain(origin, dest: RelayAccountId, amount: BalanceOf) { - let who = ensure_signed(origin)?; - - let _ = T::Currency::withdraw( - &who, - amount, - WithdrawReason::Transfer.into(), - ExistenceRequirement::AllowDeath, - )?; - - let msg = ::UpwardMessage::transfer(dest.clone(), amount.clone()); - ::UpwardMessageSender::send_upward_message(&msg, UpwardMessageOrigin::Signed) - .expect("Should not fail; qed"); - - Self::deposit_event(Event::::TransferredTokensToRelayChain(dest, amount)); - } - - /// Transfer `amount` of tokens to another parachain. - #[weight = 10] - fn transfer_tokens_to_parachain_chain( - origin, - para_id: u32, - dest: T::AccountId, - amount: BalanceOf, - ) { - //TODO we don't make sure that the parachain has some tokens on the other parachain. - let who = ensure_signed(origin)?; - - let _ = T::Currency::withdraw( - &who, - amount, - WithdrawReason::Transfer.into(), - ExistenceRequirement::AllowDeath, - )?; - - T::XCMPMessageSender::send_xcmp_message( - para_id.into(), - &XCMPMessage::TransferToken(dest, amount), - ).expect("Should not fail; qed"); - } - - fn deposit_event() = default; - } -} - -/// This is a hack to convert from one generic type to another where we are sure that both are the -/// same type/use the same encoding. -fn convert_hack(input: &impl Encode) -> O { - input.using_encoded(|e| Decode::decode(&mut &e[..]).expect("Must be compatible; qed")) -} - -impl DownwardMessageHandler for Module { - fn handle_downward_message(msg: &DownwardMessage) { - match msg { - DownwardMessage::TransferInto(dest, amount, _) => { - let dest = convert_hack(&dest); - let amount: BalanceOf = convert_hack(amount); - - let _ = T::Currency::deposit_creating(&dest, amount.clone()); - - Self::deposit_event(Event::::TransferredTokensFromRelayChain(dest, amount)); - } - _ => {} - } - } -} - -impl XCMPMessageHandler>> for Module { - fn handle_xcmp_message(src: ParaId, msg: &XCMPMessage>) { - match msg { - XCMPMessage::TransferToken(dest, amount) => { - let para_account = src.clone().into_account(); - - let res = T::Currency::transfer( - ¶_account, - dest, - amount.clone(), - ExistenceRequirement::AllowDeath, - ); - - Self::deposit_event(Event::::TransferredTokensViaXCMP( - src, - dest.clone(), - amount.clone(), - res, - )); - } - } - } -} diff --git a/pallets/token-factory/Cargo.toml b/pallets/token-factory/Cargo.toml new file mode 100644 index 00000000000..9c7beb05dc1 --- /dev/null +++ b/pallets/token-factory/Cargo.toml @@ -0,0 +1,42 @@ +[package] +authors = ["PureStake"] +edition = "2018" +name = "token-factory" +version = "0.1.0" + +[dependencies] +ethereum-types = { version = "0.11.0", default-features = false } +fp-evm = { git = "https://github.com/purestake/frontier", default-features = false, branch = "notlesh-moonbeam-v0.7" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +hex-literal = { version = "0.3.1" } +pallet-evm = { git = "https://github.com/purestake/frontier", default-features = false, branch = "notlesh-moonbeam-v0.7" } +pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] } +rustc-hex = { version = "2.1.0", default-features = false } +serde = { version = "1.0.101", optional = true } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } + +[features] +default = ["std"] +std = [ + "ethereum-types/std", + "parity-scale-codec/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "pallet-evm/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "rustc-hex/std", + "serde", + "sp-runtime/std", + "sp-std/std", + "sp-core/std", + "sp-io/std", +] \ No newline at end of file diff --git a/pallets/token-factory/contract/bytecode.txt b/pallets/token-factory/contract/bytecode.txt new file mode 100644 index 00000000000..3bec98fd544 --- /dev/null +++ b/pallets/token-factory/contract/bytecode.txt @@ -0,0 +1 @@ +60806040523480156200001157600080fd5b50604051620024913803806200249183398181016040528101906200003791906200024f565b818160006200004b6200012560201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3508160049080519060200190620001019291906200012d565b5080600590805190602001906200011a9291906200012d565b505050505062000432565b600033905090565b8280546200013b9062000357565b90600052602060002090601f0160209004810192826200015f5760008555620001ab565b82601f106200017a57805160ff1916838001178555620001ab565b82800160010185558215620001ab579182015b82811115620001aa5782518255916020019190600101906200018d565b5b509050620001ba9190620001be565b5090565b5b80821115620001d9576000816000905550600101620001bf565b5090565b6000620001f4620001ee84620002eb565b620002c2565b9050828152602081018484840111156200020d57600080fd5b6200021a84828562000321565b509392505050565b600082601f8301126200023457600080fd5b815162000246848260208601620001dd565b91505092915050565b600080604083850312156200026357600080fd5b600083015167ffffffffffffffff8111156200027e57600080fd5b6200028c8582860162000222565b925050602083015167ffffffffffffffff811115620002aa57600080fd5b620002b88582860162000222565b9150509250929050565b6000620002ce620002e1565b9050620002dc82826200038d565b919050565b6000604051905090565b600067ffffffffffffffff821115620003095762000308620003f2565b5b620003148262000421565b9050602081019050919050565b60005b838110156200034157808201518184015260208101905062000324565b8381111562000351576000848401525b50505050565b600060028204905060018216806200037057607f821691505b60208210811415620003875762000386620003c3565b5b50919050565b620003988262000421565b810181811067ffffffffffffffff82111715620003ba57620003b9620003f2565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b61204f80620004426000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063715018a6116100a25780639dc29fac116100715780639dc29fac146102cf578063a457c2d7146102eb578063a9059cbb1461031b578063dd62ed3e1461034b578063f2fde38b1461037b57610116565b8063715018a61461026d57806379cc6790146102775780638da5cb5b1461029357806395d89b41146102b157610116565b8063313ce567116100e9578063313ce567146101b757806339509351146101d557806340c10f191461020557806342966c681461022157806370a082311461023d57610116565b806306fdde031461011b578063095ea7b31461013957806318160ddd1461016957806323b872dd14610187575b600080fd5b610123610397565b604051610130919061186d565b60405180910390f35b610153600480360381019061014e9190611596565b610429565b6040516101609190611852565b60405180910390f35b610171610447565b60405161017e9190611a2f565b60405180910390f35b6101a1600480360381019061019c9190611547565b610451565b6040516101ae9190611852565b60405180910390f35b6101bf610552565b6040516101cc9190611a4a565b60405180910390f35b6101ef60048036038101906101ea9190611596565b61055b565b6040516101fc9190611852565b60405180910390f35b61021f600480360381019061021a9190611596565b610607565b005b61023b600480360381019061023691906115d2565b610691565b005b610257600480360381019061025291906114e2565b6106a5565b6040516102649190611a2f565b60405180910390f35b6102756106ee565b005b610291600480360381019061028c9190611596565b610828565b005b61029b6108ac565b6040516102a89190611837565b60405180910390f35b6102b96108d5565b6040516102c6919061186d565b60405180910390f35b6102e960048036038101906102e49190611596565b610967565b005b61030560048036038101906103009190611596565b6109f1565b6040516103129190611852565b60405180910390f35b61033560048036038101906103309190611596565b610ae5565b6040516103429190611852565b60405180910390f35b6103656004803603810190610360919061150b565b610b03565b6040516103729190611a2f565b60405180910390f35b610395600480360381019061039091906114e2565b610b8a565b005b6060600480546103a690611b93565b80601f01602080910402602001604051908101604052809291908181526020018280546103d290611b93565b801561041f5780601f106103f45761010080835404028352916020019161041f565b820191906000526020600020905b81548152906001019060200180831161040257829003601f168201915b5050505050905090565b600061043d610436610d33565b8484610d3b565b6001905092915050565b6000600354905090565b600061045e848484610f06565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a9610d33565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610529576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105209061192f565b60405180910390fd5b61054685610535610d33565b85846105419190611ad7565b610d3b565b60019150509392505050565b60006012905090565b60006105fd610568610d33565b848460026000610576610d33565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105f89190611a81565b610d3b565b6001905092915050565b61060f610d33565b73ffffffffffffffffffffffffffffffffffffffff1661062d6108ac565b73ffffffffffffffffffffffffffffffffffffffff1614610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a9061194f565b60405180910390fd5b61068d8282611188565b5050565b6106a261069c610d33565b826112dd565b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106f6610d33565b73ffffffffffffffffffffffffffffffffffffffff166107146108ac565b73ffffffffffffffffffffffffffffffffffffffff161461076a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107619061194f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061083b83610836610d33565b610b03565b905081811015610880576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108779061196f565b60405180910390fd5b61089d8361088c610d33565b84846108989190611ad7565b610d3b565b6108a783836112dd565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600580546108e490611b93565b80601f016020809104026020016040519081016040528092919081815260200182805461091090611b93565b801561095d5780601f106109325761010080835404028352916020019161095d565b820191906000526020600020905b81548152906001019060200180831161094057829003601f168201915b5050505050905090565b61096f610d33565b73ffffffffffffffffffffffffffffffffffffffff1661098d6108ac565b73ffffffffffffffffffffffffffffffffffffffff16146109e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109da9061194f565b60405180910390fd5b6109ed82826112dd565b5050565b60008060026000610a00610d33565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610abd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab4906119ef565b60405180910390fd5b610ada610ac8610d33565b858584610ad59190611ad7565b610d3b565b600191505092915050565b6000610af9610af2610d33565b8484610f06565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92610d33565b73ffffffffffffffffffffffffffffffffffffffff16610bb06108ac565b73ffffffffffffffffffffffffffffffffffffffff1614610c06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfd9061194f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6d906118cf565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da2906119cf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e12906118ef565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610ef99190611a2f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6d906119af565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fe6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdd9061188f565b60405180910390fd5b610ff18383836114b3565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106f9061190f565b60405180910390fd5b81816110849190611ad7565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111169190611a81565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161117a9190611a2f565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ef90611a0f565b60405180910390fd5b611204600083836114b3565b80600360008282546112169190611a81565b9250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461126c9190611a81565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516112d19190611a2f565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113449061198f565b60405180910390fd5b611359826000836114b3565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d7906118af565b60405180910390fd5b81816113ec9190611ad7565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600360008282546114419190611ad7565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516114a69190611a2f565b60405180910390a3505050565b505050565b6000813590506114c781611feb565b92915050565b6000813590506114dc81612002565b92915050565b6000602082840312156114f457600080fd5b6000611502848285016114b8565b91505092915050565b6000806040838503121561151e57600080fd5b600061152c858286016114b8565b925050602061153d858286016114b8565b9150509250929050565b60008060006060848603121561155c57600080fd5b600061156a868287016114b8565b935050602061157b868287016114b8565b925050604061158c868287016114cd565b9150509250925092565b600080604083850312156115a957600080fd5b60006115b7858286016114b8565b92505060206115c8858286016114cd565b9150509250929050565b6000602082840312156115e457600080fd5b60006115f2848285016114cd565b91505092915050565b61160481611b0b565b82525050565b61161381611b1d565b82525050565b600061162482611a65565b61162e8185611a70565b935061163e818560208601611b60565b61164781611c23565b840191505092915050565b600061165f602383611a70565b915061166a82611c34565b604082019050919050565b6000611682602283611a70565b915061168d82611c83565b604082019050919050565b60006116a5602683611a70565b91506116b082611cd2565b604082019050919050565b60006116c8602283611a70565b91506116d382611d21565b604082019050919050565b60006116eb602683611a70565b91506116f682611d70565b604082019050919050565b600061170e602883611a70565b915061171982611dbf565b604082019050919050565b6000611731602083611a70565b915061173c82611e0e565b602082019050919050565b6000611754602483611a70565b915061175f82611e37565b604082019050919050565b6000611777602183611a70565b915061178282611e86565b604082019050919050565b600061179a602583611a70565b91506117a582611ed5565b604082019050919050565b60006117bd602483611a70565b91506117c882611f24565b604082019050919050565b60006117e0602583611a70565b91506117eb82611f73565b604082019050919050565b6000611803601f83611a70565b915061180e82611fc2565b602082019050919050565b61182281611b49565b82525050565b61183181611b53565b82525050565b600060208201905061184c60008301846115fb565b92915050565b6000602082019050611867600083018461160a565b92915050565b600060208201905081810360008301526118878184611619565b905092915050565b600060208201905081810360008301526118a881611652565b9050919050565b600060208201905081810360008301526118c881611675565b9050919050565b600060208201905081810360008301526118e881611698565b9050919050565b60006020820190508181036000830152611908816116bb565b9050919050565b60006020820190508181036000830152611928816116de565b9050919050565b6000602082019050818103600083015261194881611701565b9050919050565b6000602082019050818103600083015261196881611724565b9050919050565b6000602082019050818103600083015261198881611747565b9050919050565b600060208201905081810360008301526119a88161176a565b9050919050565b600060208201905081810360008301526119c88161178d565b9050919050565b600060208201905081810360008301526119e8816117b0565b9050919050565b60006020820190508181036000830152611a08816117d3565b9050919050565b60006020820190508181036000830152611a28816117f6565b9050919050565b6000602082019050611a446000830184611819565b92915050565b6000602082019050611a5f6000830184611828565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611a8c82611b49565b9150611a9783611b49565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611acc57611acb611bc5565b5b828201905092915050565b6000611ae282611b49565b9150611aed83611b49565b925082821015611b0057611aff611bc5565b5b828203905092915050565b6000611b1682611b29565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611b7e578082015181840152602081019050611b63565b83811115611b8d576000848401525b50505050565b60006002820490506001821680611bab57607f821691505b60208210811415611bbf57611bbe611bf4565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7760008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611ff481611b0b565b8114611fff57600080fd5b50565b61200b81611b49565b811461201657600080fd5b5056fea2646970667358221220ebdfee37207c65b6959cdf9a6ebf426763546f84e56c8cb909bf2b3b640eaea464736f6c634300080200330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file diff --git a/pallets/token-factory/contract/contract.sol b/pallets/token-factory/contract/contract.sol new file mode 100644 index 00000000000..d963d5fc764 --- /dev/null +++ b/pallets/token-factory/contract/contract.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/access/Ownable.sol"; +import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.0/contracts/token/ERC20/extensions/ERC20Burnable.sol"; + +/** + * @dev {ERC20} token, including: + * + * The account that deploys the contract can mint and burn. + */ +contract ERC20MinterBurner is Ownable, ERC20Burnable { + /** + * @dev + * + * See {ERC20-constructor}. + */ + constructor(string memory name, string memory symbol) ERC20(name, symbol) {} + + /** + * @dev Creates `amount` new tokens for `to`. + * + * See {ERC20-_mint}. + * + * Requirements: + * + * - the caller must be the account that deployed the contract + */ + function mint(address to, uint256 amount) public virtual onlyOwner { + _mint(to, amount); + } + + /** + * @dev Burns `amount` tokens from `from` + * + * See {ERC20Burnable-_burn}. + * + * Requirements: + * + * - the caller must be the account that deployed the contract + */ + function burn(address from, uint256 amount) public virtual onlyOwner { + _burn(from, amount); + } +} diff --git a/pallets/token-factory/src/lib.rs b/pallets/token-factory/src/lib.rs new file mode 100644 index 00000000000..9c2407c512d --- /dev/null +++ b/pallets/token-factory/src/lib.rs @@ -0,0 +1,518 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Pallet for registering, minting, and burning ERC20 tokens (in EVM from runtime) + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::pallet; + +pub use pallet::*; + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +#[pallet] +pub mod pallet { + use ethereum_types::BigEndianHash; + use fp_evm::ExecutionInfo; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + use pallet_evm::{AddressMapping, ExitReason, Runner}; + use parity_scale_codec::{Decode, Encode, FullCodec}; + use rustc_hex::FromHex; + #[cfg(feature = "std")] + use serde::{Deserialize, Serialize}; + use sp_core::{H160, H256, U256}; + use sp_runtime::{ + traits::{AtLeast32BitUnsigned, Convert, MaybeSerializeDeserialize, Zero}, + DispatchError, RuntimeDebug, SaturatedConversion, + }; + use sp_std::{convert::TryFrom, fmt::Debug, vec::Vec}; + + /// ERC20PresetMinterBurner contract bytecode + const CONTRACT_BYTECODE: &str = include_str!("../contract/bytecode.txt"); + + #[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, PartialOrd, Ord)] + #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] + #[non_exhaustive] + /// The name and unique ID for each token registered in `token-factory` + pub enum Ticker { + DOT = 0, + KSM = 1, + ACA = 2, + AUSD = 3, + } + + impl TryFrom for Ticker { + type Error = (); + + fn try_from(v: u8) -> Result { + match v { + 0 => Ok(Ticker::DOT), + 1 => Ok(Ticker::KSM), + 2 => Ok(Ticker::ACA), + 3 => Ok(Ticker::AUSD), + _ => Err(()), + } + } + } + + #[derive(sp_runtime::RuntimeDebug, PartialEq, Eq)] + /// The supported currency types + pub enum CurrencyId { + /// The local instance of `balances` pallet, default GLMR + Native, + /// Token registered in `token-factory` pallet + Token(Ticker), + } + + impl TryFrom> for CurrencyId { + type Error = (); + fn try_from(v: Vec) -> Result { + match v.as_slice() { + b"GLMR" => Ok(CurrencyId::Native), + b"DOT" => Ok(CurrencyId::Token(Ticker::DOT)), + b"KSM" => Ok(CurrencyId::Token(Ticker::KSM)), + b"ACA" => Ok(CurrencyId::Token(Ticker::ACA)), + b"AUSD" => Ok(CurrencyId::Token(Ticker::AUSD)), + _ => Err(()), + } + } + } + + impl From for Vec { + fn from(c: CurrencyId) -> Vec { + match c { + CurrencyId::Native => b"GLMR".to_vec(), + CurrencyId::Token(Ticker::DOT) => b"DOT".to_vec(), + CurrencyId::Token(Ticker::KSM) => b"KSM".to_vec(), + CurrencyId::Token(Ticker::ACA) => b"ACA".to_vec(), + CurrencyId::Token(Ticker::AUSD) => b"AUSD".to_vec(), + } + } + } + + #[test] + fn currency_as_vec() { + let expect: CurrencyId = CurrencyId::try_from([71, 76, 77, 82].to_vec()).unwrap(); + assert_eq!(expect, CurrencyId::Native); + let expect: CurrencyId = CurrencyId::try_from([68, 79, 84].to_vec()).unwrap(); + assert_eq!(expect, CurrencyId::Token(Ticker::DOT)); + let expect: CurrencyId = CurrencyId::try_from([75, 83, 77].to_vec()).unwrap(); + assert_eq!(expect, CurrencyId::Token(Ticker::KSM)); + let expect: CurrencyId = CurrencyId::try_from([65, 67, 65].to_vec()).unwrap(); + assert_eq!(expect, CurrencyId::Token(Ticker::ACA)); + let expect: CurrencyId = CurrencyId::try_from([65, 85, 83, 68].to_vec()).unwrap(); + assert_eq!(expect, CurrencyId::Token(Ticker::AUSD)); + } + + /// The ERC token factory pallet + #[pallet::pallet] + pub struct Pallet(PhantomData); + + /// Configuration trait of this pallet. + #[pallet::config] + pub trait Config: frame_system::Config + pallet_evm::Config + pallet_sudo::Config { + /// Overarching event type + type Event: From> + IsType<::Event>; + /// Balances type + type Balance: Parameter + + Member + + AtLeast32BitUnsigned + + Default + + Copy + + MaybeSerializeDeserialize + + Into; + /// Token identifier + type TokenId: Clone + Copy + FullCodec + Debug + PartialEq + Ord + MaybeSerializeDeserialize; + /// Convert from AccountId to H160, is identity map for Moonbeam + type AccountToH160: Convert; + } + + #[pallet::error] + pub enum Error { + /// TokenID is already claimed + IdClaimed, + /// TokenID does not exist so cannot interact with it + IdNotClaimed, + /// Not enough balance to burn + NotEnoughBalanceToBurn, + } + + #[derive(PartialEq, Clone, Copy, Encode, Decode, sp_runtime::RuntimeDebug)] + pub enum EvmCall { + Register, + Mint, + Burn, + TotalIssuance, + BalanceOf, + } + + #[pallet::event] + #[pallet::generate_deposit(pub(crate) fn deposit_event)] + pub enum Event { + /// Token register success [token_id, contract_address] + Registered(T::TokenId, H160), + /// Mint token success. [token_id, who, amount] + Minted(T::TokenId, T::AccountId, T::Balance), + /// Burn token success. [token_id, who, amount] + Burned(T::TokenId, T::AccountId, T::Balance), + /// Destroy all tokens success. [token_id, amount] + DestroyedAll(T::TokenId, T::Balance), + /// Call failed with exit reason [call, reason] + EvmCallFailed(EvmCall, ExitReason), + } + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::storage] + #[pallet::getter(fn nonce)] + pub type Nonce = StorageValue<_, U256, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn tokens)] + pub type Tokens = StorageValue<_, Vec, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn contract_address)] + pub type ContractAddress = + StorageMap<_, Twox64Concat, T::TokenId, H160, OptionQuery>; + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub nonce: U256, + } + + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { + nonce: U256::zero(), + } + } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + >::put(self.nonce); + } + } + + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + pub fn register_token(origin: OriginFor, id: T::TokenId) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + ensure!(!Self::exists(&id), Error::::IdClaimed); + let contract = FromHex::from_hex(CONTRACT_BYTECODE) + .expect("Static smart contract is formatted incorrectly (should be hex)"); + let mut nonce = >::get(); + // deploy contract with sudo as MINTER_ROLE and BURNER_ROLE (without minting) + match T::Runner::create( + // from: H160 + Self::sudo_caller(), + // input: Vec + contract, + // value: U256 + U256::zero(), + // gas limit: U256 + U256::from(0x10000000).low_u64(), + // gas price: U256 + Some(U256::from(1)), + // nonce: Option + Some(nonce), + // config: EvmConfig + T::config(), + )? { + ExecutionInfo { + exit_reason: ExitReason::Succeed(_), + value: address, + .. + } => { + // insert contract + >::insert(&id, address.clone()); + // add to tokens + >::mutate(|list| { + if let Err(loc) = list.binary_search(&id) { + list.insert(loc, id.clone()); + } + }); + Self::deposit_event(Event::Registered(id, address)); + } + ExecutionInfo { + exit_reason: reason, + .. + } => { + Self::deposit_event(Event::EvmCallFailed(EvmCall::Register, reason)); + } + } + // increment nonce + nonce += U256::from(1); + >::put(nonce); + Ok(().into()) + } + + #[pallet::weight(0)] + pub fn destroy_all(origin: OriginFor, id: T::TokenId) -> DispatchResultWithPostInfo { + frame_system::ensure_root(origin)?; + let amount_destroyed = Self::total_issuance(id)?; + // clear storage and free id, tokens associated with the contract are no longer + // recognized by the cross-chain transfer system + >::remove(&id); + >::mutate(|list| { + if let Ok(loc) = list.binary_search(&id) { + list.remove(loc); + } + }); + Self::deposit_event(Event::DestroyedAll(id, amount_destroyed)); + Ok(().into()) + } + } + + impl Pallet { + fn sudo_caller() -> H160 { + T::AccountToH160::convert(>::key()) + } + } + + /// Isolates behavior for minting/burning tokens from registration + pub trait TokenMinter { + fn exists(id: &Id) -> bool; + // setters + fn mint(id: Id, who: Account, amount: Balance) -> DispatchResultWithPostInfo; + fn burn(id: Id, who: Account, amount: Balance) -> DispatchResultWithPostInfo; + // getters + fn total_issuance(id: Id) -> Result; + fn balance_of(id: Id, who: Account) -> Result; + } + + impl TokenMinter for Pallet { + fn exists(id: &T::TokenId) -> bool { + >::get(id).is_some() + } + fn mint(id: T::TokenId, who: H160, amount: T::Balance) -> DispatchResultWithPostInfo { + let address = >::get(&id).ok_or(Error::::IdNotClaimed)?; + let mut nonce = >::get(); + let mut input = hex_literal::hex!("40c10f19").to_vec(); + // append address + input.extend_from_slice(H256::from(who.clone()).as_bytes()); + // append amount + input.extend_from_slice( + H256::from_uint(&U256::from(amount.saturated_into::())).as_bytes(), + ); + // call evm + match T::Runner::call( + // source: H160 + Self::sudo_caller(), + // target + address, + // input: Vec + input, + // value: U256 + U256::zero(), + // gas limit: U256 + U256::from(0x10000000).low_u64(), + // gas price: U256 + Some(U256::from(1)), + // nonce: Option + Some(nonce), + // config: EvmConfig + T::config(), + )? { + ExecutionInfo { + exit_reason: ExitReason::Succeed(_), + .. + } => { + Self::deposit_event(Event::Minted( + id, + T::AddressMapping::into_account_id(who), + amount, + )); + } + ExecutionInfo { + exit_reason: reason, + .. + } => { + Self::deposit_event(Event::EvmCallFailed(EvmCall::Mint, reason)); + } + } + // increment nonce + nonce += U256::from(1); + >::put(nonce); + Ok(().into()) + } + fn burn(id: T::TokenId, who: H160, amount: T::Balance) -> DispatchResultWithPostInfo { + let address = >::get(&id).ok_or(Error::::IdNotClaimed)?; + // check that `who` has at least `amount` of `id` token + let balance = Self::balance_of(id, who)?; + let amount_to_burn = if amount > balance { balance } else { amount }; + ensure!( + amount_to_burn > T::Balance::zero(), + Error::::NotEnoughBalanceToBurn + ); + let mut nonce = >::get(); + let mut input = hex_literal::hex!("9dc29fac").to_vec(); + // append address + input.extend_from_slice(H256::from(who.clone()).as_bytes()); + // append amount + input.extend_from_slice( + H256::from_uint(&U256::from(amount_to_burn.saturated_into::())).as_bytes(), + ); + match T::Runner::call( + // source: H160 + Self::sudo_caller(), + // target + address, + // input: Vec + input, + // value: U256 + U256::zero(), + // gas limit: U256 + U256::from(0x10000000).low_u64(), + // gas price: U256 + Some(U256::from(1)), + // nonce: Option + Some(nonce), + // config: EvmConfig + T::config(), + )? { + ExecutionInfo { + exit_reason: ExitReason::Succeed(_), + .. + } => { + Self::deposit_event(Event::Burned( + id, + T::AddressMapping::into_account_id(who), + amount_to_burn, + )); + } + ExecutionInfo { + exit_reason: reason, + .. + } => { + Self::deposit_event(Event::EvmCallFailed(EvmCall::Burn, reason)); + } + } + // increment nonce + nonce += U256::from(1); + >::put(nonce); + Ok(().into()) + } + /// Gets total issuance for the given token if it exists in local evm instance + fn total_issuance(id: T::TokenId) -> Result { + let address = >::get(id).ok_or(Error::::IdNotClaimed)?; + let mut nonce = >::get(); + // first 4 bytes of hex output of Sha3("totalSupply()") + let input = hex_literal::hex!("18160ddd").to_vec(); + match T::Runner::call( + // source: H160 + Self::sudo_caller(), + // target + address, + // input: Vec + input, + // value: U256 + U256::zero(), + // gas limit: U256 + U256::from(0x10000000).low_u64(), + // gas price: U256 + Some(U256::from(1)), + // nonce: Option + Some(nonce), + // config: EvmConfig + T::config(), + ) { + Ok(ExecutionInfo { + exit_reason: ExitReason::Succeed(_), + value: result, + .. + }) => { + // increment nonce + nonce += U256::from(1); + >::put(nonce); + let value = U256::from(result.as_slice()).saturated_into::(); + Ok(value.saturated_into::()) + } + Ok(ExecutionInfo { + exit_reason: reason, + .. + }) => { + // increment nonce + nonce += U256::from(1); + >::put(nonce); + Self::deposit_event(Event::EvmCallFailed(EvmCall::TotalIssuance, reason)); + Ok(T::Balance::zero()) + } + Err(e) => Err(e.into()), + } + } + /// Gets token balance for the account + fn balance_of(id: T::TokenId, who: H160) -> Result { + let address = >::get(id).ok_or(Error::::IdNotClaimed)?; + let mut nonce = >::get(); + // first 4 bytes of hex output of Sha3("balanceOf(address)") + let mut input = hex_literal::hex!("70a08231").to_vec(); + // append address + input.extend_from_slice(H256::from(who).as_bytes()); + match T::Runner::call( + // source: H160 + Self::sudo_caller(), + // target + address, + // input: Vec + input, + // value: U256 + U256::zero(), + // gas limit: U256 + U256::from(0x10000000).low_u64(), + // gas price: U256 + Some(U256::from(1)), + // nonce: Option + Some(nonce), + // config: EvmConfig + T::config(), + ) { + Ok(ExecutionInfo { + exit_reason: ExitReason::Succeed(_), + value: result, + .. + }) => { + // increment nonce + nonce += U256::from(1); + >::put(nonce); + let value = U256::from(result.as_slice()).saturated_into::(); + return Ok(value.saturated_into::()); + } + Ok(ExecutionInfo { + exit_reason: reason, + .. + }) => { + // increment nonce + nonce += U256::from(1); + >::put(nonce); + Self::deposit_event(Event::EvmCallFailed(EvmCall::BalanceOf, reason)); + Ok(T::Balance::zero()) + } + Err(e) => Err(e.into()), + } + } + } +} diff --git a/pallets/token-factory/src/mock.rs b/pallets/token-factory/src/mock.rs new file mode 100644 index 00000000000..495c8c400da --- /dev/null +++ b/pallets/token-factory/src/mock.rs @@ -0,0 +1,202 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Token Factory Mock Runtime +use crate as token_factory; +use frame_support::parameter_types; +use sp_core::{H160, H256}; +use sp_io::TestExternalities; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + ModuleId, +}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Module, Call, Config, Storage, Event}, + Sudo: pallet_sudo::{Module, Call, Config, Storage, Event}, + Balances: pallet_balances::{Module, Call, Config, Storage, Event}, + Evm: pallet_evm::{Module, Call, Storage, Event}, + TokenFactory: token_factory::{Module, Call, Storage, Event}, + } +); + +pub struct BlockEverything; +impl frame_support::traits::Filter for BlockEverything { + fn filter(_: &Call) -> bool { + false + } +} + +parameter_types! { + pub const MinimumPeriod: u64 = 6000 / 2; +} + +impl pallet_timestamp::Config for Test { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +pub struct FixedGasPrice; +impl pallet_evm::FeeCalculator for FixedGasPrice { + fn min_gas_price() -> sp_core::U256 { + 1.into() + } +} + +impl pallet_sudo::Config for Test { + type Event = Event; + type Call = Call; +} + +parameter_types! { + pub const TransactionByteFee: u64 = 1; + pub const ChainId: u64 = 42; + pub const EVMModuleId: ModuleId = ModuleId(*b"py/evmpa"); +} + +impl pallet_evm::Config for Test { + type FeeCalculator = FixedGasPrice; + type GasWeightMapping = (); + type CallOrigin = pallet_evm::EnsureAddressSame; + type WithdrawOrigin = pallet_evm::EnsureAddressSame; + type AddressMapping = pallet_evm::IdentityAddressMapping; + type Currency = Balances; + type Event = Event; + type Precompiles = (); + type Runner = pallet_evm::runner::stack::Runner; + type ChainId = ChainId; +} + +parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for Test { + type BaseCallFilter = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Call = Call; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = (); + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); +} +type Balance = u64; +type AccountId = H160; +parameter_types! { + pub const MaxLocks: u32 = 50; + pub const ExistentialDeposit: u64 = 500; +} +impl pallet_balances::Config for Test { + type MaxLocks = MaxLocks; + type Balance = Balance; + type Event = Event; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); +} +pub struct AccountToH160; +impl sp_runtime::traits::Convert for AccountToH160 { + fn convert(from: H160) -> H160 { + from + } +} +impl token_factory::Config for Test { + type Event = Event; + type Balance = Balance; + type TokenId = u8; + type AccountToH160 = AccountToH160; +} + +pub(crate) fn last_event() -> Event { + System::events().pop().expect("Event expected").event +} + +pub(crate) fn root_address() -> H160 { + use sp_std::str::FromStr; + H160::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap() +} + +pub(crate) fn alice() -> H160 { + use sp_std::str::FromStr; + H160::from_str("1000000000000000000000000000000000000001").unwrap() +} + +pub(crate) fn bob() -> H160 { + use sp_std::str::FromStr; + H160::from_str("1000000000000000000000000000000000000002").unwrap() +} + +pub(crate) fn charlie() -> H160 { + use sp_std::str::FromStr; + H160::from_str("1000000000000000000000000000000000000003").unwrap() +} + +pub(crate) fn deploy_addresses() -> Vec { + use sp_std::str::FromStr; + vec![ + H160::from_str("c2bf5f29a4384b1ab0c063e1c666f02121b6084a").unwrap(), + H160::from_str("5c4242beb94de30b922f57241f1d02f36e906915").unwrap(), + H160::from_str("42e2ee7ba8975c473157634ac2af4098190fc741").unwrap(), + H160::from_str("f8cef78e923919054037a1d03662bbd884ff4edf").unwrap(), + H160::from_str("e573bca813c741229ffb2488f7856c6caa841041").unwrap(), + H160::from_str("bb0cc0fb3e0c06725c67167501f850b4900d6db5").unwrap(), + H160::from_str("fe5d3c52f7ee9aa32a69b96bfbb088ba0bcd8efc").unwrap(), + H160::from_str("92496871560a01551e1b4fd04540d7a519d5c19e").unwrap(), + H160::from_str("63a1519ee99d1121780fffa1726ed2ecc6d1611b").unwrap(), + H160::from_str("dc552396caec809752fed0c5e23fd3983766e758").unwrap(), + ] +} + +pub(crate) fn genesis(balances: Vec<(AccountId, Balance)>) -> TestExternalities { + let mut storage = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + let genesis = pallet_balances::GenesisConfig:: { balances }; + genesis.assimilate_storage(&mut storage).unwrap(); + let genesis = pallet_sudo::GenesisConfig:: { + key: root_address(), + }; + genesis.assimilate_storage(&mut storage).unwrap(); + let mut ext = sp_io::TestExternalities::from(storage); + ext.execute_with(|| System::set_block_number(1)); + ext +} diff --git a/pallets/token-factory/src/tests.rs b/pallets/token-factory/src/tests.rs new file mode 100644 index 00000000000..1e0631b501c --- /dev/null +++ b/pallets/token-factory/src/tests.rs @@ -0,0 +1,172 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Token Factory Unit Tests +use crate::mock::{ + alice, bob, charlie, deploy_addresses, genesis, last_event, root_address, Event as TestEvent, + Origin, Test, TokenFactory, +}; +use crate::{pallet::TokenMinter, Error, Event}; +use frame_support::{assert_err, assert_noop, assert_ok}; + +#[test] +fn registration() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + let tokens_to_register = 10u8; + let addresses = deploy_addresses(); + for i in 0..tokens_to_register { + let address = addresses[i as usize]; + assert!(!TokenFactory::exists(&i)); + assert_ok!(TokenFactory::register_token(Origin::root(), i)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Registered(i, address)) + ); + assert!(TokenFactory::exists(&i)); + assert_eq!(TokenFactory::contract_address(i).unwrap(), address); + } + }); +} + +#[test] +fn de_registration() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + assert_noop!( + TokenFactory::destroy_all(Origin::root(), 1u8), + Error::::IdNotClaimed + ); + assert_ok!(TokenFactory::register_token(Origin::root(), 1u8)); + assert_ok!(TokenFactory::destroy_all(Origin::root(), 1u8)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::DestroyedAll(1u8, 0u64)) + ); + assert!(!TokenFactory::exists(&1u8)); + assert!(TokenFactory::contract_address(1u8).is_none()); + }); +} + +#[test] +fn minting() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + assert_ok!(TokenFactory::register_token(Origin::root(), 1u8)); + assert_noop!( + TokenFactory::mint(0u8, alice(), 10000), + Error::::IdNotClaimed + ); + assert_ok!(TokenFactory::mint(1u8, alice(), 10000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Minted(1, alice(), 10000)) + ); + assert_ok!(TokenFactory::mint(1u8, bob(), 10000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Minted(1, bob(), 10000)) + ); + assert_ok!(TokenFactory::mint(1u8, charlie(), 10000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Minted(1, charlie(), 10000)) + ); + assert_eq!(TokenFactory::total_issuance(1u8).unwrap(), 30000); + assert_eq!(TokenFactory::balance_of(1u8, alice()).unwrap(), 10000); + assert_eq!(TokenFactory::balance_of(1u8, bob()).unwrap(), 10000); + assert_eq!(TokenFactory::balance_of(1u8, charlie()).unwrap(), 10000); + }); +} + +#[test] +fn burning() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + assert_ok!(TokenFactory::register_token(Origin::root(), 1u8)); + assert_noop!( + TokenFactory::burn(0u8, alice(), 10000), + Error::::IdNotClaimed + ); + // not a noop because we still iterate the nonce when we get balance_of before burning + assert_err!( + TokenFactory::burn(1u8, alice(), 5000), + Error::::NotEnoughBalanceToBurn + ); + assert_ok!(TokenFactory::mint(1u8, alice(), 10000)); + assert_err!( + TokenFactory::burn(1u8, bob(), 5000), + Error::::NotEnoughBalanceToBurn + ); + assert_ok!(TokenFactory::mint(1u8, bob(), 10000)); + assert_err!( + TokenFactory::burn(1u8, charlie(), 5000), + Error::::NotEnoughBalanceToBurn + ); + assert_ok!(TokenFactory::mint(1u8, charlie(), 10000)); + assert_ok!(TokenFactory::burn(1u8, alice(), 5000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Burned(1, alice(), 5000)) + ); + assert_ok!(TokenFactory::burn(1u8, bob(), 5000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Burned(1, bob(), 5000)) + ); + assert_ok!(TokenFactory::burn(1u8, charlie(), 10000)); + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Burned(1, charlie(), 10000)) + ); + assert_eq!(TokenFactory::total_issuance(1u8).unwrap(), 10000); + assert_eq!(TokenFactory::balance_of(1u8, alice()).unwrap(), 5000); + assert_eq!(TokenFactory::balance_of(1u8, bob()).unwrap(), 5000); + assert_eq!(TokenFactory::balance_of(1u8, charlie()).unwrap(), 0); + }); +} + +#[test] +fn get_total_supply() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + assert_ok!(TokenFactory::register_token(Origin::root(), 1u8)); + assert_ok!(TokenFactory::total_issuance(1u8)); + // implies that the error event was not emitted in total issuance call + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Registered(1u8, deploy_addresses()[0])) + ); + assert_eq!(TokenFactory::total_issuance(1u8).unwrap(), 0u64); + assert_noop!( + TokenFactory::total_issuance(2u8), + Error::::IdNotClaimed + ); + }); +} + +#[test] +fn get_balance_of() { + genesis(vec![(root_address(), 5000000000000)]).execute_with(|| { + assert_ok!(TokenFactory::register_token(Origin::root(), 1u8)); + assert_ok!(TokenFactory::balance_of(1u8, root_address())); + // implies that the error event was not emitted in total issuance call + assert_eq!( + last_event(), + TestEvent::token_factory(Event::Registered(1u8, deploy_addresses()[0])) + ); + assert_eq!(TokenFactory::balance_of(1u8, root_address()).unwrap(), 0u64); + assert_noop!( + TokenFactory::balance_of(2u8, root_address()), + Error::::IdNotClaimed + ); + }); +} diff --git a/pallets/xtransfer/Cargo.toml b/pallets/xtransfer/Cargo.toml new file mode 100644 index 00000000000..f9de1379a64 --- /dev/null +++ b/pallets/xtransfer/Cargo.toml @@ -0,0 +1,36 @@ +[package] +authors = ["PureStake"] +edition = "2018" +name = "xtransfer" +version = "0.1.0" +description = "interface for handling cross-chain transfers to relay chain or other parachains" + +[dependencies] +parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } + +hrmp-channels = { path = "../hrmp-channels", default-features = false } +token-factory = { path = "../token-factory", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "rococo-v1", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "rococo-v1", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "rococo-v1", default-features = false } + +[features] +default = ["std"] +std = [ + "parity-scale-codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-std/std", + "sp-core/std", + "hrmp-channels/std", + "token-factory/std", + "xcm-executor/std", + "cumulus-primitives-core/std", +] diff --git a/pallets/xtransfer/src/currency_adapter.rs b/pallets/xtransfer/src/currency_adapter.rs new file mode 100644 index 00000000000..3e0be1d8858 --- /dev/null +++ b/pallets/xtransfer/src/currency_adapter.rs @@ -0,0 +1,178 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Currency adapter implementation for processing cross-chain messages +use crate::support::CurrencyIdConversion; +use frame_support::traits::{Currency, ExistenceRequirement, WithdrawReasons}; +use sp_std::{marker::PhantomData, prelude::*, result}; +use token_factory::{CurrencyId, Ticker}; +use xcm::v0::{Error as XcmError, MultiAsset, MultiLocation, Result as XcmResult}; +use xcm_executor::traits::{LocationConversion, MatchesFungible, TransactAsset}; + +/// Asset transaction errors. +enum Error { + /// Failed to match fungible. + FailedToMatchFungible, + /// `MultiLocation` to `AccountId` Conversion failed. + AccountIdConversionFailed, + /// `CurrencyId` conversion failed. + CurrencyIdConversionFailed, +} + +impl From for XcmError { + fn from(e: Error) -> Self { + match e { + Error::FailedToMatchFungible => { + XcmError::FailedToTransactAsset("FailedToMatchFungible") + } + Error::AccountIdConversionFailed => { + XcmError::FailedToTransactAsset("AccountIdConversionFailed") + } + Error::CurrencyIdConversionFailed => { + XcmError::FailedToTransactAsset("CurrencyIdConversionFailed") + } + } + } +} + +/// The handler for processing cross-chain messages +pub struct MultiCurrencyAdapter< + NativeCurrency, + TokenFactory, + Matcher, + AccountIdConverter, + AccountId, + CurrencyIdConverter, + CurrencyId, +>( + PhantomData<( + NativeCurrency, + TokenFactory, + Matcher, + AccountIdConverter, + AccountId, + CurrencyIdConverter, + CurrencyId, + )>, +); + +impl< + NativeCurrency: Currency, + TokenFactory: token_factory::TokenMinter, + Matcher: MatchesFungible, + AccountIdConverter: LocationConversion, + AccountId: sp_std::fmt::Debug + Clone, + CurrencyIdConverter: CurrencyIdConversion, + > TransactAsset + for MultiCurrencyAdapter< + NativeCurrency, + TokenFactory, + Matcher, + AccountIdConverter, + AccountId, + CurrencyIdConverter, + CurrencyId, + > +{ + fn deposit_asset(asset: &MultiAsset, location: &MultiLocation) -> XcmResult { + // debug::info!("------------------------------------------------"); + // debug::info!( + // ">>> trying deposit. asset: {:?}, location: {:?}", + // asset, + // location + // ); + let who = AccountIdConverter::from_location(location).ok_or(())?; + //debug::info!("who: {:?}", who); + let currency = CurrencyIdConverter::from_asset(asset).ok_or(())?; + //debug::info!("currency_id: {:?}", currency); + let amount: NativeCurrency::Balance = Matcher::matches_fungible(&asset).ok_or(())?; + //debug::info!("amount: {:?}", amount); + // match on currency variant + if let CurrencyId::Token(token_id) = currency { + // mint erc20 token to `who` + TokenFactory::mint(token_id, who.clone(), amount).map_err(|error| { + // debug::info!( + // "Token factory `mint` failed + // \n token_id: {:?}\n who: {:?}\n amount: {:?}\n error: {:?}", + // token_id, + // who, + // amount, + // error + // ); + () + })?; + } else { + // native currency transfer via `frame/pallet_balances` is only other variant + NativeCurrency::deposit_creating(&who, amount); + } + // debug::info!(">>> successful deposit."); + // debug::info!("------------------------------------------------"); + Ok(()) + } + + fn withdraw_asset( + asset: &MultiAsset, + location: &MultiLocation, + ) -> result::Result { + // debug::info!("------------------------------------------------"); + // debug::info!( + // ">>> trying withdraw. asset: {:?}, location: {:?}", + // asset, + // location + // ); + let who = AccountIdConverter::from_location(location).ok_or(())?; + //debug::info!("who: {:?}", who); + let currency = CurrencyIdConverter::from_asset(asset).ok_or(())?; + //debug::info!("currency_id: {:?}", currency); + let amount: NativeCurrency::Balance = Matcher::matches_fungible(&asset).ok_or(())?; + //debug::info!("amount: {:?}", amount); + // match on currency variant + if let CurrencyId::Token(token_id) = currency { + // burn erc20 token from `who` + TokenFactory::burn(token_id, who.clone(), amount).map_err(|error| { + // debug::info!( + // "Token factory `burn` failed + // \n token_id: {:?}\n who: {:?}\n amount: {:?}\n error: {:?}", + // token_id, + // who, + // amount, + // error + // ); + () + })?; + } else { + // native currency transfer via `frame/pallet_balances` is only other variant + NativeCurrency::withdraw( + &who, + amount, + WithdrawReasons::TRANSFER, + ExistenceRequirement::AllowDeath, + ) + .map_err(|error| { + // debug::info!( + // "Native currency `withdraw` failed\n who: {:?}\n amount: {:?}\n error: {:?}", + // who, + // amount, + // error + // ); + () + })?; + } + // debug::info!(">>> successful withdraw."); + // debug::info!("------------------------------------------------"); + Ok(asset.clone()) + } +} diff --git a/pallets/xtransfer/src/lib.rs b/pallets/xtransfer/src/lib.rs new file mode 100644 index 00000000000..41373398e8f --- /dev/null +++ b/pallets/xtransfer/src/lib.rs @@ -0,0 +1,519 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Xtransfer handles cross-chain transfers. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod currency_adapter; +pub mod support; + +use frame_support::pallet; + +pub use pallet::*; + +#[pallet] +pub mod pallet { + use cumulus_primitives_core::{relay_chain::Balance as RelayChainBalance, ParaId}; + use frame_support::{pallet_prelude::*, traits::Get, transactional}; + use frame_system::pallet_prelude::*; + use sp_runtime::traits::{AtLeast32BitUnsigned, Convert}; + use sp_std::{convert::Into, prelude::*}; + use token_factory::CurrencyId; + use xcm::v0::{ + Error as XcmError, ExecuteXcm, Junction, MultiAsset, MultiLocation, NetworkId, Order, Xcm, + }; + use xcm_executor::traits::LocationConversion; + + #[derive(Encode, Decode, Eq, PartialEq, Clone, Copy, RuntimeDebug)] + /// Identity of chain. + pub enum ChainId { + /// The relay chain. + RelayChain, + /// A parachain. + ParaChain(ParaId), + } + + #[derive(Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug)] + /// Identity of cross chain currency. + pub struct XCurrencyId { + /// The reserve chain of the currency. For instance, the reserve chain + /// of DOT is Polkadot. + pub chain_id: ChainId, + /// The identity of the currency. + pub currency_id: Vec, + } + + impl Into for XCurrencyId { + fn into(self) -> MultiLocation { + MultiLocation::X1(Junction::GeneralKey(self.currency_id)) + } + } + + /// Pallet for executing cross-chain transfers + #[pallet::pallet] + pub struct Pallet(PhantomData); + + /// The shape of AccountId for (most) substrate chains (not Moonbeam, which is H160 => 20 bytes) + type AccountId32 = [u8; 32]; + + /// Configuration trait of this pallet. + #[pallet::config] + pub trait Config: frame_system::Config + hrmp_channels::Config { + /// Overarching event type + type Event: From> + IsType<::Event>; + /// Balances type + type Balance: Parameter + + Member + + AtLeast32BitUnsigned + + Default + + Copy + + MaybeSerializeDeserialize + + Into; + /// Convert local balance into relay chain balance type + type ToRelayChainBalance: Convert; + /// Convert system::AccountId to key shape for Junction::AccountKey20 [u8; 20] + type AccountKey20Convert: Convert; + /// Convert account to MultiLocation + type ToMultiLocation: LocationConversion; + /// Relay chain identifier + type RelayChainNetworkId: Get; + /// XCM Executor for executing XCM effects locally + type XcmExecutor: ExecuteXcm; + } + + #[pallet::event] + #[pallet::generate_deposit(fn deposit_event)] + pub enum Event { + /// Transferred to relay chain. \[src, dest, amount\] + TransferredToRelayChain(T::AccountId, AccountId32, T::Balance), + /// Transfer to relay chain failed. \[src, dest, amount, error\] + TransferToRelayChainFailed(T::AccountId, AccountId32, T::Balance, XcmError), + /// Transferred to parachain. \[x_currency_id, src, para_id, dest, dest_network, amount\] + TransferredToAccountId32Parachain( + XCurrencyId, + T::AccountId, + ParaId, + AccountId32, + NetworkId, + T::Balance, + ), + /// Transfer to parachain failed. \[x_currency_id, src, para_id, dest, + /// dest_network, amount, error\] + TransferToAccountId32ParachainFailed( + XCurrencyId, + T::AccountId, + ParaId, + AccountId32, + NetworkId, + T::Balance, + XcmError, + ), + /// Transferred to parachain. \[x_currency_id, src, para_id, dest, dest_network, amount\] + TransferredToAccountKey20Parachain( + XCurrencyId, + T::AccountId, + ParaId, + T::AccountId, + NetworkId, + T::Balance, + ), + /// Transfer to parachain failed. \[x_currency_id, src, para_id, dest, + /// dest_network, amount, error\] + TransferToAccountKey20ParachainFailed( + XCurrencyId, + T::AccountId, + ParaId, + T::AccountId, + NetworkId, + T::Balance, + XcmError, + ), + } + + #[pallet::error] + pub enum Error { + /// Bad location. + BadLocation, + /// Cannot send message from parachain to self + CannotSendToSelf, + /// Call to SendXcm failed + FailedToSendXcm, + /// Maximum one channel per relation ~ (sender,receiver) and direction matters + MaxOneChannelPerRelation, + /// Cannot accept a recipient channel request not in local storage + RecipientRequestDNE, + /// Requires existing open channel with self as sender + NoSenderChannelOpen, + /// Requires existing open channel with self as recipient + NoRecipientChannelOpen, + } + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet { + /// Transfer relay chain tokens to relay chain. + #[pallet::weight(10)] + #[transactional] + pub fn transfer_to_relay_chain( + origin: OriginFor, + dest: AccountId32, + amount: T::Balance, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + let xcm = Xcm::WithdrawAsset { + assets: vec![MultiAsset::ConcreteFungible { + id: MultiLocation::X1(Junction::Parent), + amount: T::ToRelayChainBalance::convert(amount), + }], + effects: vec![Order::InitiateReserveWithdraw { + assets: vec![MultiAsset::All], + reserve: MultiLocation::X1(Junction::Parent), + effects: vec![Order::DepositAsset { + assets: vec![MultiAsset::All], + dest: MultiLocation::X1(Junction::AccountId32 { + network: T::RelayChainNetworkId::get(), + id: dest.clone(), + }), + }], + }], + }; + + let xcm_origin = T::ToMultiLocation::try_into_location(who.clone()) + .map_err(|_| Error::::BadLocation)?; + // TODO: revert state on xcm execution failure. + match T::XcmExecutor::execute_xcm(xcm_origin, xcm) { + Ok(_) => { + Self::deposit_event(Event::::TransferredToRelayChain(who, dest, amount)) + } + Err(err) => Self::deposit_event(Event::::TransferToRelayChainFailed( + who, dest, amount, err, + )), + } + + Ok(().into()) + } + /// Transfer tokens to parachain that uses [u8; 32] for system::AccountId + /// - channel must be open with self as sender + #[pallet::weight(10)] + #[transactional] + pub fn transfer_to_account_id_32_parachain( + origin: OriginFor, + x_currency_id: XCurrencyId, + para_id: ParaId, + dest: AccountId32, + dest_network: NetworkId, + amount: T::Balance, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + ensure!(para_id != T::ParaId::get(), Error::::CannotSendToSelf); + // ensure!( + // >::sender_channels().contains(¶_id), + // Error::::NoSenderChannelOpen + // ); + + let destination = Self::account_id_32_destination(dest_network.clone(), &dest); + + let xcm = match x_currency_id.chain_id { + ChainId::RelayChain => { + Self::transfer_relay_chain_tokens_to_parachain(para_id, destination, amount) + } + ChainId::ParaChain(reserve_chain) => { + if T::ParaId::get() == reserve_chain { + Self::transfer_owned_tokens_to_parachain( + x_currency_id.clone(), + para_id, + destination, + amount, + ) + } else { + Self::transfer_non_owned_tokens_to_parachain( + reserve_chain, + x_currency_id.clone(), + para_id, + destination, + amount, + ) + } + } + }; + + let xcm_origin = T::ToMultiLocation::try_into_location(who.clone()) + .map_err(|_| Error::::BadLocation)?; + // TODO: revert state on xcm execution failure. + match T::XcmExecutor::execute_xcm(xcm_origin, xcm) { + Ok(_) => Self::deposit_event(Event::::TransferredToAccountId32Parachain( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + )), + Err(err) => Self::deposit_event(Event::::TransferToAccountId32ParachainFailed( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + err, + )), + } + + Ok(().into()) + } + /// Transfer native tokens to other parachain that uses [u8; 20] + /// - assumes channel already exists with self (but not checked for now) + #[pallet::weight(10)] + #[transactional] + pub fn transfer_native( + origin: OriginFor, + para_id: ParaId, + dest: T::AccountId, + amount: T::Balance, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let self_id = T::ParaId::get(); + // TODO: ensure channel exists + ensure!(para_id != self_id, Error::::CannotSendToSelf); + let x_currency_id = XCurrencyId { + chain_id: ChainId::ParaChain(self_id), + currency_id: CurrencyId::Native.into(), + }; + let dest_network = T::RelayChainNetworkId::get(); + let destination = Self::account_key_20_destination(dest_network.clone(), dest.clone()); + let xcm = Self::transfer_owned_tokens_to_parachain( + x_currency_id.clone(), + para_id, + destination, + amount, + ); + let xcm_origin = T::ToMultiLocation::try_into_location(who.clone()) + .map_err(|_| Error::::BadLocation)?; + // TODO: revert state on xcm execution failure. + match T::XcmExecutor::execute_xcm(xcm_origin, xcm) { + Ok(_) => Self::deposit_event(Event::::TransferredToAccountKey20Parachain( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + )), + Err(err) => Self::deposit_event(Event::::TransferToAccountKey20ParachainFailed( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + err, + )), + } + Ok(().into()) + } + /// Transfer tokens to parachain that uses [u8; 20] for system::AccountId + /// - channel must be open with self as sender + #[pallet::weight(10)] + #[transactional] + pub fn transfer_to_account_key_20_parachain( + origin: OriginFor, + x_currency_id: XCurrencyId, + para_id: ParaId, + dest: T::AccountId, + dest_network: NetworkId, + amount: T::Balance, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + ensure!(para_id != T::ParaId::get(), Error::::CannotSendToSelf); + // ensure!( + // >::sender_channels().contains(¶_id), + // Error::::NoSenderChannelOpen + // ); + + let destination = Self::account_key_20_destination(dest_network.clone(), dest.clone()); + + let xcm = match x_currency_id.chain_id { + ChainId::RelayChain => { + Self::transfer_relay_chain_tokens_to_parachain(para_id, destination, amount) + } + ChainId::ParaChain(reserve_chain) => { + if T::ParaId::get() == reserve_chain { + Self::transfer_owned_tokens_to_parachain( + x_currency_id.clone(), + para_id, + destination, + amount, + ) + } else { + Self::transfer_non_owned_tokens_to_parachain( + reserve_chain, + x_currency_id.clone(), + para_id, + destination, + amount, + ) + } + } + }; + + let xcm_origin = T::ToMultiLocation::try_into_location(who.clone()) + .map_err(|_| Error::::BadLocation)?; + // TODO: revert state on xcm execution failure. + match T::XcmExecutor::execute_xcm(xcm_origin, xcm) { + Ok(_) => Self::deposit_event(Event::::TransferredToAccountKey20Parachain( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + )), + Err(err) => Self::deposit_event(Event::::TransferToAccountKey20ParachainFailed( + x_currency_id, + who, + para_id, + dest, + dest_network, + amount, + err, + )), + } + + Ok(().into()) + } + } + + impl Pallet { + /// Form multilocation when recipient chain uses AccountId32 as system::AccountId type + fn account_id_32_destination(network: NetworkId, id: &AccountId32) -> MultiLocation { + MultiLocation::X1(Junction::AccountId32 { + network, + id: id.clone(), + }) + } + /// Form multilocation when recipient chain uses AccountKey20 as system::AccountId type + fn account_key_20_destination(network: NetworkId, key: T::AccountId) -> MultiLocation { + MultiLocation::X1(Junction::AccountKey20 { + network, + key: T::AccountKey20Convert::convert(key).clone(), + }) + } + /// Returns upward message to transfer tokens from relay chain to parachain + fn transfer_relay_chain_tokens_to_parachain( + para_id: ParaId, + destination: MultiLocation, + amount: T::Balance, + ) -> Xcm { + Xcm::WithdrawAsset { + assets: vec![MultiAsset::ConcreteFungible { + id: MultiLocation::X1(Junction::Parent), + amount: T::ToRelayChainBalance::convert(amount), + }], + effects: vec![Order::InitiateReserveWithdraw { + assets: vec![MultiAsset::All], + reserve: MultiLocation::X1(Junction::Parent), + effects: vec![Order::DepositReserveAsset { + assets: vec![MultiAsset::All], + // `dest` is children parachain(of parent). + dest: MultiLocation::X1(Junction::Parachain { id: para_id.into() }), + effects: vec![Order::DepositAsset { + assets: vec![MultiAsset::All], + dest: destination, + }], + }], + }], + } + } + /// Transfer parachain tokens "owned" by self parachain to another + /// parachain. + /// + /// NOTE - `para_id` must not be self parachain. + fn transfer_owned_tokens_to_parachain( + x_currency_id: XCurrencyId, + para_id: ParaId, + destination: MultiLocation, + amount: T::Balance, + ) -> Xcm { + Xcm::WithdrawAsset { + assets: vec![MultiAsset::ConcreteFungible { + id: x_currency_id.into(), + amount: amount.into(), + }], + effects: vec![Order::DepositReserveAsset { + assets: vec![MultiAsset::All], + dest: MultiLocation::X2( + Junction::Parent, + Junction::Parachain { id: para_id.into() }, + ), + effects: vec![Order::DepositAsset { + assets: vec![MultiAsset::All], + dest: destination, + }], + }], + } + } + /// Transfer parachain tokens not "owned" by self chain to another + /// parachain. + fn transfer_non_owned_tokens_to_parachain( + reserve_chain: ParaId, + x_currency_id: XCurrencyId, + para_id: ParaId, + destination: MultiLocation, + amount: T::Balance, + ) -> Xcm { + let deposit_to_dest = Order::DepositAsset { + assets: vec![MultiAsset::All], + dest: destination, + }; + // If transfer to reserve chain, deposit to `dest` on reserve chain, + // else deposit reserve asset. + let reserve_chain_order = if para_id == reserve_chain { + deposit_to_dest + } else { + Order::DepositReserveAsset { + assets: vec![MultiAsset::All], + dest: MultiLocation::X2( + Junction::Parent, + Junction::Parachain { id: para_id.into() }, + ), + effects: vec![deposit_to_dest], + } + }; + + Xcm::WithdrawAsset { + assets: vec![MultiAsset::ConcreteFungible { + id: x_currency_id.into(), + amount: amount.into(), + }], + effects: vec![Order::InitiateReserveWithdraw { + assets: vec![MultiAsset::All], + reserve: MultiLocation::X2( + Junction::Parent, + Junction::Parachain { + id: reserve_chain.into(), + }, + ), + effects: vec![reserve_chain_order], + }], + } + } + } +} diff --git a/pallets/xtransfer/src/support.rs b/pallets/xtransfer/src/support.rs new file mode 100644 index 00000000000..a1319cffa6f --- /dev/null +++ b/pallets/xtransfer/src/support.rs @@ -0,0 +1,82 @@ +// Copyright 2019-2020 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! XCM objects and relationships +use frame_support::traits::Get; +use sp_runtime::traits::{CheckedConversion, Convert}; +use sp_std::{ + convert::{TryFrom, TryInto}, + marker::PhantomData, + prelude::*, +}; +use xcm::v0::{Junction, MultiAsset, MultiLocation}; +use xcm_executor::traits::MatchesFungible; + +pub trait CurrencyIdConversion { + fn from_asset(asset: &MultiAsset) -> Option; +} + +/// Matcher associated type for MultiCurrencyAdapter to convert assets into local types +pub struct IsConcreteWithGeneralKey( + PhantomData<(CurrencyId, FromRelayChainBalance)>, +); +impl MatchesFungible + for IsConcreteWithGeneralKey +where + CurrencyId: TryFrom>, + B: TryFrom, + FromRelayChainBalance: Convert, +{ + fn matches_fungible(a: &MultiAsset) -> Option { + if let MultiAsset::ConcreteFungible { id, amount } = a { + if id == &MultiLocation::X1(Junction::Parent) { + // Convert relay chain decimals to local chain + let local_amount = FromRelayChainBalance::convert(*amount); + return CheckedConversion::checked_from(local_amount); + } + if let Some(Junction::GeneralKey(key)) = id.last() { + if TryInto::::try_into(key.clone()).is_ok() { + return CheckedConversion::checked_from(*amount); + } + } + } + None + } +} + +/// Converter from MultiAsset to local Currency type +pub struct CurrencyIdConverter( + PhantomData, + PhantomData, +); +impl CurrencyIdConversion + for CurrencyIdConverter +where + CurrencyId: TryFrom>, + RelayChainCurrencyId: Get, +{ + fn from_asset(asset: &MultiAsset) -> Option { + if let MultiAsset::ConcreteFungible { id: location, .. } = asset { + if location == &MultiLocation::X1(Junction::Parent) { + return Some(RelayChainCurrencyId::get()); + } + if let Some(Junction::GeneralKey(key)) = location.last() { + return CurrencyId::try_from(key.clone()).ok(); + } + } + None + } +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 0dafb34c5f2..d482dc240d1 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -16,8 +16,12 @@ hex-literal = "0.3.1" precompiles = { path = "precompiles/", default-features = false } account = { path = "account/", default-features = false } pallet-ethereum-chain-id = { path = "../pallets/ethereum-chain-id", default-features = false } +author-inherent = { path = "../pallets/author-inherent", default-features = false } parachain-staking = { path = "../pallets/parachain-staking", default-features = false } pallet-author-filter = { path = "../pallets/author-filter", default-features = false } +token-factory = { path = "../pallets/token-factory", default-features = false } +hrmp-channels = { path = "../pallets/hrmp-channels", default-features = false } +xtransfer = { path = "../pallets/xtransfer", default-features = false } # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "rococo-v1" } @@ -57,10 +61,12 @@ moonbeam-rpc-primitives-txpool = { path = "../primitives/rpc/txpool", default-fe # Cumulus dependencies cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } - -# TODO Why can't this come directly from cumulus -parachain-info = { path = "../pallets/parachain-info", default-features = false } -author-inherent = { path = "../pallets/author-inherent", default-features = false } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "rococo-v1" } +cumulus-pallet-xcm-handler = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "rococo-v1" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "rococo-v1" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "rococo-v1" } +parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "rococo-v1" } [build-dependencies] substrate-wasm-builder = { version = "4.0.0", git = "https://github.com/paritytech/substrate", branch = "rococo-v1" } @@ -111,6 +117,14 @@ std = [ "account/std", "parachain-staking/std", "pallet-author-filter/std", + "token-factory/std", + "xtransfer/std", + "xcm-builder/std", + "cumulus-pallet-xcm-handler/std", + "xcm-executor/std", + "xcm/std", + "polkadot-parachain/std", + "hrmp-channels/std", ] # Will be enabled by the `wasm-builder` when building the runtime for WASM. diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 336c8cee9cb..be63866ac0d 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -28,6 +28,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +use cumulus_primitives::relay_chain::Balance as RelayChainBalance; use fp_rpc::TransactionStatus; use frame_support::{ construct_runtime, @@ -45,11 +46,12 @@ use pallet_evm::{ use pallet_transaction_payment::CurrencyAdapter; pub use parachain_staking::{InflationInfo, Range}; use parity_scale_codec::{Decode, Encode}; +use polkadot_parachain::primitives::Sibling; use sp_api::impl_runtime_apis; use sp_core::{OpaqueMetadata, H160, H256, U256}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, Verify}, + traits::{BlakeTwo256, Block as BlockT, Convert, IdentifyAccount, IdentityLookup, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Perbill, }; @@ -57,6 +59,17 @@ use sp_std::{convert::TryFrom, prelude::*}; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; +use token_factory::{CurrencyId, Ticker}; +use xcm::v0::{Junction, MultiLocation, NetworkId}; +use xcm_builder::{ + LocationInverter, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SovereignSignedViaLocation, +}; +use xcm_executor::{ + traits::{LocationConversion, NativeAsset}, + XcmExecutor, +}; +use xtransfer::{currency_adapter::*, support::*}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -427,6 +440,168 @@ impl pallet_author_filter::Config for Runtime { type RandomnessSource = RandomnessCollectiveFlip; } +pub struct AccountToH160; +impl Convert<<::Signer as IdentifyAccount>::AccountId, H160> + for AccountToH160 +{ + fn convert(from: <::Signer as IdentifyAccount>::AccountId) -> H160 { + from + } +} +pub struct AccountKey20Convert; +impl Convert<<::Signer as IdentifyAccount>::AccountId, [u8; 20]> + for AccountKey20Convert +{ + fn convert(from: <::Signer as IdentifyAccount>::AccountId) -> [u8; 20] { + from.into() + } +} + +impl token_factory::Config for Runtime { + type Event = Event; + type Balance = Balance; + type TokenId = Ticker; + type AccountToH160 = AccountToH160; +} + +impl hrmp_channels::Config for Runtime { + type Event = Event; + type ParaId = ParachainInfo; + type XcmSender = XcmHandler; +} + +impl xtransfer::Config for Runtime { + type Event = Event; + type Balance = Balance; + type ToRelayChainBalance = NativeToRelay; + type AccountKey20Convert = AccountKey20Convert; + type ToMultiLocation = AccountId20Aliases; + type RelayChainNetworkId = PolkadotNetworkId; + type XcmExecutor = XcmExecutor; +} + +parameter_types! { + pub const PolkadotNetworkId: NetworkId = NetworkId::Polkadot; + pub MoonbeamNetwork: NetworkId = NetworkId::Named("moon".into()); + pub RelayChainOrigin: Origin = cumulus_pallet_xcm_handler::Origin::Relay.into(); + pub Ancestry: MultiLocation = MultiLocation::X1(Junction::Parachain { + id: ParachainInfo::get().into(), + }); + pub const RelayChainCurrencyId: CurrencyId = CurrencyId::Token(Ticker::DOT); +} + +// TODO: replace with `AccountKey20Aliases` once Cumulus version includes this commit +// https://github.com/paritytech/polkadot/pull/2576 +pub struct AccountId20Aliases(PhantomData<(Network, AccountId)>); +impl, AccountId: From<[u8; 20]> + Into<[u8; 20]>> + LocationConversion for AccountId20Aliases +{ + fn from_location(location: &MultiLocation) -> Option { + if let MultiLocation::X1(Junction::AccountKey20 { key, network }) = location { + if matches!(network, NetworkId::Any) || network == &Network::get() { + return Some((*key).into()); + } + } + None + } + + fn try_into_location(who: AccountId) -> Result { + Ok(Junction::AccountKey20 { + key: who.into(), + network: Network::get(), + } + .into()) + } +} +use frame_support::traits::OriginTrait; +use xcm::v0::OriginKind; +use xcm_executor::traits::ConvertOrigin; +// TODO: replace with `SignedAccountKey20AsNative` once Cumulus version includes this commit +// https://github.com/paritytech/polkadot/pull/2576 +pub struct SignedAccountId20AsNative(PhantomData<(Network, Origin)>); +impl, Origin: OriginTrait> ConvertOrigin + for SignedAccountId20AsNative +where + Origin::AccountId: From<[u8; 20]>, +{ + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Native, MultiLocation::X1(Junction::AccountKey20 { key, network })) + if matches!(network, NetworkId::Any) || network == Network::get() => + { + Ok(Origin::signed(key.into())) + } + (_, origin) => Err(origin), + } + } +} + +pub type LocationConverter = ( + ParentIsDefault, + SiblingParachainConvertsVia, + AccountId20Aliases, +); + +pub struct RelayToNative; +impl Convert for RelayToNative { + fn convert(val: u128) -> Balance { + // native is 18 + // relay is 12 + val * 1_000_000 + } +} +pub struct NativeToRelay; +impl Convert for NativeToRelay { + fn convert(val: u128) -> RelayChainBalance { + // native is 18 + // relay is 12 + val / 1_000_000 + } +} + +pub type LocalAssetTransactor = MultiCurrencyAdapter< + Balances, + TokenFactory, + IsConcreteWithGeneralKey, + LocationConverter, + AccountId, + CurrencyIdConverter, + CurrencyId, +>; + +pub type LocalOriginConverter = ( + SovereignSignedViaLocation, + RelayChainAsNative, + SiblingParachainAsNative, + SignedAccountId20AsNative, +); + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type Call = Call; + type XcmSender = XcmHandler; + type AssetTransactor = LocalAssetTransactor; + type OriginConverter = LocalOriginConverter; + type IsReserve = NativeAsset; + type IsTeleporter = (); + type LocationInverter = LocationInverter; +} + +impl cumulus_pallet_xcm_handler::Config for Runtime { + type Event = Event; + type XcmExecutor = XcmExecutor; + type UpwardMessageSender = ParachainSystem; + type HrmpMessageSender = ParachainSystem; +} + +impl cumulus_parachain_system::Config for Runtime { + type Event = Event; + type OnValidationData = (); + type SelfParaId = ParachainInfo; + type DownwardMessageHandlers = (HrmpChannels, XcmHandler); + type HrmpMessageHandlers = XcmHandler; +} + construct_runtime! { pub enum Runtime where Block = Block, @@ -448,6 +623,10 @@ construct_runtime! { ParachainStaking: parachain_staking::{Pallet, Call, Storage, Event, Config}, Scheduler: pallet_scheduler::{Pallet, Storage, Config, Event, Call}, Democracy: pallet_democracy::{Pallet, Storage, Config, Event, Call}, + TokenFactory: token_factory::{Module, Call, Storage, Event}, + HrmpChannels: hrmp_channels::{Module, Call, Storage, Event}, + Xtransfer: xtransfer::{Module, Call, Storage, Event}, + XcmHandler: cumulus_pallet_xcm_handler::{Module, Call, Event, Origin}, // The order matters here. Inherents will be included in the order specified here. // Concretely we need the author inherent to come after the parachain_upgrade inherent. AuthorInherent: author_inherent::{Pallet, Call, Storage, Inherent}, diff --git a/tools/config_xcmp.json b/tools/config_xcmp.json new file mode 100644 index 00000000000..e791238adc6 --- /dev/null +++ b/tools/config_xcmp.json @@ -0,0 +1,63 @@ +{ + "relaychain": { + "bin": "../../polkadot/target/release/polkadot", + "chain": "rococo-local", + "nodes": [ + { + "name": "alice", + "wsPort": 36944, + "port": 36444 + }, + { + "name": "bob", + "wsPort": 36955, + "port": 36555 + }, + { + "name": "charlie", + "wsPort": 36956, + "port": 36556 + } + ] + }, + "parachains": [ + { + "bin": "../target/release/moonbeam", + "id": "200", + "rpcPort": 36846, + "wsPort": 36946, + "port": 36335, + "balance": "1000", + "chain": "local", + "flags": [ + "--no-telemetry", + "--no-prometheus", + "--author-id=6be02d1d3665660d22ff9624b7be0551ee1ac91b", + "--", + "--execution=wasm" + ] + }, + { + "bin": "../target/release/moonbeam", + "id": "201", + "rpcPort": 36847, + "wsPort": 36947, + "port": 36336, + "balance": "1000", + "chain": "local", + "flags": [ + "--no-telemetry", + "--no-prometheus", + "--author-id=6be02d1d3665660d22ff9624b7be0551ee1ac91b", + "--", + "--execution=wasm" + ] + } + ], + "simpleParachains": [], + "hrmpChannels": [], + "types": { + "Address": "MultiAddress", + "LookupSource": "MultiAddress" + } +} diff --git a/tools/moonbeam-xcmp.ts b/tools/moonbeam-xcmp.ts new file mode 100644 index 00000000000..9aff41e591a --- /dev/null +++ b/tools/moonbeam-xcmp.ts @@ -0,0 +1,214 @@ +import { ApiPromise, Keyring, WsProvider } from "@polkadot/api"; +import { start } from "polkadot-launch"; +import { typesBundle } from "../moonbeam-types-bundle"; + +// constants +const GERALD = "0x6be02d1d3665660d22ff9624b7be0551ee1ac91b"; +const GERALD_PRIVKEY = "0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E342"; +const ALICE = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; +const STAKING_AMOUNT = "1.0000 kUnit"; +const GLMR = 1_000_000_000_000_000_000n; +const MIN_GLMR_STAKING = 1000n * GLMR; +const MIN_GLMR_NOMINATOR = 5n * GLMR; +const DEFAULT_GENESIS_BALANCE = 2n ** 80n; +const DEFAULT_GENESIS_STAKING = 1_000n * GLMR; +const GENESIS_ACCOUNT_BALANCE = DEFAULT_GENESIS_BALANCE - DEFAULT_GENESIS_STAKING; + +interface HrmpChannelId { + sender: number; + recipient: number; +} + +function assert(condition: boolean, msg: string) { + if (!condition) throw new Error(msg); +} + +async function wait(duration: number) { + console.log(`Waiting ${duration / 1000} seconds`); + return new Promise((res) => { + setTimeout(res, duration); + }); +} + +async function parachain_api(PORT: number): Promise { + const url = `ws://localhost:${PORT}`; + const provider = new WsProvider(url); + const api = await ApiPromise.create({ + provider, + typesBundle: typesBundle as any, + }); + return api; +} + +async function relaychain_api(PORT: number): Promise { + const url = `ws://localhost:${PORT}`; + const provider = new WsProvider(url); + const api = await ApiPromise.create({ + provider, + types: { + Address: "MultiAddress", + LookupSource: "MultiAddress", + }, + }); + return api; +} + +async function test() { + await start("config_xcmp.json"); + console.log("moonbeam launch launched"); + const WS_PORT200 = 36946; + const WS_PORT201 = 36947; + const WS_RELAY_PORT = 36944; + // first Moonbeam Parachain with ID 200 + const moonbeam200 = await parachain_api(WS_PORT200); + // second Moonbeam Parachain with ID 201 + const moonbeam201 = await parachain_api(WS_PORT201); + // relay chain + const relayApi = await relaychain_api(WS_RELAY_PORT); + // sanity checks that genesis state for all chains meet expectations + const gerald200 = await moonbeam200.query.system.account(GERALD); + assert( + gerald200.data.free.toString() === GENESIS_ACCOUNT_BALANCE.toString(), + "wrong balance for Gerald, dif: " + + (Number(GENESIS_ACCOUNT_BALANCE) - Number(gerald200.data.free)) + ); + const gerald201 = await moonbeam201.query.system.account(GERALD); + assert( + gerald201.data.free.toString() === GENESIS_ACCOUNT_BALANCE.toString(), + "wrong balance for Gerald, dif: " + + (Number(GENESIS_ACCOUNT_BALANCE) - Number(gerald201.data.free)) + ); + const relayAlice = await relayApi.query.system.account(ALICE); + assert( + "1000000000000000000" === relayAlice.data.free.toString(), + "wrong balance for relayAlice, expected: 1000000000000000000, returned: " + + Number(relayAlice.data.free) + ); + console.log("++ Sanity Checks Passed for Relay Chain and Both Parachains"); + // Open channel using relay sudo as caller + const keyring = new Keyring({ type: "sr25519" }); + const alice = keyring.addFromUri("//Alice"); + const sender: number = 200; + const recipient: number = 201; + await new Promise(async (resolve) => { + const unsub = await relayApi.tx.sudo + .sudo(relayApi.tx.parasSudoWrapper.sudoEstablishHrmpChannel(sender, recipient, 8, 1024)) + .signAndSend(alice, {}, ({ events = [], status }) => { + console.log(`Current status is ${status}`); + if (status.isInBlock) { + console.log(`Transaction included at blockHash ${status.asInBlock}`); + } else if (status.isFinalized) { + console.log(`Transaction finalized at blockHash ${status.asFinalized}`); + // Loop through Vec to display all events + events.forEach(({ phase, event: { data, method, section } }) => { + console.log(`\t' ${phase}: ${section}.${method}:: ${data}`); + }); + unsub(); + resolve(); + } + }); + }); + console.log("api call resolved"); + await wait(60000); + // (1) TODO: check that the channel is actually open by querying relay chain storage for + // `hrmp` pallet + const channelID: HrmpChannelId = { sender, recipient }; + // @ts-ignore + const expectedChannel = await relayApi.query.hrmp.hrmpChannels(channelID); + // const expectedChannel = await relayApi.query.hrmp.hrmpChannels(sender, recipient); + console.log("expectedchannel", expectedChannel, expectedChannel.toHuman()); + + assert(expectedChannel !== undefined, "Channel does not exist but we expected it to exist"); + // (2) TODO: check that channel deposits are reserved from sender and recipient + // HOW LONG TO WAIT UNTIL QUEUED DOWNWARD MESSAGES ARE RECEIVED BY PARARCHAIN + // await wait(50); + // (3) TODO: check that the downward message Xcm::HrmpNewChannelOpenRequest + // { sender, max_msg_size, max_capacity } + // was sent to the recipient parachain + const recipientChannels = await moonbeam201.query.channels.recipientChannels(); + console.log("recipientChannels", recipientChannels, recipientChannels.toHuman()); + // assert( + // recipientChannels[0] === sender, + // "Recipient channel with sender ID not yet opened on recipient chain" + // ); + // (4) TODO: check that the downward message Xcm::HrmpChannelAccepted { recipient } + // was sent to the sender parachain + const senderChannels = await moonbeam200.query.channels.senderChannels(); + console.log("senderChannels", senderChannels); + // assert( + // senderChannels[0] === recipient, + // "Sender channel with recipient ID not yet opened on sender chain" + // ); + // (5) Transfer from Sender to Recipient Parachain + // transfer_native_to_account_key_20_parachain + const senderKeyring = new Keyring({ type: "ethereum" }); + const gerald = await senderKeyring.addFromUri(GERALD_PRIVKEY, null, "ethereum"); + await new Promise(async (resolve) => { + const unsub2 = await moonbeam200.tx.xtransfer + .transferNative(recipient, GERALD, 100000) + .signAndSend(gerald, ({ events = [], status }) => { + console.log(`Current status is ${status.type}`); + + if (status.isFinalized) { + console.log(`Transaction finalized at blockHash ${status.asFinalized}`); + + // Loopcod through Vec to display all events + events.forEach(({ phase, event: { data, method, section } }) => { + console.log(`\t' ${phase}: ${section}.${method}:: ${data}`); + }); + + unsub2(); + resolve(); + } + }); + }); + await wait(60000); + // check to see if message is received on the recipient chain + // check to see if account balance changes on sender chain + // check to see if account balance changes on recipient chain + // (6) Test transfer in the opposite direction, register a new channel first and etc + // const sender2: number = recipient; + // const recipient2: number = sender; + // const unsub3 = await relayApi.tx.sudo + // .sudo(relayApi.tx.parasSudoWrapper.sudoEstablishHrmpChannel(sender2, recipient2, 8, 1024)) + // .signAndSend(alice, {}, (result) => { + // console.log(`Current status is ${result.status}`); + // if (result.status.isInBlock) { + // console.log(`Transaction included at blockHash ${result.status.asInBlock}`); + // } else if (result.status.isFinalized) { + // console.log(`Transaction finalized at blockHash ${result.status.asFinalized}`); + // unsub3(); + // } + // }); + console.log("all tests passed"); +} +test(); + +// construct Transact code to request open channel from 200 -> 201 +// const rawOpenCode = relayApi.tx.hrmp.hrmpInitOpenChannel(201, 8, 1024); +// console.log(rawOpenCode.toHex()); +// const rawParaCallTest = moonbeam200.tx.parachainStaking.leaveNominators(); +// console.log(rawParaCallTest.toHex()); +// remove prefix 31c04 +// const openCode = "0x1600c90000000800000000040000"; +// // Send message from 200 to relay to request open channel from 200 -> 201 +// const keyring = new Keyring({ type: "ethereum" }); +// const gerald = await keyring.addFromUri(GERALD_PRIVKEY, null, "ethereum"); +// const unsub = await moonbeam200.tx.xtransfer +// .openChannel(201, openCode) +// .signAndSend(gerald, ({ events = [], status }) => { +// console.log(`Current status is ${status.type}`); + +// if (status.isFinalized) { +// console.log(`Transaction finalized at blockHash ${status.asFinalized}`); + +// // Loopcod through Vec to display all events +// events.forEach(({ phase, event: { data, method, section } }) => { +// console.log(`\t' ${phase}: ${section}.${method}:: ${data}`); +// }); + +// unsub(); +// } +// }); +// Send message from 201 to relay to accept channel request from 200 -> 201 +// Transfer Moonbeam from 200 to 201 diff --git a/tools/package.json b/tools/package.json index 8a3d97f5d6e..1dda86333cb 100644 --- a/tools/package.json +++ b/tools/package.json @@ -2,7 +2,7 @@ "name": "moonbeam-tools", "version": "0.0.1", "dependencies": { - "@polkadot/api": "^4.0.3", + "@polkadot/api": "^4.2.1", "@polkadot/util-crypto": "^6.0.5", "bip39": "^3.0.3", "eth-block-tracker": "^4.4.3", @@ -28,6 +28,7 @@ "build-moonbeam-launch": "yarn add PureStake/polkadot-launch#moonbeam-launch", "moonbeam-launch": "yarn run build-moonbeam-launch && mkdir -p specFiles && ts-node moonbeam-launch.ts", "moonbeam-test": "yarn run build-moonbeam-launch && mkdir -p specFiles && ts-node moonbeam-test.ts", + "moonbeam-xcmp": "yarn run build-moonbeam-launch && mkdir -p specFiles && ts-node moonbeam-xcmp.ts", "test-staking": "yarn run build-moonbeam-launch && mkdir -p specFiles && ts-node test-staking.ts" } } diff --git a/tools/yarn.lock b/tools/yarn.lock index a19221a2a1a..3c36d9d6375 100644 --- a/tools/yarn.lock +++ b/tools/yarn.lock @@ -118,7 +118,7 @@ babel-plugin-polyfill-regenerator "^0.1.2" semver "^6.3.0" -"@babel/runtime@^7.13.7", "@babel/runtime@^7.13.8", "@babel/runtime@^7.13.9", "@babel/runtime@^7.5.5", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.13.10", "@babel/runtime@^7.13.7", "@babel/runtime@^7.13.8", "@babel/runtime@^7.13.9", "@babel/runtime@^7.5.5", "@babel/runtime@^7.9.2": version "7.13.10" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d" integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== @@ -372,15 +372,15 @@ "@polkadot/x-rxjs" "^5.9.2" bn.js "^4.11.9" -"@polkadot/api-derive@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-4.0.3.tgz#542d871d84c64f927565d655eabce0ec2b917a4a" - integrity sha512-ADHrIoYumHJBQuIdtDEX6LPiJVZmLGBlFvlkRGYsKL7qJzRZtkzfuNgd8i3cZVDKk9mlcpldmj1DTiN3KBjH0Q== +"@polkadot/api-derive@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-4.2.1.tgz#848a2a9ef947f08660af2571f72ca2b06969f2e3" + integrity sha512-TQqhK356IEk7ksMDE/tA3ZKqFEI8O8virZItd/w+RFaBs/HfbDNP8p+xPM5+6Rif3kuBzdubMv3Bdq/OIAJc6g== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/api" "4.0.3" - "@polkadot/rpc-core" "4.0.3" - "@polkadot/types" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/api" "4.2.1" + "@polkadot/rpc-core" "4.2.1" + "@polkadot/types" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/util-crypto" "^6.0.5" "@polkadot/x-rxjs" "^6.0.5" @@ -405,19 +405,19 @@ bn.js "^4.11.9" eventemitter3 "^4.0.7" -"@polkadot/api@4.0.3", "@polkadot/api@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-4.0.3.tgz#e3e11ab6341f84562c29677fb9d14d499c6aa892" - integrity sha512-jZf/NBkj6Ao7hG3I0ay7zOyDZm21tdqNRqglagBI+9Nw3wPvPL2Dz/mnGQCaeSq/fv/frY6YZQvouj4gRQzGwQ== +"@polkadot/api@4.2.1", "@polkadot/api@^4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-4.2.1.tgz#8eb0997dc148a34a4aca3a0dcaabad9954565909" + integrity sha512-PbXwcLnZr5V5LfKsovMS0TRG+rfJp8lJxluCyOSABDpaz2h1B5R8rdYEZCmXI3qSrT0yu2C6Pp8AjTQHRd7SAA== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/api-derive" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/api-derive" "4.2.1" "@polkadot/keyring" "^6.0.5" - "@polkadot/metadata" "4.0.3" - "@polkadot/rpc-core" "4.0.3" - "@polkadot/rpc-provider" "4.0.3" - "@polkadot/types" "4.0.3" - "@polkadot/types-known" "4.0.3" + "@polkadot/metadata" "4.2.1" + "@polkadot/rpc-core" "4.2.1" + "@polkadot/rpc-provider" "4.2.1" + "@polkadot/types" "4.2.1" + "@polkadot/types-known" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/util-crypto" "^6.0.5" "@polkadot/x-rxjs" "^6.0.5" @@ -454,14 +454,14 @@ "@polkadot/util-crypto" "^5.9.2" bn.js "^4.11.9" -"@polkadot/metadata@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-4.0.3.tgz#f0c7b63f8d0f40d8f81218849613f35edcb8157b" - integrity sha512-w4QRpIendx0LWINS3o93weqrNenI4X5T2iOdiPYd+DkIj1k3GI9An5BWnta9e953xEtGstwW169PF/itWMKyTw== +"@polkadot/metadata@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-4.2.1.tgz#7bff99e44992708469e7b2aa70d0865637d8febe" + integrity sha512-oXuKOrKTU0wys5pedKd1OVUDWK8/NoBRCrUYN8fxq3Qq/J9Sz6lF4ZbgX3w22C75l1z2+acsebiZBwlpWgKeqw== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/types" "4.0.3" - "@polkadot/types-known" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/types" "4.2.1" + "@polkadot/types-known" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/util-crypto" "^6.0.5" bn.js "^4.11.9" @@ -492,15 +492,15 @@ "@polkadot/util" "^5.9.2" "@polkadot/x-rxjs" "^5.9.2" -"@polkadot/rpc-core@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-4.0.3.tgz#40046acd961d925ef69532694f48437c7bceef0c" - integrity sha512-BJD5OS9uYlNMNPwRSFB0oT7az9NXBapapcafi6g1O6d4rvDwmsiptKr4+hkoLhzpuZcx6rfYSsVf7oz1v1J9/g== +"@polkadot/rpc-core@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-4.2.1.tgz#249f2e8f359450e365b0784d494814c7348e9a3e" + integrity sha512-A67Rt7lFpdauj7O7fRGn9yhII0SpCRJ/NkHWKo/whj8RwIAuOdxLnekGC9Qr26FPi0mAqN5DBQ8vYSDUiLFXxA== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/metadata" "4.0.3" - "@polkadot/rpc-provider" "4.0.3" - "@polkadot/types" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/metadata" "4.2.1" + "@polkadot/rpc-provider" "4.2.1" + "@polkadot/types" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/x-rxjs" "^6.0.5" @@ -519,13 +519,13 @@ bn.js "^4.11.9" eventemitter3 "^4.0.7" -"@polkadot/rpc-provider@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-4.0.3.tgz#55d3e87ff439e2908292fac80bcbd8244291f283" - integrity sha512-xddbODw+uMQrrdWWtKb39OwFqs6VFxvBHDjKmnB8IEUzKq2CIEDJG4qe3y2FfTeVCLWWxSmtxyOj0xo3jok3uw== +"@polkadot/rpc-provider@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-4.2.1.tgz#2dbb217773a57fde2a70fc15628e2682e3ac81f8" + integrity sha512-Gwfs6JAD4Sp+Uz1kEtBSt1P6C3Lwn9xZ64CupU1/6w3qj9QzTFOKHKoznnekiH5HXSh53qVz2c2OSXptSrwL0Q== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/types" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/types" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/util-crypto" "^6.0.5" "@polkadot/x-fetch" "^6.0.5" @@ -545,14 +545,14 @@ "@polkadot/util" "^5.9.2" bn.js "^4.11.9" -"@polkadot/types-known@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-4.0.3.tgz#e1a39c938d5b91c175eb548a586bde6a521205b2" - integrity sha512-XF6Ft2L3zU0E294SpySFi0fv9JIrL0YM0ftOrvqagdXopchc9Sg9XTm3uoukrT8yVu5IVWjQHyk2NwqeAlNV4A== +"@polkadot/types-known@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-4.2.1.tgz#0f1ccef363359de0370cd5b3cc3e6dfe51a18f38" + integrity sha512-/zbvzcCiv6yLhnikVWrN03uJk/3Vuer+sbK8G/pVtLOUhRYdDLOet7VPmRnjH9CGsEGJDQebu0zqW77npg5V2Q== dependencies: - "@babel/runtime" "^7.13.9" + "@babel/runtime" "^7.13.10" "@polkadot/networks" "^6.0.5" - "@polkadot/types" "4.0.3" + "@polkadot/types" "4.2.1" "@polkadot/util" "^6.0.5" bn.js "^4.11.9" @@ -569,13 +569,13 @@ "@types/bn.js" "^4.11.6" bn.js "^4.11.9" -"@polkadot/types@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-4.0.3.tgz#80640b102b585c7971c7116df6a23bcb1379aa31" - integrity sha512-aLNugf0Zyde8gAkHtPh8Pp2Rw6XJUUIDe9v/Lc3siJji6aPJuzwHW9XoJYBw8A8pl0MbmrJk3js/o3hEKqmFqg== +"@polkadot/types@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-4.2.1.tgz#7be97d3abda4bb3f9031b43602062ed464596696" + integrity sha512-xl8QnbXiJmSm6MUZH/U/ov3ZSXMN+KgNjsTCCzfz2xR5B3eK9ClYcstYYkNSyF12K90Gut9bnNSGZvaCfT2hNQ== dependencies: - "@babel/runtime" "^7.13.9" - "@polkadot/metadata" "4.0.3" + "@babel/runtime" "^7.13.10" + "@polkadot/metadata" "4.2.1" "@polkadot/util" "^6.0.5" "@polkadot/util-crypto" "^6.0.5" "@polkadot/x-rxjs" "^6.0.5" @@ -4112,11 +4112,11 @@ pkg@^4.4.9: polkadot-launch@PureStake/polkadot-launch#moonbeam-launch: version "1.0.12" - resolved "https://codeload.github.com/PureStake/polkadot-launch/tar.gz/e0ab521ca814a1a2ec7af4914ea5b8087bb85c1c" + resolved "https://codeload.github.com/PureStake/polkadot-launch/tar.gz/077ecbe74d0ebc30d337ce98429e1306d87ac04c" dependencies: - "@polkadot/api" "^3.11.1" - "@polkadot/util" "^5.9.2" - "@polkadot/util-crypto" "^5.9.2" + "@polkadot/api" "^3.6.4" + "@polkadot/util" "^5.4.4" + "@polkadot/util-crypto" "^5.4.4" "@types/chai" "^4.2.14" "@types/mocha" "^8.2.0" chai "^4.2.0"