@@ -39,7 +39,9 @@ use sp_api::impl_runtime_apis;
3939use sp_core:: { crypto:: KeyTypeId , OpaqueMetadata } ;
4040use sp_runtime:: {
4141 create_runtime_str, generic, impl_opaque_keys,
42- traits:: { AccountIdConversion , AccountIdLookup , BlakeTwo256 , Block as BlockT , Verify } ,
42+ traits:: {
43+ AccountIdConversion , AccountIdLookup , BlakeTwo256 , Block as BlockT , ConvertInto , Verify ,
44+ } ,
4345 transaction_validity:: { TransactionSource , TransactionValidity } ,
4446 ApplyExtrinsicResult , Perbill , Permill ,
4547} ;
@@ -58,7 +60,7 @@ use frame_support::{
5860 traits:: {
5961 fungible, fungibles, tokens:: imbalance:: ResolveAssetTo , AsEnsureOriginWithArg , ConstBool ,
6062 ConstU128 , ConstU32 , ConstU64 , ConstU8 , EitherOfDiverse , Equals , InstanceFilter ,
61- TransformOrigin ,
63+ TransformOrigin , WithdrawReasons ,
6264 } ,
6365 weights:: { ConstantMultiplier , Weight } ,
6466 BoundedVec , PalletId ,
@@ -229,6 +231,26 @@ impl pallet_balances::Config for Runtime {
229231 type MaxFreezes = ConstU32 < 0 > ;
230232}
231233
234+ parameter_types ! {
235+ pub UnvestedFundsAllowedWithdrawReasons : WithdrawReasons =
236+ WithdrawReasons :: except( WithdrawReasons :: TRANSFER | WithdrawReasons :: RESERVE ) ;
237+ }
238+
239+ impl pallet_vesting:: Config for Runtime {
240+ type RuntimeEvent = RuntimeEvent ;
241+ type Currency = Balances ;
242+ type BlockNumberToBalance = ConvertInto ;
243+ type MinVestedTransfer = ExistentialDeposit ;
244+ type WeightInfo = weights:: pallet_vesting:: WeightInfo < Runtime > ;
245+ type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons ;
246+ /// Note for wallets and implementers: This means that vesting schedules are evaluated with the
247+ /// block number of the Relay Chain, not the parachain. This is because with Coretime and Async
248+ /// Backing, parachain block numbers may not be a good proxy for time. Vesting schedules should
249+ /// be set accordingly.
250+ type BlockNumberProvider = cumulus_pallet_parachain_system:: RelaychainDataProvider < Runtime > ;
251+ const MAX_VESTING_SCHEDULES : u32 = 28 ;
252+ }
253+
232254parameter_types ! {
233255 /// Relay Chain `TransactionByteFee` / 10
234256 pub const TransactionByteFee : Balance = system_parachains_constants:: kusama:: fee:: TRANSACTION_BYTE_FEE ;
@@ -507,7 +529,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
507529 RuntimeCall :: Assets { .. } |
508530 RuntimeCall :: NftFractionalization { .. } |
509531 RuntimeCall :: Nfts { .. } |
510- RuntimeCall :: Uniques { .. }
532+ RuntimeCall :: Uniques { .. } |
533+ // We allow calling `vest` and merging vesting schedules, but obviously not
534+ // vested transfers.
535+ RuntimeCall :: Vesting ( pallet_vesting:: Call :: vested_transfer { .. } )
511536 ) ,
512537 ProxyType :: CancelProxy => matches ! (
513538 c,
@@ -934,6 +959,7 @@ construct_runtime!(
934959 Balances : pallet_balances = 10 ,
935960 TransactionPayment : pallet_transaction_payment = 11 ,
936961 AssetTxPayment : pallet_asset_conversion_tx_payment = 13 ,
962+ Vesting : pallet_vesting = 14 ,
937963
938964 // Collator support. the order of these 5 are important and shall not change.
939965 Authorship : pallet_authorship = 20 ,
@@ -1029,6 +1055,7 @@ mod benches {
10291055 [ pallet_session, SessionBench :: <Runtime >]
10301056 [ pallet_uniques, Uniques ]
10311057 [ pallet_utility, Utility ]
1058+ [ pallet_vesting, Vesting ]
10321059 [ pallet_timestamp, Timestamp ]
10331060 [ pallet_collator_selection, CollatorSelection ]
10341061 [ cumulus_pallet_parachain_system, ParachainSystem ]
0 commit comments