git.delta.rocks / unique-network / refs/commits / e26460b66f05

difftreelog

test fixed nonFungibleProxy: rolled back to proxy contract mintWithTokenURI version

Alex Saft2022-10-15parent: #25ce448.patch.diff
in: master

1 file changed

modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
before · tests/src/eth/proxy/nonFungibleProxy.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/>.1617import {readFile} from 'fs/promises';18import {IKeyringPair} from '@polkadot/types/types';19import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from '../util/playgrounds';202122async function proxyWrap(helper: EthUniqueHelper, wrapped: any, donor: IKeyringPair) {23  // Proxy owner has no special privilegies, we don't need to reuse them24  const owner = await helper.eth.createAccountWithBalance(donor);25  const web3 = helper.getWeb3();26  const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {27    from: owner,28    gas: helper.eth.DEFAULT_GAS,29  });30  const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});31  return proxy;32}3334describe('NFT (Via EVM proxy): Information getting', () => {35  let alice: IKeyringPair;36  let donor: IKeyringPair;3738  before(async function() {39    await usingEthPlaygrounds(async (helper, privateKey) => {40      donor = privateKey('//Alice');41      [alice] = await helper.arrange.createAccounts([10n], donor);42    });43  });4445  itEth('totalSupply', async ({helper}) => {46    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});47    const caller = await helper.eth.createAccountWithBalance(donor);48    await collection.mintToken(alice, {Substrate: alice.address});4950    const address = helper.ethAddress.fromCollectionId(collection.collectionId);51    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);52    const contract = await proxyWrap(helper, evmCollection, donor);53    const totalSupply = await contract.methods.totalSupply().call();5455    expect(totalSupply).to.equal('1');56  });5758  itEth('balanceOf', async ({helper}) => {59    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});6061    const caller = await helper.eth.createAccountWithBalance(donor);62    await collection.mintMultipleTokens(alice, [63      {owner: {Ethereum: caller}},64      {owner: {Ethereum: caller}},65      {owner: {Ethereum: caller}},66    ]);6768    const address = helper.ethAddress.fromCollectionId(collection.collectionId);69    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);70    const contract = await proxyWrap(helper, evmCollection, donor);71    const balance = await contract.methods.balanceOf(caller).call();7273    expect(balance).to.equal('3');74  });7576  itEth('ownerOf', async ({helper}) => {77    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});7879    const caller = await helper.eth.createAccountWithBalance(donor);80    const {tokenId} = await collection.mintToken(alice, {Ethereum: caller});8182    const address = helper.ethAddress.fromCollectionId(collection.collectionId);83    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);84    const contract = await proxyWrap(helper, evmCollection, donor);85    const owner = await contract.methods.ownerOf(tokenId).call();8687    expect(owner).to.equal(caller);88  });89});9091describe('NFT (Via EVM proxy): Plain calls', () => {92  let alice: IKeyringPair;93  let donor: IKeyringPair;9495  before(async function() {96    await usingEthPlaygrounds(async (helper, privateKey) => {97      donor = privateKey('//Alice');98      [alice] = await helper.arrange.createAccounts([10n], donor);99    });100  });101102  itEth('Can perform mint()', async ({helper}) => {103    const owner = await helper.eth.createAccountWithBalance(donor);104    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');105    const caller = await helper.eth.createAccountWithBalance(donor);106    const receiver = helper.eth.createAccount();107108    const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);109    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller);110    const contract = await proxyWrap(helper, collectionEvm, donor);111    await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();112113    {114      const result = await contract.methods.mintWithTokenURI(receiver, 'Test URI').send({from: caller});115      const tokenId = result.events.Transfer.returnValues.tokenId;116      expect(tokenId).to.be.equal('1');117118      const events = helper.eth.normalizeEvents(result.events);119      events[0].address = events[0].address.toLocaleLowerCase();120121      expect(events).to.be.deep.equal([122        {123          address: collectionAddress.toLocaleLowerCase(),124          event: 'Transfer',125          args: {126            from: '0x0000000000000000000000000000000000000000',127            to: receiver,128            tokenId,129          },130        },131      ]);132133      expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');134    }135  });136137  //TODO: CORE-302 add eth methods138  itEth.skip('Can perform mintBulk()', async ({helper}) => {139    const collection = await helper.nft.mintCollection(donor, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});140141    const caller = await helper.eth.createAccountWithBalance(donor, 30n);142    const receiver = helper.eth.createAccount();143144    const address = helper.ethAddress.fromCollectionId(collection.collectionId);145    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);146    const contract = await proxyWrap(helper, evmCollection, donor);147    await collection.addAdmin(donor, {Ethereum: contract.options.address});148149    {150      const nextTokenId = await contract.methods.nextTokenId().call();151      expect(nextTokenId).to.be.equal('1');152      const result = await contract.methods.mintBulkWithTokenURI(153        receiver,154        [155          [nextTokenId, 'Test URI 0'],156          [+nextTokenId + 1, 'Test URI 1'],157          [+nextTokenId + 2, 'Test URI 2'],158        ],159      ).send({from: caller});160      const events = helper.eth.normalizeEvents(result.events);161162      expect(events).to.be.deep.equal([163        {164          address,165          event: 'Transfer',166          args: {167            from: '0x0000000000000000000000000000000000000000',168            to: receiver,169            tokenId: nextTokenId,170          },171        },172        {173          address,174          event: 'Transfer',175          args: {176            from: '0x0000000000000000000000000000000000000000',177            to: receiver,178            tokenId: String(+nextTokenId + 1),179          },180        },181        {182          address,183          event: 'Transfer',184          args: {185            from: '0x0000000000000000000000000000000000000000',186            to: receiver,187            tokenId: String(+nextTokenId + 2),188          },189        },190      ]);191192      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');193      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');194      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');195    }196  });197198  itEth('Can perform burn()', async ({helper}) => {199    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});200    const caller = await helper.eth.createAccountWithBalance(donor);201202    const address = helper.ethAddress.fromCollectionId(collection.collectionId);203    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);204    const contract = await proxyWrap(helper, evmCollection, donor);205    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});206    await collection.addAdmin(alice, {Ethereum: contract.options.address});207208    {209      const result = await contract.methods.burn(tokenId).send({from: caller});210      const events = helper.eth.normalizeEvents(result.events);211212      expect(events).to.be.deep.equal([213        {214          address,215          event: 'Transfer',216          args: {217            from: contract.options.address,218            to: '0x0000000000000000000000000000000000000000',219            tokenId: tokenId.toString(),220          },221        },222      ]);223    }224  });225226  itEth('Can perform approve()', async ({helper}) => {227    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});228    const caller = await helper.eth.createAccountWithBalance(donor);229    const spender = helper.eth.createAccount();230231    const address = helper.ethAddress.fromCollectionId(collection.collectionId);232    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);233    const contract = await proxyWrap(helper, evmCollection, donor);234    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});235236    {237      const result = await contract.methods.approve(spender, tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS});238      const events = helper.eth.normalizeEvents(result.events);239240      expect(events).to.be.deep.equal([241        {242          address,243          event: 'Approval',244          args: {245            owner: contract.options.address,246            approved: spender,247            tokenId: tokenId.toString(),248          },249        },250      ]);251    }252  });253254  itEth('Can perform transferFrom()', async ({helper}) => {255    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});256    const caller = await helper.eth.createAccountWithBalance(donor);257    const owner = await helper.eth.createAccountWithBalance(donor);258259    const receiver = helper.eth.createAccount();260261    const address = helper.ethAddress.fromCollectionId(collection.collectionId);262    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);263    const contract = await proxyWrap(helper, evmCollection, donor);264    const {tokenId} = await collection.mintToken(alice, {Ethereum: owner});265266    await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});267268    {269      const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});270      const events = helper.eth.normalizeEvents(result.events);271      expect(events).to.be.deep.equal([272        {273          address,274          event: 'Transfer',275          args: {276            from: owner,277            to: receiver,278            tokenId: tokenId.toString(),279          },280        },281      ]);282    }283284    {285      const balance = await contract.methods.balanceOf(receiver).call();286      expect(+balance).to.equal(1);287    }288289    {290      const balance = await contract.methods.balanceOf(contract.options.address).call();291      expect(+balance).to.equal(0);292    }293  });294295  itEth('Can perform transfer()', async ({helper}) => {296    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});297    const caller = await helper.eth.createAccountWithBalance(donor);298    const receiver = helper.eth.createAccount();299300    const address = helper.ethAddress.fromCollectionId(collection.collectionId);301    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);302    const contract = await proxyWrap(helper, evmCollection, donor);303    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});304305    {306      const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});307      const events = helper.eth.normalizeEvents(result.events);308      expect(events).to.be.deep.equal([309        {310          address,311          event: 'Transfer',312          args: {313            from: contract.options.address,314            to: receiver,315            tokenId: tokenId.toString(),316          },317        },318      ]);319    }320321    {322      const balance = await contract.methods.balanceOf(contract.options.address).call();323      expect(+balance).to.equal(0);324    }325326    {327      const balance = await contract.methods.balanceOf(receiver).call();328      expect(+balance).to.equal(1);329    }330  });331});
after · tests/src/eth/proxy/nonFungibleProxy.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/>.1617import {readFile} from 'fs/promises';18import {IKeyringPair} from '@polkadot/types/types';19import {EthUniqueHelper, itEth, usingEthPlaygrounds, expect} from '../util/playgrounds';202122async function proxyWrap(helper: EthUniqueHelper, wrapped: any, donor: IKeyringPair) {23  // Proxy owner has no special privilegies, we don't need to reuse them24  const owner = await helper.eth.createAccountWithBalance(donor);25  const web3 = helper.getWeb3();26  const proxyContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/UniqueNFTProxy.abi`)).toString()), undefined, {27    from: owner,28    gas: helper.eth.DEFAULT_GAS,29  });30  const proxy = await proxyContract.deploy({data: (await readFile(`${__dirname}/UniqueNFTProxy.bin`)).toString(), arguments: [wrapped.options.address]}).send({from: owner});31  return proxy;32}3334describe('NFT (Via EVM proxy): Information getting', () => {35  let alice: IKeyringPair;36  let donor: IKeyringPair;3738  before(async function() {39    await usingEthPlaygrounds(async (helper, privateKey) => {40      donor = privateKey('//Alice');41      [alice] = await helper.arrange.createAccounts([10n], donor);42    });43  });4445  itEth('totalSupply', async ({helper}) => {46    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});47    const caller = await helper.eth.createAccountWithBalance(donor);48    await collection.mintToken(alice, {Substrate: alice.address});4950    const address = helper.ethAddress.fromCollectionId(collection.collectionId);51    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);52    const contract = await proxyWrap(helper, evmCollection, donor);53    const totalSupply = await contract.methods.totalSupply().call();5455    expect(totalSupply).to.equal('1');56  });5758  itEth('balanceOf', async ({helper}) => {59    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});6061    const caller = await helper.eth.createAccountWithBalance(donor);62    await collection.mintMultipleTokens(alice, [63      {owner: {Ethereum: caller}},64      {owner: {Ethereum: caller}},65      {owner: {Ethereum: caller}},66    ]);6768    const address = helper.ethAddress.fromCollectionId(collection.collectionId);69    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);70    const contract = await proxyWrap(helper, evmCollection, donor);71    const balance = await contract.methods.balanceOf(caller).call();7273    expect(balance).to.equal('3');74  });7576  itEth('ownerOf', async ({helper}) => {77    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});7879    const caller = await helper.eth.createAccountWithBalance(donor);80    const {tokenId} = await collection.mintToken(alice, {Ethereum: caller});8182    const address = helper.ethAddress.fromCollectionId(collection.collectionId);83    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);84    const contract = await proxyWrap(helper, evmCollection, donor);85    const owner = await contract.methods.ownerOf(tokenId).call();8687    expect(owner).to.equal(caller);88  });89});9091describe('NFT (Via EVM proxy): Plain calls', () => {92  let alice: IKeyringPair;93  let donor: IKeyringPair;9495  before(async function() {96    await usingEthPlaygrounds(async (helper, privateKey) => {97      donor = privateKey('//Alice');98      [alice] = await helper.arrange.createAccounts([10n], donor);99    });100  });101102  itEth('Can perform mint()', async ({helper}) => {103    const owner = await helper.eth.createAccountWithBalance(donor);104    const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'A', 'A', '');105    const caller = await helper.eth.createAccountWithBalance(donor);106    const receiver = helper.eth.createAccount();107108    const collectionEvmOwned = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);109    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', caller);110    const contract = await proxyWrap(helper, collectionEvm, donor);111    await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();112113    {114      const nextTokenId = await contract.methods.nextTokenId().call()115      const result = await contract.methods.mintWithTokenURI(receiver, nextTokenId, 'Test URI').send({from: caller});116      const tokenId = result.events.Transfer.returnValues.tokenId;117      expect(tokenId).to.be.equal('1');118119      const events = helper.eth.normalizeEvents(result.events);120      events[0].address = events[0].address.toLocaleLowerCase();121122      expect(events).to.be.deep.equal([123        {124          address: collectionAddress.toLocaleLowerCase(),125          event: 'Transfer',126          args: {127            from: '0x0000000000000000000000000000000000000000',128            to: receiver,129            tokenId,130          },131        },132      ]);133134      expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');135    }136  });137138  //TODO: CORE-302 add eth methods139  itEth.skip('Can perform mintBulk()', async ({helper}) => {140    const collection = await helper.nft.mintCollection(donor, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});141142    const caller = await helper.eth.createAccountWithBalance(donor, 30n);143    const receiver = helper.eth.createAccount();144145    const address = helper.ethAddress.fromCollectionId(collection.collectionId);146    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);147    const contract = await proxyWrap(helper, evmCollection, donor);148    await collection.addAdmin(donor, {Ethereum: contract.options.address});149150    {151      const nextTokenId = await contract.methods.nextTokenId().call();152      expect(nextTokenId).to.be.equal('1');153      const result = await contract.methods.mintBulkWithTokenURI(154        receiver,155        [156          [nextTokenId, 'Test URI 0'],157          [+nextTokenId + 1, 'Test URI 1'],158          [+nextTokenId + 2, 'Test URI 2'],159        ],160      ).send({from: caller});161      const events = helper.eth.normalizeEvents(result.events);162163      expect(events).to.be.deep.equal([164        {165          address,166          event: 'Transfer',167          args: {168            from: '0x0000000000000000000000000000000000000000',169            to: receiver,170            tokenId: nextTokenId,171          },172        },173        {174          address,175          event: 'Transfer',176          args: {177            from: '0x0000000000000000000000000000000000000000',178            to: receiver,179            tokenId: String(+nextTokenId + 1),180          },181        },182        {183          address,184          event: 'Transfer',185          args: {186            from: '0x0000000000000000000000000000000000000000',187            to: receiver,188            tokenId: String(+nextTokenId + 2),189          },190        },191      ]);192193      expect(await contract.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI 0');194      expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');195      expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');196    }197  });198199  itEth('Can perform burn()', async ({helper}) => {200    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});201    const caller = await helper.eth.createAccountWithBalance(donor);202203    const address = helper.ethAddress.fromCollectionId(collection.collectionId);204    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);205    const contract = await proxyWrap(helper, evmCollection, donor);206    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});207    await collection.addAdmin(alice, {Ethereum: contract.options.address});208209    {210      const result = await contract.methods.burn(tokenId).send({from: caller});211      const events = helper.eth.normalizeEvents(result.events);212213      expect(events).to.be.deep.equal([214        {215          address,216          event: 'Transfer',217          args: {218            from: contract.options.address,219            to: '0x0000000000000000000000000000000000000000',220            tokenId: tokenId.toString(),221          },222        },223      ]);224    }225  });226227  itEth('Can perform approve()', async ({helper}) => {228    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});229    const caller = await helper.eth.createAccountWithBalance(donor);230    const spender = helper.eth.createAccount();231232    const address = helper.ethAddress.fromCollectionId(collection.collectionId);233    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);234    const contract = await proxyWrap(helper, evmCollection, donor);235    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});236237    {238      const result = await contract.methods.approve(spender, tokenId).send({from: caller, gas: helper.eth.DEFAULT_GAS});239      const events = helper.eth.normalizeEvents(result.events);240241      expect(events).to.be.deep.equal([242        {243          address,244          event: 'Approval',245          args: {246            owner: contract.options.address,247            approved: spender,248            tokenId: tokenId.toString(),249          },250        },251      ]);252    }253  });254255  itEth('Can perform transferFrom()', async ({helper}) => {256    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});257    const caller = await helper.eth.createAccountWithBalance(donor);258    const owner = await helper.eth.createAccountWithBalance(donor);259260    const receiver = helper.eth.createAccount();261262    const address = helper.ethAddress.fromCollectionId(collection.collectionId);263    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);264    const contract = await proxyWrap(helper, evmCollection, donor);265    const {tokenId} = await collection.mintToken(alice, {Ethereum: owner});266267    await evmCollection.methods.approve(contract.options.address, tokenId).send({from: owner});268269    {270      const result = await contract.methods.transferFrom(owner, receiver, tokenId).send({from: caller});271      const events = helper.eth.normalizeEvents(result.events);272      expect(events).to.be.deep.equal([273        {274          address,275          event: 'Transfer',276          args: {277            from: owner,278            to: receiver,279            tokenId: tokenId.toString(),280          },281        },282      ]);283    }284285    {286      const balance = await contract.methods.balanceOf(receiver).call();287      expect(+balance).to.equal(1);288    }289290    {291      const balance = await contract.methods.balanceOf(contract.options.address).call();292      expect(+balance).to.equal(0);293    }294  });295296  itEth('Can perform transfer()', async ({helper}) => {297    const collection = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});298    const caller = await helper.eth.createAccountWithBalance(donor);299    const receiver = helper.eth.createAccount();300301    const address = helper.ethAddress.fromCollectionId(collection.collectionId);302    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);303    const contract = await proxyWrap(helper, evmCollection, donor);304    const {tokenId} = await collection.mintToken(alice, {Ethereum: contract.options.address});305306    {307      const result = await contract.methods.transfer(receiver, tokenId).send({from: caller});308      const events = helper.eth.normalizeEvents(result.events);309      expect(events).to.be.deep.equal([310        {311          address,312          event: 'Transfer',313          args: {314            from: contract.options.address,315            to: receiver,316            tokenId: tokenId.toString(),317          },318        },319      ]);320    }321322    {323      const balance = await contract.methods.balanceOf(contract.options.address).call();324      expect(+balance).to.equal(0);325    }326327    {328      const balance = await contract.methods.balanceOf(receiver).call();329      expect(+balance).to.equal(1);330    }331  });332});