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

difftreelog

Merge pull request #744 from UniqueNetwork/tests/eth-helpers

ut-akuznetsov2022-12-01parents: #b5e90fb #ccf797c.patch.diff
in: master
Tests/eth helpers

5 files changed

modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
before · tests/src/eth/allowlist.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 {itEth, usingEthPlaygrounds, expect} from './util';1920describe('EVM contract allowlist', () => {21  let donor: IKeyringPair;2223  before(async function() {24    await usingEthPlaygrounds(async (_helper, privateKey) => {25      donor = await privateKey({filename: __filename});26    });27  });2829  itEth('Contract allowlist can be toggled', async ({helper}) => {30    const owner = await helper.eth.createAccountWithBalance(donor);31    const flipper = await helper.eth.deployFlipper(owner);32    const helpers = helper.ethNativeContract.contractHelpers(owner);3334    // Any user is allowed by default35    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;3637    // Enable38    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});39    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;4041    // Disable42    await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});43    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;44  });4546  itEth('Non-allowlisted user can\'t call contract with allowlist enabled', async ({helper}) => {47    const owner = await helper.eth.createAccountWithBalance(donor);48    const caller = await helper.eth.createAccountWithBalance(donor);49    const flipper = await helper.eth.deployFlipper(owner);50    const helpers = helper.ethNativeContract.contractHelpers(owner);5152    // User can flip with allowlist disabled53    await flipper.methods.flip().send({from: caller});54    expect(await flipper.methods.getValue().call()).to.be.true;5556    // Tx will be reverted if user is not in allowlist57    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});58    await expect(flipper.methods.flip().send({from: caller})).to.rejected;59    expect(await flipper.methods.getValue().call()).to.be.true;6061    // Adding caller to allowlist will make contract callable again62    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});63    await flipper.methods.flip().send({from: caller});64    expect(await flipper.methods.getValue().call()).to.be.false;65  });66});6768describe('EVM collection allowlist', () => {69  let donor: IKeyringPair;7071  before(async function() {72    await usingEthPlaygrounds(async (_helper, privateKey) => {73      donor = await privateKey({filename: __filename});74    });75  });7677  // Soft-deprecated78  itEth('Collection allowlist can be added and removed by [eth] address', async ({helper}) => {79    const owner = await helper.eth.createAccountWithBalance(donor);80    const user = helper.eth.createAccount();81    const crossUser = helper.ethCrossAccount.fromAddress(user);82    83    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');84    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);8586    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;87    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});88    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;8990    await collectionEvm.methods.removeFromCollectionAllowList(user).send({from: owner});91    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;92  });9394  itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {95    const owner = await helper.eth.createAccountWithBalance(donor);96    const user = donor;97    98    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');99    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);100    const userCross = helper.ethCrossAccount.fromKeyringPair(user);101    102    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;103    await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});104    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;105    expect(await collectionEvm.methods.allowlistedCross(userCross).call({from: owner})).to.be.true;106    107    await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});108    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;109    expect(await collectionEvm.methods.allowlistedCross(userCross).call({from: owner})).to.be.false;110  });111112  // Soft-deprecated113  itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {114    const owner = await helper.eth.createAccountWithBalance(donor);115    const notOwner = await helper.eth.createAccountWithBalance(donor);116    const user = helper.eth.createAccount();117    const crossUser = helper.ethCrossAccount.fromAddress(user);118119    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');120    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);121122    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;123    await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');124    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;125    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});126    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;127    await expect(collectionEvm.methods.removeFromCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');128    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;129  });130131  itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {132    const owner = await helper.eth.createAccountWithBalance(donor);133    const notOwner = await helper.eth.createAccountWithBalance(donor);134    const user = donor;135    136    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');137    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);138    139    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;140    const userCross = helper.ethCrossAccount.fromKeyringPair(user);141    await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');142    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;143    await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});144    145    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;146    await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');147    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;148  });149});
after · tests/src/eth/allowlist.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 {itEth, usingEthPlaygrounds, expect} from './util';1920describe('EVM contract allowlist', () => {21  let donor: IKeyringPair;2223  before(async function() {24    await usingEthPlaygrounds(async (_helper, privateKey) => {25      donor = await privateKey({filename: __filename});26    });27  });2829  itEth('Contract allowlist can be toggled', async ({helper}) => {30    const owner = await helper.eth.createAccountWithBalance(donor);31    const flipper = await helper.eth.deployFlipper(owner);32    const helpers = helper.ethNativeContract.contractHelpers(owner);3334    // Any user is allowed by default35    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;3637    // Enable38    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});39    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;4041    // Disable42    await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});43    expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;44  });4546  itEth('Non-allowlisted user can\'t call contract with allowlist enabled', async ({helper}) => {47    const owner = await helper.eth.createAccountWithBalance(donor);48    const caller = await helper.eth.createAccountWithBalance(donor);49    const flipper = await helper.eth.deployFlipper(owner);50    const helpers = helper.ethNativeContract.contractHelpers(owner);5152    // User can flip with allowlist disabled53    await flipper.methods.flip().send({from: caller});54    expect(await flipper.methods.getValue().call()).to.be.true;5556    // Tx will be reverted if user is not in allowlist57    await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});58    await expect(flipper.methods.flip().send({from: caller})).to.rejected;59    expect(await flipper.methods.getValue().call()).to.be.true;6061    // Adding caller to allowlist will make contract callable again62    await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({from: owner});63    await flipper.methods.flip().send({from: caller});64    expect(await flipper.methods.getValue().call()).to.be.false;65  });66});6768describe('EVM collection allowlist', () => {69  let donor: IKeyringPair;7071  before(async function() {72    await usingEthPlaygrounds(async (_helper, privateKey) => {73      donor = await privateKey({filename: __filename});74    });75  });7677  // Soft-deprecated78  itEth('Collection allowlist can be added and removed by [eth] address', async ({helper}) => {79    const owner = await helper.eth.createAccountWithBalance(donor);80    const user = helper.eth.createAccount();81    const crossUser = helper.ethCrossAccount.fromAddress(user);82    83    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');84    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);8586    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;87    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});88    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;8990    await collectionEvm.methods.removeFromCollectionAllowList(user).send({from: owner});91    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;92  });9394  itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {95    const owner = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();96    const [userSub] = await helper.arrange.createAccounts([10n], donor);97    const userEth = await helper.eth.createAccountWithBalance(donor);98    99    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');100    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);101    const userCrossSub = helper.ethCrossAccount.fromKeyringPair(userSub);102    const userCrossEth = helper.ethCrossAccount.fromAddress(userEth);103    const ownerCrossEth = helper.ethCrossAccount.fromAddress(owner);104    105    // Can addToCollectionAllowListCross:106    expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;107    await collectionEvm.methods.addToCollectionAllowListCross(userCrossSub).send({from: owner});108    await collectionEvm.methods.addToCollectionAllowListCross(userCrossEth).send({from: owner});109    await collectionEvm.methods.addToCollectionAllowListCross(ownerCrossEth).send({from: owner});110    expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.true;111    expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.true;112    expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.true;113    expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.true;114115    await collectionEvm.methods.mint(userEth).send(); // token #1116    await collectionEvm.methods.mint(userEth).send(); // token #2117    await collectionEvm.methods.setCollectionAccess(1).send();118    119    // allowlisted account can transfer and transferCross:120    await collectionEvm.methods.transfer(owner, 1).send({from: userEth});121    await collectionEvm.methods.transferCross(userCrossSub, 2).send({from: userEth});122    expect(await helper.nft.getTokenOwner(collectionId, 1)).to.deep.eq({Ethereum: owner});123    expect(await helper.nft.getTokenOwner(collectionId, 2)).to.deep.eq({Substrate: userSub.address});124    125    // can removeFromCollectionAllowListCross:126    await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossSub).send({from: owner});127    await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossEth).send({from: owner});128    expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;129    expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.false;130    expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.false;131    expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.false;132133    // cannot transfer anymore134    await collectionEvm.methods.mint(userEth).send();135    await expect(collectionEvm.methods.transfer(owner, 2).send({from: userEth})).to.be.rejectedWith(/Transaction has been reverted/);136  });137138  // Soft-deprecated139  itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {140    const owner = await helper.eth.createAccountWithBalance(donor);141    const notOwner = await helper.eth.createAccountWithBalance(donor);142    const user = helper.eth.createAccount();143    const crossUser = helper.ethCrossAccount.fromAddress(user);144145    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');146    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);147148    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;149    await expect(collectionEvm.methods.addToCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');150    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.false;151    await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});152    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;153    await expect(collectionEvm.methods.removeFromCollectionAllowList(user).call({from: notOwner})).to.be.rejectedWith('NoPermission');154    expect(await collectionEvm.methods.allowlistedCross(crossUser).call({from: owner})).to.be.true;155  });156157  itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {158    const owner = await helper.eth.createAccountWithBalance(donor);159    const notOwner = await helper.eth.createAccountWithBalance(donor);160    const user = donor;161    162    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');163    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);164    165    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;166    const userCross = helper.ethCrossAccount.fromKeyringPair(user);167    await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');168    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;169    await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});170    171    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;172    await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');173    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;174  });175});
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -39,80 +39,98 @@
     });
   });
 
-  // Soft-deprecated
-  itEth('Add admin by owner', async ({helper}) => {
+  itEth('can add account admin by owner', async ({helper, privateKey}) => {
+    // arrange
     const owner = await helper.eth.createAccountWithBalance(donor);
+    const adminSub = await privateKey('//admin2');
+    const adminEth = helper.eth.createAccount().toLowerCase();
+
+    const adminDeprecated = helper.eth.createAccount().toLowerCase();
+    const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
+    const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
+        
     const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
 
-    const newAdmin = helper.eth.createAccount();
+    // Soft-deprecated: can addCollectionAdmin 
+    await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();
+    // Can addCollectionAdminCross for substrate and ethereum address
+    await collectionEvm.methods.addCollectionAdminCross(adminCrossSub).send();
+    await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();
 
-    await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
-    const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);
-    expect(adminList[0].asEthereum.toString().toLocaleLowerCase())
-      .to.be.eq(newAdmin.toLocaleLowerCase());
+    // 1. Expect api.rpc.unique.adminlist returns admins:
+    const adminListRpc = await helper.collection.getAdmins(collectionId);
+    expect(adminListRpc).to.has.length(3);
+    expect(adminListRpc).to.be.deep.contain.members([{Substrate: adminSub.address}, {Ethereum: adminEth}, {Ethereum: adminDeprecated}]);
+
+    // 2. Expect methods.collectionAdmins == api.rpc.unique.adminlist
+    let adminListEth = await collectionEvm.methods.collectionAdmins().call();
+    adminListEth = adminListEth.map((element: IEthCrossAccountId) => {
+      return helper.address.convertCrossAccountFromEthCrossAccount(element);
+    });
+    expect(adminListRpc).to.be.like(adminListEth);
   });
 
-  itEth('Add cross account admin by owner', async ({helper, privateKey}) => {
+  itEth('cross account admin can mint', async ({helper}) => {
+    // arrange: create collection and accounts
     const owner = await helper.eth.createAccountWithBalance(donor);
-        
-    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+    const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', 'uri');
+    const adminEth = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();
+    const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
+    const [adminSub] = await helper.arrange.createAccounts([100n], donor);
+    const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
+    
+    // cannot mint while not admin
+    await expect(collectionEvm.methods.mint(owner).send({from: adminEth})).to.be.rejected;
+    await expect(helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}})).to.be.rejectedWith(/common.PublicMintingNotAllowed/);
     
-    const newAdmin = await privateKey('//Bob');
-    const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);
-    await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();
+    // admin (sub and eth) can mint token:
+    await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();
+    await collectionEvm.methods.addCollectionAdminCross(adminCrossSub).send();
+    await collectionEvm.methods.mint(owner).send({from: adminEth});
+    await helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}});
 
-    const adminList = await helper.collection.getAdmins(collectionId);
-    expect(adminList).to.be.like([{Substrate: newAdmin.address}]);
+    expect(await helper.collection.getLastTokenId(collectionId)).to.eq(2);
   });
 
