From cb00bb792ec6c8cdb0570401aa6abf96d31b964d Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Thu, 6 Jul 2023 13:39:12 +0200 Subject: [PATCH 1/5] Add pm proxies --- primitives/src/proxy_type.rs | 5 +++++ runtime/common/src/lib.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/primitives/src/proxy_type.rs b/primitives/src/proxy_type.rs index a0ab36ab3..bdddb12aa 100644 --- a/primitives/src/proxy_type.rs +++ b/primitives/src/proxy_type.rs @@ -36,6 +36,11 @@ pub enum ProxyType { CancelProxy, Governance, Staking, + CreateMarket, + ReportOutcome, + ProvideLiquidity, + BuySellCompleteSets, + Trading, } impl Default for ProxyType { diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 73dfad19f..155d48c19 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -805,6 +805,34 @@ macro_rules! impl_config_traits { ProxyType::Staking => matches!(c, RuntimeCall::ParachainStaking(..)), #[cfg(not(feature = "parachain"))] ProxyType::Staking => false, + ProxyType::CreateMarket => + matches!(c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::create_market {..}) | + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::create_cpmm_market_and_deploy_assets {..}) + ), + ProxyType::ReportOutcome => + matches!(c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::report {..}) + ), + ProxyType::ProvideLiquidity => + matches!(c, + RuntimeCall::Swaps(zrml_swaps::Call::pool_join {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::pool_join_with_exact_asset_amount {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::pool_join_with_exact_pool_amount {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::pool_exit {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::pool_exit_with_exact_asset_amount {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::pool_exit_with_exact_pool_amount {..}) + ), + ProxyType::BuySellCompleteSets => + matches!(c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::buy_complete_set {..}) | + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::sell_complete_set {..}) + ), + ProxyType::Trading => + matches!(c, + RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_in {..}) | + RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_out {..}) + ), } } From b8eb5bed5a1b13d2dcea98759e9863fd26fb20ea Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Thu, 6 Jul 2023 13:46:02 +0200 Subject: [PATCH 2/5] fix copyrights --- primitives/src/proxy_type.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/primitives/src/proxy_type.rs b/primitives/src/proxy_type.rs index bdddb12aa..46c7ca003 100644 --- a/primitives/src/proxy_type.rs +++ b/primitives/src/proxy_type.rs @@ -1,3 +1,4 @@ +// Copyright 2022-2023 Forecasting Technologies LTD. // Copyright 2021-2022 Zeitgeist PM LLC. // // This file is part of Zeitgeist. From b80ae75c2da1bc7ce687cb5e2a5aa6d1aef2d37c Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Fri, 7 Jul 2023 13:25:37 +0200 Subject: [PATCH 3/5] address review comments --- primitives/src/proxy_type.rs | 4 +- runtime/common/src/lib.rs | 86 ++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/primitives/src/proxy_type.rs b/primitives/src/proxy_type.rs index 46c7ca003..7eadf4f32 100644 --- a/primitives/src/proxy_type.rs +++ b/primitives/src/proxy_type.rs @@ -37,11 +37,13 @@ pub enum ProxyType { CancelProxy, Governance, Staking, - CreateMarket, + CreateEditMarket, ReportOutcome, + Dispute, ProvideLiquidity, BuySellCompleteSets, Trading, + HandleAssets, } impl Default for ProxyType { diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 155d48c19..8653b484e 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -805,34 +805,64 @@ macro_rules! impl_config_traits { ProxyType::Staking => matches!(c, RuntimeCall::ParachainStaking(..)), #[cfg(not(feature = "parachain"))] ProxyType::Staking => false, - ProxyType::CreateMarket => - matches!(c, - RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::create_market {..}) | - RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::create_cpmm_market_and_deploy_assets {..}) - ), - ProxyType::ReportOutcome => - matches!(c, - RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::report {..}) - ), - ProxyType::ProvideLiquidity => - matches!(c, - RuntimeCall::Swaps(zrml_swaps::Call::pool_join {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::pool_join_with_exact_asset_amount {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::pool_join_with_exact_pool_amount {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::pool_exit {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::pool_exit_with_exact_asset_amount {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::pool_exit_with_exact_pool_amount {..}) - ), - ProxyType::BuySellCompleteSets => - matches!(c, - RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::buy_complete_set {..}) | - RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::sell_complete_set {..}) - ), - ProxyType::Trading => - matches!(c, - RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_in {..}) | - RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_out {..}) - ), + ProxyType::CreateEditMarket => matches!( + c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::create_market { .. }) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::edit_market { .. } + ) + ), + ProxyType::ReportOutcome => matches!( + c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::report { .. }) + ), + ProxyType::Dispute => matches!( + c, + RuntimeCall::PredictionMarkets(zrml_prediction_markets::Call::dispute { .. }) + ), + ProxyType::ProvideLiquidity => matches!( + c, + RuntimeCall::Swaps(zrml_swaps::Call::pool_join { .. }) + | RuntimeCall::Swaps(zrml_swaps::Call::pool_exit { .. }) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::deploy_swap_pool_for_market { .. } + ) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::deploy_swap_pool_and_additional_liquidity { .. } + ) + ), + ProxyType::BuySellCompleteSets => matches!( + c, + RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::buy_complete_set { .. } + ) | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::sell_complete_set { .. } + ) + ), + ProxyType::Trading => matches!( + c, + RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_in { .. }) + | RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_out { .. }) + ), + ProxyType::HandleAssets => matches!( + c, + RuntimeCall::Swaps(zrml_swaps::Call::pool_join { .. }) + | RuntimeCall::Swaps(zrml_swaps::Call::pool_exit { .. }) + | RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_in { .. }) + | RuntimeCall::Swaps(zrml_swaps::Call::swap_exact_amount_out { .. }) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::buy_complete_set { .. } + ) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::sell_complete_set { .. } + ) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::deploy_swap_pool_for_market { .. } + ) + | RuntimeCall::PredictionMarkets( + zrml_prediction_markets::Call::deploy_swap_pool_and_additional_liquidity { .. } + ) + ), } } From 827bcb18f26b486dd188ceba13ad9cebc97dee94 Mon Sep 17 00:00:00 2001 From: Chralt Date: Fri, 14 Jul 2023 08:56:52 +0200 Subject: [PATCH 4/5] Update primitives/src/proxy_type.rs Co-authored-by: Malte Kliemann --- primitives/src/proxy_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/src/proxy_type.rs b/primitives/src/proxy_type.rs index 7eadf4f32..36a77cc95 100644 --- a/primitives/src/proxy_type.rs +++ b/primitives/src/proxy_type.rs @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Forecasting Technologies LTD. +// Copyright 2023 Forecasting Technologies LTD. // Copyright 2021-2022 Zeitgeist PM LLC. // // This file is part of Zeitgeist. From 8ad96ca427a2859ec8b8b2163d5b193252725e78 Mon Sep 17 00:00:00 2001 From: Chralt Date: Fri, 14 Jul 2023 09:08:27 +0200 Subject: [PATCH 5/5] Update runtime/common/src/lib.rs --- runtime/common/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 8653b484e..33e09bb27 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -827,9 +827,6 @@ macro_rules! impl_config_traits { | RuntimeCall::PredictionMarkets( zrml_prediction_markets::Call::deploy_swap_pool_for_market { .. } ) - | RuntimeCall::PredictionMarkets( - zrml_prediction_markets::Call::deploy_swap_pool_and_additional_liquidity { .. } - ) ), ProxyType::BuySellCompleteSets => matches!( c,