git.delta.rocks / unique-network / refs/commits / 231aa66d6048

difftreelog

Add more transferCross tests

Max Andreev2022-12-02parent: #3509456.patch.diff
in: master

2 files changed

modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
277 }277 }
278 });278 });
279 279
280 itEth('Cannot transferCross() more than have', async ({helper}) => {
281 const sender = await helper.eth.createAccountWithBalance(donor);
282 const receiverEth = await helper.eth.createAccountWithBalance(donor);
283 const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);
284 const BALANCE = 200n;
285 const BALANCE_TO_TRANSFER = BALANCE + 100n;
286
287 const collection = await helper.ft.mintCollection(alice);
288 await collection.mint(alice, BALANCE, {Ethereum: sender});
289 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
290 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', sender);
291
292 await expect(collectionEvm.methods.transferCross(receiverCrossEth, BALANCE_TO_TRANSFER).send({from: sender})).to.be.rejected;
293 });
294
280 itEth('Can perform transfer()', async ({helper}) => {295 itEth('Can perform transfer()', async ({helper}) => {
281 const owner = await helper.eth.createAccountWithBalance(donor);296 const owner = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
415415
416 itEth('Cannot transferCross with invalid params', async ({helper}) => {416 itEth('Cannot transferCross with invalid params', async ({helper}) => {
417 const sender = await helper.eth.createAccountWithBalance(donor);417 const sender = await helper.eth.createAccountWithBalance(donor);
418 const tokenOwner = await helper.eth.createAccountWithBalance(donor);
418 const receiverCrossSub = helper.ethCrossAccount.fromKeyringPair(minter);419 const receiverCrossSub = helper.ethCrossAccount.fromKeyringPair(minter);
419420
420 const collection = await helper.rft.mintCollection(minter, {});421 const collection = await helper.rft.mintCollection(minter, {});
421 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);422 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
422 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', sender);423 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', sender);
423424
425 await collection.mintToken(minter, 50n, {Ethereum: sender});
424 const {tokenId} = await collection.mintToken(minter, 50n, {Ethereum: sender});426 const notSendersToken = await collection.mintToken(minter, 50n, {Ethereum: tokenOwner});
425 // FIXME (transaction successful): Cannot transfer token if it does not exist:427 // Cannot transferCross someone else's token:
426 await expect(collectionEvm.methods.transferCross(receiverCrossSub, tokenId + 1).send({from: sender})).to.be.rejected;428 await expect(collectionEvm.methods.transferCross(receiverCrossSub, notSendersToken.tokenId).send({from: sender})).to.be.rejected;
429 // FIXME: (transaction successful): Cannot transfer token if it does not exist:
430 await expect(collectionEvm.methods.transferCross(receiverCrossSub, 999999).send({from: sender})).to.be.rejected;
427 });431 });
428432
429 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {433 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {