difftreelog
tests(eth): remove redundant commented area
in: master
1 file changed
tests/src/eth/crossTransfer.test.tsdiffbeforeafterboth1// 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/>.1617import {itEth, usingEthPlaygrounds} from './util/playgrounds';18import {CrossAccountId} from '../util/playgrounds/unique';19import {IKeyringPair} from '@polkadot/types/types';2021describe('Token transfer between substrate address and EVM address. Fungible', () => {22 let donor: IKeyringPair;23 let alice: IKeyringPair;24 let bob: IKeyringPair;25 let charlie: IKeyringPair;2627 before(async function() {28 await usingEthPlaygrounds(async (helper, privateKey) => {29 donor = privateKey('//Alice');30 [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);31 });32 });33 34 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}) => { 35 const bobCA = CrossAccountId.fromKeyring(bob);36 const charlieCA = CrossAccountId.fromKeyring(charlie);3738 const collection = await helper.ft.mintCollection(alice);39 await collection.setLimits(alice, {ownerCanTransfer: true});4041 await collection.mint(alice, 200n);42 await collection.transfer(alice, charlieCA.toEthereum(), 200n);43 await collection.transferFrom(alice, charlieCA.toEthereum(), charlieCA, 50n);44 await collection.transfer(charlie, bobCA, 50n);45 });4647 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}) => {48 const aliceProxy = await helper.eth.createAccountWithBalance(donor);49 const bobProxy = await helper.eth.createAccountWithBalance(donor);5051 const collection = await helper.ft.mintCollection(alice);52 await collection.setLimits(alice, {ownerCanTransfer: true});5354 const address = helper.ethAddress.fromCollectionId(collection.collectionId);55 const contract = helper.ethNativeContract.collection(address, 'ft', aliceProxy);5657 await collection.mint(alice, 200n, {Ethereum: aliceProxy});58 await contract.methods.transfer(bobProxy, 50).send({from: aliceProxy});59 await collection.transferFrom(alice, {Ethereum: bobProxy}, CrossAccountId.fromKeyring(bob), 50n);60 await collection.transfer(bob, CrossAccountId.fromKeyring(alice), 50n);61 });62});6364describe('Token transfer between substrate address and EVM address. NFT', () => {65 let donor: IKeyringPair;66 let alice: IKeyringPair;67 let bob: IKeyringPair;68 let charlie: IKeyringPair;6970 before(async function() {71 await usingEthPlaygrounds(async (helper, privateKey) => {72 donor = privateKey('//Alice');73 [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);74 });75 });76 77 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}) => {78 const charlieEth = CrossAccountId.fromKeyring(charlie, 'Ethereum');79 80 const collection = await helper.nft.mintCollection(alice);81 await collection.setLimits(alice, {ownerCanTransfer: true});82 const token = await collection.mintToken(alice);83 await token.transfer(alice, charlieEth);84 await token.transferFrom(alice, charlieEth, CrossAccountId.fromKeyring(charlie));85 await token.transfer(charlie, CrossAccountId.fromKeyring(bob));86 });8788 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}) => {89 const aliceProxy = await helper.eth.createAccountWithBalance(donor);90 const bobProxy = await helper.eth.createAccountWithBalance(donor);9192 const collection = await helper.nft.mintCollection(alice);93 await collection.setLimits(alice, {ownerCanTransfer: true});9495 const address = helper.ethAddress.fromCollectionId(collection.collectionId);96 const contract = helper.ethNativeContract.collection(address, 'nft', aliceProxy);9798 const token = await collection.mintToken(alice);99 await token.transfer(alice, {Ethereum: aliceProxy});100 await contract.methods.transfer(bobProxy, 1).send({from: aliceProxy});101 await token.transferFrom(alice, {Ethereum: bobProxy}, {Substrate: bob.address});102 await token.transfer(bob, {Substrate: charlie.address});103 });104});