-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add market ID to `Market` struct (#1248) * Add market ID to `Market` struct * Add market builder struct * Use `PredictionMarketBuilder` * Fix issues * Fix copyright * Make `build` return a `Result` * Let `build` raise an error on incomplete data. * Fix formatting * Refactor `MarketBuilder` * Add missing files * AMM-CDA-1: Switch to AmmCdaHybrid enum field (#1274) * switch to AmmCdaHybrid enum field * Update zrml/parimutuel/src/tests/buy.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/parimutuel/src/tests/claim.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/parimutuel/src/tests/refund.rs Co-authored-by: Malte Kliemann <[email protected]> * Update storage version to 11 and add MigrateScoringRuleAmmCdaHybrid * Update primitives/src/market.rs * update migration --------- Co-authored-by: Malte Kliemann <[email protected]> * merge amm-cda-3 changes * merge amm-cda-2 changes * merge amm-cda-4 changes * correct clippy * merge amm-cda-5 changes * merge amm-cda-6 changes * Fix Hybrid Router clippy and tests (#1291) * glue everything together * add hybrid router to configuration * fix tests * fix conditional tests * AMM-CDA-8 Add event information for fees and aggregated amount_out (#1293) * add event info * use slice as function parameter * update test amm amount out of event * fix order book tests * update documentation * removed dependency * Merge `main` into `mkl-market-id-feature` (#1302) * Merge `main` into `mkl-mkl-market-id-feature` * Remove unused `outcomes` * Remove old migrations (#1301) * AMM-CDA-9 Adds soft and hard failure distinction for AMM and order book errors (#1294) * add event info * use slice as function parameter * update test amm amount out of event * wip * handle soft and hard failure * add order book soft failure * fix clippy * fix CI * remove swaps pallet dependency * add compact to order book struct * fix recursion overflow * Migration: Add Market ID to Market (#1257) * Add market ID to `Market` struct * Add market builder struct * Use `PredictionMarketBuilder` * Fix issues * Fix copyright * Make `build` return a `Result` * Let `build` raise an error on incomplete data. * Fix formatting * Refactor `MarketBuilder` * Add missing files * Add migration to new market * Fix migration * Fix missing import * Fix duplicate import * Fix formatting * Remove unused `types/` * Fix of Hybrid Router after asset system merge (#1309) * wip * use asset conversions * adapt hybrid router to new asset system * apply review suggestions * fmt * rename Asset to Assets * update copyrights * Make minor fixes after merge * update hybrid router crate version * correct orderbook spelling * add amount is zero tests * add price limit too high test * add max order exceeded test * use saturated conversion * use saturated conversion again * remove unused code * Update changelog * add tests for soft failures * add skip order test * add changelog for devs description * add amm soft failure test * add numerical soft failure test for sell * Remove ZeitgeistAssetManager trait * correct failing test for parachain feature * cover remaining is zero execution path * Fix try-runtime test --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]>
- Loading branch information
1 parent
32eedc9
commit bcb1421
Showing
41 changed files
with
771 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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/>. | ||
|
||
use crate::types::{ | ||
Deadlines, EarlyClose, Market, MarketBonds, MarketCreation, MarketDisputeMechanism, | ||
MarketPeriod, MarketStatus, MarketType, OutcomeReport, Report, ScoringRule, | ||
}; | ||
use alloc::vec::Vec; | ||
use sp_runtime::{DispatchError, Perbill}; | ||
|
||
macro_rules! builder_methods { | ||
($($field:ident: $type:ty),* $(,)?) => { | ||
$(fn $field(&mut self, $field: $type) -> &mut Self;)* | ||
} | ||
} | ||
|
||
/// Mutably referenced builder struct for the `Market` object. The `build` call is pass-by-value, so | ||
/// the usual calling pattern is: | ||
/// | ||
/// ```ignore | ||
/// let builder = MarketBuilderImpl::new(); | ||
/// builder.field1(value1).field2(value2); | ||
/// builder.clone().build() | ||
/// ``` | ||
pub trait MarketBuilderTrait<AI, BA, BN, M, A, MI> { | ||
fn build(self) -> Result<Market<AI, BA, BN, M, A, MI>, DispatchError>; | ||
|
||
builder_methods! { | ||
market_id: MI, | ||
base_asset: A, | ||
creator: AI, | ||
creation: MarketCreation, | ||
creator_fee: Perbill, | ||
oracle: AI, | ||
metadata: Vec<u8>, | ||
market_type: MarketType, | ||
period: MarketPeriod<BN, M>, | ||
deadlines: Deadlines<BN>, | ||
scoring_rule: ScoringRule, | ||
status: MarketStatus, | ||
report: Option<Report<AI, BN>>, | ||
resolved_outcome: Option<OutcomeReport>, | ||
dispute_mechanism: Option<MarketDisputeMechanism>, | ||
bonds: MarketBonds<AI, BA>, | ||
early_close: Option<EarlyClose<BN, M>>, | ||
} | ||
} |
Oops, something went wrong.