mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Companion: Rename pallet trait Trait to Config (#2014)
* rename Trait -> Config * revert diener changes * rename HostConfig to ActiveConfig as more meaningful * fix merge * "Update Substrate" * cargo update -p sp-io Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
7df537fcdd
commit
2d4aa3a42e
@@ -37,13 +37,13 @@ use sp_runtime::{
|
||||
};
|
||||
use primitives::v1::ValidityError;
|
||||
|
||||
type CurrencyOf<T> = <<T as Trait>::VestingSchedule as VestingSchedule<<T as frame_system::Trait>::AccountId>>::Currency;
|
||||
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
type CurrencyOf<T> = <<T as Config>::VestingSchedule as VestingSchedule<<T as frame_system::Config>::AccountId>>::Currency;
|
||||
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
/// Configuration trait.
|
||||
pub trait Trait: frame_system::Trait {
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
type VestingSchedule: VestingSchedule<Self::AccountId, Moment=Self::BlockNumber>;
|
||||
type Prefix: Get<&'static [u8]>;
|
||||
type MoveClaimOrigin: EnsureOrigin<Self::Origin>;
|
||||
@@ -130,7 +130,7 @@ impl sp_std::fmt::Debug for EcdsaSignature {
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
Balance = BalanceOf<T>,
|
||||
AccountId = <T as frame_system::Trait>::AccountId
|
||||
AccountId = <T as frame_system::Config>::AccountId
|
||||
{
|
||||
/// Someone claimed some DOTs. [who, ethereum_address, amount]
|
||||
Claimed(AccountId, EthereumAddress, Balance),
|
||||
@@ -138,7 +138,7 @@ decl_event!(
|
||||
);
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Invalid Ethereum signature.
|
||||
InvalidEthereumSignature,
|
||||
/// Ethereum address has no claim.
|
||||
@@ -159,7 +159,7 @@ decl_storage! {
|
||||
// A macro for the Storage trait, and its implementation, for this module.
|
||||
// This allows for type-safe usage of the Substrate storage database, so you can
|
||||
// keep things around between blocks.
|
||||
trait Store for Module<T: Trait> as Claims {
|
||||
trait Store for Module<T: Config> as Claims {
|
||||
Claims get(fn claims) build(|config: &GenesisConfig<T>| {
|
||||
config.claims.iter().map(|(a, b, _, _)| (a.clone(), b.clone())).collect::<Vec<_>>()
|
||||
}): map hasher(identity) EthereumAddress => Option<BalanceOf<T>>;
|
||||
@@ -194,7 +194,7 @@ decl_storage! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// The Prefix that is used in signed Ethereum messages for this network
|
||||
@@ -426,7 +426,7 @@ fn to_ascii_hex(data: &[u8]) -> Vec<u8> {
|
||||
r
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
// Constructs the message that Ethereum RPC's `personal_sign` and `eth_sign` would sign.
|
||||
fn ethereum_signable_message(what: &[u8], extra: &[u8]) -> Vec<u8> {
|
||||
let prefix = T::Prefix::get();
|
||||
@@ -487,7 +487,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
|
||||
impl<T: Config> sp_runtime::traits::ValidateUnsigned for Module<T> {
|
||||
type Call = Call<T>;
|
||||
|
||||
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
|
||||
@@ -538,11 +538,11 @@ impl<T: Trait> sp_runtime::traits::ValidateUnsigned for Module<T> {
|
||||
/// Validate `attest` calls prior to execution. Needed to avoid a DoS attack since they are
|
||||
/// otherwise free to place on chain.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct PrevalidateAttests<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>) where
|
||||
<T as frame_system::Trait>::Call: IsSubType<Call<T>>;
|
||||
pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>) where
|
||||
<T as frame_system::Config>::Call: IsSubType<Call<T>>;
|
||||
|
||||
impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
|
||||
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
|
||||
impl<T: Config + Send + Sync> Debug for PrevalidateAttests<T> where
|
||||
<T as frame_system::Config>::Call: IsSubType<Call<T>>
|
||||
{
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
@@ -555,8 +555,8 @@ impl<T: Trait + Send + Sync> Debug for PrevalidateAttests<T> where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
|
||||
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
|
||||
impl<T: Config + Send + Sync> PrevalidateAttests<T> where
|
||||
<T as frame_system::Config>::Call: IsSubType<Call<T>>
|
||||
{
|
||||
/// Create new `SignedExtension` to check runtime version.
|
||||
pub fn new() -> Self {
|
||||
@@ -564,11 +564,11 @@ impl<T: Trait + Send + Sync> PrevalidateAttests<T> where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for PrevalidateAttests<T> where
|
||||
<T as frame_system::Trait>::Call: IsSubType<Call<T>>
|
||||
impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> where
|
||||
<T as frame_system::Config>::Call: IsSubType<Call<T>>
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as frame_system::Trait>::Call;
|
||||
type Call = <T as frame_system::Config>::Call;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "PrevalidateAttests";
|
||||
@@ -615,7 +615,7 @@ mod secp_utils {
|
||||
res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]);
|
||||
res
|
||||
}
|
||||
pub fn sig<T: Trait>(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
|
||||
pub fn sig<T: Config>(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature {
|
||||
let msg = keccak_256(&<super::Module<T>>::ethereum_signable_message(&to_ascii_hex(what)[..], extra));
|
||||
let (sig, recovery_id) = secp256k1::sign(&secp256k1::Message::parse(&msg), secret);
|
||||
let mut r = [0u8; 65];
|
||||
@@ -665,7 +665,7 @@ mod tests {
|
||||
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
@@ -697,7 +697,7 @@ mod tests {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = ();
|
||||
type DustRemoval = ();
|
||||
@@ -711,7 +711,7 @@ mod tests {
|
||||
pub const MinVestedTransfer: u64 = 0;
|
||||
}
|
||||
|
||||
impl pallet_vesting::Trait for Test {
|
||||
impl pallet_vesting::Config for Test {
|
||||
type Event = ();
|
||||
type Currency = Balances;
|
||||
type BlockNumberToBalance = Identity;
|
||||
@@ -726,7 +726,7 @@ mod tests {
|
||||
pub const Six: u64 = 6;
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type VestingSchedule = Vesting;
|
||||
type Prefix = Prefix;
|
||||
@@ -1048,7 +1048,7 @@ mod tests {
|
||||
fn claiming_while_vested_doesnt_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// A user is already vested
|
||||
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10));
|
||||
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10));
|
||||
CurrencyOf::<Test>::make_free_balance_be(&69, total_claims());
|
||||
assert_eq!(Balances::free_balance(69), total_claims());
|
||||
assert_ok!(Claims::mint_claim(Origin::root(), eth(&bob()), 200, Some((50, 10, 1)), None));
|
||||
@@ -1181,7 +1181,7 @@ mod benchmarking {
|
||||
const MAX_CLAIMS: u32 = 10_000;
|
||||
const VALUE: u32 = 1_000_000;
|
||||
|
||||
fn create_claim<T: Trait>(input: u32) -> DispatchResult {
|
||||
fn create_claim<T: Config>(input: u32) -> DispatchResult {
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
@@ -1189,7 +1189,7 @@ mod benchmarking {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_claim_attest<T: Trait>(input: u32) -> DispatchResult {
|
||||
fn create_claim_attest<T: Config>(input: u32) -> DispatchResult {
|
||||
let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap();
|
||||
let eth_address = eth(&secret_key);
|
||||
let vesting = Some((100_000u32.into(), 1_000u32.into(), 100u32.into()));
|
||||
|
||||
@@ -82,13 +82,13 @@ use sp_std::vec::Vec;
|
||||
use primitives::v1::{Id as ParaId, HeadData};
|
||||
|
||||
pub type BalanceOf<T> =
|
||||
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
<<T as slots::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
#[allow(dead_code)]
|
||||
pub type NegativeImbalanceOf<T> =
|
||||
<<T as slots::Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
<<T as slots::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
|
||||
|
||||
pub trait Trait: slots::Trait {
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
pub trait Config: slots::Config {
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// ModuleID for the crowdfund module. An appropriate value could be ```ModuleId(*b"py/cfund")```
|
||||
type ModuleId: Get<ModuleId>;
|
||||
@@ -164,7 +164,7 @@ pub struct FundInfo<AccountId, Balance, Hash, BlockNumber> {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Crowdfund {
|
||||
trait Store for Module<T: Config> as Crowdfund {
|
||||
/// Info on all of the funds.
|
||||
Funds get(fn funds):
|
||||
map hasher(twox_64_concat) FundIndex
|
||||
@@ -184,7 +184,7 @@ decl_storage! {
|
||||
|
||||
decl_event! {
|
||||
pub enum Event<T> where
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as frame_system::Config>::AccountId,
|
||||
Balance = BalanceOf<T>,
|
||||
{
|
||||
/// Create a new crowdfunding campaign. [fund_index]
|
||||
@@ -205,7 +205,7 @@ decl_event! {
|
||||
}
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Last slot must be greater than first slot.
|
||||
LastSlotBeforeFirstSlot,
|
||||
/// The last slot cannot be more then 3 slots after the first slot.
|
||||
@@ -251,7 +251,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
const ModuleId: ModuleId = T::ModuleId::get();
|
||||
@@ -528,7 +528,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
/// The account ID of the fund pot.
|
||||
///
|
||||
/// This actually does computation. If you need to keep using it, then make sure you cache the
|
||||
@@ -599,7 +599,7 @@ mod tests {
|
||||
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = ();
|
||||
@@ -629,7 +629,7 @@ mod tests {
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = ();
|
||||
type DustRemoval = ();
|
||||
@@ -667,7 +667,7 @@ mod tests {
|
||||
fn min_len() -> usize { 0 }
|
||||
fn max_len() -> usize { 0 }
|
||||
}
|
||||
impl pallet_treasury::Trait for Test {
|
||||
impl pallet_treasury::Config for Test {
|
||||
type Currency = pallet_balances::Module<Test>;
|
||||
type ApproveOrigin = frame_system::EnsureRoot<u64>;
|
||||
type RejectOrigin = frame_system::EnsureRoot<u64>;
|
||||
@@ -749,7 +749,7 @@ mod tests {
|
||||
pub const LeasePeriod: u64 = 10;
|
||||
pub const EndingPeriod: u64 = 3;
|
||||
}
|
||||
impl slots::Trait for Test {
|
||||
impl slots::Config for Test {
|
||||
type Event = ();
|
||||
type Currency = Balances;
|
||||
type Parachains = TestParachains;
|
||||
@@ -763,7 +763,7 @@ mod tests {
|
||||
pub const RetirementPeriod: u64 = 5;
|
||||
pub const CrowdfundModuleId: ModuleId = ModuleId(*b"py/cfund");
|
||||
}
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type SubmissionDeposit = SubmissionDeposit;
|
||||
type MinContribution = MinContribution;
|
||||
@@ -936,7 +936,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into()
|
||||
));
|
||||
@@ -947,7 +947,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
fund.deploy_data,
|
||||
Some(DeployData {
|
||||
code_hash: <Test as frame_system::Trait>::Hash::default(),
|
||||
code_hash: <Test as frame_system::Config>::Hash::default(),
|
||||
code_size: 0,
|
||||
initial_head_data: vec![0].into(),
|
||||
}),
|
||||
@@ -966,7 +966,7 @@ mod tests {
|
||||
assert_noop!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(2),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into()),
|
||||
Error::<Test>::InvalidOrigin
|
||||
@@ -976,7 +976,7 @@ mod tests {
|
||||
assert_noop!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
1,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into()),
|
||||
Error::<Test>::InvalidFundIndex
|
||||
@@ -986,7 +986,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -994,7 +994,7 @@ mod tests {
|
||||
assert_noop!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![1].into()),
|
||||
Error::<Test>::ExistingDeployData
|
||||
@@ -1014,7 +1014,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1060,7 +1060,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1088,7 +1088,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1131,7 +1131,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1273,7 +1273,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1302,7 +1302,7 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
@@ -1341,14 +1341,14 @@ mod tests {
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(1),
|
||||
0,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
assert_ok!(Crowdfund::fix_deploy_data(
|
||||
Origin::signed(2),
|
||||
1,
|
||||
<Test as frame_system::Trait>::Hash::default(),
|
||||
<Test as frame_system::Config>::Hash::default(),
|
||||
0,
|
||||
vec![0].into(),
|
||||
));
|
||||
|
||||
@@ -23,12 +23,12 @@ use crate::NegativeImbalance;
|
||||
pub struct ToAuthor<R>(sp_std::marker::PhantomData<R>);
|
||||
impl<R> OnUnbalanced<NegativeImbalance<R>> for ToAuthor<R>
|
||||
where
|
||||
R: pallet_balances::Trait + pallet_authorship::Trait,
|
||||
<R as frame_system::Trait>::AccountId: From<primitives::v1::AccountId>,
|
||||
<R as frame_system::Trait>::AccountId: Into<primitives::v1::AccountId>,
|
||||
<R as frame_system::Trait>::Event: From<pallet_balances::RawEvent<
|
||||
<R as frame_system::Trait>::AccountId,
|
||||
<R as pallet_balances::Trait>::Balance,
|
||||
R: pallet_balances::Config + pallet_authorship::Config,
|
||||
<R as frame_system::Config>::AccountId: From<primitives::v1::AccountId>,
|
||||
<R as frame_system::Config>::AccountId: Into<primitives::v1::AccountId>,
|
||||
<R as frame_system::Config>::Event: From<pallet_balances::RawEvent<
|
||||
<R as frame_system::Config>::AccountId,
|
||||
<R as pallet_balances::Config>::Balance,
|
||||
pallet_balances::DefaultInstance>
|
||||
>,
|
||||
{
|
||||
@@ -43,13 +43,13 @@ where
|
||||
pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>);
|
||||
impl<R> OnUnbalanced<NegativeImbalance<R>> for DealWithFees<R>
|
||||
where
|
||||
R: pallet_balances::Trait + pallet_treasury::Trait + pallet_authorship::Trait,
|
||||
R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config,
|
||||
pallet_treasury::Module<R>: OnUnbalanced<NegativeImbalance<R>>,
|
||||
<R as frame_system::Trait>::AccountId: From<primitives::v1::AccountId>,
|
||||
<R as frame_system::Trait>::AccountId: Into<primitives::v1::AccountId>,
|
||||
<R as frame_system::Trait>::Event: From<pallet_balances::RawEvent<
|
||||
<R as frame_system::Trait>::AccountId,
|
||||
<R as pallet_balances::Trait>::Balance,
|
||||
<R as frame_system::Config>::AccountId: From<primitives::v1::AccountId>,
|
||||
<R as frame_system::Config>::AccountId: Into<primitives::v1::AccountId>,
|
||||
<R as frame_system::Config>::Event: From<pallet_balances::RawEvent<
|
||||
<R as frame_system::Config>::AccountId,
|
||||
<R as pallet_balances::Config>::Balance,
|
||||
pallet_balances::DefaultInstance>
|
||||
>,
|
||||
{
|
||||
@@ -97,7 +97,7 @@ mod tests {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = ();
|
||||
type DustRemoval = ();
|
||||
@@ -151,7 +151,7 @@ mod tests {
|
||||
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
|
||||
}
|
||||
|
||||
impl pallet_treasury::Trait for Test {
|
||||
impl pallet_treasury::Config for Test {
|
||||
type Currency = pallet_balances::Module<Test>;
|
||||
type ApproveOrigin = frame_system::EnsureRoot<AccountId>;
|
||||
type RejectOrigin = frame_system::EnsureRoot<AccountId>;
|
||||
@@ -185,7 +185,7 @@ mod tests {
|
||||
Some(Default::default())
|
||||
}
|
||||
}
|
||||
impl pallet_authorship::Trait for Test {
|
||||
impl pallet_authorship::Config for Test {
|
||||
type FindAuthor = OneAuthor;
|
||||
type UncleGenerations = ();
|
||||
type FilterUncle = ();
|
||||
|
||||
@@ -47,7 +47,7 @@ pub use pallet_balances::Call as BalancesCall;
|
||||
/// Implementations of some helper traits passed into runtime modules as associated types.
|
||||
pub use impls::ToAuthor;
|
||||
|
||||
pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
|
||||
|
||||
/// The sequence of bytes a valid wasm module binary always starts with. Apart from that it's also a
|
||||
/// valid wasm module.
|
||||
@@ -106,7 +106,7 @@ impl<T> sp_runtime::BoundToRuntimeAppPublic for ParachainSessionKeyPlaceholder<T
|
||||
type Public = ValidatorId;
|
||||
}
|
||||
|
||||
impl<T: pallet_session::Trait>
|
||||
impl<T: pallet_session::Config>
|
||||
pallet_session::OneSessionHandler<T::AccountId> for ParachainSessionKeyPlaceholder<T>
|
||||
{
|
||||
type Key = ValidatorId;
|
||||
@@ -154,7 +154,7 @@ mod multiplier_tests {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Runtime {
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
|
||||
@@ -39,15 +39,15 @@ use runtime_parachains::{
|
||||
};
|
||||
|
||||
type BalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
pub trait Trait: paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait {
|
||||
pub trait Config: paras::Config + dmp::Config + ump::Config + hrmp::Config {
|
||||
/// The aggregated origin type must support the `parachains` origin. We require that we can
|
||||
/// infallibly convert between this origin and the system origin, but in reality, they're the
|
||||
/// same type, we just can't express that to the Rust type system without writing a `where`
|
||||
/// clause everywhere.
|
||||
type Origin: From<<Self as frame_system::Trait>::Origin>
|
||||
+ Into<result::Result<Origin, <Self as Trait>::Origin>>;
|
||||
type Origin: From<<Self as frame_system::Config>::Origin>
|
||||
+ Into<result::Result<Origin, <Self as Config>::Origin>>;
|
||||
|
||||
/// The system's currency for parathread payment.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
@@ -57,7 +57,7 @@ pub trait Trait: paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Registrar {
|
||||
trait Store for Module<T: Config> as Registrar {
|
||||
/// Whether parathreads are enabled or not.
|
||||
ParathreadsRegistrationEnabled: bool;
|
||||
|
||||
@@ -73,7 +73,7 @@ decl_storage! {
|
||||
}
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Parachain already exists.
|
||||
ParaAlreadyExists,
|
||||
/// Invalid parachain ID.
|
||||
@@ -92,7 +92,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// Register a parathread with given code for immediate use.
|
||||
@@ -117,7 +117,7 @@ decl_module! {
|
||||
|
||||
ensure!(outgoing.binary_search(&id).is_err(), Error::<T>::ParaAlreadyExists);
|
||||
|
||||
<T as Trait>::Currency::reserve(&who, T::ParathreadDeposit::get())?;
|
||||
<T as Config>::Currency::reserve(&who, T::ParathreadDeposit::get())?;
|
||||
<Debtors<T>>::insert(id, who);
|
||||
|
||||
Paras::insert(id, false);
|
||||
@@ -142,7 +142,7 @@ decl_module! {
|
||||
/// governance intervention).
|
||||
#[weight = 0]
|
||||
fn deregister_parathread(origin) -> DispatchResult {
|
||||
let id = ensure_parachain(<T as Trait>::Origin::from(origin))?;
|
||||
let id = ensure_parachain(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
ensure!(ParathreadsRegistrationEnabled::get(), Error::<T>::ParathreadsRegistrationDisabled);
|
||||
|
||||
@@ -151,7 +151,7 @@ decl_module! {
|
||||
ensure!(!is_parachain, Error::<T>::InvalidThreadId);
|
||||
|
||||
let debtor = <Debtors<T>>::take(id);
|
||||
let _ = <T as Trait>::Currency::unreserve(&debtor, T::ParathreadDeposit::get());
|
||||
let _ = <T as Config>::Currency::unreserve(&debtor, T::ParathreadDeposit::get());
|
||||
|
||||
runtime_parachains::schedule_para_cleanup::<T>(id);
|
||||
|
||||
@@ -187,7 +187,7 @@ decl_module! {
|
||||
/// and the auction deposit are switched.
|
||||
#[weight = 0]
|
||||
fn swap(origin, other: ParaId) {
|
||||
let id = ensure_parachain(<T as Trait>::Origin::from(origin))?;
|
||||
let id = ensure_parachain(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
if PendingSwap::get(other) == Some(id) {
|
||||
// Remove intention to swap.
|
||||
@@ -211,7 +211,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
/// Register a parachain with given code. Must be called by root.
|
||||
/// Fails if given ID is already used.
|
||||
pub fn register_parachain(
|
||||
@@ -306,7 +306,7 @@ mod tests {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
@@ -345,7 +345,7 @@ mod tests {
|
||||
pub const ExistentialDeposit: Balance = 1;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u128;
|
||||
type DustRemoval = ();
|
||||
type Event = ();
|
||||
@@ -371,7 +371,7 @@ mod tests {
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
}
|
||||
|
||||
impl pallet_session::Trait for Test {
|
||||
impl pallet_session::Config for Test {
|
||||
type SessionManager = ();
|
||||
type Keys = UintAuthorityId;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
@@ -395,7 +395,7 @@ mod tests {
|
||||
pub const StakingUnsignedPriority: u64 = u64::max_value() / 2;
|
||||
}
|
||||
|
||||
impl pallet_staking::Trait for Test {
|
||||
impl pallet_staking::Config for Test {
|
||||
type RewardRemainder = ();
|
||||
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
|
||||
type Event = ();
|
||||
@@ -420,24 +420,24 @@ mod tests {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Trait for Test {
|
||||
impl pallet_timestamp::Config for Test {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl dmp::Trait for Test {}
|
||||
impl dmp::Config for Test {}
|
||||
|
||||
impl ump::Trait for Test {
|
||||
impl ump::Config for Test {
|
||||
type UmpSink = ();
|
||||
}
|
||||
|
||||
impl hrmp::Trait for Test {
|
||||
impl hrmp::Config for Test {
|
||||
type Origin = Origin;
|
||||
}
|
||||
|
||||
impl pallet_session::historical::Trait for Test {
|
||||
impl pallet_session::historical::Config for Test {
|
||||
type FullIdentification = pallet_staking::Exposure<u64, Balance>;
|
||||
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
|
||||
}
|
||||
@@ -467,23 +467,23 @@ mod tests {
|
||||
pub type ReporterId = app::Public;
|
||||
}
|
||||
|
||||
impl paras::Trait for Test {
|
||||
impl paras::Config for Test {
|
||||
type Origin = Origin;
|
||||
}
|
||||
|
||||
impl configuration::Trait for Test { }
|
||||
impl configuration::Config for Test { }
|
||||
|
||||
impl inclusion::Trait for Test {
|
||||
impl inclusion::Config for Test {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl session_info::AuthorityDiscoveryTrait for Test {
|
||||
impl session_info::AuthorityDiscoveryConfig for Test {
|
||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl session_info::Trait for Test { }
|
||||
impl session_info::Config for Test { }
|
||||
|
||||
pub struct TestRandomness;
|
||||
|
||||
@@ -493,11 +493,11 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
impl initializer::Trait for Test {
|
||||
impl initializer::Config for Test {
|
||||
type Randomness = TestRandomness;
|
||||
}
|
||||
|
||||
impl scheduler::Trait for Test { }
|
||||
impl scheduler::Config for Test { }
|
||||
|
||||
type Extrinsic = TestXt<Call, ()>;
|
||||
|
||||
@@ -507,8 +507,8 @@ mod tests {
|
||||
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
|
||||
call: Call,
|
||||
_public: test_keys::ReporterId,
|
||||
_account: <Test as frame_system::Trait>::AccountId,
|
||||
nonce: <Test as frame_system::Trait>::Index,
|
||||
_account: <Test as frame_system::Config>::AccountId,
|
||||
nonce: <Test as frame_system::Config>::Index,
|
||||
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
|
||||
Some((call, (nonce, ())))
|
||||
}
|
||||
@@ -525,7 +525,7 @@ mod tests {
|
||||
pub const MaxRetries: u32 = 3;
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Origin = Origin;
|
||||
type Currency = pallet_balances::Module<Test>;
|
||||
type ParathreadDeposit = ParathreadDeposit;
|
||||
|
||||
@@ -30,13 +30,13 @@ use runtime_parachains::{
|
||||
use primitives::v1::Id as ParaId;
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Trait:
|
||||
configuration::Trait + paras::Trait + dmp::Trait + ump::Trait + hrmp::Trait
|
||||
pub trait Config:
|
||||
configuration::Config + paras::Config + dmp::Config + ump::Config + hrmp::Config
|
||||
{
|
||||
}
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// The specified parachain or parathread is not registered.
|
||||
ParaDoesntExist,
|
||||
/// A DMP message couldn't be sent because it exceeds the maximum size allowed for a downward
|
||||
@@ -49,7 +49,7 @@ decl_error! {
|
||||
|
||||
decl_module! {
|
||||
/// A sudo wrapper to call into v1 paras module.
|
||||
pub struct Module<T: Trait> for enum Call where origin: <T as frame_system::Trait>::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: <T as frame_system::Config>::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// Schedule a para to be initialized at the start of the next session.
|
||||
|
||||
@@ -28,9 +28,9 @@ use sp_core::sr25519;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Configuration trait.
|
||||
pub trait Trait: frame_system::Trait {
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
/// Balances Pallet
|
||||
type Currency: Currency<Self::AccountId>;
|
||||
/// Vesting Pallet
|
||||
@@ -47,7 +47,7 @@ pub trait Trait: frame_system::Trait {
|
||||
type MaxUnlocked: Get<BalanceOf<Self>>;
|
||||
}
|
||||
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
/// The kind of a statement an account needs to make for a claim to be valid.
|
||||
#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug)]
|
||||
@@ -103,9 +103,9 @@ pub struct AccountStatus<Balance> {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
AccountId = <T as frame_system::Trait>::AccountId,
|
||||
AccountId = <T as frame_system::Config>::AccountId,
|
||||
Balance = BalanceOf<T>,
|
||||
BlockNumber = <T as frame_system::Trait>::BlockNumber,
|
||||
BlockNumber = <T as frame_system::Config>::BlockNumber,
|
||||
{
|
||||
/// A [new] account was created.
|
||||
AccountCreated(AccountId),
|
||||
@@ -125,7 +125,7 @@ decl_event!(
|
||||
);
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Account is not currently valid to use.
|
||||
InvalidAccount,
|
||||
/// Account used in the purchase already exists.
|
||||
@@ -146,7 +146,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Purchase {
|
||||
trait Store for Module<T: Config> as Purchase {
|
||||
// A map of all participants in the DOT purchase process.
|
||||
Accounts: map hasher(blake2_128_concat) T::AccountId => AccountStatus<BalanceOf<T>>;
|
||||
// The account that will be used to payout participants of the DOT purchase process.
|
||||
@@ -159,7 +159,7 @@ decl_storage! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// The maximum statement length for the statement users to sign when creating an account.
|
||||
@@ -340,7 +340,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
fn verify_signature(who: &T::AccountId, signature: &[u8]) -> Result<(), DispatchError> {
|
||||
// sr25519 always expects a 64 byte signature.
|
||||
ensure!(signature.len() == 64, Error::<T>::InvalidSignature);
|
||||
@@ -374,7 +374,7 @@ fn account_to_bytes<AccountId>(account: &AccountId) -> Result<[u8; 32], Dispatch
|
||||
/// WARNING: Executing this function will clear all storage used by this pallet.
|
||||
/// Be sure this is what you want...
|
||||
pub fn remove_pallet<T>() -> frame_support::weights::Weight
|
||||
where T: frame_system::Trait
|
||||
where T: frame_system::Config
|
||||
{
|
||||
use frame_support::migration::remove_storage_prefix;
|
||||
remove_storage_prefix(b"Purchase", b"Accounts", b"");
|
||||
@@ -428,7 +428,7 @@ mod tests {
|
||||
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
@@ -460,7 +460,7 @@ mod tests {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = ();
|
||||
type DustRemoval = ();
|
||||
@@ -474,7 +474,7 @@ mod tests {
|
||||
pub const MinVestedTransfer: u64 = 0;
|
||||
}
|
||||
|
||||
impl pallet_vesting::Trait for Test {
|
||||
impl pallet_vesting::Config for Test {
|
||||
type Event = ();
|
||||
type Currency = Balances;
|
||||
type BlockNumberToBalance = Identity;
|
||||
@@ -494,7 +494,7 @@ mod tests {
|
||||
pub const ConfigurationOrigin: AccountId = AccountId32::from([2u8; 32]);
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type Currency = Balances;
|
||||
type VestingSchedule = Vesting;
|
||||
@@ -692,7 +692,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Account with vesting
|
||||
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(
|
||||
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(
|
||||
&alice(),
|
||||
100,
|
||||
1,
|
||||
@@ -933,13 +933,13 @@ mod tests {
|
||||
bob(),
|
||||
));
|
||||
// Payment is made.
|
||||
assert_eq!(<Test as Trait>::Currency::free_balance(&payment_account()), 99_650);
|
||||
assert_eq!(<Test as Trait>::Currency::free_balance(&alice()), 100);
|
||||
assert_eq!(<Test as Config>::Currency::free_balance(&payment_account()), 99_650);
|
||||
assert_eq!(<Test as Config>::Currency::free_balance(&alice()), 100);
|
||||
// 10% of the 50 units is unlocked automatically for Alice
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), Some(45));
|
||||
assert_eq!(<Test as Trait>::Currency::free_balance(&bob()), 250);
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45));
|
||||
assert_eq!(<Test as Config>::Currency::free_balance(&bob()), 250);
|
||||
// A max of 10 units is unlocked automatically for Bob
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), Some(140));
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), Some(140));
|
||||
// Status is completed.
|
||||
assert_eq!(
|
||||
Accounts::<Test>::get(alice()),
|
||||
@@ -966,13 +966,13 @@ mod tests {
|
||||
let vest_call = Call::Vesting(pallet_vesting::Call::<Test>::vest());
|
||||
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
|
||||
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), Some(45));
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), Some(140));
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45));
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), Some(140));
|
||||
System::set_block_number(101);
|
||||
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
|
||||
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&alice()), None);
|
||||
assert_eq!(<Test as Trait>::VestingSchedule::vesting_balance(&bob()), None);
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), None);
|
||||
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&bob()), None);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ mod tests {
|
||||
alice(),
|
||||
), BadOrigin);
|
||||
// Account with Existing Vesting Schedule
|
||||
assert_ok!(<Test as Trait>::VestingSchedule::add_vesting_schedule(
|
||||
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(
|
||||
&bob(), 100, 1, 50,
|
||||
));
|
||||
assert_noop!(Purchase::payout(
|
||||
|
||||
@@ -34,12 +34,12 @@ use primitives::v1::{
|
||||
use frame_system::{ensure_signed, ensure_root};
|
||||
use crate::slot_range::{SlotRange, SLOT_RANGE_COUNT};
|
||||
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
type BalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Trait: frame_system::Trait {
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// The currency type used for bidding.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
@@ -161,18 +161,18 @@ pub enum IncomingParachain<AccountId, Hash> {
|
||||
Deploy { code: ValidationCode, initial_head_data: HeadData },
|
||||
}
|
||||
|
||||
type LeasePeriodOf<T> = <T as frame_system::Trait>::BlockNumber;
|
||||
type LeasePeriodOf<T> = <T as frame_system::Config>::BlockNumber;
|
||||
// Winning data type. This encodes the top bidders of each range together with their bid.
|
||||
type WinningData<T> =
|
||||
[Option<(Bidder<<T as frame_system::Trait>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
|
||||
[Option<(Bidder<<T as frame_system::Config>::AccountId>, BalanceOf<T>)>; SLOT_RANGE_COUNT];
|
||||
// Winners data type. This encodes each of the final winners of a parachain auction, the parachain
|
||||
// index assigned to them, their winning bid and the range that they won.
|
||||
type WinnersData<T> =
|
||||
Vec<(Option<NewBidder<<T as frame_system::Trait>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
|
||||
Vec<(Option<NewBidder<<T as frame_system::Config>::AccountId>>, ParaId, BalanceOf<T>, SlotRange)>;
|
||||
|
||||
// This module's storage items.
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as Slots {
|
||||
trait Store for Module<T: Config> as Slots {
|
||||
/// The number of auctions that have been started so far.
|
||||
pub AuctionCounter get(fn auction_counter): AuctionIndex;
|
||||
|
||||
@@ -245,7 +245,7 @@ fn swap_ordered_existence<T: PartialOrd + Ord + Copy>(ids: &mut [T], one: T, oth
|
||||
ids.sort();
|
||||
}
|
||||
|
||||
impl<T: Trait> SwapAux for Module<T> {
|
||||
impl<T: Config> SwapAux for Module<T> {
|
||||
fn ensure_can_swap(one: ParaId, other: ParaId) -> Result<(), &'static str> {
|
||||
if <Onboarding<T>>::contains_key(one) || <Onboarding<T>>::contains_key(other) {
|
||||
Err("can't swap an undeployed parachain")?
|
||||
@@ -262,8 +262,8 @@ impl<T: Trait> SwapAux for Module<T> {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
AccountId = <T as frame_system::Trait>::AccountId,
|
||||
BlockNumber = <T as frame_system::Trait>::BlockNumber,
|
||||
AccountId = <T as frame_system::Config>::AccountId,
|
||||
BlockNumber = <T as frame_system::Config>::BlockNumber,
|
||||
LeasePeriod = LeasePeriodOf<T>,
|
||||
ParaId = ParaId,
|
||||
Balance = BalanceOf<T>,
|
||||
@@ -292,7 +292,7 @@ decl_event!(
|
||||
);
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// This auction is already in progress.
|
||||
AuctionInProgress,
|
||||
/// The lease period is in the past.
|
||||
@@ -323,7 +323,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
fn deposit_event() = default;
|
||||
@@ -520,7 +520,7 @@ decl_module! {
|
||||
.ok_or(Error::<T>::ParaNotOnboarding)?;
|
||||
if let IncomingParachain::Fixed{code_hash, code_size, initial_head_data} = details {
|
||||
ensure!(code.0.len() as u32 == code_size, Error::<T>::InvalidCode);
|
||||
ensure!(<T as frame_system::Trait>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
|
||||
ensure!(<T as frame_system::Config>::Hashing::hash(&code.0) == code_hash, Error::<T>::InvalidCode);
|
||||
|
||||
if starts > Self::lease_period_index() {
|
||||
// Hasn't yet begun. Replace the on-boarding entry with the new information.
|
||||
@@ -542,7 +542,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
/// Deposit currently held for a particular parachain that we administer.
|
||||
fn deposit_held(para_id: &ParaId) -> BalanceOf<T> {
|
||||
<Deposits<T>>::get(para_id).into_iter().max().unwrap_or_else(Zero::zero)
|
||||
@@ -968,7 +968,7 @@ mod tests {
|
||||
pub const MaximumBlockLength: u32 = 4 * 1024 * 1024;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = ();
|
||||
@@ -1000,7 +1000,7 @@ mod tests {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = ();
|
||||
type DustRemoval = ();
|
||||
@@ -1074,7 +1074,7 @@ mod tests {
|
||||
pub const EndingPeriod: BlockNumber = 3;
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type Currency = Balances;
|
||||
type Parachains = TestParachains;
|
||||
|
||||
Reference in New Issue
Block a user