From b88acfcd6f0d24af97ff06a5dac325105351911a Mon Sep 17 00:00:00 2001 From: CJ42 Date: Mon, 19 Feb 2024 16:49:56 +0000 Subject: [PATCH] chore: fix remaining failing tests in CI --- .../LSP23LinkedContractsDeployment.test.ts | 16 +++++++++------- tests/utils/fixtures.ts | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/LSP23LinkedContractsDeployment/LSP23LinkedContractsDeployment.test.ts b/tests/LSP23LinkedContractsDeployment/LSP23LinkedContractsDeployment.test.ts index ed1c82524..9c2089ce3 100644 --- a/tests/LSP23LinkedContractsDeployment/LSP23LinkedContractsDeployment.test.ts +++ b/tests/LSP23LinkedContractsDeployment/LSP23LinkedContractsDeployment.test.ts @@ -15,6 +15,7 @@ import { createDataKey, deployImplementationContracts, } from './helpers'; +import { EventLog } from 'ethers'; describe('UniversalProfileDeployer', function () { describe('for non-proxies deployment', async function () { @@ -140,7 +141,7 @@ describe('UniversalProfileDeployer', function () { expect(await universalProfileInstance.owner()).to.equal(keyManagerContract); // CHECK that the `target()` of the KeyManager contract is the UP contract - expect(await keyManagerInstance.target()).to.equal(upContract); + expect(await keyManagerInstance['target()'].staticCall()).to.equal(upContract); }); it('should deploy both contract (with value)', async function () { @@ -472,7 +473,7 @@ describe('UniversalProfileDeployer', function () { expect(await universalProfileInstance.owner()).to.equal(keyManagerContract); // CHECK that the `target()` of the KeyManager contract is the UP contract - expect(await keyManagerInstance.target()).to.equal(upContract); + expect(await keyManagerInstance['target()'].staticCall()).to.equal(upContract); expect(await keyManagerInstance.FIRST_PARAM()).to.deep.equal(firstAddress); expect(await keyManagerInstance.LAST_PARAM()).to.deep.equal(lastAddress); @@ -577,7 +578,7 @@ describe('UniversalProfileDeployer', function () { ) as unknown as LSP6KeyManager; const upProxyOwner = await upProxy.owner(); - const keyManagerProxyOwner = await keyManagerProxy.target(); + const keyManagerProxyOwner = await keyManagerProxy['target()'].staticCall(); const [expectedUpProxyAddress, expectedKeyManagerProxyAddress] = await LSP23LinkedContractsFactory.computeERC1167Addresses( @@ -805,7 +806,7 @@ describe('UniversalProfileDeployer', function () { 'KeyManagerInitWithExtraParams', ); const keyManagerWithExtraParamsFactory = await KeyManagerWithExtraParamsFactory.deploy(); - await keyManagerWithExtraParamsFactory.deployed(); + await keyManagerWithExtraParamsFactory.waitForDeployment(); const salt = ethers.hexlify(ethers.randomBytes(32)); const primaryFundingAmount = ethers.parseEther('1'); @@ -832,7 +833,7 @@ describe('UniversalProfileDeployer', function () { const secondaryContractDeploymentInit = { fundingAmount: secondaryFundingAmount, - implementationContract: keyManagerWithExtraParamsFactory.address, + implementationContract: keyManagerWithExtraParamsFactory.target, addPrimaryContractAddress: true, initializationCalldata: initializationDataWithSelector, extraInitializationParams: lastParam, @@ -922,11 +923,12 @@ describe('UniversalProfileDeployer', function () { ); const receipt = await tx.wait(); - const event = receipt.events?.find((e) => e.event === 'DeployedERC1167Proxies'); + // const event = receipt.events?.find((e) => e.event === 'DeployedERC1167Proxies'); + const event = receipt.logs.find((e: EventLog) => e.eventName === 'DeployedERC1167Proxies'); expect(event).to.not.be.undefined; - const args = event.args; + const args = (event as EventLog).args; expect(args[0]).to.equal(primaryAddress); expect(args[1]).to.equal(secondaryAddress); diff --git a/tests/utils/fixtures.ts b/tests/utils/fixtures.ts index f82ca022a..e51450c18 100644 --- a/tests/utils/fixtures.ts +++ b/tests/utils/fixtures.ts @@ -36,7 +36,7 @@ export async function deployProxy( // deploy proxy contract const proxyBytecode = eip1167RuntimeCodeTemplate.replace( 'bebebebebebebebebebebebebebebebebebebebe', - baseContractAddress.substr(2), + baseContractAddress.substring(2), ); const tx = await deployer.sendTransaction({ data: proxyBytecode, @@ -204,8 +204,8 @@ export async function getLSP5MapAndArrayKeysValue(account, token) { ethers.concat([ERC725YDataKeys.LSP5.LSP5ReceivedAssetsMap, token.address]), ); - const indexInHex = '0x' + mapValue.substr(10, mapValue.length); - const interfaceId = mapValue.substr(0, 10); + const indexInHex = '0x' + mapValue.substring(10, mapValue.length); + const interfaceId = mapValue.substring(0, 10); const indexInNumber = ethers.toNumber(ethers.toBigInt(indexInHex)); const rawIndexInArray = ethers.zeroPadValue(ethers.toBeHex(indexInNumber), 16);