Skip to content

Commit

Permalink
Scaffold combo pallet (#1367)
Browse files Browse the repository at this point in the history
* Scaffold combo pallet

* Fix dependencies/features
  • Loading branch information
maltekliemann authored Sep 24, 2024
1 parent d45ecf4 commit 2bd5e6c
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ default-members = [
"runtime/battery-station",
"runtime/zeitgeist",
"zrml/authorized",
"zrml/combo",
"zrml/court",
"zrml/hybrid-router",
"zrml/global-disputes",
Expand All @@ -36,6 +37,7 @@ members = [
"runtime/battery-station",
"runtime/zeitgeist",
"zrml/authorized",
"zrml/combo",
"zrml/court",
"zrml/hybrid-router",
"zrml/global-disputes",
Expand Down Expand Up @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ macro_rules! create_runtime {
Orderbook: zrml_orderbook::{Call, Event<T>, Pallet, Storage} = 61,
Parimutuel: zrml_parimutuel::{Call, Event<T>, Pallet, Storage} = 62,
HybridRouter: zrml_hybrid_router::{Call, Event<T>, Pallet, Storage} = 64,
Combo: zrml_combo::{Pallet, Storage} = 65,

$($additional_pallets)*
}
Expand Down Expand Up @@ -1168,6 +1169,8 @@ macro_rules! impl_config_traits {
type WeightInfo = zrml_authorized::weights::WeightInfo<Runtime>;
}

impl zrml_combo::Config for Runtime {}

impl zrml_court::Config for Runtime {
type AppealBond = AppealBond;
type BlocksPerYear = BlocksPerYear;
Expand Down
4 changes: 4 additions & 0 deletions runtime/zeitgeist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 30 additions & 0 deletions zrml/combo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-combo"
version = "0.5.5"
3 changes: 3 additions & 0 deletions zrml/combo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Combo Module

The Combo module implements combinatorial tokens in substrate.
50 changes: 50 additions & 0 deletions zrml/combo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

#![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<T>(PhantomData<T>);

// TODO Types
pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

// TODO Storage Items

// TODO `Event` enum

// TODO `Error` enum

// TODO Dispatchables
}

0 comments on commit 2bd5e6c

Please sign in to comment.