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
245 }245 }
246246
247 #[weight(<SelfWeightOf<T>>::create_collection())]247 #[weight(<SelfWeightOf<T>>::create_collection())]
248 #[solidity(rename_selector = "createRFTCollection")]
248 fn create_refungible_collection(249 fn create_refungible_collection(
249 &mut self,250 &mut self,
250 caller: caller,251 caller: caller,
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
30}30}
3131
32/// @title Contract, which allows users to operate with collections32/// @title Contract, which allows users to operate with collections
33/// @dev the ERC-165 identifier for this interface is 0x675f307433/// @dev the ERC-165 identifier for this interface is 0x88ee8ef1
34contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {34contract CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
35 /// Create an NFT collection35 /// Create an NFT collection
36 /// @param name Name of the collection36 /// @param name Name of the collection
69 return 0x0000000000000000000000000000000000000000;69 return 0x0000000000000000000000000000000000000000;
70 }70 }
7171
72 /// @dev EVM selector for this function is: 0x44a68ad5,72 /// @dev EVM selector for this function is: 0xab173450,
73 /// or in textual repr: createRefungibleCollection(string,string,string)73 /// or in textual repr: createRFTCollection(string,string,string)
74 function createRefungibleCollection(74 function createRFTCollection(
75 string memory name,75 string memory name,
76 string memory description,76 string memory description,
77 string memory tokenPrefix77 string memory tokenPrefix
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
21}21}
2222
23/// @title Contract, which allows users to operate with collections23/// @title Contract, which allows users to operate with collections
24/// @dev the ERC-165 identifier for this interface is 0x675f307424/// @dev the ERC-165 identifier for this interface is 0x88ee8ef1
25interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {25interface CollectionHelpers is Dummy, ERC165, CollectionHelpersEvents {
26 /// Create an NFT collection26 /// Create an NFT collection
27 /// @param name Name of the collection27 /// @param name Name of the collection
45 string memory baseUri45 string memory baseUri
46 ) external returns (address);46 ) external returns (address);
4747
48 /// @dev EVM selector for this function is: 0x44a68ad5,48 /// @dev EVM selector for this function is: 0xab173450,
49 /// or in textual repr: createRefungibleCollection(string,string,string)49 /// or in textual repr: createRFTCollection(string,string,string)
50 function createRefungibleCollection(50 function createRFTCollection(
51 string memory name,51 string memory name,
52 string memory description,52 string memory description,
53 string memory tokenPrefix53 string memory tokenPrefix
modifiedtests/src/eth/collectionHelpersAbi.jsondiffbeforeafterboth
59 { "internalType": "string", "name": "description", "type": "string" },59 { "internalType": "string", "name": "description", "type": "string" },
60 { "internalType": "string", "name": "tokenPrefix", "type": "string" }60 { "internalType": "string", "name": "tokenPrefix", "type": "string" }
61 ],61 ],
62 "name": "createRefungibleCollection",62 "name": "createRFTCollection",
63 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],63 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
64 "stateMutability": "nonpayable",64 "stateMutability": "nonpayable",
65 "type": "function"65 "type": "function"
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
41 41
42 const collectionCountBefore = await getCreatedCollectionCount(api);42 const collectionCountBefore = await getCreatedCollectionCount(api);
43 const result = await collectionHelper.methods43 const result = await collectionHelper.methods
44 .createRefungibleCollection(collectionName, description, tokenPrefix)44 .createRFTCollection(collectionName, description, tokenPrefix)
45 .send();45 .send();
46 const collectionCountAfter = await getCreatedCollectionCount(api);46 const collectionCountAfter = await getCreatedCollectionCount(api);
47 47
65 .call()).to.be.false;65 .call()).to.be.false;
6666
67 await collectionHelpers.methods67 await collectionHelpers.methods
68 .createRefungibleCollection('A', 'A', 'A')68 .createRFTCollection('A', 'A', 'A')
69 .send();69 .send();
70 70
71 expect(await collectionHelpers.methods71 expect(await collectionHelpers.methods
76 itWeb3('Set sponsorship', async ({api, web3, privateKeyWrapper}) => {76 itWeb3('Set sponsorship', async ({api, web3, privateKeyWrapper}) => {
77 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);77 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
78 const collectionHelpers = evmCollectionHelpers(web3, owner);78 const collectionHelpers = evmCollectionHelpers(web3, owner);
79 let result = await collectionHelpers.methods.createRefungibleCollection('Sponsor collection', '1', '1').send();79 let result = await collectionHelpers.methods.createRFTCollection('Sponsor collection', '1', '1').send();
80 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);80 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
81 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);81 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
82 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});82 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
96 itWeb3('Set limits', async ({api, web3, privateKeyWrapper}) => {96 itWeb3('Set limits', async ({api, web3, privateKeyWrapper}) => {
97 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);97 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
98 const collectionHelpers = evmCollectionHelpers(web3, owner);98 const collectionHelpers = evmCollectionHelpers(web3, owner);
99 const result = await collectionHelpers.methods.createRefungibleCollection('Const collection', '5', '5').send();99 const result = await collectionHelpers.methods.createRFTCollection('Const collection', '5', '5').send();
100 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);100 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
101 const limits = {101 const limits = {
102 accountTokenOwnershipLimit: 1000,102 accountTokenOwnershipLimit: 1000,
141 .isCollectionExist(collectionAddressForNonexistentCollection).call())141 .isCollectionExist(collectionAddressForNonexistentCollection).call())
142 .to.be.false;142 .to.be.false;
143 143
144 const result = await collectionHelpers.methods.createRefungibleCollection('Collection address exist', '7', '7').send();144 const result = await collectionHelpers.methods.createRFTCollection('Collection address exist', '7', '7').send();
145 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);145 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
146 expect(await collectionHelpers.methods146 expect(await collectionHelpers.methods
147 .isCollectionExist(collectionIdAddress).call())147 .isCollectionExist(collectionIdAddress).call())
164 const tokenPrefix = 'A';164 const tokenPrefix = 'A';
165 165
166 await expect(helper.methods166 await expect(helper.methods
167 .createRefungibleCollection(collectionName, description, tokenPrefix)167 .createRFTCollection(collectionName, description, tokenPrefix)
168 .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGHT);168 .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGHT);
169 169
170 }170 }
174 const description = 'A'.repeat(MAX_DESCRIPTION_LENGHT + 1);174 const description = 'A'.repeat(MAX_DESCRIPTION_LENGHT + 1);
175 const tokenPrefix = 'A';175 const tokenPrefix = 'A';
176 await expect(helper.methods176 await expect(helper.methods
177 .createRefungibleCollection(collectionName, description, tokenPrefix)177 .createRFTCollection(collectionName, description, tokenPrefix)
178 .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGHT);178 .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGHT);
179 }179 }
180 { 180 {
183 const description = 'A';183 const description = 'A';
184 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGHT + 1);184 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGHT + 1);
185 await expect(helper.methods185 await expect(helper.methods
186 .createRefungibleCollection(collectionName, description, tokenPrefix)186 .createRFTCollection(collectionName, description, tokenPrefix)
187 .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGHT);187 .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGHT);
188 }188 }
189 });189 });
196 const tokenPrefix = 'A';196 const tokenPrefix = 'A';
197 197
198 await expect(helper.methods198 await expect(helper.methods
199 .createRefungibleCollection(collectionName, description, tokenPrefix)199 .createRFTCollection(collectionName, description, tokenPrefix)
200 .call()).to.be.rejectedWith('NotSufficientFounds');200 .call()).to.be.rejectedWith('NotSufficientFounds');
201 });201 });
202202
203 itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {203 itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {
204 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);204 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
205 const notOwner = createEthAccount(web3);205 const notOwner = createEthAccount(web3);
206 const collectionHelpers = evmCollectionHelpers(web3, owner);206 const collectionHelpers = evmCollectionHelpers(web3, owner);
207 const result = await collectionHelpers.methods.createRefungibleCollection('A', 'A', 'A').send();207 const result = await collectionHelpers.methods.createRFTCollection('A', 'A', 'A').send();
208 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);208 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
209 const contractEvmFromNotOwner = evmCollection(web3, notOwner, collectionIdAddress, {type: 'ReFungible'});209 const contractEvmFromNotOwner = evmCollection(web3, notOwner, collectionIdAddress, {type: 'ReFungible'});
210 const EXPECTED_ERROR = 'NoPermission';210 const EXPECTED_ERROR = 'NoPermission';
229 itWeb3('(!negative test!) Set limits', async ({api, web3, privateKeyWrapper}) => {229 itWeb3('(!negative test!) Set limits', async ({api, web3, privateKeyWrapper}) => {
230 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);230 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
231 const collectionHelpers = evmCollectionHelpers(web3, owner);231 const collectionHelpers = evmCollectionHelpers(web3, owner);
232 const result = await collectionHelpers.methods.createRefungibleCollection('Schema collection', 'A', 'A').send();232 const result = await collectionHelpers.methods.createRFTCollection('Schema collection', 'A', 'A').send();
233 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);233 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
234 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});234 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
235 await expect(collectionEvm.methods235 await expect(collectionEvm.methods
modifiedtests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth
84 "RFT collection is already set"
85 );
86 address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;96 address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;
87 rftCollection = CollectionHelpers(collectionHelpers).createRefungibleCollection(_name, _description, _tokenPrefix);97 rftCollection = CollectionHelpers(collectionHelpers)
98 .createRFTCollection(_name, _description, _tokenPrefix);
88 emit RFTCollectionSet(rftCollection);99 emit RFTCollectionSet(rftCollection);
89 }100 }
90101
modifiedtests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth
21import {readFile} from 'fs/promises';21import {readFile} from 'fs/promises';
22import {executeTransaction, submitTransactionAsync} from '../../substrate/substrate-api';22import {executeTransaction, submitTransactionAsync} from '../../substrate/substrate-api';
23import {getCreateCollectionResult, getCreateItemResult, UNIQUE, requirePallets, Pallets} from '../../util/helpers';23import {getCreateCollectionResult, getCreateItemResult, UNIQUE, requirePallets, Pallets} from '../../util/helpers';
24import {collectionIdToAddress, CompiledContract, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';24import {collectionIdToAddress, CompiledContract, createEthAccountWithBalance, createNonfungibleCollection, createRFTCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';
25import {Contract} from 'web3-eth-contract';25import {Contract} from 'web3-eth-contract';
26import * as solc from 'solc';26import * as solc from 'solc';
2727
123 itWeb3('Set RFT collection', async ({api, web3, privateKeyWrapper}) => {123 itWeb3('Set RFT collection', async ({api, web3, privateKeyWrapper}) => {
124 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);124 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
125 const fractionalizer = await deployFractionalizer(web3, owner);125 const fractionalizer = await deployFractionalizer(web3, owner);
126 const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);126 const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
127 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);127 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
128 await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();128 await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
129 const result = await fractionalizer.methods.setRFTCollection(collectionIdAddress).send();129 const result = await fractionalizer.methods.setRFTCollection(collectionIdAddress).send();
256256
257 itWeb3('call setRFTCollection twice', async ({api, web3, privateKeyWrapper}) => {257 itWeb3('call setRFTCollection twice', async ({api, web3, privateKeyWrapper}) => {
258 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);258 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
259 const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);259 const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
260 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);260 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
261261
262 const fractionalizer = await deployFractionalizer(web3, owner);262 const fractionalizer = await deployFractionalizer(web3, owner);
282 itWeb3('call setRFTCollection while not collection admin', async ({api, web3, privateKeyWrapper}) => {282 itWeb3('call setRFTCollection while not collection admin', async ({api, web3, privateKeyWrapper}) => {
283 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);283 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
284 const fractionalizer = await deployFractionalizer(web3, owner);284 const fractionalizer = await deployFractionalizer(web3, owner);
285 const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);285 const {collectionIdAddress} = await createRFTCollection(api, web3, owner);
286286
287 await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())287 await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())
288 .to.be.rejectedWith(/Fractionalizer contract should be an admin of the collection$/g);288 .to.be.rejectedWith(/Fractionalizer contract should be an admin of the collection$/g);
368 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);368 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
369369
370 const fractionalizer = await deployFractionalizer(web3, owner);370 const fractionalizer = await deployFractionalizer(web3, owner);
371 const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);371 const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
372 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);372 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
373 const rftTokenId = await refungibleContract.methods.nextTokenId().call();373 const rftTokenId = await refungibleContract.methods.nextTokenId().call();
374 await refungibleContract.methods.mint(owner, rftTokenId).send();374 await refungibleContract.methods.mint(owner, rftTokenId).send();
381 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);381 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
382382
383 const {fractionalizer} = await initFractionalizer(api, web3, privateKeyWrapper, owner);383 const {fractionalizer} = await initFractionalizer(api, web3, privateKeyWrapper, owner);
384 const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);384 const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
385 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);385 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
386 const rftTokenId = await refungibleContract.methods.nextTokenId().call();386 const rftTokenId = await refungibleContract.methods.nextTokenId().call();
387 await refungibleContract.methods.mint(owner, rftTokenId).send();387 await refungibleContract.methods.mint(owner, rftTokenId).send();
392392
393 itWeb3('call rft2nft for RFT token that was not minted by fractionalizer contract', async ({api, web3, privateKeyWrapper}) => {393 itWeb3('call rft2nft for RFT token that was not minted by fractionalizer contract', async ({api, web3, privateKeyWrapper}) => {
394 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);394 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
395 const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);395 const {collectionIdAddress: rftCollectionAddress} = await createRFTCollection(api, web3, owner);
396396
397 const fractionalizer = await deployFractionalizer(web3, owner);397 const fractionalizer = await deployFractionalizer(web3, owner);
398 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);398 const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
26 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {26 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {
27 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);27 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
28 const helper = evmCollectionHelpers(web3, caller);28 const helper = evmCollectionHelpers(web3, caller);
29 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();29 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
30 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);30 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
31 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});31 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
32 const nextTokenId = await contract.methods.nextTokenId().call();32 const nextTokenId = await contract.methods.nextTokenId().call();
38 itWeb3('balanceOf', async ({api, web3, privateKeyWrapper}) => {38 itWeb3('balanceOf', async ({api, web3, privateKeyWrapper}) => {
39 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);39 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
40 const helper = evmCollectionHelpers(web3, caller);40 const helper = evmCollectionHelpers(web3, caller);
41 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();41 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
42 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);42 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
43 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});43 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
4444
63 itWeb3('ownerOf', async ({api, web3, privateKeyWrapper}) => {63 itWeb3('ownerOf', async ({api, web3, privateKeyWrapper}) => {
64 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);64 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
65 const helper = evmCollectionHelpers(web3, caller);65 const helper = evmCollectionHelpers(web3, caller);
66 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();66 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
67 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);67 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
68 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});68 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
6969
79 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);79 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
80 const receiver = createEthAccount(web3);80 const receiver = createEthAccount(web3);
81 const helper = evmCollectionHelpers(web3, caller);81 const helper = evmCollectionHelpers(web3, caller);
82 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();82 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
83 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);83 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
84 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});84 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
8585
103 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);103 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
104 const receiver = createEthAccount(web3);104 const receiver = createEthAccount(web3);
105 const helper = evmCollectionHelpers(web3, caller);105 const helper = evmCollectionHelpers(web3, caller);
106 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();106 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
107 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);107 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
108 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});108 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
109109
130 itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {130 itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {
131 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);131 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
132 const helper = evmCollectionHelpers(web3, owner);132 const helper = evmCollectionHelpers(web3, owner);
133 let result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();133 let result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
134 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);134 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
135 const receiver = createEthAccount(web3);135 const receiver = createEthAccount(web3);
136 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});136 const contract = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});
163 itWeb3('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {163 itWeb3('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {
164 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);164 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
165 const helper = evmCollectionHelpers(web3, caller);165 const helper = evmCollectionHelpers(web3, caller);
166 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();166 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
167 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);167 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
168 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});168 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
169169
221 itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {221 itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {
222 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);222 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
223 const helper = evmCollectionHelpers(web3, caller);223 const helper = evmCollectionHelpers(web3, caller);
224 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();224 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
225 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);225 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
226 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});226 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
227227
247 itWeb3('Can perform transferFrom()', async ({web3, api, privateKeyWrapper}) => {247 itWeb3('Can perform transferFrom()', async ({web3, api, privateKeyWrapper}) => {
248 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);248 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
249 const helper = evmCollectionHelpers(web3, caller);249 const helper = evmCollectionHelpers(web3, caller);
250 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();250 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
251 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);251 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
252 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});252 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
253253
304 itWeb3('Can perform transfer()', async ({web3, api, privateKeyWrapper}) => {304 itWeb3('Can perform transfer()', async ({web3, api, privateKeyWrapper}) => {
305 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);305 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
306 const helper = evmCollectionHelpers(web3, caller);306 const helper = evmCollectionHelpers(web3, caller);
307 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();307 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
308 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);308 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
309 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});309 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
310310
344 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);344 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
345 const receiver = createEthAccount(web3);345 const receiver = createEthAccount(web3);
346 const helper = evmCollectionHelpers(web3, caller);346 const helper = evmCollectionHelpers(web3, caller);
347 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();347 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
348 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);348 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
349 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});349 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
350350
376 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);376 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
377 const receiver = createEthAccount(web3);377 const receiver = createEthAccount(web3);
378 const helper = evmCollectionHelpers(web3, caller);378 const helper = evmCollectionHelpers(web3, caller);
379 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();379 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
380 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);380 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
381 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});381 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
382382
413 itWeb3('transferFrom() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {413 itWeb3('transferFrom() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {
414 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);414 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
415 const helper = evmCollectionHelpers(web3, caller);415 const helper = evmCollectionHelpers(web3, caller);
416 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();416 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
417 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);417 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
418 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});418 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
419419
430 itWeb3('transfer() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {430 itWeb3('transfer() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {
431 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);431 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
432 const helper = evmCollectionHelpers(web3, caller);432 const helper = evmCollectionHelpers(web3, caller);
433 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();433 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
434 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);434 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
435 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});435 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
436436
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';17import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';
18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createRefungibleCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, createRFTCollection, evmCollection, evmCollectionHelpers, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth, uniqueRefungible, uniqueRefungibleToken} from './util/helpers';
1919
20import chai from 'chai';20import chai from 'chai';
21import chaiAsPromised from 'chai-as-promised';21import chaiAsPromised from 'chai-as-promised';
458 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);458 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
459 const receiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);459 const receiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
460 const helper = evmCollectionHelpers(web3, caller);460 const helper = evmCollectionHelpers(web3, caller);
461 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();461 const result = await helper.methods.createRFTCollection('Mint collection', '6', '6').send();
462 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);462 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
463 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});463 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});
464464
658 itWeb3('Default parent token address and id', async ({api, web3, privateKeyWrapper}) => {658 itWeb3('Default parent token address and id', async ({api, web3, privateKeyWrapper}) => {
659 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);659 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
660660
661 const {collectionIdAddress, collectionId} = await createRefungibleCollection(api, web3, owner);661 const {collectionIdAddress, collectionId} = await createRFTCollection(api, web3, owner);
662 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);662 const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
663 const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();663 const refungibleTokenId = await refungibleContract.methods.nextTokenId().call();
664 await refungibleContract.methods.mint(owner, refungibleTokenId).send();664 await refungibleContract.methods.mint(owner, refungibleTokenId).send();
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
141 expect(result.success).to.be.true;141 expect(result.success).to.be.true;
142}142}
143143
144export async function createRefungibleCollection(api: ApiPromise, web3: Web3, owner: string) {144export async function createRFTCollection(api: ApiPromise, web3: Web3, owner: string) {
145 const collectionHelper = evmCollectionHelpers(web3, owner);145 const collectionHelper = evmCollectionHelpers(web3, owner);
146 const result = await collectionHelper.methods146 const result = await collectionHelper.methods
147 .createRefungibleCollection('A', 'B', 'C')147 .createRFTCollection('A', 'B', 'C')
148 .send();148 .send();
149 return await getCollectionAddressFromResult(api, result);149 return await getCollectionAddressFromResult(api, result);
150}150}