git.delta.rocks / unique-network / refs/commits / 8c337cff2bc8

difftreelog

refactor rename function

Trubnikov Sergey2022-09-13parent: #8a59560.patch.diff
in: master

11 files changed

modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -245,6 +245,7 @@
 	}
 
 	#[weight(<SelfWeightOf<T>>::create_collection())]
+	#[solidity(rename_selector = "createRFTCollection")]
 	fn create_refungible_collection(
 		&mut self,
 		caller: caller,
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -30,7 +30,7 @@
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x675f3074
+/// @dev the ERC-165 identifier for this interface is 0x88ee8ef1
 contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create an NFT collection
 	/// @param name Name of the collection
@@ -69,9 +69,9 @@
 		return 0x0000000000000000000000000000000000000000;
 	}
 
-	/// @dev EVM selector for this function is: 0x44a68ad5,
-	///  or in textual repr: createRefungibleCollection(string,string,string)
-	function createRefungibleCollection(
+	/// @dev EVM selector for this function is: 0xab173450,
+	///  or in textual repr: createRFTCollection(string,string,string)
+	function createRFTCollection(
 		string memory name,
 		string memory description,
 		string memory tokenPrefix
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -21,7 +21,7 @@
 }
 
 /// @title Contract, which allows users to operate with collections
-/// @dev the ERC-165 identifier for this interface is 0x675f3074
+/// @dev the ERC-165 identifier for this interface is 0x88ee8ef1
 interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
 	/// Create an NFT collection
 	/// @param name Name of the collection
@@ -45,9 +45,9 @@
 		string memory baseUri
 	) external returns (address);
 
-	/// @dev EVM selector for this function is: 0x44a68ad5,
-	///  or in textual repr: createRefungibleCollection(string,string,string)
-	function createRefungibleCollection(
+	/// @dev EVM selector for this function is: 0xab173450,
+	///  or in textual repr: createRFTCollection(string,string,string)
+	function createRFTCollection(
 		string memory name,
 		string memory description,
 		string memory tokenPrefix
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/collectionHelpersAbi.json
+++ b/tests/src/eth/collectionHelpersAbi.json
@@ -59,7 +59,7 @@
       { "internalType": "string", "name": "description", "type": "string" },
       { "internalType": "string", "name": "tokenPrefix", "type": "string" }
     ],
-    "name": "createRefungibleCollection",
+    "name": "createRFTCollection",
     "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
     "stateMutability": "nonpayable",
     "type": "function"
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -41,7 +41,7 @@
   
     const collectionCountBefore = await getCreatedCollectionCount(api);
     const result = await collectionHelper.methods
-      .createRefungibleCollection(collectionName, description, tokenPrefix)
+      .createRFTCollection(collectionName, description, tokenPrefix)
       .send();
     const collectionCountAfter = await getCreatedCollectionCount(api);
   
@@ -65,7 +65,7 @@
       .call()).to.be.false;
 
     await collectionHelpers.methods
