Skip to content

Commit

Permalink
Integrate Court into the Runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Aug 25, 2021
1 parent ae87e1f commit d3aef9f
Show file tree
Hide file tree
Showing 18 changed files with 385 additions and 121 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

7 changes: 6 additions & 1 deletion primitives/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ parameter_types! {

// Liquidity Mining parameters
parameter_types! {
pub const LiquidityMiningPalletId: PalletId = PalletId(*b"zrml/lmg");
pub const LiquidityMiningPalletId: PalletId = PalletId(*b"zge/ltmg");
}

// Prediction Market parameters
Expand Down Expand Up @@ -75,3 +75,8 @@ parameter_types! {
pub const MinWeight: Balance = BASE;
pub const SwapsPalletId: PalletId = PalletId(*b"zge/swap");
}

// Treasury
parameter_types! {
pub const TreasuryPalletId: PalletId = PalletId(*b"zge/trsy");
}
16 changes: 16 additions & 0 deletions primitives/src/market.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ pub struct Market<AccountId, BlockNumber> {
pub report: Option<Report<AccountId, BlockNumber>>,
// The resolved outcome.
pub resolved_outcome: Option<OutcomeReport>,
// See [`MarketDisputeMechanism`].
pub mdm: MarketDisputeMechanism<AccountId>,
}

impl<AccountId, B> Market<AccountId, B> {
Expand Down Expand Up @@ -69,6 +71,20 @@ pub struct MarketDispute<AccountId, BlockNumber> {
pub outcome: OutcomeReport,
}

/// How a market should resolve disputes
#[derive(
Clone,
PartialEq,
parity_scale_codec::Decode,
parity_scale_codec::Encode,
sp_runtime::RuntimeDebug,
)]
pub enum MarketDisputeMechanism<AI> {
Authorized(AI),
SimpleDisputes,
Court,
}

/// Defines whether the end is represented as a blocknumber or a timestamp.
#[derive(
Clone,
Expand Down
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sp-finality-grandpa = { branch = "polkadot-v0.9.8", default-features = false, gi
# Zeitgeist

zeitgeist-primitives = { default-features = false, path = "../primitives" }
zrml-court = { default-features = false, path = "../zrml/court" }
zrml-liquidity-mining = { default-features = false, path = "../zrml/liquidity-mining" }
zrml-market-commons = { default-features = false, path = "../zrml/market-commons" }
zrml-orderbook-v1 = { default-features = false, path = "../zrml/orderbook-v1" }
Expand Down Expand Up @@ -199,6 +200,7 @@ std = [
# Zeitgeist

"zeitgeist-primitives/std",
"zrml-court/std",
"zrml-liquidity-mining/std",
"zrml-market-commons/std",
"zrml-orderbook-v1/std",
Expand Down
21 changes: 16 additions & 5 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ macro_rules! create_zeitgeist_runtime {
Orderbook: zrml_orderbook_v1::{Call, Event<T>, Pallet, Storage} = 41,

MarketCommons: zrml_market_commons::{Pallet, Storage} = 42,
Swaps: zrml_swaps::{Call, Event<T>, Pallet, Storage} = 43,
SimpleDisputes: zrml_simple_disputes::{Event<T>, Pallet, Storage} = 44,
PredictionMarkets: zrml_prediction_markets::{Call, Event<T>, Pallet, Storage} = 45,
Court: zrml_court::{Event<T>, Pallet, Storage} = 43,
Swaps: zrml_swaps::{Call, Event<T>, Pallet, Storage} = 44,
SimpleDisputes: zrml_simple_disputes::{Event<T>, Pallet, Storage} = 45,
PredictionMarkets: zrml_prediction_markets::{Call, Event<T>, Pallet, Storage} = 46,

$($additional_pallets)*
}
Expand Down Expand Up @@ -374,7 +375,7 @@ impl orml_tokens::Config for Runtime {
type Event = Event;
type ExistentialDeposits = ExistentialDeposits;
type MaxLocks = MaxLocks;
type OnDust = ();
type OnDust = orml_tokens::TransferDust<Runtime, DustAccount>;
type WeightInfo = ();
}

Expand Down Expand Up @@ -423,6 +424,15 @@ impl pallet_utility::Config for Runtime {
#[cfg(feature = "parachain")]
impl parachain_info::Config for Runtime {}

impl zrml_court::Config for Runtime {
type CourtCaseDuration = CourtCaseDuration;
type Event = Event;
type MarketCommons = MarketCommons;
type Random = RandomnessCollectiveFlip;
type StakeWeight = StakeWeight;
type TreasuryPalletId = TreasuryPalletId;
}

impl zrml_liquidity_mining::Config for Runtime {
type Currency = Balances;
type Event = Event;
Expand All @@ -447,12 +457,13 @@ impl zrml_orderbook_v1::Config for Runtime {
impl zrml_prediction_markets::Config for Runtime {
type AdvisoryBond = AdvisoryBond;
type ApprovalOrigin = EnsureRoot<AccountId>;
type Court = Court;
type DisputeBond = DisputeBond;
type DisputeFactor = DisputeFactor;
type DisputePeriod = DisputePeriod;
type Event = Event;
type MarketCommons = MarketCommons;
type LiquidityMining = LiquidityMining;
type MarketCommons = MarketCommons;
type MaxCategories = MaxCategories;
type MaxDisputes = MaxDisputes;
type MinCategories = MinCategories;
Expand Down
5 changes: 3 additions & 2 deletions zrml/court/src/court_pallet_api.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/// Court - Pallet Api
pub trait CourtPalletApi {}
use zeitgeist_primitives::traits::DisputeApi;

pub trait CourtPalletApi: DisputeApi {}
Loading

0 comments on commit d3aef9f

Please sign in to comment.