-
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.
Merge branch 'chralt98-remove-market-commons-currency' of github.com:…
…zeitgeistpm/zeitgeist into chralt98-remove-market-commons-currency
- Loading branch information
Showing
18 changed files
with
719 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
// Copyright 2023 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/>. | ||
|
||
/// Trait for distributing fees collected from trading to external recipients like the treasury. | ||
pub trait DistributeFees { | ||
type Asset; | ||
type AccountId; | ||
type Balance; | ||
type MarketId; | ||
|
||
/// Deduct and distribute the swap fees of the pool from the specified amount and returns the | ||
/// deducted fees. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// - `market_id`: The market on which the fees are taken. | ||
/// - `asset`: The asset the fee is paid in. | ||
/// - `account`: The account which pays the fees. | ||
/// - `amount`: The gross amount from which fees are deducted. | ||
/// | ||
/// Note that this function is infallible. If distribution is impossible or fails midway, it | ||
/// should return the balance of the already successfully deducted fees. | ||
fn distribute( | ||
market_id: Self::MarketId, | ||
asset: Self::Asset, | ||
account: Self::AccountId, | ||
amount: Self::Balance, | ||
) -> Self::Balance; | ||
} |
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,42 @@ | ||
[dependencies] | ||
frame-benchmarking = { workspace = true, optional = true } | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } | ||
scale-info = { workspace = true, features = ["derive"] } | ||
sp-runtime = { workspace = true } | ||
zeitgeist-primitives = { workspace = true } | ||
zrml-market-commons = { workspace = true } | ||
orml-traits = { workspace = true } | ||
|
||
[dev-dependencies] | ||
pallet-balances = { workspace = true, features = ["default"] } | ||
pallet-timestamp = { workspace = true, features = ["default"] } | ||
sp-io = { workspace = true, features = ["default"] } | ||
zeitgeist-primitives = { workspace = true, features = ["mock", "default"] } | ||
|
||
[features] | ||
default = ["std"] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
] | ||
std = [ | ||
"frame-benchmarking?/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"parity-scale-codec/std", | ||
"sp-runtime/std", | ||
"zeitgeist-primitives/std", | ||
"zrml-market-commons/std", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
] | ||
|
||
[package] | ||
authors = ["Zeitgeist PM <[email protected]>"] | ||
edition = "2021" | ||
name = "zrml-parimutuel" | ||
version = "0.3.11" |
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 @@ | ||
# Authorized Module |
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,56 @@ | ||
// Copyright 2022-2023 Forecasting Technologies LTD. | ||
// Copyright 2021-2022 Zeitgeist PM LLC. | ||
// | ||
// 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/>. | ||
|
||
#![allow( | ||
// Auto-generated code is a no man's land | ||
clippy::arithmetic_side_effects | ||
)] | ||
#![cfg(feature = "runtime-benchmarks")] | ||
|
||
use crate::{ | ||
market_mock, AuthorizedOutcomeReports, Call, Config, NegativeImbalanceOf, Pallet as Authorized, | ||
Pallet as Parimutuel, | ||
}; | ||
use frame_benchmarking::v2::*; | ||
use frame_support::{ | ||
dispatch::UnfilteredDispatchable, | ||
traits::{EnsureOrigin, Get, Imbalance}, | ||
}; | ||
use sp_runtime::traits::Saturating; | ||
use zeitgeist_primitives::{ | ||
traits::{DisputeApi, DisputeResolutionApi}, | ||
types::{AuthorityReport, OutcomeReport}, | ||
}; | ||
use zrml_market_commons::MarketCommonsPalletApi; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn buy() {} | ||
|
||
#[benchmark] | ||
fn claim_reward() {} | ||
|
||
impl_benchmark_test_suite!( | ||
Parimutuel, | ||
crate::mock::ExtBuilder::default().build(), | ||
crate::mock::Runtime | ||
); | ||
} |
Oops, something went wrong.