git.delta.rocks / unique-network / refs/commits / 39148f6db4ae

difftreelog

Merge pull request #665 from UniqueNetwork/tests/fix-eslint

ut-akuznetsov2022-10-19parents: #2e3c4de #f921c01.patch.diff
in: master
Fix eslint errors

8 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6711,24 +6711,6 @@
 ]
 
 [[package]]
-name = "pallet-unique-scheduler-v2"
-version = "0.1.0"
-dependencies = [
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "log",
- "pallet-preimage",
- "parity-scale-codec 3.2.1",
- "scale-info",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
- "substrate-test-utils",
-]
-
-[[package]]
 name = "pallet-utility"
 version = "4.0.0-dev"
 source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe"
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -14,8 +14,6 @@
 // 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 {Contract} from 'web3-eth-contract';
-
 import {IKeyringPair} from '@polkadot/types/types';
 import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from './util';
 
@@ -44,7 +42,7 @@
       from: userA,
       to: userB,
       value: '1000000',
-      gas: helper.eth.DEFAULT_GAS
+      gas: helper.eth.DEFAULT_GAS,
     }));
     const balanceB = await helper.balance.getEthereum(userB);
     expect(cost - balanceB < BigInt(0.2 * Number(helper.balance.getOneTokenNominal()))).to.be.true;
@@ -93,7 +91,7 @@
       const donor = await privateKey({filename: __filename});
       const [alice] = await helper.arrange.createAccounts([10n], donor);
       ({collectionId: simpleNftCollectionId} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}));
-      minter = helper.eth.createAccount();
+      minter = await helper.eth.createAccountWithBalance(donor);
       ({collectionId: erc721MetadataCompatibleNftCollectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(minter, 'n', 'd', 'p', BASE_URI));
     });
   });
modifiedtests/src/eth/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -18,7 +18,6 @@
 import {Pallets} from '../util';
 import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';
 import {IKeyringPair} from '@polkadot/types/types';
-import {Contract} from 'web3-eth-contract';
 
 describe('EVM collection properties', () => {
   let donor: IKeyringPair;
@@ -87,20 +86,20 @@
     const caller = await helper.eth.createAccountWithBalance(donor);
     const bruh = await helper.eth.createAccountWithBalance(donor);
 
-    const BASE_URI = 'base/'
-    const SUFFIX = 'suffix1'
-    const URI = 'uri1'
+    const BASE_URI = 'base/';
+    const SUFFIX = 'suffix1';
+    const URI = 'uri1';
 
     const collectionHelpers = helper.ethNativeContract.collectionHelpers(caller);
-    const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection'
+    const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection';
 
-    const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p')
+    const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');
 
     const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);
     await contract.methods.addCollectionAdmin(bruh).send(); // to check that admin will work too
 
-    const collection1 = await helper.nft.getCollectionObject(collectionId);
-    const data1 = await collection1.getData()
+    const collection1 = helper.nft.getCollectionObject(collectionId);
+    const data1 = await collection1.getData();
     expect(data1?.raw.flags.erc721metadata).to.be.false;
     expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.false;
 
@@ -109,37 +108,37 @@
 
     expect(await contract.methods.supportsInterface('0x5b5e139f').call()).to.be.true;
 
-    const collection2 = await helper.nft.getCollectionObject(collectionId);
-    const data2 = await collection2.getData()
+    const collection2 = helper.nft.getCollectionObject(collectionId);
+    const data2 = await collection2.getData();
     expect(data2?.raw.flags.erc721metadata).to.be.true;
 
-    const TPPs = data2?.raw.tokenPropertyPermissions
-    expect(TPPs?.length).to.equal(2);
+    const propertyPermissions = data2?.raw.tokenPropertyPermissions;
+    expect(propertyPermissions?.length).to.equal(2);
 
-    expect(TPPs.find((tpp: ITokenPropertyPermission) => {
-      return tpp.key === "URI" && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner
-    })).to.be.not.null
+    expect(propertyPermissions.find((tpp: ITokenPropertyPermission) => {
+      return tpp.key === 'URI' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;
+    })).to.be.not.null;
 
-    expect(TPPs.find((tpp: ITokenPropertyPermission) => {
-      return tpp.key === "URISuffix" && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner
-    })).to.be.not.null
+    expect(propertyPermissions.find((tpp: ITokenPropertyPermission) => {
+      return tpp.key === 'URISuffix' && tpp.permission.mutable && tpp.permission.collectionAdmin && !tpp.permission.tokenOwner;
+    })).to.be.not.null;
 
     expect(data2?.raw.properties?.find((property: IProperty) => {
-      return property.key === "baseURI" && property.value === BASE_URI
-    })).to.be.not.null
+      return property.key === 'baseURI' && property.value === BASE_URI;
+    })).to.be.not.null;
 
     const token1Result = await contract.methods.mint(bruh).send();
     const tokenId1 = token1Result.events.Transfer.returnValues.tokenId;
 
     expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI);
 
