Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Salary pallet #13378

Merged
merged 46 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e3a5bb2
More drafting
gavofyork Oct 7, 2022
3ff9ce8
Merge remote-tracking branch 'origin/master' into gav-paymaster
gavofyork Oct 7, 2022
07ab87a
Paymaster pallet
gavofyork Oct 11, 2022
88e11ce
Merge remote-tracking branch 'origin/master' into gav-paymaster
gavofyork Nov 30, 2022
8200850
Merge remote-tracking branch 'origin/master' into gav-paymaster
gavofyork Feb 12, 2023
958d34f
Fix build
gavofyork Feb 13, 2023
91cb1f5
More tests
gavofyork Feb 13, 2023
c53d372
Rename
gavofyork Feb 13, 2023
0806559
Rename
gavofyork Feb 13, 2023
5cadabf
Renaming
gavofyork Feb 13, 2023
712118b
Revert old changes
gavofyork Feb 13, 2023
07b785c
Multi-phase payouts to avoid bank-runs
gavofyork Feb 15, 2023
7fb95d0
Tests
gavofyork Feb 15, 2023
5c38814
Tests
gavofyork Feb 16, 2023
bfdf333
Allow payment to be targeted elsewhere
gavofyork Feb 16, 2023
807a3c9
Proper ssync payment failure handling
gavofyork Feb 16, 2023
cf1f365
Test for repayment
gavofyork Feb 22, 2023
d829078
Docs
gavofyork Feb 22, 2023
7162964
Impl RankedMembers for RankedCollective
gavofyork Feb 26, 2023
2e299f4
Implement Pay for Pot (i.e. basic account).
gavofyork Feb 26, 2023
5995eeb
Benchmarks
gavofyork Feb 26, 2023
c9c2ce8
Weights
gavofyork Feb 26, 2023
16bc55a
Introduce Salary benchmark into node
gavofyork Feb 26, 2023
2fc7fab
Fix warning
gavofyork Feb 26, 2023
575f426
Merge branch 'master' of https://github.com/paritytech/substrate into…
Feb 26, 2023
42a7927
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_salary
Feb 26, 2023
7dc1529
Update primitives/arithmetic/src/traits.rs
gavofyork Feb 27, 2023
366267c
Update frame/salary/src/lib.rs
gavofyork Feb 27, 2023
26f1ab0
Update lib.rs
gavofyork Feb 27, 2023
872a047
Update frame/salary/src/lib.rs
gavofyork Feb 27, 2023
e2fd134
Docs
gavofyork Feb 27, 2023
8d8a5bf
Update frame/salary/src/lib.rs
gavofyork Feb 27, 2023
9849a65
Update frame/salary/src/lib.rs
gavofyork Feb 27, 2023
0b4aafa
Fix
gavofyork Feb 27, 2023
03199ae
Merge branch 'gav-paymaster' of github.com:paritytech/substrate into …
gavofyork Feb 27, 2023
a21b1bc
Fixes
gavofyork Feb 27, 2023
4c85f02
Fixes
gavofyork Feb 27, 2023
d5696c1
Move some salary traits stuff to a shared location
gavofyork Mar 1, 2023
ddd4d3e
Fix
gavofyork Mar 2, 2023
3704efe
Update frame/salary/src/lib.rs
gavofyork Mar 3, 2023
93a845d
Update frame/salary/src/lib.rs
gavofyork Mar 3, 2023
e5c0733
Mul floor
gavofyork Mar 3, 2023
5d24050
Merge branch 'gav-paymaster' of github.com:paritytech/substrate into …
gavofyork Mar 3, 2023
b3d160e
Fix warnings
gavofyork Mar 3, 2023
b9623a4
Fix test
gavofyork Mar 3, 2023
c08c010
Docs
gavofyork Mar 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ rls*.log
*.bin
*.iml
scripts/ci/node-template-release/Cargo.lock
substrate.code-workspace
17 changes: 17 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ members = [
"frame/recovery",
"frame/referenda",
"frame/remark",
"frame/salary",
"frame/scheduler",
"frame/scored-pool",
"frame/session",
Expand Down
2 changes: 2 additions & 0 deletions frame/ranked-collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,3 +685,5 @@ pub mod pallet {
}
}
}

// TODO: Impl `RankedMembers` for this pallet.
49 changes: 49 additions & 0 deletions frame/salary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
name = "pallet-salary"
version = "4.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "Paymaster"
readme = "README.md"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.16", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../primitives/arithmetic" }
sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" }
sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" }

[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"scale-info/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
3 changes: 3 additions & 0 deletions frame/salary/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Salary

Make periodic payment to members of a ranked collective according to rank.
45 changes: 45 additions & 0 deletions frame/salary/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// This file is part of Substrate.

// Copyright (C) 2020-2022 Parity Technologies (UK) Ltd.
gavofyork marked this conversation as resolved.
Show resolved Hide resolved
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Staking pallet benchmarking.

use super::*;
#[allow(unused_imports)]
use crate::Pallet as RankedCollective;

use frame_benchmarking::{account, benchmarks_instance_pallet, whitelisted_caller};
use frame_support::{assert_ok, dispatch::UnfilteredDispatchable};
use frame_system::RawOrigin as SystemOrigin;

const SEED: u32 = 0;

fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}

benchmarks_instance_pallet! {
add_member {
let origin = T::PromoteOrigin::successful_origin();
let call = Call::<T, I>::add_member { };
}: { call.dispatch_bypass_filter(origin)? }
verify {
assert_eq!(MemberCount::<T, I>::get(0), 1);
assert_last_event::<T, I>(Event::MemberAdded { who }.into());
}

impl_benchmark_test_suite!(RankedCollective, crate::tests::new_test_ext(), crate::tests::Test);
}
Loading