-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enable off-chain workers for pendulum node. (#136) * Add bootnodes to Pendulum chain specs (#104) * enable off chain workers for pendulum node. --------- Co-authored-by: Gonza Montiel <[email protected]> * Free up CI disk space * Fix typo in workflow file * Added vesting-manager pallet * Bump versions --------- Co-authored-by: cr4pt0 <[email protected]> Co-authored-by: Gonza Montiel <[email protected]>
- Loading branch information
1 parent
f5837cc
commit a774df1
Showing
6 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[package] | ||
authors = ["Pendulum"] | ||
description = "A pallet to manage vesting schedules" | ||
edition = "2021" | ||
name = "vesting-manager" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
log = "0.4.17" | ||
parity-scale-codec = {version = "3.1.5", default-features = false, features = ["derive"]} | ||
scale-info = {version = "2.1.1", default-features = false, features = ["derive"]} | ||
serde = {version = "1.0.142", optional = true} | ||
sp-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
|
||
frame-support = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
frame-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
pallet-vesting = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
sp-runtime = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
sp-std = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false} | ||
|
||
# benchmarking | ||
frame-benchmarking = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false, optional = true} | ||
|
||
[features] | ||
default = ["std"] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
] | ||
std = [ | ||
"frame-support/std", | ||
"frame-system/std", | ||
"log/std", | ||
"parity-scale-codec/std", | ||
"pallet-vesting/std", | ||
"scale-info/std", | ||
"serde", | ||
"sp-api/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
pub use pallet::*; | ||
|
||
use frame_support::traits::VestingSchedule; | ||
use sp_runtime::traits::StaticLookup; | ||
|
||
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source; | ||
|
||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use super::*; | ||
use frame_support::pallet_prelude::*; | ||
use frame_system::pallet_prelude::*; | ||
|
||
#[pallet::pallet] | ||
#[pallet::generate_store(pub(super) trait Store)] | ||
pub struct Pallet<T>(_); | ||
|
||
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>; | ||
type VestingSchedule: VestingSchedule<Self::AccountId>; | ||
} | ||
|
||
#[pallet::event] | ||
#[pallet::generate_deposit(pub(super) fn deposit_event)] | ||
pub enum Event<T: Config> { | ||
VestingScheduleRemoved { who: T::AccountId, schedule_index: u32 }, | ||
} | ||
|
||
#[pallet::call] | ||
impl<T: Config> Pallet<T> { | ||
#[pallet::call_index(0)] | ||
#[pallet::weight(10_000_000)] | ||
pub fn remove_vesting_schedule( | ||
origin: OriginFor<T>, | ||
who: AccountIdLookupOf<T>, | ||
schedule_index: u32, | ||
) -> DispatchResultWithPostInfo { | ||
ensure_root(origin)?; | ||
let who = T::Lookup::lookup(who)?; | ||
T::VestingSchedule::remove_vesting_schedule(&who, schedule_index)?; | ||
|
||
Self::deposit_event(Event::VestingScheduleRemoved { who, schedule_index }); | ||
|
||
// waive the fee | ||
Ok(Pays::No.into()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters