Skip to content

Commit

Permalink
runtime and genesis fixes (#57)
Browse files Browse the repository at this point in the history
* add vesting pallet

* hardcoded pallet index
  • Loading branch information
brenzi authored Oct 4, 2021
1 parent d593a2d commit 078230a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 20 deletions.
22 changes: 18 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -392,5 +392,6 @@ fn genesis_config(
key: root_key,
},
treasury: Default::default(),
vesting: Default::default(),
}
}
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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",
Expand Down
50 changes: 35 additions & 15 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -485,27 +485,47 @@ 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
Block = Block,
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Aura: pallet_aura::{Pallet, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>},
// added by Integritee
Teerex: pallet_teerex::{Pallet, Call, Storage, Event<T>},
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>},
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>},
}
// Basic
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 5,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 6,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 7,

// funds and fees
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 11,
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 12,

// consensus
Aura: pallet_aura::{Pallet, Config<T>} = 23,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event} = 24,

// governance
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 30,

// utility
Teerex: pallet_teerex::{Pallet, Call, Storage, Event<T>} = 50, }
);

/// The address format for describing accounts.
Expand Down

0 comments on commit 078230a

Please sign in to comment.