difftreelog
chore fix tests
in: master
12 files changed
tests/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);
tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth1import {addToAllowListExpectSuccess, bigIntToSub, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess} from '../util/helpers';2import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub} from './util/helpers';3import nonFungibleAbi from './nonFungibleAbi.json';4import {expect} from 'chai';5import {evmToAddress} from '@polkadot/util-crypto';6import {submitTransactionAsync} from '../substrate/substrate-api';7import getBalance from '../substrate/get-balance';89describe('evm collection sponsoring', () => {10 itWeb3('sponsors mint transactions', async ({web3, privateKeyWrapper}) => {11 const alice = privateKeyWrapper('//Alice');1213 const collection = await createCollectionExpectSuccess();14 await setCollectionSponsorExpectSuccess(collection, alice.address);15 await confirmSponsorshipExpectSuccess(collection);1617 const minter = createEthAccount(web3);18 expect(await web3.eth.getBalance(minter)).to.equal('0');1920 const address = collectionIdToAddress(collection);21 const contract = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collection), {from: minter, ...GAS_ARGS});2223 await enablePublicMintingExpectSuccess(alice, collection);24 await addToAllowListExpectSuccess(alice, collection, {Ethereum: minter});2526 const nextTokenId = await contract.methods.nextTokenId().call();27 expect(nextTokenId).to.equal('1');28 const result = await contract.methods.mint(minter, nextTokenId).send();29 const events = normalizeEvents(result.events);30 expect(events).to.be.deep.equal([31 {32 address,33 event: 'Transfer',34 args: {35 from: '0x0000000000000000000000000000000000000000',36 to: minter,37 tokenId: nextTokenId,38 },39 },40 ]);41 });4243 // TODO: Temprorary off. Need refactor44 // itWeb3('Set substrate sponsor', async ({api, web3, privateKeyWrapper}) => {45 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);46 // const collectionHelpers = evmCollectionHelpers(web3, owner);47 // let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();48 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);49 // const sponsor = privateKeyWrapper('//Alice');50 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);5152 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;53 // result = await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});54 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;55 56 // const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);57 // await submitTransactionAsync(sponsor, confirmTx);58 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;59 60 // const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});61 // expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);62 // });6364 itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {65 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);66 const collectionHelpers = evmCollectionHelpers(web3, owner);67 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();68 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);69 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);70 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);7172 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;73 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});74 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;75 76 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});77 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;78 79 await collectionEvm.methods.removeCollectionSponsor().send({from: owner});80 81 const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});82 expect(sponsorTuple.field_0).to.be.eq('0x0000000000000000000000000000000000000000');83 });8485 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3, privateKeyWrapper}) => {86 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);87 const collectionHelpers = evmCollectionHelpers(web3, owner);88 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);90 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);91 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);92 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send({from: owner});93 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;94 const ss58Format = (api.registry.getChainProperties())!.toJSON().ss58Format;95 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;96 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));97 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');9899 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});100 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;101 expect(collectionSub.sponsorship.isConfirmed).to.be.true;102 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));103104 const user = createEthAccount(web3);105 const nextTokenId = await collectionEvm.methods.nextTokenId().call();106 expect(nextTokenId).to.be.equal('1');107108 const oldPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();109 expect(oldPermissions.mintMode).to.be.false;110 expect(oldPermissions.access).to.be.equal('Normal');111112 await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});113 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});114 await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});115116 const newPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();117 expect(newPermissions.mintMode).to.be.true;118 expect(newPermissions.access).to.be.equal('AllowList');119120 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);121 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);122123 {124 const nextTokenId = await collectionEvm.methods.nextTokenId().call();125 expect(nextTokenId).to.be.equal('1');126 const result = await collectionEvm.methods.mintWithTokenURI(127 user,128 nextTokenId,129 'Test URI',130 ).send({from: user});131 const events = normalizeEvents(result.events);132133 expect(events).to.be.deep.equal([134 {135 address: collectionIdAddress,136 event: 'Transfer',137 args: {138 from: '0x0000000000000000000000000000000000000000',139 to: user,140 tokenId: nextTokenId,141 },142 },143 ]);144145 const ownerBalanceAfter = await ethBalanceViaSub(api, owner);146 const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);147148 expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');149 expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);150 expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;151 }152 });153154 // TODO: Temprorary off. Need refactor155 // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {156 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);157 // const collectionHelpers = evmCollectionHelpers(web3, owner);158 // const result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();159 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);160 // const sponsor = privateKeyWrapper('//Alice');161 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);162163 // await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});164 165 // const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);166 // await submitTransactionAsync(sponsor, confirmTx);167 168 // const user = createEthAccount(web3);169 // const nextTokenId = await collectionEvm.methods.nextTokenId().call();170 // expect(nextTokenId).to.be.equal('1');171172 // await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});173 // await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});174 // await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});175176 // const ownerBalanceBefore = await ethBalanceViaSub(api, owner);177 // const sponsorBalanceBefore = (await getBalance(api, [sponsor.address]))[0];178179 // {180 // const nextTokenId = await collectionEvm.methods.nextTokenId().call();181 // expect(nextTokenId).to.be.equal('1');182 // const result = await collectionEvm.methods.mintWithTokenURI(183 // user,184 // nextTokenId,185 // 'Test URI',186 // ).send({from: user});187 // const events = normalizeEvents(result.events);188189 // expect(events).to.be.deep.equal([190 // {191 // address: collectionIdAddress,192 // event: 'Transfer',193 // args: {194 // from: '0x0000000000000000000000000000000000000000',195 // to: user,196 // tokenId: nextTokenId,197 // },198 // },199 // ]);200201 // const ownerBalanceAfter = await ethBalanceViaSub(api, owner);202 // const sponsorBalanceAfter = (await getBalance(api, [sponsor.address]))[0];203204 // expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');205 // expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);206 // expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;207 // }208 // });209210 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {211 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);212 const collectionHelpers = evmCollectionHelpers(web3, owner);213 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();214 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);215 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);216 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);217 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();218 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;219 const ss58Format = (api.registry.getChainProperties())!.toJSON().ss58Format;220 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;221 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));222 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');223 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);224 await sponsorCollection.methods.confirmCollectionSponsorship().send();225 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;226 expect(collectionSub.sponsorship.isConfirmed).to.be.true;227 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));228229 const user = createEthAccount(web3);230 await collectionEvm.methods.addCollectionAdmin(user).send();231 232 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);233 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);234 235 236 const userCollectionEvm = evmCollection(web3, user, collectionIdAddress);237 const nextTokenId = await userCollectionEvm.methods.nextTokenId().call();238 expect(nextTokenId).to.be.equal('1');239 result = await userCollectionEvm.methods.mintWithTokenURI(240 user,241 nextTokenId,242 'Test URI',243 ).send();244245 const events = normalizeEvents(result.events);246 const address = collectionIdToAddress(collectionId);247248 expect(events).to.be.deep.equal([249 {250 address,251 event: 'Transfer',252 args: {253 from: '0x0000000000000000000000000000000000000000',254 to: user,255 tokenId: nextTokenId,256 },257 },258 ]);259 expect(await userCollectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');260 261 const ownerBalanceAfter = await ethBalanceViaSub(api, owner);262 expect(ownerBalanceAfter).to.be.eq(ownerBalanceBefore);263 const sponsorBalanceAfter = await ethBalanceViaSub(api, sponsor);264 expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;265 });266});tests/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}) => {
tests/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}) => {
tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth--- a/tests/src/eth/fractionalizer/Fractionalizer.sol
+++ b/tests/src/eth/fractionalizer/Fractionalizer.sol
@@ -81,10 +81,10 @@
string calldata _name,
string calldata _description,
string calldata _tokenPrefix
- ) external onlyOwner {
+ ) external payable onlyOwner {
require(rftCollection == address(0), "RFT collection is already set");
address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;
- rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection(_name, _description, _tokenPrefix);
+ rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(_name, _description, _tokenPrefix);
emit RFTCollectionSet(rftCollection);
}
tests/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())
tests/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);
tests/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);
tests/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);
tests/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);
}
tests/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);
tests/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()