-  itEth('Check adminlist', async ({helper, privateKey}) => {
+  itEth('cannot add invalid cross account admin', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
-        
-    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
+    const [admin] = await helper.arrange.createAccounts([100n, 100n], donor);
 
-    const admin1 = helper.eth.createAccount();
-    const admin2 = await privateKey('admin');
-    const admin2Cross = helper.ethCrossAccount.fromKeyringPair(admin2);
-    
-    // Soft-deprecated
-    await collectionEvm.methods.addCollectionAdmin(admin1).send();
-    await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();
+    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
 
-    const adminListRpc = await helper.collection.getAdmins(collectionId);
-    let adminListEth = await collectionEvm.methods.collectionAdmins().call();
-    adminListEth = adminListEth.map((element: IEthCrossAccountId) => {
-      return helper.address.convertCrossAccountFromEthCrossAcoount(element);
-    });
-    expect(adminListRpc).to.be.like(adminListEth);
+    const adminCross = {
+      eth: helper.address.substrateToEth(admin.address),
+      sub: admin.addressRaw,
+    };
+    await expect(collectionEvm.methods.addCollectionAdminCross(adminCross).send()).to.be.rejected;
   });
 
-  // Soft-deprecated
-  itEth('Verify owner or admin', async ({helper}) => {
+  itEth('can verify owner with methods.isOwnerOrAdmin[Cross]', async ({helper, privateKey}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
     const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
 
-    const newAdmin = helper.eth.createAccount();
+    const adminDeprecated = helper.eth.createAccount();
+    const admin1Cross = helper.ethCrossAccount.fromKeyringPair(await privateKey('admin'));
+    const admin2Cross = helper.ethCrossAccount.fromAddress(helper.address.substrateToEth((await privateKey('admin3')).address));
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
   
-    expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.false;
-    await collectionEvm.methods.addCollectionAdmin(newAdmin).send();
-    expect(await collectionEvm.methods.isOwnerOrAdmin(newAdmin).call()).to.be.true;
-  });
+    // Soft-deprecated:
+    expect(await collectionEvm.methods.isOwnerOrAdmin(adminDeprecated).call()).to.be.false;
+    expect(await collectionEvm.methods.isOwnerOrAdminCross(admin1Cross).call()).to.be.false;
+    expect(await collectionEvm.methods.isOwnerOrAdminCross(admin2Cross).call()).to.be.false;
 
-  itEth('Verify owner or admin cross', async ({helper, privateKey}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor);
-    const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+    await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();
+    await collectionEvm.methods.addCollectionAdminCross(admin1Cross).send();
+    await collectionEvm.methods.addCollectionAdminCross(admin2Cross).send();
 
-    const newAdmin = await privateKey('admin');
-    const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);
-    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
-  
-    expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.false;
-    await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();
-    expect(await collectionEvm.methods.isOwnerOrAdminCross(newAdminCross).call()).to.be.true;
+    // Soft-deprecated: isOwnerOrAdmin returns true
+    expect(await collectionEvm.methods.isOwnerOrAdmin(adminDeprecated).call()).to.be.true;
+    // Expect isOwnerOrAdminCross return true
+    expect(await collectionEvm.methods.isOwnerOrAdminCross(admin1Cross).call()).to.be.true;
+    expect(await collectionEvm.methods.isOwnerOrAdminCross(admin2Cross).call()).to.be.true;
   });
 
   // Soft-deprecated
@@ -154,12 +172,11 @@
     const owner = await helper.eth.createAccountWithBalance(donor);
     const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
 
-    const [admin] = await helper.arrange.createAccounts([10n], donor);
+    const [admin, notAdmin] = await helper.arrange.createAccounts([10n, 10n], donor);
     const adminCross = helper.ethCrossAccount.fromKeyringPair(admin);
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
     await collectionEvm.methods.addCollectionAdminCross(adminCross).send();
 
-    const [notAdmin] = await helper.arrange.createAccounts([10n], donor);
     const notAdminCross = helper.ethCrossAccount.fromKeyringPair(notAdmin);
     await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: adminCross.eth}))
       .to.be.rejectedWith('NoPermission');
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -314,7 +314,7 @@
     }
   });
 
