Skip to content

Commit

Permalink
chore: fix remaining failing tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Feb 19, 2024
1 parent adb776e commit b88acfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
createDataKey,
deployImplementationContracts,
} from './helpers';
import { EventLog } from 'ethers';

describe('UniversalProfileDeployer', function () {
describe('for non-proxies deployment', async function () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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');
Expand All @@ -832,7 +833,7 @@ describe('UniversalProfileDeployer', function () {

const secondaryContractDeploymentInit = {
fundingAmount: secondaryFundingAmount,
implementationContract: keyManagerWithExtraParamsFactory.address,
implementationContract: keyManagerWithExtraParamsFactory.target,
addPrimaryContractAddress: true,
initializationCalldata: initializationDataWithSelector,
extraInitializationParams: lastParam,
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b88acfc

Please sign in to comment.