Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prediction market and swaps proxies #1038

Merged
merged 5 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
maltekliemann marked this conversation as resolved.
Show resolved Hide resolved
Dispute,
ProvideLiquidity,
BuySellCompleteSets,
maltekliemann marked this conversation as resolved.
Show resolved Hide resolved
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
Loading