mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
* add module ids to kusama runtime * update kusam with polkadot runtimes to have moduleids configured * trivial * define module id for treasury in crowdfund.rs * crodfund builds without issue * remove commented out code * switch crowdfund to configurable moduleid * test-runtime passing * trivial syntax * add module id to mock * Update `Cargo.lock` Co-authored-by: zeke <emostov@middlebury.edu>
This commit is contained in:
Generated
+126
-126
File diff suppressed because it is too large
Load Diff
@@ -82,8 +82,6 @@ use codec::{Encode, Decode};
|
||||
use sp_std::vec::Vec;
|
||||
use primitives::parachain::{Id as ParaId, HeadData};
|
||||
|
||||
const MODULE_ID: ModuleId = ModuleId(*b"py/cfund");
|
||||
|
||||
pub type BalanceOf<T> =
|
||||
<<T as slots::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
#[allow(dead_code)]
|
||||
@@ -93,6 +91,9 @@ pub type NegativeImbalanceOf<T> =
|
||||
pub trait Trait: slots::Trait {
|
||||
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
|
||||
|
||||
/// ModuleID for the crowdfund module. An appropriate value could be ```ModuleId(*b"py/cfund")```
|
||||
type ModuleId: Get<ModuleId>;
|
||||
|
||||
/// The amount to be held on deposit by the owner of a crowdfund.
|
||||
type SubmissionDeposit: Get<BalanceOf<Self>>;
|
||||
|
||||
@@ -247,6 +248,8 @@ decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
const ModuleId: ModuleId = T::ModuleId::get();
|
||||
|
||||
fn deposit_event() = default;
|
||||
|
||||
/// Create a new crowdfunding campaign for a parachain slot deposit for the current auction.
|
||||
@@ -525,7 +528,7 @@ impl<T: Trait> Module<T> {
|
||||
/// This actually does computation. If you need to keep using it, then make sure you cache the
|
||||
/// value and only call this once.
|
||||
pub fn fund_account_id(index: FundIndex) -> T::AccountId {
|
||||
MODULE_ID.into_sub_account(index)
|
||||
T::ModuleId::get().into_sub_account(index)
|
||||
}
|
||||
|
||||
pub fn id_from_index(index: FundIndex) -> child::ChildInfo {
|
||||
@@ -632,6 +635,7 @@ mod tests {
|
||||
pub const TipFindersFee: Percent = Percent::from_percent(20);
|
||||
pub const TipReportDepositBase: u64 = 1;
|
||||
pub const TipReportDepositPerByte: u64 = 1;
|
||||
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
|
||||
}
|
||||
pub struct Nobody;
|
||||
impl Contains<u64> for Nobody {
|
||||
@@ -655,6 +659,7 @@ mod tests {
|
||||
type TipFindersFee = TipFindersFee;
|
||||
type TipReportDepositBase = TipReportDepositBase;
|
||||
type TipReportDepositPerByte = TipReportDepositPerByte;
|
||||
type ModuleId = TreasuryModuleId;
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
@@ -729,6 +734,7 @@ mod tests {
|
||||
pub const SubmissionDeposit: u64 = 1;
|
||||
pub const MinContribution: u64 = 10;
|
||||
pub const RetirementPeriod: u64 = 5;
|
||||
pub const CrowdfundModuleId: ModuleId = ModuleId(*b"py/cfund");
|
||||
}
|
||||
impl Trait for Test {
|
||||
type Event = ();
|
||||
@@ -736,6 +742,7 @@ mod tests {
|
||||
type MinContribution = MinContribution;
|
||||
type RetirementPeriod = RetirementPeriod;
|
||||
type OrphanedFunds = Treasury;
|
||||
type ModuleId = CrowdfundModuleId;
|
||||
}
|
||||
|
||||
type System = system::Module<Test>;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The Polkadot runtime. This can be compiled with `#[no_std]`, ready for Wasm.
|
||||
|
||||
@@ -33,7 +33,7 @@ use runtime_common::{attestations, claims, parachains, registrar, slots,
|
||||
MaximumBlockLength,
|
||||
};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
create_runtime_str, generic, impl_opaque_keys, ModuleId,
|
||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, Perquintill, RuntimeDebug,
|
||||
transaction_validity::{
|
||||
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource, TransactionPriority,
|
||||
@@ -54,7 +54,7 @@ use sp_core::OpaqueMetadata;
|
||||
use sp_staking::SessionIndex;
|
||||
use frame_support::{
|
||||
parameter_types, construct_runtime, debug,
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness, LockIdentifier},
|
||||
};
|
||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||
@@ -387,6 +387,7 @@ parameter_types! {
|
||||
pub const TermDuration: BlockNumber = 24 * HOURS;
|
||||
pub const DesiredMembers: u32 = 13;
|
||||
pub const DesiredRunnersUp: u32 = 7;
|
||||
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
|
||||
}
|
||||
|
||||
impl elections_phragmen::Trait for Runtime {
|
||||
@@ -403,6 +404,7 @@ impl elections_phragmen::Trait for Runtime {
|
||||
type DesiredMembers = DesiredMembers;
|
||||
type DesiredRunnersUp = DesiredRunnersUp;
|
||||
type TermDuration = TermDuration;
|
||||
type ModuleId = ElectionsPhragmenModuleId;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -433,6 +435,7 @@ parameter_types! {
|
||||
pub const ProposalBondMinimum: Balance = 20 * DOLLARS;
|
||||
pub const SpendPeriod: BlockNumber = 6 * DAYS;
|
||||
pub const Burn: Permill = Permill::from_percent(0);
|
||||
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
|
||||
|
||||
pub const TipCountdown: BlockNumber = 1 * DAYS;
|
||||
pub const TipFindersFee: Percent = Percent::from_percent(20);
|
||||
@@ -455,6 +458,7 @@ impl treasury::Trait for Runtime {
|
||||
type ProposalBondMinimum = ProposalBondMinimum;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
type ModuleId = TreasuryModuleId;
|
||||
}
|
||||
|
||||
impl offences::Trait for Runtime {
|
||||
@@ -694,6 +698,7 @@ parameter_types! {
|
||||
pub const PeriodSpend: Balance = 500 * DOLLARS;
|
||||
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
|
||||
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
|
||||
pub const SocietyModuleId: ModuleId = ModuleId(*b"py/socie");
|
||||
}
|
||||
|
||||
impl society::Trait for Runtime {
|
||||
@@ -710,6 +715,7 @@ impl society::Trait for Runtime {
|
||||
type FounderSetOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
|
||||
type SuspensionJudgementOrigin = society::EnsureFounder<Runtime>;
|
||||
type ChallengePeriod = ChallengePeriod;
|
||||
type ModuleId = SocietyModuleId;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -34,7 +34,7 @@ use primitives::{
|
||||
parachain::{self, ActiveParas, AbridgedCandidateReceipt, SigningContext}, ValidityError,
|
||||
};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
create_runtime_str, generic, impl_opaque_keys, ModuleId,
|
||||
ApplyExtrinsicResult, KeyTypeId, Percent, Permill, Perbill, Perquintill, RuntimeDebug,
|
||||
transaction_validity::{
|
||||
TransactionValidity, InvalidTransaction, TransactionValidityError, TransactionSource, TransactionPriority,
|
||||
@@ -56,7 +56,7 @@ use sp_core::OpaqueMetadata;
|
||||
use sp_staking::SessionIndex;
|
||||
use frame_support::{
|
||||
parameter_types, construct_runtime, debug,
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness},
|
||||
traits::{KeyOwnerProofSystem, SplitTwoWays, Randomness, LockIdentifier},
|
||||
};
|
||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
|
||||
@@ -393,6 +393,7 @@ parameter_types! {
|
||||
/// 13 members initially, to be increased to 23 eventually.
|
||||
pub const DesiredMembers: u32 = 13;
|
||||
pub const DesiredRunnersUp: u32 = 20;
|
||||
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
|
||||
}
|
||||
|
||||
impl elections_phragmen::Trait for Runtime {
|
||||
@@ -409,6 +410,7 @@ impl elections_phragmen::Trait for Runtime {
|
||||
type DesiredMembers = DesiredMembers;
|
||||
type DesiredRunnersUp = DesiredRunnersUp;
|
||||
type TermDuration = TermDuration;
|
||||
type ModuleId = ElectionsPhragmenModuleId;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -439,6 +441,7 @@ parameter_types! {
|
||||
pub const ProposalBondMinimum: Balance = 100 * DOLLARS;
|
||||
pub const SpendPeriod: BlockNumber = 24 * DAYS;
|
||||
pub const Burn: Permill = Permill::from_percent(1);
|
||||
pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
|
||||
|
||||
pub const TipCountdown: BlockNumber = 1 * DAYS;
|
||||
pub const TipFindersFee: Percent = Percent::from_percent(20);
|
||||
@@ -461,6 +464,7 @@ impl treasury::Trait for Runtime {
|
||||
type ProposalBondMinimum = ProposalBondMinimum;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
type ModuleId = TreasuryModuleId;
|
||||
}
|
||||
|
||||
impl offences::Trait for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user