git.delta.rocks / unique-network / refs/commits / 624d2812f7d4

difftreelog

chore fix tests

Grigoriy Simonov2022-09-27parent: #57eacee.patch.diff
in: master

12 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -30,10 +30,10 @@
   itWeb3('Add admin by owner', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelper = evmCollectionHelpers(web3, owner);
-        
+
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const newAdmin = createEthAccount(web3);
@@ -69,7 +69,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
 
     const newAdmin = createEthAccount(web3);
@@ -85,7 +85,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -108,7 +108,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
@@ -174,7 +174,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const newAdmin = createEthAccount(web3);
@@ -222,7 +222,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
@@ -249,7 +249,7 @@
         
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
 
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
@@ -326,7 +326,7 @@
     const collectionHelper = evmCollectionHelpers(web3, owner);
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
   
@@ -342,7 +342,7 @@
     const collectionHelper = evmCollectionHelpers(web3, owner);
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
 
@@ -357,7 +357,7 @@
     const collectionHelper = evmCollectionHelpers(web3, owner);
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'B', 'C')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
   
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -1,10 +1,8 @@
-import {addToAllowListExpectSuccess, bigIntToSub, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess} from '../util/helpers';
+import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess, UNIQUE} from '../util/helpers';
 import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub} from './util/helpers';
 import nonFungibleAbi from './nonFungibleAbi.json';
 import {expect} from 'chai';
 import {evmToAddress} from '@polkadot/util-crypto';
