diff --git a/Cargo.lock b/Cargo.lock index 5328917c8..3c41b94ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ "xcm-emulator", "zeitgeist-primitives", "zrml-authorized", + "zrml-combo", "zrml-court", "zrml-global-disputes", "zrml-hybrid-router", @@ -15039,6 +15040,7 @@ dependencies = [ "xcm-emulator", "zeitgeist-primitives", "zrml-authorized", + "zrml-combo", "zrml-court", "zrml-global-disputes", "zrml-hybrid-router", @@ -15110,6 +15112,18 @@ dependencies = [ "zrml-market-commons", ] +[[package]] +name = "zrml-combo" +version = "0.5.5" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + [[package]] name = "zrml-court" version = "0.5.5" diff --git a/Cargo.toml b/Cargo.toml index d04e185ec..3985992ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ default-members = [ "runtime/battery-station", "runtime/zeitgeist", "zrml/authorized", + "zrml/combo", "zrml/court", "zrml/hybrid-router", "zrml/global-disputes", @@ -36,6 +37,7 @@ members = [ "runtime/battery-station", "runtime/zeitgeist", "zrml/authorized", + "zrml/combo", "zrml/court", "zrml/hybrid-router", "zrml/global-disputes", @@ -244,6 +246,7 @@ common-runtime = { path = "runtime/common", default-features = false } zeitgeist-macros = { path = "macros", default-features = false } zeitgeist-primitives = { path = "primitives", default-features = false } zrml-authorized = { path = "zrml/authorized", default-features = false } +zrml-combo = { path = "zrml/combo", default-features = false } zrml-court = { path = "zrml/court", default-features = false } zrml-global-disputes = { path = "zrml/global-disputes", default-features = false } zrml-hybrid-router = { path = "zrml/hybrid-router", default-features = false } diff --git a/runtime/battery-station/Cargo.toml b/runtime/battery-station/Cargo.toml index 3e1bf7035..035b69562 100644 --- a/runtime/battery-station/Cargo.toml +++ b/runtime/battery-station/Cargo.toml @@ -109,6 +109,7 @@ xcm-executor = { workspace = true, optional = true } common-runtime = { workspace = true } zeitgeist-primitives = { workspace = true } zrml-authorized = { workspace = true } +zrml-combo = { workspace = true } zrml-court = { workspace = true } zrml-global-disputes = { workspace = true, optional = true } zrml-hybrid-router = { workspace = true } @@ -214,6 +215,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder?/runtime-benchmarks", "zrml-authorized/runtime-benchmarks", + "zrml-combo/runtime-benchmarks", "zrml-court/runtime-benchmarks", "zrml-hybrid-router/runtime-benchmarks", "zrml-neo-swaps/runtime-benchmarks", @@ -327,6 +329,7 @@ std = [ "zeitgeist-primitives/std", "zrml-authorized/std", + "zrml-combo/std", "zrml-court/std", "zrml-hybrid-router/std", "zrml-market-commons/std", @@ -381,6 +384,7 @@ try-runtime = [ # Zeitgeist runtime pallets "zrml-authorized/try-runtime", + "zrml-combo/try-runtime", "zrml-court/try-runtime", "zrml-hybrid-router/try-runtime", "zrml-market-commons/try-runtime", diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 9b82785b6..083821a64 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -358,6 +358,7 @@ macro_rules! create_runtime { Orderbook: zrml_orderbook::{Call, Event, Pallet, Storage} = 61, Parimutuel: zrml_parimutuel::{Call, Event, Pallet, Storage} = 62, HybridRouter: zrml_hybrid_router::{Call, Event, Pallet, Storage} = 64, + Combo: zrml_combo::{Pallet, Storage} = 65, $($additional_pallets)* } @@ -1168,6 +1169,8 @@ macro_rules! impl_config_traits { type WeightInfo = zrml_authorized::weights::WeightInfo; } + impl zrml_combo::Config for Runtime {} + impl zrml_court::Config for Runtime { type AppealBond = AppealBond; type BlocksPerYear = BlocksPerYear; diff --git a/runtime/zeitgeist/Cargo.toml b/runtime/zeitgeist/Cargo.toml index a8a6ccc02..7d7aa5360 100644 --- a/runtime/zeitgeist/Cargo.toml +++ b/runtime/zeitgeist/Cargo.toml @@ -108,6 +108,7 @@ xcm-executor = { workspace = true, optional = true } common-runtime = { workspace = true } zeitgeist-primitives = { workspace = true } zrml-authorized = { workspace = true } +zrml-combo = { workspace = true } zrml-court = { workspace = true } zrml-global-disputes = { workspace = true, optional = true } zrml-hybrid-router = { workspace = true } @@ -211,6 +212,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder?/runtime-benchmarks", "zrml-authorized/runtime-benchmarks", + "zrml-combo/runtime-benchmarks", "zrml-court/runtime-benchmarks", "zrml-hybrid-router/runtime-benchmarks", "zrml-neo-swaps/runtime-benchmarks", @@ -316,6 +318,7 @@ std = [ "zeitgeist-primitives/std", "zrml-authorized/std", + "zrml-combo/std", "zrml-court/std", "zrml-hybrid-router/std", "zrml-market-commons/std", @@ -369,6 +372,7 @@ try-runtime = [ # Zeitgeist runtime pallets "zrml-authorized/try-runtime", + "zrml-combo/try-runtime", "zrml-court/try-runtime", "zrml-hybrid-router/try-runtime", "zrml-market-commons/try-runtime", diff --git a/zrml/combo/Cargo.toml b/zrml/combo/Cargo.toml new file mode 100644 index 000000000..5a182a122 --- /dev/null +++ b/zrml/combo/Cargo.toml @@ -0,0 +1,30 @@ +[dependencies] +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } +scale-info = { workspace = true, features = ["derive"] } +sp-runtime = { workspace = true } + +[features] +default = ["std"] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +std = [ + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", +] +try-runtime = [ + "frame-support/try-runtime", +] + +[package] +authors = ["Zeitgeist PM "] +edition.workspace = true +name = "zrml-combo" +version = "0.5.5" diff --git a/zrml/combo/README.md b/zrml/combo/README.md new file mode 100644 index 000000000..1e0c36716 --- /dev/null +++ b/zrml/combo/README.md @@ -0,0 +1,3 @@ +# Combo Module + +The Combo module implements combinatorial tokens in substrate. diff --git a/zrml/combo/src/lib.rs b/zrml/combo/src/lib.rs new file mode 100644 index 000000000..5ef80e751 --- /dev/null +++ b/zrml/combo/src/lib.rs @@ -0,0 +1,50 @@ +// Copyright 2024 Forecasting Technologies LTD. +// +// This file is part of Zeitgeist. +// +// Zeitgeist is free software: you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at +// your option) any later version. +// +// Zeitgeist is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Zeitgeist. If not, see . + +#![doc = include_str!("../README.md")] +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +// TODO Modules + +pub use pallet::*; + +#[frame_support::pallet] +mod pallet { + use core::marker::PhantomData; + use frame_support::pallet_prelude::StorageVersion; + + // TODO Config + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + pub struct Pallet(PhantomData); + + // TODO Types + pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + + // TODO Storage Items + + // TODO `Event` enum + + // TODO `Error` enum + + // TODO Dispatchables +}