Skip to content

Commit

Permalink
compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Sep 2, 2023
1 parent 2bda0fd commit f0362a2
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 81 deletions.
Binary file not shown.
Binary file removed audits/halborn/audit20220919-pallet-democracy.pdf
Binary file not shown.
Binary file not shown.
73 changes: 73 additions & 0 deletions code/parachain/runtime/composable/src/assets.rs
Original file line number Diff line number Diff line change
@@ -1 +1,74 @@
use super::*;


impl pallet_assets::Config for Runtime {
type NativeAssetId = NativeAssetId;
type AssetId = CurrencyId;
type Balance = Balance;
type NativeCurrency = Balances;
type MultiCurrency = Tokens;
type WeightInfo = ();
type AdminOrigin = EnsureRootOrHalfCouncil;
type CurrencyValidator = ValidateCurrencyId;
type RuntimeHoldReason = TemporalHoldIdentifier;
}

pub struct CurrencyHooks;
impl orml_traits::currency::MutationHooks<AccountId, CurrencyId, Balance> for CurrencyHooks {
type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccount>;
type OnSlash = ();
type PreDeposit = ();
type PostDeposit = ();
type PreTransfer = ();
type PostTransfer = ();
type OnNewTokenAccount = ();
type OnKilledTokenAccount = ();
}

type ReserveIdentifier = [u8; 8];
impl orml_tokens::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type Amount = Amount;
type CurrencyId = CurrencyId;
type WeightInfo = weights::tokens::WeightInfo<Runtime>;
type ExistentialDeposits = MultiExistentialDeposits;
type MaxLocks = ConstU32<32>;
type ReserveIdentifier = ReserveIdentifier;
type MaxReserves = frame_support::traits::ConstU32<2>;
type DustRemovalWhitelist = DustRemovalWhitelist;
type CurrencyHooks = CurrencyHooks;
}


parameter_types! {
/// Minimum amount an account has to hold to stay in state.
// minimum account balance is given as 0.1 PICA ~ 100 CurrencyId::milli()
pub ExistentialDeposit: Balance = 100 * CurrencyId::milli::<Balance>();
}

pub type BalanceIdentifier = [u8; 8];

/// until next upgrade when ORM will be upgraded
pub type TemporalHoldIdentifier = ();


impl balances::Config for Runtime {
type MaxLocks = ConstU32<64>;
type MaxReserves = ();
type ReserveIdentifier = BalanceIdentifier;
type Balance = Balance;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = weights::balances::SubstrateWeight<Runtime>;

type HoldIdentifier = TemporalHoldIdentifier;

type FreezeIdentifier = BalanceIdentifier;

type MaxHolds = ConstU32<32>;

type MaxFreezes = ConstU32<32>;
}
87 changes: 6 additions & 81 deletions code/parachain/runtime/composable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
clippy::indexing_slicing,
clippy::todo,
clippy::unwrap_used,
// // impl_runtime_apis will generate code that contains a `panic!`. Implementations should still avoid using panics.
// clippy::panic
clippy::panic
)
)]
#![deny(clippy::unseparated_literal_suffix, clippy::disallowed_types, unused_imports)]
Expand All @@ -32,6 +31,7 @@ mod prelude;
pub mod version;
mod weights;
mod xcmp;
mod assets;
use common::{
fees::multi_existential_deposits, governance::native::NativeTreasury, rewards::StakingPot,
AccountId, AccountIndex, Address, Amount, AuraId, Balance, BlockNumber, Hash, Moment,
Expand All @@ -56,6 +56,8 @@ use sp_std::prelude::*;
use sp_version::RuntimeVersion;
// A few exports that help ease life for downstream crates.
use codec::Encode;

pub use crate::assets::*;
pub use frame_support::{
construct_runtime,
pallet_prelude::*,
Expand Down Expand Up @@ -212,15 +214,10 @@ impl assets_registry::Config for Runtime {
type NetworkId = ComposableNetworkId;
}

parameter_types! {
// Maximum authorities/collators for aura
pub const MaxAuthorities: u32 = 100;
}

impl aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
type MaxAuthorities = ConstU32<100>;
}

impl cumulus_pallet_aura_ext::Config for Runtime {}
Expand Down Expand Up @@ -256,41 +253,6 @@ impl timestamp::Config for Runtime {
type WeightInfo = weights::timestamp::WeightInfo<Runtime>;
}

parameter_types! {
/// Minimum amount an account has to hold to stay in state.
// minimum account balance is given as 0.1 PICA ~ 100 CurrencyId::milli()
pub ExistentialDeposit: Balance = 100 * CurrencyId::milli::<Balance>();
/// Max locks that can be placed on an account. Capped for storage
/// concerns.
pub const MaxLocks: u32 = 50;
}

type BalanceIdentifier = [u8; 8];

/// until next upgrade when ORM will be upgraded
type TemporalHoldIdentifier = ();


impl balances::Config for Runtime {
type MaxLocks = MaxLocks;
type MaxReserves = ();
type ReserveIdentifier = BalanceIdentifier;
type Balance = Balance;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = weights::balances::SubstrateWeight<Runtime>;

type HoldIdentifier = TemporalHoldIdentifier;

type FreezeIdentifier = BalanceIdentifier;

type MaxHolds = ConstU32<32>;

type MaxFreezes = ConstU32<32>;
}

pub struct WeightToFee;
impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
Expand Down Expand Up @@ -486,17 +448,7 @@ impl collator_selection::Config for Runtime {
type WeightInfo = weights::collator_selection::WeightInfo<Runtime>;
}

impl pallet_assets::Config for Runtime {
type NativeAssetId = NativeAssetId;
type AssetId = CurrencyId;
type Balance = Balance;
type NativeCurrency = Balances;
type MultiCurrency = Tokens;
type WeightInfo = ();
type AdminOrigin = EnsureRootOrHalfCouncil;
type CurrencyValidator = ValidateCurrencyId;
type RuntimeHoldReason = TemporalHoldIdentifier;
}


parameter_type_with_key! {
// Minimum amount an account has to hold to stay in state
Expand All @@ -518,33 +470,6 @@ parameter_types! {
pub TreasuryAccount: AccountId = TreasuryPalletId::get().into_account_truncating();
}

pub struct CurrencyHooks;
impl orml_traits::currency::MutationHooks<AccountId, CurrencyId, Balance> for CurrencyHooks {
type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccount>;
type OnSlash = ();
type PreDeposit = ();
type PostDeposit = ();
type PreTransfer = ();
type PostTransfer = ();
type OnNewTokenAccount = ();
type OnKilledTokenAccount = ();
}

type ReserveIdentifier = [u8; 8];
impl orml_tokens::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type Amount = Amount;
type CurrencyId = CurrencyId;
type WeightInfo = weights::tokens::WeightInfo<Runtime>;
type ExistentialDeposits = MultiExistentialDeposits;
type MaxLocks = MaxLocks;
type ReserveIdentifier = ReserveIdentifier;
type MaxReserves = frame_support::traits::ConstU32<2>;
type DustRemovalWhitelist = DustRemovalWhitelist;
type CurrencyHooks = CurrencyHooks;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
RuntimeBlockWeights::get().max_block;
Expand Down

0 comments on commit f0362a2

Please sign in to comment.