Skip to content

Commit

Permalink
Appease the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
m-chrzan committed Mar 15, 2024
1 parent b1948cf commit 18ccf95
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 33 deletions.
1 change: 0 additions & 1 deletion test-ts/default-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
electGroup,
electMockValidatorGroupsAndUpdate,
registerValidatorAndAddToGroupMembers,
registerValidatorAndOnlyAffiliateToGroup,
registerValidatorGroup,
removeMembersFromGroup,
updateGroupSlashingMultiplier,
Expand Down
14 changes: 8 additions & 6 deletions test-ts/proxy-deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ describe("Contract deployed via proxy", () => {
const newImplementation = (await contractFactory.deploy()).address;
const theProxy = await hre.ethers.getContract(`${test.contractName}_Proxy`);

await expect(submitAndExecuteMultiSigProposal(
[contract.address],
["0"],
[contract.interface.encodeFunctionData("upgradeTo", [newImplementation])],
multisigOwner0
)).to.emit(theProxy, "Upgraded");
await expect(
submitAndExecuteMultiSigProposal(
[contract.address],
["0"],
[contract.interface.encodeFunctionData("upgradeTo", [newImplementation])],
multisigOwner0
)
).to.emit(theProxy, "Upgraded");
});
});

Expand Down
8 changes: 1 addition & 7 deletions test-ts/utils-interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable no-unused-vars */
import {
BaseContract,
BigNumber as EthersBigNumber,
CallOverrides,
ContractTransaction,
Overrides,
} from "ethers";
import { BaseContract, BigNumber as EthersBigNumber, ContractTransaction, Overrides } from "ethers";

export interface RebalanceContract extends BaseContract {
rebalance(
Expand Down
14 changes: 6 additions & 8 deletions test-ts/utils-multisig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hre from "hardhat";
import { BigNumberish, ContractTransaction, Signer } from "ethers";

import hre from "hardhat";
import { ProposalConfirmedEvent } from "../typechain-types/MultiSig";
import { timeTravel } from "./utils";

export async function submitAndExecuteMultiSigProposal(
Expand All @@ -10,13 +10,11 @@ export async function submitAndExecuteMultiSigProposal(
signer: Signer
): Promise<ContractTransaction> {
const multiSig = await hre.ethers.getContract("MultiSig");
const tx = await multiSig.connect(signer).submitProposal(
destinations,
values,
payloads
);
const tx = await multiSig.connect(signer).submitProposal(destinations, values, payloads);
const receipt = await tx.wait();
const event = receipt.events?.find((event: any) => event.event === "ProposalConfirmed");
const event = receipt.events?.find(
(event: ProposalConfirmedEvent) => event.event === "ProposalConfirmed"
);
// @ts-ignore - proposalId not a compiled member of event.args
const proposalId = event?.args.proposalId;
await timeTravel((await multiSig.delay()).toNumber());
Expand Down
4 changes: 1 addition & 3 deletions test-ts/utils-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import {
MIN_VALIDATOR_LOCKED_CELO,
timeTravel,
} from "./utils";
import {
submitAndExecuteMultiSigProposal,
} from "./utils-multisig";
import { submitAndExecuteMultiSigProposal } from "./utils-multisig";

// Locks the required CELO and registers as a validator group.
export async function registerValidatorGroup(account: SignerWithAddress, members = 1) {
Expand Down
14 changes: 6 additions & 8 deletions test-ts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LockedGoldWrapper } from "@celo/contractkit/lib/wrappers/LockedGold";
import { ValidatorsWrapper } from "@celo/contractkit/lib/wrappers/Validators";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { default as BigNumberJs } from "bignumber.js";
import { BigNumber as EthersBigNumber, Contract, Wallet } from "ethers";
import { BigNumber as EthersBigNumber, Wallet } from "ethers";
import { formatEther, parseUnits } from "ethers/lib/utils";
import hre, { ethers } from "hardhat";
import Web3 from "web3";
Expand All @@ -24,11 +24,7 @@ import { MockDefaultStrategy } from "../typechain-types/MockDefaultStrategy";
import { MockGroupHealth } from "../typechain-types/MockGroupHealth";
import { SpecificGroupStrategy } from "../typechain-types/SpecificGroupStrategy";
import electionContractData from "./code/abi/electionAbi.json";
import {
ExpectVsReal,
OrderedGroup,
RebalanceContract,
} from "./utils-interfaces";
import { ExpectVsReal, OrderedGroup, RebalanceContract } from "./utils-interfaces";

export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000";
export const REGISTRY_ADDRESS = "0x000000000000000000000000000000000000ce10";
Expand Down Expand Up @@ -252,7 +248,9 @@ export async function setGovernanceConcurrentProposals(count: number) {
});
}

export async function getDefaultGroups(defaultStrategy: DefaultStrategy | MockDefaultStrategy): Promise<string[]> {
export async function getDefaultGroups(
defaultStrategy: DefaultStrategy | MockDefaultStrategy
): Promise<string[]> {
const activeGroupsLengthPromise = defaultStrategy.getNumberOfGroups();
let [key] = await defaultStrategy.getGroupsHead();

Expand Down Expand Up @@ -441,7 +439,7 @@ export async function upgradeToMockGroupHealthE2E(
multisigOwner.address,
[groupHealthContract.address],
["0"],
[groupHealthContract.interface.encodeFunctionData("upgradeTo", [mockGroupHealth.address])],
[groupHealthContract.interface.encodeFunctionData("upgradeTo", [mockGroupHealth.address])]
);

return mockGroupHealthFactory.attach(groupHealthContract.address);
Expand Down

0 comments on commit 18ccf95

Please sign in to comment.