Skip to content

Commit

Permalink
Add prediction market and swaps proxies (#1038)
Browse files Browse the repository at this point in the history
* Add pm proxies

* fix copyrights

* address review comments

* Update primitives/src/proxy_type.rs

Co-authored-by: Malte Kliemann <mail@maltekliemann.com>

* Update runtime/common/src/lib.rs

---------

Co-authored-by: Malte Kliemann <mail@maltekliemann.com>
  • Loading branch information
Chralt98 and maltekliemann authored Jul 17, 2023
1 parent be494e4 commit 257932c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
8 changes: 8 additions & 0 deletions primitives/src/proxy_type.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2023 Forecasting Technologies LTD.
// Copyright 2021-2022 Zeitgeist PM LLC.
//
// This file is part of Zeitgeist.
Expand Down Expand Up @@ -36,6 +37,13 @@ pub enum ProxyType {
CancelProxy,
Governance,
Staking,
CreateEditMarket,
ReportOutcome,
Dispute,
ProvideLiquidity,
BuySellCompleteSets,
Trading,
HandleAssets,
}

impl Default for ProxyType {
Expand Down
55 changes: 55 additions & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,61 @@ macro_rules! impl_config_traits {
ProxyType::Staking => matches!(c, RuntimeCall::ParachainStaking(..)),
#[cfg(not(feature = "parachain"))]
ProxyType::Staking => false,
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 { .. }
)
),
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 { .. }
)
),
}
}

Expand Down

0 comments on commit 257932c

Please sign in to comment.