Skip to content

Commit

Permalink
Integrates crowdloan pallets to altait
Browse files Browse the repository at this point in the history
  • Loading branch information
mustermeiszer committed Oct 13, 2021
1 parent 424de85 commit 74dd42b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions runtime/altair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ pallet-anchors = { path = "../../pallets/anchors", default-features = false }
pallet-fees = { path = "../../pallets/fees", default-features = false }
pallet-claims = { path = "../../pallets/claims", default-features = false }
pallet-migration-manager = { path = "../../pallets/migration", default-features = false }
pallet-crowdloan-claim = { path = "../../pallets/crowdloan-claim", default-features = false }
pallet-crowdloan-reward = { path = "../../pallets/crowdloan-reward", default-features = false }

[build-dependencies]
substrate-wasm-builder = "3.0.0"
Expand Down Expand Up @@ -172,6 +174,8 @@ std = [
"pallet-society/std",
"runtime-common/std",
"pallet-migration-manager/std",
"pallet-crowdloan-claim/std",
"pallet-crowdloan-reward/std"
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
41 changes: 41 additions & 0 deletions runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,40 @@ impl pallet_migration_manager::Config for Runtime {
type WeightInfo = pallet_migration_manager::SubstrateWeight<Self>;
}

// Parameterize crowdloan reward pallet configuration
parameter_types! {
pub const CrowdloanRewardPalletId: PalletId = PalletId(*b"cc/rewrd");
}

// Implement crowdloan reward pallet's configuration trait for the runtime
impl pallet_crowdloan_reward::Config for Runtime {
type Event = Event;
type PalletId = CrowdloanRewardPalletId;
type AdminOrigin = EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
type WeightInfo = pallet_crowdloan_reward::weights::SubstrateWeight<Self>;
}

// Parameterize crowdloan claim pallet
parameter_types! {
pub const CrowdloanClaimPalletId: PalletId = PalletId(*b"cc/claim");
pub const ClaimTransactionPriority: TransactionPriority = TransactionPriority::max_value();
pub const ClaimTransactionLongevity: u32 = 64;
pub const MaxProofLength: u32 = 30;
}

// Implement crowdloan claim pallet configuration trait for the mock runtime
impl pallet_crowdloan_claim::Config for Runtime {
type Event = Event;
type PalletId = CrowdloanClaimPalletId;
type WeightInfo = pallet_crowdloan_claim::weights::SubstrateWeight<Self>;
type AdminOrigin = EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
type RelayChainAccountId = AccountId;
type MaxProofLength = MaxProofLength;
type ClaimTransactionPriority = ClaimTransactionPriority;
type ClaimTransactionLongevity = ClaimTransactionLongevity;
type RewardMechanism = CrowdloanReward;
}

// admin stuff
impl pallet_sudo::Config for Runtime {
type Event = Event;
Expand Down Expand Up @@ -681,6 +715,9 @@ construct_runtime!(
Fees: pallet_fees::{Pallet, Call, Storage, Config<T>, Event<T>} = 90,
Anchor: pallet_anchors::{Pallet, Call, Storage} = 91,
Claims: pallet_claims::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 92,
CrowdloanClaim: pallet_crowdloan_claim::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 93,
CrowdloanReward: pallet_crowdloan_reward::{Pallet, Call, Storage, Event<T>} = 94,

// migration pallet
Migration: pallet_migration_manager::{Pallet, Call, Storage, Event<T>} = 199,
// admin stuff
Expand Down Expand Up @@ -853,6 +890,8 @@ impl_runtime_apis! {

add_benchmark!(params, batches, pallet_fees, Fees);
add_benchmark!(params, batches, pallet_migration_manager, Migration);
add_benchmark!(params, batches, pallet_crowdloan_claim, CrowdloanClaim);
add_benchmark!(params, batches, pallet_crowdloan_reward, CrowdloanReward);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
Expand All @@ -869,6 +908,8 @@ impl_runtime_apis! {

list_benchmark!(list, extra, pallet_fees, Fees);
list_benchmark!(list, extra, pallet_migration_manager, Migration);
list_benchmark!(list, extra, pallet_crowdloan_claim, CrowdloanClaim);
list_benchmark!(list, extra, pallet_crowdloan_reward, CrowdloanReward);

let storage_info = AllPalletsWithSystem::storage_info();

Expand Down

0 comments on commit 74dd42b

Please sign in to comment.