ghost-node/runtime/common/src/benchmarking.rs

27 lines
984 B
Rust
Raw Normal View History

use primitives::{AccountId, Balance};
use pallet_treasury::ArgumentsFactory;
use sp_core::crypto::FromEntropy;
use frame_support::traits::tokens::{Pay, PaymentStatus};
pub struct BenchmarkTreasuryHelper;
impl ArgumentsFactory<(), AccountId> for BenchmarkTreasuryHelper {
fn create_asset_kind(_seed: u32) -> () { () }
fn create_beneficiary(seed: [u8; 32]) -> AccountId {
AccountId::from_entropy(&mut seed.as_slice()).unwrap()
}
}
pub struct BenchmarkTreasuryPaymaster;
impl Pay for BenchmarkTreasuryPaymaster {
type Beneficiary = AccountId;
type Balance = Balance;
type Id = ();
type AssetKind = ();
type Error = ();
fn pay(_: &Self::Beneficiary, _: Self::AssetKind, _: Self::Balance) -> Result<Self::Id, Self::Error> { Ok(()) }
fn check_payment(_: Self::Id) -> PaymentStatus { PaymentStatus::Success }
fn ensure_successful(_: &Self::Beneficiary, _: Self::AssetKind, _: Self::Balance) {}
fn ensure_concluded(_: Self::Id) {}
}