-    await contract.methods.setProperty(tokenId1, "URISuffix", Buffer.from(SUFFIX)).send();
+    await contract.methods.setProperty(tokenId1, 'URISuffix', Buffer.from(SUFFIX)).send();
     expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);
 
-    await contract.methods.setProperty(tokenId1, "URI", Buffer.from(URI)).send();
+    await contract.methods.setProperty(tokenId1, 'URI', Buffer.from(URI)).send();
     expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(URI);
 
-    await contract.methods.deleteProperty(tokenId1, "URI").send();
+    await contract.methods.deleteProperty(tokenId1, 'URI').send();
     expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);
 
     const token2Result = await contract.methods.mintWithTokenURI(bruh, URI).send();
@@ -147,12 +146,12 @@
 
     expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(URI);
 
-    await contract.methods.deleteProperty(tokenId2, "URI").send();
+    await contract.methods.deleteProperty(tokenId2, 'URI').send();
     expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI);
 
-    await contract.methods.setProperty(tokenId2, "URISuffix", Buffer.from(SUFFIX)).send();
+    await contract.methods.setProperty(tokenId2, 'URISuffix', Buffer.from(SUFFIX)).send();
     expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);
-  }
+  };
 
   itEth('ERC721Metadata property can be set for NFT collection', async({helper}) => {
     await checkERC721Metadata(helper, 'nft');
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
before · tests/src/eth/collectionSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds} from '../util/index';19import {itEth, expect} from './util';2021describe('evm collection sponsoring', () => {22  let donor: IKeyringPair;23  let alice: IKeyringPair;24  let nominal: bigint;2526  before(async () => {27    await usingPlaygrounds(async (helper, privateKey) => {28      donor = await privateKey({filename: __filename});29      [alice] = await helper.arrange.createAccounts([100n], donor);30      nominal = helper.balance.getOneTokenNominal();31    });32  });33  34  itEth('sponsors mint transactions', async ({helper}) => {35    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'spnr', permissions: {mintMode: true}});36    await collection.setSponsor(alice, alice.address);37    await collection.confirmSponsorship(alice);3839    const minter = helper.eth.createAccount();40    expect(await helper.balance.getEthereum(minter)).to.equal(0n);4142    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);43    const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', minter);4445    await collection.addToAllowList(alice, {Ethereum: minter});4647    const result = await contract.methods.mint(minter).send();4849    const events = helper.eth.normalizeEvents(result.events);50    expect(events).to.be.deep.equal([51      {52        address: collectionAddress,53        event: 'Transfer',54        args: {55          from: '0x0000000000000000000000000000000000000000',56          to: minter,57          tokenId: '1',58        },59      },60    ]);61  });6263  // TODO: Temprorary off. Need refactor64  // itWeb3('Set substrate sponsor', async ({api, web3, privateKeyWrapper}) => {65  //   const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);66  //   const collectionHelpers = evmCollectionHelpers(web3, owner);67  //   let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send();68  //   const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);69  //   const sponsor = privateKeyWrapper('//Alice');70  //   const collectionEvm = evmCollection(web3, owner, collectionIdAddress);7172  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;73  //   result = await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});74  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;7576  //   const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);77  //   await submitTransactionAsync(sponsor, confirmTx);78  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;7980  //   const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});81  //   expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);82  // });8384  itEth('Remove sponsor', async ({helper}) => {85    const owner = await helper.eth.createAccountWithBalance(donor);86    const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);8788    let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});89    const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);90    const sponsor = await helper.eth.createAccountWithBalance(donor);91    const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner);9293    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;94    result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});95    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;9697    await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});98    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;99100    await collectionEvm.methods.removeCollectionSponsor().send({from: owner});101102    const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});103    expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');104  });105106  itEth('Sponsoring collection from evm address via access list', async ({helper}) => {107    const owner = await helper.eth.createAccountWithBalance(donor);108109    const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');110111    const collection = helper.nft.getCollectionObject(collectionId);112    const sponsor = await helper.eth.createAccountWithBalance(donor);113    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);114115    await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});116    let collectionData = (await collection.getData())!;117    expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));118    await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');119120    await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});121    collectionData = (await collection.getData())!;122    expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));123124    const user = helper.eth.createAccount();125    const nextTokenId = await collectionEvm.methods.nextTokenId().call();126    expect(nextTokenId).to.be.equal('1');127128    const oldPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();129    expect(oldPermissions.mintMode).to.be.false;130    expect(oldPermissions.access).to.be.equal('Normal');131132    await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});133    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});134    await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});135136    const newPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();137    expect(newPermissions.mintMode).to.be.true;138    expect(newPermissions.access).to.be.equal('AllowList');139140    const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));141    const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));142143    {144      const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});145      const events = helper.eth.normalizeEvents(result.events);146147      expect(events).to.be.deep.equal([148        {149          address: collectionAddress,150          event: 'Transfer',151          args: {152            from: '0x0000000000000000000000000000000000000000',153            to: user,154            tokenId: '1',155          },156        },157      ]);158159      const ownerBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(owner));160      const sponsorBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(sponsor));161162      expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');163      expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);164      expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;165    }166  });167168  // TODO: Temprorary off. Need refactor169  // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {170  //   const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);171  //   const collectionHelpers = evmCollectionHelpers(web3, owner);172  //   const result = await collectionHelpers.methods.createERC721MetadataCompatibleNFTCollection('Sponsor collection', '1', '1', '').send();173  //   const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);174  //   const sponsor = privateKeyWrapper('//Alice');175  //   const collectionEvm = evmCollection(web3, owner, collectionIdAddress);176177  //   await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});178179  //   const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);180  //   await submitTransactionAsync(sponsor, confirmTx);181182  //   const user = createEthAccount(web3);183  //   const nextTokenId = await collectionEvm.methods.nextTokenId().call();184  //   expect(nextTokenId).to.be.equal('1');185186  //   await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});187  //   await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});188  //   await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});189190  //   const ownerBalanceBefore = await ethBalanceViaSub(api, owner);191  //   const sponsorBalanceBefore = (await getBalance(api, [sponsor.address]))[0];192193  //   {194  //     const nextTokenId = await collectionEvm.methods.nextTokenId().call();195  //     expect(nextTokenId).to.be.equal('1');196  //     const result = await collectionEvm.methods.mintWithTokenURI(197  //       user,198  //       nextTokenId,199  //       'Test URI',200  //     ).send({from: user});201  //     const events = normalizeEvents(result.events);202203  //     expect(events).to.be.deep.equal([204  //       {205  //         address: collectionIdAddress,206  //         event: 'Transfer',207  //         args: {208  //           from: '0x0000000000000000000000000000000000000000',209  //           to: user,210  //           tokenId: nextTokenId,211  //         },212  //       },213  //     ]);214215  //     const ownerBalanceAfter = await ethBalanceViaSub(api, owner);216  //     const sponsorBalanceAfter = (await getBalance(api, [sponsor.address]))[0];217218  //     expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');219  //     expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);220  //     expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;221  //   }222  // });223224  itEth('Check that transaction via EVM spend money from sponsor address', async ({helper}) => {225    const owner = await helper.eth.createAccountWithBalance(donor);226227    const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');228    const collection = helper.nft.getCollectionObject(collectionId);229    const sponsor = await helper.eth.createAccountWithBalance(donor);230    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);231232    await collectionEvm.methods.setCollectionSponsor(sponsor).send();233    let collectionData = (await collection.getData())!;234    expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));235    await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');236237    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);238    await sponsorCollection.methods.confirmCollectionSponsorship().send();239    collectionData = (await collection.getData())!;240    expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));241242    const user = helper.eth.createAccount();243    await collectionEvm.methods.addCollectionAdmin(user).send();244245    const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));246    const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));247248    const userCollectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', user);249250    let result = await userCollectionEvm.methods.mintWithTokenURI(user, 'Test URI',).send();251    const tokenId = result.events.Transfer.returnValues.tokenId;252253    const events = helper.eth.normalizeEvents(result.events);254    const address = helper.ethAddress.fromCollectionId(collectionId);255256    expect(events).to.be.deep.equal([257      {258        address,259        event: 'Transfer',260        args: {261          from: '0x0000000000000000000000000000000000000000',262          to: user,263          tokenId: '1',264        },265      },266    ]);267    expect(await userCollectionEvm.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');268269    const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));270    expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);271    const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));272    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;273  });274});
after · tests/src/eth/collectionSponsoring.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds} from '../util/index';19import {itEth, expect} from './util';2021describe('evm collection sponsoring', () => {22  let donor: IKeyringPair;23  let alice: IKeyringPair;24  let nominal: bigint;2526  before(async () => {27    await usingPlaygrounds(async (helper, privateKey) => {28      donor = await privateKey({filename: __filename});29      [alice] = await helper.arrange.createAccounts([100n], donor);30      nominal = helper.balance.getOneTokenNominal();31    });32  });33  34  itEth('sponsors mint transactions', async ({helper}) => {35    const collection = await helper.nft.mintCollection(alice, {tokenPrefix: 'spnr', permissions: {mintMode: true}});36    await collection.setSponsor(alice, alice.address);37    await collection.confirmSponsorship(alice);3839    const minter = helper.eth.createAccount();40    expect(await helper.balance.getEthereum(minter)).to.equal(0n);4142    const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);43    const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', minter);4445    await collection.addToAllowList(alice, {Ethereum: minter});4647    const result = await contract.methods.mint(minter).send();4849    const events = helper.eth.normalizeEvents(result.events);50    expect(events).to.be.deep.equal([51      {52        address: collectionAddress,53        event: 'Transfer',54        args: {55          from: '0x0000000000000000000000000000000000000000',56          to: minter,57          tokenId: '1',58        },59      },60    ]);61  });6263  // TODO: Temprorary off. Need refactor64  // itWeb3('Set substrate sponsor', async ({api, web3, privateKeyWrapper}) => {65  //   const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);66  //   const collectionHelpers = evmCollectionHelpers(web3, owner);67  //   let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send();68  //   const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);69  //   const sponsor = privateKeyWrapper('//Alice');70  //   const collectionEvm = evmCollection(web3, owner, collectionIdAddress);7172  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;73  //   result = await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});74  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;7576  //   const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);77  //   await submitTransactionAsync(sponsor, confirmTx);78  //   expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;7980  //   const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});81  //   expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);82  // });8384  itEth('Remove sponsor', async ({helper}) => {85    const owner = await helper.eth.createAccountWithBalance(donor);86    const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);8788    let result = await collectionHelpers.methods.createNFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});89    const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);90    const sponsor = await helper.eth.createAccountWithBalance(donor);91    const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'nft', owner);9293    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;94    result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});95    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;9697    await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});98    expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;99100    await collectionEvm.methods.removeCollectionSponsor().send({from: owner});101102    const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});103    expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');104  });105106  itEth('Sponsoring collection from evm address via access list', async ({helper}) => {107    const owner = await helper.eth.createAccountWithBalance(donor);108109    const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Sponsor collection', '1', '1', '');110111    const collection = helper.nft.getCollectionObject(collectionId);112    const sponsor = await helper.eth.createAccountWithBalance(donor);113    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);114115    await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});116    let collectionData = (await collection.getData())!;117    expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));118    await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');119120    await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});121    collectionData = (await collection.getData())!;122    expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));123124    const user = helper.eth.createAccount();125    const nextTokenId = await collectionEvm.methods.nextTokenId().call();126    expect(nextTokenId).to.be.equal('1');127128    const oldPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();129    expect(oldPermissions.mintMode).to.be.false;130    expect(oldPermissions.access).to.be.equal('Normal');131132    await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});133    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});134    await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});135136    const newPermissions = (await collection.getData())!.raw.permissions; // (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();137    expect(newPermissions.mintMode).to.be.true;138    expect(newPermissions.access).to.be.equal('AllowList');139140    const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));141    const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));142143    {144      const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});145      const events = helper.eth.normalizeEvents(result.events);146147      expect(events).to.be.deep.equal([148        {149          address: collectionAddress,150          event: 'Transfer',151          args: {152            from: '0x0000000000000000000000000000000000000000',153            to: user,154            tokenId: '1',155          },156        },157      ]);158159      const ownerBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(owner));160      const sponsorBalanceAfter = await helper.balance.getSubstrate(await helper.address.ethToSubstrate(sponsor));161162      expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');163      expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);164      expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;165    }166  });167168  // TODO: Temprorary off. Need refactor169  // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {170  //   const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);171  //   const collectionHelpers = evmCollectionHelpers(web3, owner);172  //   const result = await collectionHelpers.methods.createERC721MetadataCompatibleNFTCollection('Sponsor collection', '1', '1', '').send();173  //   const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);174  //   const sponsor = privateKeyWrapper('//Alice');175  //   const collectionEvm = evmCollection(web3, owner, collectionIdAddress);176177  //   await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});178179  //   const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);180  //   await submitTransactionAsync(sponsor, confirmTx);181182  //   const user = createEthAccount(web3);183  //   const nextTokenId = await collectionEvm.methods.nextTokenId().call();184  //   expect(nextTokenId).to.be.equal('1');185186  //   await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});187  //   await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});188  //   await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});189190  //   const ownerBalanceBefore = await ethBalanceViaSub(api, owner);191  //   const sponsorBalanceBefore = (await getBalance(api, [sponsor.address]))[0];192193  //   {194  //     const nextTokenId = await collectionEvm.methods.nextTokenId().call();195  //     expect(nextTokenId).to.be.equal('1');196  //     const result = await collectionEvm.methods.mintWithTokenURI(197  //       user,198  //       nextTokenId,199  //       'Test URI',200  //     ).send({from: user});201  //     const events = normalizeEvents(result.events);202203  //     expect(events).to.be.deep.equal([204  //       {205  //         address: collectionIdAddress,206  //         event: 'Transfer',207  //         args: {208  //           from: '0x0000000000000000000000000000000000000000',209  //           to: user,210  //           tokenId: nextTokenId,211  //         },212  //       },213  //     ]);214215  //     const ownerBalanceAfter = await ethBalanceViaSub(api, owner);216  //     const sponsorBalanceAfter = (await getBalance(api, [sponsor.address]))[0];217218  //     expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');219  //     expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);220  //     expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;221  //   }222  // });223224  itEth('Check that transaction via EVM spend money from sponsor address', async ({helper}) => {225    const owner = await helper.eth.createAccountWithBalance(donor);226227    const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner,'Sponsor collection', '1', '1', '');228    const collection = helper.nft.getCollectionObject(collectionId);229    const sponsor = await helper.eth.createAccountWithBalance(donor);230    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);231232    await collectionEvm.methods.setCollectionSponsor(sponsor).send();233    let collectionData = (await collection.getData())!;234    expect(collectionData.raw.sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));235    await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');236237    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);238    await sponsorCollection.methods.confirmCollectionSponsorship().send();239    collectionData = (await collection.getData())!;240    expect(collectionData.raw.sponsorship.Confirmed).to.be.eq(helper.address.ethToSubstrate(sponsor, true));241242    const user = helper.eth.createAccount();243    await collectionEvm.methods.addCollectionAdmin(user).send();244245    const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));246    const sponsorBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));247248    const userCollectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', user);249250    const result = await userCollectionEvm.methods.mintWithTokenURI(user, 'Test URI').send();251    const tokenId = result.events.Transfer.returnValues.tokenId;252253    const events = helper.eth.normalizeEvents(result.events);254    const address = helper.ethAddress.fromCollectionId(collectionId);255256    expect(events).to.be.deep.equal([257      {258        address,259        event: 'Transfer',260        args: {261          from: '0x0000000000000000000000000000000000000000',262          to: user,263          tokenId: '1',264        },265      },266    ]);267    expect(await userCollectionEvm.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');268269    const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));270    expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);271    const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsor));272    expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;273  });274});
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -111,7 +111,7 @@
     await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();
 
     {
-      const nextTokenId = await contract.methods.nextTokenId().call()
+      const nextTokenId = await contract.methods.nextTokenId().call();
       const result = await contract.methods.mintWithTokenURI(receiver, nextTokenId, 'Test URI').send({from: caller});
       const tokenId = result.events.Transfer.returnValues.tokenId;
       expect(tokenId).to.be.equal('1');
modifiedtests/src/eth/util/index.tsdiffbeforeafterboth
--- a/tests/src/eth/util/index.ts
+++ b/tests/src/eth/util/index.ts
@@ -14,7 +14,7 @@
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
 import chaiLike from 'chai-like';
-import {getTestSeed, requirePalletsOrSkip} from '../../util';
+import {getTestSeed, MINIMUM_DONOR_FUND, requirePalletsOrSkip} from '../../util';
 
 chai.use(chaiAsPromised);
 chai.use(chaiLike);
@@ -43,7 +43,7 @@
       else {
         const actualSeed = getTestSeed(seed.filename);
         let account = helper.util.fromSeed(actualSeed, ss58Format);
-        if (await helper.balance.getSubstrate(account.address) == 0n) {
+        if (await helper.balance.getSubstrate(account.address) < MINIMUM_DONOR_FUND) {
           console.warn(`${path.basename(seed.filename)}: Not enough funds present on the filename account. Using the default one as the donor instead.`);
           account = helper.util.fromSeed('//Alice', ss58Format);
         }
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -189,7 +189,7 @@
   async createERC721MetadataCompatibleNFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string}> {
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
 
-    const {collectionId, collectionAddress} = await this.createNFTCollection(signer, name, description, tokenPrefix)
+    const {collectionId, collectionAddress} = await this.createNFTCollection(signer, name, description, tokenPrefix);
 
     await collectionHelper.methods.makeCollectionERC721MetadataCompatible(collectionAddress, baseUri).send();
 
@@ -211,7 +211,7 @@
   async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string}> {
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
 
-    const {collectionId, collectionAddress} = await this.createRFTCollection(signer, name, description, tokenPrefix)
+    const {collectionId, collectionAddress} = await this.createRFTCollection(signer, name, description, tokenPrefix);
 
     await collectionHelper.methods.makeCollectionERC721MetadataCompatible(collectionAddress, baseUri).send();
 
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -62,7 +62,7 @@
       const chain = await helper.callRpc('api.rpc.system.chain', []);
 
       const refungible = 'refungible';
-      const scheduler = 'scheduler';
+      // const scheduler = 'scheduler';
       const foreignAssets = 'foreignassets';
       const rmrkPallets = ['rmrkcore', 'rmrkequip'];
       const appPromotion = 'apppromotion';
@@ -70,7 +70,7 @@
       if (chain.eq('OPAL by UNIQUE')) {
         requiredPallets.push(
           refungible,
-          scheduler,
+          // scheduler,
           foreignAssets,
           appPromotion,
           ...rmrkPallets,