Skip to content

Commit 514cf4d

Browse files
authored
Merge pull request #269 from fei-protocol/feat/check-proposal-cleanup
check proposal cleanup
2 parents fd0f3ac + 38fe7f2 commit 514cf4d

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

proposals/dao/fip_34.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ValidateUpgradeFunc
1010
} from '../../types/types';
1111
import { FeiDAOTimelock } from '@custom-types/contracts';
12+
import { getImpersonatedSigner } from '@test/helpers';
1213

1314
chai.use(CBN(ethers.BigNumber));
1415

@@ -51,7 +52,8 @@ export const deploy: DeployUpgradeFunc = async (deployAddress, addresses, loggin
5152
};
5253

5354
export const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
54-
await (await (contracts.feiDAOTimelock as FeiDAOTimelock).rollback()).wait();
55+
const timelock: FeiDAOTimelock = contracts.feiDAOTimelock as FeiDAOTimelock;
56+
await (await timelock.connect(await getImpersonatedSigner(addresses.multisig)).rollback()).wait();
5557
};
5658

5759
export const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {

scripts/utils/checkProposal.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { getAllContracts } from '../../test/integration/setup/loadContracts';
2-
import hre, { ethers } from 'hardhat';
3-
import { time } from '@openzeppelin/test-helpers';
4-
import { NamedContracts, namedContractsToNamedAddresses, UpgradeFuncs } from '../../types/types';
1+
import { getAllContracts, getAllContractAddresses } from '@test/integration/setup/loadContracts';
2+
import { getImpersonatedSigner, time } from '@test/helpers';
3+
import { NamedContracts, UpgradeFuncs } from '@custom-types/types';
54

65
import * as dotenv from 'dotenv';
76

@@ -22,16 +21,26 @@ async function checkProposal() {
2221
throw new Error('DEPLOY_FILE or PROPOSAL_NUMBER env variable not set');
2322
}
2423

24+
// Get the upgrade setup, run and teardown scripts
25+
const proposalFuncs: UpgradeFuncs = await import(`@proposals/dao/${proposalName}`);
26+
2527
const contracts = (await getAllContracts()) as NamedContracts;
2628

27-
const { feiDAO } = contracts;
29+
const contractAddresses = await getAllContractAddresses();
2830

29-
await hre.network.provider.request({
30-
method: 'hardhat_impersonateAccount',
31-
params: [voterAddress]
32-
});
31+
if (process.env.DO_SETUP) {
32+
console.log('Setup');
33+
await proposalFuncs.setup(
34+
contractAddresses,
35+
contracts as unknown as NamedContracts,
36+
contracts as unknown as NamedContracts,
37+
true
38+
);
39+
}
3340

34-
const voterSigner = await ethers.getSigner(voterAddress);
41+
const { feiDAO } = contracts;
42+
43+
const voterSigner = await getImpersonatedSigner(voterAddress);
3544

3645
console.log(`Proposal Number: ${proposalNo}`);
3746

@@ -76,11 +85,6 @@ async function checkProposal() {
7685
await feiDAO['execute(uint256)'](proposalNo);
7786
console.log('Success');
7887

79-
// Get the upgrade setup, run and teardown scripts
80-
const proposalFuncs: UpgradeFuncs = await import(`../../proposals/dao/${proposalName}`);
81-
82-
const contractAddresses = namedContractsToNamedAddresses(contracts);
83-
8488
console.log('Teardown');
8589
await proposalFuncs.teardown(
8690
contractAddresses,

scripts/utils/exec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import hre, { ethers } from 'hardhat';
2-
import { time } from '@openzeppelin/test-helpers';
2+
import { time } from '@test/helpers';
33

44
import * as dotenv from 'dotenv';
55

test/unit/staking/feirari/RewardsDistributorAdmin.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { expectRevert, getAddresses, getCore } from '../../../helpers';
1+
import { expectRevert, getAddresses, getCore, ZERO_ADDRESS } from '@test/helpers';
22
import { expect } from 'chai';
33
import hre, { ethers } from 'hardhat';
44
import { Signer, utils } from 'ethers';
5-
import testHelpers from '@openzeppelin/test-helpers';
6-
import { Core } from '../../../../types/contracts/Core';
7-
import { RewardsDistributorAdmin } from '../../../../types/contracts/RewardsDistributorAdmin';
8-
import { MockRewardsDistributor } from '../../../../types/contracts/MockRewardsDistributor';
5+
import { Core, RewardsDistributorAdmin, MockRewardsDistributor } from '@custom-types/contracts';
96
import { keccak256 } from 'ethers/lib/utils';
107

118
const toBN = ethers.BigNumber.from;
12-
const {
13-
constants: { ZERO_ADDRESS }
14-
} = testHelpers;
159

1610
describe('RewardsDistributorAdmin', function () {
1711
let governorAddress: string;

0 commit comments

Comments
 (0)