-      .createRefungibleCollection('A', 'A', 'A')
+      .createRFTCollection('A', 'A', 'A')
       .send();
     
     expect(await collectionHelpers.methods
@@ -76,7 +76,7 @@
   itWeb3('Set sponsorship', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    let result = await collectionHelpers.methods.createRefungibleCollection('Sponsor collection', '1', '1').send();
+    let result = await collectionHelpers.methods.createRFTCollection('Sponsor collection', '1', '1').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
@@ -96,7 +96,7 @@
   itWeb3('Set limits', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    const result = await collectionHelpers.methods.createRefungibleCollection('Const collection', '5', '5').send();
+    const result = await collectionHelpers.methods.createRFTCollection('Const collection', '5', '5').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const limits = {
       accountTokenOwnershipLimit: 1000,
@@ -141,7 +141,7 @@
       .isCollectionExist(collectionAddressForNonexistentCollection).call())
       .to.be.false;
     
-    const result = await collectionHelpers.methods.createRefungibleCollection('Collection address exist', '7', '7').send();
+    const result = await collectionHelpers.methods.createRFTCollection('Collection address exist', '7', '7').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     expect(await collectionHelpers.methods
       .isCollectionExist(collectionIdAddress).call())
@@ -164,7 +164,7 @@
       const tokenPrefix = 'A';
     
       await expect(helper.methods
-        .createRefungibleCollection(collectionName, description, tokenPrefix)
+        .createRFTCollection(collectionName, description, tokenPrefix)
         .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGHT);
       
     }
@@ -174,7 +174,7 @@
       const description = 'A'.repeat(MAX_DESCRIPTION_LENGHT + 1);
       const tokenPrefix = 'A';
       await expect(helper.methods
-        .createRefungibleCollection(collectionName, description, tokenPrefix)
+        .createRFTCollection(collectionName, description, tokenPrefix)
         .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGHT);
     }
     {  
@@ -183,7 +183,7 @@
       const description = 'A';
       const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGHT + 1);
       await expect(helper.methods
-        .createRefungibleCollection(collectionName, description, tokenPrefix)
+        .createRFTCollection(collectionName, description, tokenPrefix)
         .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGHT);
     }
   });
@@ -196,7 +196,7 @@
     const tokenPrefix = 'A';
     
     await expect(helper.methods
-      .createRefungibleCollection(collectionName, description, tokenPrefix)
+      .createRFTCollection(collectionName, description, tokenPrefix)
       .call()).to.be.rejectedWith('NotSufficientFounds');
   });
 
