Skip to content

Commit

Permalink
fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Jan 20, 2025
1 parent efecd50 commit b11064f
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ packages/subgraph/imported
packages/subgraph/generated
packages/subgraph/tests/.bin

packages/contracts/.upgradable

# files
*.env
*.log
Expand Down
12 changes: 1 addition & 11 deletions packages/contracts/hardhat-zksync.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './types/hardhat';
import {isZkSync} from './utils/zkSync';
import RichAccounts from './utils/zksync-rich-accounts';
import {addRpcUrlToNetwork} from '@aragon/osx-commons-configs';
Expand Down Expand Up @@ -84,17 +85,6 @@ extendEnvironment((hre: HardhatRuntimeEnvironment) => {

const namedAccounts = {
deployer: 0,
alice: 1,
bob: 2,
carol: 3,
dave: 4,
eve: 5,
frank: 6,
grace: 7,
harold: 8,
ivan: 9,
judy: 10,
mallory: 11,
};

const config: HardhatUserConfig = {
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './types/hardhat';
import {
addRpcUrlToNetwork,
networks as osxCommonsConfigNetworks,
Expand Down
16 changes: 8 additions & 8 deletions packages/contracts/test/10_unit-testing/11_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
IProtocolVersion__factory,
ProxyFactory__factory,
} from '../../typechain';
import {ProxyCreatedEvent} from '../../typechain/@aragon/osx-commons-contracts/src/utils/deployment/ProxyFactory';
import {ProposalCreatedEvent} from '../../typechain/src/Admin';
import {isZkSync, ZK_SYNC_NETWORKS} from '../../utils/zkSync';
import {
Expand All @@ -24,8 +23,6 @@ import {
} from '../admin-constants';
import {loadFixtureCustom} from '../test-utils/fixture';
import {
skipDescribeIfNot,
skipTestIfNetworkIsZkSync,
skipTestSuiteIfNetworkIsNotZkSync,
skipTestSuiteIfNetworkIsZkSync,
} from '../test-utils/skip-functions';
Expand Down Expand Up @@ -515,9 +512,6 @@ async function fixture(): Promise<FixtureResult> {
target: dao.address,
};

let initializedPlugin: any;
let uninitializedPlugin: any;

const isZksync = isZkSync(hre.network.name);

const artifactSource = isZksync
Expand All @@ -528,8 +522,14 @@ async function fixture(): Promise<FixtureResult> {
? {withProxy: false, args: [dao.address, targetConfig]}
: {withProxy: true};

initializedPlugin = await hre.wrapper.deploy(artifactSource, deployArgs);
uninitializedPlugin = await hre.wrapper.deploy(artifactSource, deployArgs);
const initializedPlugin = await hre.wrapper.deploy(
artifactSource,
deployArgs
);
const uninitializedPlugin = await hre.wrapper.deploy(
artifactSource,
deployArgs
);

if (!isZksync) {
initializedPlugin.initialize(dao.address, targetConfig);
Expand Down
5 changes: 1 addition & 4 deletions packages/contracts/test/test-utils/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {decodeReturnData} from '@nomicfoundation/hardhat-chai-matchers/internal/
import {buildAssert} from '@nomicfoundation/hardhat-chai-matchers/utils.js';
import {AssertionError} from 'chai';
import chai from 'chai';
import {ethers} from 'hardhat';

/// The below code overwrites the behaviour of the `revertedWith` matcher to support how zkSync and ethers-v5
/// encode and handle errors. The functions below are lifted from the `hardhat-chai-matchers` package and modified
Expand Down Expand Up @@ -344,8 +345,6 @@ function findCustomErrorByName(
iface: any,
name: string
): CustomError | undefined {
const ethers = require('ethers');

const customErrorEntry = Object.entries(iface.errors).find(
([, fragment]: any) => fragment.name === name
);
Expand All @@ -365,8 +364,6 @@ function findCustomErrorByName(
}

function findCustomErrorById(iface: any, id: string): CustomError | undefined {
const ethers = require('ethers');

const customErrorEntry: any = Object.entries(iface.errors).find(
([signature]: any) => ethers.utils.id(signature).slice(0, 10) === id
);
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/test/test-utils/wrapper/hardhat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class HardhatClass implements NetworkDeployment {
sender: string,
type?: 'Deployment' | 'Transaction'
): Promise<number> {
type;
return this.provider.getTransactionCount(sender);
}

Expand Down
13 changes: 7 additions & 6 deletions packages/contracts/test/test-utils/wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {ProxyCreatedEvent} from '../../../typechain/ProxyFactory';
import {HardhatClass} from './hardhat';
import {ZkSync} from './zksync';
import {findEvent} from '@aragon/osx-commons-sdk';
import {BigNumberish, Contract, Wallet} from 'ethers';
import {BigNumberish, Contract} from 'ethers';
import {providers} from 'ethers';
import hre, {ethers} from 'hardhat';

Expand Down Expand Up @@ -77,7 +77,7 @@ export class Wrapper {
});
}

// @ts-ignore TODO:GIORGI
// @ts-expect-error TODO:GIORGI
return new Wrapper(new ZkSync(provider));
}

Expand All @@ -89,10 +89,11 @@ export class Wrapper {
const isProxy = options?.withProxy ?? false;
const initializer = options?.proxySettings?.initializer ?? undefined;

let {artifact, contract} = await this.network.deploy(
artifactName,
constructorArgs
);
const deployRes = await this.network.deploy(artifactName, constructorArgs);

const artifact = deployRes.artifact;
const contract = deployRes.contract;

if (isProxy) {
const {contract: proxyFactoryContract} = await this.network.deploy(
'ProxyFactory',
Expand Down
11 changes: 6 additions & 5 deletions packages/contracts/test/test-utils/wrapper/zksync.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {DeployOptions, NetworkDeployment} from '.';
import {getTime} from '../voting';
import {BigNumber, BigNumberish, Contract} from 'ethers';
import hre from 'hardhat';
import {Provider} from 'zksync-ethers';
Expand All @@ -15,8 +14,6 @@ export class ZkSync implements NetworkDeployment {
const {deployer} = hre;
const artifact = await deployer.loadArtifact(artifactName);
const contract = await deployer.deploy(artifact, args);
// TODO:Claudia this seems to be printed twice..
// console.log('movida good');

return {artifact, contract};
}
Expand Down Expand Up @@ -52,8 +49,12 @@ export class ZkSync implements NetworkDeployment {
const abi = [
'function getDeploymentNonce(address) public view returns(uint256)',
];
let signers = await ethers.getSigners();
let contract = new ethers.Contract(NONCE_HOLDER_ADDRESS, abi, signers[0]);
const signers = await ethers.getSigners();
const contract = new ethers.Contract(
NONCE_HOLDER_ADDRESS,
abi,
signers[0]
);
const nonce = await contract.getDeploymentNonce(sender);
return BigNumber.from(nonce).toNumber();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import {Wrapper} from '../test/test-utils/wrapper';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

export type VerifyEntry = {
address: string;
args?: unknown[];
};

declare module 'hardhat/types/runtime' {
interface HardhatRuntimeEnvironment {
wrapper: Wrapper;
aragonToVerifyContracts: VerifyEntry[];
}
}
10 changes: 0 additions & 10 deletions packages/contracts/utils/hardhat.d.ts

This file was deleted.

0 comments on commit b11064f

Please sign in to comment.