Skip to content

Commit

Permalink
added pallet identity
Browse files Browse the repository at this point in the history
  • Loading branch information
asiniscalchi committed Aug 28, 2024
1 parent 5785b36 commit 278ca9c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions runtime/laos/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ frame_benchmarking::define_benchmarks!(
[pallet_vesting, Vesting]
[pallet_message_queue, MessageQueue]
[cumulus_pallet_parachain_system, ParachainSystem]
[pallet_identity, Identity]
// TODO pallet_xcm?
);
41 changes: 41 additions & 0 deletions runtime/laos/src/configs/identity.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use crate::{currency, AccountId, Balances, Runtime, RuntimeEvent, Signature};
use frame_support::parameter_types;
use frame_system::EnsureRoot;
use parachains_common::DAYS;
use sp_core::ConstU128;

parameter_types! {
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
pub const PendingUsernameExpiration: u32 = 7 * DAYS;
pub const MaxSuffixLength: u32 = 7;
pub const MaxUsernameLength: u32 = 32;
}

type IdentityForceOrigin = EnsureRoot<AccountId>;
type IdentityRegistrarOrigin = EnsureRoot<AccountId>;

impl pallet_identity::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
// Add one item in storage and take 258 bytes
type BasicDeposit = ConstU128<{ currency::calculate_deposit(1, 258) }>;
// Does not add any item to the storage but takes 1 bytes
type ByteDeposit = ConstU128<{ currency::calculate_deposit(0, 1) }>;
// Add one item in storage and take 53 bytes
type SubAccountDeposit = ConstU128<{ currency::calculate_deposit(1, 53) }>;
type MaxSubAccounts = MaxSubAccounts;
type IdentityInformation = pallet_identity::legacy::IdentityInfo<MaxAdditionalFields>;
type MaxRegistrars = MaxRegistrars;
type Slashed = (); // TODO: Treasury;
type ForceOrigin = IdentityForceOrigin;
type RegistrarOrigin = IdentityRegistrarOrigin;
type OffchainSignature = Signature;
type SigningPublicKey = <Signature as sp_runtime::traits::Verify>::Signer;
type UsernameAuthorityOrigin = EnsureRoot<AccountId>;
type PendingUsernameExpiration = PendingUsernameExpiration;
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = (); // moonbeam_weights::pallet_identity::WeightInfo<Runtime>;
}
2 changes: 1 addition & 1 deletion runtime/laos/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod cumulus_parachain_system;
mod cumulus_xcmp_queue;
mod ethereum;
pub(crate) mod evm;
mod identity;
pub(crate) mod laos_evolution;
mod multisig;
pub(crate) mod parachain_staking;
Expand All @@ -37,7 +38,6 @@ mod utility;
mod vesting;
pub(crate) mod xcm_config;
mod xcm_message_queue;
mod identity;

use frame_support::parameter_types;

Expand Down
1 change: 1 addition & 0 deletions runtime/laos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ construct_runtime!(
Utility: pallet_utility = 5,
Multisig: pallet_multisig = 6,
Proxy: pallet_proxy = 7,
Identity: pallet_identity = 8,

// Monetary stuff.
Balances: pallet_balances = 10,
Expand Down

0 comments on commit 278ca9c

Please sign in to comment.