git.delta.rocks / unique-network / refs/commits / 1fbfeb72b3d2

difftreelog

fix make scheduler test seq

Daniel Shiposha2022-11-09parent: #b17ffdc.patch.diff
in: master

3 files changed

modifiedtests/package.jsondiffbeforeafterboth
before · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/typegen": "9.5.2",8    "@types/chai": "^4.3.3",9    "@types/chai-as-promised": "^7.1.5",10    "@types/chai-like": "^1.1.1",11    "@types/mocha": "^10.0.0",12    "@types/node": "^18.11.2",13    "@typescript-eslint/eslint-plugin": "^5.40.1",14    "@typescript-eslint/parser": "^5.40.1",15    "chai": "^4.3.6",16    "eslint": "^8.25.0",17    "eslint-plugin-mocha": "^10.1.0",18    "mocha": "^10.1.0",19    "ts-node": "^10.9.1",20    "typescript": "^4.8.4"21  },22  "mocha": {23    "timeout": 9999999,24    "require": [25      "ts-node/register"26    ]27  },28  "scripts": {29    "lint": "eslint --ext .ts,.js src/",30    "fix": "eslint --ext .ts,.js src/ --fix",31    "setup": "ts-node ./src/util/globalSetup.ts",32    "test": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.*test.ts'",33    "testParallelFull": "yarn testParallel && yarn testSequential",34    "testParallel": "yarn setup && mocha --parallel --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",35    "testSequential": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.seqtest.ts'",36    "testStructure": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/nesting/*.*test.ts",37    "testEth": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.*test.ts'",38    "testEthNesting": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.*test.ts'",39    "testEthFractionalizer": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.*test.ts'",40    "testEthMarketplace": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.*test.ts'",41    "testEvent": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.*test.ts",42    "testRmrk": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/rmrk/*.*test.ts",43    "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",44    "testEthTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/eth/tokenProperties.test.ts",45    "testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",46    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",47    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",48    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",49    "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",50    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",51    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",52    "testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",53    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",54    "testConfirmSponsorship": "mocha --timeout 9999999 --parallel -r ts-node/register ./**/confirmSponsorship.test.ts",55    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",56    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",57    "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",58    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",59    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",60    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",61    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",62    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",63    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",64    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",65    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",66    "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",67    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",68    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",69    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",70    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",71    "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",72    "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",73    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.seqtest.ts",74    "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/eth/contractSponsoring.test.ts",75    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",76    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",77    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",78    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",79    "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",80    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",81    "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenanceMode.seqtest.ts",82    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",83    "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",84    "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",85    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",86    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",87    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",88    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",89    "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",90    "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",91    "testEthNFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/nonFungible.test.ts",92    "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",93    "testEthRFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/reFungible.test.ts ./**/eth/reFungibleToken.test.ts",94    "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",95    "testEthFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/fungible.test.ts",96    "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",97    "testPromotion": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.*test.ts",98    "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",99    "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",100    "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",101    "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",102    "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",103    "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",104    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",105    "loadTransfer": "ts-node src/transfer.nload.ts",106    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",107    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",108    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",109    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"110  },111  "author": "",112  "license": "SEE LICENSE IN ../LICENSE",113  "homepage": "",114  "dependencies": {115    "@polkadot/api": "9.5.2",116    "@polkadot/util-crypto": "10.1.11",117    "chai-as-promised": "^7.1.1",118    "chai-like": "^1.1.1",119    "find-process": "^1.4.7",120    "solc": "0.8.17",121    "web3": "^1.8.0"122  }123}
after · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/typegen": "9.5.2",8    "@types/chai": "^4.3.3",9    "@types/chai-as-promised": "^7.1.5",10    "@types/chai-like": "^1.1.1",11    "@types/mocha": "^10.0.0",12    "@types/node": "^18.11.2",13    "@typescript-eslint/eslint-plugin": "^5.40.1",14    "@typescript-eslint/parser": "^5.40.1",15    "chai": "^4.3.6",16    "eslint": "^8.25.0",17    "eslint-plugin-mocha": "^10.1.0",18    "mocha": "^10.1.0",19    "ts-node": "^10.9.1",20    "typescript": "^4.8.4"21  },22  "mocha": {23    "timeout": 9999999,24    "require": [25      "ts-node/register"26    ]27  },28  "scripts": {29    "lint": "eslint --ext .ts,.js src/",30    "fix": "eslint --ext .ts,.js src/ --fix",31    "setup": "ts-node ./src/util/globalSetup.ts",32    "test": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.*test.ts'",33    "testParallelFull": "yarn testParallel && yarn testSequential",34    "testParallel": "yarn setup && mocha --parallel --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",35    "testSequential": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.seqtest.ts'",36    "testStructure": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/nesting/*.*test.ts",37    "testEth": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.*test.ts'",38    "testEthNesting": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.*test.ts'",39    "testEthFractionalizer": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.*test.ts'",40    "testEthMarketplace": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.*test.ts'",41    "testEvent": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.*test.ts",42    "testRmrk": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/rmrk/*.*test.ts",43    "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",44    "testEthTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/eth/tokenProperties.test.ts",45    "testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",46    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",47    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",48    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",49    "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",50    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",51    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",52    "testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",53    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",54    "testConfirmSponsorship": "mocha --timeout 9999999 --parallel -r ts-node/register ./**/confirmSponsorship.test.ts",55    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",56    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",57    "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",58    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",59    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",60    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",61    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",62    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",63    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",64    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",65    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",66    "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",67    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",68    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",69    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",70    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",71    "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",72    "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",73    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.seqtest.ts",74    "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/eth/contractSponsoring.test.ts",75    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",76    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",77    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",78    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",79    "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",80    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",81    "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenanceMode.seqtest.ts",82    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",83    "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.seqtest.ts",84    "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",85    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",86    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",87    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",88    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",89    "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",90    "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",91    "testEthNFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/nonFungible.test.ts",92    "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",93    "testEthRFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/reFungible.test.ts ./**/eth/reFungibleToken.test.ts",94    "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",95    "testEthFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/fungible.test.ts",96    "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",97    "testPromotion": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.*test.ts",98    "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",99    "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",100    "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",101    "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",102    "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",103    "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",104    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",105    "loadTransfer": "ts-node src/transfer.nload.ts",106    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",107    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",108    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",109    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"110  },111  "author": "",112  "license": "SEE LICENSE IN ../LICENSE",113  "homepage": "",114  "dependencies": {115    "@polkadot/api": "9.5.2",116    "@polkadot/util-crypto": "10.1.11",117    "chai-as-promised": "^7.1.1",118    "chai-like": "^1.1.1",119    "find-process": "^1.4.7",120    "solc": "0.8.17",121    "web3": "^1.8.0"122  }123}
addedtests/src/scheduler.seqtest.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/scheduler.seqtest.ts
@@ -0,0 +1,742 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
+import {IKeyringPair} from '@polkadot/types/types';
+import {DevUniqueHelper} from './util/playgrounds/unique.dev';
+
+describe('Scheduling token and balance transfers', () => {
+  let superuser: IKeyringPair;
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+  let charlie: IKeyringPair;
+
+  before(async function() {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.Scheduler]);
+
+      superuser = await privateKey('//Alice');
+      const donor = await privateKey({filename: __filename});
+      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+
+      await helper.testUtils.enable();
+    });
+  });
+
+  itSub('Can delay a transfer of an owned token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(alice);
+    const schedulerId = await helper.arrange.makeScheduledId();
+    const blocksBeforeExecution = 4;
+    
+    await token.scheduleAfter(schedulerId, blocksBeforeExecution)
+      .transfer(alice, {Substrate: bob.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
+  });
+
+  itSub('Can transfer funds periodically', async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 1;
+
+    const amount = 1n * helper.balance.getOneTokenNominal();
+    const periodic = {
+      period: 2,
+      repetitions: 2,
+    };
+
+    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
+
+    await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})
+      .balance.transferToSubstrate(alice, bob.address, amount);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const bobsBalanceAfterFirst = await helper.balance.getSubstrate(bob.address);
+    expect(bobsBalanceAfterFirst)
+      .to.be.equal(
+        bobsBalanceBefore + 1n * amount,
+        '#1 Balance of the recipient should be increased by 1 * amount',
+      );
+
+    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
+
+    const bobsBalanceAfterSecond = await helper.balance.getSubstrate(bob.address);
+    expect(bobsBalanceAfterSecond)
+      .to.be.equal(
+        bobsBalanceBefore + 2n * amount,
+        '#2 Balance of the recipient should be increased by 2 * amount',
+      );
+  });
+
+  itSub('Can cancel a scheduled operation which has not yet taken effect', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(alice);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(alice, {Substrate: bob.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.scheduler.cancelScheduled(alice, scheduledId);
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
+  });
+
+  itSub('Can cancel a periodic operation (transfer of funds)', async ({helper}) => {
+    const waitForBlocks = 1;
+    const periodic = {
+      period: 3,
+      repetitions: 2,
+    };
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+
+    const amount = 1n * helper.balance.getOneTokenNominal();
+
+    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
+
+    await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})
+      .balance.transferToSubstrate(alice, bob.address, amount);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const bobsBalanceAfterFirst = await helper.balance.getSubstrate(bob.address);
+
+    expect(bobsBalanceAfterFirst)
+      .to.be.equal(
+        bobsBalanceBefore + 1n * amount,
+        '#1 Balance of the recipient should be increased by 1 * amount',
+      );
+
+    await helper.scheduler.cancelScheduled(alice, scheduledId);
+    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
+
+    const bobsBalanceAfterSecond = await helper.balance.getSubstrate(bob.address);
+    expect(bobsBalanceAfterSecond)
+      .to.be.equal(
+        bobsBalanceAfterFirst,
+        '#2 Balance of the recipient should not be changed',
+      );
+  });
+
+  itSub.ifWithPallets('Scheduled tasks are transactional', [Pallets.TestUtils], async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    const initTestVal = 42;
+    const changedTestVal = 111;
+
+    await helper.testUtils.setTestValue(alice, initTestVal);
+
+    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks)
+      .testUtils.setTestValueAndRollback(alice, changedTestVal);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const testVal = await helper.testUtils.testValue();
+    expect(testVal, 'The test value should NOT be commited')
+      .to.be.equal(initTestVal);
+  });
+
+  itSub.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.TestUtils], async function({helper}) {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+    const periodic = {
+      period: 2,
+      repetitions: 2,
+    };
+
+    const dummyTx = helper.constructApiCall('api.tx.testUtils.justTakeFee', []);
+    const scheduledLen = dummyTx.callIndex.length;
+
+    const expectedScheduledFee = (await helper.getPaymentInfo(alice, dummyTx, scheduledLen))
+      .partialFee.toBigInt();
+
+    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})
+      .testUtils.justTakeFee(alice);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    const aliceInitBalance = await helper.balance.getSubstrate(alice.address);
+    let diff;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const aliceBalanceAfterFirst = await helper.balance.getSubstrate(alice.address);
+    expect(
+      aliceBalanceAfterFirst < aliceInitBalance,
+      '[after execution #1] Scheduled task should take a fee',
+    ).to.be.true;
+
+    diff = aliceInitBalance - aliceBalanceAfterFirst;
+    expect(diff).to.be.equal(
+      expectedScheduledFee,
+      'Scheduled task should take the right amount of fees',
+    );
+
+    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
+
+    const aliceBalanceAfterSecond = await helper.balance.getSubstrate(alice.address);
+    expect(
+      aliceBalanceAfterSecond < aliceBalanceAfterFirst,
+      '[after execution #2] Scheduled task should take a fee',
+    ).to.be.true;
+
+    diff = aliceBalanceAfterFirst - aliceBalanceAfterSecond;
+    expect(diff).to.be.equal(
+      expectedScheduledFee,
+      'Scheduled task should take the right amount of fees',
+    );
+  });
+
+  // Check if we can cancel a scheduled periodic operation
+  // in the same block in which it is running
+  itSub.ifWithPallets('Can cancel the periodic sheduled tx when the tx is running', [Pallets.TestUtils], async ({helper}) => {
+    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
+    const blocksBeforeExecution = 10;
+    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
+
+    const [
+      scheduledId,
+      scheduledCancelId,
+    ] = await helper.arrange.makeScheduledIds(2);
+
+    const periodic = {
+      period: 5,
+      repetitions: 5,
+    };
+
+    const initTestVal = 0;
+    const incTestVal = initTestVal + 1;
+    const finalTestVal = initTestVal + 2;
+
+    await helper.testUtils.setTestValue(alice, initTestVal);
+
+    await helper.scheduler.scheduleAt<DevUniqueHelper>(scheduledId, firstExecutionBlockNumber, {periodic})
+      .testUtils.incTestValue(alice);
+
+    // Cancel the inc tx after 2 executions
+    // *in the same block* in which the second execution is scheduled
+    await helper.scheduler.scheduleAt(
+      scheduledCancelId,
+      firstExecutionBlockNumber + periodic.period,
+    ).scheduler.cancelScheduled(alice, scheduledId);
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
+
+    // execution #0
+    expect(await helper.testUtils.testValue())
+      .to.be.equal(incTestVal);
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period);
+
+    // execution #1
+    expect(await helper.testUtils.testValue())
+      .to.be.equal(finalTestVal);
+
+    for (let i = 1; i < periodic.repetitions; i++) {
+      await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period * (i + 1));
+      expect(await helper.testUtils.testValue())
+        .to.be.equal(finalTestVal);
+    }
+  });
+
+  itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.TestUtils], async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+    const periodic = {
+      period: 2,
+      repetitions: 5,
+    };
+
+    const initTestVal = 0;
+    const maxTestVal = 2;
+
+    await helper.testUtils.setTestValue(alice, initTestVal);
+
+    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})
+      .testUtils.selfCancelingInc(alice, scheduledId, maxTestVal);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    // execution #0
+    expect(await helper.testUtils.testValue())
+      .to.be.equal(initTestVal + 1);
+
+    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
+
+    // execution #1
+    expect(await helper.testUtils.testValue())
+      .to.be.equal(initTestVal + 2);
+
+    await helper.wait.forParachainBlockNumber(executionBlock + 2 * periodic.period);
+
+    // <canceled>
+    expect(await helper.testUtils.testValue())
+      .to.be.equal(initTestVal + 2);
+  });
+
+  itSub('Root can cancel any scheduled operation', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(bob);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(bob, {Substrate: alice.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId);
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
+  });
+
+  itSub('Root can set prioritized scheduled operation', async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    const amount = 42n * helper.balance.getOneTokenNominal();
+
+    const balanceBefore = await helper.balance.getSubstrate(charlie.address);
+
+    await helper.getSudo()
+      .scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42})
+      .balance.forceTransferToSubstrate(superuser, bob.address, charlie.address, amount);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const balanceAfter = await helper.balance.getSubstrate(charlie.address);
+
+    expect(balanceAfter > balanceBefore).to.be.true;
+
+    const diff = balanceAfter - balanceBefore;
+    expect(diff).to.be.equal(amount);
+  });
+
+  itSub("Root can change scheduled operation's priority", async ({helper}) => {
+    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(bob);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 6;
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(bob, {Substrate: alice.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    const priority = 112;
+    await helper.getSudo().scheduler.changePriority(superuser, scheduledId, priority);
+
+    const priorityChanged = await helper.wait.event(
+      waitForBlocks,
+      'scheduler',
+      'PriorityChanged',
+    );
+
+    expect(priorityChanged !== null).to.be.true;
+
+    const [blockNumber, index] = priorityChanged!.event.data[0].toJSON() as any[];
+    expect(blockNumber).to.be.equal(executionBlock);
+    expect(index).to.be.equal(0);
+
+    expect(priorityChanged!.event.data[1].toString()).to.be.equal(priority.toString());
+  });
+
+  itSub('Prioritized operations execute in valid order', async ({helper}) => {
+    const [
+      scheduledFirstId,
+      scheduledSecondId,
+    ] = await helper.arrange.makeScheduledIds(2);
+
+    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
+    const blocksBeforeExecution = 6;
+    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
+
+    const prioHigh = 0;
+    const prioLow = 255;
+
+    const periodic = {
+      period: 6,
+      repetitions: 2,
+    };
+
+    const amount = 1n * helper.balance.getOneTokenNominal();
+
+    // Scheduler a task with a lower priority first, then with a higher priority
+    await helper.getSudo().scheduler.scheduleAt(scheduledFirstId, firstExecutionBlockNumber, {priority: prioLow, periodic})
+      .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
+
+    await helper.getSudo().scheduler.scheduleAt(scheduledSecondId, firstExecutionBlockNumber, {priority: prioHigh, periodic})
+      .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
+
+    const capture = await helper.arrange.captureEvents('scheduler', 'Dispatched');
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
+
+    // Flip priorities
+    await helper.getSudo().scheduler.changePriority(superuser, scheduledFirstId, prioHigh);
+    await helper.getSudo().scheduler.changePriority(superuser, scheduledSecondId, prioLow);
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period);
+
+    const dispatchEvents = capture.extractCapturedEvents();
+    expect(dispatchEvents.length).to.be.equal(4);
+
+    const dispatchedIds = dispatchEvents.map(r => r.event.data[1].toString());
+
+    const firstExecuctionIds = [dispatchedIds[0], dispatchedIds[1]];
+    const secondExecuctionIds = [dispatchedIds[2], dispatchedIds[3]];
+
+    expect(firstExecuctionIds[0]).to.be.equal(scheduledSecondId);
+    expect(firstExecuctionIds[1]).to.be.equal(scheduledFirstId);
+
+    expect(secondExecuctionIds[0]).to.be.equal(scheduledFirstId);
+    expect(secondExecuctionIds[1]).to.be.equal(scheduledSecondId);
+  });
+
+  itSub('Periodic operations always can be rescheduled', async ({helper}) => {
+    const maxScheduledPerBlock = 50;
+    const numFilledBlocks = 3;
+    const ids = await helper.arrange.makeScheduledIds(numFilledBlocks * maxScheduledPerBlock + 1);
+    const periodicId = ids[0];
+    const fillIds = ids.slice(1);
+
+    const initTestVal = 0;
+    const firstExecTestVal = 1;
+    const secondExecTestVal = 2;
+    await helper.testUtils.setTestValue(alice, initTestVal);
+
+    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
+    const blocksBeforeExecution = 8;
+    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
+
+    const period = 5;
+
+    const periodic = {
+      period,
+      repetitions: 2,
+    };
+
+    // Fill `numFilledBlocks` blocks beginning from the block in which the second execution should occur
+    const txs = [];
+    for (let offset = 0; offset < numFilledBlocks; offset ++) {
+      for (let i = 0; i < maxScheduledPerBlock; i++) {
+
+        const scheduledTx = helper.constructApiCall('api.tx.balances.transfer', [bob.address, 1n]);
+
+        const when = firstExecutionBlockNumber + period + offset;
+        const tx = helper.constructApiCall('api.tx.scheduler.scheduleNamed', [fillIds[i + offset * maxScheduledPerBlock], when, null, null, scheduledTx]);
+
+        txs.push(tx);
+      }
+    }
+    await helper.executeExtrinsic(alice, 'api.tx.testUtils.batchAll', [txs], true);
+
+    await helper.scheduler.scheduleAt<DevUniqueHelper>(periodicId, firstExecutionBlockNumber, {periodic})
+      .testUtils.incTestValue(alice);
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
+    expect(await helper.testUtils.testValue()).to.be.equal(firstExecTestVal);
+
+    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + period + numFilledBlocks);
+
+    // The periodic operation should be postponed by `numFilledBlocks`
+    for (let i = 0; i < numFilledBlocks; i++) {
+      expect(await helper.testUtils.testValue(firstExecutionBlockNumber + period + i)).to.be.equal(firstExecTestVal);
+    }
+
+    // After the `numFilledBlocks` the periodic operation will eventually be executed
+    expect(await helper.testUtils.testValue()).to.be.equal(secondExecTestVal);
+  });
+
+  itSub('scheduled operations does not change nonce', async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const blocksBeforeExecution = 4;
+
+    await helper.scheduler
+      .scheduleAfter<DevUniqueHelper>(scheduledId, blocksBeforeExecution)
+      .balance.transferToSubstrate(alice, bob.address, 1n);
+    const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
+
+    const initNonce = await helper.chain.getNonce(alice.address);
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const finalNonce = await helper.chain.getNonce(alice.address);
+
+    expect(initNonce).to.be.equal(finalNonce);
+  });
+});
+
+describe('Negative Test: Scheduling', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+
+  before(async function() {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.Scheduler]);
+
+      const donor = await privateKey({filename: __filename});
+      [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
+
+      await helper.testUtils.enable();
+    });
+  });
+
+  itSub("Can't overwrite a scheduled ID", async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(alice);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(alice, {Substrate: bob.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks);
+    await expect(scheduled.balance.transferToSubstrate(alice, bob.address, 1n * helper.balance.getOneTokenNominal()))
+      .to.be.rejectedWith(/scheduler\.FailedToSchedule/);
+
+    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const bobsBalanceAfter = await helper.balance.getSubstrate(bob.address);
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
+    expect(bobsBalanceBefore).to.be.equal(bobsBalanceAfter);
+  });
+
+  itSub("Can't cancel an operation which is not scheduled", async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    await expect(helper.scheduler.cancelScheduled(alice, scheduledId))
+      .to.be.rejectedWith(/scheduler\.NotFound/);
+  });
+
+  itSub("Can't cancel a non-owned scheduled operation", async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(alice);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(alice, {Substrate: bob.address});
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await expect(helper.scheduler.cancelScheduled(bob, scheduledId))
+      .to.be.rejectedWith(/BadOrigin/);
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
+  });
+
+  itSub("Regular user can't set prioritized scheduled operation", async ({helper}) => {
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    const amount = 42n * helper.balance.getOneTokenNominal();
+
+    const balanceBefore = await helper.balance.getSubstrate(bob.address);
+
+    const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42});
+    
+    await expect(scheduled.balance.transferToSubstrate(alice, bob.address, amount))
+      .to.be.rejectedWith(/BadOrigin/);
+
+    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
+
+    await helper.wait.forParachainBlockNumber(executionBlock);
+
+    const balanceAfter = await helper.balance.getSubstrate(bob.address);
+
+    expect(balanceAfter).to.be.equal(balanceBefore);
+  });
+
+  itSub("Regular user can't change scheduled operation's priority", async ({helper}) => {
+    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
+    const token = await collection.mintToken(bob);
+
+    const scheduledId = await helper.arrange.makeScheduledId();
+    const waitForBlocks = 4;
+
+    await token.scheduleAfter(scheduledId, waitForBlocks)
+      .transfer(bob, {Substrate: alice.address});
+
+    const priority = 112;
+    await expect(helper.scheduler.changePriority(alice, scheduledId, priority))
+      .to.be.rejectedWith(/BadOrigin/);
+
+    const priorityChanged = await helper.wait.event(
+      waitForBlocks,
+      'scheduler',
+      'PriorityChanged',
+    );
+
+    expect(priorityChanged === null).to.be.true;
+  });
+});
+
+// Implementation of the functionality tested here was postponed/shelved
+describe.skip('Sponsoring scheduling', () => {
+  // let alice: IKeyringPair;
+  // let bob: IKeyringPair;
+
+  // before(async() => {
+  //   await usingApi(async (_, privateKey) => {
+  //     alice = privateKey('//Alice');
+  //     bob = privateKey('//Bob');
+  //   });
+  // });
+
+  it('Can sponsor scheduling a transaction', async () => {
+    // const collectionId = await createCollectionExpectSuccess();
+    // await setCollectionSponsorExpectSuccess(collectionId, bob.address);
+    // await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+
+    // await usingApi(async api => {
+    //   const scheduledId = await makeScheduledId();
+    //   const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
+
+    //   const bobBalanceBefore = await getFreeBalance(bob);
+    //   const waitForBlocks = 4;
+    //   // no need to wait to check, fees must be deducted on scheduling, immediately
+    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, alice, bob, 0, waitForBlocks, scheduledId);
+    //   const bobBalanceAfter = await getFreeBalance(bob);
+    //   // expect(aliceBalanceAfter == aliceBalanceBefore).to.be.true;
+    //   expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
+    //   // wait for sequentiality matters
+    //   await waitNewBlocks(waitForBlocks - 1);
+    // });
+  });
+
+  it('Schedules and dispatches a transaction even if the caller has no funds at the time of the dispatch', async () => {
+    // await usingApi(async (api, privateKey) => {
+    //   // Find an empty, unused account
+    //   const zeroBalance = await findUnusedAddress(api, privateKey);
+
+    //   const collectionId = await createCollectionExpectSuccess();
+
+    //   // Add zeroBalance address to allow list
+    //   await enablePublicMintingExpectSuccess(alice, collectionId);
+    //   await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
+
+    //   // Grace zeroBalance with money, enough to cover future transactions
+    //   const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
+    //   await submitTransactionAsync(alice, balanceTx);
+
+    //   // Mint a fresh NFT
+    //   const tokenId = await createItemExpectSuccess(zeroBalance, collectionId, 'NFT');
+    //   const scheduledId = await makeScheduledId();
+
+    //   // Schedule transfer of the NFT a few blocks ahead
+    //   const waitForBlocks = 5;
+    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, zeroBalance, alice, 1, waitForBlocks, scheduledId);
+
+    //   // Get rid of the account's funds before the scheduled transaction takes place
+    //   const balanceTx2 = api.tx.balances.transfer(alice.address, UNIQUE * 68n / 100n);
+    //   const events = await submitTransactionAsync(zeroBalance, balanceTx2);
+    //   expect(getGenericResult(events).success).to.be.true;
+    //   /*const emptyBalanceTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0); // do not null reserved?
+    //   const sudoTx = api.tx.sudo.sudo(emptyBalanceTx as any);
+    //   const events = await submitTransactionAsync(alice, sudoTx);
+    //   expect(getGenericResult(events).success).to.be.true;*/
+
+    //   // Wait for a certain number of blocks, discarding the ones that already happened while accepting the late transactions
+    //   await waitNewBlocks(waitForBlocks - 3);
+
+    //   expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));
+    // });
+  });
+
+  it('Sponsor going bankrupt does not impact a scheduled transaction', async () => {
+    // const collectionId = await createCollectionExpectSuccess();
+
+    // await usingApi(async (api, privateKey) => {
+    //   const zeroBalance = await findUnusedAddress(api, privateKey);
+    //   const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
+    //   await submitTransactionAsync(alice, balanceTx);
+
+    //   await setCollectionSponsorExpectSuccess(collectionId, zeroBalance.address);
+    //   await confirmSponsorshipByKeyExpectSuccess(collectionId, zeroBalance);
+
+    //   const scheduledId = await makeScheduledId();
+    //   const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
+
+    //   const waitForBlocks = 5;
+    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, alice, zeroBalance, 1, waitForBlocks, scheduledId);
+
+    //   const emptyBalanceSponsorTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0);
+    //   const sudoTx = api.tx.sudo.sudo(emptyBalanceSponsorTx as any);
+    //   const events = await submitTransactionAsync(alice, sudoTx);
+    //   expect(getGenericResult(events).success).to.be.true;
+
+    //   // Wait for a certain number of blocks, save for the ones that already happened while accepting the late transactions
+    //   await waitNewBlocks(waitForBlocks - 3);
+
+    //   expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(zeroBalance.address));
+    // });
+  });
+
+  it('Exceeding sponsor rate limit without having enough funds prevents scheduling a periodic transaction', async () => {
+    // const collectionId = await createCollectionExpectSuccess();
+    // await setCollectionSponsorExpectSuccess(collectionId, bob.address);
+    // await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+
+    // await usingApi(async (api, privateKey) => {
+    //   const zeroBalance = await findUnusedAddress(api, privateKey);
+
+    //   await enablePublicMintingExpectSuccess(alice, collectionId);
+    //   await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
+
+    //   const bobBalanceBefore = await getFreeBalance(bob);
+
+    //   const createData = {nft: {const_data: [], variable_data: []}};
+    //   const creationTx = api.tx.unique.createItem(collectionId, normalizeAccountId(zeroBalance), createData as any);
+    //   const scheduledId = await makeScheduledId();
+
+    //   /*const badTransaction = async function () {
+    //     await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
+    //   };
+    //   await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');*/
+
+    //   await expect(scheduleAfter(api, creationTx, zeroBalance, 3, scheduledId, 1, 3)).to.be.rejectedWith(/Inability to pay some fees/);
+
+    //   expect(await getFreeBalance(bob)).to.be.equal(bobBalanceBefore);
+    // });
+  });
+});
deletedtests/src/scheduler.test.tsdiffbeforeafterboth
--- a/tests/src/scheduler.test.ts
+++ /dev/null
@@ -1,742 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
-import {IKeyringPair} from '@polkadot/types/types';
-import {DevUniqueHelper} from './util/playgrounds/unique.dev';
-
-describe('Scheduling token and balance transfers', () => {
-  let superuser: IKeyringPair;
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
-
-  before(async function() {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      requirePalletsOrSkip(this, helper, [Pallets.Scheduler]);
-
-      superuser = await privateKey('//Alice');
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
-
-      await helper.testUtils.enable();
-    });
-  });
-
-  itSub('Can delay a transfer of an owned token', async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(alice);
-    const schedulerId = await helper.arrange.makeScheduledId();
-    const blocksBeforeExecution = 4;
-    
-    await token.scheduleAfter(schedulerId, blocksBeforeExecution)
-      .transfer(alice, {Substrate: bob.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
-  });
-
-  itSub('Can transfer funds periodically', async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 1;
-
-    const amount = 1n * helper.balance.getOneTokenNominal();
-    const periodic = {
-      period: 2,
-      repetitions: 2,
-    };
-
-    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
-
-    await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})
-      .balance.transferToSubstrate(alice, bob.address, amount);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const bobsBalanceAfterFirst = await helper.balance.getSubstrate(bob.address);
-    expect(bobsBalanceAfterFirst)
-      .to.be.equal(
-        bobsBalanceBefore + 1n * amount,
-        '#1 Balance of the recipient should be increased by 1 * amount',
-      );
-
-    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
-
-    const bobsBalanceAfterSecond = await helper.balance.getSubstrate(bob.address);
-    expect(bobsBalanceAfterSecond)
-      .to.be.equal(
-        bobsBalanceBefore + 2n * amount,
-        '#2 Balance of the recipient should be increased by 2 * amount',
-      );
-  });
-
-  itSub('Can cancel a scheduled operation which has not yet taken effect', async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(alice);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(alice, {Substrate: bob.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.scheduler.cancelScheduled(alice, scheduledId);
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
-  });
-
-  itSub('Can cancel a periodic operation (transfer of funds)', async ({helper}) => {
-    const waitForBlocks = 1;
-    const periodic = {
-      period: 3,
-      repetitions: 2,
-    };
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-
-    const amount = 1n * helper.balance.getOneTokenNominal();
-
-    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
-
-    await helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {periodic})
-      .balance.transferToSubstrate(alice, bob.address, amount);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const bobsBalanceAfterFirst = await helper.balance.getSubstrate(bob.address);
-
-    expect(bobsBalanceAfterFirst)
-      .to.be.equal(
-        bobsBalanceBefore + 1n * amount,
-        '#1 Balance of the recipient should be increased by 1 * amount',
-      );
-
-    await helper.scheduler.cancelScheduled(alice, scheduledId);
-    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
-
-    const bobsBalanceAfterSecond = await helper.balance.getSubstrate(bob.address);
-    expect(bobsBalanceAfterSecond)
-      .to.be.equal(
-        bobsBalanceAfterFirst,
-        '#2 Balance of the recipient should not be changed',
-      );
-  });
-
-  itSub.ifWithPallets('Scheduled tasks are transactional', [Pallets.TestUtils], async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    const initTestVal = 42;
-    const changedTestVal = 111;
-
-    await helper.testUtils.setTestValue(alice, initTestVal);
-
-    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks)
-      .testUtils.setTestValueAndRollback(alice, changedTestVal);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const testVal = await helper.testUtils.testValue();
-    expect(testVal, 'The test value should NOT be commited')
-      .to.be.equal(initTestVal);
-  });
-
-  itSub.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.TestUtils], async function({helper}) {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-    const periodic = {
-      period: 2,
-      repetitions: 2,
-    };
-
-    const dummyTx = helper.constructApiCall('api.tx.testUtils.justTakeFee', []);
-    const scheduledLen = dummyTx.callIndex.length;
-
-    const expectedScheduledFee = (await helper.getPaymentInfo(alice, dummyTx, scheduledLen))
-      .partialFee.toBigInt();
-
-    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})
-      .testUtils.justTakeFee(alice);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    const aliceInitBalance = await helper.balance.getSubstrate(alice.address);
-    let diff;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const aliceBalanceAfterFirst = await helper.balance.getSubstrate(alice.address);
-    expect(
-      aliceBalanceAfterFirst < aliceInitBalance,
-      '[after execution #1] Scheduled task should take a fee',
-    ).to.be.true;
-
-    diff = aliceInitBalance - aliceBalanceAfterFirst;
-    expect(diff).to.be.equal(
-      expectedScheduledFee,
-      'Scheduled task should take the right amount of fees',
-    );
-
-    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
-
-    const aliceBalanceAfterSecond = await helper.balance.getSubstrate(alice.address);
-    expect(
-      aliceBalanceAfterSecond < aliceBalanceAfterFirst,
-      '[after execution #2] Scheduled task should take a fee',
-    ).to.be.true;
-
-    diff = aliceBalanceAfterFirst - aliceBalanceAfterSecond;
-    expect(diff).to.be.equal(
-      expectedScheduledFee,
-      'Scheduled task should take the right amount of fees',
-    );
-  });
-
-  // Check if we can cancel a scheduled periodic operation
-  // in the same block in which it is running
-  itSub.ifWithPallets('Can cancel the periodic sheduled tx when the tx is running', [Pallets.TestUtils], async ({helper}) => {
-    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
-    const blocksBeforeExecution = 10;
-    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
-
-    const [
-      scheduledId,
-      scheduledCancelId,
-    ] = await helper.arrange.makeScheduledIds(2);
-
-    const periodic = {
-      period: 5,
-      repetitions: 5,
-    };
-
-    const initTestVal = 0;
-    const incTestVal = initTestVal + 1;
-    const finalTestVal = initTestVal + 2;
-
-    await helper.testUtils.setTestValue(alice, initTestVal);
-
-    await helper.scheduler.scheduleAt<DevUniqueHelper>(scheduledId, firstExecutionBlockNumber, {periodic})
-      .testUtils.incTestValue(alice);
-
-    // Cancel the inc tx after 2 executions
-    // *in the same block* in which the second execution is scheduled
-    await helper.scheduler.scheduleAt(
-      scheduledCancelId,
-      firstExecutionBlockNumber + periodic.period,
-    ).scheduler.cancelScheduled(alice, scheduledId);
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
-
-    // execution #0
-    expect(await helper.testUtils.testValue())
-      .to.be.equal(incTestVal);
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period);
-
-    // execution #1
-    expect(await helper.testUtils.testValue())
-      .to.be.equal(finalTestVal);
-
-    for (let i = 1; i < periodic.repetitions; i++) {
-      await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period * (i + 1));
-      expect(await helper.testUtils.testValue())
-        .to.be.equal(finalTestVal);
-    }
-  });
-
-  itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.TestUtils], async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-    const periodic = {
-      period: 2,
-      repetitions: 5,
-    };
-
-    const initTestVal = 0;
-    const maxTestVal = 2;
-
-    await helper.testUtils.setTestValue(alice, initTestVal);
-
-    await helper.scheduler.scheduleAfter<DevUniqueHelper>(scheduledId, waitForBlocks, {periodic})
-      .testUtils.selfCancelingInc(alice, scheduledId, maxTestVal);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    // execution #0
-    expect(await helper.testUtils.testValue())
-      .to.be.equal(initTestVal + 1);
-
-    await helper.wait.forParachainBlockNumber(executionBlock + periodic.period);
-
-    // execution #1
-    expect(await helper.testUtils.testValue())
-      .to.be.equal(initTestVal + 2);
-
-    await helper.wait.forParachainBlockNumber(executionBlock + 2 * periodic.period);
-
-    // <canceled>
-    expect(await helper.testUtils.testValue())
-      .to.be.equal(initTestVal + 2);
-  });
-
-  itSub('Root can cancel any scheduled operation', async ({helper}) => {
-    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(bob);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(bob, {Substrate: alice.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId);
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
-  });
-
-  itSub('Root can set prioritized scheduled operation', async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    const amount = 42n * helper.balance.getOneTokenNominal();
-
-    const balanceBefore = await helper.balance.getSubstrate(charlie.address);
-
-    await helper.getSudo()
-      .scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42})
-      .balance.forceTransferToSubstrate(superuser, bob.address, charlie.address, amount);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const balanceAfter = await helper.balance.getSubstrate(charlie.address);
-
-    expect(balanceAfter > balanceBefore).to.be.true;
-
-    const diff = balanceAfter - balanceBefore;
-    expect(diff).to.be.equal(amount);
-  });
-
-  itSub("Root can change scheduled operation's priority", async ({helper}) => {
-    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(bob);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 6;
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(bob, {Substrate: alice.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    const priority = 112;
-    await helper.getSudo().scheduler.changePriority(superuser, scheduledId, priority);
-
-    const priorityChanged = await helper.wait.event(
-      waitForBlocks,
-      'scheduler',
-      'PriorityChanged',
-    );
-
-    expect(priorityChanged !== null).to.be.true;
-
-    const [blockNumber, index] = priorityChanged!.event.data[0].toJSON() as any[];
-    expect(blockNumber).to.be.equal(executionBlock);
-    expect(index).to.be.equal(0);
-
-    expect(priorityChanged!.event.data[1].toString()).to.be.equal(priority.toString());
-  });
-
-  itSub('Prioritized operations execute in valid order', async ({helper}) => {
-    const [
-      scheduledFirstId,
-      scheduledSecondId,
-    ] = await helper.arrange.makeScheduledIds(2);
-
-    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
-    const blocksBeforeExecution = 6;
-    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
-
-    const prioHigh = 0;
-    const prioLow = 255;
-
-    const periodic = {
-      period: 6,
-      repetitions: 2,
-    };
-
-    const amount = 1n * helper.balance.getOneTokenNominal();
-
-    // Scheduler a task with a lower priority first, then with a higher priority
-    await helper.getSudo().scheduler.scheduleAt(scheduledFirstId, firstExecutionBlockNumber, {priority: prioLow, periodic})
-      .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
-
-    await helper.getSudo().scheduler.scheduleAt(scheduledSecondId, firstExecutionBlockNumber, {priority: prioHigh, periodic})
-      .balance.forceTransferToSubstrate(superuser, alice.address, bob.address, amount);
-
-    const capture = await helper.arrange.captureEvents('scheduler', 'Dispatched');
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
-
-    // Flip priorities
-    await helper.getSudo().scheduler.changePriority(superuser, scheduledFirstId, prioHigh);
-    await helper.getSudo().scheduler.changePriority(superuser, scheduledSecondId, prioLow);
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + periodic.period);
-
-    const dispatchEvents = capture.extractCapturedEvents();
-    expect(dispatchEvents.length).to.be.equal(4);
-
-    const dispatchedIds = dispatchEvents.map(r => r.event.data[1].toString());
-
-    const firstExecuctionIds = [dispatchedIds[0], dispatchedIds[1]];
-    const secondExecuctionIds = [dispatchedIds[2], dispatchedIds[3]];
-
-    expect(firstExecuctionIds[0]).to.be.equal(scheduledSecondId);
-    expect(firstExecuctionIds[1]).to.be.equal(scheduledFirstId);
-
-    expect(secondExecuctionIds[0]).to.be.equal(scheduledFirstId);
-    expect(secondExecuctionIds[1]).to.be.equal(scheduledSecondId);
-  });
-
-  itSub('Periodic operations always can be rescheduled', async ({helper}) => {
-    const maxScheduledPerBlock = 50;
-    const numFilledBlocks = 3;
-    const ids = await helper.arrange.makeScheduledIds(numFilledBlocks * maxScheduledPerBlock + 1);
-    const periodicId = ids[0];
-    const fillIds = ids.slice(1);
-
-    const initTestVal = 0;
-    const firstExecTestVal = 1;
-    const secondExecTestVal = 2;
-    await helper.testUtils.setTestValue(alice, initTestVal);
-
-    const currentBlockNumber = await helper.chain.getLatestBlockNumber();
-    const blocksBeforeExecution = 8;
-    const firstExecutionBlockNumber = currentBlockNumber + blocksBeforeExecution;
-
-    const period = 5;
-
-    const periodic = {
-      period,
-      repetitions: 2,
-    };
-
-    // Fill `numFilledBlocks` blocks beginning from the block in which the second execution should occur
-    const txs = [];
-    for (let offset = 0; offset < numFilledBlocks; offset ++) {
-      for (let i = 0; i < maxScheduledPerBlock; i++) {
-
-        const scheduledTx = helper.constructApiCall('api.tx.balances.transfer', [bob.address, 1n]);
-
-        const when = firstExecutionBlockNumber + period + offset;
-        const tx = helper.constructApiCall('api.tx.scheduler.scheduleNamed', [fillIds[i + offset * maxScheduledPerBlock], when, null, null, scheduledTx]);
-
-        txs.push(tx);
-      }
-    }
-    await helper.executeExtrinsic(alice, 'api.tx.testUtils.batchAll', [txs], true);
-
-    await helper.scheduler.scheduleAt<DevUniqueHelper>(periodicId, firstExecutionBlockNumber, {periodic})
-      .testUtils.incTestValue(alice);
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber);
-    expect(await helper.testUtils.testValue()).to.be.equal(firstExecTestVal);
-
-    await helper.wait.forParachainBlockNumber(firstExecutionBlockNumber + period + numFilledBlocks);
-
-    // The periodic operation should be postponed by `numFilledBlocks`
-    for (let i = 0; i < numFilledBlocks; i++) {
-      expect(await helper.testUtils.testValue(firstExecutionBlockNumber + period + i)).to.be.equal(firstExecTestVal);
-    }
-
-    // After the `numFilledBlocks` the periodic operation will eventually be executed
-    expect(await helper.testUtils.testValue()).to.be.equal(secondExecTestVal);
-  });
-
-  itSub('scheduled operations does not change nonce', async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const blocksBeforeExecution = 4;
-
-    await helper.scheduler
-      .scheduleAfter<DevUniqueHelper>(scheduledId, blocksBeforeExecution)
-      .balance.transferToSubstrate(alice, bob.address, 1n);
-    const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
-
-    const initNonce = await helper.chain.getNonce(alice.address);
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const finalNonce = await helper.chain.getNonce(alice.address);
-
-    expect(initNonce).to.be.equal(finalNonce);
-  });
-});
-
-describe('Negative Test: Scheduling', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-
-  before(async function() {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      requirePalletsOrSkip(this, helper, [Pallets.Scheduler]);
-
-      const donor = await privateKey({filename: __filename});
-      [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
-
-      await helper.testUtils.enable();
-    });
-  });
-
-  itSub("Can't overwrite a scheduled ID", async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(alice);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(alice, {Substrate: bob.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks);
-    await expect(scheduled.balance.transferToSubstrate(alice, bob.address, 1n * helper.balance.getOneTokenNominal()))
-      .to.be.rejectedWith(/scheduler\.FailedToSchedule/);
-
-    const bobsBalanceBefore = await helper.balance.getSubstrate(bob.address);
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const bobsBalanceAfter = await helper.balance.getSubstrate(bob.address);
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
-    expect(bobsBalanceBefore).to.be.equal(bobsBalanceAfter);
-  });
-
-  itSub("Can't cancel an operation which is not scheduled", async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    await expect(helper.scheduler.cancelScheduled(alice, scheduledId))
-      .to.be.rejectedWith(/scheduler\.NotFound/);
-  });
-
-  itSub("Can't cancel a non-owned scheduled operation", async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(alice);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(alice, {Substrate: bob.address});
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await expect(helper.scheduler.cancelScheduled(bob, scheduledId))
-      .to.be.rejectedWith(/BadOrigin/);
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    expect(await token.getOwner()).to.be.deep.equal({Substrate: bob.address});
-  });
-
-  itSub("Regular user can't set prioritized scheduled operation", async ({helper}) => {
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    const amount = 42n * helper.balance.getOneTokenNominal();
-
-    const balanceBefore = await helper.balance.getSubstrate(bob.address);
-
-    const scheduled = helper.scheduler.scheduleAfter(scheduledId, waitForBlocks, {priority: 42});
-    
-    await expect(scheduled.balance.transferToSubstrate(alice, bob.address, amount))
-      .to.be.rejectedWith(/BadOrigin/);
-
-    const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
-
-    await helper.wait.forParachainBlockNumber(executionBlock);
-
-    const balanceAfter = await helper.balance.getSubstrate(bob.address);
-
-    expect(balanceAfter).to.be.equal(balanceBefore);
-  });
-
-  itSub("Regular user can't change scheduled operation's priority", async ({helper}) => {
-    const collection = await helper.nft.mintCollection(bob, {tokenPrefix: 'schd'});
-    const token = await collection.mintToken(bob);
-
-    const scheduledId = await helper.arrange.makeScheduledId();
-    const waitForBlocks = 4;
-
-    await token.scheduleAfter(scheduledId, waitForBlocks)
-      .transfer(bob, {Substrate: alice.address});
-
-    const priority = 112;
-    await expect(helper.scheduler.changePriority(alice, scheduledId, priority))
-      .to.be.rejectedWith(/BadOrigin/);
-
-    const priorityChanged = await helper.wait.event(
-      waitForBlocks,
-      'scheduler',
-      'PriorityChanged',
-    );
-
-    expect(priorityChanged === null).to.be.true;
-  });
-});
-
-// Implementation of the functionality tested here was postponed/shelved
-describe.skip('Sponsoring scheduling', () => {
-  // let alice: IKeyringPair;
-  // let bob: IKeyringPair;
-
-  // before(async() => {
-  //   await usingApi(async (_, privateKey) => {
-  //     alice = privateKey('//Alice');
-  //     bob = privateKey('//Bob');
-  //   });
-  // });
-
-  it('Can sponsor scheduling a transaction', async () => {
-    // const collectionId = await createCollectionExpectSuccess();
-    // await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    // await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    // await usingApi(async api => {
-    //   const scheduledId = await makeScheduledId();
-    //   const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
-
-    //   const bobBalanceBefore = await getFreeBalance(bob);
-    //   const waitForBlocks = 4;
-    //   // no need to wait to check, fees must be deducted on scheduling, immediately
-    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, alice, bob, 0, waitForBlocks, scheduledId);
-    //   const bobBalanceAfter = await getFreeBalance(bob);
-    //   // expect(aliceBalanceAfter == aliceBalanceBefore).to.be.true;
-    //   expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
-    //   // wait for sequentiality matters
-    //   await waitNewBlocks(waitForBlocks - 1);
-    // });
-  });
-
-  it('Schedules and dispatches a transaction even if the caller has no funds at the time of the dispatch', async () => {
-    // await usingApi(async (api, privateKey) => {
-    //   // Find an empty, unused account
-    //   const zeroBalance = await findUnusedAddress(api, privateKey);
-
-    //   const collectionId = await createCollectionExpectSuccess();
-
-    //   // Add zeroBalance address to allow list
-    //   await enablePublicMintingExpectSuccess(alice, collectionId);
-    //   await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
-
-    //   // Grace zeroBalance with money, enough to cover future transactions
-    //   const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-    //   await submitTransactionAsync(alice, balanceTx);
-
-    //   // Mint a fresh NFT
-    //   const tokenId = await createItemExpectSuccess(zeroBalance, collectionId, 'NFT');
-    //   const scheduledId = await makeScheduledId();
-
-    //   // Schedule transfer of the NFT a few blocks ahead
-    //   const waitForBlocks = 5;
-    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, zeroBalance, alice, 1, waitForBlocks, scheduledId);
-
-    //   // Get rid of the account's funds before the scheduled transaction takes place
-    //   const balanceTx2 = api.tx.balances.transfer(alice.address, UNIQUE * 68n / 100n);
-    //   const events = await submitTransactionAsync(zeroBalance, balanceTx2);
-    //   expect(getGenericResult(events).success).to.be.true;
-    //   /*const emptyBalanceTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0); // do not null reserved?
-    //   const sudoTx = api.tx.sudo.sudo(emptyBalanceTx as any);
-    //   const events = await submitTransactionAsync(alice, sudoTx);
-    //   expect(getGenericResult(events).success).to.be.true;*/
-
-    //   // Wait for a certain number of blocks, discarding the ones that already happened while accepting the late transactions
-    //   await waitNewBlocks(waitForBlocks - 3);
-
-    //   expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));
-    // });
-  });
-
-  it('Sponsor going bankrupt does not impact a scheduled transaction', async () => {
-    // const collectionId = await createCollectionExpectSuccess();
-
-    // await usingApi(async (api, privateKey) => {
-    //   const zeroBalance = await findUnusedAddress(api, privateKey);
-    //   const balanceTx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-    //   await submitTransactionAsync(alice, balanceTx);
-
-    //   await setCollectionSponsorExpectSuccess(collectionId, zeroBalance.address);
-    //   await confirmSponsorshipByKeyExpectSuccess(collectionId, zeroBalance);
-
-    //   const scheduledId = await makeScheduledId();
-    //   const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
-
-    //   const waitForBlocks = 5;
-    //   await scheduleTransferExpectSuccess(api, collectionId, tokenId, alice, zeroBalance, 1, waitForBlocks, scheduledId);
-
-    //   const emptyBalanceSponsorTx = api.tx.balances.setBalance(zeroBalance.address, 0, 0);
-    //   const sudoTx = api.tx.sudo.sudo(emptyBalanceSponsorTx as any);
-    //   const events = await submitTransactionAsync(alice, sudoTx);
-    //   expect(getGenericResult(events).success).to.be.true;
-
-    //   // Wait for a certain number of blocks, save for the ones that already happened while accepting the late transactions
-    //   await waitNewBlocks(waitForBlocks - 3);
-
-    //   expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(zeroBalance.address));
-    // });
-  });
-
-  it('Exceeding sponsor rate limit without having enough funds prevents scheduling a periodic transaction', async () => {
-    // const collectionId = await createCollectionExpectSuccess();
-    // await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    // await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    // await usingApi(async (api, privateKey) => {
-    //   const zeroBalance = await findUnusedAddress(api, privateKey);
-
-    //   await enablePublicMintingExpectSuccess(alice, collectionId);
-    //   await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
-
-    //   const bobBalanceBefore = await getFreeBalance(bob);
-
-    //   const createData = {nft: {const_data: [], variable_data: []}};
-    //   const creationTx = api.tx.unique.createItem(collectionId, normalizeAccountId(zeroBalance), createData as any);
-    //   const scheduledId = await makeScheduledId();
-
-    //   /*const badTransaction = async function () {
-    //     await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
-    //   };
-    //   await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');*/
-
-    //   await expect(scheduleAfter(api, creationTx, zeroBalance, 3, scheduledId, 1, 3)).to.be.rejectedWith(/Inability to pay some fees/);
-
-    //   expect(await getFreeBalance(bob)).to.be.equal(bobBalanceBefore);
-    // });
-  });
-});