-
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 pull request #276 from zeitgeistpm/caio-c8
Integrate Court into the Runtime
- Loading branch information
Showing
16 changed files
with
461 additions
and
124 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,52 @@ | ||
#![allow( | ||
// Auto-generated code is a no man's land | ||
clippy::integer_arithmetic | ||
)] | ||
#![cfg(feature = "runtime-benchmarks")] | ||
|
||
#[cfg(test)] | ||
use crate::Pallet as Court; | ||
use crate::{BalanceOf, Call, Config, CurrencyOf, Pallet}; | ||
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; | ||
use frame_support::{dispatch::UnfilteredDispatchable, traits::Currency}; | ||
use frame_system::RawOrigin; | ||
use sp_runtime::traits::Bounded; | ||
use zeitgeist_primitives::types::OutcomeReport; | ||
|
||
fn deposit<T>(caller: &T::AccountId) | ||
where | ||
T: Config, | ||
{ | ||
let _ = CurrencyOf::<T>::deposit_creating(caller, BalanceOf::<T>::max_value()); | ||
} | ||
|
||
fn deposit_and_join_court<T>(caller: &T::AccountId) | ||
where | ||
T: Config, | ||
{ | ||
deposit::<T>(caller); | ||
Call::<T>::join_court() | ||
.dispatch_bypass_filter(RawOrigin::Signed(caller.clone()).into()) | ||
.unwrap(); | ||
} | ||
|
||
benchmarks! { | ||
exit_court { | ||
let caller: T::AccountId = whitelisted_caller(); | ||
deposit_and_join_court::<T>(&caller); | ||
}: _(RawOrigin::Signed(caller)) | ||
|
||
join_court { | ||
let caller: T::AccountId = whitelisted_caller(); | ||
deposit::<T>(&caller); | ||
}: _(RawOrigin::Signed(caller)) | ||
|
||
vote { | ||
let caller: T::AccountId = whitelisted_caller(); | ||
let market_id = Default::default(); | ||
let outcome = OutcomeReport::Scalar(u128::MAX); | ||
deposit_and_join_court::<T>(&caller); | ||
}: _(RawOrigin::Signed(caller), market_id, outcome) | ||
} | ||
|
||
impl_benchmark_test_suite!(Court, crate::mock::ExtBuilder::default().build(), crate::mock::Runtime); |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/// Court - Pallet Api | ||
pub trait CourtPalletApi {} | ||
use zeitgeist_primitives::traits::DisputeApi; | ||
|
||
pub trait CourtPalletApi: DisputeApi {} |
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
Oops, something went wrong.