-  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+  itEth('Can perform transferFromCross()', async ({helper}) => {
     const sender = await helper.eth.createAccountWithBalance(donor, 100n);
 
     const collection = await helper.ft.mintCollection(owner, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
@@ -508,7 +508,7 @@
     expect(event.returnValues.value).to.be.equal('51');
   });
 
-  itEth('Events emitted for transferFromCross()', async ({helper, privateKey}) => {
+  itEth('Events emitted for transferFromCross()', async ({helper}) => {
     const sender = await helper.eth.createAccountWithBalance(donor, 100n);
 
     const collection = await helper.ft.mintCollection(owner, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -17,7 +17,6 @@
 import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
-import exp from 'constants';
 
 
 describe('NFT: Information getting', () => {
@@ -280,30 +279,51 @@
   });
 
   itEth('Can perform approveCross()', async ({helper}) => {
+    // arrange: create accounts
+    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
+    const ownerCross = helper.ethCrossAccount.fromAddress(owner);
+    const receiverSub = charlie;
+    const recieverCrossSub = helper.ethCrossAccount.fromKeyringPair(receiverSub);
+    const receiverEth = await helper.eth.createAccountWithBalance(donor, 100n);
+    const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);
+
+    // arrange: create collection and tokens:
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
+    const token1 = await collection.mintToken(minter, {Ethereum: owner});
+    const token2 = await collection.mintToken(minter, {Ethereum: owner});
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
-    const receiver = charlie;
+    const collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(collection.collectionId), 'nft');
 
-    const token = await collection.mintToken(minter, {Ethereum: owner});
-
-    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
-    const contract = helper.ethNativeContract.collection(address, 'nft');
+    // Can approveCross substrate and ethereum address:
+    const resultSub = await collectionEvm.methods.approveCross(recieverCrossSub, token1.tokenId).send({from: owner});
+    const resultEth = await collectionEvm.methods.approveCross(receiverCrossEth, token2.tokenId).send({from: owner});
+    const eventSub = resultSub.events.Approval;
+    const eventEth = resultEth.events.Approval;
+    expect(eventSub).to.be.like({
+      address: helper.ethAddress.fromCollectionId(collection.collectionId),
+      event: 'Approval',
+      returnValues: {
+        owner,
+        approved: helper.address.substrateToEth(receiverSub.address),
+        tokenId: token1.tokenId.toString(),
+      },
+    });
+    expect(eventEth).to.be.like({
+      address: helper.ethAddress.fromCollectionId(collection.collectionId),
+      event: 'Approval',
+      returnValues: {
+        owner,
+        approved: receiverEth,
+        tokenId: token2.tokenId.toString(),
+      },
+    });
 
-    {
-      const recieverCross = helper.ethCrossAccount.fromKeyringPair(receiver);
-      const result = await contract.methods.approveCross(recieverCross, token.tokenId).send({from: owner});
-      const event = result.events.Approval;
-      expect(event).to.be.like({
-        address: helper.ethAddress.fromCollectionId(collection.collectionId),
-        event: 'Approval',
-        returnValues: {
-          owner,
-          approved: helper.address.substrateToEth(receiver.address),
-          tokenId: token.tokenId.toString(),
-        },
-      });
-    }
+    // Substrate address can transferFrom approved tokens:
+    await helper.nft.transferTokenFrom(receiverSub, collection.collectionId, token1.tokenId, {Ethereum: owner}, {Substrate: receiverSub.address});
+    expect(await helper.nft.getTokenOwner(collection.collectionId, token1.tokenId)).to.deep.eq({Substrate: receiverSub.address});
+    // Ethereum address can transferFromCross approved tokens:
+    await collectionEvm.methods.transferFromCross(ownerCross, receiverCrossEth, token2.tokenId).send({from: receiverEth});
+    expect(await helper.nft.getTokenOwner(collection.collectionId, token2.tokenId)).to.deep.eq({Ethereum: receiverEth.toLowerCase()});
   });
 
   itEth('Can perform transferFrom()', async ({helper}) => {
@@ -340,13 +360,11 @@
     }
   });
 
-  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
-    const minter = await privateKey('//Alice');
+  itEth('Can perform transferFromCross()', async ({helper}) => {
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await privateKey('//Bob');
+    const [owner, receiver] = await helper.arrange.createAccounts([100n, 100n], donor);
     const spender = await helper.eth.createAccountWithBalance(donor);
-    const receiver = await privateKey('//Charlie');
 
     const token = await collection.mintToken(minter, {Substrate: owner.address});
 
@@ -501,7 +519,7 @@
     expect(cost < BigInt(0.2 * Number(helper.balance.getOneTokenNominal())));
   });
 
-  itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
+  itEth('Can perform transferFromCross()', async ({helper}) => {
     const collectionMinter = alice;
     const owner = bob;
     const receiver = charlie;
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2429,7 +2429,7 @@
    * @param ethCrossAccount etherium cross account
    * @returns substrate cross account id
    */
-  convertCrossAccountFromEthCrossAcoount(ethCrossAccount: IEthCrossAccountId): ICrossAccountId {
+  convertCrossAccountFromEthCrossAccount(ethCrossAccount: IEthCrossAccountId): ICrossAccountId {
     if (ethCrossAccount.sub === '0') {
       return {Ethereum: ethCrossAccount.eth.toLocaleLowerCase()};
     }