git.delta.rocks / unique-network / refs/commits / f52eddef5fcc

difftreelog

orml-vesting pallet

str-mv2021-11-16parent: #516bf2b.patch.diff
in: master

2 files changed

modifiedruntime/Cargo.tomldiffbeforeafterboth
60 'pallet-transaction-payment/std',60 'pallet-transaction-payment/std',
61 'pallet-transaction-payment-rpc-runtime-api/std',61 'pallet-transaction-payment-rpc-runtime-api/std',
62 'pallet-treasury/std',62 'pallet-treasury/std',
63 'pallet-vesting/std',63 # 'pallet-vesting/std',
64 'pallet-evm/std',64 'pallet-evm/std',
65 'pallet-evm-migration/std',65 'pallet-evm-migration/std',
66 'pallet-evm-contract-helpers/std',66 'pallet-evm-contract-helpers/std',
98 'xcm-builder/std',98 'xcm-builder/std',
99 'xcm-executor/std',99 'xcm-executor/std',
100
101 "orml-vesting/std",
100]102]
101limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']103limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']
102104
210git = 'https://github.com/paritytech/substrate.git'212git = 'https://github.com/paritytech/substrate.git'
211branch = 'polkadot-v0.9.12'213branch = 'polkadot-v0.9.12'
212214
213[dependencies.pallet-vesting]215# [dependencies.pallet-vesting]
214default-features = false216# default-features = false
215git = 'https://github.com/paritytech/substrate.git'217# git = 'https://github.com/paritytech/substrate.git'
216branch = 'polkadot-v0.9.12'218# branch = 'polkadot-v0.9.12'
217219
218[dependencies.sp-arithmetic]220[dependencies.sp-arithmetic]
219default-features = false221default-features = false
359branch = 'release-v0.9.12'361branch = 'release-v0.9.12'
360default-features = false362default-features = false
361363
364[dependencies.orml-vesting]
365git = "https://github.com/open-web3-stack/open-runtime-module-library"
366version = "0.4.1-dev"
367default-features = false
362368
363################################################################################369################################################################################
364# local dependencies370# local dependencies
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -22,8 +22,7 @@
 use sp_runtime::{
 	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
 	traits::{
-		AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,
-		AccountIdConversion,
+		AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify, AccountIdConversion,
 	},
 	transaction_validity::{TransactionSource, TransactionValidity},
 	ApplyExtrinsicResult, MultiSignature,
@@ -70,7 +69,7 @@
 use fp_rpc::TransactionStatus;
 use sp_core::crypto::Public;
 use sp_runtime::{
-	traits::{Dispatchable, PostDispatchInfoOf},
+	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf},
 	transaction_validity::TransactionValidityError,
 };
 
@@ -515,17 +514,33 @@
 	type Call = Call;
 }
 
+pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
+
+impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
+	for RelayChainBlockNumberProvider<T>
+{
+	type BlockNumber = BlockNumber;
+
+	fn current_block_number() -> Self::BlockNumber {
+		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
+			.map(|d| d.relay_parent_number)
+			.unwrap_or_default()
+	}
+}
+
 parameter_types! {
 	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
+	pub const MaxVestingSchedules: u32 = 28;
 }
 
-impl pallet_vesting::Config for Runtime {
+impl orml_vesting::Config for Runtime {
 	type Event = Event;
-	type Currency = Balances;
-	type BlockNumberToBalance = ConvertInto;
+	type Currency = pallet_balances::Pallet<Runtime>;
 	type MinVestedTransfer = MinVestedTransfer;
+	type VestedTransferOrigin = EnsureSigned<AccountId>;
 	type WeightInfo = ();
-	const MAX_VESTING_SCHEDULES: u32 = 28;
+	type MaxVestingSchedules = MaxVestingSchedules;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
 }
 
 parameter_types! {
@@ -841,7 +856,8 @@
 		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
 		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
 		System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,
-		Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
+		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
+		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
 		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
 
 		// XCM helpers.