From d317c715ab04bfba8606aa625fb4b0a0f6e16d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senovilla=20Polo?= Date: Tue, 12 Nov 2024 17:42:50 +0100 Subject: [PATCH] Use this.ethereumPairs instead of the plain address along tests --- e2e-tests/tests/test-create-collection.ts | 19 ++++---- e2e-tests/tests/test-evolution.ts | 39 ++++++++------- e2e-tests/tests/test-staking.ts | 30 +++++------- .../tests/test-update-extended-token-uri.ts | 48 +++++++++---------- e2e-tests/tests/test-web3api.ts | 4 +- 5 files changed, 62 insertions(+), 78 deletions(-) diff --git a/e2e-tests/tests/test-create-collection.ts b/e2e-tests/tests/test-create-collection.ts index a338b3b64..587a3edd8 100644 --- a/e2e-tests/tests/test-create-collection.ts +++ b/e2e-tests/tests/test-create-collection.ts @@ -5,8 +5,6 @@ import { EVOLUTION_COLLECTION_FACTORY_CONTRACT_ADDRESS, EVOLUTION_COLLECTION_FACTORY_ABI, GAS_PRICE, - FAITH, - FAITH_PRIVATE_KEY, REVERT_BYTECODE, SELECTOR_LOG_NEW_COLLECTION, } from "./config"; @@ -24,11 +22,10 @@ describeWithExistingNode("Frontier RPC (Create Collection)", function () { EVOLUTION_COLLECTION_FACTORY_ABI, EVOLUTION_COLLECTION_FACTORY_CONTRACT_ADDRESS, { - from: FAITH, + from: this.ethereumPairs.faith.address, gasPrice: GAS_PRICE, } ); - this.context.web3.eth.accounts.wallet.add(FAITH_PRIVATE_KEY); }); step("when collection is created, it should return owner", async function () { @@ -36,13 +33,13 @@ describeWithExistingNode("Frontier RPC (Create Collection)", function () { testCollectionContract = collectionContract; const owner = await collectionContract.methods.owner().call(); - expect(owner).to.be.eq(FAITH); + expect(owner).to.be.eq(this.ethereumPairs.faith.address); }); step("when collection is created event is emitted", async function () { - const estimatedGas = await contract.methods.createCollection(FAITH).estimateGas(); - const result = await contract.methods.createCollection(FAITH).send({ - from: FAITH, + const estimatedGas = await contract.methods.createCollection(this.ethereumPairs.faith.address).estimateGas(); + const result = await contract.methods.createCollection(this.ethereumPairs.faith.address).send({ + from: this.ethereumPairs.faith.address, gas: estimatedGas, gasPrice: GAS_PRICE, }); @@ -53,13 +50,13 @@ describeWithExistingNode("Frontier RPC (Create Collection)", function () { true ); testCollectionAddress = result.events.NewCollection.returnValues._collectionAddress; - expect(result.events.NewCollection.returnValues._owner).to.be.eq(FAITH); + expect(result.events.NewCollection.returnValues._owner).to.be.eq(this.ethereumPairs.faith.address); // event topics expect(result.events.NewCollection.raw.topics.length).to.be.eq(2); expect(result.events.NewCollection.raw.topics[0]).to.be.eq(SELECTOR_LOG_NEW_COLLECTION); expect(result.events.NewCollection.raw.topics[1]).to.be.eq( - this.context.web3.utils.padLeft(FAITH.toLowerCase(), 64) + this.context.web3.utils.padLeft(this.ethereumPairs.faith.address.toLowerCase(), 64) ); // event data @@ -75,6 +72,6 @@ describeWithExistingNode("Frontier RPC (Create Collection)", function () { expect(await this.context.web3.eth.getCode(testCollectionAddress)).to.be.eq(REVERT_BYTECODE); // non-contract address doesn't have any code - expect(await this.context.web3.eth.getCode(FAITH)).to.be.eq("0x"); + expect(await this.context.web3.eth.getCode(this.ethereumPairs.faith.address)).to.be.eq("0x"); }); }); diff --git a/e2e-tests/tests/test-evolution.ts b/e2e-tests/tests/test-evolution.ts index 4fa887e0b..bff61899b 100644 --- a/e2e-tests/tests/test-evolution.ts +++ b/e2e-tests/tests/test-evolution.ts @@ -1,6 +1,5 @@ import { createCollection, describeWithExistingNode, slotAndOwnerToTokenId } from "./util"; import { - FAITH, SELECTOR_LOG_EVOLVED_WITH_EXTERNAL_TOKEN_URI, SELECTOR_LOG_MINTED_WITH_EXTERNAL_TOKEN_URI, SELECTOR_LOG_OWNERSHIP_TRANSFERRED, @@ -32,14 +31,14 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { step("when asset is minted it should return token uri", async function () { const slot = "0"; - const to = FAITH; + const to = this.ethereumPairs.faith.address; const tokenURI = "https://example.com"; - let nonce = await this.context.web3.eth.getTransactionCount(FAITH); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.faith.address); const estimatedGas = await collectionContract.methods.mintWithExternalURI(to, slot, tokenURI).estimateGas(); const result = await collectionContract.methods .mintWithExternalURI(to, slot, tokenURI) - .send({ from: FAITH, gas: estimatedGas, nonce: nonce++ }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas, nonce: nonce++ }); expect(result.status).to.be.eq(true); const tokenId = result.events.MintedWithExternalURI.returnValues._tokenId; @@ -49,7 +48,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { step("given slot and owner it should return token id", async function () { const slot = "1"; - const to = FAITH; + const to = this.ethereumPairs.faith.address; const tokenId = slotAndOwnerToTokenId(slot, to); expect(tokenId).to.be.eq("000000000000000000000001c0f0f4ab324c46e55d02d0033343b4be8a55532d"); @@ -59,13 +58,13 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { step("when asset is minted it should emit an event", async function () { const slot = "22"; - const to = FAITH; + const to = this.ethereumPairs.faith.address; const tokenURI = "https://example.com"; const estimatedGas = await collectionContract.methods.mintWithExternalURI(to, slot, tokenURI).estimateGas(); const result = await collectionContract.methods .mintWithExternalURI(to, slot, tokenURI) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(result.status).to.be.eq(true); expect(Object.keys(result.events).length).to.be.eq(1); @@ -82,7 +81,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { expect(result.events.MintedWithExternalURI.raw.topics.length).to.be.eq(2); expect(result.events.MintedWithExternalURI.raw.topics[0]).to.be.eq(SELECTOR_LOG_MINTED_WITH_EXTERNAL_TOKEN_URI); expect(result.events.MintedWithExternalURI.raw.topics[1]).to.be.eq( - this.context.web3.utils.padLeft(FAITH.toLowerCase(), 64) + this.context.web3.utils.padLeft(this.ethereumPairs.faith.address.toLowerCase(), 64) ); // event data @@ -96,7 +95,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { step("when asset is evolved it should change token uri", async function () { const slot = "22"; - const to = FAITH; + const to = this.ethereumPairs.faith.address; const tokenURI = "https://example.com"; const newTokenURI = "https://new_example.com"; const tokenId = slotAndOwnerToTokenId(slot, to); @@ -105,7 +104,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { var estimatedGas = await collectionContract.methods.mintWithExternalURI(to, slot, tokenURI).estimateGas(); const mintingResult = await collectionContract.methods .mintWithExternalURI(to, slot, tokenURI) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(mintingResult.status).to.be.eq(true); estimatedGas = await collectionContract.methods @@ -113,7 +112,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { .estimateGas(); const evolvingResult = await collectionContract.methods .evolveWithExternalURI(tokenIdDecimal, newTokenURI) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(evolvingResult.status).to.be.eq(true); const got = await collectionContract.methods.tokenURI(tokenIdDecimal).call(); @@ -122,7 +121,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { step("when asset is evolved it should emit an event", async function () { const slot = "22"; - const to = FAITH; + const to = this.ethereumPairs.faith.address; const tokenURI = "https://example.com"; const newTokenURI = "https://new_example.com"; const tokenId = slotAndOwnerToTokenId(slot, to); @@ -131,7 +130,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { var estimatedGas = await collectionContract.methods.mintWithExternalURI(to, slot, tokenURI).estimateGas(); const mintingResult = await collectionContract.methods .mintWithExternalURI(to, slot, tokenURI) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(mintingResult.status).to.be.eq(true); estimatedGas = await collectionContract.methods @@ -139,7 +138,7 @@ describeWithExistingNode("Frontier RPC (Mint and Evolve Assets)", function () { .estimateGas(); const evolvingResult = await collectionContract.methods .evolveWithExternalURI(tokenIdDecimal, newTokenURI) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(evolvingResult.status).to.be.eq(true); expect(Object.keys(evolvingResult.events).length).to.be.eq(1); @@ -172,18 +171,18 @@ describeWithExistingNode("Frontier RPC (Transfer Ownership)", function () { step("when is transferred owner should change and emit an event", async function () { const newOwner = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; - expect(await collectionContract.methods.owner().call()).to.be.eq(FAITH); + expect(await collectionContract.methods.owner().call()).to.be.eq(this.ethereumPairs.faith.address); const estimatedGas = await collectionContract.methods.transferOwnership(newOwner).estimateGas(); const tranferringResult = await collectionContract.methods .transferOwnership(newOwner) - .send({ from: FAITH, gas: estimatedGas }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect(tranferringResult.status).to.be.eq(true); expect(await collectionContract.methods.owner().call()).to.be.eq(newOwner); expect(Object.keys(tranferringResult.events).length).to.be.eq(1); // data returned within the event - expect(tranferringResult.events.OwnershipTransferred.returnValues._previousOwner).to.be.eq(FAITH); + expect(tranferringResult.events.OwnershipTransferred.returnValues._previousOwner).to.be.eq(this.ethereumPairs.faith.address); expect(tranferringResult.events.OwnershipTransferred.returnValues._newOwner).to.be.eq(newOwner); // event topics @@ -192,7 +191,7 @@ describeWithExistingNode("Frontier RPC (Transfer Ownership)", function () { SELECTOR_LOG_OWNERSHIP_TRANSFERRED ); expect(tranferringResult.events.OwnershipTransferred.raw.topics[1]).to.be.eq( - this.context.web3.utils.padLeft(FAITH.toLowerCase(), 64) + this.context.web3.utils.padLeft(this.ethereumPairs.faith.address.toLowerCase(), 64) ); expect(tranferringResult.events.OwnershipTransferred.raw.topics[2]).to.be.eq( this.context.web3.utils.padLeft(newOwner.toLowerCase(), 64) @@ -201,8 +200,8 @@ describeWithExistingNode("Frontier RPC (Transfer Ownership)", function () { expect(tranferringResult.events.OwnershipTransferred.raw.data).to.be.eq("0x"); try { - const estimatedGas = await collectionContract.methods.transferOwnership(FAITH).estimateGas(); - await collectionContract.methods.transferOwnership(FAITH).send({ from: FAITH, gas: estimatedGas }); + const estimatedGas = await collectionContract.methods.transferOwnership(this.ethereumPairs.faith.address).estimateGas(); + await collectionContract.methods.transferOwnership(this.ethereumPairs.faith.address).send({ from: this.ethereumPairs.faith.address, gas: estimatedGas }); expect.fail("Expected error was not thrown"); // Ensure an error is thrown } catch (error) { expect(error.message).to.eq( diff --git a/e2e-tests/tests/test-staking.ts b/e2e-tests/tests/test-staking.ts index 954a3750f..a46d86657 100644 --- a/e2e-tests/tests/test-staking.ts +++ b/e2e-tests/tests/test-staking.ts @@ -1,18 +1,12 @@ import { describeWithExistingNode } from "./util"; import { - ALITH, STAKING_ABI, STAKING_CONTRACT_ADDRESS, UNIT, - FAITH_PRIVATE_KEY, - FAITH, - BALTATHAR, - BALTATHAR_PRIVATE_KEY, } from "./config"; import { expect } from "chai"; import Contract from "web3-eth-contract"; import { step } from "mocha-steps"; -import { Keyring } from "@polkadot/api"; describeWithExistingNode( "Frontier RPC (Staking)", @@ -21,10 +15,8 @@ describeWithExistingNode( before(async function () { contract = new this.context.web3.eth.Contract(STAKING_ABI, STAKING_CONTRACT_ADDRESS, { - from: ALITH, + from: this.ethereumPairs.alith.address, }); - this.context.web3.eth.accounts.wallet.add(BALTATHAR_PRIVATE_KEY); - this.context.web3.eth.accounts.wallet.add(FAITH_PRIVATE_KEY); }); step("Faith can join as candidate", async function () { @@ -37,7 +29,7 @@ describeWithExistingNode( console.log("transaction failed", error); }); - expect(await contract.methods.isCandidate(FAITH).call()).to.be.eq(false); + expect(await contract.methods.isCandidate(this.ethereumPairs.faith.address).call()).to.be.eq(false); const candidateCount = await contract.methods.candidateCount().call(); expect((await this.context.web3.eth.getBlock("latest")).baseFeePerGas.toString()).to.be.eq( await this.context.web3.eth.getGasPrice() @@ -46,24 +38,24 @@ describeWithExistingNode( .joinCandidates(BigInt(20000) * UNIT, candidateCount) .estimateGas(); const gasPrice = (await this.context.web3.eth.getGasPrice()) + 1; // if we don't add +1 tx never gets included in the block - let nonce = await this.context.web3.eth.getTransactionCount(FAITH); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.faith.address); const result = await contract.methods .joinCandidates(BigInt(20000) * UNIT, candidateCount) - .send({ from: FAITH, gas: estimatedGas, gasPrice, nonce: nonce++ }); + .send({ from: this.ethereumPairs.faith.address, gas: estimatedGas, gasPrice, nonce: nonce++ }); expect(result.status).to.be.eq(true); - expect(await contract.methods.isCandidate(FAITH).call()).to.be.eq(true); + expect(await contract.methods.isCandidate(this.ethereumPairs.faith.address).call()).to.be.eq(true); }); step("Baltathar can delegate to Faith", async function () { - expect(await contract.methods.isDelegator(BALTATHAR).call()).to.be.eq(false); - let nonce = await this.context.web3.eth.getTransactionCount(BALTATHAR); + expect(await contract.methods.isDelegator(this.ethereumPairs.baltathar.address).call()).to.be.eq(false); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.baltathar.address); const gasPrice = (await this.context.web3.eth.getGasPrice()) + 1; // if we don't add +1 tx never gets included in the block - const estimatedGas = await contract.methods.delegate(FAITH, BigInt(1000) * UNIT, 0, 0).estimateGas(); + const estimatedGas = await contract.methods.delegate(this.ethereumPairs.faith.address, BigInt(1000) * UNIT, 0, 0).estimateGas(); const result = await contract.methods - .delegate(FAITH, BigInt(1000) * UNIT, 0, 0) - .send({ from: BALTATHAR, gas: estimatedGas, gasPrice, nonce: nonce++ }); + .delegate(this.ethereumPairs.faith.address, BigInt(1000) * UNIT, 0, 0) + .send({ from: this.ethereumPairs.baltathar.address, gas: estimatedGas, gasPrice, nonce: nonce++ }); expect(result.status).to.be.eq(true); - expect(await contract.methods.isDelegator(BALTATHAR).call()).to.be.eq(true); + expect(await contract.methods.isDelegator(this.ethereumPairs.baltathar.address).call()).to.be.eq(true); }); }, true diff --git a/e2e-tests/tests/test-update-extended-token-uri.ts b/e2e-tests/tests/test-update-extended-token-uri.ts index d02d9e7d5..3161d3151 100644 --- a/e2e-tests/tests/test-update-extended-token-uri.ts +++ b/e2e-tests/tests/test-update-extended-token-uri.ts @@ -5,8 +5,6 @@ import { ASSET_METADATA_EXTENDER_ADDRESS, ASSET_METADATA_EXTENDER_ABI, GAS_PRICE, - FAITH, - FAITH_PRIVATE_KEY, SELECTOR_LOG_UPDATED_EXTENDED_UL_WITH_EXTERNAL_URI, SELECTOR_LOG_EXTENDED_UL_WITH_EXTERNAL_URI, } from "./config"; @@ -17,10 +15,9 @@ describeWithExistingNode("Frontier RPC (Extend Token URI)", function () { before(async function () { contract = new this.context.web3.eth.Contract(ASSET_METADATA_EXTENDER_ABI, ASSET_METADATA_EXTENDER_ADDRESS, { - from: FAITH, + from: this.ethereumPairs.faith.address, gasPrice: GAS_PRICE, }); - this.context.web3.eth.accounts.wallet.add(FAITH_PRIVATE_KEY); }); let uloc = `universal/location/1/${Date.now()}`; @@ -29,14 +26,14 @@ describeWithExistingNode("Frontier RPC (Extend Token URI)", function () { step("by default token uri is empty", async function () { expect(await contract.methods.balanceOfUL(uloc).call()).to.be.eq("0"); - expect(await contract.methods.hasExtensionByClaimer(uloc, FAITH).call()).to.be.eq(false); + expect(await contract.methods.hasExtensionByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(false); }); step("extend should return ok", async function () { - let nonce = await this.context.web3.eth.getTransactionCount(FAITH); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.faith.address); const estimatedGas = await contract.methods.extendULWithExternalURI(uloc, tokenURI).estimateGas(); extendResult = await contract.methods.extendULWithExternalURI(uloc, tokenURI).send({ - from: FAITH, + from: this.ethereumPairs.faith.address, gas: estimatedGas, gasPrice: GAS_PRICE, nonce: nonce++, @@ -46,16 +43,16 @@ describeWithExistingNode("Frontier RPC (Extend Token URI)", function () { step("it creates an extension that I can query", async function () { expect(await contract.methods.extensionOfULByIndex(uloc, 0).call()).to.be.eq(tokenURI); - expect(await contract.methods.extensionOfULByClaimer(uloc, FAITH).call()).to.be.eq(tokenURI); - expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(FAITH); + expect(await contract.methods.extensionOfULByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(tokenURI); + expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(this.ethereumPairs.faith.address); expect(await contract.methods.balanceOfUL(uloc).call()).to.be.eq("1"); - expect(await contract.methods.hasExtensionByClaimer(uloc, FAITH).call()).to.be.eq(true); + expect(await contract.methods.hasExtensionByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(true); }); step("it emits an event", async function () { // data returned within the event expect(Object.keys(extendResult.events).length).to.be.eq(1); - expect(extendResult.events.ExtendedULWithExternalURI.returnValues._claimer).to.be.eq(FAITH); + expect(extendResult.events.ExtendedULWithExternalURI.returnValues._claimer).to.be.eq(this.ethereumPairs.faith.address); expect(extendResult.events.ExtendedULWithExternalURI.returnValues._universalLocationHash).to.be.eq( this.context.web3.utils.soliditySha3(uloc) ); @@ -68,7 +65,7 @@ describeWithExistingNode("Frontier RPC (Extend Token URI)", function () { SELECTOR_LOG_EXTENDED_UL_WITH_EXTERNAL_URI ); expect(extendResult.events.ExtendedULWithExternalURI.raw.topics[1]).to.be.eq( - this.context.web3.utils.padLeft(FAITH.toLowerCase(), 64) + this.context.web3.utils.padLeft(this.ethereumPairs.faith.address.toLowerCase(), 64) ); expect(extendResult.events.ExtendedULWithExternalURI.raw.topics[2]).to.be.eq( this.context.web3.utils.padLeft(this.context.web3.utils.soliditySha3(uloc), 64) @@ -91,16 +88,15 @@ describeWithExistingNode("Frontier RPC (Update Extended Token URI)", async funct before(async function () { contract = new this.context.web3.eth.Contract(ASSET_METADATA_EXTENDER_ABI, ASSET_METADATA_EXTENDER_ADDRESS, { - from: FAITH, + from: this.ethereumPairs.faith.address, gasPrice: GAS_PRICE, }); - this.context.web3.eth.accounts.wallet.add(FAITH_PRIVATE_KEY); // we first create an extension to be updated later - let nonce = await this.context.web3.eth.getTransactionCount(FAITH); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.faith.address); const estimatedGas = await contract.methods.extendULWithExternalURI(uloc, tokenURI).estimateGas(); const createResult = await contract.methods.extendULWithExternalURI(uloc, tokenURI).send({ - from: FAITH, + from: this.ethereumPairs.faith.address, gas: estimatedGas, gasPrice: GAS_PRICE, nonce: nonce++, @@ -110,17 +106,17 @@ describeWithExistingNode("Frontier RPC (Update Extended Token URI)", async funct step("check existing extension", async function () { expect(await contract.methods.extensionOfULByIndex(uloc, 0).call()).to.be.eq(tokenURI); - expect(await contract.methods.extensionOfULByClaimer(uloc, FAITH).call()).to.be.eq(tokenURI); - expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(FAITH); + expect(await contract.methods.extensionOfULByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(tokenURI); + expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(this.ethereumPairs.faith.address); expect(await contract.methods.balanceOfUL(uloc).call()).to.be.eq("1"); - expect(await contract.methods.hasExtensionByClaimer(uloc, FAITH).call()).to.be.eq(true); + expect(await contract.methods.hasExtensionByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(true); }); step("update extension should return ok", async function () { - let nonce = await this.context.web3.eth.getTransactionCount(FAITH); + let nonce = await this.context.web3.eth.getTransactionCount(this.ethereumPairs.faith.address); const estimatedGas = await contract.methods.updateExtendedULWithExternalURI(uloc, newTokenURI).estimateGas(); updateExtensionResult = await contract.methods.updateExtendedULWithExternalURI(uloc, newTokenURI).send({ - from: FAITH, + from: this.ethereumPairs.faith.address, gas: estimatedGas, gasPrice: GAS_PRICE, nonce: nonce++, @@ -130,17 +126,17 @@ describeWithExistingNode("Frontier RPC (Update Extended Token URI)", async funct step("it updates just the extension data", async function () { expect(await contract.methods.extensionOfULByIndex(uloc, 0).call()).to.be.eq(newTokenURI); - expect(await contract.methods.extensionOfULByClaimer(uloc, FAITH).call()).to.be.eq(newTokenURI); + expect(await contract.methods.extensionOfULByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(newTokenURI); // the following might be the same as before updating - expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(FAITH); + expect(await contract.methods.claimerOfULByIndex(uloc, 0).call()).to.be.eq(this.ethereumPairs.faith.address); expect(await contract.methods.balanceOfUL(uloc).call()).to.be.eq("1"); - expect(await contract.methods.hasExtensionByClaimer(uloc, FAITH).call()).to.be.eq(true); + expect(await contract.methods.hasExtensionByClaimer(uloc, this.ethereumPairs.faith.address).call()).to.be.eq(true); }); step("it emits an event", async function () { // data returned within the event expect(Object.keys(updateExtensionResult.events).length).to.be.eq(1); - expect(updateExtensionResult.events.UpdatedExtendedULWithExternalURI.returnValues._claimer).to.be.eq(FAITH); + expect(updateExtensionResult.events.UpdatedExtendedULWithExternalURI.returnValues._claimer).to.be.eq(this.ethereumPairs.faith.address); expect( updateExtensionResult.events.UpdatedExtendedULWithExternalURI.returnValues._universalLocationHash ).to.be.eq(this.context.web3.utils.soliditySha3(uloc)); @@ -157,7 +153,7 @@ describeWithExistingNode("Frontier RPC (Update Extended Token URI)", async funct SELECTOR_LOG_UPDATED_EXTENDED_UL_WITH_EXTERNAL_URI ); expect(updateExtensionResult.events.UpdatedExtendedULWithExternalURI.raw.topics[1]).to.be.eq( - this.context.web3.utils.padLeft(FAITH.toLowerCase(), 64) + this.context.web3.utils.padLeft(this.ethereumPairs.faith.address.toLowerCase(), 64) ); expect(updateExtensionResult.events.UpdatedExtendedULWithExternalURI.raw.topics[2]).to.be.eq( this.context.web3.utils.padLeft(this.context.web3.utils.soliditySha3(uloc), 64) diff --git a/e2e-tests/tests/test-web3api.ts b/e2e-tests/tests/test-web3api.ts index f2dd40460..45320f052 100644 --- a/e2e-tests/tests/test-web3api.ts +++ b/e2e-tests/tests/test-web3api.ts @@ -2,7 +2,7 @@ import BN from "bn.js"; import { assert, expect } from "chai"; import { step } from "mocha-steps"; -import { CHAIN_ID, FAITH, RUNTIME_IMPL_VERSION, RUNTIME_SPEC_NAME, RUNTIME_SPEC_VERSION } from "./config"; +import { CHAIN_ID, RUNTIME_IMPL_VERSION, RUNTIME_SPEC_NAME, RUNTIME_SPEC_VERSION } from "./config"; import { customRequest, describeWithExistingNode } from "./util"; describeWithExistingNode("Frontier RPC (Web3Api)", function () { @@ -26,7 +26,7 @@ describeWithExistingNode("Frontier RPC (Web3Api)", function () { }); step("genesis balance is setup correctly", async function () { - const balance = new BN(await this.context.web3.eth.getBalance(FAITH)); + const balance = new BN(await this.context.web3.eth.getBalance(this.ethereumPairs.faith.address)); expect(balance.gt(new BN(0))).to.be.eq(true); }); });