diff --git a/Cargo.lock b/Cargo.lock
index 23b66e533..a63fd7ef6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -411,6 +411,7 @@ name = "asset-manager"
version = "0.1.0"
dependencies = [
"bit-country-primitives",
+ "core-primitives",
"frame-support",
"frame-system",
"hex",
@@ -4346,6 +4347,19 @@ dependencies = [
"generic-array 0.14.7",
]
+[[package]]
+name = "insta"
+version = "1.34.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc"
+dependencies = [
+ "console",
+ "lazy_static",
+ "linked-hash-map",
+ "similar",
+ "yaml-rust",
+]
+
[[package]]
name = "instant"
version = "0.1.12"
@@ -5771,6 +5785,15 @@ dependencies = [
"auction-manager",
"bit-country-primitives",
"core-primitives",
+ "cumulus-pallet-aura-ext",
+ "cumulus-pallet-dmp-queue",
+ "cumulus-pallet-parachain-system",
+ "cumulus-pallet-session-benchmarking",
+ "cumulus-pallet-xcm",
+ "cumulus-pallet-xcmp-queue",
+ "cumulus-primitives-core",
+ "cumulus-primitives-timestamp",
+ "cumulus-primitives-utility",
"currencies",
"fp-evm",
"fp-rpc",
@@ -5790,6 +5813,7 @@ dependencies = [
"orml-currencies",
"orml-nft",
"orml-oracle",
+ "orml-rewards",
"orml-tokens",
"orml-traits",
"pallet-auction",
@@ -5822,6 +5846,7 @@ dependencies = [
"pallet-reward",
"pallet-scheduler",
"pallet-session",
+ "pallet-spp",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
@@ -5829,6 +5854,7 @@ dependencies = [
"pallet-treasury",
"pallet-utility",
"pallet-vesting",
+ "parachain-info",
"parity-scale-codec",
"polkadot-primitives",
"scale-info",
@@ -6636,6 +6662,23 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "orml-rewards"
+version = "0.4.1-dev"
+source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-9.38#5861b6707c69031e8d70515b0aea6d222f5a5053"
+dependencies = [
+ "frame-support",
+ "frame-system",
+ "orml-traits",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "orml-tokens"
version = "0.4.1-dev"
@@ -8020,6 +8063,33 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-spp"
+version = "2.0.0-rc6"
+dependencies = [
+ "asset-manager",
+ "auction-manager",
+ "bit-country-primitives",
+ "core-primitives",
+ "currencies",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "orml-rewards",
+ "orml-tokens",
+ "orml-traits",
+ "pallet-balances",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "sp-version",
+ "substrate-fixed",
+]
+
[[package]]
name = "pallet-staking"
version = "4.0.0-dev"
@@ -8277,6 +8347,35 @@ dependencies = [
"xcm-executor",
]
+[[package]]
+name = "pallet-xcm-interface"
+version = "2.0.0-rc6"
+dependencies = [
+ "asset-manager",
+ "bit-country-primitives",
+ "core-primitives",
+ "cumulus-primitives-core",
+ "currencies",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "insta",
+ "log",
+ "orml-tokens",
+ "orml-traits",
+ "pallet-balances",
+ "pallet-xcm",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "xcm",
+ "xcm-builder",
+ "xcm-executor",
+]
+
[[package]]
name = "parachain-info"
version = "0.1.0"
@@ -15575,6 +15674,15 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "yaml-rust"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+dependencies = [
+ "linked-hash-map",
+]
+
[[package]]
name = "yamux"
version = "0.10.2"
diff --git a/Cargo.toml b/Cargo.toml
index 41220719b..3f959a986 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ url = "2.3.1"
tracing-core = "0.1.28"
impl-trait-for-tuples = "0.2.2"
num_enum = { version = "0.5.3", default-features = false }
-getrandom = { version = "0.2.7", features = ["js"]}
+getrandom = { version = "0.2.7", features = ["js"] }
blake2-rfc = { version = "0.2.18", default-features = false }
hex = { version = "0.4", default-features = false }
funty = { version = "=1.1.0", default-features = false }
@@ -38,13 +38,13 @@ similar-asserts = { version = "1.1.0" }
# General (ethereum)
ethabi = { version = "18.0.0", default-features = false }
-evm = { git = "https://github.com/rust-blockchain/evm", rev = "51b8c2ce3104265e1fd5bb0fe5cdfd2e0938239c", default-features = false, features = [ "with-codec" ] }
+evm = { git = "https://github.com/rust-blockchain/evm", rev = "51b8c2ce3104265e1fd5bb0fe5cdfd2e0938239c", default-features = false, features = ["with-codec"] }
# General (precompile macro)
proc-macro2 = "1.0"
quote = "1.0"
sha3 = "0.8"
-syn = { version = "1.0", features = [ "extra-traits", "fold", "full", "visit" ] }
+syn = { version = "1.0", features = ["extra-traits", "fold", "full", "visit"] }
# General (node only)
parking_lot = "0.12.1"
@@ -60,7 +60,7 @@ frame-executive = { git = 'https://github.com/paritytech/substrate', branch = 'p
frame-benchmarking = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
frame-support = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
frame-system = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-frame-system-benchmarking = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false}
+frame-system-benchmarking = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
frame-system-rpc-runtime-api = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
frame-try-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false }
@@ -85,7 +85,7 @@ sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
-sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38"}
+sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
@@ -101,22 +101,22 @@ sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkad
# Substrate Primitive Dependencies (general)
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
sp-block-builder = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
-sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
+sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
+sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
sp-api = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
sp-core = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-inherents = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-runtime = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-std = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-version = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
-sp-application-crypto = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-sp-arithmetic = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-consensus-aura = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-inherents = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-runtime = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-std = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-version = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
+sp-application-crypto = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
+sp-arithmetic = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
# Substrate Utilities
-node-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38"}
+node-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38" }
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
@@ -128,13 +128,13 @@ sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkad
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
-pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38"}
+pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" }
# Substrate Pallets
pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
-pallet-collective = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false}
+pallet-collective = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
pallet-democracy = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
pallet-randomness-collective-flip = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
pallet-sudo = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.38', default-features = false }
@@ -186,38 +186,39 @@ pallet-collator-selection = { git = 'https://github.com/paritytech/cumulus', bra
# Polkadot
polkadot-cli = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" }
polkadot-service = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" }
-polkadot-parachain = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-polkadot-runtime-parachains = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-polkadot-primitives = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-xcm = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-xcm-builder = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-xcm-executor = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
-pallet-xcm = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38" , default-features = false }
+polkadot-parachain = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+polkadot-runtime-parachains = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+polkadot-primitives = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+xcm = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+xcm-builder = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+xcm-executor = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
+pallet-xcm = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
polkadot-runtime-common = { git = 'https://github.com/paritytech/polkadot', branch = "release-v0.9.38", default-features = false }
kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false }
# ORML
-orml-currencies = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-traits = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-nft = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-unknown-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-xtokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-xcm = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-xcm-support = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
-orml-oracle = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-currencies = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-traits = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-nft = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-unknown-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-xtokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-xcm = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-xcm-support = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-oracle = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
orml-benchmarking = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
+orml-rewards = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-9.38", default-features = false }
# EVM
pallet-dynamic-fee = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
-fp-consensus = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fp-storage = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-cli = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-rpc = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-rpc-core = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-consensus = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-mapping-sync = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
-fc-db = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38"}
+fp-consensus = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fp-storage = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-cli = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-rpc = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-rpc-core = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-consensus = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-mapping-sync = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
+fc-db = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38" }
fp-self-contained = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
fp-rpc = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
fp-evm = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
@@ -231,7 +232,7 @@ pallet-evm-precompile-ed25519 = { git = "https://github.com/justinphamnz/frontie
pallet-evm-precompile-modexp = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v0.9.38", default-features = false }
-libsecp256k1 = { version = "0.6", default-features = false, features = ["hmac", "static-context"]}
+libsecp256k1 = { version = "0.6", default-features = false, features = ["hmac", "static-context"] }
# ink!
pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false }
diff --git a/Makefile b/Makefile
index 60b69f451..fe5d92fd9 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,11 @@ build-docker-pioneer:
.PHONY: run-dev
run-dev:
./target/release/metaverse-node purge-chain --dev
- ./target/release/metaverse-node --dev --tmp --alice -lruntime=debug
+ ./target/release/metaverse-node --dev --tmp --alice --node-key 0000000000000000000000000000000000000000000000000000000000000001 -lruntime=debug
+
+.PHONY: run-bob-dev
+run-bob-dev:
+ ./target/release/metaverse-node --dev --tmp --bob --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp -lruntime=debug
.PHONY: run-chopsticks-pioneer
run-chopsticks-pioneer:
diff --git a/README.md b/README.md
index 36c712e74..0b3612156 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,7 @@
-
-
-
-
-
-
-
-
-
[Bit.Country] Metaverse.Network
+
MNET (Metaverse.Network) by BitCountry team
-## Start your own metaverse. An Ethereum-compatible Network for Metaverses & Games
+## An Ethereum-compatible Blockchain Network Built using Substrate
[![Substrate version](https://img.shields.io/badge/Substrate-3.0.0-brightgreen?logo=Parity%20Substrate)](https://substrate.dev/)
[![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Fbitdotcountry)](https://twitter.com/bitdotcountry)
@@ -30,10 +22,7 @@ Development Note: It is still a WIP.
# 1. Introduction
-Metaverse Network is an EVM-enabled blockchain network for user-created metaverses and games.
-
-Everyone can start their own metaverse for their people with the 3D world, NFTs, play-to-earn & build communities to
-earn, and takes community engagement to a new dimension on web3.0.
+MNET (Metaverse.Network), featuring a seamlessly integrated enriched social layer, stands as an interesting blockchain ecosystem that extends support for both EVM (Ethereum Virtual Machine) and WASM (WebAssembly) smart contracts. This framework empowers developers to harness the network's capabilities in crafting decentralized applications (dApps) with unparalleled versatility and functionality.
# 2. Build
@@ -105,3 +94,8 @@ cargo run -- \
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0' \
--validator
```
+
+
+
+
+
diff --git a/modules/bridge/src/lib.rs b/modules/bridge/src/lib.rs
index e8c26764e..5390eda15 100644
--- a/modules/bridge/src/lib.rs
+++ b/modules/bridge/src/lib.rs
@@ -11,7 +11,7 @@ use sp_core::{H160, U256};
use sp_std::prelude::*;
pub use pallet::*;
-use primitives::{Balance, FungibleTokenId};
+use primitives::FungibleTokenId;
pub type ResourceId = H160;
pub type ChainId = u8;
@@ -29,12 +29,12 @@ pub mod pallet {
use frame_support::traits::{Currency, ExistenceRequirement, LockableCurrency, ReservableCurrency};
use frame_support::PalletId;
use orml_traits::MultiCurrency;
- use sp_arithmetic::traits::{CheckedMul, Saturating, Zero};
- use sp_runtime::traits::{AccountIdConversion, CheckedDiv};
- use sp_runtime::{ArithmeticError, ModuleError};
+ use sp_arithmetic::traits::{Saturating, Zero};
+ use sp_runtime::traits::AccountIdConversion;
+ use sp_runtime::ModuleError;
use core_primitives::NFTTrait;
- use primitives::evm::CurrencyIdType::FungibleToken;
+
use primitives::{Attributes, ClassId, NftMetadata, TokenId};
use super::*;
@@ -300,7 +300,11 @@ pub mod pallet {
Ok(())
}
Err(err) => match err {
- DispatchError::Module(ModuleError { index, error, message }) => {
+ DispatchError::Module(ModuleError {
+ index: _,
+ error: _,
+ message,
+ }) => {
if message == Some("AssetInfoNotFound") {
if let Ok(_mint_succeeded) =
T::NFTHandler::mint_token_with_id(&to, class_id, token_id, metadata, Attributes::new())
@@ -335,7 +339,7 @@ pub mod pallet {
let bridge_id = T::PalletId::get().into_account_truncating();
ensure!(BridgeFee::
::contains_key(&chain_id), Error::::FeeOptionsMissing);
- let (min_fee, fee_scale) = Self::bridge_fee(chain_id);
+ let (min_fee, _fee_scale) = Self::bridge_fee(chain_id);
T::Currency::transfer(&source, &bridge_id, min_fee.into(), ExistenceRequirement::AllowDeath)?;
diff --git a/modules/bridge/src/mock.rs b/modules/bridge/src/mock.rs
index 1fbfa7bd9..32894d6bf 100644
--- a/modules/bridge/src/mock.rs
+++ b/modules/bridge/src/mock.rs
@@ -3,22 +3,18 @@
use std::collections::BTreeMap;
use std::vec;
-use frame_support::traits::{EqualPrivilegeOnly, Nothing};
+use frame_support::traits::Nothing;
use frame_support::{construct_runtime, ord_parameter_types, pallet_prelude::Hooks, parameter_types, PalletId};
-use frame_system::{EnsureRoot, EnsureSignedBy};
+use frame_system::EnsureRoot;
use orml_traits::parameter_type_with_key;
use sp_core::H256;
use sp_runtime::traits::AccountIdConversion;
use sp_runtime::{testing::Header, traits::IdentityLookup, ModuleError, Perbill};
-use auction_manager::{Auction, AuctionInfo, AuctionItem, AuctionType, CheckAuctionItemHandler, ListingLevel};
-use core_primitives::{
- Attributes, CollectionType, MetaverseInfo, MetaverseMetadata, MetaverseTrait, NFTTrait, NftAssetData, NftClassData,
- NftMetadata, TokenType,
-};
+use core_primitives::{Attributes, CollectionType, NFTTrait, NftClassData, NftMetadata, TokenType};
use primitives::{
- continuum::MapTrait, estate::Estate, Amount, AuctionId, ClassId, EstateId, FungibleTokenId, GroupCollectionId,
- ItemId, MapSpotId, NftOffer, TokenId, UndeployedLandBlockId,
+ continuum::MapTrait, Amount, ClassId, EstateId, FungibleTokenId, GroupCollectionId, MapSpotId, TokenId,
+ UndeployedLandBlockId,
};
use crate as bridge;
@@ -283,7 +279,7 @@ impl NFTTrait for MockNFTHandler {
{
return Ok(true);
}
- if (nft_value.1 == 5) {
+ if nft_value.1 == 5 {
return Err(DispatchError::Module(ModuleError {
index: 5,
error: [0, 0, 0, 0],
@@ -293,7 +289,7 @@ impl NFTTrait for MockNFTHandler {
Ok(false)
}
- fn is_stackable(asset_id: (Self::ClassId, Self::TokenId)) -> Result {
+ fn is_stackable(_asset_id: (Self::ClassId, Self::TokenId)) -> Result {
Ok(false)
}
@@ -306,19 +302,19 @@ impl NFTTrait for MockNFTHandler {
}
Ok(false)
}
- fn get_nft_group_collection(nft_collection: &Self::ClassId) -> Result {
+ fn get_nft_group_collection(_nft_collection: &Self::ClassId) -> Result {
Ok(ASSET_COLLECTION_ID)
}
fn create_token_class(
sender: &AccountId,
- metadata: NftMetadata,
- attributes: Attributes,
+ _metadata: NftMetadata,
+ _attributes: Attributes,
collection_id: GroupCollectionId,
- token_type: TokenType,
- collection_type: CollectionType,
- royalty_fee: Perbill,
- mint_limit: Option,
+ _token_type: TokenType,
+ _collection_type: CollectionType,
+ _royalty_fee: Perbill,
+ _mint_limit: Option,
) -> Result {
match *sender {
ALICE => {
@@ -339,8 +335,8 @@ impl NFTTrait for MockNFTHandler {
fn mint_token(
sender: &AccountId,
class_id: ClassId,
- metadata: NftMetadata,
- attributes: Attributes,
+ _metadata: NftMetadata,
+ _attributes: Attributes,
) -> Result {
match *sender {
ALICE => Ok(1),
@@ -364,26 +360,26 @@ impl NFTTrait for MockNFTHandler {
}
}
- fn transfer_nft(from: &AccountId, to: &AccountId, nft: &(Self::ClassId, Self::TokenId)) -> DispatchResult {
+ fn transfer_nft(_from: &AccountId, _to: &AccountId, _nft: &(Self::ClassId, Self::TokenId)) -> DispatchResult {
Ok(())
}
- fn check_item_on_listing(class_id: Self::ClassId, token_id: Self::TokenId) -> Result {
+ fn check_item_on_listing(_class_id: Self::ClassId, _token_id: Self::TokenId) -> Result {
Ok(true)
}
- fn burn_nft(account: &AccountId, nft: &(Self::ClassId, Self::TokenId)) -> DispatchResult {
+ fn burn_nft(_account: &AccountId, _nft: &(Self::ClassId, Self::TokenId)) -> DispatchResult {
Ok(())
}
- fn is_transferable(nft: &(Self::ClassId, Self::TokenId)) -> Result {
+ fn is_transferable(_nft: &(Self::ClassId, Self::TokenId)) -> Result {
Ok(true)
}
- fn get_class_fund(class_id: &Self::ClassId) -> AccountId {
+ fn get_class_fund(_class_id: &Self::ClassId) -> AccountId {
CLASS_FUND_ID
}
- fn get_nft_detail(asset_id: (Self::ClassId, Self::TokenId)) -> Result, DispatchError> {
+ fn get_nft_detail(_asset_id: (Self::ClassId, Self::TokenId)) -> Result, DispatchError> {
let new_data = NftClassData {
deposit: 0,
attributes: test_attributes(1),
@@ -397,11 +393,11 @@ impl NFTTrait for MockNFTHandler {
Ok(new_data)
}
- fn set_lock_collection(class_id: Self::ClassId, is_locked: bool) -> sp_runtime::DispatchResult {
+ fn set_lock_collection(_class_id: Self::ClassId, _is_locked: bool) -> sp_runtime::DispatchResult {
todo!()
}
- fn set_lock_nft(token_id: (Self::ClassId, Self::TokenId), is_locked: bool) -> sp_runtime::DispatchResult {
+ fn set_lock_nft(_token_id: (Self::ClassId, Self::TokenId), _is_locked: bool) -> sp_runtime::DispatchResult {
todo!()
}
@@ -419,20 +415,20 @@ impl NFTTrait for MockNFTHandler {
Ok(new_data)
}
- fn get_total_issuance(class_id: Self::ClassId) -> Result {
+ fn get_total_issuance(_class_id: Self::ClassId) -> Result {
Ok(10u64)
}
- fn get_asset_owner(asset_id: &(Self::ClassId, Self::TokenId)) -> Result {
+ fn get_asset_owner(_asset_id: &(Self::ClassId, Self::TokenId)) -> Result {
Ok(ALICE)
}
fn mint_token_with_id(
sender: &AccountId,
class_id: Self::ClassId,
- token_id: Self::TokenId,
- metadata: NftMetadata,
- attributes: Attributes,
+ _token_id: Self::TokenId,
+ _metadata: NftMetadata,
+ _attributes: Attributes,
) -> Result {
match *sender {
ALICE => Ok(1),
@@ -456,31 +452,31 @@ impl NFTTrait for MockNFTHandler {
}
}
- fn get_free_stackable_nft_balance(who: &AccountId, asset_id: &(Self::ClassId, Self::TokenId)) -> Balance {
+ fn get_free_stackable_nft_balance(_who: &AccountId, _asset_id: &(Self::ClassId, Self::TokenId)) -> Balance {
1000
}
fn reserve_stackable_nft_balance(
- who: &AccountId,
- asset_id: &(Self::ClassId, Self::TokenId),
- amount: Balance,
+ _who: &AccountId,
+ _asset_id: &(Self::ClassId, Self::TokenId),
+ _amount: Balance,
) -> DispatchResult {
Ok(())
}
fn unreserve_stackable_nft_balance(
- who: &AccountId,
- asset_id: &(Self::ClassId, Self::TokenId),
- amount: Balance,
+ _who: &AccountId,
+ _asset_id: &(Self::ClassId, Self::TokenId),
+ _amount: Balance,
) -> sp_runtime::DispatchResult {
Ok(())
}
fn transfer_stackable_nft(
- sender: &AccountId,
- to: &AccountId,
- nft: &(Self::ClassId, Self::TokenId),
- amount: Balance,
+ _sender: &AccountId,
+ _to: &AccountId,
+ _nft: &(Self::ClassId, Self::TokenId),
+ _amount: Balance,
) -> sp_runtime::DispatchResult {
Ok(())
}
diff --git a/modules/bridge/src/tests.rs b/modules/bridge/src/tests.rs
index c3e5f13a4..0308dcb72 100644
--- a/modules/bridge/src/tests.rs
+++ b/modules/bridge/src/tests.rs
@@ -1,16 +1,13 @@
#![cfg(test)]
-use std::str::{from_utf8, FromStr};
+use std::str::FromStr;
-use frame_support::{assert_noop, assert_ok};
+use frame_support::assert_ok;
use sp_core::H160;
-use mock::{Balances, BridgeModule, ExtBuilder, One, Runtime, RuntimeEvent, RuntimeOrigin, System, Tokens};
-use primitives::evm::{CurrencyIdType, EvmAddress, H160_POSITION_CURRENCY_ID_TYPE, H160_POSITION_TOKEN};
-use primitives::FungibleTokenId::FungibleToken;
-use primitives::{TokenId, TokenSymbol};
+use mock::{Balances, BridgeModule, ExtBuilder, RuntimeOrigin};
-use crate::mock::{BridgeSovereignPalletId, ALICE, BOB};
+use crate::mock::{ALICE, BOB};
use super::*;
diff --git a/node/src/chain_spec/metaverse.rs b/node/src/chain_spec/metaverse.rs
index 64d0d0010..1c88f618a 100644
--- a/node/src/chain_spec/metaverse.rs
+++ b/node/src/chain_spec/metaverse.rs
@@ -1,4 +1,3 @@
-use std::collections::BTreeMap;
use std::str::FromStr;
use hex_literal::hex;
@@ -8,16 +7,13 @@ use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::crypto::UncheckedInto;
use sp_core::{sr25519, Pair, Public, H160, U256};
use sp_finality_grandpa::AuthorityId as GrandpaId;
-use sp_runtime::{
- traits::{IdentifyAccount, Verify},
- Perbill,
-};
+use sp_runtime::traits::{IdentifyAccount, Verify};
use metaverse_runtime::{
constants::currency::*, opaque::SessionKeys, wasm_binary_unwrap, AccountId, AuraConfig, BalancesConfig,
BaseFeeConfig, CollatorSelectionConfig, DemocracyConfig, EVMConfig, EstateConfig, EthereumConfig, GenesisAccount,
- GenesisConfig, GrandpaConfig, MintingRange, MintingRateInfo, OracleMembershipConfig, SessionConfig, Signature,
- SudoConfig, SystemConfig,
+ GenesisConfig, GrandpaConfig, MintingRateInfo, OracleMembershipConfig, SessionConfig, Signature, SudoConfig,
+ SystemConfig,
};
use primitives::Balance;
diff --git a/node/src/cli.rs b/node/src/cli.rs
index 53d21dab7..10454a8e5 100644
--- a/node/src/cli.rs
+++ b/node/src/cli.rs
@@ -5,7 +5,6 @@ use cumulus_client_cli;
use url::Url;
use crate::chain_spec;
-use crate::chain_spec::Extensions;
fn validate_relay_chain_url(arg: &str) -> Result<(), String> {
let url = Url::parse(arg).map_err(|e| e.to_string())?;
diff --git a/node/src/command.rs b/node/src/command.rs
index 41a6fc8a6..c2be223b2 100644
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use std::{io::Write, net::SocketAddr, sync::Arc};
+use std::{io::Write, net::SocketAddr};
use codec::Encode;
use cumulus_client_cli::generate_genesis_block;
@@ -23,13 +23,14 @@ use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use sc_cli::{
- ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result, Role,
+ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sc_service::PartialComponents;
use sp_core::hexdisplay::HexDisplay;
-use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
+use sp_runtime::traits::AccountIdConversion;
+use sp_runtime::traits::Block as BlockT;
#[cfg(feature = "with-continuum-runtime")]
use continuum_runtime::RuntimeApi;
@@ -41,12 +42,11 @@ use pioneer_runtime::RuntimeApi;
use crate::service::{continuum_partial, ContinuumParachainRuntimeExecutor};
#[cfg(feature = "with-pioneer-runtime")]
use crate::service::{pioneer_partial, ParachainRuntimeExecutor};
-use crate::service::{CONTINUUM_RUNTIME_NOT_AVAILABLE, METAVERSE_RUNTIME_NOT_AVAILABLE, PIONEER_RUNTIME_NOT_AVAILABLE};
+use crate::service::{CONTINUUM_RUNTIME_NOT_AVAILABLE, PIONEER_RUNTIME_NOT_AVAILABLE};
use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
service,
- service::ExecutorDispatch,
};
fn load_spec(id: &str) -> std::result::Result, String> {
diff --git a/node/src/rpc/rpc_metaverse.rs b/node/src/rpc/rpc_metaverse.rs
index f46faed58..b4113a02e 100644
--- a/node/src/rpc/rpc_metaverse.rs
+++ b/node/src/rpc/rpc_metaverse.rs
@@ -6,12 +6,12 @@ use fc_rpc::{
EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override,
SchemaV3Override, StorageOverride,
};
-use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
+use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use fp_storage::EthereumStorageSchema;
-use jsonrpc_pubsub::manager::SubscriptionManager;
+
use jsonrpsee::RpcModule;
use pallet_transaction_payment_rpc;
-use sc_cli::SubstrateCli;
+
// Substrate
use sc_client_api::{
backend::{AuxStore, Backend, StateBackend, StorageProvider},
@@ -23,7 +23,7 @@ use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
-use sp_blockchain::{Backend as BlockchainBackend, Error as BlockChainError, HeaderBackend, HeaderMetadata};
+use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_runtime::traits::BlakeTwo256;
use substrate_frame_rpc_system::{System, SystemApiServer};
@@ -138,8 +138,8 @@ where
A: ChainApi + 'static,
{
use fc_rpc::{
- Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, EthSigner, Net,
- NetApiServer, Web3, Web3ApiServer,
+ Eth, EthApiServer, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net, NetApiServer, Web3,
+ Web3ApiServer,
};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use substrate_frame_rpc_system::SystemApiServer;
diff --git a/node/src/service/metaverse.rs b/node/src/service/metaverse.rs
index 2dacd366b..1c4c478d1 100644
--- a/node/src/service/metaverse.rs
+++ b/node/src/service/metaverse.rs
@@ -14,7 +14,7 @@ use fc_consensus::FrontierBlockImport;
use fc_rpc::EthTask;
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use futures::StreamExt;
-use sc_client_api::{BlockBackend, BlockchainEvents, ExecutorProvider};
+use sc_client_api::{BlockBackend, BlockchainEvents};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState;
diff --git a/pallets/asset-manager/Cargo.toml b/pallets/asset-manager/Cargo.toml
index ca6303094..61d84ad3b 100644
--- a/pallets/asset-manager/Cargo.toml
+++ b/pallets/asset-manager/Cargo.toml
@@ -12,12 +12,13 @@ version = '0.1.0'
log = { workspace = true }
serde = { workspace = true, optional = true }
scale-info = { workspace = true }
-codec = { package = "parity-scale-codec", version ="3.1.5", default-features = false }
+codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
primitives = { package = "bit-country-primitives", path = "../../primitives/metaverse", default-features = false }
+core-primitives = { path = "../../traits/core-primitives", default-features = false }
xcm = { workspace = true }
[dev-dependencies]
@@ -42,5 +43,6 @@ std = [
"frame-support/std",
"frame-system/std",
"primitives/std",
+ "core-primitives/std",
"xcm/std",
]
\ No newline at end of file
diff --git a/pallets/asset-manager/src/lib.rs b/pallets/asset-manager/src/lib.rs
index c8c33008d..7a793cb42 100644
--- a/pallets/asset-manager/src/lib.rs
+++ b/pallets/asset-manager/src/lib.rs
@@ -23,7 +23,6 @@
#![allow(clippy::unused_unit)]
use frame_support::{
- assert_ok,
dispatch::DispatchResult,
ensure,
pallet_prelude::*,
@@ -31,16 +30,14 @@ use frame_support::{
transactional,
};
use frame_system::pallet_prelude::*;
-use scale_info::prelude::format;
use sp_runtime::{traits::One, ArithmeticError, FixedPointNumber, FixedU128};
-use sp_std::{boxed::Box, vec::Vec};
+use sp_std::boxed::Box;
use xcm::v3::MultiLocation;
use xcm::VersionedMultiLocation;
+use core_primitives::CurrencyIdManagement;
pub use pallet::*;
-use primitives::{
- AssetIds, AssetMetadata, BuyWeightRate, CurrencyId, ForeignAssetIdMapping, FungibleTokenId, Ratio, TokenId,
-};
+use primitives::{AssetIds, AssetMetadata, BuyWeightRate, ForeignAssetIdMapping, FungibleTokenId, Ratio, TokenId};
mod mock;
mod tests;
@@ -346,3 +343,23 @@ where
None
}
}
+
+impl CurrencyIdManagement for ForeignAssetMapping {
+ fn check_token_exist(_token_id: FungibleTokenId) -> bool {
+ return true;
+ }
+
+ fn convert_to_rcurrency(currency_id: FungibleTokenId) -> Result {
+ match currency_id {
+ FungibleTokenId::NativeToken(token_id) => Ok(FungibleTokenId::FungibleToken(token_id)),
+ _ => Err(()),
+ }
+ }
+
+ fn convert_to_currency(currency_id: FungibleTokenId) -> Result {
+ match currency_id {
+ FungibleTokenId::FungibleToken(token_id) => Ok(FungibleTokenId::NativeToken(token_id)),
+ _ => Err(()),
+ }
+ }
+}
diff --git a/pallets/auction/src/lib.rs b/pallets/auction/src/lib.rs
index 8afd48829..e338a1cf7 100644
--- a/pallets/auction/src/lib.rs
+++ b/pallets/auction/src/lib.rs
@@ -31,7 +31,7 @@ use frame_system::{self as system, ensure_signed};
use sp_core::sp_std::convert::TryInto;
use sp_runtime::SaturatedConversion;
use sp_runtime::{
- traits::{CheckedDiv, One, Saturating, Zero},
+ traits::{One, Saturating, Zero},
DispatchError, DispatchResult, Perbill,
};
use sp_std::vec::Vec;
@@ -58,17 +58,12 @@ pub mod weights;
pub struct AuctionLogicHandler;
pub mod migration_v2 {
- use codec::FullCodec;
use codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
- use sp_runtime::{traits::AtLeast32BitUnsigned, DispatchError, RuntimeDebug};
- use sp_std::{
- cmp::{Eq, PartialEq},
- fmt::Debug,
- vec::Vec,
- };
+ use sp_runtime::RuntimeDebug;
+ use sp_std::cmp::{Eq, PartialEq};
use auction_manager::{AuctionType, ListingLevel};
use primitives::{AssetId, EstateId, FungibleTokenId, MetaverseId};
@@ -104,20 +99,17 @@ pub mod migration_v2 {
#[frame_support::pallet]
pub mod pallet {
+ use frame_support::dispatch::DispatchResultWithPostInfo;
use frame_support::log;
use frame_support::sp_runtime::traits::CheckedSub;
- use frame_support::{dispatch::DispatchResultWithPostInfo, traits::tokens::currency};
- use frame_system::ensure_root;
use frame_system::pallet_prelude::OriginFor;
use orml_traits::{MultiCurrency, MultiReservableCurrency};
use sp_runtime::traits::CheckedAdd;
use sp_runtime::ArithmeticError;
- use auction_manager::{AuctionItemV1, CheckAuctionItemHandler, ListingLevel};
+ use auction_manager::{CheckAuctionItemHandler, ListingLevel};
use core_primitives::{MetaverseTrait, NFTTrait};
- use primitives::{AssetId, Balance, ClassId, FungibleTokenId, MetaverseId, TokenId};
-
- use crate::migration_v2::V1ItemId;
+ use primitives::{Balance, ClassId, FungibleTokenId, MetaverseId, TokenId};
use super::*;
@@ -1191,7 +1183,7 @@ pub mod pallet {
/// Internal auction bid handler
fn auction_bid_handler(from: T::AccountId, id: AuctionId, value: Self::Balance) -> DispatchResult {
- let mut auction_item: AuctionItem> =
+ let auction_item: AuctionItem> =
Self::get_auction_item(id.clone()).ok_or(Error::::AuctionDoesNotExist)?;
ensure!(
auction_item.auction_type == AuctionType::Auction,
@@ -1426,7 +1418,7 @@ pub mod pallet {
::Currency::unreserve(&auction_item.recipient, T::NetworkFeeReserve::get());
// Transfer balance from buy it now user to asset owner
- let mut currency_transfer;
+ let currency_transfer;
if auction_item.currency_id == FungibleTokenId::NativeToken(0) {
currency_transfer = ::Currency::transfer(
&from,
@@ -1618,7 +1610,7 @@ pub mod pallet {
}
// Handle balance transfer
- let mut currency_transfer;
+ let currency_transfer;
if auction_item.currency_id == FungibleTokenId::NativeToken(0) {
currency_transfer = ::Currency::transfer(
&high_bidder,
diff --git a/pallets/auction/src/mock.rs b/pallets/auction/src/mock.rs
index e91e72bac..0352d86ce 100644
--- a/pallets/auction/src/mock.rs
+++ b/pallets/auction/src/mock.rs
@@ -4,14 +4,15 @@ use frame_support::traits::{EqualPrivilegeOnly, Nothing};
use frame_support::{construct_runtime, pallet_prelude::Hooks, parameter_types, PalletId};
use frame_system::EnsureRoot;
use orml_traits::parameter_type_with_key;
+use sp_core::crypto::AccountId32;
use sp_core::H256;
-use sp_runtime::traits::AccountIdConversion;
-use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
+use sp_runtime::traits::{AccountIdConversion, IdentifyAccount, Verify};
+use sp_runtime::{testing::Header, traits::IdentityLookup, MultiSignature, Perbill};
use auction_manager::{CheckAuctionItemHandler, ListingLevel};
use core_primitives::{MetaverseInfo, MetaverseMetadata, MetaverseTrait, NftAssetData, NftClassData};
use primitives::{
- continuum::MapTrait, estate::Estate, Amount, AuctionId, ClassId, EstateId, FungibleTokenId, MapSpotId, NftOffer,
+ continuum::MapTrait, estate::Estate, Amount, AuctionId, ClassId, EstateId, FungibleTokenId, MapSpotId,
UndeployedLandBlockId,
};
@@ -23,14 +24,13 @@ parameter_types! {
pub const BlockHashCount: u32 = 256;
}
-pub type AccountId = u128;
+pub type AccountId = ::AccountId;
pub type Balance = u128;
pub type BlockNumber = u64;
pub type MetaverseId = u64;
+type Signature = MultiSignature;
+type AccountPublic = ::Signer;
-pub const ALICE: AccountId = 1;
-pub const BOB: AccountId = 2;
-pub const NO_METAVERSE_OWNER: AccountId = 3;
pub const CLASS_ID: u32 = 0;
pub const COLLECTION_ID: u64 = 0;
pub const ALICE_METAVERSE_ID: MetaverseId = 1;
@@ -43,8 +43,6 @@ pub const LAND_UNIT_EXIST: (i32, i32) = (0, 0);
pub const LAND_UNIT_EXIST_1: (i32, i32) = (1, 1);
pub const LAND_UNIT_NOT_EXIST: (i32, i32) = (99, 99);
-pub const GENERAL_METAVERSE_FUND: AccountId = 102;
-
pub const UNDEPLOYED_LAND_BLOCK_ID_EXIST: UndeployedLandBlockId = 4;
pub const UNDEPLOYED_LAND_BLOCK_ID_NOT_EXIST: UndeployedLandBlockId = 5;
@@ -93,7 +91,7 @@ impl pallet_balances::Config for Runtime {
pub struct Continuumm;
-impl MapTrait for Continuumm {
+impl MapTrait for Continuumm {
fn transfer_spot(
_spot_id: MapSpotId,
_from: AccountId,
@@ -105,7 +103,7 @@ impl MapTrait for Continuumm {
pub struct EstateHandler;
-impl Estate for EstateHandler {
+impl Estate for EstateHandler {
fn transfer_estate(_estate_id: EstateId, _from: &AccountId, _to: &AccountId) -> Result {
Ok(1)
}
@@ -119,9 +117,9 @@ impl Estate for EstateHandler {
}
fn transfer_undeployed_land_block(
- who: &AccountId,
- to: &AccountId,
- undeployed_land_block_id: UndeployedLandBlockId,
+ _who: &AccountId,
+ _to: &AccountId,
+ _undeployed_land_block_id: UndeployedLandBlockId,
) -> Result {
Ok(2)
}
@@ -143,7 +141,7 @@ impl Estate for EstateHandler {
}
fn check_undeployed_land_block(
- owner: &AccountId,
+ _owner: &AccountId,
undeployed_land_block_id: UndeployedLandBlockId,
) -> Result {
match undeployed_land_block_id {
@@ -153,7 +151,7 @@ impl Estate for EstateHandler {
}
}
- fn get_total_land_units(estate_id: Option) -> u64 {
+ fn get_total_land_units(_estate_id: Option) -> u64 {
100
}
@@ -161,15 +159,15 @@ impl Estate for EstateHandler {
100
}
- fn check_estate_ownership(owner: AccountId, estate_id: EstateId) -> Result {
+ fn check_estate_ownership(_owner: AccountId, _estate_id: EstateId) -> Result {
Ok(false)
}
- fn is_estate_leasor(leasor: AccountId, estate_id: EstateId) -> Result {
+ fn is_estate_leasor(_leasor: AccountId, _estate_id: EstateId) -> Result {
Ok(false)
}
- fn is_estate_leased(estate_id: EstateId) -> Result {
+ fn is_estate_leased(_estate_id: EstateId) -> Result {
Ok(false)
}
}
@@ -183,8 +181,8 @@ impl AuctionHandler for Handler {
new_bid: (AccountId, Balance),
_last_bid: Option<(AccountId, Balance)>,
) -> OnNewBidResult {
- // Test with Alice bid
- if new_bid.0 == ALICE || new_bid.0 == BOB {
+ // Test with [1,32].into() bid
+ if new_bid.0 == [1; 32].into() || new_bid.0 == [2; 32].into() {
OnNewBidResult {
accept_bid: true,
auction_end_change: Change::NoChange,
@@ -243,19 +241,21 @@ parameter_types! {
pub struct MetaverseInfoSource {}
impl MetaverseTrait for MetaverseInfoSource {
- fn create_metaverse(who: &AccountId, metadata: MetaverseMetadata) -> MetaverseId {
+ fn create_metaverse(_who: &AccountId, _metadata: MetaverseMetadata) -> MetaverseId {
1u64
}
fn check_ownership(who: &AccountId, metaverse_id: &MetaverseId) -> bool {
- match *who {
- ALICE => *metaverse_id == ALICE_METAVERSE_ID,
- BOB => *metaverse_id == BOB_METAVERSE_ID,
- _ => false,
+ if who == &AccountId32::new([1; 32]) {
+ *metaverse_id == ALICE_METAVERSE_ID
+ } else if who == &AccountId32::new([2; 32]) {
+ *metaverse_id == BOB_METAVERSE_ID
+ } else {
+ false
}
}
- fn get_metaverse(_metaverse_id: u64) -> Option> {
+ fn get_metaverse(_metaverse_id: u64) -> Option> {
None
}
@@ -267,28 +267,28 @@ impl MetaverseTrait for MetaverseInfoSource {
Ok(())
}
- fn get_metaverse_land_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_land_class(_metaverse_id: MetaverseId) -> Result {
Ok(15u32)
}
- fn get_metaverse_estate_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_estate_class(_metaverse_id: MetaverseId) -> Result {
Ok(16u32)
}
- fn get_metaverse_marketplace_listing_fee(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_marketplace_listing_fee(_metaverse_id: MetaverseId) -> Result {
Ok(Perbill::from_percent(1u32))
}
- fn get_metaverse_treasury(metaverse_id: MetaverseId) -> AccountId {
- GENERAL_METAVERSE_FUND
+ fn get_metaverse_treasury(_metaverse_id: MetaverseId) -> AccountId {
+ [102; 32].into()
}
fn get_network_treasury() -> AccountId {
- GENERAL_METAVERSE_FUND
+ [102; 32].into()
}
fn check_if_metaverse_estate(
- metaverse_id: primitives::MetaverseId,
+ _metaverse_id: primitives::MetaverseId,
class_id: &ClassId,
) -> Result {
if class_id == &15u32 || class_id == &16u32 {
@@ -302,7 +302,7 @@ impl MetaverseTrait for MetaverseInfoSource {
}
fn is_metaverse_owner(who: &AccountId) -> bool {
- who != &NO_METAVERSE_OWNER
+ who != &[3; 32].into()
}
}
@@ -384,6 +384,8 @@ impl pallet_nft::Config for Runtime {
type AssetMintingFee = AssetMintingFee;
type ClassMintingFee = ClassMintingFee;
type StorageDepositFee = StorageDepositFee;
+ type OffchainSignature = Signature;
+ type OffchainPublic = AccountPublic;
}
parameter_types! {
@@ -442,15 +444,15 @@ impl ExtBuilder {
.unwrap();
pallet_balances::GenesisConfig:: {
- balances: vec![(ALICE, 100000), (BOB, 500), (NO_METAVERSE_OWNER, 500)],
+ balances: vec![([1; 32].into(), 100000), ([2; 32].into(), 500), ([3; 32].into(), 500)],
}
.assimilate_storage(&mut t)
.unwrap();
orml_tokens::GenesisConfig:: {
balances: vec![
- (ALICE, FungibleTokenId::MiningResource(0), 10000),
- (BOB, FungibleTokenId::MiningResource(0), 5000),
+ ([1; 32].into(), FungibleTokenId::MiningResource(0), 10000),
+ ([2; 32].into(), FungibleTokenId::MiningResource(0), 5000),
],
}
.assimilate_storage(&mut t)
@@ -484,24 +486,24 @@ pub struct MockAuctionManager;
impl Auction for MockAuctionManager {
type Balance = Balance;
- fn auction_info(_id: u64) -> Option> {
+ fn auction_info(_id: u64) -> Option> {
None
}
- fn auction_item(id: AuctionId) -> Option> {
+ fn auction_item(_id: AuctionId) -> Option> {
None
}
- fn update_auction(_id: u64, _info: AuctionInfo) -> DispatchResult {
+ fn update_auction(_id: u64, _info: AuctionInfo) -> DispatchResult {
Ok(())
}
- fn update_auction_item(id: AuctionId, item_id: ItemId) -> frame_support::dispatch::DispatchResult {
+ fn update_auction_item(_id: AuctionId, _item_id: ItemId) -> frame_support::dispatch::DispatchResult {
Ok(())
}
fn new_auction(
- _recipient: u128,
+ _recipient: AccountId,
_initial_amount: Self::Balance,
_start: u64,
_end: Option,
@@ -513,7 +515,7 @@ impl Auction for MockAuctionManager {
_auction_type: AuctionType,
_item_id: ItemId,
_end: Option,
- _recipient: u128,
+ _recipient: AccountId,
_initial_amount: Self::Balance,
_start: u64,
_listing_level: ListingLevel,
@@ -526,17 +528,17 @@ impl Auction for MockAuctionManager {
fn remove_auction(_id: u64, _item_id: ItemId) {}
fn auction_bid_handler(
- from: AccountId,
- id: AuctionId,
- value: Self::Balance,
+ _from: AccountId,
+ _id: AuctionId,
+ _value: Self::Balance,
) -> frame_support::dispatch::DispatchResult {
Ok(())
}
fn buy_now_handler(
- from: AccountId,
- auction_id: AuctionId,
- value: Self::Balance,
+ _from: AccountId,
+ _auction_id: AuctionId,
+ _value: Self::Balance,
) -> frame_support::dispatch::DispatchResult {
Ok(())
}
@@ -544,8 +546,8 @@ impl Auction for MockAuctionManager {
fn local_auction_bid_handler(
_now: u64,
_id: u64,
- _new_bid: (u128, Self::Balance),
- _last_bid: Option<(u128, Self::Balance)>,
+ _new_bid: (AccountId, Self::Balance),
+ _last_bid: Option<(AccountId, Self::Balance)>,
_social_currency_id: FungibleTokenId,
) -> DispatchResult {
Ok(())
@@ -553,7 +555,7 @@ impl Auction for MockAuctionManager {
fn collect_royalty_fee(
_high_bid_price: &Self::Balance,
- _high_bidder: &u128,
+ _high_bidder: &AccountId,
_asset_id: &(u32, u64),
_social_currency_id: FungibleTokenId,
) -> DispatchResult {
diff --git a/pallets/auction/src/tests.rs b/pallets/auction/src/tests.rs
index ab4a5b657..9a0616e6d 100644
--- a/pallets/auction/src/tests.rs
+++ b/pallets/auction/src/tests.rs
@@ -1,16 +1,22 @@
#![cfg(test)]
use frame_support::{assert_noop, assert_ok};
+use sp_core::crypto::AccountId32;
use sp_std::collections::btree_map::BTreeMap;
use auction_manager::ListingLevel;
use core_primitives::{Attributes, CollectionType, NFTTrait, TokenType};
use mock::{RuntimeEvent, *};
-use primitives::ItemId::NFT;
-use primitives::{ClassId, FungibleTokenId};
+
+use primitives::FungibleTokenId;
use super::*;
+pub const ALICE: AccountId = AccountId32::new([1; 32]);
+pub const BOB: AccountId = AccountId32::new([2; 32]);
+pub const NO_METAVERSE_OWNER: AccountId = AccountId32::new([3; 32]);
+pub const GENERAL_METAVERSE_FUND: AccountId = AccountId32::new([102; 32]);
+
fn init_test_nft(owner: RuntimeOrigin) {
//Create group collection before class
assert_ok!(NFTModule::::create_group(
@@ -785,7 +791,7 @@ fn bid_works() {
assert_eq!(
AuctionModule::auctions(0),
Some(AuctionInfo {
- bid: Some((1, 200)),
+ bid: Some((ALICE, 200)),
start: 1,
end: Some(101),
})
@@ -825,7 +831,7 @@ fn bid_anti_snipe_duration_works() {
assert_eq!(
AuctionModule::auctions(0),
Some(AuctionInfo {
- bid: Some((1, 200)),
+ bid: Some((ALICE, 200)),
start: 1,
end: Some(106),
})
@@ -848,7 +854,7 @@ fn bid_anti_snipe_duration_works() {
// Verify if auction finalized with new end time.
assert_eq!(
last_event(),
- RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, 1, 201))
+ RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, ALICE, 201))
);
});
}
@@ -1046,7 +1052,7 @@ fn asset_transfers_after_auction() {
// Verify asset transfers to alice after end of auction
assert_eq!(
last_event(),
- RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, 1, 200))
+ RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, ALICE, 200))
);
// Verify transfer of fund (minus gas)
@@ -1100,7 +1106,7 @@ fn asset_transfers_after_multicurrency_auction() {
// Verify asset transfers to alice after end of auction
assert_eq!(
last_event(),
- RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, 1, 200))
+ RuntimeEvent::AuctionModule(crate::Event::AuctionFinalized(0, ALICE, 200))
);
// Verify transfer of fund
@@ -1685,7 +1691,7 @@ fn auction_bundle_should_update_new_price_according_new_bid() {
assert_eq!(Balances::free_balance(ALICE), 99991);
let tokens_after_bid = vec![(0, 0, 150), (0, 1, 150)];
- let item_updated_after_bid = AuctionModule::items_in_auction(ItemId::Bundle(tokens.clone()));
+ let _item_updated_after_bid = AuctionModule::items_in_auction(ItemId::Bundle(tokens.clone()));
let auction_item = AuctionModule::get_auction_item(0).unwrap();
assert_eq!(auction_item.item_id, ItemId::Bundle(tokens_after_bid));
@@ -2106,7 +2112,7 @@ fn withdraw_offer_should_work() {
fn finalize_auction_should_fail() {
ExtBuilder::default().build().execute_with(|| {
let owner = RuntimeOrigin::signed(BOB);
- let bidder = RuntimeOrigin::signed(ALICE);
+ let _bidder = RuntimeOrigin::signed(ALICE);
init_test_nft(owner.clone());
init_test_nft(owner.clone());
assert_ok!(AuctionModule::create_auction(
@@ -2146,7 +2152,7 @@ fn finalize_auction_should_fail() {
fn cancel_listing_should_work() {
ExtBuilder::default().build().execute_with(|| {
let owner = RuntimeOrigin::signed(BOB);
- let bidder = RuntimeOrigin::signed(ALICE);
+ let _bidder = RuntimeOrigin::signed(ALICE);
init_test_nft(owner.clone());
assert_ok!(AuctionModule::create_auction(
AuctionType::Auction,
@@ -2186,7 +2192,7 @@ fn cancel_listing_should_work() {
fn cancel_listing_should_fail() {
ExtBuilder::default().build().execute_with(|| {
let owner = RuntimeOrigin::signed(BOB);
- let bidder = RuntimeOrigin::signed(ALICE);
+ let _bidder = RuntimeOrigin::signed(ALICE);
init_test_nft(owner.clone());
init_test_nft(owner.clone());
assert_ok!(AuctionModule::create_auction(
diff --git a/pallets/continuum/src/lib.rs b/pallets/continuum/src/lib.rs
index e73c0aca7..52649c14f 100644
--- a/pallets/continuum/src/lib.rs
+++ b/pallets/continuum/src/lib.rs
@@ -47,18 +47,15 @@
use codec::{Decode, Encode};
use frame_support::{
dispatch::DispatchResult,
- ensure, log,
+ ensure,
traits::ExistenceRequirement,
traits::{Currency, Get, LockableCurrency, ReservableCurrency},
transactional, PalletId,
};
use frame_system::{ensure_root, ensure_signed};
use scale_info::TypeInfo;
-use sp_runtime::traits::CheckedAdd;
-use sp_runtime::{
- traits::{AccountIdConversion, One, Zero},
- DispatchError, Perbill, RuntimeDebug,
-};
+
+use sp_runtime::{traits::AccountIdConversion, DispatchError, Perbill, RuntimeDebug};
use sp_std::vec;
use sp_std::vec::Vec;
@@ -112,7 +109,6 @@ pub struct AuctionSlot {
pub mod pallet {
use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*};
use frame_system::pallet_prelude::OriginFor;
- use sp_arithmetic::traits::UniqueSaturatedInto;
use core_primitives::TokenType;
use primitives::{AuctionId, MapSpotId};
diff --git a/pallets/continuum/src/mock.rs b/pallets/continuum/src/mock.rs
index a49353f1f..a57a3abf0 100644
--- a/pallets/continuum/src/mock.rs
+++ b/pallets/continuum/src/mock.rs
@@ -25,7 +25,7 @@ use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
use auction_manager::{Auction, AuctionInfo, AuctionItem, CheckAuctionItemHandler, ListingLevel};
use core_primitives::{MetaverseInfo, MetaverseMetadata, MetaverseTrait};
-use primitives::FungibleTokenId::FungibleToken;
+
use primitives::{AuctionId, ClassId, FungibleTokenId};
use crate as continuum;
@@ -147,11 +147,11 @@ impl Auction for MockAuctionManager {
return None;
}
- fn update_auction(id: AuctionId, _info: AuctionInfo) -> DispatchResult {
+ fn update_auction(_id: AuctionId, _info: AuctionInfo) -> DispatchResult {
Ok(())
}
- fn update_auction_item(id: AuctionId, item_id: ItemId) -> DispatchResult {
+ fn update_auction_item(_id: AuctionId, _item_id: ItemId) -> DispatchResult {
Ok(())
}
@@ -180,11 +180,11 @@ impl Auction for MockAuctionManager {
fn remove_auction(_id: u64, _item_id: ItemId) {}
- fn auction_bid_handler(from: AccountId, id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn auction_bid_handler(_from: AccountId, _id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
- fn buy_now_handler(from: AccountId, auction_id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn buy_now_handler(_from: AccountId, _auction_id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
@@ -228,7 +228,7 @@ parameter_types! {
pub struct MetaverseInfoSource {}
impl MetaverseTrait for MetaverseInfoSource {
- fn create_metaverse(who: &AccountId, metadata: MetaverseMetadata) -> MetaverseId {
+ fn create_metaverse(_who: &AccountId, _metadata: MetaverseMetadata) -> MetaverseId {
1u64
}
@@ -253,15 +253,15 @@ impl MetaverseTrait for MetaverseInfoSource {
Ok(())
}
- fn get_metaverse_land_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_land_class(_metaverse_id: MetaverseId) -> Result {
Ok(15u32)
}
- fn get_metaverse_estate_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_estate_class(_metaverse_id: MetaverseId) -> Result {
Ok(16u32)
}
- fn get_metaverse_marketplace_listing_fee(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_marketplace_listing_fee(_metaverse_id: MetaverseId) -> Result {
Ok(Perbill::from_percent(1u32))
}
@@ -278,7 +278,7 @@ impl MetaverseTrait for MetaverseInfoSource {
}
fn check_if_metaverse_estate(
- metaverse_id: primitives::MetaverseId,
+ _metaverse_id: primitives::MetaverseId,
class_id: &ClassId,
) -> Result {
if class_id == &15u32 || class_id == &16u32 {
@@ -295,7 +295,7 @@ impl MetaverseTrait for MetaverseInfoSource {
}
}
- fn is_metaverse_owner(who: &AccountId) -> bool {
+ fn is_metaverse_owner(_who: &AccountId) -> bool {
true
}
}
diff --git a/pallets/continuum/src/tests.rs b/pallets/continuum/src/tests.rs
index db3b7c10c..048f61345 100644
--- a/pallets/continuum/src/tests.rs
+++ b/pallets/continuum/src/tests.rs
@@ -21,8 +21,8 @@ use frame_support::{assert_noop, assert_ok};
use sp_runtime::traits::BadOrigin;
use core_primitives::TokenType;
-use mock::BlockNumber as MBlockNumber;
-use mock::{RuntimeEvent, *};
+
+use mock::*;
use super::*;
diff --git a/pallets/crowdloan/src/lib.rs b/pallets/crowdloan/src/lib.rs
index ebe710e1e..ed189b346 100644
--- a/pallets/crowdloan/src/lib.rs
+++ b/pallets/crowdloan/src/lib.rs
@@ -18,26 +18,17 @@
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_prelude::*;
-use frame_support::traits::{Currency, ExistenceRequirement, VestingSchedule};
-use frame_support::{dispatch::DispatchResult, ensure, traits::Get, PalletId};
+use frame_support::traits::{Currency, VestingSchedule};
+use frame_support::{dispatch::DispatchResult, ensure, traits::Get};
use frame_system::pallet_prelude::*;
use frame_system::{ensure_root, ensure_signed};
use pallet_vesting::{Pallet as VestingModule, VestingInfo};
-use scale_info::TypeInfo;
-use sp_runtime::traits::Convert;
-use sp_runtime::{
- traits::{AccountIdConversion, One, Saturating, Zero},
- DispatchError,
-};
+
+use sp_runtime::traits::Saturating;
use sp_std::{convert::TryInto, vec::Vec};
-use auction_manager::{Auction, CheckAuctionItemHandler};
-use core_primitives::*;
pub use pallet::*;
-use primitives::{
- estate::Estate, Balance, EstateId, ItemId, MetaverseId, UndeployedLandBlock, UndeployedLandBlockId,
- UndeployedLandBlockType,
-};
+
pub use weights::WeightInfo;
#[cfg(feature = "runtime-benchmarks")]
@@ -53,11 +44,9 @@ pub mod weights;
#[frame_support::pallet]
pub mod pallet {
- use frame_support::traits::{Currency, ExistenceRequirement, Imbalance, ReservableCurrency, VestingSchedule};
+ use frame_support::traits::{Currency, ExistenceRequirement, VestingSchedule};
use pallet_vesting::VestingInfo;
- use sp_runtime::traits::{CheckedAdd, CheckedSub, Convert, ConvertInto, StaticLookup, Zero};
-
- use primitives::UndeployedLandBlockId;
+ use sp_runtime::traits::{Convert, StaticLookup};
use super::*;
diff --git a/pallets/crowdloan/src/mock.rs b/pallets/crowdloan/src/mock.rs
index d13741bbb..d7366fa24 100644
--- a/pallets/crowdloan/src/mock.rs
+++ b/pallets/crowdloan/src/mock.rs
@@ -1,14 +1,11 @@
#![cfg(test)]
use frame_support::traits::WithdrawReasons;
-use frame_support::{construct_runtime, ord_parameter_types, parameter_types, PalletId};
-use frame_system::EnsureSignedBy;
-use sp_core::H256;
-use sp_runtime::traits::{ConvertInto, Identity};
-use sp_runtime::{testing::Header, traits::IdentityLookup, DispatchError, Perbill};
+use frame_support::{construct_runtime, ord_parameter_types, parameter_types};
-use auction_manager::{Auction, AuctionInfo, AuctionType, CheckAuctionItemHandler, ListingLevel};
-use primitives::FungibleTokenId;
+use sp_core::H256;
+use sp_runtime::traits::ConvertInto;
+use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
use crate as crowdloan;
@@ -124,29 +121,29 @@ impl VestingSchedule for VestingScheduleTrait {
type Moment = ();
type Currency = Balances;
- fn vesting_balance(who: &AccountId) -> Option {
+ fn vesting_balance(_who: &AccountId) -> Option {
None
}
fn add_vesting_schedule(
- who: &AccountId,
- locked: Balance,
- per_block: Balance,
- starting_block: Self::Moment,
+ _who: &AccountId,
+ _locked: Balance,
+ _per_block: Balance,
+ _starting_block: Self::Moment,
) -> DispatchResult {
Ok(())
}
fn can_add_vesting_schedule(
- who: &AccountId,
- locked: Balance,
- per_block: Balance,
- starting_block: Self::Moment,
+ _who: &AccountId,
+ _locked: Balance,
+ _per_block: Balance,
+ _starting_block: Self::Moment,
) -> DispatchResult {
Ok(())
}
- fn remove_vesting_schedule(who: &AccountId, schedule_index: u32) -> DispatchResult {
+ fn remove_vesting_schedule(_who: &AccountId, _schedule_index: u32) -> DispatchResult {
Ok(())
}
}
diff --git a/pallets/crowdloan/src/tests.rs b/pallets/crowdloan/src/tests.rs
index e64629b57..79d295b2d 100644
--- a/pallets/crowdloan/src/tests.rs
+++ b/pallets/crowdloan/src/tests.rs
@@ -17,7 +17,7 @@
#![cfg(test)]
-use frame_support::{assert_err, assert_noop, assert_ok};
+use frame_support::{assert_noop, assert_ok};
use sp_runtime::traits::BadOrigin;
use mock::{RuntimeEvent, *};
diff --git a/pallets/economy/src/lib.rs b/pallets/economy/src/lib.rs
index be695632a..124e7997a 100644
--- a/pallets/economy/src/lib.rs
+++ b/pallets/economy/src/lib.rs
@@ -17,16 +17,15 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use codec::{Decode, Encode, HasCompact};
-use frame_support::traits::{LockIdentifier, WithdrawReasons};
+use codec::Encode;
use frame_support::{
- ensure, log,
+ ensure,
pallet_prelude::*,
- traits::{Currency, ExistenceRequirement, LockableCurrency, ReservableCurrency},
+ traits::{Currency, LockableCurrency, ReservableCurrency},
transactional, PalletId,
};
use frame_system::{ensure_signed, pallet_prelude::*};
-use orml_traits::{DataFeeder, DataProvider, MultiCurrency, MultiReservableCurrency};
+use orml_traits::{DataProvider, MultiCurrency, MultiReservableCurrency};
use sp_runtime::traits::{BlockNumberProvider, CheckedAdd, CheckedMul, Saturating};
use sp_runtime::{
traits::{AccountIdConversion, One, Zero},
@@ -38,7 +37,7 @@ use core_primitives::NFTTrait;
use core_primitives::*;
pub use pallet::*;
use primitives::{estate::Estate, EstateId};
-use primitives::{AssetId, Balance, ClassId, DomainId, FungibleTokenId, MetaverseId, NftId, PowerAmount, RoundIndex};
+use primitives::{Balance, ClassId, DomainId, FungibleTokenId, PowerAmount, RoundIndex};
pub use weights::WeightInfo;
//#[cfg(feature = "runtime-benchmarks")]
@@ -54,12 +53,11 @@ pub mod weights;
#[frame_support::pallet]
pub mod pallet {
- use orml_traits::MultiCurrencyExtended;
use sp_runtime::traits::{CheckedAdd, CheckedSub, Saturating};
use sp_runtime::ArithmeticError;
- use primitives::staking::{Bond, RoundInfo};
- use primitives::{ClassId, GroupCollectionId, NftId};
+ use primitives::staking::Bond;
+ use primitives::{ClassId, NftId};
use super::*;
@@ -338,7 +336,7 @@ pub mod pallet {
Error::::ExitQueueAlreadyScheduled
);
- let mut staked_balance = StakingInfo::::get(&who);
+ let staked_balance = StakingInfo::::get(&who);
let total = staked_balance.checked_add(&amount).ok_or(ArithmeticError::Overflow)?;
ensure!(total >= T::MinimumStake::get(), Error::::StakeBelowMinimum);
@@ -440,7 +438,7 @@ pub mod pallet {
match estate {
None => {
- let mut staked_balance = StakingInfo::::get(&who);
+ let staked_balance = StakingInfo::::get(&who);
ensure!(amount <= staked_balance, Error::::UnstakeAmountExceedStakedAmount);
let remaining = staked_balance.checked_sub(&amount).ok_or(ArithmeticError::Underflow)?;
@@ -672,7 +670,7 @@ pub mod pallet {
match estate {
None => {
- let mut staked_balance = StakingInfo::::get(&who);
+ let staked_balance = StakingInfo::::get(&who);
ensure!(amount <= staked_balance, Error::::UnstakeAmountExceedStakedAmount);
let remaining = staked_balance.checked_sub(&amount).ok_or(ArithmeticError::Underflow)?;
@@ -771,7 +769,7 @@ pub mod pallet {
ensure!(!amount.is_zero(), Error::::UnstakeAmountIsZero);
// Update staking info
- let mut staked_reserved_balance = T::Currency::reserved_balance(&who);
+ let staked_reserved_balance = T::Currency::reserved_balance(&who);
ensure!(
amount <= staked_reserved_balance,
Error::::UnstakeAmountExceedStakedAmount
@@ -795,7 +793,7 @@ impl Pallet {
pub fn convert_power_to_bit(power_amount: Balance, commission: Perbill) -> (Balance, Balance) {
let rate = Self::get_bit_power_exchange_rate();
- let mut bit_required = power_amount
+ let bit_required = power_amount
.checked_mul(rate)
.ok_or(ArithmeticError::Overflow)
.unwrap_or(Zero::zero());
diff --git a/pallets/economy/src/mock.rs b/pallets/economy/src/mock.rs
index f6da3a3ca..6969f2bf4 100644
--- a/pallets/economy/src/mock.rs
+++ b/pallets/economy/src/mock.rs
@@ -3,10 +3,12 @@
use frame_support::traits::Nothing;
use frame_support::{construct_runtime, ord_parameter_types, parameter_types, PalletId};
use frame_system::EnsureSignedBy;
-use orml_traits::currency::MutationHooks;
+
use orml_traits::parameter_type_with_key;
+use sp_core::crypto::AccountId32;
use sp_core::H256;
-use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
+use sp_runtime::traits::{IdentifyAccount, Verify};
+use sp_runtime::{testing::Header, traits::IdentityLookup, MultiSignature, Perbill};
use auction_manager::*;
use core_primitives::NftAssetData;
@@ -18,13 +20,15 @@ use crate as economy;
use super::*;
-pub type AccountId = u128;
+pub type AccountId = ::AccountId;
pub type Balance = u128;
pub type BlockNumber = u64;
+type Signature = MultiSignature;
+type AccountPublic = ::Signer;
-pub const ALICE: AccountId = 1;
-pub const BOB: AccountId = 2;
-pub const FREEDY: AccountId = 3;
+pub const ALICE: AccountId = AccountId32::new([1; 32]);
+pub const BOB: AccountId = AccountId32::new([2; 32]);
+pub const FREEDY: AccountId = AccountId32::new([3; 32]);
pub const DISTRIBUTOR_COLLECTION_ID: u64 = 0;
pub const DISTRIBUTOR_CLASS_ID: ClassId = 0;
@@ -121,23 +125,23 @@ impl pallet_balances::Config for Runtime {
pub struct EstateHandler;
-impl Estate for EstateHandler {
- fn transfer_estate(estate_id: EstateId, _from: &u128, _to: &u128) -> Result {
+impl Estate for EstateHandler {
+ fn transfer_estate(estate_id: EstateId, _from: &AccountId, _to: &AccountId) -> Result {
Ok(estate_id)
}
fn transfer_landunit(
coordinate: (i32, i32),
- _from: &u128,
- _to: &(u128, primitives::MetaverseId),
+ _from: &AccountId,
+ _to: &(AccountId, primitives::MetaverseId),
) -> Result<(i32, i32), DispatchError> {
Ok(coordinate)
}
fn transfer_undeployed_land_block(
- who: &AccountId,
- to: &AccountId,
- undeployed_land_block_id: UndeployedLandBlockId,
+ _who: &AccountId,
+ _to: &AccountId,
+ _undeployed_land_block_id: UndeployedLandBlockId,
) -> Result {
Ok(2)
}
@@ -156,18 +160,18 @@ impl Estate for EstateHandler {
Ok(false)
}
- fn check_landunit(_metaverse_id: primitives::MetaverseId, coordinate: (i32, i32)) -> Result {
+ fn check_landunit(_metaverse_id: primitives::MetaverseId, _coordinate: (i32, i32)) -> Result {
Ok(true)
}
fn check_undeployed_land_block(
- owner: &AccountId,
- undeployed_land_block_id: UndeployedLandBlockId,
+ _owner: &AccountId,
+ _undeployed_land_block_id: UndeployedLandBlockId,
) -> Result {
Ok(true)
}
- fn get_total_land_units(estate_id: Option) -> u64 {
+ fn get_total_land_units(_estate_id: Option) -> u64 {
10
}
@@ -175,11 +179,11 @@ impl Estate for EstateHandler {
10
}
- fn is_estate_leasor(leasor: AccountId, estate_id: EstateId) -> Result {
+ fn is_estate_leasor(_leasor: AccountId, _estate_id: EstateId) -> Result {
Ok(false)
}
- fn is_estate_leased(estate_id: EstateId) -> Result {
+ fn is_estate_leased(_estate_id: EstateId) -> Result {
Ok(false)
}
}
@@ -187,7 +191,7 @@ impl Estate for EstateHandler {
pub struct MetaverseStakingHandler;
impl MetaverseStakingTrait for MetaverseStakingHandler {
- fn update_staking_reward(round: RoundIndex, total_reward: u128) -> sp_runtime::DispatchResult {
+ fn update_staking_reward(_round: RoundIndex, _total_reward: u128) -> sp_runtime::DispatchResult {
Ok(())
}
}
@@ -213,8 +217,8 @@ impl pallet_mining::Config for Runtime {
}
ord_parameter_types! {
- pub const One: AccountId = 1;
- pub const Two: AccountId = 2;
+ pub const One: AccountId = AccountId32::new([1;32]);
+ pub const Two: AccountId = AccountId32::new([2;32]);
pub const PowerAmountPerBlock: u32 = 10;
}
impl Config for Runtime {
@@ -276,24 +280,24 @@ pub struct MockAuctionManager;
impl Auction for MockAuctionManager {
type Balance = Balance;
- fn auction_info(_id: u64) -> Option> {
+ fn auction_info(_id: u64) -> Option> {
None
}
- fn auction_item(id: AuctionId) -> Option> {
+ fn auction_item(_id: AuctionId) -> Option> {
None
}
- fn update_auction(_id: u64, _info: AuctionInfo) -> DispatchResult {
+ fn update_auction(_id: u64, _info: AuctionInfo) -> DispatchResult {
Ok(())
}
- fn update_auction_item(id: AuctionId, item_id: ItemId) -> DispatchResult {
+ fn update_auction_item(_id: AuctionId, _item_id: ItemId) -> DispatchResult {
Ok(())
}
fn new_auction(
- _recipient: u128,
+ _recipient: AccountId,
_initial_amount: Self::Balance,
_start: u64,
_end: Option,
@@ -305,7 +309,7 @@ impl Auction for MockAuctionManager {
_auction_type: AuctionType,
_item_id: ItemId,
_end: Option,
- _recipient: u128,
+ _recipient: AccountId,
_initial_amount: Self::Balance,
_start: u64,
_listing_level: ListingLevel,
@@ -317,19 +321,19 @@ impl Auction for MockAuctionManager {
fn remove_auction(_id: u64, _item_id: ItemId) {}
- fn auction_bid_handler(from: AccountId, id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn auction_bid_handler(_from: AccountId, _id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
- fn buy_now_handler(from: AccountId, auction_id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn buy_now_handler(_from: AccountId, _auction_id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
fn local_auction_bid_handler(
_now: u64,
_id: u64,
- _new_bid: (u128, Self::Balance),
- _last_bid: Option<(u128, Self::Balance)>,
+ _new_bid: (AccountId, Self::Balance),
+ _last_bid: Option<(AccountId, Self::Balance)>,
_social_currency_id: FungibleTokenId,
) -> DispatchResult {
Ok(())
@@ -337,7 +341,7 @@ impl Auction for MockAuctionManager {
fn collect_royalty_fee(
_high_bid_price: &Self::Balance,
- _high_bidder: &u128,
+ _high_bidder: &AccountId,
_asset_id: &(u32, u64),
_social_currency_id: FungibleTokenId,
) -> DispatchResult {
@@ -376,6 +380,8 @@ impl pallet_nft::Config for Runtime {
type AssetMintingFee = AssetMintingFee;
type ClassMintingFee = ClassMintingFee;
type StorageDepositFee = StorageDepositFee;
+ type OffchainSignature = Signature;
+ type OffchainPublic = AccountPublic;
}
parameter_types! {
diff --git a/pallets/economy/src/tests.rs b/pallets/economy/src/tests.rs
index a67f3e08b..64e848a46 100644
--- a/pallets/economy/src/tests.rs
+++ b/pallets/economy/src/tests.rs
@@ -17,12 +17,11 @@
#![cfg(test)]
-use frame_support::{assert_err, assert_noop, assert_ok};
-use orml_nft::Tokens;
+use frame_support::{assert_noop, assert_ok};
+
use sp_runtime::traits::BadOrigin;
use sp_std::default::Default;
-use auction_manager::ListingLevel;
use core_primitives::{Attributes, CollectionType, TokenType};
use mock::{RuntimeEvent, *};
use primitives::staking::Bond;
@@ -30,6 +29,12 @@ use primitives::GroupCollectionId;
use super::*;
+type AccountIdOf = ::AccountId;
+
+fn account(id: u8) -> AccountIdOf {
+ [id; 32].into()
+}
+
fn init_test_nft(owner: RuntimeOrigin, collection_id: GroupCollectionId, class_id: ClassId) {
//Create group collection before class
assert_ok!(NFTModule::create_group(RuntimeOrigin::root(), vec![1], vec![1]));
@@ -66,7 +71,7 @@ fn get_mining_currency() -> FungibleTokenId {
fn set_bit_power_exchange_rate_should_fail_bad_origin() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::set_bit_power_exchange_rate(RuntimeOrigin::signed(BOB), EXCHANGE_RATE),
+ EconomyModule::set_bit_power_exchange_rate(RuntimeOrigin::signed(account(2)), EXCHANGE_RATE),
BadOrigin
);
});
@@ -88,7 +93,7 @@ fn set_bit_power_exchange_rate_should_work() {
fn stake_should_fail_insufficient_balance() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_EXCESS_BALANCE, None),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_EXCESS_BALANCE, None),
Error::::InsufficientBalanceForStaking
);
});
@@ -98,10 +103,10 @@ fn stake_should_fail_insufficient_balance() {
fn stake_should_fail_exit_queue_scheduled() {
ExtBuilder::default().build().execute_with(|| {
// Add account entry to ExitQueue
- ExitQueue::::insert(ALICE, CURRENT_ROUND, STAKE_BALANCE);
+ ExitQueue::::insert(account(1), CURRENT_ROUND, STAKE_BALANCE);
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BELOW_MINIMUM_BALANCE, None),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BELOW_MINIMUM_BALANCE, None),
Error::::ExitQueueAlreadyScheduled
);
});
@@ -111,7 +116,7 @@ fn stake_should_fail_exit_queue_scheduled() {
fn stake_should_fail_below_minimum() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BELOW_MINIMUM_BALANCE, None),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BELOW_MINIMUM_BALANCE, None),
Error::::StakeBelowMinimum
);
});
@@ -121,7 +126,7 @@ fn stake_should_fail_below_minimum() {
fn stake_should_fail_for_non_existing_estate() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(8u32.into())),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE, Some(8u32.into())),
Error::::StakeEstateDoesNotExist
);
});
@@ -131,7 +136,11 @@ fn stake_should_fail_for_non_existing_estate() {
fn stake_should_fail_for_estate_not_owned_by_staker() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(EXISTING_ESTATE_ID)),
+ EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ Some(EXISTING_ESTATE_ID)
+ ),
Error::::StakerNotEstateOwner
);
});
@@ -140,14 +149,14 @@ fn stake_should_fail_for_estate_not_owned_by_staker() {
fn stake_should_fail_for_estate_owned_by_staker_but_having_previously_staked_bond() {
ExtBuilder::default().build().execute_with(|| {
let prepopulated_bond = Bond {
- staker: BOB,
+ staker: account(2),
amount: STAKE_BALANCE,
};
EstateStakingInfo::::insert(&OWNED_ESTATE_ID, prepopulated_bond);
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
Error::::PreviousOwnerStillStakesAtEstate
);
});
@@ -156,16 +165,20 @@ fn stake_should_fail_for_estate_owned_by_staker_but_having_previously_staked_bon
#[test]
fn stake_should_work() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_eq!(
last_event(),
- RuntimeEvent::Economy(crate::Event::SelfStakedToEconomy101(ALICE, STAKE_BALANCE))
+ RuntimeEvent::Economy(crate::Event::SelfStakedToEconomy101(account(1), STAKE_BALANCE))
);
- assert_eq!(Balances::reserved_balance(ALICE), STAKE_BALANCE);
+ assert_eq!(Balances::reserved_balance(account(1)), STAKE_BALANCE);
- assert_eq!(EconomyModule::get_staking_info(ALICE), STAKE_BALANCE);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), STAKE_BALANCE);
assert_eq!(EconomyModule::total_stake(), STAKE_BALANCE);
});
@@ -175,7 +188,7 @@ fn stake_should_work() {
fn stake_should_work_for_estate() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(EconomyModule::stake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
STAKE_BALANCE,
Some(OWNED_ESTATE_ID)
));
@@ -183,16 +196,16 @@ fn stake_should_work_for_estate() {
assert_eq!(
last_event(),
RuntimeEvent::Economy(crate::Event::EstateStakedToEconomy101(
- ALICE,
+ account(1),
OWNED_ESTATE_ID,
STAKE_BALANCE
))
);
- assert_eq!(Balances::reserved_balance(ALICE), STAKE_BALANCE);
+ assert_eq!(Balances::reserved_balance(account(1)), STAKE_BALANCE);
assert_eq!(
EconomyModule::get_estate_staking_info(OWNED_ESTATE_ID).unwrap().staker,
- ALICE
+ account(1)
);
assert_eq!(
EconomyModule::get_estate_staking_info(OWNED_ESTATE_ID).unwrap().amount,
@@ -206,15 +219,19 @@ fn stake_should_work_for_estate() {
#[test]
fn stake_should_work_with_more_operations() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), 100, None));
+ assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(account(1)), 100, None));
let total_staked_balance = STAKE_BALANCE + 100u128;
- assert_eq!(Balances::reserved_balance(ALICE), total_staked_balance);
+ assert_eq!(Balances::reserved_balance(account(1)), total_staked_balance);
- assert_eq!(EconomyModule::get_staking_info(ALICE), total_staked_balance);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), total_staked_balance);
assert_eq!(EconomyModule::total_stake(), total_staked_balance);
});
@@ -224,7 +241,7 @@ fn stake_should_work_with_more_operations() {
fn unstake_should_fail_exceeds_staked_amount() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::unstake(RuntimeOrigin::signed(ALICE), UNSTAKE_AMOUNT, None),
+ EconomyModule::unstake(RuntimeOrigin::signed(account(1)), UNSTAKE_AMOUNT, None),
Error::::UnstakeAmountExceedStakedAmount
);
});
@@ -233,10 +250,14 @@ fn unstake_should_fail_exceeds_staked_amount() {
#[test]
fn unstake_should_fail_unstake_zero() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_noop!(
- EconomyModule::unstake(RuntimeOrigin::signed(ALICE), 0u128, None),
+ EconomyModule::unstake(RuntimeOrigin::signed(account(1)), 0u128, None),
Error::::UnstakeAmountIsZero
);
});
@@ -246,7 +267,7 @@ fn unstake_should_fail_unstake_zero() {
fn unstake_should_fail_for_non_existing_estate() {
ExtBuilder::default().build().execute_with(|| {
assert_noop!(
- EconomyModule::unstake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(8u32.into())),
+ EconomyModule::unstake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE, Some(8u32.into())),
Error::::StakeEstateDoesNotExist
);
});
@@ -256,14 +277,14 @@ fn unstake_should_fail_for_non_existing_estate() {
fn unstake_should_fail_for_estate_the_account_has_not_staked_in() {
ExtBuilder::default().build().execute_with(|| {
let prepopulated_bond = Bond {
- staker: BOB,
+ staker: account(2),
amount: STAKE_BALANCE,
};
EstateStakingInfo::::insert(&OWNED_ESTATE_ID, prepopulated_bond);
assert_noop!(
- EconomyModule::unstake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
+ EconomyModule::unstake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
Error::::NoFundsStakedAtEstate
);
});
@@ -272,26 +293,33 @@ fn unstake_should_fail_for_estate_the_account_has_not_staked_in() {
#[test]
fn unstake_should_work() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_ok!(EconomyModule::unstake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
UNSTAKE_AMOUNT,
None
));
assert_eq!(
last_event(),
- RuntimeEvent::Economy(crate::Event::SelfStakingRemovedFromEconomy101(ALICE, UNSTAKE_AMOUNT))
+ RuntimeEvent::Economy(crate::Event::SelfStakingRemovedFromEconomy101(
+ account(1),
+ UNSTAKE_AMOUNT
+ ))
);
let total_staked_balance = STAKE_BALANCE - UNSTAKE_AMOUNT;
- assert_eq!(EconomyModule::get_staking_info(ALICE), total_staked_balance);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), total_staked_balance);
assert_eq!(EconomyModule::total_stake(), total_staked_balance);
let next_round: RoundIndex = CURRENT_ROUND.saturating_add(1);
assert_eq!(
- EconomyModule::staking_exit_queue(ALICE, next_round),
+ EconomyModule::staking_exit_queue(account(1), next_round),
Some(UNSTAKE_AMOUNT)
);
});
@@ -301,18 +329,18 @@ fn unstake_should_work() {
fn unstake_should_work_for_estate() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(EconomyModule::stake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
STAKE_BALANCE,
Some(OWNED_ESTATE_ID)
));
assert_noop!(
- EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
+ EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE, Some(OWNED_ESTATE_ID)),
Error::::StakeAmountExceedMaximumAmount
);
assert_ok!(EconomyModule::unstake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
UNSTAKE_AMOUNT,
Some(OWNED_ESTATE_ID)
));
@@ -320,7 +348,7 @@ fn unstake_should_work_for_estate() {
assert_eq!(
last_event(),
RuntimeEvent::Economy(crate::Event::EstateStakingRemovedFromEconomy101(
- ALICE,
+ account(1),
OWNED_ESTATE_ID,
UNSTAKE_AMOUNT
))
@@ -329,7 +357,7 @@ fn unstake_should_work_for_estate() {
let total_staked_balance = STAKE_BALANCE - UNSTAKE_AMOUNT;
assert_eq!(
EconomyModule::get_estate_staking_info(OWNED_ESTATE_ID).unwrap().staker,
- ALICE
+ account(1)
);
assert_eq!(
EconomyModule::get_estate_staking_info(OWNED_ESTATE_ID).unwrap().amount,
@@ -339,7 +367,7 @@ fn unstake_should_work_for_estate() {
let next_round: RoundIndex = CURRENT_ROUND.saturating_add(1);
assert_eq!(
- EconomyModule::estate_staking_exit_queue((ALICE, next_round, OWNED_ESTATE_ID)),
+ EconomyModule::estate_staking_exit_queue((account(1), next_round, OWNED_ESTATE_ID)),
Some(UNSTAKE_AMOUNT)
);
});
@@ -348,56 +376,67 @@ fn unstake_should_work_for_estate() {
#[test]
fn withdraw_unstake_should_work() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_ok!(EconomyModule::unstake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
UNSTAKE_AMOUNT,
None
));
assert_eq!(
last_event(),
- RuntimeEvent::Economy(crate::Event::SelfStakingRemovedFromEconomy101(ALICE, UNSTAKE_AMOUNT))
+ RuntimeEvent::Economy(crate::Event::SelfStakingRemovedFromEconomy101(
+ account(1),
+ UNSTAKE_AMOUNT
+ ))
);
let total_staked_balance = STAKE_BALANCE - UNSTAKE_AMOUNT;
- assert_eq!(EconomyModule::get_staking_info(ALICE), total_staked_balance);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), total_staked_balance);
assert_eq!(EconomyModule::total_stake(), total_staked_balance);
let next_round: RoundIndex = CURRENT_ROUND.saturating_add(1);
assert_eq!(
- EconomyModule::staking_exit_queue(ALICE, next_round),
+ EconomyModule::staking_exit_queue(account(1), next_round),
Some(UNSTAKE_AMOUNT)
);
// Default round length is 20 blocks so moving 25 blocks will move to the next round
run_to_block(25);
assert_ok!(EconomyModule::withdraw_unreserved(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
next_round
));
- // ALICE balance free_balance was 9000 and added 9010 after withdraw unreserved
- assert_eq!(Balances::free_balance(ALICE), FREE_BALANCE);
+ // account(1) balance free_balance was 9000 and added 9010 after withdraw unreserved
+ assert_eq!(Balances::free_balance(account(1)), FREE_BALANCE);
});
}
#[test]
fn unstake_should_work_with_single_round() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_ok!(EconomyModule::unstake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
UNSTAKE_AMOUNT,
None
));
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(BOB), 200, None));
+ assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(account(2)), 200, None));
let alice_staked_balance = STAKE_BALANCE - UNSTAKE_AMOUNT;
- assert_eq!(EconomyModule::get_staking_info(ALICE), alice_staked_balance);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), alice_staked_balance);
let total_staked_balance = alice_staked_balance + 200;
assert_eq!(EconomyModule::total_stake(), total_staked_balance);
@@ -407,25 +446,29 @@ fn unstake_should_work_with_single_round() {
#[test]
fn unstake_should_fail_with_existing_queue() {
ExtBuilder::default().build().execute_with(|| {
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE, None));
+ assert_ok!(EconomyModule::stake(
+ RuntimeOrigin::signed(account(1)),
+ STAKE_BALANCE,
+ None
+ ));
assert_ok!(EconomyModule::unstake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
UNSTAKE_AMOUNT,
None
));
- assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(BOB), 200, None));
+ assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(account(2)), 200, None));
let alice_staked_balance = STAKE_BALANCE - UNSTAKE_AMOUNT;
- assert_eq!(EconomyModule::get_staking_info(ALICE), alice_staked_balance);
+ assert_eq!(EconomyModule::get_staking_info(account(1)), alice_staked_balance);
let total_staked_balance = alice_staked_balance + 200;
assert_eq!(EconomyModule::total_stake(), total_staked_balance);
assert_noop!(
- EconomyModule::unstake(RuntimeOrigin::signed(ALICE), UNSTAKE_AMOUNT, None),
+ EconomyModule::unstake(RuntimeOrigin::signed(account(1)), UNSTAKE_AMOUNT, None),
Error::::ExitQueueAlreadyScheduled
);
});
@@ -434,10 +477,10 @@ fn unstake_should_fail_with_existing_queue() {
#[test]
fn unstake_new_estate_owner_should_fail_if_estate_does_not_exist() {
ExtBuilder::default().build().execute_with(|| {
- //assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(ALICE), STAKE_BALANCE,
+ //assert_ok!(EconomyModule::stake(RuntimeOrigin::signed(account(1)), STAKE_BALANCE,
// Some(OWNED_ESTATE_ID)));
assert_noop!(
- EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(ALICE), 1000u64),
+ EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(account(1)), 1000u64),
Error::::StakeEstateDoesNotExist
);
});
@@ -447,12 +490,12 @@ fn unstake_new_estate_owner_should_fail_if_estate_does_not_exist() {
fn unstake_new_estate_owner_should_fail_if_not_estate_owner() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(EconomyModule::stake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
STAKE_BALANCE,
Some(OWNED_ESTATE_ID)
));
assert_noop!(
- EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(BOB), OWNED_ESTATE_ID),
+ EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(account(2)), OWNED_ESTATE_ID),
Error::::StakerNotEstateOwner
);
});
@@ -462,12 +505,12 @@ fn unstake_new_estate_owner_should_fail_if_not_estate_owner() {
fn unstake_new_estate_owner_should_fail_if_no_previous_owner_has_staked_balance_left() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(EconomyModule::stake(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
STAKE_BALANCE,
Some(OWNED_ESTATE_ID)
));
assert_noop!(
- EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(ALICE), OWNED_ESTATE_ID),
+ EconomyModule::unstake_new_estate_owner(RuntimeOrigin::signed(account(1)), OWNED_ESTATE_ID),
Error::::StakerNotPreviousOwner
);
});
@@ -477,19 +520,19 @@ fn unstake_new_estate_owner_should_fail_if_no_previous_owner_has_staked_balance_
fn unstake_new_estate_owner_should_work() {
ExtBuilder::default().build().execute_with(|| {
let prepopulated_bond = Bond {
- staker: BOB,
+ staker: account(2),
amount: STAKE_BALANCE,
};
EstateStakingInfo::::insert(&OWNED_ESTATE_ID, prepopulated_bond);
assert_ok!(EconomyModule::unstake_new_estate_owner(
- RuntimeOrigin::signed(ALICE),
+ RuntimeOrigin::signed(account(1)),
OWNED_ESTATE_ID
));
assert_eq!(
last_event(),
RuntimeEvent::Economy(crate::Event::EstateStakingRemovedFromEconomy101(
- ALICE,
+ account(1),
OWNED_ESTATE_ID,
STAKE_BALANCE
))
diff --git a/pallets/estate/src/lib.rs b/pallets/estate/src/lib.rs
index 3c124e779..b7a31ca30 100644
--- a/pallets/estate/src/lib.rs
+++ b/pallets/estate/src/lib.rs
@@ -26,11 +26,10 @@ use frame_support::{
};
use frame_system::pallet_prelude::*;
use frame_system::{ensure_root, ensure_signed};
-use scale_info::TypeInfo;
use sp_runtime::{
- traits::{AccountIdConversion, Convert, One, Saturating, Zero},
- ArithmeticError, DispatchError, Perbill, SaturatedConversion,
+ traits::{AccountIdConversion, Convert, One, Saturating},
+ DispatchError, Perbill, SaturatedConversion,
};
use sp_std::vec::Vec;
@@ -40,7 +39,7 @@ pub use pallet::*;
use primitives::estate::EstateInfo;
use primitives::{
estate::{Estate, LandUnitStatus, LeaseContract, OwnerId},
- Attributes, ClassId, EstateId, FungibleTokenId, ItemId, MetaverseId, NftMetadata, TokenId, UndeployedLandBlock,
+ Attributes, ClassId, EstateId, ItemId, MetaverseId, NftMetadata, TokenId, UndeployedLandBlock,
UndeployedLandBlockId, UndeployedLandBlockType,
};
pub use rate::{MintingRateInfo, Range};
@@ -61,11 +60,11 @@ pub mod weights;
#[frame_support::pallet]
pub mod pallet {
use frame_support::traits::{Currency, Imbalance, ReservableCurrency};
- use sp_runtime::traits::{CheckedAdd, CheckedSub, Zero};
+ use sp_runtime::traits::{CheckedSub, Zero};
use primitives::estate::EstateInfo;
- use primitives::staking::{Bond, RoundInfo, StakeSnapshot};
- use primitives::{Balance, RoundIndex, UndeployedLandBlockId};
+ use primitives::staking::RoundInfo;
+ use primitives::{RoundIndex, UndeployedLandBlockId};
use crate::rate::{round_issuance_range, MintingRateInfo};
@@ -1047,7 +1046,7 @@ pub mod pallet {
T::NFTTokenizationSource::burn_nft(&who, &(class_id, token_id));
*estate_owner = None;
}
- OwnerId::Account(ref a) => {
+ OwnerId::Account(ref _a) => {
*estate_owner = None;
}
}
@@ -1063,7 +1062,7 @@ pub mod pallet {
AllEstatesCount::::put(new_total_estates_count);
// Mint new land tokens to replace the lands in the dissolved estate
- let estate_account_id: T::AccountId =
+ let _estate_account_id: T::AccountId =
T::LandTreasury::get().into_sub_account_truncating(estate_id);
let storage_fee: BalanceOf =
Perbill::from_percent(100u32.saturating_mul(estate_info.land_units.len() as u32))
@@ -1207,11 +1206,12 @@ pub mod pallet {
Error::::NoPermission
);
let estate_info: EstateInfo = Estates::::get(estate_id).ok_or(Error::::EstateDoesNotExist)?;
- let estate_account_id: T::AccountId = T::LandTreasury::get().into_sub_account_truncating(estate_id);
+ let _estate_account_id: T::AccountId =
+ T::LandTreasury::get().into_sub_account_truncating(estate_id);
// Mutate estates
Estates::::try_mutate_exists(&estate_id, |maybe_estate_info| {
- let mut mut_estate_info = maybe_estate_info.as_mut().ok_or(Error::::EstateDoesNotExist)?;
+ let mut_estate_info = maybe_estate_info.as_mut().ok_or(Error::::EstateDoesNotExist)?;
let storage_fee: BalanceOf =
Perbill::from_percent(100u32.saturating_mul(land_units.len() as u32))
@@ -1549,7 +1549,7 @@ pub mod pallet {
);
let current_block = >::block_number();
EstateLeases::::try_mutate_exists(&estate_id, |estate_lease_value| {
- let mut lease = estate_lease_value.as_mut().ok_or(Error::::LeaseDoesNotExist)?;
+ let lease = estate_lease_value.as_mut().ok_or(Error::::LeaseDoesNotExist)?;
ensure!(lease.end_block > current_block, Error::::LeaseIsExpired);
@@ -1615,7 +1615,7 @@ impl Pallet {
Error::::NoPermission
);
- if let OwnerId::Token(owner_class_id, owner_token_id) = token_owner {
+ if let OwnerId::Token(owner_class_id, _owner_token_id) = token_owner {
ensure!(owner_class_id != class_id, Error::::LandUnitAlreadyInEstate)
}
@@ -1881,11 +1881,11 @@ impl Pallet {
from: &T::AccountId,
to: &T::AccountId,
) -> Result {
- EstateOwner::::try_mutate_exists(&estate_id, |estate_owner| -> Result {
+ EstateOwner::::try_mutate_exists(&estate_id, |_estate_owner| -> Result {
//ensure there is record of the estate owner with estate id and account id
ensure!(from != to, Error::::AlreadyOwnTheEstate);
let estate_owner_value = Self::get_estate_owner(&estate_id).ok_or(Error::::NoPermission)?;
- let estate_info = Estates::::get(estate_id).ok_or(Error::::EstateDoesNotExist)?;
+ let _estate_info = Estates::::get(estate_id).ok_or(Error::::EstateDoesNotExist)?;
ensure!(
!EstateLeases::::contains_key(estate_id),
Error::::EstateIsAlreadyLeased
@@ -2081,8 +2081,8 @@ impl Pallet {
}
fn verify_land_unit_in_bound(block_coordinate: &(i32, i32), land_unit_coordinates: &Vec<(i32, i32)>) -> bool {
- let mut vec_axis = land_unit_coordinates.iter().map(|lu| lu.0).collect::>();
- let mut vec_yaxis = land_unit_coordinates.iter().map(|lu| lu.1).collect::>();
+ let vec_axis = land_unit_coordinates.iter().map(|lu| lu.0).collect::>();
+ let vec_yaxis = land_unit_coordinates.iter().map(|lu| lu.1).collect::>();
let max_axis = vec_axis.iter().max().unwrap_or(&i32::MAX);
let max_yaxis = vec_yaxis.iter().max().unwrap_or(&i32::MAX);
diff --git a/pallets/estate/src/mock.rs b/pallets/estate/src/mock.rs
index 3856a489b..c20c8137d 100644
--- a/pallets/estate/src/mock.rs
+++ b/pallets/estate/src/mock.rs
@@ -14,9 +14,7 @@ use sp_std::vec::Vec;
use auction_manager::{Auction, AuctionInfo, AuctionItem, AuctionType, CheckAuctionItemHandler, ListingLevel};
use core_primitives::{CollectionType, NftClassData, TokenType};
-use primitives::{
- AssetId, Attributes, AuctionId, ClassId, FungibleTokenId, GroupCollectionId, NftMetadata, TokenId, LAND_CLASS_ID,
-};
+use primitives::{Attributes, AuctionId, ClassId, FungibleTokenId, GroupCollectionId, NftMetadata, TokenId};
use crate as estate;
@@ -144,7 +142,7 @@ parameter_types! {
pub struct MetaverseInfoSource {}
impl MetaverseTrait for MetaverseInfoSource {
- fn create_metaverse(who: &AccountId, metadata: MetaverseMetadata) -> MetaverseId {
+ fn create_metaverse(_who: &AccountId, _metadata: MetaverseMetadata) -> MetaverseId {
1u64
}
@@ -168,19 +166,19 @@ impl MetaverseTrait for MetaverseInfoSource {
Ok(())
}
- fn get_metaverse_land_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_land_class(_metaverse_id: MetaverseId) -> Result {
Ok(METAVERSE_LAND_CLASS)
}
- fn get_metaverse_estate_class(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_estate_class(_metaverse_id: MetaverseId) -> Result {
Ok(METAVERSE_ESTATE_CLASS)
}
- fn get_metaverse_marketplace_listing_fee(metaverse_id: MetaverseId) -> Result {
+ fn get_metaverse_marketplace_listing_fee(_metaverse_id: MetaverseId) -> Result {
Ok(Perbill::from_percent(1u32))
}
- fn get_metaverse_treasury(metaverse_id: MetaverseId) -> AccountId {
+ fn get_metaverse_treasury(_metaverse_id: MetaverseId) -> AccountId {
GENERAL_METAVERSE_FUND
}
@@ -189,7 +187,7 @@ impl MetaverseTrait for MetaverseInfoSource {
}
fn check_if_metaverse_estate(
- metaverse_id: primitives::MetaverseId,
+ _metaverse_id: primitives::MetaverseId,
class_id: &ClassId,
) -> Result {
if class_id == &METAVERSE_LAND_CLASS || class_id == &METAVERSE_ESTATE_CLASS {
@@ -202,7 +200,7 @@ impl MetaverseTrait for MetaverseInfoSource {
Ok(true)
}
- fn is_metaverse_owner(who: &AccountId) -> bool {
+ fn is_metaverse_owner(_who: &AccountId) -> bool {
true
}
}
@@ -216,7 +214,7 @@ impl Auction for MockAuctionManager {
None
}
- fn auction_item(id: AuctionId) -> Option> {
+ fn auction_item(_id: AuctionId) -> Option> {
None
}
@@ -224,7 +222,7 @@ impl Auction for MockAuctionManager {
Ok(())
}
- fn update_auction_item(id: AuctionId, item_id: ItemId) -> DispatchResult {
+ fn update_auction_item(_id: AuctionId, _item_id: ItemId) -> DispatchResult {
Ok(())
}
@@ -253,11 +251,11 @@ impl Auction for MockAuctionManager {
fn remove_auction(_id: u64, _item_id: ItemId) {}
- fn auction_bid_handler(from: AccountId, id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn auction_bid_handler(_from: AccountId, _id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
- fn buy_now_handler(from: AccountId, auction_id: AuctionId, value: Self::Balance) -> DispatchResult {
+ fn buy_now_handler(_from: AccountId, _auction_id: AuctionId, _value: Self::Balance) -> DispatchResult {
Ok(())
}
@@ -335,23 +333,23 @@ impl NFTTrait