Skip to content

Commit

Permalink
feat: add utility paleet
Browse files Browse the repository at this point in the history
  • Loading branch information
cuteolaf committed Aug 31, 2022
1 parent fb5a4e8 commit 17a660b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 12 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

16 changes: 11 additions & 5 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ repository = "https://github.com/Fair-Squares/fair-squares"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.1.1", default-features = false, features = [
"derive",
] }

pallet-aura = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
Expand All @@ -29,10 +33,10 @@ pallet-transaction-payment = { version = "4.0.0-dev", default-features = false,
pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26"}
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26"}
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
Expand All @@ -45,6 +49,7 @@ pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", default-features = false }

# Used for the node template's RPCs
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.26" }
Expand Down Expand Up @@ -105,6 +110,7 @@ std = [
"pallet-preimage/std",
"pallet-treasury/std",
### add new std
"pallet-utility/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down Expand Up @@ -141,4 +147,4 @@ try-runtime = [
"pallet-onboarding/try-runtime",
"pallet-voting/try-runtime",
### add new try-runtime
]
]
22 changes: 15 additions & 7 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ use sp_version::RuntimeVersion;
pub use frame_support::{
construct_runtime, parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
EqualPrivilegeOnly, KeyOwnerProofSystem, Randomness, StorageInfo,
Contains,
},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
Expand Down Expand Up @@ -536,11 +535,11 @@ impl Contains<Call> for DontAllowCollectiveAndDemocracy {
Call::Democracy(_) => false,
Call::Council(_) => false,
Call::NftModule(_) => false,
Call::OnboardingModule(pallet_onboarding::Call::do_something{..}) => false,
Call::OnboardingModule(pallet_onboarding::Call::change_status{..}) => false,
Call::OnboardingModule(pallet_onboarding::Call::do_buy{..}) => false,
Call::OnboardingModule(pallet_onboarding::Call::reject_edit{..}) => false,
Call::OnboardingModule(pallet_onboarding::Call::reject_destroy{..}) => false,
Call::OnboardingModule(pallet_onboarding::Call::do_something { .. }) => false,
Call::OnboardingModule(pallet_onboarding::Call::change_status { .. }) => false,
Call::OnboardingModule(pallet_onboarding::Call::do_buy { .. }) => false,
Call::OnboardingModule(pallet_onboarding::Call::reject_edit { .. }) => false,
Call::OnboardingModule(pallet_onboarding::Call::reject_destroy { .. }) => false,
_ => true,
}
}
Expand All @@ -566,6 +565,14 @@ impl pallet_voting::Config for Runtime {
type CheckPeriod = CheckPeriod;
type MinimumDepositVote = MinimumDeposit;
}

impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type PalletsOrigin = OriginCaller;
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
}

// flag add pallet config

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down Expand Up @@ -595,6 +602,7 @@ construct_runtime!(
Preimage: pallet_preimage,
Council: pallet_collective::<Instance1>,
Democracy: pallet_democracy,
Utility: pallet_utility,
// flag add pallet runtime
}
);
Expand Down

0 comments on commit 17a660b

Please sign in to comment.