|
| 1 | +import { ethers } from 'hardhat'; |
| 2 | +import { expect } from 'chai'; |
| 3 | +import { |
| 4 | + DeployUpgradeFunc, |
| 5 | + NamedAddresses, |
| 6 | + SetupUpgradeFunc, |
| 7 | + TeardownUpgradeFunc, |
| 8 | + ValidateUpgradeFunc |
| 9 | +} from '@custom-types/types'; |
| 10 | +import { getImpersonatedSigner } from '@test/helpers'; |
| 11 | + |
| 12 | +/* |
| 13 | +
|
| 14 | +OA Proposal 97 |
| 15 | +
|
| 16 | +Description: |
| 17 | +
|
| 18 | +Steps: |
| 19 | +1. Deploy Turbo Fuse pool PCV deposit |
| 20 | +2. Transfer $10 million Fei to the PCV Deposit |
| 21 | +3. Deposit the Fei into the pool |
| 22 | +*/ |
| 23 | + |
| 24 | +const fipNumber = '97'; // Change me! |
| 25 | + |
| 26 | +// Do any deployments |
| 27 | +// This should exclusively include new contract deployments |
| 28 | +const deploy: DeployUpgradeFunc = async (deployAddress: string, addresses: NamedAddresses, logging: boolean) => { |
| 29 | + // 1. Deploy compound PCV deposit |
| 30 | + const erc20CompoundPCVDepositFactory = await ethers.getContractFactory('ERC20CompoundPCVDeposit'); |
| 31 | + const turboFusePCVDeposit = await erc20CompoundPCVDepositFactory.deploy(addresses.core, addresses.rariTurboFusePool); |
| 32 | + await turboFusePCVDeposit.deployTransaction.wait(); |
| 33 | + logging && console.log('Turbo PCV Deposit deployed to: ', turboFusePCVDeposit.address); |
| 34 | + |
| 35 | + return { |
| 36 | + turboFusePCVDeposit |
| 37 | + }; |
| 38 | +}; |
| 39 | + |
| 40 | +// Do any setup necessary for running the test. |
| 41 | +// This could include setting up Hardhat to impersonate accounts, |
| 42 | +// ensuring contracts have a specific state, etc. |
| 43 | +const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { |
| 44 | + // feiDAOTimelock is TURBO_ADMIN_ROLE |
| 45 | + const governorSigner = await getImpersonatedSigner(addresses.feiDAOTimelock); |
| 46 | + |
| 47 | + const turboAdminABI = ['function _setWhitelistStatuses(address[] calldata suppliers, bool[] calldata statuses)']; |
| 48 | + const turboAdmin = new ethers.Contract(addresses.turboAdmin, turboAdminABI, governorSigner); |
| 49 | + await turboAdmin._setWhitelistStatuses([contracts.turboFusePCVDeposit.address], [true]); |
| 50 | +}; |
| 51 | + |
| 52 | +// Tears down any changes made in setup() that need to be |
| 53 | +// cleaned up before doing any validation checks. |
| 54 | +const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { |
| 55 | + console.log(`No actions to complete in teardown for fip${fipNumber}`); |
| 56 | +}; |
| 57 | + |
| 58 | +// Run any validations required on the fip using mocha or console logging |
| 59 | +// IE check balances, check state of contracts, etc. |
| 60 | +const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => { |
| 61 | + // Validate 10M Fei was seeded |
| 62 | + const seedAmount = ethers.constants.WeiPerEther.mul(10_000_000); // 10 M |
| 63 | + const pcvBalance = await contracts.turboFusePCVDeposit.balance(); |
| 64 | + expect(pcvBalance).to.equal(seedAmount); |
| 65 | +}; |
| 66 | + |
| 67 | +export { deploy, setup, teardown, validate }; |
0 commit comments