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

difftreelog

Merge pull request #230 from UniqueNetwork/feature/core-202

kozyrevdev2021-11-17parents: #35c67b7 #0734ff6.patch.diff
in: master
orml-vesting pallet

3 files changed

modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -60,7 +60,7 @@
     'pallet-transaction-payment/std',
     'pallet-transaction-payment-rpc-runtime-api/std',
     'pallet-treasury/std',
-    'pallet-vesting/std',
+    # 'pallet-vesting/std',
     'pallet-evm/std',
     'pallet-evm-migration/std',
     'pallet-evm-contract-helpers/std',
@@ -97,6 +97,8 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
+
+    "orml-vesting/std",
 ]
 limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']
 
@@ -210,10 +212,10 @@
 git = 'https://github.com/paritytech/substrate.git'
 branch = 'polkadot-v0.9.12'
 
-[dependencies.pallet-vesting]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.12'
+# [dependencies.pallet-vesting]
+# default-features = false
+# git = 'https://github.com/paritytech/substrate.git'
+# branch = 'polkadot-v0.9.12'
 
 [dependencies.sp-arithmetic]
 default-features = false
@@ -359,6 +361,10 @@
 branch = 'release-v0.9.12'
 default-features = false
 
+[dependencies.orml-vesting]
+git = "https://github.com/open-web3-stack/open-runtime-module-library"
+version = "0.4.1-dev" 
+default-features = false
 
 ################################################################################
 # local dependencies
modifiedruntime/src/lib.rsdiffbeforeafterboth
22use sp_runtime::{22use sp_runtime::{
23 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,23 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
24 traits::{24 traits::{
25 AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,25 AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify, AccountIdConversion,
26 AccountIdConversion,
27 },26 },
28 transaction_validity::{TransactionSource, TransactionValidity},27 transaction_validity::{TransactionSource, TransactionValidity},
70use fp_rpc::TransactionStatus;69use fp_rpc::TransactionStatus;
71use sp_core::crypto::Public;70use sp_core::crypto::Public;
72use sp_runtime::{71use sp_runtime::{
73 traits::{Dispatchable, PostDispatchInfoOf},72 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf},
74 transaction_validity::TransactionValidityError,73 transaction_validity::TransactionValidityError,
75};74};
7675
515 type Call = Call;514 type Call = Call;
516}515}
516
517pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
518
519impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
520 for RelayChainBlockNumberProvider<T>
521{
522 type BlockNumber = BlockNumber;
523
524 fn current_block_number() -> Self::BlockNumber {
525 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
526 .map(|d| d.relay_parent_number)
527 .unwrap_or_default()
528 }
529}
517530
518parameter_types! {531parameter_types! {
519 pub const MinVestedTransfer: Balance = 10 * UNIQUE;532 pub const MinVestedTransfer: Balance = 10 * UNIQUE;
533 pub const MaxVestingSchedules: u32 = 28;
520}534}
521535
522impl pallet_vesting::Config for Runtime {536impl orml_vesting::Config for Runtime {
523 type Event = Event;537 type Event = Event;
524 type Currency = Balances;538 type Currency = pallet_balances::Pallet<Runtime>;
525 type BlockNumberToBalance = ConvertInto;539 type MinVestedTransfer = MinVestedTransfer;
526 type MinVestedTransfer = MinVestedTransfer;540 type VestedTransferOrigin = EnsureSigned<AccountId>;
527 type WeightInfo = ();541 type WeightInfo = ();
528 const MAX_VESTING_SCHEDULES: u32 = 28;542 type MaxVestingSchedules = MaxVestingSchedules;
543 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
529}544}
530545
531parameter_types! {546parameter_types! {
841 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,856 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
842 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,857 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
843 System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,858 System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,
844 Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,859 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
860 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
845 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,861 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
846862
847 // XCM helpers.863 // XCM helpers.
modifiedtests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth
--- a/tests/src/eth/marketplace/marketplace.test.ts
+++ b/tests/src/eth/marketplace/marketplace.test.ts
@@ -1,7 +1,7 @@
 import {readFile} from 'fs/promises';
 import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';
 import privateKey from '../../substrate/privateKey';
-import {addToWhiteListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
+import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
 import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase} from '../util/helpers';
 import {evmToAddress} from '@polkadot/util-crypto';
 import nonFungibleAbi from '../nonFungibleAbi.json';
@@ -10,7 +10,7 @@
 
 const PRICE = 2000n;
 
-describe.only('Matcher contract usage', () => {
+describe('Matcher contract usage', () => {
   itWeb3('With UNQ', async ({api, web3}) => {
     const matcherOwner = await createEthAccountWithBalance(api, web3);
     const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
@@ -29,11 +29,11 @@
     await confirmSponsorshipExpectSuccess(collectionId);
 
     await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
-    await addToWhiteListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
 
     const seller = privateKey('//Bob');
     await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
-    await addToWhiteListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
 
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
 
@@ -156,11 +156,11 @@
     await confirmSponsorshipExpectSuccess(collectionId);
 
     await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
-    await addToWhiteListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
 
     const seller = privateKey('//Bob');
     await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
-    await addToWhiteListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
 
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);