git.delta.rocks / unique-network / refs/commits / 3b7dec1d258f

difftreelog

tests(eth): remove redundant commented area

Fahrrader2022-09-30parent: #d444328.patch.diff
in: master

1 file changed

modifiedtests/src/eth/crossTransfer.test.tsdiffbeforeafterboth
before · tests/src/eth/crossTransfer.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617/*import {createCollectionExpectSuccess,18  createFungibleItemExpectSuccess,19  transferExpectSuccess,20  transferFromExpectSuccess,21  setCollectionLimitsExpectSuccess,22  createItemExpectSuccess} from '../util/helpers';23import {collectionIdToAddress,24  createEthAccountWithBalance,25  subToEth,26  GAS_ARGS, itEth} from './util/helpers';27import fungibleAbi from './fungibleAbi.json';28import nonFungibleAbi from './nonFungibleAbi.json';*/29import {itEth, usingEthPlaygrounds} from './util/playgrounds';30import {CrossAccountId} from '../util/playgrounds/unique';31import {IKeyringPair} from '@polkadot/types/types';3233describe('Token transfer between substrate address and EVM address. Fungible', () => {34  let donor: IKeyringPair;35  let alice: IKeyringPair;36  let bob: IKeyringPair;37  let charlie: IKeyringPair;3839  before(async function() {40    await usingEthPlaygrounds(async (helper, privateKey) => {41      donor = privateKey('//Alice');42      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);43    });44  });45  46  itEth('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({helper}) => {  47    const bobCA = CrossAccountId.fromKeyring(bob);48    const charlieCA = CrossAccountId.fromKeyring(charlie);4950    const collection = await helper.ft.mintCollection(alice);51    await collection.setLimits(alice, {ownerCanTransfer: true});5253    await collection.mint(alice, 200n);54    await collection.transfer(alice, charlieCA.toEthereum(), 200n);55    await collection.transferFrom(alice, charlieCA.toEthereum(), charlieCA, 50n);56    await collection.transfer(charlie, bobCA, 50n);57  });5859  itEth('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({helper}) => {60    const aliceProxy = await helper.eth.createAccountWithBalance(donor);61    const bobProxy = await helper.eth.createAccountWithBalance(donor);6263    const collection = await helper.ft.mintCollection(alice);64    await collection.setLimits(alice, {ownerCanTransfer: true});6566    const address = helper.ethAddress.fromCollectionId(collection.collectionId);67    const contract = helper.ethNativeContract.collection(address, 'ft', aliceProxy);6869    await collection.mint(alice, 200n, {Ethereum: aliceProxy});70    await contract.methods.transfer(bobProxy, 50).send({from: aliceProxy});71    await collection.transferFrom(alice, {Ethereum: bobProxy}, CrossAccountId.fromKeyring(bob), 50n);72    await collection.transfer(bob, CrossAccountId.fromKeyring(alice), 50n);73  });74});7576describe('Token transfer between substrate address and EVM address. NFT', () => {77  let donor: IKeyringPair;78  let alice: IKeyringPair;79  let bob: IKeyringPair;80  let charlie: IKeyringPair;8182  before(async function() {83    await usingEthPlaygrounds(async (helper, privateKey) => {84      donor = privateKey('//Alice');85      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);86    });87  });88  89  itEth('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({helper}) => {90    const charlieEth = CrossAccountId.fromKeyring(charlie, 'Ethereum');91    92    const collection = await helper.nft.mintCollection(alice);93    await collection.setLimits(alice, {ownerCanTransfer: true});94    const token = await collection.mintToken(alice);95    await token.transfer(alice, charlieEth);96    await token.transferFrom(alice, charlieEth, CrossAccountId.fromKeyring(charlie));97    await token.transfer(charlie, CrossAccountId.fromKeyring(bob));98  });99100  itEth('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({helper}) => {101    const aliceProxy = await helper.eth.createAccountWithBalance(donor);102    const bobProxy = await helper.eth.createAccountWithBalance(donor);103104    const collection = await helper.nft.mintCollection(alice);105    await collection.setLimits(alice, {ownerCanTransfer: true});106107    const address = helper.ethAddress.fromCollectionId(collection.collectionId);108    const contract = helper.ethNativeContract.collection(address, 'nft', aliceProxy);109110    const token = await collection.mintToken(alice);111    await token.transfer(alice, {Ethereum: aliceProxy});112    await contract.methods.transfer(bobProxy, 1).send({from: aliceProxy});113    await token.transferFrom(alice, {Ethereum: bobProxy}, {Substrate: bob.address});114    await token.transfer(bob, {Substrate: charlie.address});115  });116});