1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pub use pallet::*;

pub mod benchmarking;
#[cfg(test)]
mod mock;

#[frame_support::pallet]
pub mod pallet {
	use frame_benchmarking::BenchmarkError;
	use frame_support::{dispatch::Dispatchable, pallet_prelude::Encode, weights::GetDispatchInfo};
	use xcm::latest::{MultiAssets, MultiLocation, Response};

	#[pallet::config]
	pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
		type Call: Dispatchable<Origin = Self::Origin>
			+ GetDispatchInfo
			+ From<frame_system::Call<Self>>
			+ Encode;

		///	The response which causes the most runtime weight.
		fn worst_case_response() -> (u64, Response);

		/// The `MultiLocation` used for successful transaction XCMs.
		///
		/// If set to `None`, benchmarks which rely on a `transact_origin` will be skipped.
		fn transact_origin() -> Result<MultiLocation, BenchmarkError>;

		/// A valid `MultiLocation` we can successfully subscribe to.
		///
		/// If set to `None`, benchmarks which rely on a `subscribe_origin` will be skipped.
		fn subscribe_origin() -> Result<MultiLocation, BenchmarkError>;

		/// Return an origin, ticket, and assets that can be trapped and claimed.
		fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError>;
	}

	#[pallet::pallet]
	pub struct Pallet<T, I = ()>(_);
}