diff --git a/Cargo.lock b/Cargo.lock index 88a7c38..39958de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -254,9 +254,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" +checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" dependencies = [ "async-channel", "async-global-executor", @@ -2341,6 +2341,7 @@ dependencies = [ "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", + "pallet-vesting", "parity-scale-codec", "sp-api", "sp-block-builder", @@ -4024,6 +4025,19 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-vesting" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate.git?branch=master#b391b82954ad95a927a921035e3017c4a0aad516" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "sp-runtime", + "sp-std", +] + [[package]] name = "parity-db" version = "0.3.1" @@ -6180,9 +6194,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "snap" diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 89b1072..f0e8ed5 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,6 +1,6 @@ use integritee_node_runtime::{ AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, Multisig, Signature, SudoConfig, - SystemConfig, TreasuryPalletId, WASM_BINARY + SystemConfig, TreasuryPalletId, WASM_BINARY }; use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -392,5 +392,6 @@ fn genesis_config( key: root_key, }, treasury: Default::default(), + vesting: Default::default(), } } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ae0f88c..e0256b4 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -30,6 +30,7 @@ pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } +pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } sp-block-builder = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" } @@ -79,6 +80,7 @@ std = [ "pallet-transaction-payment/std", "pallet-treasury/std", "pallet-multisig/std", + "pallet-vesting/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 9f649d2..1a3c8dc 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -27,7 +27,7 @@ use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, Verify}, + traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, Verify, ConvertInto}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, }; @@ -485,6 +485,18 @@ impl pallet_proxy::Config for Runtime { type AnnouncementDepositFactor = AnnouncementDepositFactor; } +parameter_types! { + pub const MinVestedTransfer: Balance = 1 * TEER; +} + +impl pallet_vesting::Config for Runtime { + type Event = Event; + type Currency = Balances; + type BlockNumberToBalance = ConvertInto; + type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); + const MAX_VESTING_SCHEDULES: u32 = 28; +} // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -492,20 +504,28 @@ construct_runtime!( NodeBlock = opaque::Block, UncheckedExtrinsic = UncheckedExtrinsic { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - Aura: pallet_aura::{Pallet, Config}, - Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, - Sudo: pallet_sudo::{Pallet, Call, Config, Storage, Event}, - // added by Integritee - Teerex: pallet_teerex::{Pallet, Call, Storage, Event}, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, - Multisig: pallet_multisig::{Pallet, Call, Storage, Event}, - Proxy: pallet_proxy::{Pallet, Call, Storage, Event}, - } + // Basic + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, + Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 5, + Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 6, + Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 7, + + // funds and fees + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 11, + Vesting: pallet_vesting::{Pallet, Call, Storage, Event, Config} = 12, + + // consensus + Aura: pallet_aura::{Pallet, Config} = 23, + Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event} = 24, + + // governance + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 30, + + // utility + Teerex: pallet_teerex::{Pallet, Call, Storage, Event} = 50, } ); /// The address format for describing accounts.