-import {submitTransactionAsync} from '../substrate/substrate-api';
-import getBalance from '../substrate/get-balance';
 
 describe('evm collection sponsoring', () => {
   itWeb3('sponsors mint transactions', async ({web3, privateKeyWrapper}) => {
@@ -64,7 +62,7 @@
   itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
+    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
@@ -85,7 +83,7 @@
   itWeb3('Sponsoring collection from evm address via access list', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
+    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
@@ -210,7 +208,7 @@
   itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
+    let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -17,6 +17,7 @@
 import {evmToAddress} from '@polkadot/util-crypto';
 import {IKeyringPair} from '@polkadot/types/types';
 import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {UNIQUE} from '../util/helpers';
 
 describe('Create NFT collection from EVM', () => {
   let donor: IKeyringPair;
@@ -64,7 +65,7 @@
 
     await collectionHelpers.methods
       .createNonfungibleCollection('A', 'A', 'A')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     
     expect(await collectionHelpers.methods
       .isCollectionExist(expectedCollectionAddress)
@@ -164,7 +165,7 @@
 
       await expect(collectionHelper.methods
         .createNonfungibleCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
       
     }
     {
@@ -174,7 +175,7 @@
       const tokenPrefix = 'A';
       await expect(collectionHelper.methods
         .createNonfungibleCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);
     }
     {
       const MAX_TOKEN_PREFIX_LENGTH = 16;
@@ -183,16 +184,16 @@
       const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);
       await expect(collectionHelper.methods
         .createNonfungibleCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
     }
   });
   
   itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
-    const owner = helper.eth.createAccount();
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
     await expect(collectionHelper.methods
       .createNonfungibleCollection('Peasantry', 'absolutely anything', 'CVE')
-      .call()).to.be.rejectedWith('NotSufficientFounds');
+      .call({value: Number(1n * UNIQUE)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
   });
 
   itEth('(!negative test!) Check owner', async ({helper}) => {
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -18,6 +18,7 @@
 import {IKeyringPair} from '@polkadot/types/types';
 import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';
 import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
+import {UNIQUE} from '../util/helpers';
 
 describe('Create RFT collection from EVM', () => {
   let donor: IKeyringPair;
@@ -65,7 +66,7 @@
 
     await collectionHelpers.methods
       .createRFTCollection('A', 'A', 'A')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     
     expect(await collectionHelpers.methods
       .isCollectionExist(expectedCollectionAddress)
@@ -166,7 +167,7 @@
 
       await expect(collectionHelper.methods
         .createRFTCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);
     }
     {
       const MAX_DESCRIPTION_LENGTH = 256;
@@ -175,7 +176,7 @@
       const tokenPrefix = 'A';
       await expect(collectionHelper.methods
         .createRFTCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);
     }
     {
       const MAX_TOKEN_PREFIX_LENGTH = 16;
@@ -184,16 +185,16 @@
       const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);
       await expect(collectionHelper.methods
         .createRFTCollection(collectionName, description, tokenPrefix)
-        .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
+        .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);
     }
   });
   
   itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {
-    const owner = helper.eth.createAccount();
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
     await expect(collectionHelper.methods
       .createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')
-      .call()).to.be.rejectedWith('NotSufficientFounds');
+      .call({value: Number(1n * UNIQUE)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');
   });
 
   itEth('(!negative test!) Check owner', async ({helper}) => {
modifiedtests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth
--- a/tests/src/eth/fractionalizer/Fractionalizer.sol
+++ b/tests/src/eth/fractionalizer/Fractionalizer.sol
@@ -81,10 +81,10 @@
 		string calldata _name,
 		string calldata _description,
 		string calldata _tokenPrefix
-	) external onlyOwner {
+	) external payable onlyOwner {
 		require(rftCollection == address(0), "RFT collection is already set");
 		address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;
-		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection(_name, _description, _tokenPrefix);
+		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(_name, _description, _tokenPrefix);
 		emit RFTCollectionSet(rftCollection);
 	}
 
modifiedtests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -93,7 +93,7 @@
   const fractionalizer = await deployFractionalizer(web3, owner);
   const amount = 10n * UNIQUE;
   await web3.eth.sendTransaction({from: owner, to: fractionalizer.options.address, value: `${amount}`, ...GAS_ARGS});
-  const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send();
+  const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({value: Number(2n * UNIQUE)});
   const rftCollectionAddress = result.events.RFTCollectionSet.returnValues._collection;
   return {fractionalizer, rftCollectionAddress};
 }
@@ -141,9 +141,9 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const fractionalizer = await deployFractionalizer(web3, owner);
     const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);
-    await submitTransactionAsync(alice, tx);
+    await executeTransaction(api, alice, tx);
 
-    const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner});
+    const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner, value: Number(2n * UNIQUE)});
     expect(result.events).to.be.like({
       RFTCollectionSet: {},
     });
@@ -295,7 +295,7 @@
     const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);
     await submitTransactionAsync(alice, tx);
 
-    const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner});
+    const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner, value: Number(2n * UNIQUE)});
     const collectionIdAddress = result.events.RFTCollectionSet.returnValues._collection;
 
     await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -17,6 +17,7 @@
 import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util/playgrounds';
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
+import {UNIQUE} from '../util/helpers';
 
 describe('NFT: Information getting', () => {
   let donor: IKeyringPair;
@@ -83,7 +84,7 @@
     const receiver = helper.eth.createAccount();
 
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
-    let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send();
+    let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send({value: Number(2n * UNIQUE)});
     const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
     
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
before · tests/src/eth/proxy/nonFungibleProxy.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 {createCollectionExpectSuccess, createItemExpectSuccess} from '../../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents} from '../util/helpers';19import nonFungibleAbi from '../nonFungibleAbi.json';20import {expect} from 'chai';21import {submitTransactionAsync} from '../../substrate/substrate-api';22import Web3 from 'web3';23import {readFile} from 'fs/promises';24import {ApiPromise} from '@polkadot/api';25import {IKeyringPair} from '@polkadot/types/types';2627async function proxyWrap(api: ApiPromise, web3: Web3, wrapped: any, privateKeyWrapper: (account: string) => IKeyringPair) {28  // Proxy owner has no special privilegies, we don't need to reuse them29  const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);30  const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {31    from: owner,32    ...GAS_ARGS,33  });34  const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});35  return proxy;36}3738describe('NFT (Via EVM proxy): Information getting', () => {39  itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {40    const collection = await createCollectionExpectSuccess({41      mode: {type: 'NFT'},42    });43    const alice = privateKeyWrapper('//Alice');44    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);4546    await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});4748    const address = collectionIdToAddress(collection);49    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);50    const totalSupply = await contract.methods.totalSupply().call();5152    expect(totalSupply).to.equal('1');53  });5455  itWeb3('balanceOf', async ({api, web3, privateKeyWrapper}) => {56    const collection = await createCollectionExpectSuccess({57      mode: {type: 'NFT'},58    });59    const alice = privateKeyWrapper('//Alice');6061    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);62    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});63    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});64    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});6566    const address = collectionIdToAddress(collection);67    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);68    const balance = await contract.methods.balanceOf(caller).call();6970    expect(balance).to.equal('3');71  });7273  itWeb3('ownerOf', async ({api, web3, privateKeyWrapper}) => {74    const collection = await createCollectionExpectSuccess({75      mode: {type: 'NFT'},76    });77    const alice = privateKeyWrapper('//Alice');7879    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);80    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});8182    const address = collectionIdToAddress(collection);83    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);84    const owner = await contract.methods.ownerOf(tokenId).call();8586    expect(owner).to.equal(caller);87  });88});8990describe('NFT (Via EVM proxy): Plain calls', () => {91  itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {92    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);93    const collectionHelper = evmCollectionHelpers(web3, owner);94    const result = await collectionHelper.methods95      .createNonfungibleCollection('A', 'A', 'A')96      .send();97    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);98    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);99    const receiver = createEthAccount(web3);100    const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);101    const collectionEvm = evmCollection(web3, caller, collectionIdAddress);102    const contract = await proxyWrap(api, web3, collectionEvm, privateKeyWrapper);103    await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();104105    {106      const nextTokenId = await contract.methods.nextTokenId().call();107      expect(nextTokenId).to.be.equal('1');108      const result = await contract.methods.mintWithTokenURI(109        receiver,110        nextTokenId,111        'Test URI',112      ).send({from: caller});113      const events = normalizeEvents(result.events);114      events[0].address = events[0].address.toLocaleLowerCase();115116      expect(events).to.be.deep.equal([117        {118          address: collectionIdAddress.toLocaleLowerCase(),119          event: 'Transfer',120          args: {121            from: '0x0000000000000000000000000000000000000000',122            to: receiver,123            tokenId: nextTokenId,124          },125        },126      ]);127128      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');129    }130  });131  132  //TODO: CORE-302 add eth methods133  itWeb3.skip('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {134    const collection = await createCollectionExpectSuccess({135      mode: {type: 'NFT'},136    });137    const alice = privateKeyWrapper('//Alice');138139    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);140    const receiver = createEthAccount(web3);141142    const address = collectionIdToAddress(collection);143    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);144    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});145    await submitTransactionAsync(alice, changeAdminTx);146147    {148      const nextTokenId = await contract.methods.nextTokenId().call();149      expect(nextTokenId).to.be.equal('1');150      const result = await contract.methods.mintBulkWithTokenURI(151        receiver,152        [153          [nextTokenId, 'Test URI 0'],154          [+nextTokenId + 1, 'Test URI 1'],155          [+nextTokenId + 2, 'Test URI 2'],156        ],157      ).send({from: caller});158      const events = normalizeEvents(result.events);159160      expect(events).to.be.deep.equal([161        {162          address,163          event: 'Transfer',164          args: {165            from: '0x0000000000000000000000000000000000000000',166            to: receiver,167            tokenId: nextTokenId,168          },169        },170        {171          address,172          event: 'Transfer',173          args: {174            from: '0x0000000000000000000000000000000000000000',175            to: receiver,176            tokenId: String(+nextTokenId + 1),177          },178        },179        {180          address,181          event: 'Transfer',182          args: {183            from: '0x0000000000000000000000000000000000000000',184            to: receiver,185            tokenId: String(+nextTokenId + 2),186          },187        },188      ]);189190      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');191      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');192      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');193    }194  });195196  itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {197    const collection = await createCollectionExpectSuccess({198      mode: {type: 'NFT'},199    });200    const alice = privateKeyWrapper('//Alice');201    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);202203    const address = collectionIdToAddress(collection);204    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);205    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});206207    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});208    await submitTransactionAsync(alice, changeAdminTx);209210    {211      const result = await contract.methods.burn(tokenId).send({from: caller});212      const events = normalizeEvents(result.events);213214      expect(events).to.be.deep.equal([215        {216          address,217          event: 'Transfer',218          args: {219            from: contract.options.address,220            to: '0x0000000000000000000000000000000000000000',221            tokenId: tokenId.toString(),222          },223        },224      ]);225    }226  });227228  itWeb3('Can perform approve()', async ({web3, api, privateKeyWrapper}) => {229    const collection = await createCollectionExpectSuccess({230      mode: {type: 'NFT'},231    });232    const alice = privateKeyWrapper('//Alice');233    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);234    const spender = createEthAccount(web3);235236    const address = collectionIdToAddress(collection);237    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address), privateKeyWrapper);238    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});239240    {241      const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});242      const events = normalizeEvents(result.events);243244      expect(events).to.be.deep.equal([245        {246          address,247          event: 'Approval',248          args: {249            owner: contract.options.address,250            approved: spender,251            tokenId: tokenId.toString(),252          },253        },254      ]);255    }256  });257258  itWeb3('Can perform transferFrom()', async ({web3, api, privateKeyWrapper}) => {259    const collection = await createCollectionExpectSuccess({260      mode: {type: 'NFT'},261    });262    const alice = privateKeyWrapper('//Alice');263    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);264    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);265266    const receiver = createEthAccount(web3);267268    const address = collectionIdToAddress(collection);269    const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});270    const contract = await proxyWrap(api, web3, evmCollection, privateKeyWrapper);271    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});272273    await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});274275    {276      const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});277      const events = normalizeEvents(result.events);278      expect(events).to.be.deep.equal([279        {280          address,281          event: 'Transfer',282          args: {283            from: owner,284            to: receiver,285            tokenId: tokenId.toString(),286          },287        },288      ]);289    }290291    {292      const balance = await contract.methods.balanceOf(receiver).call();293      expect(+balance).to.equal(1);294    }295296    {297      const balance = await contract.methods.balanceOf(contract.options.address).call();298      expect(+balance).to.equal(0);299    }300  });301302  itWeb3('Can perform transfer()', async ({web3, api, privateKeyWrapper}) => {303    const collection = await createCollectionExpectSuccess({304      mode: {type: 'NFT'},305    });306    const alice = privateKeyWrapper('//Alice');307    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308    const receiver = createEthAccount(web3);309310    const address = collectionIdToAddress(collection);311    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);312    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});313314    {315      const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});316      const events = normalizeEvents(result.events);317      expect(events).to.be.deep.equal([318        {319          address,320          event: 'Transfer',321          args: {322            from: contract.options.address,323            to: receiver,324            tokenId: tokenId.toString(),325          },326        },327      ]);328    }329330    {331      const balance = await contract.methods.balanceOf(contract.options.address).call();332      expect(+balance).to.equal(0);333    }334335    {336      const balance = await contract.methods.balanceOf(receiver).call();337      expect(+balance).to.equal(1);338    }339  });340});
after · tests/src/eth/proxy/nonFungibleProxy.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 {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents} from '../util/helpers';19import nonFungibleAbi from '../nonFungibleAbi.json';20import {expect} from 'chai';21import {submitTransactionAsync} from '../../substrate/substrate-api';22import Web3 from 'web3';23import {readFile} from 'fs/promises';24import {ApiPromise} from '@polkadot/api';25import {IKeyringPair} from '@polkadot/types/types';2627async function proxyWrap(api: ApiPromise, web3: Web3, wrapped: any, privateKeyWrapper: (account: string) => IKeyringPair) {28  // Proxy owner has no special privilegies, we don't need to reuse them29  const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);30  const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {31    from: owner,32    ...GAS_ARGS,33  });34  const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});35  return proxy;36}3738describe('NFT (Via EVM proxy): Information getting', () => {39  itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {40    const collection = await createCollectionExpectSuccess({41      mode: {type: 'NFT'},42    });43    const alice = privateKeyWrapper('//Alice');44    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);4546    await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});4748    const address = collectionIdToAddress(collection);49    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);50    const totalSupply = await contract.methods.totalSupply().call();5152    expect(totalSupply).to.equal('1');53  });5455  itWeb3('balanceOf', async ({api, web3, privateKeyWrapper}) => {56    const collection = await createCollectionExpectSuccess({57      mode: {type: 'NFT'},58    });59    const alice = privateKeyWrapper('//Alice');6061    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);62    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});63    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});64    await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});6566    const address = collectionIdToAddress(collection);67    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);68    const balance = await contract.methods.balanceOf(caller).call();6970    expect(balance).to.equal('3');71  });7273  itWeb3('ownerOf', async ({api, web3, privateKeyWrapper}) => {74    const collection = await createCollectionExpectSuccess({75      mode: {type: 'NFT'},76    });77    const alice = privateKeyWrapper('//Alice');7879    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);80    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});8182    const address = collectionIdToAddress(collection);83    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);84    const owner = await contract.methods.ownerOf(tokenId).call();8586    expect(owner).to.equal(caller);87  });88});8990describe('NFT (Via EVM proxy): Plain calls', () => {91  itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {92    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);93    const collectionHelper = evmCollectionHelpers(web3, owner);94    const result = await collectionHelper.methods95      .createNonfungibleCollection('A', 'A', 'A')96      .send({value: Number(2n * UNIQUE)});97    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);98    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);99    const receiver = createEthAccount(web3);100    const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);101    const collectionEvm = evmCollection(web3, caller, collectionIdAddress);102    const contract = await proxyWrap(api, web3, collectionEvm, privateKeyWrapper);103    await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();104105    {106      const nextTokenId = await contract.methods.nextTokenId().call();107      expect(nextTokenId).to.be.equal('1');108      const result = await contract.methods.mintWithTokenURI(109        receiver,110        nextTokenId,111        'Test URI',112      ).send({from: caller});113      const events = normalizeEvents(result.events);114      events[0].address = events[0].address.toLocaleLowerCase();115116      expect(events).to.be.deep.equal([117        {118          address: collectionIdAddress.toLocaleLowerCase(),119          event: 'Transfer',120          args: {121            from: '0x0000000000000000000000000000000000000000',122            to: receiver,123            tokenId: nextTokenId,124          },125        },126      ]);127128      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');129    }130  });131  132  //TODO: CORE-302 add eth methods133  itWeb3.skip('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {134    const collection = await createCollectionExpectSuccess({135      mode: {type: 'NFT'},136    });137    const alice = privateKeyWrapper('//Alice');138139    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);140    const receiver = createEthAccount(web3);141142    const address = collectionIdToAddress(collection);143    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);144    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});145    await submitTransactionAsync(alice, changeAdminTx);146147    {148      const nextTokenId = await contract.methods.nextTokenId().call();149      expect(nextTokenId).to.be.equal('1');150      const result = await contract.methods.mintBulkWithTokenURI(151        receiver,152        [153          [nextTokenId, 'Test URI 0'],154          [+nextTokenId + 1, 'Test URI 1'],155          [+nextTokenId + 2, 'Test URI 2'],156        ],157      ).send({from: caller});158      const events = normalizeEvents(result.events);159160      expect(events).to.be.deep.equal([161        {162          address,163          event: 'Transfer',164          args: {165            from: '0x0000000000000000000000000000000000000000',166            to: receiver,167            tokenId: nextTokenId,168          },169        },170        {171          address,172          event: 'Transfer',173          args: {174            from: '0x0000000000000000000000000000000000000000',175            to: receiver,176            tokenId: String(+nextTokenId + 1),177          },178        },179        {180          address,181          event: 'Transfer',182          args: {183            from: '0x0000000000000000000000000000000000000000',184            to: receiver,185            tokenId: String(+nextTokenId + 2),186          },187        },188      ]);189190      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');191      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');192      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');193    }194  });195196  itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {197    const collection = await createCollectionExpectSuccess({198      mode: {type: 'NFT'},199    });200    const alice = privateKeyWrapper('//Alice');201    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);202203    const address = collectionIdToAddress(collection);204    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);205    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});206207    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});208    await submitTransactionAsync(alice, changeAdminTx);209210    {211      const result = await contract.methods.burn(tokenId).send({from: caller});212      const events = normalizeEvents(result.events);213214      expect(events).to.be.deep.equal([215        {216          address,217          event: 'Transfer',218          args: {219            from: contract.options.address,220            to: '0x0000000000000000000000000000000000000000',221            tokenId: tokenId.toString(),222          },223        },224      ]);225    }226  });227228  itWeb3('Can perform approve()', async ({web3, api, privateKeyWrapper}) => {229    const collection = await createCollectionExpectSuccess({230      mode: {type: 'NFT'},231    });232    const alice = privateKeyWrapper('//Alice');233    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);234    const spender = createEthAccount(web3);235236    const address = collectionIdToAddress(collection);237    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address), privateKeyWrapper);238    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});239240    {241      const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});242      const events = normalizeEvents(result.events);243244      expect(events).to.be.deep.equal([245        {246          address,247          event: 'Approval',248          args: {249            owner: contract.options.address,250            approved: spender,251            tokenId: tokenId.toString(),252          },253        },254      ]);255    }256  });257258  itWeb3('Can perform transferFrom()', async ({web3, api, privateKeyWrapper}) => {259    const collection = await createCollectionExpectSuccess({260      mode: {type: 'NFT'},261    });262    const alice = privateKeyWrapper('//Alice');263    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);264    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);265266    const receiver = createEthAccount(web3);267268    const address = collectionIdToAddress(collection);269    const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});270    const contract = await proxyWrap(api, web3, evmCollection, privateKeyWrapper);271    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});272273    await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});274275    {276      const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});277      const events = normalizeEvents(result.events);278      expect(events).to.be.deep.equal([279        {280          address,281          event: 'Transfer',282          args: {283            from: owner,284            to: receiver,285            tokenId: tokenId.toString(),286          },287        },288      ]);289    }290291    {292      const balance = await contract.methods.balanceOf(receiver).call();293      expect(+balance).to.equal(1);294    }295296    {297      const balance = await contract.methods.balanceOf(contract.options.address).call();298      expect(+balance).to.equal(0);299    }300  });301302  itWeb3('Can perform transfer()', async ({web3, api, privateKeyWrapper}) => {303    const collection = await createCollectionExpectSuccess({304      mode: {type: 'NFT'},305    });306    const alice = privateKeyWrapper('//Alice');307    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308    const receiver = createEthAccount(web3);309310    const address = collectionIdToAddress(collection);311    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);312    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});313314    {315      const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});316      const events = normalizeEvents(result.events);317      expect(events).to.be.deep.equal([318        {319          address,320          event: 'Transfer',321          args: {322            from: contract.options.address,323            to: receiver,324            tokenId: tokenId.toString(),325          },326        },327      ]);328    }329330    {331      const balance = await contract.methods.balanceOf(contract.options.address).call();332      expect(+balance).to.equal(0);333    }334335    {336      const balance = await contract.methods.balanceOf(receiver).call();337      expect(+balance).to.equal(1);338    }339  });340});
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -18,6 +18,7 @@
 import {EthUniqueHelper, expect, itEth, usingEthPlaygrounds} from './util/playgrounds';
 import {IKeyringPair} from '@polkadot/types/types';
 import {Contract} from 'web3-eth-contract';
+import {UNIQUE} from '../util/helpers';
 
 describe('Refungible token: Information getting', () => {
   let donor: IKeyringPair;
@@ -80,7 +81,7 @@
     const receiver = helper.eth.createAccount();
 
     const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
-    let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send();
+    let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send({value: Number(2n * UNIQUE)});
     const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);
     
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -145,7 +145,7 @@
   const collectionHelper = evmCollectionHelpers(web3, owner);
   const result = await collectionHelper.methods
     .createRFTCollection('A', 'B', 'C')
-    .send();
+    .send({value: Number(2n * UNIQUE)});
   return await getCollectionAddressFromResult(api, result);
 }
 
@@ -154,7 +154,7 @@
   const collectionHelper = evmCollectionHelpers(web3, owner);
   const result = await collectionHelper.methods
     .createNonfungibleCollection('A', 'B', 'C')
-    .send();
+    .send({value: Number(2n * UNIQUE)});
   return await getCollectionAddressFromResult(api, result);
 }
 
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
@@ -170,9 +170,10 @@
   }
 
   async createNonfungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {
+    const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
-
-    const result = await collectionHelper.methods.createNonfungibleCollection(name, description, tokenPrefix).send();
+        
+    const result = await collectionHelper.methods.createNonfungibleCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
 
     const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);
@@ -181,9 +182,10 @@
   }
 
   async createRefungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {
+    const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();
     const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
-
-    const result = await collectionHelper.methods.createRFTCollection(name, description, tokenPrefix).send();
+        
+    const result = await collectionHelper.methods.createRFTCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});
 
     const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
     const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2034,6 +2034,9 @@
 
 
 class BalanceGroup extends HelperGroup {
+  getCollectionCreationPrice(): bigint {
+    return 2n * this.helper.balance.getOneTokenNominal();
+  }
   /**
    * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).
    * @example getOneTokenNominal()