1234567891011121314151617import {itEth, usingEthPlaygrounds, expect} from './util';18import {IKeyringPair} from '@polkadot/types/types';19import {Pallets} from '../util';2021const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';2223describe('[eth]CollectionHelperAddress test: ERC20/ERC721 ', () => {24 let donor: IKeyringPair;2526 before(async function() {27 await usingEthPlaygrounds(async (helper, privateKey) => {28 donor = await privateKey({filename: __filename});29 });30 });3132 itEth('NFT', async ({helper}) => {33 const owner = await helper.eth.createAccountWithBalance(donor);3435 const {collectionAddress: nftCollectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');36 const nftCollection = await helper.ethNativeContract.collection(nftCollectionAddress, 'nft', owner);3738 expect((await nftCollection.methods.collectionHelperAddress().call())39 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);40 });4142 itEth.ifWithPallets('RFT ', [Pallets.ReFungible], async ({helper}) => {43 const owner = await helper.eth.createAccountWithBalance(donor);4445 const {collectionAddress: rftCollectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');4647 const rftCollection = await helper.ethNativeContract.collection(rftCollectionAddress, 'rft', owner);48 expect((await rftCollection.methods.collectionHelperAddress().call())49 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);50 });5152 itEth('FT', async ({helper}) => {53 const owner = await helper.eth.createAccountWithBalance(donor);5455 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', 18, 'absolutely anything', 'ROC');56 const collection = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);5758 expect((await collection.methods.collectionHelperAddress().call())59 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);60 });6162 itEth('[collectionHelpers] convert collectionId into address', async ({helper}) => {63 const owner = await helper.eth.createAccountWithBalance(donor);64 const collectionId = 7;65 const collectionAddress = helper.ethAddress.fromCollectionId(collectionId);66 const helperContract = await helper.ethNativeContract.collectionHelpers(owner);6768 expect(await helperContract.methods.collectionAddress(collectionId).call()).to.be.equal(collectionAddress);69 expect(parseInt(await helperContract.methods.collectionId(collectionAddress).call())).to.be.equal(collectionId);70 });7172});