From c3f56ae4b45405a45badba3eabab3e660556f625 Mon Sep 17 00:00:00 2001 From: Muhammad Abdul Hakim Shibghatallah <70675129+abdulhakim2902@users.noreply.github.com> Date: Wed, 22 Feb 2023 10:44:25 +0700 Subject: [PATCH] feat: implement pallet tipping (#403) --- Cargo.lock | 23 +++++++++++++++++++++++ runtime/Cargo.toml | 10 ++++++++++ runtime/src/lib.rs | 23 +++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f15dd04d..74c4e833 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1616,6 +1616,7 @@ dependencies = [ "pallet-session-benchmarking", "pallet-sudo", "pallet-timestamp", + "pallet-tipping", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-uniques", @@ -6207,6 +6208,28 @@ dependencies = [ "sp-timestamp", ] +[[package]] +name = "pallet-tipping" +version = "2.3.4" +source = "git+https://github.com/myriadsocial/myriad-node.git?tag=2.3.4#e75626126a266a0c344ec0d143362ea273693101" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hex", + "log", + "pallet-assets", + "pallet-balances", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-std", +] + [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 1ab6c2b5..b7715d37 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -125,6 +125,10 @@ opinion-requestor-benchmarking = { path = '../pallets/opinion-requestor/benchmar opinion = { path = '../pallets/opinion', default-features = false } opinion-benchmarking = { path = '../pallets/opinion/benchmarking', default-features = false, optional = true } +# Myriad Dependencies +## Myriad Pallet Dependencies +pallet-tipping = { git = 'https://github.com/myriadsocial/myriad-node.git', tag = '2.3.4', default-features = false } + # Local Primitives primitives-profile-roles = { path = '../primitives/profile-roles', default-features = false } primitives-ethereum-address = { path = '../primitives/ethereum-address', default-features = false } @@ -192,6 +196,9 @@ runtime-benchmarks = [ 'health-professional-qualification-benchmarking', 'opinion-requestor-benchmarking', 'opinion-benchmarking', + + # Myriad Pallet + 'pallet-tipping/runtime-benchmarks', ] std = [ # External Dependencies @@ -287,6 +294,9 @@ std = [ # Local Primitives 'primitives-profile-roles/std', 'primitives-ethereum-address/std', + + # Myriad Pallet + 'pallet-tipping/std', ] try-runtime = [ # Substrate Dependencies diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 320eb563..6eeb66f3 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -933,6 +933,26 @@ impl opinion::Config for Runtime { type OpinionWeightInfo = (); } +// ------------------------------ +// Myriad Pallets +// ------------------------------ +parameter_types! { + // In percentage + pub const AdminFee: u8 = 10; + pub const TransactionFee: u8 = 5; +} + +impl pallet_tipping::Config for Runtime { + type Assets = OctopusAssets; + type Currency = Balances; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type TimeProvider = Timestamp; + type AdminFee = AdminFee; + type TransactionFee = TransactionFee; + type WeightInfo = (); +} + type Migrations = ( // This migration is used to set the interval value in the upward-messages. It should be // deleted after the upgrade. @@ -1004,6 +1024,9 @@ construct_runtime!( HealthProfessionalQualification: health_professional_qualification, OpinionRequestor: opinion_requestor, Opinion: opinion, + + // Myriad pallets + Tipping: pallet_tipping, } );