@@ -204,7 +204,7 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const notOwner = createEthAccount(web3);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    const result = await collectionHelpers.methods.createRefungibleCollection('A', 'A', 'A').send();
+    const result = await collectionHelpers.methods.createRFTCollection('A', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contractEvmFromNotOwner = evmCollection(web3, notOwner, collectionIdAddress, {type: 'ReFungible'});
     const EXPECTED_ERROR = 'NoPermission';
@@ -229,7 +229,7 @@
   itWeb3('(!negative test!) Set limits', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const collectionHelpers = evmCollectionHelpers(web3, owner);
-    const result = await collectionHelpers.methods.createRefungibleCollection('Schema collection', 'A', 'A').send();
+    const result = await collectionHelpers.methods.createRFTCollection('Schema collection', 'A', 'A').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
     await expect(collectionEvm.methods
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    bytes32 refungibleCollectionType = keccak256(bytes("ReFungible"));2223    receive() external payable onlyOwner {}2425    /// @dev Method modifier to only allow contract owner to call it.26    modifier onlyOwner() {27        address contracthelpersAddress = 0x842899ECF380553E8a4de75bF534cdf6fBF64049;28        ContractHelpers contractHelpers = ContractHelpers(contracthelpersAddress);29        address contractOwner = contractHelpers.contractOwner(address(this));30        require(msg.sender == contractOwner, "Only owner can");31        _;32    }3334    /// @dev This emits when RFT collection setting is changed.35    event RFTCollectionSet(address _collection);3637    /// @dev This emits when NFT collection is allowed or disallowed.38    event AllowListSet(address _collection, bool _status);3940    /// @dev This emits when NFT token is fractionalized by contract.41    event Fractionalized(address _collection, uint256 _tokenId, address _rftToken, uint128 _amount);4243    /// @dev This emits when NFT token is defractionalized by contract.44    event Defractionalized(address _rftToken, address _nftCollection, uint256 _nftTokenId);4546    /// Set RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens47    /// would be created in this collection.48    /// @dev Throws if RFT collection is already configured for this contract.49    ///  Throws if collection of wrong type (NFT, Fungible) is provided instead50    ///  of RFT collection.51    ///  Throws if `msg.sender` is not owner or admin of provided RFT collection.52    ///  Can only be called by contract owner.53    /// @param _collection address of RFT collection.54    function setRFTCollection(address _collection) public onlyOwner {55        require(56            rftCollection == address(0),57            "RFT collection is already set"58        );59        UniqueRefungible refungibleContract = UniqueRefungible(_collection);60        string memory collectionType = refungibleContract.uniqueCollectionType();61        62        require(63            keccak256(bytes(collectionType)) == refungibleCollectionType,64            "Wrong collection type. Collection is not refungible."65        );66        require(67            refungibleContract.isOwnerOrAdmin(address(this)),68            "Fractionalizer contract should be an admin of the collection"69        );70        rftCollection = _collection;71        emit RFTCollectionSet(rftCollection);72    }7374    /// Creates and sets RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens75    /// would be created in this collection.76    /// @dev Throws if RFT collection is already configured for this contract.77    ///  Can only be called by contract owner.78    /// @param _name name for created RFT collection.79    /// @param _description description for created RFT collection.80    /// @param _tokenPrefix token prefix for created RFT collection.81    function createAndSetRFTCollection(string calldata _name, string calldata _description, string calldata _tokenPrefix) public onlyOwner {82        require(83            rftCollection == address(0),84            "RFT collection is already set"85        );86        address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;87        rftCollection = CollectionHelpers(collectionHelpers).createRefungibleCollection(_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) public 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(address _collection, uint256 _token, uint128 _pieces) public {111        require(112            rftCollection != address(0),113            "RFT collection is not set"114        );115        UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);116        require(117            nftCollectionAllowList[_collection] == true,118            "Fractionalization of this collection is not allowed by admin"119        );120        require(121            UniqueNFT(_collection).ownerOf(_token) == msg.sender,122            "Only token owner could fractionalize it"123        );124        UniqueNFT(_collection).transferFrom(125            msg.sender,126            address(this),127            _token128        );129        uint256 rftTokenId;130        address rftTokenAddress;131        UniqueRefungibleToken rftTokenContract;132        if (nft2rftMapping[_collection][_token] == 0) {133            rftTokenId = rftCollectionContract.nextTokenId();134            rftCollectionContract.mint(address(this), rftTokenId);135            rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);136            nft2rftMapping[_collection][_token] = rftTokenId;137            rft2nftMapping[rftTokenAddress] = Token(_collection, _token);138139            rftTokenContract = UniqueRefungibleToken(rftTokenAddress);140        } else {141            rftTokenId = nft2rftMapping[_collection][_token];142            rftTokenAddress = rftCollectionContract.tokenContractAddress(rftTokenId);143            rftTokenContract = UniqueRefungibleToken(rftTokenAddress);144        }145        rftTokenContract.repartition(_pieces);146        rftTokenContract.transfer(msg.sender, _pieces);147        emit Fractionalized(_collection, _token, rftTokenAddress, _pieces);148    }149150    /// Defrationalize NFT token.151    /// @dev Takes RFT token from `msg.sender` and transfers corresponding NFT token152    ///  to `msg.sender` instead.153    ///  Throws if RFT collection isn't configured for this contract.154    ///  Throws if provided RFT token is no from configured RFT collection.155    ///  Throws if RFT token was not created by this contract.156    ///  Throws if `msg.sender` isn't owner of all RFT token pieces.157    /// @param _collection RFT collection address158    /// @param _token id of RFT token159    function rft2nft(address _collection, uint256 _token) public {160        require(161            rftCollection != address(0),162            "RFT collection is not set"163        );164        require(165            rftCollection == _collection,166            "Wrong RFT collection"167        );168        UniqueRefungible rftCollectionContract = UniqueRefungible(rftCollection);169        address rftTokenAddress = rftCollectionContract.tokenContractAddress(_token);170        Token memory nftToken = rft2nftMapping[rftTokenAddress];171        require(172            nftToken._collection != address(0),173            "No corresponding NFT token found"174        );175        UniqueRefungibleToken rftTokenContract = UniqueRefungibleToken(rftTokenAddress);176        require(177            rftTokenContract.balanceOf(msg.sender) == rftTokenContract.totalSupply(),178            "Not all pieces are owned by the caller"179        );180        rftCollectionContract.transferFrom(msg.sender, address(this), _token);181        UniqueNFT(nftToken._collection).transferFrom(182            address(this),183            msg.sender,184            nftToken._tokenId185        );186        emit Defractionalized(rftTokenAddress, nftToken._collection, nftToken._tokenId);187    }188}
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    bytes32 refungibleCollectionType = keccak256(bytes("ReFungible"));2223    receive() external payable onlyOwner {}2425    /// @dev Method modifier to only allow contract owner to call it.26    modifier onlyOwner() {27        address contracthelpersAddress = 0x842899ECF380553E8a4de75bF534cdf6fBF64049;28        ContractHelpers contractHelpers = ContractHelpers(29            contracthelpersAddress30        );31        address contractOwner = contractHelpers.contractOwner(address(this));32        require(msg.sender == contractOwner, "Only owner can");33        _;34    }3536    /// @dev This emits when RFT collection setting is changed.37    event RFTCollectionSet(address _collection);3839    /// @dev This emits when NFT collection is allowed or disallowed.40    event AllowListSet(address _collection, bool _status);4142    /// @dev This emits when NFT token is fractionalized by contract.43    event Fractionalized(44        address _collection,45        uint256 _tokenId,46        address _rftToken,47        uint128 _amount48    );4950    /// @dev This emits when NFT token is defractionalized by contract.51    event Defractionalized(52        address _rftToken,53        address _nftCollection,54        uint256 _nftTokenId55    );5657    /// Set RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens58    /// would be created in this collection.59    /// @dev Throws if RFT collection is already configured for this contract.60    ///  Throws if collection of wrong type (NFT, Fungible) is provided instead61    ///  of RFT collection.62    ///  Throws if `msg.sender` is not owner or admin of provided RFT collection.63    ///  Can only be called by contract owner.64    /// @param _collection address of RFT collection.65    function setRFTCollection(address _collection) public onlyOwner {66        require(rftCollection == address(0), "RFT collection is already set");67        UniqueRefungible refungibleContract = UniqueRefungible(_collection);68        string memory collectionType = refungibleContract69            .uniqueCollectionType();7071        require(72            keccak256(bytes(collectionType)) == refungibleCollectionType,73            "Wrong collection type. Collection is not refungible."74        );75        require(76            refungibleContract.isOwnerOrAdmin(address(this)),77            "Fractionalizer contract should be an admin of the collection"78        );79        rftCollection = _collection;80        emit RFTCollectionSet(rftCollection);81    }8283    /// Creates and sets RFT collection that contract will work with. RFT tokens for fractionalized NFT tokens84    /// would be created in this collection.85    /// @dev Throws if RFT collection is already configured for this contract.86    ///  Can only be called by contract owner.87    /// @param _name name for created RFT collection.88    /// @param _description description for created RFT collection.89    /// @param _tokenPrefix token prefix for created RFT collection.90    function createAndSetRFTCollection(91        string calldata _name,92        string calldata _description,93        string calldata _tokenPrefix94    ) public onlyOwner {95        require(rftCollection == address(0), "RFT collection is already set");96        address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;97        rftCollection = CollectionHelpers(collectionHelpers)98            .createRFTCollection(_name, _description, _tokenPrefix);99        emit RFTCollectionSet(rftCollection);100    }101102    /// Allow or disallow NFT collection tokens from being fractionalized by this contract.103    /// @dev Can only be called by contract owner.104    /// @param collection NFT token address.105    /// @param status `true` to allow and `false` to disallow NFT token.106    function setNftCollectionIsAllowed(address collection, bool status)107        public108        onlyOwner109    {110        nftCollectionAllowList[collection] = status;111        emit AllowListSet(collection, status);112    }113114    /// Fractionilize NFT token.115    /// @dev Takes NFT token from `msg.sender` and transfers RFT token to `msg.sender`116    ///  instead. Creates new RFT token if provided NFT token never was fractionalized117    ///  by this contract or existing RFT token if it was.118    ///  Throws if RFT collection isn't configured for this contract.119    ///  Throws if fractionalization of provided NFT token is not allowed120    ///  Throws if `msg.sender` is not owner of provided NFT token121    /// @param  _collection NFT collection address122    /// @param  _token id of NFT token to be fractionalized123    /// @param  _pieces number of pieces new RFT token would have124    function nft2rft(125        address _collection,126        uint256 _token,127        uint128 _pieces128    ) public {129        require(rftCollection != address(0), "RFT collection is not set");130        UniqueRefungible rftCollectionContract = UniqueRefungible(131            rftCollection132        );133        require(134            nftCollectionAllowList[_collection] == true,135            "Fractionalization of this collection is not allowed by admin"136        );137        require(138            UniqueNFT(_collection).ownerOf(_token) == msg.sender,139            "Only token owner could fractionalize it"140        );141        UniqueNFT(_collection).transferFrom(msg.sender, address(this), _token);142        uint256 rftTokenId;143        address rftTokenAddress;144        UniqueRefungibleToken rftTokenContract;145        if (nft2rftMapping[_collection][_token] == 0) {146            rftTokenId = rftCollectionContract.nextTokenId();147            rftCollectionContract.mint(address(this), rftTokenId);148            rftTokenAddress = rftCollectionContract.tokenContractAddress(149                rftTokenId150            );151            nft2rftMapping[_collection][_token] = rftTokenId;152            rft2nftMapping[rftTokenAddress] = Token(_collection, _token);153154            rftTokenContract = UniqueRefungibleToken(rftTokenAddress);155        } else {156            rftTokenId = nft2rftMapping[_collection][_token];157            rftTokenAddress = rftCollectionContract.tokenContractAddress(158                rftTokenId159            );160            rftTokenContract = UniqueRefungibleToken(rftTokenAddress);161        }162        rftTokenContract.repartition(_pieces);163        rftTokenContract.transfer(msg.sender, _pieces);164        emit Fractionalized(_collection, _token, rftTokenAddress, _pieces);165    }166167    /// Defrationalize NFT token.168    /// @dev Takes RFT token from `msg.sender` and transfers corresponding NFT token169    ///  to `msg.sender` instead.170    ///  Throws if RFT collection isn't configured for this contract.171    ///  Throws if provided RFT token is no from configured RFT collection.172    ///  Throws if RFT token was not created by this contract.173    ///  Throws if `msg.sender` isn't owner of all RFT token pieces.174    /// @param _collection RFT collection address175    /// @param _token id of RFT token176    function rft2nft(address _collection, uint256 _token) public {177        require(rftCollection != address(0), "RFT collection is not set");178        require(rftCollection == _collection, "Wrong RFT collection");179        UniqueRefungible rftCollectionContract = UniqueRefungible(180            rftCollection181        );182        address rftTokenAddress = rftCollectionContract.tokenContractAddress(183            _token184        );185        Token memory nftToken = rft2nftMapping[rftTokenAddress];186        require(187            nftToken._collection != address(0),188            "No corresponding NFT token found"189        );190        UniqueRefungibleToken rftTokenContract = UniqueRefungibleToken(191            rftTokenAddress192        );193        require(194            rftTokenContract.balanceOf(msg.sender) ==195                rftTokenContract.totalSupply(),196            "Not all pieces are owned by the caller"197        );198        rftCollectionContract.transferFrom(msg.sender, address(this), _token);199        UniqueNFT(nftToken._collection).transferFrom(200            address(this),201            msg.sender,202            nftToken._tokenId203        );204        emit Defractionalized(205            rftTokenAddress,206            nftToken._collection,207            nftToken._tokenId208        );209    }210}
modifiedtests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -21,7 +21,7 @@
 import {readFile} from 'fs/promises';
 import {executeTransaction, submitTransactionAsync} from '../../substrate/substrate-api';
 import {getCreateCollectionResult, getCreateItemResult, UNIQUE, requirePallets, Pallets} from '../../util/helpers';
-import {collectionIdToAddress, CompiledContract, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';
+import {collectionIdToAddress, CompiledContract, createEthAccountWithBalance, createNonfungibleCollection, createRFTCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';
 import {Contract} from 'web3-eth-contract';
 import * as solc from 'solc';
 
@@ -123,7 +123,7 @@
   itWeb3('Set RFT collection', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const fractionalizer = await deployFractionalizer(web3, owner);
-    const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
     const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
     await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
     const result = await fractionalizer.methods.setRFTCollection(collectionIdAddress).send();
@@ -256,7 +256,7 @@
 
   itWeb3('call setRFTCollection twice', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
-    const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
     const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
 
     const fractionalizer = await deployFractionalizer(web3, owner);
@@ -282,7 +282,7 @@
   itWeb3('call setRFTCollection while not collection admin', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const fractionalizer = await deployFractionalizer(web3, owner);
-    const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
 
     await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())
       .to.be.rejectedWith(/Fractionalizer contract should be an admin of the collection$/g);
@@ -368,7 +368,7 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
 
     const fractionalizer = await deployFractionalizer(web3, owner);
-    const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
     const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
     const rftTokenId = await refungibleContract.methods.nextTokenId().call();
     await refungibleContract.methods.mint(owner, rftTokenId).send();
@@ -381,7 +381,7 @@
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
 
     const {fractionalizer} = await initFractionalizer(api, web3, privateKeyWrapper, owner);
-    const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
     const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
     const rftTokenId = await refungibleContract.methods.nextTokenId().call();
     await refungibleContract.methods.mint(owner, rftTokenId).send();
@@ -392,7 +392,7 @@
 
   itWeb3('call rft2nft for RFT token that was not minted by fractionalizer contract', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
-    const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
 
     const fractionalizer = await deployFractionalizer(web3, owner);
     const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -26,7 +26,7 @@
   itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
     const nextTokenId = await contract.methods.nextTokenId().call();
@@ -38,7 +38,7 @@
   itWeb3('balanceOf', async ({api, web3, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -63,7 +63,7 @@
   itWeb3('ownerOf', async ({api, web3, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -79,7 +79,7 @@
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = createEthAccount(web3);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -103,7 +103,7 @@
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = createEthAccount(web3);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -130,7 +130,7 @@
   itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, owner);
-    let result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    let result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const receiver = createEthAccount(web3);
     const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
@@ -163,7 +163,7 @@
   itWeb3('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -221,7 +221,7 @@
   itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -247,7 +247,7 @@
   itWeb3('Can perform transferFrom()', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -304,7 +304,7 @@
   itWeb3('Can perform transfer()', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -344,7 +344,7 @@
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = createEthAccount(web3);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -376,7 +376,7 @@
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = createEthAccount(web3);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -413,7 +413,7 @@
   itWeb3('transferFrom() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -430,7 +430,7 @@
   itWeb3('transfer() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -15,7 +15,7 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';
-import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createRefungibleCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
+import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createRFTCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
@@ -458,7 +458,7 @@
     const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const receiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const helper = evmCollectionHelpers(web3, caller);
-    const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();
+    const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
     const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
     const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
 
@@ -658,7 +658,7 @@
   itWeb3('Default parent token address and id', async ({api, web3, privateKeyWrapper}) => {
     const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
 
-    const {collectionIdAddress, collectionId} = await createRefungibleCollection(api, web3, owner);
+    const {collectionIdAddress, collectionId} = await createRFTCollection(api, web3, owner);
     const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
     const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();
     await refungibleContract.methods.mint(owner, refungibleTokenId).send();
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -141,10 +141,10 @@
   expect(result.success).to.be.true;
 }
 
-export async function createRefungibleCollection(api: ApiPromise, web3: Web3, owner: string) {
+export async function createRFTCollection(api: ApiPromise, web3: Web3, owner: string) {
   const collectionHelper = evmCollectionHelpers(web3, owner);
   const result = await collectionHelper.methods
-    .createRefungibleCollection('A', 'B', 'C')
+    .createRFTCollection('A', 'B', 'C')
     .send();
   return await getCollectionAddressFromResult(api, result);
 }