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
before · tests/src/eth/fractionalizer/Fractionalizer.sol
1// SPDX-License-Identifier:  Apache License2pragma solidity >=0.8.0;3import {CollectionHelpers} from "../api/CollectionHelpers.sol";4import {ContractHelpers} from "../api/ContractHelpers.sol";5import {UniqueRefungibleToken} from "../api/UniqueRefungibleToken.sol";6import {UniqueRefungible} from "../api/UniqueRefungible.sol";7import {UniqueNFT} from "../api/UniqueNFT.sol";89/// @dev Fractionalization contract. It stores mappings between NFT and RFT tokens,10///  stores allowlist of NFT tokens available for fractionalization, has methods11///  for fractionalization and defractionalization of NFT tokens.12contract Fractionalizer {13	struct Token {14		address _collection;15		uint256 _tokenId;16	}17	address rftCollection;18	mapping(address => bool) nftCollectionAllowList;19	mapping(address => mapping(uint256 => uint256)) public nft2rftMapping;20	mapping(address => Token) public rft2nftMapping;21	//use constant to reduce gas cost22	bytes32 constant refungibleCollectionType = keccak256(bytes("ReFungible"));2324	receive() external payable onlyOwner {}2526	/// @dev Method modifier to only allow contract owner to call it.27	modifier onlyOwner() {28		address contracthelpersAddress = 0x842899ECF380553E8a4de75bF534cdf6fBF64049;29		ContractHelpers contractHelpers = ContractHelpers(contracthelpersAddress);30		address contractOwner = contractHelpers.contractOwner(address(this));31		require(msg.sender == contractOwner, "Only owner can");32		_;33	}3435	/// @dev This emits when RFT collection setting is changed.36	event RFTCollectionSet(address _collection);3738	/// @dev This emits when NFT collection is allowed or disallowed.39	event AllowListSet(address _collection, bool _status);4041	/// @dev This emits when NFT token is fractionalized by contract.42	event Fractionalized(address _collection, uint256 _tokenId, address _rftToken, uint128 _amount);4344	/// @dev This emits when NFT token is defractionalized by contract.45	event Defractionalized(address _rftToken, address _nftCollection, uint256 _nftTokenId);4647	/// Set RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens48	/// would be created in this collection.49	/// @dev Throws if RFT collection is already configured for this contract.50	///  Throws if collection of wrong type (NFT, Fungible) is provided instead51	///  of RFT collection.52	///  Throws if `msg.sender` is not owner or admin of provided RFT collection.53	///  Can only be called by contract owner.54	/// @param _collection address of RFT collection.55	function setRFTCollection(address _collection) external onlyOwner {56		require(rftCollection == address(0), "RFT collection is already set");57		UniqueRefungible refungibleContract = UniqueRefungible(_collection);58		string memory collectionType = refungibleContract.uniqueCollectionType();5960		// compare hashed to reduce gas cost61		require(62			keccak256(bytes(collectionType)) == refungibleCollectionType,63			"Wrong collection type. Collection is not refungible."64		);65		require(66			refungibleContract.isOwnerOrAdmin(address(this)),67			"Fractionalizer contract should be an admin of the collection"68		);69		rftCollection = _collection;70		emit RFTCollectionSet(rftCollection);71	}7273	/// Creates and sets RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens74	/// would be created in this collection.75	/// @dev Throws if RFT collection is already configured for this contract.76	///  Can only be called by contract owner.77	/// @param _name name for created RFT collection.78	/// @param _description description for created RFT collection.79	/// @param _tokenPrefix token prefix for created RFT collection.80	function createAndSetRFTCollection(81		string calldata _name,82		string calldata _description,83		string calldata _tokenPrefix84	) external onlyOwner {85		require(rftCollection == address(0), "RFT collection is already set");86		address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;87		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection(_name, _description, _tokenPrefix);88		emit RFTCollectionSet(rftCollection);89	}9091	/// Allow or disallow NFT collection tokens from being fractionalized by this contract.92	/// @dev Can only be called by contract owner.93	/// @param collection NFT token address.94	/// @param status `true` to allow and `false` to disallow NFT token.95	function setNftCollectionIsAllowed(address collection, bool status) external onlyOwner {96		nftCollectionAllowList[collection] = status;97		emit AllowListSet(collection, status);98	}99100	/// Fractionilize NFT token.101	/// @dev Takes NFT token from `msg.sender` and transfers RFT token to `msg.sender`102	///  instead. Creates new RFT token if provided NFT token never was fractionalized103	///  by this contract or existing RFT token if it was.104	///  Throws if RFT collection isn't configured for this contract.105	///  Throws if fractionalization of provided NFT token is not allowed106	///  Throws if `msg.sender` is not owner of provided NFT token107	/// @param  _collection NFT collection address108	/// @param  _token id of NFT token to be fractionalized109	/// @param  _pieces number of pieces new RFT token would have110	function nft2rft(111		address _collection,112		uint256 _token,113		uint128 _pieces114	) external {115		require(rftCollection != address(0), "RFT collection is not set");116		UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);117		require(118			nftCollectionAllowList[_collection] == true,119			"Fractionalization of this collection is not allowed by admin"120		);121		require(UniqueNFT(_collection).ownerOf(_token) == msg.sender, "Only token owner could fractionalize it");122		UniqueNFT(_collection).transferFrom(msg.sender, address(this), _token);123		uint256 rftTokenId;124		address rftTokenAddress;125		UniqueRefungibleToken rftTokenContract;126		if (nft2rftMapping[_collection][_token] == 0) {127			rftTokenId = rftCollectionContract.nextTokenId();128			rftCollectionContract.mint(address(this), rftTokenId);129			rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);130			nft2rftMapping[_collection][_token] = rftTokenId;131			rft2nftMapping[rftTokenAddress] = Token(_collection, _token);132133			rftTokenContract = UniqueRefungibleToken(rftTokenAddress);134		} else {135			rftTokenId = nft2rftMapping[_collection][_token];136			rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);137			rftTokenContract = UniqueRefungibleToken(rftTokenAddress);138		}139		rftTokenContract.repartition(_pieces);140		rftTokenContract.transfer(msg.sender, _pieces);141		emit Fractionalized(_collection, _token, rftTokenAddress, _pieces);142	}143144	/// Defrationalize NFT token.145	/// @dev Takes RFT token from `msg.sender` and transfers corresponding NFT token146	///  to `msg.sender` instead.147	///  Throws if RFT collection isn't configured for this contract.148	///  Throws if provided RFT token is no from configured RFT collection.149	///  Throws if RFT token was not created by this contract.150	///  Throws if `msg.sender` isn't owner of all RFT token pieces.151	/// @param _collection RFT collection address152	/// @param _token id of RFT token153	function rft2nft(address _collection, uint256 _token) external {154		require(rftCollection != address(0), "RFT collection is not set");155		require(rftCollection == _collection, "Wrong RFT collection");156		UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);157		address rftTokenAddress = rftCollectionContract.tokenContractAddress(_token);158		Token memory nftToken = rft2nftMapping[rftTokenAddress];159		require(nftToken._collection != address(0), "No corresponding NFT token found");160		UniqueRefungibleToken rftTokenContract = UniqueRefungibleToken(rftTokenAddress);161		require(162			rftTokenContract.balanceOf(msg.sender) == rftTokenContract.totalSupply(),163			"Not all pieces are owned by the caller"164		);165		rftCollectionContract.transferFrom(msg.sender, address(this), _token);166		UniqueNFT(nftToken._collection).transferFrom(address(this), msg.sender, nftToken._tokenId);167		emit Defractionalized(rftTokenAddress, nftToken._collection, nftToken._tokenId);168	}169}
after · tests/src/eth/fractionalizer/Fractionalizer.sol
1// SPDX-License-Identifier:  Apache License2pragma solidity >=0.8.0;3import {CollectionHelpers} from "../api/CollectionHelpers.sol";4import {ContractHelpers} from "../api/ContractHelpers.sol";5import {UniqueRefungibleToken} from "../api/UniqueRefungibleToken.sol";6import {UniqueRefungible} from "../api/UniqueRefungible.sol";7import {UniqueNFT} from "../api/UniqueNFT.sol";89/// @dev Fractionalization contract. It stores mappings between NFT and RFT tokens,10///  stores allowlist of NFT tokens available for fractionalization, has methods11///  for fractionalization and defractionalization of NFT tokens.12contract Fractionalizer {13	struct Token {14		address _collection;15		uint256 _tokenId;16	}17	address rftCollection;18	mapping(address => bool) nftCollectionAllowList;19	mapping(address => mapping(uint256 => uint256)) public nft2rftMapping;20	mapping(address => Token) public rft2nftMapping;21	//use constant to reduce gas cost22	bytes32 constant refungibleCollectionType = keccak256(bytes("ReFungible"));2324	receive() external payable onlyOwner {}2526	/// @dev Method modifier to only allow contract owner to call it.27	modifier onlyOwner() {28		address contracthelpersAddress = 0x842899ECF380553E8a4de75bF534cdf6fBF64049;29		ContractHelpers contractHelpers = ContractHelpers(contracthelpersAddress);30		address contractOwner = contractHelpers.contractOwner(address(this));31		require(msg.sender == contractOwner, "Only owner can");32		_;33	}3435	/// @dev This emits when RFT collection setting is changed.36	event RFTCollectionSet(address _collection);3738	/// @dev This emits when NFT collection is allowed or disallowed.39	event AllowListSet(address _collection, bool _status);4041	/// @dev This emits when NFT token is fractionalized by contract.42	event Fractionalized(address _collection, uint256 _tokenId, address _rftToken, uint128 _amount);4344	/// @dev This emits when NFT token is defractionalized by contract.45	event Defractionalized(address _rftToken, address _nftCollection, uint256 _nftTokenId);4647	/// Set RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens48	/// would be created in this collection.49	/// @dev Throws if RFT collection is already configured for this contract.50	///  Throws if collection of wrong type (NFT, Fungible) is provided instead51	///  of RFT collection.52	///  Throws if `msg.sender` is not owner or admin of provided RFT collection.53	///  Can only be called by contract owner.54	/// @param _collection address of RFT collection.55	function setRFTCollection(address _collection) external onlyOwner {56		require(rftCollection == address(0), "RFT collection is already set");57		UniqueRefungible refungibleContract = UniqueRefungible(_collection);58		string memory collectionType = refungibleContract.uniqueCollectionType();5960		// compare hashed to reduce gas cost61		require(62			keccak256(bytes(collectionType)) == refungibleCollectionType,63			"Wrong collection type. Collection is not refungible."64		);65		require(66			refungibleContract.isOwnerOrAdmin(address(this)),67			"Fractionalizer contract should be an admin of the collection"68		);69		rftCollection = _collection;70		emit RFTCollectionSet(rftCollection);71	}7273	/// Creates and sets RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens74	/// would be created in this collection.75	/// @dev Throws if RFT collection is already configured for this contract.76	///  Can only be called by contract owner.77	/// @param _name name for created RFT collection.78	/// @param _description description for created RFT collection.79	/// @param _tokenPrefix token prefix for created RFT collection.80	function createAndSetRFTCollection(81		string calldata _name,82		string calldata _description,83		string calldata _tokenPrefix84	) external payable onlyOwner {85		require(rftCollection == address(0), "RFT collection is already set");86		address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;87		rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(_name, _description, _tokenPrefix);88		emit RFTCollectionSet(rftCollection);89	}9091	/// Allow or disallow NFT collection tokens from being fractionalized by this contract.92	/// @dev Can only be called by contract owner.93	/// @param collection NFT token address.94	/// @param status `true` to allow and `false` to disallow NFT token.95	function setNftCollectionIsAllowed(address collection, bool status) external onlyOwner {96		nftCollectionAllowList[collection] = status;97		emit AllowListSet(collection, status);98	}99100	/// Fractionilize NFT token.101	/// @dev Takes NFT token from `msg.sender` and transfers RFT token to `msg.sender`102	///  instead. Creates new RFT token if provided NFT token never was fractionalized103	///  by this contract or existing RFT token if it was.104	///  Throws if RFT collection isn't configured for this contract.105	///  Throws if fractionalization of provided NFT token is not allowed106	///  Throws if `msg.sender` is not owner of provided NFT token107	/// @param  _collection NFT collection address108	/// @param  _token id of NFT token to be fractionalized109	/// @param  _pieces number of pieces new RFT token would have110	function nft2rft(111		address _collection,112		uint256 _token,113		uint128 _pieces114	) external {115		require(rftCollection != address(0), "RFT collection is not set");116		UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);117		require(118			nftCollectionAllowList[_collection] == true,119			"Fractionalization of this collection is not allowed by admin"120		);121		require(UniqueNFT(_collection).ownerOf(_token) == msg.sender, "Only token owner could fractionalize it");122		UniqueNFT(_collection).transferFrom(msg.sender, address(this), _token);123		uint256 rftTokenId;124		address rftTokenAddress;125		UniqueRefungibleToken rftTokenContract;126		if (nft2rftMapping[_collection][_token] == 0) {127			rftTokenId = rftCollectionContract.nextTokenId();128			rftCollectionContract.mint(address(this), rftTokenId);129			rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);130			nft2rftMapping[_collection][_token] = rftTokenId;131			rft2nftMapping[rftTokenAddress] = Token(_collection, _token);132133			rftTokenContract = UniqueRefungibleToken(rftTokenAddress);134		} else {135			rftTokenId = nft2rftMapping[_collection][_token];136			rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);137			rftTokenContract = UniqueRefungibleToken(rftTokenAddress);138		}139		rftTokenContract.repartition(_pieces);140		rftTokenContract.transfer(msg.sender, _pieces);141		emit Fractionalized(_collection, _token, rftTokenAddress, _pieces);142	}143144	/// Defrationalize NFT token.145	/// @dev Takes RFT token from `msg.sender` and transfers corresponding NFT token146	///  to `msg.sender` instead.147	///  Throws if RFT collection isn't configured for this contract.148	///  Throws if provided RFT token is no from configured RFT collection.149	///  Throws if RFT token was not created by this contract.150	///  Throws if `msg.sender` isn't owner of all RFT token pieces.151	/// @param _collection RFT collection address152	/// @param _token id of RFT token153	function rft2nft(address _collection, uint256 _token) external {154		require(rftCollection != address(0), "RFT collection is not set");155		require(rftCollection == _collection, "Wrong RFT collection");156		UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);157		address rftTokenAddress = rftCollectionContract.tokenContractAddress(_token);158		Token memory nftToken = rft2nftMapping[rftTokenAddress];159		require(nftToken._collection != address(0), "No corresponding NFT token found");160		UniqueRefungibleToken rftTokenContract = UniqueRefungibleToken(rftTokenAddress);161		require(162			rftTokenContract.balanceOf(msg.sender) == rftTokenContract.totalSupply(),163			"Not all pieces are owned by the caller"164		);165		rftCollectionContract.transferFrom(msg.sender, address(this), _token);166		UniqueNFT(nftToken._collection).transferFrom(address(this), msg.sender, nftToken._tokenId);167		emit Defractionalized(rftTokenAddress, nftToken._collection, nftToken._tokenId);168	}169}
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
--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -14,7 +14,7 @@
 // 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 {createCollectionExpectSuccess, createItemExpectSuccess} from '../../util/helpers';
+import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../../util/helpers';
 import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents} from '../util/helpers';
 import nonFungibleAbi from '../nonFungibleAbi.json';
 import {expect} from 'chai';
@@ -93,7 +93,7 @@
     const collectionHelper = evmCollectionHelpers(web3, owner);
     const result = await collectionHelper.methods
       .createNonfungibleCollection('A', 'A', 'A')
-      .send();
+      .send({value: Number(2n * UNIQUE)});
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = createEthAccount(web3);
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()